Kernel-Collections.js 329 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Kernel-Collections");
  5. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  8. //>>excludeStart("ide", pragmas.excludeIdeData);
  9. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  10. //>>excludeEnd("ide");
  11. $core.addMethod(
  12. $core.method({
  13. selector: "=",
  14. protocol: "comparing",
  15. fn: function (anAssociation){
  16. var self=this,$self=this;
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. var $3,$2,$5,$4,$6,$1;
  21. $3=$self._class();
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. $ctx1.sendIdx["class"]=1;
  24. //>>excludeEnd("ctx");
  25. $2=$recv($3).__eq($recv(anAssociation)._class());
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. $ctx1.sendIdx["="]=1;
  28. //>>excludeEnd("ctx");
  29. $1=$recv($2)._and_((function(){
  30. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31. return $core.withContext(function($ctx2) {
  32. //>>excludeEnd("ctx");
  33. $5=$self._key();
  34. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35. $ctx2.sendIdx["key"]=1;
  36. //>>excludeEnd("ctx");
  37. $4=$recv($5).__eq($recv(anAssociation)._key());
  38. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39. $ctx2.sendIdx["="]=2;
  40. //>>excludeEnd("ctx");
  41. return $recv($4)._and_((function(){
  42. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43. return $core.withContext(function($ctx3) {
  44. //>>excludeEnd("ctx");
  45. $6=$self._value();
  46. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47. $ctx3.sendIdx["value"]=1;
  48. //>>excludeEnd("ctx");
  49. return $recv($6).__eq($recv(anAssociation)._value());
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52. //>>excludeEnd("ctx");
  53. }));
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56. //>>excludeEnd("ctx");
  57. }));
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. $ctx1.sendIdx["and:"]=1;
  60. //>>excludeEnd("ctx");
  61. return $1;
  62. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  64. //>>excludeEnd("ctx");
  65. },
  66. //>>excludeStart("ide", pragmas.excludeIdeData);
  67. args: ["anAssociation"],
  68. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  69. referencedClasses: [],
  70. //>>excludeEnd("ide");
  71. messageSends: ["and:", "=", "class", "key", "value"]
  72. }),
  73. $globals.Association);
  74. $core.addMethod(
  75. $core.method({
  76. selector: "key",
  77. protocol: "accessing",
  78. fn: function (){
  79. var self=this,$self=this;
  80. return $self["@key"];
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: [],
  84. source: "key\x0a\x09^ key",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. messageSends: []
  88. }),
  89. $globals.Association);
  90. $core.addMethod(
  91. $core.method({
  92. selector: "key:",
  93. protocol: "accessing",
  94. fn: function (aKey){
  95. var self=this,$self=this;
  96. $self["@key"]=aKey;
  97. return self;
  98. },
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: ["aKey"],
  101. source: "key: aKey\x0a\x09key := aKey",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. messageSends: []
  105. }),
  106. $globals.Association);
  107. $core.addMethod(
  108. $core.method({
  109. selector: "printOn:",
  110. protocol: "printing",
  111. fn: function (aStream){
  112. var self=this,$self=this;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. return $core.withContext(function($ctx1) {
  115. //>>excludeEnd("ctx");
  116. $recv($self._key())._printOn_(aStream);
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. $ctx1.sendIdx["printOn:"]=1;
  119. //>>excludeEnd("ctx");
  120. $recv(aStream)._nextPutAll_(" -> ");
  121. $recv($self._value())._printOn_(aStream);
  122. return self;
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  125. //>>excludeEnd("ctx");
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: ["aStream"],
  129. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  133. }),
  134. $globals.Association);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "value",
  138. protocol: "accessing",
  139. fn: function (){
  140. var self=this,$self=this;
  141. return $self["@value"];
  142. },
  143. //>>excludeStart("ide", pragmas.excludeIdeData);
  144. args: [],
  145. source: "value\x0a\x09^ value",
  146. referencedClasses: [],
  147. //>>excludeEnd("ide");
  148. messageSends: []
  149. }),
  150. $globals.Association);
  151. $core.addMethod(
  152. $core.method({
  153. selector: "value:",
  154. protocol: "accessing",
  155. fn: function (aValue){
  156. var self=this,$self=this;
  157. $self["@value"]=aValue;
  158. return self;
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: ["aValue"],
  162. source: "value: aValue\x0a\x09value := aValue",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: []
  166. }),
  167. $globals.Association);
  168. $core.addMethod(
  169. $core.method({
  170. selector: "key:value:",
  171. protocol: "instance creation",
  172. fn: function (aKey,aValue){
  173. var self=this,$self=this;
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. return $core.withContext(function($ctx1) {
  176. //>>excludeEnd("ctx");
  177. var $1;
  178. $1=$self._new();
  179. $recv($1)._key_(aKey);
  180. $recv($1)._value_(aValue);
  181. return $recv($1)._yourself();
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  184. //>>excludeEnd("ctx");
  185. },
  186. //>>excludeStart("ide", pragmas.excludeIdeData);
  187. args: ["aKey", "aValue"],
  188. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  189. referencedClasses: [],
  190. //>>excludeEnd("ide");
  191. messageSends: ["key:", "new", "value:", "yourself"]
  192. }),
  193. $globals.Association.a$cls);
  194. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  195. //>>excludeStart("ide", pragmas.excludeIdeData);
  196. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  197. //>>excludeEnd("ide");
  198. $core.addMethod(
  199. $core.method({
  200. selector: "bucketOfElement:",
  201. protocol: "accessing",
  202. fn: function (anObject){
  203. var self=this,$self=this;
  204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  205. return $core.withContext(function($ctx1) {
  206. //>>excludeEnd("ctx");
  207. var hash = $self['@hashBlock'](anObject);
  208. if (!hash) return null;
  209. var buckets = $self['@buckets'],
  210. bucket = buckets[hash];
  211. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  212. return bucket;
  213. ;
  214. return self;
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  217. //>>excludeEnd("ctx");
  218. },
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["anObject"],
  221. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. messageSends: []
  225. }),
  226. $globals.BucketStore);
  227. $core.addMethod(
  228. $core.method({
  229. selector: "do:",
  230. protocol: "enumerating",
  231. fn: function (aBlock){
  232. var self=this,$self=this;
  233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  234. return $core.withContext(function($ctx1) {
  235. //>>excludeEnd("ctx");
  236. var buckets = $self['@buckets'];
  237. var keys = Object.keys(buckets);
  238. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  239. ;
  240. return self;
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  243. //>>excludeEnd("ctx");
  244. },
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: ["aBlock"],
  247. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. messageSends: []
  251. }),
  252. $globals.BucketStore);
  253. $core.addMethod(
  254. $core.method({
  255. selector: "hashBlock:",
  256. protocol: "accessing",
  257. fn: function (aBlock){
  258. var self=this,$self=this;
  259. $self["@hashBlock"]=aBlock;
  260. return self;
  261. },
  262. //>>excludeStart("ide", pragmas.excludeIdeData);
  263. args: ["aBlock"],
  264. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  265. referencedClasses: [],
  266. //>>excludeEnd("ide");
  267. messageSends: []
  268. }),
  269. $globals.BucketStore);
  270. $core.addMethod(
  271. $core.method({
  272. selector: "initialize",
  273. protocol: "initialization",
  274. fn: function (){
  275. var self=this,$self=this;
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. return $core.withContext(function($ctx1) {
  278. //>>excludeEnd("ctx");
  279. (
  280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  281. $ctx1.supercall = true,
  282. //>>excludeEnd("ctx");
  283. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  285. $ctx1.supercall = false;
  286. //>>excludeEnd("ctx");;
  287. $self._removeAll();
  288. return self;
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  291. //>>excludeEnd("ctx");
  292. },
  293. //>>excludeStart("ide", pragmas.excludeIdeData);
  294. args: [],
  295. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  296. referencedClasses: [],
  297. //>>excludeEnd("ide");
  298. messageSends: ["initialize", "removeAll"]
  299. }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. fn: function (){
  306. var self=this,$self=this;
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx1) {
  309. //>>excludeEnd("ctx");
  310. $self._subclassResponsibility();
  311. return self;
  312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  313. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  314. //>>excludeEnd("ctx");
  315. },
  316. //>>excludeStart("ide", pragmas.excludeIdeData);
  317. args: [],
  318. source: "newBucket\x0a\x09self subclassResponsibility",
  319. referencedClasses: [],
  320. //>>excludeEnd("ide");
  321. messageSends: ["subclassResponsibility"]
  322. }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. fn: function (){
  329. var self=this,$self=this;
  330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  331. return $core.withContext(function($ctx1) {
  332. //>>excludeEnd("ctx");
  333. $self['@buckets'] = Object.create(null);;
  334. return self;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  337. //>>excludeEnd("ctx");
  338. },
  339. //>>excludeStart("ide", pragmas.excludeIdeData);
  340. args: [],
  341. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  342. referencedClasses: [],
  343. //>>excludeEnd("ide");
  344. messageSends: []
  345. }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. fn: function (aBlock){
  352. var self=this,$self=this;
  353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  354. return $core.withContext(function($ctx1) {
  355. //>>excludeEnd("ctx");
  356. var $1;
  357. $1=$self._new();
  358. $recv($1)._hashBlock_(aBlock);
  359. return $recv($1)._yourself();
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  362. //>>excludeEnd("ctx");
  363. },
  364. //>>excludeStart("ide", pragmas.excludeIdeData);
  365. args: ["aBlock"],
  366. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  367. referencedClasses: [],
  368. //>>excludeEnd("ide");
  369. messageSends: ["hashBlock:", "new", "yourself"]
  370. }),
  371. $globals.BucketStore.a$cls);
  372. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  375. //>>excludeEnd("ide");
  376. $core.addMethod(
  377. $core.method({
  378. selector: "newBucket",
  379. protocol: "private",
  380. fn: function (){
  381. var self=this,$self=this;
  382. return [];
  383. },
  384. //>>excludeStart("ide", pragmas.excludeIdeData);
  385. args: [],
  386. source: "newBucket\x0a\x09^ #()",
  387. referencedClasses: [],
  388. //>>excludeEnd("ide");
  389. messageSends: []
  390. }),
  391. $globals.ArrayBucketStore);
  392. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  395. //>>excludeEnd("ide");
  396. $core.addMethod(
  397. $core.method({
  398. selector: ",",
  399. protocol: "copying",
  400. fn: function (aCollection){
  401. var self=this,$self=this;
  402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  403. return $core.withContext(function($ctx1) {
  404. //>>excludeEnd("ctx");
  405. var $1;
  406. $1=$self._copy();
  407. $recv($1)._addAll_(aCollection);
  408. return $recv($1)._yourself();
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  411. //>>excludeEnd("ctx");
  412. },
  413. //>>excludeStart("ide", pragmas.excludeIdeData);
  414. args: ["aCollection"],
  415. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  416. referencedClasses: [],
  417. //>>excludeEnd("ide");
  418. messageSends: ["addAll:", "copy", "yourself"]
  419. }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. fn: function (anObject){
  426. var self=this,$self=this;
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. return $core.withContext(function($ctx1) {
  429. //>>excludeEnd("ctx");
  430. $self._subclassResponsibility();
  431. return self;
  432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  433. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  434. //>>excludeEnd("ctx");
  435. },
  436. //>>excludeStart("ide", pragmas.excludeIdeData);
  437. args: ["anObject"],
  438. source: "add: anObject\x0a\x09self subclassResponsibility",
  439. referencedClasses: [],
  440. //>>excludeEnd("ide");
  441. messageSends: ["subclassResponsibility"]
  442. }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. fn: function (aCollection){
  449. var self=this,$self=this;
  450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  451. return $core.withContext(function($ctx1) {
  452. //>>excludeEnd("ctx");
  453. $recv(aCollection)._do_((function(each){
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. return $core.withContext(function($ctx2) {
  456. //>>excludeEnd("ctx");
  457. return $self._add_(each);
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  460. //>>excludeEnd("ctx");
  461. }));
  462. return aCollection;
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  465. //>>excludeEnd("ctx");
  466. },
  467. //>>excludeStart("ide", pragmas.excludeIdeData);
  468. args: ["aCollection"],
  469. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  470. referencedClasses: [],
  471. //>>excludeEnd("ide");
  472. messageSends: ["do:", "add:"]
  473. }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. fn: function (aBlock){
  480. var self=this,$self=this;
  481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  482. return $core.withContext(function($ctx1) {
  483. //>>excludeEnd("ctx");
  484. var $1;
  485. var $early={};
  486. try {
  487. $self._do_((function(each){
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx2) {
  490. //>>excludeEnd("ctx");
  491. $1=$recv(aBlock)._value_(each);
  492. if(!$core.assert($1)){
  493. throw $early=[false];
  494. }
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  497. //>>excludeEnd("ctx");
  498. }));
  499. return true;
  500. }
  501. catch(e) {if(e===$early)return e[0]; throw e}
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  504. //>>excludeEnd("ctx");
  505. },
  506. //>>excludeStart("ide", pragmas.excludeIdeData);
  507. args: ["aBlock"],
  508. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  509. referencedClasses: [],
  510. //>>excludeEnd("ide");
  511. messageSends: ["do:", "ifFalse:", "value:"]
  512. }),
  513. $globals.Collection);
  514. $core.addMethod(
  515. $core.method({
  516. selector: "anyOne",
  517. protocol: "accessing",
  518. fn: function (){
  519. var self=this,$self=this;
  520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  521. return $core.withContext(function($ctx1) {
  522. //>>excludeEnd("ctx");
  523. var $early={};
  524. try {
  525. $self._ifEmpty_((function(){
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx2) {
  528. //>>excludeEnd("ctx");
  529. return $self._error_("Collection is empty");
  530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  532. //>>excludeEnd("ctx");
  533. }));
  534. $self._do_((function(each){
  535. throw $early=[each];
  536. }));
  537. return self;
  538. }
  539. catch(e) {if(e===$early)return e[0]; throw e}
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  542. //>>excludeEnd("ctx");
  543. },
  544. //>>excludeStart("ide", pragmas.excludeIdeData);
  545. args: [],
  546. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  547. referencedClasses: [],
  548. //>>excludeEnd("ide");
  549. messageSends: ["ifEmpty:", "error:", "do:"]
  550. }),
  551. $globals.Collection);
  552. $core.addMethod(
  553. $core.method({
  554. selector: "anySatisfy:",
  555. protocol: "enumerating",
  556. fn: function (aBlock){
  557. var self=this,$self=this;
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. return $core.withContext(function($ctx1) {
  560. //>>excludeEnd("ctx");
  561. var $1;
  562. var $early={};
  563. try {
  564. $self._do_((function(each){
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. return $core.withContext(function($ctx2) {
  567. //>>excludeEnd("ctx");
  568. $1=$recv(aBlock)._value_(each);
  569. if($core.assert($1)){
  570. throw $early=[true];
  571. }
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  574. //>>excludeEnd("ctx");
  575. }));
  576. return false;
  577. }
  578. catch(e) {if(e===$early)return e[0]; throw e}
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  581. //>>excludeEnd("ctx");
  582. },
  583. //>>excludeStart("ide", pragmas.excludeIdeData);
  584. args: ["aBlock"],
  585. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  586. referencedClasses: [],
  587. //>>excludeEnd("ide");
  588. messageSends: ["do:", "ifTrue:", "value:"]
  589. }),
  590. $globals.Collection);
  591. $core.addMethod(
  592. $core.method({
  593. selector: "asArray",
  594. protocol: "converting",
  595. fn: function (){
  596. var self=this,$self=this;
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. return $core.withContext(function($ctx1) {
  599. //>>excludeEnd("ctx");
  600. return $recv($globals.Array)._withAll_(self);
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "asArray\x0a\x09^ Array withAll: self",
  608. referencedClasses: ["Array"],
  609. //>>excludeEnd("ide");
  610. messageSends: ["withAll:"]
  611. }),
  612. $globals.Collection);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "asJavaScriptObject",
  616. protocol: "converting",
  617. fn: function (){
  618. var self=this,$self=this;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. return $core.withContext(function($ctx1) {
  621. //>>excludeEnd("ctx");
  622. return $recv($self._asArray())._collect_((function(each){
  623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  624. return $core.withContext(function($ctx2) {
  625. //>>excludeEnd("ctx");
  626. return $recv(each)._asJavaScriptObject();
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  629. //>>excludeEnd("ctx");
  630. }));
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  641. }),
  642. $globals.Collection);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "asOrderedCollection",
  646. protocol: "converting",
  647. fn: function (){
  648. var self=this,$self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. return $self._asArray();
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  655. //>>excludeEnd("ctx");
  656. },
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. args: [],
  659. source: "asOrderedCollection\x0a\x09^ self asArray",
  660. referencedClasses: [],
  661. //>>excludeEnd("ide");
  662. messageSends: ["asArray"]
  663. }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asSet",
  668. protocol: "converting",
  669. fn: function (){
  670. var self=this,$self=this;
  671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  672. return $core.withContext(function($ctx1) {
  673. //>>excludeEnd("ctx");
  674. return $recv($globals.Set)._withAll_(self);
  675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  676. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  677. //>>excludeEnd("ctx");
  678. },
  679. //>>excludeStart("ide", pragmas.excludeIdeData);
  680. args: [],
  681. source: "asSet\x0a\x09^ Set withAll: self",
  682. referencedClasses: ["Set"],
  683. //>>excludeEnd("ide");
  684. messageSends: ["withAll:"]
  685. }),
  686. $globals.Collection);
  687. $core.addMethod(
  688. $core.method({
  689. selector: "collect:",
  690. protocol: "enumerating",
  691. fn: function (aBlock){
  692. var self=this,$self=this;
  693. var stream;
  694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  695. return $core.withContext(function($ctx1) {
  696. //>>excludeEnd("ctx");
  697. stream=$recv($recv($self._class())._new())._writeStream();
  698. $self._do_((function(each){
  699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  700. return $core.withContext(function($ctx2) {
  701. //>>excludeEnd("ctx");
  702. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  705. //>>excludeEnd("ctx");
  706. }));
  707. return $recv(stream)._contents();
  708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  709. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  710. //>>excludeEnd("ctx");
  711. },
  712. //>>excludeStart("ide", pragmas.excludeIdeData);
  713. args: ["aBlock"],
  714. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  715. referencedClasses: [],
  716. //>>excludeEnd("ide");
  717. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  718. }),
  719. $globals.Collection);
  720. $core.addMethod(
  721. $core.method({
  722. selector: "copyWith:",
  723. protocol: "copying",
  724. fn: function (anObject){
  725. var self=this,$self=this;
  726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  727. return $core.withContext(function($ctx1) {
  728. //>>excludeEnd("ctx");
  729. var $1;
  730. $1=$self._copy();
  731. $recv($1)._add_(anObject);
  732. return $recv($1)._yourself();
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  735. //>>excludeEnd("ctx");
  736. },
  737. //>>excludeStart("ide", pragmas.excludeIdeData);
  738. args: ["anObject"],
  739. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  740. referencedClasses: [],
  741. //>>excludeEnd("ide");
  742. messageSends: ["add:", "copy", "yourself"]
  743. }),
  744. $globals.Collection);
  745. $core.addMethod(
  746. $core.method({
  747. selector: "copyWithAll:",
  748. protocol: "copying",
  749. fn: function (aCollection){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._addAll_(aCollection);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  760. //>>excludeEnd("ctx");
  761. },
  762. //>>excludeStart("ide", pragmas.excludeIdeData);
  763. args: ["aCollection"],
  764. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  765. referencedClasses: [],
  766. //>>excludeEnd("ide");
  767. messageSends: ["addAll:", "copy", "yourself"]
  768. }),
  769. $globals.Collection);
  770. $core.addMethod(
  771. $core.method({
  772. selector: "copyWithout:",
  773. protocol: "copying",
  774. fn: function (anObject){
  775. var self=this,$self=this;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. return $core.withContext(function($ctx1) {
  778. //>>excludeEnd("ctx");
  779. return $self._reject_((function(each){
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx2) {
  782. //>>excludeEnd("ctx");
  783. return $recv(each).__eq(anObject);
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  786. //>>excludeEnd("ctx");
  787. }));
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  790. //>>excludeEnd("ctx");
  791. },
  792. //>>excludeStart("ide", pragmas.excludeIdeData);
  793. args: ["anObject"],
  794. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  795. referencedClasses: [],
  796. //>>excludeEnd("ide");
  797. messageSends: ["reject:", "="]
  798. }),
  799. $globals.Collection);
  800. $core.addMethod(
  801. $core.method({
  802. selector: "copyWithoutAll:",
  803. protocol: "copying",
  804. fn: function (aCollection){
  805. var self=this,$self=this;
  806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  807. return $core.withContext(function($ctx1) {
  808. //>>excludeEnd("ctx");
  809. return $self._reject_((function(each){
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx2) {
  812. //>>excludeEnd("ctx");
  813. return $recv(aCollection)._includes_(each);
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  816. //>>excludeEnd("ctx");
  817. }));
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  820. //>>excludeEnd("ctx");
  821. },
  822. //>>excludeStart("ide", pragmas.excludeIdeData);
  823. args: ["aCollection"],
  824. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  825. referencedClasses: [],
  826. //>>excludeEnd("ide");
  827. messageSends: ["reject:", "includes:"]
  828. }),
  829. $globals.Collection);
  830. $core.addMethod(
  831. $core.method({
  832. selector: "deepCopy",
  833. protocol: "copying",
  834. fn: function (){
  835. var self=this,$self=this;
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. return $core.withContext(function($ctx1) {
  838. //>>excludeEnd("ctx");
  839. return $self._collect_((function(each){
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx2) {
  842. //>>excludeEnd("ctx");
  843. return $recv(each)._deepCopy();
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  846. //>>excludeEnd("ctx");
  847. }));
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  850. //>>excludeEnd("ctx");
  851. },
  852. //>>excludeStart("ide", pragmas.excludeIdeData);
  853. args: [],
  854. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  855. referencedClasses: [],
  856. //>>excludeEnd("ide");
  857. messageSends: ["collect:", "deepCopy"]
  858. }),
  859. $globals.Collection);
  860. $core.addMethod(
  861. $core.method({
  862. selector: "detect:",
  863. protocol: "enumerating",
  864. fn: function (aBlock){
  865. var self=this,$self=this;
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. return $core.withContext(function($ctx1) {
  868. //>>excludeEnd("ctx");
  869. return $self._detect_ifNone_(aBlock,(function(){
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx2) {
  872. //>>excludeEnd("ctx");
  873. return $self._errorNotFound();
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  876. //>>excludeEnd("ctx");
  877. }));
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  880. //>>excludeEnd("ctx");
  881. },
  882. //>>excludeStart("ide", pragmas.excludeIdeData);
  883. args: ["aBlock"],
  884. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  885. referencedClasses: [],
  886. //>>excludeEnd("ide");
  887. messageSends: ["detect:ifNone:", "errorNotFound"]
  888. }),
  889. $globals.Collection);
  890. $core.addMethod(
  891. $core.method({
  892. selector: "detect:ifNone:",
  893. protocol: "enumerating",
  894. fn: function (aBlock,anotherBlock){
  895. var self=this,$self=this;
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. return $core.withContext(function($ctx1) {
  898. //>>excludeEnd("ctx");
  899. $self._subclassResponsibility();
  900. return self;
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  903. //>>excludeEnd("ctx");
  904. },
  905. //>>excludeStart("ide", pragmas.excludeIdeData);
  906. args: ["aBlock", "anotherBlock"],
  907. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  908. referencedClasses: [],
  909. //>>excludeEnd("ide");
  910. messageSends: ["subclassResponsibility"]
  911. }),
  912. $globals.Collection);
  913. $core.addMethod(
  914. $core.method({
  915. selector: "do:",
  916. protocol: "enumerating",
  917. fn: function (aBlock){
  918. var self=this,$self=this;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. return $core.withContext(function($ctx1) {
  921. //>>excludeEnd("ctx");
  922. $self._subclassResponsibility();
  923. return self;
  924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  925. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  926. //>>excludeEnd("ctx");
  927. },
  928. //>>excludeStart("ide", pragmas.excludeIdeData);
  929. args: ["aBlock"],
  930. source: "do: aBlock\x0a\x09self subclassResponsibility",
  931. referencedClasses: [],
  932. //>>excludeEnd("ide");
  933. messageSends: ["subclassResponsibility"]
  934. }),
  935. $globals.Collection);
  936. $core.addMethod(
  937. $core.method({
  938. selector: "do:separatedBy:",
  939. protocol: "enumerating",
  940. fn: function (aBlock,anotherBlock){
  941. var self=this,$self=this;
  942. var actionBeforeElement;
  943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  944. return $core.withContext(function($ctx1) {
  945. //>>excludeEnd("ctx");
  946. actionBeforeElement=(function(){
  947. actionBeforeElement=anotherBlock;
  948. return actionBeforeElement;
  949. });
  950. $self._do_((function(each){
  951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  952. return $core.withContext(function($ctx2) {
  953. //>>excludeEnd("ctx");
  954. $recv(actionBeforeElement)._value();
  955. return $recv(aBlock)._value_(each);
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  958. //>>excludeEnd("ctx");
  959. }));
  960. return self;
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  963. //>>excludeEnd("ctx");
  964. },
  965. //>>excludeStart("ide", pragmas.excludeIdeData);
  966. args: ["aBlock", "anotherBlock"],
  967. 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 ]",
  968. referencedClasses: [],
  969. //>>excludeEnd("ide");
  970. messageSends: ["do:", "value", "value:"]
  971. }),
  972. $globals.Collection);
  973. $core.addMethod(
  974. $core.method({
  975. selector: "errorNotFound",
  976. protocol: "error handling",
  977. fn: function (){
  978. var self=this,$self=this;
  979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  980. return $core.withContext(function($ctx1) {
  981. //>>excludeEnd("ctx");
  982. $self._error_("Object is not in the collection");
  983. return self;
  984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  985. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  986. //>>excludeEnd("ctx");
  987. },
  988. //>>excludeStart("ide", pragmas.excludeIdeData);
  989. args: [],
  990. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  991. referencedClasses: [],
  992. //>>excludeEnd("ide");
  993. messageSends: ["error:"]
  994. }),
  995. $globals.Collection);
  996. $core.addMethod(
  997. $core.method({
  998. selector: "ifEmpty:",
  999. protocol: "testing",
  1000. fn: function (aBlock){
  1001. var self=this,$self=this;
  1002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1003. return $core.withContext(function($ctx1) {
  1004. //>>excludeEnd("ctx");
  1005. var $1;
  1006. $1=$self._isEmpty();
  1007. if($core.assert($1)){
  1008. return $recv(aBlock)._value();
  1009. } else {
  1010. return self;
  1011. }
  1012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1013. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1014. //>>excludeEnd("ctx");
  1015. },
  1016. //>>excludeStart("ide", pragmas.excludeIdeData);
  1017. args: ["aBlock"],
  1018. 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 ]",
  1019. referencedClasses: [],
  1020. //>>excludeEnd("ide");
  1021. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1022. }),
  1023. $globals.Collection);
  1024. $core.addMethod(
  1025. $core.method({
  1026. selector: "ifEmpty:ifNotEmpty:",
  1027. protocol: "testing",
  1028. fn: function (aBlock,anotherBlock){
  1029. var self=this,$self=this;
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. return $core.withContext(function($ctx1) {
  1032. //>>excludeEnd("ctx");
  1033. var $1;
  1034. $1=$self._isEmpty();
  1035. if($core.assert($1)){
  1036. return $recv(aBlock)._value();
  1037. } else {
  1038. return $recv(anotherBlock)._value_(self);
  1039. }
  1040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1041. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1042. //>>excludeEnd("ctx");
  1043. },
  1044. //>>excludeStart("ide", pragmas.excludeIdeData);
  1045. args: ["aBlock", "anotherBlock"],
  1046. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1047. referencedClasses: [],
  1048. //>>excludeEnd("ide");
  1049. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1050. }),
  1051. $globals.Collection);
  1052. $core.addMethod(
  1053. $core.method({
  1054. selector: "ifNotEmpty:",
  1055. protocol: "testing",
  1056. fn: function (aBlock){
  1057. var self=this,$self=this;
  1058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1059. return $core.withContext(function($ctx1) {
  1060. //>>excludeEnd("ctx");
  1061. var $1;
  1062. $1=$self._notEmpty();
  1063. if($core.assert($1)){
  1064. return $recv(aBlock)._value_(self);
  1065. } else {
  1066. return self;
  1067. }
  1068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1069. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1070. //>>excludeEnd("ctx");
  1071. },
  1072. //>>excludeStart("ide", pragmas.excludeIdeData);
  1073. args: ["aBlock"],
  1074. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1075. referencedClasses: [],
  1076. //>>excludeEnd("ide");
  1077. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1078. }),
  1079. $globals.Collection);
  1080. $core.addMethod(
  1081. $core.method({
  1082. selector: "ifNotEmpty:ifEmpty:",
  1083. protocol: "testing",
  1084. fn: function (aBlock,anotherBlock){
  1085. var self=this,$self=this;
  1086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1087. return $core.withContext(function($ctx1) {
  1088. //>>excludeEnd("ctx");
  1089. var $1;
  1090. $1=$self._notEmpty();
  1091. if($core.assert($1)){
  1092. return $recv(aBlock)._value_(self);
  1093. } else {
  1094. return $recv(anotherBlock)._value();
  1095. }
  1096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1097. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1098. //>>excludeEnd("ctx");
  1099. },
  1100. //>>excludeStart("ide", pragmas.excludeIdeData);
  1101. args: ["aBlock", "anotherBlock"],
  1102. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1103. referencedClasses: [],
  1104. //>>excludeEnd("ide");
  1105. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1106. }),
  1107. $globals.Collection);
  1108. $core.addMethod(
  1109. $core.method({
  1110. selector: "includes:",
  1111. protocol: "testing",
  1112. fn: function (anObject){
  1113. var self=this,$self=this;
  1114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1115. return $core.withContext(function($ctx1) {
  1116. //>>excludeEnd("ctx");
  1117. return $self._anySatisfy_((function(each){
  1118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1119. return $core.withContext(function($ctx2) {
  1120. //>>excludeEnd("ctx");
  1121. return $recv(each).__eq(anObject);
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1124. //>>excludeEnd("ctx");
  1125. }));
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1128. //>>excludeEnd("ctx");
  1129. },
  1130. //>>excludeStart("ide", pragmas.excludeIdeData);
  1131. args: ["anObject"],
  1132. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1133. referencedClasses: [],
  1134. //>>excludeEnd("ide");
  1135. messageSends: ["anySatisfy:", "="]
  1136. }),
  1137. $globals.Collection);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "inject:into:",
  1141. protocol: "enumerating",
  1142. fn: function (anObject,aBlock){
  1143. var self=this,$self=this;
  1144. var result;
  1145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1146. return $core.withContext(function($ctx1) {
  1147. //>>excludeEnd("ctx");
  1148. result=anObject;
  1149. $self._do_((function(each){
  1150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1151. return $core.withContext(function($ctx2) {
  1152. //>>excludeEnd("ctx");
  1153. result=$recv(aBlock)._value_value_(result,each);
  1154. return result;
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1157. //>>excludeEnd("ctx");
  1158. }));
  1159. return result;
  1160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1161. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1162. //>>excludeEnd("ctx");
  1163. },
  1164. //>>excludeStart("ide", pragmas.excludeIdeData);
  1165. args: ["anObject", "aBlock"],
  1166. 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",
  1167. referencedClasses: [],
  1168. //>>excludeEnd("ide");
  1169. messageSends: ["do:", "value:value:"]
  1170. }),
  1171. $globals.Collection);
  1172. $core.addMethod(
  1173. $core.method({
  1174. selector: "intersection:",
  1175. protocol: "enumerating",
  1176. fn: function (aCollection){
  1177. var self=this,$self=this;
  1178. var set,outputSet;
  1179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1180. return $core.withContext(function($ctx1) {
  1181. //>>excludeEnd("ctx");
  1182. var $2,$1;
  1183. set=$self._asSet();
  1184. outputSet=$recv($globals.Set)._new();
  1185. $recv(aCollection)._do_((function(each){
  1186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1187. return $core.withContext(function($ctx2) {
  1188. //>>excludeEnd("ctx");
  1189. $2=$recv(set)._includes_(each);
  1190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1191. $ctx2.sendIdx["includes:"]=1;
  1192. //>>excludeEnd("ctx");
  1193. $1=$recv($2)._and_((function(){
  1194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1195. return $core.withContext(function($ctx3) {
  1196. //>>excludeEnd("ctx");
  1197. return $recv($recv(outputSet)._includes_(each))._not();
  1198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1199. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1200. //>>excludeEnd("ctx");
  1201. }));
  1202. if($core.assert($1)){
  1203. return $recv(outputSet)._add_(each);
  1204. }
  1205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1207. //>>excludeEnd("ctx");
  1208. }));
  1209. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1212. //>>excludeEnd("ctx");
  1213. },
  1214. //>>excludeStart("ide", pragmas.excludeIdeData);
  1215. args: ["aCollection"],
  1216. 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",
  1217. referencedClasses: ["Set"],
  1218. //>>excludeEnd("ide");
  1219. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1220. }),
  1221. $globals.Collection);
  1222. $core.addMethod(
  1223. $core.method({
  1224. selector: "isEmpty",
  1225. protocol: "testing",
  1226. fn: function (){
  1227. var self=this,$self=this;
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. return $core.withContext(function($ctx1) {
  1230. //>>excludeEnd("ctx");
  1231. return $recv($self._size()).__eq((0));
  1232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1233. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1234. //>>excludeEnd("ctx");
  1235. },
  1236. //>>excludeStart("ide", pragmas.excludeIdeData);
  1237. args: [],
  1238. source: "isEmpty\x0a\x09^ self size = 0",
  1239. referencedClasses: [],
  1240. //>>excludeEnd("ide");
  1241. messageSends: ["=", "size"]
  1242. }),
  1243. $globals.Collection);
  1244. $core.addMethod(
  1245. $core.method({
  1246. selector: "noneSatisfy:",
  1247. protocol: "enumerating",
  1248. fn: function (aBlock){
  1249. var self=this,$self=this;
  1250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1251. return $core.withContext(function($ctx1) {
  1252. //>>excludeEnd("ctx");
  1253. var $1;
  1254. var $early={};
  1255. try {
  1256. $self._do_((function(item){
  1257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1258. return $core.withContext(function($ctx2) {
  1259. //>>excludeEnd("ctx");
  1260. $1=$recv(aBlock)._value_(item);
  1261. if($core.assert($1)){
  1262. throw $early=[false];
  1263. }
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1266. //>>excludeEnd("ctx");
  1267. }));
  1268. return true;
  1269. }
  1270. catch(e) {if(e===$early)return e[0]; throw e}
  1271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1272. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1273. //>>excludeEnd("ctx");
  1274. },
  1275. //>>excludeStart("ide", pragmas.excludeIdeData);
  1276. args: ["aBlock"],
  1277. 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",
  1278. referencedClasses: [],
  1279. //>>excludeEnd("ide");
  1280. messageSends: ["do:", "ifTrue:", "value:"]
  1281. }),
  1282. $globals.Collection);
  1283. $core.addMethod(
  1284. $core.method({
  1285. selector: "notEmpty",
  1286. protocol: "testing",
  1287. fn: function (){
  1288. var self=this,$self=this;
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. return $core.withContext(function($ctx1) {
  1291. //>>excludeEnd("ctx");
  1292. return $recv($self._isEmpty())._not();
  1293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1294. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1295. //>>excludeEnd("ctx");
  1296. },
  1297. //>>excludeStart("ide", pragmas.excludeIdeData);
  1298. args: [],
  1299. source: "notEmpty\x0a\x09^ self isEmpty not",
  1300. referencedClasses: [],
  1301. //>>excludeEnd("ide");
  1302. messageSends: ["not", "isEmpty"]
  1303. }),
  1304. $globals.Collection);
  1305. $core.addMethod(
  1306. $core.method({
  1307. selector: "occurrencesOf:",
  1308. protocol: "accessing",
  1309. fn: function (anObject){
  1310. var self=this,$self=this;
  1311. var tally;
  1312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1313. return $core.withContext(function($ctx1) {
  1314. //>>excludeEnd("ctx");
  1315. var $1;
  1316. tally=(0);
  1317. $self._do_((function(each){
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. return $core.withContext(function($ctx2) {
  1320. //>>excludeEnd("ctx");
  1321. $1=$recv(anObject).__eq(each);
  1322. if($core.assert($1)){
  1323. tally=$recv(tally).__plus((1));
  1324. return tally;
  1325. }
  1326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1328. //>>excludeEnd("ctx");
  1329. }));
  1330. return tally;
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1333. //>>excludeEnd("ctx");
  1334. },
  1335. //>>excludeStart("ide", pragmas.excludeIdeData);
  1336. args: ["anObject"],
  1337. 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",
  1338. referencedClasses: [],
  1339. //>>excludeEnd("ide");
  1340. messageSends: ["do:", "ifTrue:", "=", "+"]
  1341. }),
  1342. $globals.Collection);
  1343. $core.addMethod(
  1344. $core.method({
  1345. selector: "putOn:",
  1346. protocol: "streaming",
  1347. fn: function (aStream){
  1348. var self=this,$self=this;
  1349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1350. return $core.withContext(function($ctx1) {
  1351. //>>excludeEnd("ctx");
  1352. $self._do_((function(each){
  1353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1354. return $core.withContext(function($ctx2) {
  1355. //>>excludeEnd("ctx");
  1356. return $recv(each)._putOn_(aStream);
  1357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1359. //>>excludeEnd("ctx");
  1360. }));
  1361. return self;
  1362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1363. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1364. //>>excludeEnd("ctx");
  1365. },
  1366. //>>excludeStart("ide", pragmas.excludeIdeData);
  1367. args: ["aStream"],
  1368. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1369. referencedClasses: [],
  1370. //>>excludeEnd("ide");
  1371. messageSends: ["do:", "putOn:"]
  1372. }),
  1373. $globals.Collection);
  1374. $core.addMethod(
  1375. $core.method({
  1376. selector: "reject:",
  1377. protocol: "enumerating",
  1378. fn: function (aBlock){
  1379. var self=this,$self=this;
  1380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1381. return $core.withContext(function($ctx1) {
  1382. //>>excludeEnd("ctx");
  1383. return $self._select_((function(each){
  1384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1385. return $core.withContext(function($ctx2) {
  1386. //>>excludeEnd("ctx");
  1387. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1390. //>>excludeEnd("ctx");
  1391. }));
  1392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1393. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1394. //>>excludeEnd("ctx");
  1395. },
  1396. //>>excludeStart("ide", pragmas.excludeIdeData);
  1397. args: ["aBlock"],
  1398. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1399. referencedClasses: [],
  1400. //>>excludeEnd("ide");
  1401. messageSends: ["select:", "=", "value:"]
  1402. }),
  1403. $globals.Collection);
  1404. $core.addMethod(
  1405. $core.method({
  1406. selector: "remove:",
  1407. protocol: "adding/removing",
  1408. fn: function (anObject){
  1409. var self=this,$self=this;
  1410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1411. return $core.withContext(function($ctx1) {
  1412. //>>excludeEnd("ctx");
  1413. return $self._remove_ifAbsent_(anObject,(function(){
  1414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1415. return $core.withContext(function($ctx2) {
  1416. //>>excludeEnd("ctx");
  1417. return $self._errorNotFound();
  1418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1419. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1420. //>>excludeEnd("ctx");
  1421. }));
  1422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1423. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1424. //>>excludeEnd("ctx");
  1425. },
  1426. //>>excludeStart("ide", pragmas.excludeIdeData);
  1427. args: ["anObject"],
  1428. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1429. referencedClasses: [],
  1430. //>>excludeEnd("ide");
  1431. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1432. }),
  1433. $globals.Collection);
  1434. $core.addMethod(
  1435. $core.method({
  1436. selector: "remove:ifAbsent:",
  1437. protocol: "adding/removing",
  1438. fn: function (anObject,aBlock){
  1439. var self=this,$self=this;
  1440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1441. return $core.withContext(function($ctx1) {
  1442. //>>excludeEnd("ctx");
  1443. $self._subclassResponsibility();
  1444. return self;
  1445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1446. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1447. //>>excludeEnd("ctx");
  1448. },
  1449. //>>excludeStart("ide", pragmas.excludeIdeData);
  1450. args: ["anObject", "aBlock"],
  1451. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1452. referencedClasses: [],
  1453. //>>excludeEnd("ide");
  1454. messageSends: ["subclassResponsibility"]
  1455. }),
  1456. $globals.Collection);
  1457. $core.addMethod(
  1458. $core.method({
  1459. selector: "removeAll",
  1460. protocol: "adding/removing",
  1461. fn: function (){
  1462. var self=this,$self=this;
  1463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1464. return $core.withContext(function($ctx1) {
  1465. //>>excludeEnd("ctx");
  1466. $self._subclassResponsibility();
  1467. return self;
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1470. //>>excludeEnd("ctx");
  1471. },
  1472. //>>excludeStart("ide", pragmas.excludeIdeData);
  1473. args: [],
  1474. source: "removeAll\x0a\x09self subclassResponsibility",
  1475. referencedClasses: [],
  1476. //>>excludeEnd("ide");
  1477. messageSends: ["subclassResponsibility"]
  1478. }),
  1479. $globals.Collection);
  1480. $core.addMethod(
  1481. $core.method({
  1482. selector: "select:",
  1483. protocol: "enumerating",
  1484. fn: function (aBlock){
  1485. var self=this,$self=this;
  1486. var stream;
  1487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1488. return $core.withContext(function($ctx1) {
  1489. //>>excludeEnd("ctx");
  1490. var $1;
  1491. stream=$recv($recv($self._class())._new())._writeStream();
  1492. $self._do_((function(each){
  1493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1494. return $core.withContext(function($ctx2) {
  1495. //>>excludeEnd("ctx");
  1496. $1=$recv(aBlock)._value_(each);
  1497. if($core.assert($1)){
  1498. return $recv(stream)._nextPut_(each);
  1499. }
  1500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1502. //>>excludeEnd("ctx");
  1503. }));
  1504. return $recv(stream)._contents();
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1507. //>>excludeEnd("ctx");
  1508. },
  1509. //>>excludeStart("ide", pragmas.excludeIdeData);
  1510. args: ["aBlock"],
  1511. 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",
  1512. referencedClasses: [],
  1513. //>>excludeEnd("ide");
  1514. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1515. }),
  1516. $globals.Collection);
  1517. $core.addMethod(
  1518. $core.method({
  1519. selector: "select:thenCollect:",
  1520. protocol: "enumerating",
  1521. fn: function (selectBlock,collectBlock){
  1522. var self=this,$self=this;
  1523. var stream;
  1524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1525. return $core.withContext(function($ctx1) {
  1526. //>>excludeEnd("ctx");
  1527. var $1;
  1528. stream=$recv($recv($self._class())._new())._writeStream();
  1529. $self._do_((function(each){
  1530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1531. return $core.withContext(function($ctx2) {
  1532. //>>excludeEnd("ctx");
  1533. $1=$recv(selectBlock)._value_(each);
  1534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1535. $ctx2.sendIdx["value:"]=1;
  1536. //>>excludeEnd("ctx");
  1537. if($core.assert($1)){
  1538. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1539. }
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1542. //>>excludeEnd("ctx");
  1543. }));
  1544. return $recv(stream)._contents();
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1547. //>>excludeEnd("ctx");
  1548. },
  1549. //>>excludeStart("ide", pragmas.excludeIdeData);
  1550. args: ["selectBlock", "collectBlock"],
  1551. 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",
  1552. referencedClasses: [],
  1553. //>>excludeEnd("ide");
  1554. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1555. }),
  1556. $globals.Collection);
  1557. $core.addMethod(
  1558. $core.method({
  1559. selector: "shallowCopy",
  1560. protocol: "copying",
  1561. fn: function (){
  1562. var self=this,$self=this;
  1563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1564. return $core.withContext(function($ctx1) {
  1565. //>>excludeEnd("ctx");
  1566. return $self._collect_((function(each){
  1567. return each;
  1568. }));
  1569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1570. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1571. //>>excludeEnd("ctx");
  1572. },
  1573. //>>excludeStart("ide", pragmas.excludeIdeData);
  1574. args: [],
  1575. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1576. referencedClasses: [],
  1577. //>>excludeEnd("ide");
  1578. messageSends: ["collect:"]
  1579. }),
  1580. $globals.Collection);
  1581. $core.addMethod(
  1582. $core.method({
  1583. selector: "single",
  1584. protocol: "accessing",
  1585. fn: function (){
  1586. var self=this,$self=this;
  1587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1588. return $core.withContext(function($ctx1) {
  1589. //>>excludeEnd("ctx");
  1590. var $1;
  1591. $self._ifEmpty_((function(){
  1592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1593. return $core.withContext(function($ctx2) {
  1594. //>>excludeEnd("ctx");
  1595. return $self._error_("Collection is empty");
  1596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1597. $ctx2.sendIdx["error:"]=1;
  1598. //>>excludeEnd("ctx");
  1599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1601. //>>excludeEnd("ctx");
  1602. }));
  1603. $1=$recv($self._size()).__gt((1));
  1604. if($core.assert($1)){
  1605. $self._error_("Collection holds more than one element");
  1606. }
  1607. return $self._anyOne();
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1610. //>>excludeEnd("ctx");
  1611. },
  1612. //>>excludeStart("ide", pragmas.excludeIdeData);
  1613. args: [],
  1614. 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",
  1615. referencedClasses: [],
  1616. //>>excludeEnd("ide");
  1617. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1618. }),
  1619. $globals.Collection);
  1620. $core.addMethod(
  1621. $core.method({
  1622. selector: "size",
  1623. protocol: "accessing",
  1624. fn: function (){
  1625. var self=this,$self=this;
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. return $core.withContext(function($ctx1) {
  1628. //>>excludeEnd("ctx");
  1629. $self._subclassResponsibility();
  1630. return self;
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1633. //>>excludeEnd("ctx");
  1634. },
  1635. //>>excludeStart("ide", pragmas.excludeIdeData);
  1636. args: [],
  1637. source: "size\x0a\x09self subclassResponsibility",
  1638. referencedClasses: [],
  1639. //>>excludeEnd("ide");
  1640. messageSends: ["subclassResponsibility"]
  1641. }),
  1642. $globals.Collection);
  1643. $core.addMethod(
  1644. $core.method({
  1645. selector: "classTag",
  1646. protocol: "accessing",
  1647. fn: function (){
  1648. var self=this,$self=this;
  1649. return "collection";
  1650. },
  1651. //>>excludeStart("ide", pragmas.excludeIdeData);
  1652. args: [],
  1653. 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'",
  1654. referencedClasses: [],
  1655. //>>excludeEnd("ide");
  1656. messageSends: []
  1657. }),
  1658. $globals.Collection.a$cls);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "new:",
  1662. protocol: "instance creation",
  1663. fn: function (anInteger){
  1664. var self=this,$self=this;
  1665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1666. return $core.withContext(function($ctx1) {
  1667. //>>excludeEnd("ctx");
  1668. return $self._new();
  1669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1670. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1671. //>>excludeEnd("ctx");
  1672. },
  1673. //>>excludeStart("ide", pragmas.excludeIdeData);
  1674. args: ["anInteger"],
  1675. source: "new: anInteger\x0a\x09^ self new",
  1676. referencedClasses: [],
  1677. //>>excludeEnd("ide");
  1678. messageSends: ["new"]
  1679. }),
  1680. $globals.Collection.a$cls);
  1681. $core.addMethod(
  1682. $core.method({
  1683. selector: "with:",
  1684. protocol: "instance creation",
  1685. fn: function (anObject){
  1686. var self=this,$self=this;
  1687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1688. return $core.withContext(function($ctx1) {
  1689. //>>excludeEnd("ctx");
  1690. var $1;
  1691. $1=$self._new();
  1692. $recv($1)._add_(anObject);
  1693. return $recv($1)._yourself();
  1694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1695. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1696. //>>excludeEnd("ctx");
  1697. },
  1698. //>>excludeStart("ide", pragmas.excludeIdeData);
  1699. args: ["anObject"],
  1700. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1701. referencedClasses: [],
  1702. //>>excludeEnd("ide");
  1703. messageSends: ["add:", "new", "yourself"]
  1704. }),
  1705. $globals.Collection.a$cls);
  1706. $core.addMethod(
  1707. $core.method({
  1708. selector: "with:with:",
  1709. protocol: "instance creation",
  1710. fn: function (anObject,anotherObject){
  1711. var self=this,$self=this;
  1712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1713. return $core.withContext(function($ctx1) {
  1714. //>>excludeEnd("ctx");
  1715. var $1;
  1716. $1=$self._new();
  1717. $recv($1)._add_(anObject);
  1718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1719. $ctx1.sendIdx["add:"]=1;
  1720. //>>excludeEnd("ctx");
  1721. $recv($1)._add_(anotherObject);
  1722. return $recv($1)._yourself();
  1723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1724. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1725. //>>excludeEnd("ctx");
  1726. },
  1727. //>>excludeStart("ide", pragmas.excludeIdeData);
  1728. args: ["anObject", "anotherObject"],
  1729. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1730. referencedClasses: [],
  1731. //>>excludeEnd("ide");
  1732. messageSends: ["add:", "new", "yourself"]
  1733. }),
  1734. $globals.Collection.a$cls);
  1735. $core.addMethod(
  1736. $core.method({
  1737. selector: "with:with:with:",
  1738. protocol: "instance creation",
  1739. fn: function (firstObject,secondObject,thirdObject){
  1740. var self=this,$self=this;
  1741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1742. return $core.withContext(function($ctx1) {
  1743. //>>excludeEnd("ctx");
  1744. var $1;
  1745. $1=$self._new();
  1746. $recv($1)._add_(firstObject);
  1747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1748. $ctx1.sendIdx["add:"]=1;
  1749. //>>excludeEnd("ctx");
  1750. $recv($1)._add_(secondObject);
  1751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1752. $ctx1.sendIdx["add:"]=2;
  1753. //>>excludeEnd("ctx");
  1754. $recv($1)._add_(thirdObject);
  1755. return $recv($1)._yourself();
  1756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1757. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1758. //>>excludeEnd("ctx");
  1759. },
  1760. //>>excludeStart("ide", pragmas.excludeIdeData);
  1761. args: ["firstObject", "secondObject", "thirdObject"],
  1762. 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",
  1763. referencedClasses: [],
  1764. //>>excludeEnd("ide");
  1765. messageSends: ["add:", "new", "yourself"]
  1766. }),
  1767. $globals.Collection.a$cls);
  1768. $core.addMethod(
  1769. $core.method({
  1770. selector: "withAll:",
  1771. protocol: "instance creation",
  1772. fn: function (aCollection){
  1773. var self=this,$self=this;
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. return $core.withContext(function($ctx1) {
  1776. //>>excludeEnd("ctx");
  1777. var $1;
  1778. $1=$self._new();
  1779. $recv($1)._addAll_(aCollection);
  1780. return $recv($1)._yourself();
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1783. //>>excludeEnd("ctx");
  1784. },
  1785. //>>excludeStart("ide", pragmas.excludeIdeData);
  1786. args: ["aCollection"],
  1787. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1788. referencedClasses: [],
  1789. //>>excludeEnd("ide");
  1790. messageSends: ["addAll:", "new", "yourself"]
  1791. }),
  1792. $globals.Collection.a$cls);
  1793. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  1794. //>>excludeStart("ide", pragmas.excludeIdeData);
  1795. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  1796. //>>excludeEnd("ide");
  1797. $core.addMethod(
  1798. $core.method({
  1799. selector: "at:",
  1800. protocol: "accessing",
  1801. fn: function (anIndex){
  1802. var self=this,$self=this;
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. return $core.withContext(function($ctx1) {
  1805. //>>excludeEnd("ctx");
  1806. return $self._at_ifAbsent_(anIndex,(function(){
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. return $core.withContext(function($ctx2) {
  1809. //>>excludeEnd("ctx");
  1810. return $self._errorNotFound();
  1811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1812. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1813. //>>excludeEnd("ctx");
  1814. }));
  1815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1816. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1817. //>>excludeEnd("ctx");
  1818. },
  1819. //>>excludeStart("ide", pragmas.excludeIdeData);
  1820. args: ["anIndex"],
  1821. 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 ]",
  1822. referencedClasses: [],
  1823. //>>excludeEnd("ide");
  1824. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1825. }),
  1826. $globals.IndexableCollection);
  1827. $core.addMethod(
  1828. $core.method({
  1829. selector: "at:ifAbsent:",
  1830. protocol: "accessing",
  1831. fn: function (anIndex,aBlock){
  1832. var self=this,$self=this;
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. return $core.withContext(function($ctx1) {
  1835. //>>excludeEnd("ctx");
  1836. $self._subclassResponsibility();
  1837. return self;
  1838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1839. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1840. //>>excludeEnd("ctx");
  1841. },
  1842. //>>excludeStart("ide", pragmas.excludeIdeData);
  1843. args: ["anIndex", "aBlock"],
  1844. 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",
  1845. referencedClasses: [],
  1846. //>>excludeEnd("ide");
  1847. messageSends: ["subclassResponsibility"]
  1848. }),
  1849. $globals.IndexableCollection);
  1850. $core.addMethod(
  1851. $core.method({
  1852. selector: "at:ifAbsentPut:",
  1853. protocol: "accessing",
  1854. fn: function (aKey,aBlock){
  1855. var self=this,$self=this;
  1856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1857. return $core.withContext(function($ctx1) {
  1858. //>>excludeEnd("ctx");
  1859. return $self._at_ifAbsent_(aKey,(function(){
  1860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1861. return $core.withContext(function($ctx2) {
  1862. //>>excludeEnd("ctx");
  1863. return $self._at_put_(aKey,$recv(aBlock)._value());
  1864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1866. //>>excludeEnd("ctx");
  1867. }));
  1868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1869. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1870. //>>excludeEnd("ctx");
  1871. },
  1872. //>>excludeStart("ide", pragmas.excludeIdeData);
  1873. args: ["aKey", "aBlock"],
  1874. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1875. referencedClasses: [],
  1876. //>>excludeEnd("ide");
  1877. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1878. }),
  1879. $globals.IndexableCollection);
  1880. $core.addMethod(
  1881. $core.method({
  1882. selector: "at:ifPresent:",
  1883. protocol: "accessing",
  1884. fn: function (anIndex,aBlock){
  1885. var self=this,$self=this;
  1886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1887. return $core.withContext(function($ctx1) {
  1888. //>>excludeEnd("ctx");
  1889. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1890. return nil;
  1891. }));
  1892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1893. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1894. //>>excludeEnd("ctx");
  1895. },
  1896. //>>excludeStart("ide", pragmas.excludeIdeData);
  1897. args: ["anIndex", "aBlock"],
  1898. 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 ]",
  1899. referencedClasses: [],
  1900. //>>excludeEnd("ide");
  1901. messageSends: ["at:ifPresent:ifAbsent:"]
  1902. }),
  1903. $globals.IndexableCollection);
  1904. $core.addMethod(
  1905. $core.method({
  1906. selector: "at:ifPresent:ifAbsent:",
  1907. protocol: "accessing",
  1908. fn: function (anIndex,aBlock,anotherBlock){
  1909. var self=this,$self=this;
  1910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1911. return $core.withContext(function($ctx1) {
  1912. //>>excludeEnd("ctx");
  1913. $self._subclassResponsibility();
  1914. return self;
  1915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1916. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1917. //>>excludeEnd("ctx");
  1918. },
  1919. //>>excludeStart("ide", pragmas.excludeIdeData);
  1920. args: ["anIndex", "aBlock", "anotherBlock"],
  1921. 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",
  1922. referencedClasses: [],
  1923. //>>excludeEnd("ide");
  1924. messageSends: ["subclassResponsibility"]
  1925. }),
  1926. $globals.IndexableCollection);
  1927. $core.addMethod(
  1928. $core.method({
  1929. selector: "at:put:",
  1930. protocol: "accessing",
  1931. fn: function (anIndex,anObject){
  1932. var self=this,$self=this;
  1933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1934. return $core.withContext(function($ctx1) {
  1935. //>>excludeEnd("ctx");
  1936. $self._subclassResponsibility();
  1937. return self;
  1938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1939. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1940. //>>excludeEnd("ctx");
  1941. },
  1942. //>>excludeStart("ide", pragmas.excludeIdeData);
  1943. args: ["anIndex", "anObject"],
  1944. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1945. referencedClasses: [],
  1946. //>>excludeEnd("ide");
  1947. messageSends: ["subclassResponsibility"]
  1948. }),
  1949. $globals.IndexableCollection);
  1950. $core.addMethod(
  1951. $core.method({
  1952. selector: "indexOf:",
  1953. protocol: "accessing",
  1954. fn: function (anObject){
  1955. var self=this,$self=this;
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. return $core.withContext(function($ctx1) {
  1958. //>>excludeEnd("ctx");
  1959. return $self._indexOf_ifAbsent_(anObject,(function(){
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. return $core.withContext(function($ctx2) {
  1962. //>>excludeEnd("ctx");
  1963. return $self._errorNotFound();
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1966. //>>excludeEnd("ctx");
  1967. }));
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1970. //>>excludeEnd("ctx");
  1971. },
  1972. //>>excludeStart("ide", pragmas.excludeIdeData);
  1973. args: ["anObject"],
  1974. 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 ]",
  1975. referencedClasses: [],
  1976. //>>excludeEnd("ide");
  1977. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1978. }),
  1979. $globals.IndexableCollection);
  1980. $core.addMethod(
  1981. $core.method({
  1982. selector: "indexOf:ifAbsent:",
  1983. protocol: "accessing",
  1984. fn: function (anObject,aBlock){
  1985. var self=this,$self=this;
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. return $core.withContext(function($ctx1) {
  1988. //>>excludeEnd("ctx");
  1989. $self._subclassResponsibility();
  1990. return self;
  1991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1992. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1993. //>>excludeEnd("ctx");
  1994. },
  1995. //>>excludeStart("ide", pragmas.excludeIdeData);
  1996. args: ["anObject", "aBlock"],
  1997. 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",
  1998. referencedClasses: [],
  1999. //>>excludeEnd("ide");
  2000. messageSends: ["subclassResponsibility"]
  2001. }),
  2002. $globals.IndexableCollection);
  2003. $core.addMethod(
  2004. $core.method({
  2005. selector: "with:do:",
  2006. protocol: "enumerating",
  2007. fn: function (anotherCollection,aBlock){
  2008. var self=this,$self=this;
  2009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2010. return $core.withContext(function($ctx1) {
  2011. //>>excludeEnd("ctx");
  2012. $self._withIndexDo_((function(each,index){
  2013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2014. return $core.withContext(function($ctx2) {
  2015. //>>excludeEnd("ctx");
  2016. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  2019. //>>excludeEnd("ctx");
  2020. }));
  2021. return self;
  2022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2023. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  2024. //>>excludeEnd("ctx");
  2025. },
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["anotherCollection", "aBlock"],
  2028. 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) ]",
  2029. referencedClasses: [],
  2030. //>>excludeEnd("ide");
  2031. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2032. }),
  2033. $globals.IndexableCollection);
  2034. $core.addMethod(
  2035. $core.method({
  2036. selector: "withIndexDo:",
  2037. protocol: "enumerating",
  2038. fn: function (aBlock){
  2039. var self=this,$self=this;
  2040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2041. return $core.withContext(function($ctx1) {
  2042. //>>excludeEnd("ctx");
  2043. $self._subclassResponsibility();
  2044. return self;
  2045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2046. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  2047. //>>excludeEnd("ctx");
  2048. },
  2049. //>>excludeStart("ide", pragmas.excludeIdeData);
  2050. args: ["aBlock"],
  2051. 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",
  2052. referencedClasses: [],
  2053. //>>excludeEnd("ide");
  2054. messageSends: ["subclassResponsibility"]
  2055. }),
  2056. $globals.IndexableCollection);
  2057. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  2058. //>>excludeStart("ide", pragmas.excludeIdeData);
  2059. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2060. //>>excludeEnd("ide");
  2061. $core.addMethod(
  2062. $core.method({
  2063. selector: "=",
  2064. protocol: "comparing",
  2065. fn: function (anAssocitativeCollection){
  2066. var self=this,$self=this;
  2067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2068. return $core.withContext(function($ctx1) {
  2069. //>>excludeEnd("ctx");
  2070. var $2,$1,$4,$3,$5;
  2071. $2=$self._class();
  2072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2073. $ctx1.sendIdx["class"]=1;
  2074. //>>excludeEnd("ctx");
  2075. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. $ctx1.sendIdx["="]=1;
  2078. //>>excludeEnd("ctx");
  2079. if(!$core.assert($1)){
  2080. return false;
  2081. }
  2082. $4=$self._size();
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. $ctx1.sendIdx["size"]=1;
  2085. //>>excludeEnd("ctx");
  2086. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. $ctx1.sendIdx["="]=2;
  2089. //>>excludeEnd("ctx");
  2090. if(!$core.assert($3)){
  2091. return false;
  2092. }
  2093. $5=$self._associations();
  2094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2095. $ctx1.sendIdx["associations"]=1;
  2096. //>>excludeEnd("ctx");
  2097. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2099. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2100. //>>excludeEnd("ctx");
  2101. },
  2102. //>>excludeStart("ide", pragmas.excludeIdeData);
  2103. args: ["anAssocitativeCollection"],
  2104. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2105. referencedClasses: [],
  2106. //>>excludeEnd("ide");
  2107. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2108. }),
  2109. $globals.AssociativeCollection);
  2110. $core.addMethod(
  2111. $core.method({
  2112. selector: "add:",
  2113. protocol: "adding/removing",
  2114. fn: function (anAssociation){
  2115. var self=this,$self=this;
  2116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2117. return $core.withContext(function($ctx1) {
  2118. //>>excludeEnd("ctx");
  2119. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2120. return self;
  2121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2122. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2123. //>>excludeEnd("ctx");
  2124. },
  2125. //>>excludeStart("ide", pragmas.excludeIdeData);
  2126. args: ["anAssociation"],
  2127. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2128. referencedClasses: [],
  2129. //>>excludeEnd("ide");
  2130. messageSends: ["at:put:", "key", "value"]
  2131. }),
  2132. $globals.AssociativeCollection);
  2133. $core.addMethod(
  2134. $core.method({
  2135. selector: "addAll:",
  2136. protocol: "adding/removing",
  2137. fn: function (anAssociativeCollection){
  2138. var self=this,$self=this;
  2139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2140. return $core.withContext(function($ctx1) {
  2141. //>>excludeEnd("ctx");
  2142. (
  2143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2144. $ctx1.supercall = true,
  2145. //>>excludeEnd("ctx");
  2146. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  2147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2148. $ctx1.supercall = false;
  2149. //>>excludeEnd("ctx");;
  2150. return anAssociativeCollection;
  2151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2152. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2153. //>>excludeEnd("ctx");
  2154. },
  2155. //>>excludeStart("ide", pragmas.excludeIdeData);
  2156. args: ["anAssociativeCollection"],
  2157. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2158. referencedClasses: [],
  2159. //>>excludeEnd("ide");
  2160. messageSends: ["addAll:", "associations"]
  2161. }),
  2162. $globals.AssociativeCollection);
  2163. $core.addMethod(
  2164. $core.method({
  2165. selector: "asDictionary",
  2166. protocol: "converting",
  2167. fn: function (){
  2168. var self=this,$self=this;
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. return $core.withContext(function($ctx1) {
  2171. //>>excludeEnd("ctx");
  2172. return $recv($globals.Dictionary)._from_($self._associations());
  2173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2174. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2175. //>>excludeEnd("ctx");
  2176. },
  2177. //>>excludeStart("ide", pragmas.excludeIdeData);
  2178. args: [],
  2179. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2180. referencedClasses: ["Dictionary"],
  2181. //>>excludeEnd("ide");
  2182. messageSends: ["from:", "associations"]
  2183. }),
  2184. $globals.AssociativeCollection);
  2185. $core.addMethod(
  2186. $core.method({
  2187. selector: "asHashedCollection",
  2188. protocol: "converting",
  2189. fn: function (){
  2190. var self=this,$self=this;
  2191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2192. return $core.withContext(function($ctx1) {
  2193. //>>excludeEnd("ctx");
  2194. return $recv($globals.HashedCollection)._from_($self._associations());
  2195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2196. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2197. //>>excludeEnd("ctx");
  2198. },
  2199. //>>excludeStart("ide", pragmas.excludeIdeData);
  2200. args: [],
  2201. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2202. referencedClasses: ["HashedCollection"],
  2203. //>>excludeEnd("ide");
  2204. messageSends: ["from:", "associations"]
  2205. }),
  2206. $globals.AssociativeCollection);
  2207. $core.addMethod(
  2208. $core.method({
  2209. selector: "asJavaScriptObject",
  2210. protocol: "converting",
  2211. fn: function (){
  2212. var self=this,$self=this;
  2213. var hash;
  2214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2215. return $core.withContext(function($ctx1) {
  2216. //>>excludeEnd("ctx");
  2217. hash=$recv($globals.HashedCollection)._new();
  2218. $self._keysAndValuesDo_((function(key,value){
  2219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2220. return $core.withContext(function($ctx2) {
  2221. //>>excludeEnd("ctx");
  2222. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2225. //>>excludeEnd("ctx");
  2226. }));
  2227. return hash;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  2230. //>>excludeEnd("ctx");
  2231. },
  2232. //>>excludeStart("ide", pragmas.excludeIdeData);
  2233. args: [],
  2234. 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",
  2235. referencedClasses: ["HashedCollection"],
  2236. //>>excludeEnd("ide");
  2237. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2238. }),
  2239. $globals.AssociativeCollection);
  2240. $core.addMethod(
  2241. $core.method({
  2242. selector: "associations",
  2243. protocol: "accessing",
  2244. fn: function (){
  2245. var self=this,$self=this;
  2246. var associations;
  2247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2248. return $core.withContext(function($ctx1) {
  2249. //>>excludeEnd("ctx");
  2250. associations=[];
  2251. $self._associationsDo_((function(each){
  2252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2253. return $core.withContext(function($ctx2) {
  2254. //>>excludeEnd("ctx");
  2255. return $recv(associations)._add_(each);
  2256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2257. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2258. //>>excludeEnd("ctx");
  2259. }));
  2260. return associations;
  2261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2262. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2263. //>>excludeEnd("ctx");
  2264. },
  2265. //>>excludeStart("ide", pragmas.excludeIdeData);
  2266. args: [],
  2267. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2268. referencedClasses: [],
  2269. //>>excludeEnd("ide");
  2270. messageSends: ["associationsDo:", "add:"]
  2271. }),
  2272. $globals.AssociativeCollection);
  2273. $core.addMethod(
  2274. $core.method({
  2275. selector: "associationsDo:",
  2276. protocol: "enumerating",
  2277. fn: function (aBlock){
  2278. var self=this,$self=this;
  2279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2280. return $core.withContext(function($ctx1) {
  2281. //>>excludeEnd("ctx");
  2282. $self._keysAndValuesDo_((function(key,value){
  2283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2284. return $core.withContext(function($ctx2) {
  2285. //>>excludeEnd("ctx");
  2286. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2288. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2289. //>>excludeEnd("ctx");
  2290. }));
  2291. return self;
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2294. //>>excludeEnd("ctx");
  2295. },
  2296. //>>excludeStart("ide", pragmas.excludeIdeData);
  2297. args: ["aBlock"],
  2298. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2299. referencedClasses: ["Association"],
  2300. //>>excludeEnd("ide");
  2301. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2302. }),
  2303. $globals.AssociativeCollection);
  2304. $core.addMethod(
  2305. $core.method({
  2306. selector: "at:ifPresent:ifAbsent:",
  2307. protocol: "accessing",
  2308. fn: function (aKey,aBlock,anotherBlock){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. var $1;
  2314. $1=$self._includesKey_(aKey);
  2315. if($core.assert($1)){
  2316. return $recv(aBlock)._value_($self._at_(aKey));
  2317. } else {
  2318. return $recv(anotherBlock)._value();
  2319. }
  2320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2321. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2322. //>>excludeEnd("ctx");
  2323. },
  2324. //>>excludeStart("ide", pragmas.excludeIdeData);
  2325. args: ["aKey", "aBlock", "anotherBlock"],
  2326. 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 ]",
  2327. referencedClasses: [],
  2328. //>>excludeEnd("ide");
  2329. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2330. }),
  2331. $globals.AssociativeCollection);
  2332. $core.addMethod(
  2333. $core.method({
  2334. selector: "collect:",
  2335. protocol: "enumerating",
  2336. fn: function (aBlock){
  2337. var self=this,$self=this;
  2338. var newDict;
  2339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2340. return $core.withContext(function($ctx1) {
  2341. //>>excludeEnd("ctx");
  2342. newDict=$recv($self._class())._new();
  2343. $self._keysAndValuesDo_((function(key,value){
  2344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2345. return $core.withContext(function($ctx2) {
  2346. //>>excludeEnd("ctx");
  2347. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2350. //>>excludeEnd("ctx");
  2351. }));
  2352. return newDict;
  2353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2354. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2355. //>>excludeEnd("ctx");
  2356. },
  2357. //>>excludeStart("ide", pragmas.excludeIdeData);
  2358. args: ["aBlock"],
  2359. 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",
  2360. referencedClasses: [],
  2361. //>>excludeEnd("ide");
  2362. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2363. }),
  2364. $globals.AssociativeCollection);
  2365. $core.addMethod(
  2366. $core.method({
  2367. selector: "deepCopy",
  2368. protocol: "copying",
  2369. fn: function (){
  2370. var self=this,$self=this;
  2371. var copy;
  2372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2373. return $core.withContext(function($ctx1) {
  2374. //>>excludeEnd("ctx");
  2375. copy=$recv($self._class())._new();
  2376. $self._keysAndValuesDo_((function(key,value){
  2377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2378. return $core.withContext(function($ctx2) {
  2379. //>>excludeEnd("ctx");
  2380. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2383. //>>excludeEnd("ctx");
  2384. }));
  2385. return copy;
  2386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2387. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2388. //>>excludeEnd("ctx");
  2389. },
  2390. //>>excludeStart("ide", pragmas.excludeIdeData);
  2391. args: [],
  2392. 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",
  2393. referencedClasses: [],
  2394. //>>excludeEnd("ide");
  2395. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2396. }),
  2397. $globals.AssociativeCollection);
  2398. $core.addMethod(
  2399. $core.method({
  2400. selector: "detect:ifNone:",
  2401. protocol: "enumerating",
  2402. fn: function (aBlock,anotherBlock){
  2403. var self=this,$self=this;
  2404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2405. return $core.withContext(function($ctx1) {
  2406. //>>excludeEnd("ctx");
  2407. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2409. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2410. //>>excludeEnd("ctx");
  2411. },
  2412. //>>excludeStart("ide", pragmas.excludeIdeData);
  2413. args: ["aBlock", "anotherBlock"],
  2414. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2415. referencedClasses: [],
  2416. //>>excludeEnd("ide");
  2417. messageSends: ["detect:ifNone:", "values"]
  2418. }),
  2419. $globals.AssociativeCollection);
  2420. $core.addMethod(
  2421. $core.method({
  2422. selector: "do:",
  2423. protocol: "enumerating",
  2424. fn: function (aBlock){
  2425. var self=this,$self=this;
  2426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2427. return $core.withContext(function($ctx1) {
  2428. //>>excludeEnd("ctx");
  2429. $self._valuesDo_(aBlock);
  2430. return self;
  2431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2432. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2433. //>>excludeEnd("ctx");
  2434. },
  2435. //>>excludeStart("ide", pragmas.excludeIdeData);
  2436. args: ["aBlock"],
  2437. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2438. referencedClasses: [],
  2439. //>>excludeEnd("ide");
  2440. messageSends: ["valuesDo:"]
  2441. }),
  2442. $globals.AssociativeCollection);
  2443. $core.addMethod(
  2444. $core.method({
  2445. selector: "includes:",
  2446. protocol: "enumerating",
  2447. fn: function (anObject){
  2448. var self=this,$self=this;
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. return $core.withContext(function($ctx1) {
  2451. //>>excludeEnd("ctx");
  2452. return $recv($self._values())._includes_(anObject);
  2453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2454. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2455. //>>excludeEnd("ctx");
  2456. },
  2457. //>>excludeStart("ide", pragmas.excludeIdeData);
  2458. args: ["anObject"],
  2459. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2460. referencedClasses: [],
  2461. //>>excludeEnd("ide");
  2462. messageSends: ["includes:", "values"]
  2463. }),
  2464. $globals.AssociativeCollection);
  2465. $core.addMethod(
  2466. $core.method({
  2467. selector: "includesKey:",
  2468. protocol: "testing",
  2469. fn: function (aKey){
  2470. var self=this,$self=this;
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. return $core.withContext(function($ctx1) {
  2473. //>>excludeEnd("ctx");
  2474. $self._subclassResponsibility();
  2475. return self;
  2476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2477. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2478. //>>excludeEnd("ctx");
  2479. },
  2480. //>>excludeStart("ide", pragmas.excludeIdeData);
  2481. args: ["aKey"],
  2482. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2483. referencedClasses: [],
  2484. //>>excludeEnd("ide");
  2485. messageSends: ["subclassResponsibility"]
  2486. }),
  2487. $globals.AssociativeCollection);
  2488. $core.addMethod(
  2489. $core.method({
  2490. selector: "indexOf:ifAbsent:",
  2491. protocol: "accessing",
  2492. fn: function (anObject,aBlock){
  2493. var self=this,$self=this;
  2494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2495. return $core.withContext(function($ctx1) {
  2496. //>>excludeEnd("ctx");
  2497. return $recv($self._keys())._detect_ifNone_((function(each){
  2498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2499. return $core.withContext(function($ctx2) {
  2500. //>>excludeEnd("ctx");
  2501. return $recv($self._at_(each)).__eq(anObject);
  2502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2504. //>>excludeEnd("ctx");
  2505. }),aBlock);
  2506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2507. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2508. //>>excludeEnd("ctx");
  2509. },
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["anObject", "aBlock"],
  2512. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2516. }),
  2517. $globals.AssociativeCollection);
  2518. $core.addMethod(
  2519. $core.method({
  2520. selector: "keyAtValue:",
  2521. protocol: "accessing",
  2522. fn: function (anObject){
  2523. var self=this,$self=this;
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. return $core.withContext(function($ctx1) {
  2526. //>>excludeEnd("ctx");
  2527. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2529. return $core.withContext(function($ctx2) {
  2530. //>>excludeEnd("ctx");
  2531. return $self._errorNotFound();
  2532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2534. //>>excludeEnd("ctx");
  2535. }));
  2536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2537. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2538. //>>excludeEnd("ctx");
  2539. },
  2540. //>>excludeStart("ide", pragmas.excludeIdeData);
  2541. args: ["anObject"],
  2542. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2543. referencedClasses: [],
  2544. //>>excludeEnd("ide");
  2545. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2546. }),
  2547. $globals.AssociativeCollection);
  2548. $core.addMethod(
  2549. $core.method({
  2550. selector: "keyAtValue:ifAbsent:",
  2551. protocol: "accessing",
  2552. fn: function (anObject,aBlock){
  2553. var self=this,$self=this;
  2554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2555. return $core.withContext(function($ctx1) {
  2556. //>>excludeEnd("ctx");
  2557. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2559. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2560. //>>excludeEnd("ctx");
  2561. },
  2562. //>>excludeStart("ide", pragmas.excludeIdeData);
  2563. args: ["anObject", "aBlock"],
  2564. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2565. referencedClasses: [],
  2566. //>>excludeEnd("ide");
  2567. messageSends: ["indexOf:ifAbsent:"]
  2568. }),
  2569. $globals.AssociativeCollection);
  2570. $core.addMethod(
  2571. $core.method({
  2572. selector: "keys",
  2573. protocol: "accessing",
  2574. fn: function (){
  2575. var self=this,$self=this;
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. return $core.withContext(function($ctx1) {
  2578. //>>excludeEnd("ctx");
  2579. $self._subclassResponsibility();
  2580. return self;
  2581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2582. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2583. //>>excludeEnd("ctx");
  2584. },
  2585. //>>excludeStart("ide", pragmas.excludeIdeData);
  2586. args: [],
  2587. source: "keys\x0a\x09self subclassResponsibility",
  2588. referencedClasses: [],
  2589. //>>excludeEnd("ide");
  2590. messageSends: ["subclassResponsibility"]
  2591. }),
  2592. $globals.AssociativeCollection);
  2593. $core.addMethod(
  2594. $core.method({
  2595. selector: "keysAndValuesDo:",
  2596. protocol: "enumerating",
  2597. fn: function (aBlock){
  2598. var self=this,$self=this;
  2599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2600. return $core.withContext(function($ctx1) {
  2601. //>>excludeEnd("ctx");
  2602. $self._keysDo_((function(each){
  2603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2604. return $core.withContext(function($ctx2) {
  2605. //>>excludeEnd("ctx");
  2606. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2609. //>>excludeEnd("ctx");
  2610. }));
  2611. return self;
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2614. //>>excludeEnd("ctx");
  2615. },
  2616. //>>excludeStart("ide", pragmas.excludeIdeData);
  2617. args: ["aBlock"],
  2618. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2619. referencedClasses: [],
  2620. //>>excludeEnd("ide");
  2621. messageSends: ["keysDo:", "value:value:", "at:"]
  2622. }),
  2623. $globals.AssociativeCollection);
  2624. $core.addMethod(
  2625. $core.method({
  2626. selector: "keysDo:",
  2627. protocol: "enumerating",
  2628. fn: function (aBlock){
  2629. var self=this,$self=this;
  2630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2631. return $core.withContext(function($ctx1) {
  2632. //>>excludeEnd("ctx");
  2633. $self._subclassResponsibility();
  2634. return self;
  2635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2636. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2637. //>>excludeEnd("ctx");
  2638. },
  2639. //>>excludeStart("ide", pragmas.excludeIdeData);
  2640. args: ["aBlock"],
  2641. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2642. referencedClasses: [],
  2643. //>>excludeEnd("ide");
  2644. messageSends: ["subclassResponsibility"]
  2645. }),
  2646. $globals.AssociativeCollection);
  2647. $core.addMethod(
  2648. $core.method({
  2649. selector: "printOn:",
  2650. protocol: "printing",
  2651. fn: function (aStream){
  2652. var self=this,$self=this;
  2653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2654. return $core.withContext(function($ctx1) {
  2655. //>>excludeEnd("ctx");
  2656. (
  2657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2658. $ctx1.supercall = true,
  2659. //>>excludeEnd("ctx");
  2660. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. $ctx1.supercall = false;
  2663. //>>excludeEnd("ctx");;
  2664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2665. $ctx1.sendIdx["printOn:"]=1;
  2666. //>>excludeEnd("ctx");
  2667. $recv(aStream)._nextPutAll_(" (");
  2668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2669. $ctx1.sendIdx["nextPutAll:"]=1;
  2670. //>>excludeEnd("ctx");
  2671. $recv($self._associations())._do_separatedBy_((function(each){
  2672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2673. return $core.withContext(function($ctx2) {
  2674. //>>excludeEnd("ctx");
  2675. return $recv(each)._printOn_(aStream);
  2676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2677. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2678. //>>excludeEnd("ctx");
  2679. }),(function(){
  2680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2681. return $core.withContext(function($ctx2) {
  2682. //>>excludeEnd("ctx");
  2683. return $recv(aStream)._nextPutAll_(" , ");
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. $ctx2.sendIdx["nextPutAll:"]=2;
  2686. //>>excludeEnd("ctx");
  2687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2689. //>>excludeEnd("ctx");
  2690. }));
  2691. $recv(aStream)._nextPutAll_(")");
  2692. return self;
  2693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2694. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2695. //>>excludeEnd("ctx");
  2696. },
  2697. //>>excludeStart("ide", pragmas.excludeIdeData);
  2698. args: ["aStream"],
  2699. 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: ')'",
  2700. referencedClasses: [],
  2701. //>>excludeEnd("ide");
  2702. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2703. }),
  2704. $globals.AssociativeCollection);
  2705. $core.addMethod(
  2706. $core.method({
  2707. selector: "remove:ifAbsent:",
  2708. protocol: "adding/removing",
  2709. fn: function (aKey,aBlock){
  2710. var self=this,$self=this;
  2711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2712. return $core.withContext(function($ctx1) {
  2713. //>>excludeEnd("ctx");
  2714. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2716. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2717. //>>excludeEnd("ctx");
  2718. },
  2719. //>>excludeStart("ide", pragmas.excludeIdeData);
  2720. args: ["aKey", "aBlock"],
  2721. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2722. referencedClasses: [],
  2723. //>>excludeEnd("ide");
  2724. messageSends: ["removeKey:ifAbsent:"]
  2725. }),
  2726. $globals.AssociativeCollection);
  2727. $core.addMethod(
  2728. $core.method({
  2729. selector: "removeAll",
  2730. protocol: "adding/removing",
  2731. fn: function (){
  2732. var self=this,$self=this;
  2733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2734. return $core.withContext(function($ctx1) {
  2735. //>>excludeEnd("ctx");
  2736. return $recv($self._keys())._do_((function(each){
  2737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2738. return $core.withContext(function($ctx2) {
  2739. //>>excludeEnd("ctx");
  2740. return $self._removeKey_(each);
  2741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2742. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2743. //>>excludeEnd("ctx");
  2744. }));
  2745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2746. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2747. //>>excludeEnd("ctx");
  2748. },
  2749. //>>excludeStart("ide", pragmas.excludeIdeData);
  2750. args: [],
  2751. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2752. referencedClasses: [],
  2753. //>>excludeEnd("ide");
  2754. messageSends: ["do:", "keys", "removeKey:"]
  2755. }),
  2756. $globals.AssociativeCollection);
  2757. $core.addMethod(
  2758. $core.method({
  2759. selector: "removeKey:",
  2760. protocol: "adding/removing",
  2761. fn: function (aKey){
  2762. var self=this,$self=this;
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. return $core.withContext(function($ctx1) {
  2765. //>>excludeEnd("ctx");
  2766. return $self._remove_(aKey);
  2767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2768. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2769. //>>excludeEnd("ctx");
  2770. },
  2771. //>>excludeStart("ide", pragmas.excludeIdeData);
  2772. args: ["aKey"],
  2773. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2774. referencedClasses: [],
  2775. //>>excludeEnd("ide");
  2776. messageSends: ["remove:"]
  2777. }),
  2778. $globals.AssociativeCollection);
  2779. $core.addMethod(
  2780. $core.method({
  2781. selector: "removeKey:ifAbsent:",
  2782. protocol: "adding/removing",
  2783. fn: function (aKey,aBlock){
  2784. var self=this,$self=this;
  2785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2786. return $core.withContext(function($ctx1) {
  2787. //>>excludeEnd("ctx");
  2788. $self._subclassResponsibility();
  2789. return self;
  2790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2791. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2792. //>>excludeEnd("ctx");
  2793. },
  2794. //>>excludeStart("ide", pragmas.excludeIdeData);
  2795. args: ["aKey", "aBlock"],
  2796. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2797. referencedClasses: [],
  2798. //>>excludeEnd("ide");
  2799. messageSends: ["subclassResponsibility"]
  2800. }),
  2801. $globals.AssociativeCollection);
  2802. $core.addMethod(
  2803. $core.method({
  2804. selector: "select:",
  2805. protocol: "enumerating",
  2806. fn: function (aBlock){
  2807. var self=this,$self=this;
  2808. var newDict;
  2809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2810. return $core.withContext(function($ctx1) {
  2811. //>>excludeEnd("ctx");
  2812. var $1;
  2813. newDict=$recv($self._class())._new();
  2814. $self._keysAndValuesDo_((function(key,value){
  2815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2816. return $core.withContext(function($ctx2) {
  2817. //>>excludeEnd("ctx");
  2818. $1=$recv(aBlock)._value_(value);
  2819. if($core.assert($1)){
  2820. return $recv(newDict)._at_put_(key,value);
  2821. }
  2822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2823. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2824. //>>excludeEnd("ctx");
  2825. }));
  2826. return newDict;
  2827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2828. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2829. //>>excludeEnd("ctx");
  2830. },
  2831. //>>excludeStart("ide", pragmas.excludeIdeData);
  2832. args: ["aBlock"],
  2833. 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",
  2834. referencedClasses: [],
  2835. //>>excludeEnd("ide");
  2836. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2837. }),
  2838. $globals.AssociativeCollection);
  2839. $core.addMethod(
  2840. $core.method({
  2841. selector: "select:thenCollect:",
  2842. protocol: "enumerating",
  2843. fn: function (selectBlock,collectBlock){
  2844. var self=this,$self=this;
  2845. var newDict;
  2846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2847. return $core.withContext(function($ctx1) {
  2848. //>>excludeEnd("ctx");
  2849. var $1;
  2850. newDict=$recv($self._class())._new();
  2851. $self._keysAndValuesDo_((function(key,value){
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. return $core.withContext(function($ctx2) {
  2854. //>>excludeEnd("ctx");
  2855. $1=$recv(selectBlock)._value_(value);
  2856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2857. $ctx2.sendIdx["value:"]=1;
  2858. //>>excludeEnd("ctx");
  2859. if($core.assert($1)){
  2860. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2861. }
  2862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2863. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2864. //>>excludeEnd("ctx");
  2865. }));
  2866. return newDict;
  2867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2868. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2869. //>>excludeEnd("ctx");
  2870. },
  2871. //>>excludeStart("ide", pragmas.excludeIdeData);
  2872. args: ["selectBlock", "collectBlock"],
  2873. 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",
  2874. referencedClasses: [],
  2875. //>>excludeEnd("ide");
  2876. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2877. }),
  2878. $globals.AssociativeCollection);
  2879. $core.addMethod(
  2880. $core.method({
  2881. selector: "shallowCopy",
  2882. protocol: "copying",
  2883. fn: function (){
  2884. var self=this,$self=this;
  2885. var copy;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. return $core.withContext(function($ctx1) {
  2888. //>>excludeEnd("ctx");
  2889. copy=$recv($self._class())._new();
  2890. $self._keysAndValuesDo_((function(key,value){
  2891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2892. return $core.withContext(function($ctx2) {
  2893. //>>excludeEnd("ctx");
  2894. return $recv(copy)._at_put_(key,value);
  2895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2896. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2897. //>>excludeEnd("ctx");
  2898. }));
  2899. return copy;
  2900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2901. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2902. //>>excludeEnd("ctx");
  2903. },
  2904. //>>excludeStart("ide", pragmas.excludeIdeData);
  2905. args: [],
  2906. 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",
  2907. referencedClasses: [],
  2908. //>>excludeEnd("ide");
  2909. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2910. }),
  2911. $globals.AssociativeCollection);
  2912. $core.addMethod(
  2913. $core.method({
  2914. selector: "size",
  2915. protocol: "accessing",
  2916. fn: function (){
  2917. var self=this,$self=this;
  2918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2919. return $core.withContext(function($ctx1) {
  2920. //>>excludeEnd("ctx");
  2921. return $recv($self._keys())._size();
  2922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2923. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2924. //>>excludeEnd("ctx");
  2925. },
  2926. //>>excludeStart("ide", pragmas.excludeIdeData);
  2927. args: [],
  2928. source: "size\x0a\x09^ self keys size",
  2929. referencedClasses: [],
  2930. //>>excludeEnd("ide");
  2931. messageSends: ["size", "keys"]
  2932. }),
  2933. $globals.AssociativeCollection);
  2934. $core.addMethod(
  2935. $core.method({
  2936. selector: "values",
  2937. protocol: "accessing",
  2938. fn: function (){
  2939. var self=this,$self=this;
  2940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2941. return $core.withContext(function($ctx1) {
  2942. //>>excludeEnd("ctx");
  2943. $self._subclassResponsibility();
  2944. return self;
  2945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2946. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2947. //>>excludeEnd("ctx");
  2948. },
  2949. //>>excludeStart("ide", pragmas.excludeIdeData);
  2950. args: [],
  2951. source: "values\x0a\x09self subclassResponsibility",
  2952. referencedClasses: [],
  2953. //>>excludeEnd("ide");
  2954. messageSends: ["subclassResponsibility"]
  2955. }),
  2956. $globals.AssociativeCollection);
  2957. $core.addMethod(
  2958. $core.method({
  2959. selector: "valuesDo:",
  2960. protocol: "enumerating",
  2961. fn: function (aBlock){
  2962. var self=this,$self=this;
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. return $core.withContext(function($ctx1) {
  2965. //>>excludeEnd("ctx");
  2966. $self._subclassResponsibility();
  2967. return self;
  2968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2969. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2970. //>>excludeEnd("ctx");
  2971. },
  2972. //>>excludeStart("ide", pragmas.excludeIdeData);
  2973. args: ["aBlock"],
  2974. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2975. referencedClasses: [],
  2976. //>>excludeEnd("ide");
  2977. messageSends: ["subclassResponsibility"]
  2978. }),
  2979. $globals.AssociativeCollection);
  2980. $core.addMethod(
  2981. $core.method({
  2982. selector: "withIndexDo:",
  2983. protocol: "enumerating",
  2984. fn: function (aBlock){
  2985. var self=this,$self=this;
  2986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2987. return $core.withContext(function($ctx1) {
  2988. //>>excludeEnd("ctx");
  2989. $self._keysAndValuesDo_((function(key,value){
  2990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2991. return $core.withContext(function($ctx2) {
  2992. //>>excludeEnd("ctx");
  2993. return $recv(aBlock)._value_value_(value,key);
  2994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2995. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2996. //>>excludeEnd("ctx");
  2997. }));
  2998. return self;
  2999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3000. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  3001. //>>excludeEnd("ctx");
  3002. },
  3003. //>>excludeStart("ide", pragmas.excludeIdeData);
  3004. args: ["aBlock"],
  3005. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  3006. referencedClasses: [],
  3007. //>>excludeEnd("ide");
  3008. messageSends: ["keysAndValuesDo:", "value:value:"]
  3009. }),
  3010. $globals.AssociativeCollection);
  3011. $core.addMethod(
  3012. $core.method({
  3013. selector: "from:",
  3014. protocol: "instance creation",
  3015. fn: function (aCollection){
  3016. var self=this,$self=this;
  3017. var newCollection;
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. return $core.withContext(function($ctx1) {
  3020. //>>excludeEnd("ctx");
  3021. newCollection=$self._new();
  3022. $recv(aCollection)._do_((function(each){
  3023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3024. return $core.withContext(function($ctx2) {
  3025. //>>excludeEnd("ctx");
  3026. return $recv(newCollection)._add_(each);
  3027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3029. //>>excludeEnd("ctx");
  3030. }));
  3031. return newCollection;
  3032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3033. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3034. //>>excludeEnd("ctx");
  3035. },
  3036. //>>excludeStart("ide", pragmas.excludeIdeData);
  3037. args: ["aCollection"],
  3038. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  3039. referencedClasses: [],
  3040. //>>excludeEnd("ide");
  3041. messageSends: ["new", "do:", "add:"]
  3042. }),
  3043. $globals.AssociativeCollection.a$cls);
  3044. $core.addMethod(
  3045. $core.method({
  3046. selector: "fromPairs:",
  3047. protocol: "instance creation",
  3048. fn: function (aCollection){
  3049. var self=this,$self=this;
  3050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3051. return $core.withContext(function($ctx1) {
  3052. //>>excludeEnd("ctx");
  3053. return $self._from_(aCollection);
  3054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3055. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  3056. //>>excludeEnd("ctx");
  3057. },
  3058. //>>excludeStart("ide", pragmas.excludeIdeData);
  3059. args: ["aCollection"],
  3060. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  3061. referencedClasses: [],
  3062. //>>excludeEnd("ide");
  3063. messageSends: ["from:"]
  3064. }),
  3065. $globals.AssociativeCollection.a$cls);
  3066. $core.addMethod(
  3067. $core.method({
  3068. selector: "newFromPairs:",
  3069. protocol: "instance creation",
  3070. fn: function (aCollection){
  3071. var self=this,$self=this;
  3072. var newCollection;
  3073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3074. return $core.withContext(function($ctx1) {
  3075. //>>excludeEnd("ctx");
  3076. var $2,$1,$3,$4;
  3077. $2=$recv(aCollection)._size();
  3078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3079. $ctx1.sendIdx["size"]=1;
  3080. //>>excludeEnd("ctx");
  3081. $1=$recv($2)._even();
  3082. if(!$core.assert($1)){
  3083. $self._error_("#newFromPairs only accepts arrays of an even length");
  3084. }
  3085. newCollection=$self._new();
  3086. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. return $core.withContext(function($ctx2) {
  3089. //>>excludeEnd("ctx");
  3090. $3=newCollection;
  3091. $4=$recv(aCollection)._at_(each);
  3092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3093. $ctx2.sendIdx["at:"]=1;
  3094. //>>excludeEnd("ctx");
  3095. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  3096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3098. //>>excludeEnd("ctx");
  3099. }));
  3100. return newCollection;
  3101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3102. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3103. //>>excludeEnd("ctx");
  3104. },
  3105. //>>excludeStart("ide", pragmas.excludeIdeData);
  3106. args: ["aCollection"],
  3107. 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",
  3108. referencedClasses: [],
  3109. //>>excludeEnd("ide");
  3110. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3111. }),
  3112. $globals.AssociativeCollection.a$cls);
  3113. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  3114. //>>excludeStart("ide", pragmas.excludeIdeData);
  3115. $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.";
  3116. //>>excludeEnd("ide");
  3117. $core.addMethod(
  3118. $core.method({
  3119. selector: "at:ifAbsent:",
  3120. protocol: "accessing",
  3121. fn: function (aKey,aBlock){
  3122. var self=this,$self=this;
  3123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3124. return $core.withContext(function($ctx1) {
  3125. //>>excludeEnd("ctx");
  3126. var index = $self._positionOfKey_(aKey);
  3127. return index >=0 ? $self['@values'][index] : aBlock._value();
  3128. ;
  3129. return self;
  3130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3131. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3132. //>>excludeEnd("ctx");
  3133. },
  3134. //>>excludeStart("ide", pragmas.excludeIdeData);
  3135. args: ["aKey", "aBlock"],
  3136. 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'>",
  3137. referencedClasses: [],
  3138. //>>excludeEnd("ide");
  3139. messageSends: []
  3140. }),
  3141. $globals.Dictionary);
  3142. $core.addMethod(
  3143. $core.method({
  3144. selector: "at:put:",
  3145. protocol: "accessing",
  3146. fn: function (aKey,aValue){
  3147. var self=this,$self=this;
  3148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3149. return $core.withContext(function($ctx1) {
  3150. //>>excludeEnd("ctx");
  3151. var index = $self._positionOfKey_(aKey);
  3152. if(index === -1) {
  3153. var keys = $self['@keys'];
  3154. index = keys.length;
  3155. keys.push(aKey);
  3156. }
  3157. return $self['@values'][index] = aValue;
  3158. ;
  3159. return self;
  3160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3161. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3162. //>>excludeEnd("ctx");
  3163. },
  3164. //>>excludeStart("ide", pragmas.excludeIdeData);
  3165. args: ["aKey", "aValue"],
  3166. 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'>",
  3167. referencedClasses: [],
  3168. //>>excludeEnd("ide");
  3169. messageSends: []
  3170. }),
  3171. $globals.Dictionary);
  3172. $core.addMethod(
  3173. $core.method({
  3174. selector: "includesKey:",
  3175. protocol: "testing",
  3176. fn: function (aKey){
  3177. var self=this,$self=this;
  3178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3179. return $core.withContext(function($ctx1) {
  3180. //>>excludeEnd("ctx");
  3181. return $self._positionOfKey_(aKey) >= 0;;
  3182. return self;
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3185. //>>excludeEnd("ctx");
  3186. },
  3187. //>>excludeStart("ide", pragmas.excludeIdeData);
  3188. args: ["aKey"],
  3189. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3190. referencedClasses: [],
  3191. //>>excludeEnd("ide");
  3192. messageSends: []
  3193. }),
  3194. $globals.Dictionary);
  3195. $core.addMethod(
  3196. $core.method({
  3197. selector: "indexOf:ifAbsent:",
  3198. protocol: "accessing",
  3199. fn: function (anObject,aBlock){
  3200. var self=this,$self=this;
  3201. var index;
  3202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3203. return $core.withContext(function($ctx1) {
  3204. //>>excludeEnd("ctx");
  3205. var $1;
  3206. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3207. return (0);
  3208. }));
  3209. $1=$recv(index).__eq((0));
  3210. if($core.assert($1)){
  3211. return $recv(aBlock)._value();
  3212. } else {
  3213. return $recv($self["@keys"])._at_(index);
  3214. }
  3215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3216. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3217. //>>excludeEnd("ctx");
  3218. },
  3219. //>>excludeStart("ide", pragmas.excludeIdeData);
  3220. args: ["anObject", "aBlock"],
  3221. 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 ]",
  3222. referencedClasses: [],
  3223. //>>excludeEnd("ide");
  3224. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3225. }),
  3226. $globals.Dictionary);
  3227. $core.addMethod(
  3228. $core.method({
  3229. selector: "initialize",
  3230. protocol: "initialization",
  3231. fn: function (){
  3232. var self=this,$self=this;
  3233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3234. return $core.withContext(function($ctx1) {
  3235. //>>excludeEnd("ctx");
  3236. (
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. $ctx1.supercall = true,
  3239. //>>excludeEnd("ctx");
  3240. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  3241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3242. $ctx1.supercall = false;
  3243. //>>excludeEnd("ctx");;
  3244. $self["@keys"]=[];
  3245. $self["@values"]=[];
  3246. return self;
  3247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3248. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3249. //>>excludeEnd("ctx");
  3250. },
  3251. //>>excludeStart("ide", pragmas.excludeIdeData);
  3252. args: [],
  3253. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3254. referencedClasses: [],
  3255. //>>excludeEnd("ide");
  3256. messageSends: ["initialize"]
  3257. }),
  3258. $globals.Dictionary);
  3259. $core.addMethod(
  3260. $core.method({
  3261. selector: "keys",
  3262. protocol: "accessing",
  3263. fn: function (){
  3264. var self=this,$self=this;
  3265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3266. return $core.withContext(function($ctx1) {
  3267. //>>excludeEnd("ctx");
  3268. return $recv($self["@keys"])._copy();
  3269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3270. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3271. //>>excludeEnd("ctx");
  3272. },
  3273. //>>excludeStart("ide", pragmas.excludeIdeData);
  3274. args: [],
  3275. source: "keys\x0a\x09^ keys copy",
  3276. referencedClasses: [],
  3277. //>>excludeEnd("ide");
  3278. messageSends: ["copy"]
  3279. }),
  3280. $globals.Dictionary);
  3281. $core.addMethod(
  3282. $core.method({
  3283. selector: "keysAndValuesDo:",
  3284. protocol: "enumerating",
  3285. fn: function (aBlock){
  3286. var self=this,$self=this;
  3287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3288. return $core.withContext(function($ctx1) {
  3289. //>>excludeEnd("ctx");
  3290. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  3291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3292. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3293. //>>excludeEnd("ctx");
  3294. },
  3295. //>>excludeStart("ide", pragmas.excludeIdeData);
  3296. args: ["aBlock"],
  3297. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3298. referencedClasses: [],
  3299. //>>excludeEnd("ide");
  3300. messageSends: ["with:do:"]
  3301. }),
  3302. $globals.Dictionary);
  3303. $core.addMethod(
  3304. $core.method({
  3305. selector: "keysDo:",
  3306. protocol: "enumerating",
  3307. fn: function (aBlock){
  3308. var self=this,$self=this;
  3309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3310. return $core.withContext(function($ctx1) {
  3311. //>>excludeEnd("ctx");
  3312. return $recv($self["@keys"])._do_(aBlock);
  3313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3314. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3315. //>>excludeEnd("ctx");
  3316. },
  3317. //>>excludeStart("ide", pragmas.excludeIdeData);
  3318. args: ["aBlock"],
  3319. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3320. referencedClasses: [],
  3321. //>>excludeEnd("ide");
  3322. messageSends: ["do:"]
  3323. }),
  3324. $globals.Dictionary);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "positionOfKey:",
  3328. protocol: "private",
  3329. fn: function (anObject){
  3330. var self=this,$self=this;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. return $core.withContext(function($ctx1) {
  3333. //>>excludeEnd("ctx");
  3334. var keys = $self['@keys'];
  3335. for(var i=0;i<keys.length;i++){
  3336. if(keys[i].__eq(anObject)) { return i;}
  3337. }
  3338. return -1;
  3339. ;
  3340. return self;
  3341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3342. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3343. //>>excludeEnd("ctx");
  3344. },
  3345. //>>excludeStart("ide", pragmas.excludeIdeData);
  3346. args: ["anObject"],
  3347. 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'>",
  3348. referencedClasses: [],
  3349. //>>excludeEnd("ide");
  3350. messageSends: []
  3351. }),
  3352. $globals.Dictionary);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "removeAll",
  3356. protocol: "adding/removing",
  3357. fn: function (){
  3358. var self=this,$self=this;
  3359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3360. return $core.withContext(function($ctx1) {
  3361. //>>excludeEnd("ctx");
  3362. $recv($self["@keys"])._removeAll();
  3363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3364. $ctx1.sendIdx["removeAll"]=1;
  3365. //>>excludeEnd("ctx");
  3366. $recv($self["@values"])._removeAll();
  3367. return self;
  3368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3369. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3370. //>>excludeEnd("ctx");
  3371. },
  3372. //>>excludeStart("ide", pragmas.excludeIdeData);
  3373. args: [],
  3374. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3375. referencedClasses: [],
  3376. //>>excludeEnd("ide");
  3377. messageSends: ["removeAll"]
  3378. }),
  3379. $globals.Dictionary);
  3380. $core.addMethod(
  3381. $core.method({
  3382. selector: "removeKey:ifAbsent:",
  3383. protocol: "adding/removing",
  3384. fn: function (aKey,aBlock){
  3385. var self=this,$self=this;
  3386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3387. return $core.withContext(function($ctx1) {
  3388. //>>excludeEnd("ctx");
  3389. var index = $self._positionOfKey_(aKey);
  3390. if(index === -1) {
  3391. return aBlock._value()
  3392. } else {
  3393. var keys = $self['@keys'], values = $self['@values'];
  3394. var value = values[index], l = keys.length;
  3395. keys[index] = keys[l-1];
  3396. keys.pop();
  3397. values[index] = values[l-1];
  3398. values.pop();
  3399. return value;
  3400. }
  3401. ;
  3402. return self;
  3403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3404. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3405. //>>excludeEnd("ctx");
  3406. },
  3407. //>>excludeStart("ide", pragmas.excludeIdeData);
  3408. args: ["aKey", "aBlock"],
  3409. 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'>",
  3410. referencedClasses: [],
  3411. //>>excludeEnd("ide");
  3412. messageSends: []
  3413. }),
  3414. $globals.Dictionary);
  3415. $core.addMethod(
  3416. $core.method({
  3417. selector: "values",
  3418. protocol: "accessing",
  3419. fn: function (){
  3420. var self=this,$self=this;
  3421. return $self["@values"];
  3422. },
  3423. //>>excludeStart("ide", pragmas.excludeIdeData);
  3424. args: [],
  3425. source: "values\x0a\x09^ values",
  3426. referencedClasses: [],
  3427. //>>excludeEnd("ide");
  3428. messageSends: []
  3429. }),
  3430. $globals.Dictionary);
  3431. $core.addMethod(
  3432. $core.method({
  3433. selector: "valuesDo:",
  3434. protocol: "enumerating",
  3435. fn: function (aBlock){
  3436. var self=this,$self=this;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. return $core.withContext(function($ctx1) {
  3439. //>>excludeEnd("ctx");
  3440. return $recv($self["@values"])._do_(aBlock);
  3441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3442. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3443. //>>excludeEnd("ctx");
  3444. },
  3445. //>>excludeStart("ide", pragmas.excludeIdeData);
  3446. args: ["aBlock"],
  3447. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3448. referencedClasses: [],
  3449. //>>excludeEnd("ide");
  3450. messageSends: ["do:"]
  3451. }),
  3452. $globals.Dictionary);
  3453. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3454. //>>excludeStart("ide", pragmas.excludeIdeData);
  3455. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3456. //>>excludeEnd("ide");
  3457. $core.addMethod(
  3458. $core.method({
  3459. selector: "at:ifAbsent:",
  3460. protocol: "accessing",
  3461. fn: function (aKey,aBlock){
  3462. var self=this,$self=this;
  3463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3464. return $core.withContext(function($ctx1) {
  3465. //>>excludeEnd("ctx");
  3466. var $1;
  3467. $1=$self._includesKey_(aKey);
  3468. if($core.assert($1)){
  3469. return $self._basicAt_(aKey);
  3470. } else {
  3471. return $recv(aBlock)._value();
  3472. }
  3473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3474. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3475. //>>excludeEnd("ctx");
  3476. },
  3477. //>>excludeStart("ide", pragmas.excludeIdeData);
  3478. args: ["aKey", "aBlock"],
  3479. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3480. referencedClasses: [],
  3481. //>>excludeEnd("ide");
  3482. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3483. }),
  3484. $globals.HashedCollection);
  3485. $core.addMethod(
  3486. $core.method({
  3487. selector: "at:put:",
  3488. protocol: "accessing",
  3489. fn: function (aKey,aValue){
  3490. var self=this,$self=this;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return $core.withContext(function($ctx1) {
  3493. //>>excludeEnd("ctx");
  3494. return $self._basicAt_put_(aKey,aValue);
  3495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3496. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3497. //>>excludeEnd("ctx");
  3498. },
  3499. //>>excludeStart("ide", pragmas.excludeIdeData);
  3500. args: ["aKey", "aValue"],
  3501. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3502. referencedClasses: [],
  3503. //>>excludeEnd("ide");
  3504. messageSends: ["basicAt:put:"]
  3505. }),
  3506. $globals.HashedCollection);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "includesKey:",
  3510. protocol: "testing",
  3511. fn: function (aKey){
  3512. var self=this,$self=this;
  3513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3514. return $core.withContext(function($ctx1) {
  3515. //>>excludeEnd("ctx");
  3516. return self.hasOwnProperty(aKey);
  3517. return self;
  3518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3519. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3520. //>>excludeEnd("ctx");
  3521. },
  3522. //>>excludeStart("ide", pragmas.excludeIdeData);
  3523. args: ["aKey"],
  3524. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3525. referencedClasses: [],
  3526. //>>excludeEnd("ide");
  3527. messageSends: []
  3528. }),
  3529. $globals.HashedCollection);
  3530. $core.addMethod(
  3531. $core.method({
  3532. selector: "keys",
  3533. protocol: "accessing",
  3534. fn: function (){
  3535. var self=this,$self=this;
  3536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3537. return $core.withContext(function($ctx1) {
  3538. //>>excludeEnd("ctx");
  3539. return Object.keys(self);
  3540. return self;
  3541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3542. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3543. //>>excludeEnd("ctx");
  3544. },
  3545. //>>excludeStart("ide", pragmas.excludeIdeData);
  3546. args: [],
  3547. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3548. referencedClasses: [],
  3549. //>>excludeEnd("ide");
  3550. messageSends: []
  3551. }),
  3552. $globals.HashedCollection);
  3553. $core.addMethod(
  3554. $core.method({
  3555. selector: "keysDo:",
  3556. protocol: "enumerating",
  3557. fn: function (aBlock){
  3558. var self=this,$self=this;
  3559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3560. return $core.withContext(function($ctx1) {
  3561. //>>excludeEnd("ctx");
  3562. $recv($self._keys())._do_(aBlock);
  3563. return self;
  3564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3565. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3566. //>>excludeEnd("ctx");
  3567. },
  3568. //>>excludeStart("ide", pragmas.excludeIdeData);
  3569. args: ["aBlock"],
  3570. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3571. referencedClasses: [],
  3572. //>>excludeEnd("ide");
  3573. messageSends: ["do:", "keys"]
  3574. }),
  3575. $globals.HashedCollection);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: "removeKey:ifAbsent:",
  3579. protocol: "adding/removing",
  3580. fn: function (aKey,aBlock){
  3581. var self=this,$self=this;
  3582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3583. return $core.withContext(function($ctx1) {
  3584. //>>excludeEnd("ctx");
  3585. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3587. return $core.withContext(function($ctx2) {
  3588. //>>excludeEnd("ctx");
  3589. $self._basicDelete_(aKey);
  3590. return removed;
  3591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3592. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3593. //>>excludeEnd("ctx");
  3594. }),(function(){
  3595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3596. return $core.withContext(function($ctx2) {
  3597. //>>excludeEnd("ctx");
  3598. return $recv(aBlock)._value();
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3601. //>>excludeEnd("ctx");
  3602. }));
  3603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3604. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3605. //>>excludeEnd("ctx");
  3606. },
  3607. //>>excludeStart("ide", pragmas.excludeIdeData);
  3608. args: ["aKey", "aBlock"],
  3609. 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 ]",
  3610. referencedClasses: [],
  3611. //>>excludeEnd("ide");
  3612. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3613. }),
  3614. $globals.HashedCollection);
  3615. $core.addMethod(
  3616. $core.method({
  3617. selector: "values",
  3618. protocol: "accessing",
  3619. fn: function (){
  3620. var self=this,$self=this;
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. return $core.withContext(function($ctx1) {
  3623. //>>excludeEnd("ctx");
  3624. return $self._keys().map(function(key){
  3625. return $self._at_(key);
  3626. });
  3627. ;
  3628. return self;
  3629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3630. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3631. //>>excludeEnd("ctx");
  3632. },
  3633. //>>excludeStart("ide", pragmas.excludeIdeData);
  3634. args: [],
  3635. 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'>",
  3636. referencedClasses: [],
  3637. //>>excludeEnd("ide");
  3638. messageSends: []
  3639. }),
  3640. $globals.HashedCollection);
  3641. $core.addMethod(
  3642. $core.method({
  3643. selector: "valuesDo:",
  3644. protocol: "enumerating",
  3645. fn: function (aBlock){
  3646. var self=this,$self=this;
  3647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3648. return $core.withContext(function($ctx1) {
  3649. //>>excludeEnd("ctx");
  3650. $recv($self._values())._do_(aBlock);
  3651. return self;
  3652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3653. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3654. //>>excludeEnd("ctx");
  3655. },
  3656. //>>excludeStart("ide", pragmas.excludeIdeData);
  3657. args: ["aBlock"],
  3658. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3659. referencedClasses: [],
  3660. //>>excludeEnd("ide");
  3661. messageSends: ["do:", "values"]
  3662. }),
  3663. $globals.HashedCollection);
  3664. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  3665. //>>excludeStart("ide", pragmas.excludeIdeData);
  3666. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3667. //>>excludeEnd("ide");
  3668. $core.addMethod(
  3669. $core.method({
  3670. selector: "=",
  3671. protocol: "comparing",
  3672. fn: function (aCollection){
  3673. var self=this,$self=this;
  3674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3675. return $core.withContext(function($ctx1) {
  3676. //>>excludeEnd("ctx");
  3677. var $3,$2,$4,$1,$5;
  3678. var $early={};
  3679. try {
  3680. $3=$self._class();
  3681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3682. $ctx1.sendIdx["class"]=1;
  3683. //>>excludeEnd("ctx");
  3684. $2=$recv($3).__eq($recv(aCollection)._class());
  3685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3686. $ctx1.sendIdx["="]=1;
  3687. //>>excludeEnd("ctx");
  3688. $1=$recv($2)._and_((function(){
  3689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3690. return $core.withContext(function($ctx2) {
  3691. //>>excludeEnd("ctx");
  3692. $4=$self._size();
  3693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3694. $ctx2.sendIdx["size"]=1;
  3695. //>>excludeEnd("ctx");
  3696. return $recv($4).__eq($recv(aCollection)._size());
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. $ctx2.sendIdx["="]=2;
  3699. //>>excludeEnd("ctx");
  3700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3701. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3702. //>>excludeEnd("ctx");
  3703. }));
  3704. if(!$core.assert($1)){
  3705. return false;
  3706. }
  3707. $self._withIndexDo_((function(each,i){
  3708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3709. return $core.withContext(function($ctx2) {
  3710. //>>excludeEnd("ctx");
  3711. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3712. if(!$core.assert($5)){
  3713. throw $early=[false];
  3714. }
  3715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3716. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3717. //>>excludeEnd("ctx");
  3718. }));
  3719. return true;
  3720. }
  3721. catch(e) {if(e===$early)return e[0]; throw e}
  3722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3723. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3724. //>>excludeEnd("ctx");
  3725. },
  3726. //>>excludeStart("ide", pragmas.excludeIdeData);
  3727. args: ["aCollection"],
  3728. 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",
  3729. referencedClasses: [],
  3730. //>>excludeEnd("ide");
  3731. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3732. }),
  3733. $globals.SequenceableCollection);
  3734. $core.addMethod(
  3735. $core.method({
  3736. selector: "addLast:",
  3737. protocol: "adding/removing",
  3738. fn: function (anObject){
  3739. var self=this,$self=this;
  3740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3741. return $core.withContext(function($ctx1) {
  3742. //>>excludeEnd("ctx");
  3743. $self._add_(anObject);
  3744. return self;
  3745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3746. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3747. //>>excludeEnd("ctx");
  3748. },
  3749. //>>excludeStart("ide", pragmas.excludeIdeData);
  3750. args: ["anObject"],
  3751. source: "addLast: anObject\x0a\x09self add: anObject",
  3752. referencedClasses: [],
  3753. //>>excludeEnd("ide");
  3754. messageSends: ["add:"]
  3755. }),
  3756. $globals.SequenceableCollection);
  3757. $core.addMethod(
  3758. $core.method({
  3759. selector: "allButFirst",
  3760. protocol: "accessing",
  3761. fn: function (){
  3762. var self=this,$self=this;
  3763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3764. return $core.withContext(function($ctx1) {
  3765. //>>excludeEnd("ctx");
  3766. return $self._copyFrom_to_((2),$self._size());
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3769. //>>excludeEnd("ctx");
  3770. },
  3771. //>>excludeStart("ide", pragmas.excludeIdeData);
  3772. args: [],
  3773. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3774. referencedClasses: [],
  3775. //>>excludeEnd("ide");
  3776. messageSends: ["copyFrom:to:", "size"]
  3777. }),
  3778. $globals.SequenceableCollection);
  3779. $core.addMethod(
  3780. $core.method({
  3781. selector: "allButLast",
  3782. protocol: "accessing",
  3783. fn: function (){
  3784. var self=this,$self=this;
  3785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3786. return $core.withContext(function($ctx1) {
  3787. //>>excludeEnd("ctx");
  3788. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3790. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3791. //>>excludeEnd("ctx");
  3792. },
  3793. //>>excludeStart("ide", pragmas.excludeIdeData);
  3794. args: [],
  3795. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3796. referencedClasses: [],
  3797. //>>excludeEnd("ide");
  3798. messageSends: ["copyFrom:to:", "-", "size"]
  3799. }),
  3800. $globals.SequenceableCollection);
  3801. $core.addMethod(
  3802. $core.method({
  3803. selector: "anyOne",
  3804. protocol: "accessing",
  3805. fn: function (){
  3806. var self=this,$self=this;
  3807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3808. return $core.withContext(function($ctx1) {
  3809. //>>excludeEnd("ctx");
  3810. return $self._at_((1));
  3811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3812. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3813. //>>excludeEnd("ctx");
  3814. },
  3815. //>>excludeStart("ide", pragmas.excludeIdeData);
  3816. args: [],
  3817. source: "anyOne\x0a\x09^ self at: 1",
  3818. referencedClasses: [],
  3819. //>>excludeEnd("ide");
  3820. messageSends: ["at:"]
  3821. }),
  3822. $globals.SequenceableCollection);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "atRandom",
  3826. protocol: "accessing",
  3827. fn: function (){
  3828. var self=this,$self=this;
  3829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3830. return $core.withContext(function($ctx1) {
  3831. //>>excludeEnd("ctx");
  3832. return $self._at_($recv($self._size())._atRandom());
  3833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3834. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3835. //>>excludeEnd("ctx");
  3836. },
  3837. //>>excludeStart("ide", pragmas.excludeIdeData);
  3838. args: [],
  3839. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3840. referencedClasses: [],
  3841. //>>excludeEnd("ide");
  3842. messageSends: ["at:", "atRandom", "size"]
  3843. }),
  3844. $globals.SequenceableCollection);
  3845. $core.addMethod(
  3846. $core.method({
  3847. selector: "beginsWith:",
  3848. protocol: "testing",
  3849. fn: function (prefix){
  3850. var self=this,$self=this;
  3851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3852. return $core.withContext(function($ctx1) {
  3853. //>>excludeEnd("ctx");
  3854. var $2,$3,$1;
  3855. $2=$self._size();
  3856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3857. $ctx1.sendIdx["size"]=1;
  3858. //>>excludeEnd("ctx");
  3859. $3=$recv(prefix)._size();
  3860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3861. $ctx1.sendIdx["size"]=2;
  3862. //>>excludeEnd("ctx");
  3863. $1=$recv($2).__lt($3);
  3864. if($core.assert($1)){
  3865. return false;
  3866. }
  3867. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3869. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3870. //>>excludeEnd("ctx");
  3871. },
  3872. //>>excludeStart("ide", pragmas.excludeIdeData);
  3873. args: ["prefix"],
  3874. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3875. referencedClasses: [],
  3876. //>>excludeEnd("ide");
  3877. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3878. }),
  3879. $globals.SequenceableCollection);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "copyFrom:to:",
  3883. protocol: "copying",
  3884. fn: function (anIndex,anotherIndex){
  3885. var self=this,$self=this;
  3886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3887. return $core.withContext(function($ctx1) {
  3888. //>>excludeEnd("ctx");
  3889. $self._subclassResponsibility();
  3890. return self;
  3891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3892. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3893. //>>excludeEnd("ctx");
  3894. },
  3895. //>>excludeStart("ide", pragmas.excludeIdeData);
  3896. args: ["anIndex", "anotherIndex"],
  3897. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3898. referencedClasses: [],
  3899. //>>excludeEnd("ide");
  3900. messageSends: ["subclassResponsibility"]
  3901. }),
  3902. $globals.SequenceableCollection);
  3903. $core.addMethod(
  3904. $core.method({
  3905. selector: "detect:ifNone:",
  3906. protocol: "enumerating",
  3907. fn: function (aBlock,anotherBlock){
  3908. var self=this,$self=this;
  3909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3910. return $core.withContext(function($ctx1) {
  3911. //>>excludeEnd("ctx");
  3912. for(var i = 0; i < self.length; i++)
  3913. if(aBlock._value_(self[i]))
  3914. return self[i];
  3915. return anotherBlock._value();
  3916. ;
  3917. return self;
  3918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3919. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3920. //>>excludeEnd("ctx");
  3921. },
  3922. //>>excludeStart("ide", pragmas.excludeIdeData);
  3923. args: ["aBlock", "anotherBlock"],
  3924. 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'>",
  3925. referencedClasses: [],
  3926. //>>excludeEnd("ide");
  3927. messageSends: []
  3928. }),
  3929. $globals.SequenceableCollection);
  3930. $core.addMethod(
  3931. $core.method({
  3932. selector: "do:",
  3933. protocol: "enumerating",
  3934. fn: function (aBlock){
  3935. var self=this,$self=this;
  3936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3937. return $core.withContext(function($ctx1) {
  3938. //>>excludeEnd("ctx");
  3939. for(var i=0; i < self.length; i++) {
  3940. aBlock._value_(self[i]);
  3941. }
  3942. ;
  3943. return self;
  3944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3945. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3946. //>>excludeEnd("ctx");
  3947. },
  3948. //>>excludeStart("ide", pragmas.excludeIdeData);
  3949. args: ["aBlock"],
  3950. 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'>",
  3951. referencedClasses: [],
  3952. //>>excludeEnd("ide");
  3953. messageSends: []
  3954. }),
  3955. $globals.SequenceableCollection);
  3956. $core.addMethod(
  3957. $core.method({
  3958. selector: "endsWith:",
  3959. protocol: "testing",
  3960. fn: function (suffix){
  3961. var self=this,$self=this;
  3962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3963. return $core.withContext(function($ctx1) {
  3964. //>>excludeEnd("ctx");
  3965. var $2,$3,$1;
  3966. $2=$self._size();
  3967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3968. $ctx1.sendIdx["size"]=1;
  3969. //>>excludeEnd("ctx");
  3970. $3=$recv(suffix)._size();
  3971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3972. $ctx1.sendIdx["size"]=2;
  3973. //>>excludeEnd("ctx");
  3974. $1=$recv($2).__lt($3);
  3975. if($core.assert($1)){
  3976. return false;
  3977. }
  3978. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3980. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3981. //>>excludeEnd("ctx");
  3982. },
  3983. //>>excludeStart("ide", pragmas.excludeIdeData);
  3984. args: ["suffix"],
  3985. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3986. referencedClasses: [],
  3987. //>>excludeEnd("ide");
  3988. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3989. }),
  3990. $globals.SequenceableCollection);
  3991. $core.addMethod(
  3992. $core.method({
  3993. selector: "first",
  3994. protocol: "accessing",
  3995. fn: function (){
  3996. var self=this,$self=this;
  3997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3998. return $core.withContext(function($ctx1) {
  3999. //>>excludeEnd("ctx");
  4000. return $self._at_((1));
  4001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4002. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  4003. //>>excludeEnd("ctx");
  4004. },
  4005. //>>excludeStart("ide", pragmas.excludeIdeData);
  4006. args: [],
  4007. source: "first\x0a\x09^ self at: 1",
  4008. referencedClasses: [],
  4009. //>>excludeEnd("ide");
  4010. messageSends: ["at:"]
  4011. }),
  4012. $globals.SequenceableCollection);
  4013. $core.addMethod(
  4014. $core.method({
  4015. selector: "first:",
  4016. protocol: "accessing",
  4017. fn: function (aNumber){
  4018. var self=this,$self=this;
  4019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4020. return $core.withContext(function($ctx1) {
  4021. //>>excludeEnd("ctx");
  4022. var $1;
  4023. $1=$recv($self._size()).__lt(aNumber);
  4024. if($core.assert($1)){
  4025. $self._error_("Invalid number of elements");
  4026. }
  4027. return $self._copyFrom_to_((1),aNumber);
  4028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4029. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4030. //>>excludeEnd("ctx");
  4031. },
  4032. //>>excludeStart("ide", pragmas.excludeIdeData);
  4033. args: ["aNumber"],
  4034. 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",
  4035. referencedClasses: [],
  4036. //>>excludeEnd("ide");
  4037. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  4038. }),
  4039. $globals.SequenceableCollection);
  4040. $core.addMethod(
  4041. $core.method({
  4042. selector: "fourth",
  4043. protocol: "accessing",
  4044. fn: function (){
  4045. var self=this,$self=this;
  4046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4047. return $core.withContext(function($ctx1) {
  4048. //>>excludeEnd("ctx");
  4049. return $self._at_((4));
  4050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4051. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  4052. //>>excludeEnd("ctx");
  4053. },
  4054. //>>excludeStart("ide", pragmas.excludeIdeData);
  4055. args: [],
  4056. source: "fourth\x0a\x09^ self at: 4",
  4057. referencedClasses: [],
  4058. //>>excludeEnd("ide");
  4059. messageSends: ["at:"]
  4060. }),
  4061. $globals.SequenceableCollection);
  4062. $core.addMethod(
  4063. $core.method({
  4064. selector: "includes:",
  4065. protocol: "testing",
  4066. fn: function (anObject){
  4067. var self=this,$self=this;
  4068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4069. return $core.withContext(function($ctx1) {
  4070. //>>excludeEnd("ctx");
  4071. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  4072. return nil;
  4073. })))._notNil();
  4074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4075. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  4076. //>>excludeEnd("ctx");
  4077. },
  4078. //>>excludeStart("ide", pragmas.excludeIdeData);
  4079. args: ["anObject"],
  4080. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4081. referencedClasses: [],
  4082. //>>excludeEnd("ide");
  4083. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4084. }),
  4085. $globals.SequenceableCollection);
  4086. $core.addMethod(
  4087. $core.method({
  4088. selector: "indexOf:ifAbsent:",
  4089. protocol: "accessing",
  4090. fn: function (anObject,aBlock){
  4091. var self=this,$self=this;
  4092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4093. return $core.withContext(function($ctx1) {
  4094. //>>excludeEnd("ctx");
  4095. for(var i=0; i < self.length; i++) {
  4096. if($recv(self[i]).__eq(anObject)) {return i+1}
  4097. };
  4098. return aBlock._value();
  4099. ;
  4100. return self;
  4101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4102. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  4103. //>>excludeEnd("ctx");
  4104. },
  4105. //>>excludeStart("ide", pragmas.excludeIdeData);
  4106. args: ["anObject", "aBlock"],
  4107. 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'>",
  4108. referencedClasses: [],
  4109. //>>excludeEnd("ide");
  4110. messageSends: []
  4111. }),
  4112. $globals.SequenceableCollection);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "indexOf:startingAt:",
  4116. protocol: "accessing",
  4117. fn: function (anObject,start){
  4118. var self=this,$self=this;
  4119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4120. return $core.withContext(function($ctx1) {
  4121. //>>excludeEnd("ctx");
  4122. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4123. return (0);
  4124. }));
  4125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4126. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4127. //>>excludeEnd("ctx");
  4128. },
  4129. //>>excludeStart("ide", pragmas.excludeIdeData);
  4130. args: ["anObject", "start"],
  4131. 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 ]",
  4132. referencedClasses: [],
  4133. //>>excludeEnd("ide");
  4134. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4135. }),
  4136. $globals.SequenceableCollection);
  4137. $core.addMethod(
  4138. $core.method({
  4139. selector: "indexOf:startingAt:ifAbsent:",
  4140. protocol: "accessing",
  4141. fn: function (anObject,start,aBlock){
  4142. var self=this,$self=this;
  4143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4144. return $core.withContext(function($ctx1) {
  4145. //>>excludeEnd("ctx");
  4146. for(var i=start - 1; i < self.length; i++){
  4147. if($recv(self[i]).__eq(anObject)) {return i+1}
  4148. }
  4149. return aBlock._value();
  4150. ;
  4151. return self;
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4154. //>>excludeEnd("ctx");
  4155. },
  4156. //>>excludeStart("ide", pragmas.excludeIdeData);
  4157. args: ["anObject", "start", "aBlock"],
  4158. 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'>",
  4159. referencedClasses: [],
  4160. //>>excludeEnd("ide");
  4161. messageSends: []
  4162. }),
  4163. $globals.SequenceableCollection);
  4164. $core.addMethod(
  4165. $core.method({
  4166. selector: "last",
  4167. protocol: "accessing",
  4168. fn: function (){
  4169. var self=this,$self=this;
  4170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4171. return $core.withContext(function($ctx1) {
  4172. //>>excludeEnd("ctx");
  4173. return $self._at_($self._size());
  4174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4175. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4176. //>>excludeEnd("ctx");
  4177. },
  4178. //>>excludeStart("ide", pragmas.excludeIdeData);
  4179. args: [],
  4180. source: "last\x0a\x09^ self at: self size",
  4181. referencedClasses: [],
  4182. //>>excludeEnd("ide");
  4183. messageSends: ["at:", "size"]
  4184. }),
  4185. $globals.SequenceableCollection);
  4186. $core.addMethod(
  4187. $core.method({
  4188. selector: "last:",
  4189. protocol: "accessing",
  4190. fn: function (aNumber){
  4191. var self=this,$self=this;
  4192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4193. return $core.withContext(function($ctx1) {
  4194. //>>excludeEnd("ctx");
  4195. var $2,$1,$5,$4,$3;
  4196. $2=$self._size();
  4197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4198. $ctx1.sendIdx["size"]=1;
  4199. //>>excludeEnd("ctx");
  4200. $1=$recv($2).__lt(aNumber);
  4201. if($core.assert($1)){
  4202. $self._error_("Invalid number of elements");
  4203. }
  4204. $5=$self._size();
  4205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4206. $ctx1.sendIdx["size"]=2;
  4207. //>>excludeEnd("ctx");
  4208. $4=$recv($5).__minus(aNumber);
  4209. $3=$recv($4).__plus((1));
  4210. return $self._copyFrom_to_($3,$self._size());
  4211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4212. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4213. //>>excludeEnd("ctx");
  4214. },
  4215. //>>excludeStart("ide", pragmas.excludeIdeData);
  4216. args: ["aNumber"],
  4217. 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",
  4218. referencedClasses: [],
  4219. //>>excludeEnd("ide");
  4220. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4221. }),
  4222. $globals.SequenceableCollection);
  4223. $core.addMethod(
  4224. $core.method({
  4225. selector: "newStream",
  4226. protocol: "streaming",
  4227. fn: function (){
  4228. var self=this,$self=this;
  4229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4230. return $core.withContext(function($ctx1) {
  4231. //>>excludeEnd("ctx");
  4232. return $recv($self._streamClass())._on_(self);
  4233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4234. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4235. //>>excludeEnd("ctx");
  4236. },
  4237. //>>excludeStart("ide", pragmas.excludeIdeData);
  4238. args: [],
  4239. source: "newStream\x0a\x09^ self streamClass on: self",
  4240. referencedClasses: [],
  4241. //>>excludeEnd("ide");
  4242. messageSends: ["on:", "streamClass"]
  4243. }),
  4244. $globals.SequenceableCollection);
  4245. $core.addMethod(
  4246. $core.method({
  4247. selector: "readStream",
  4248. protocol: "streaming",
  4249. fn: function (){
  4250. var self=this,$self=this;
  4251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4252. return $core.withContext(function($ctx1) {
  4253. //>>excludeEnd("ctx");
  4254. return $self._stream();
  4255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4256. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4257. //>>excludeEnd("ctx");
  4258. },
  4259. //>>excludeStart("ide", pragmas.excludeIdeData);
  4260. args: [],
  4261. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4262. referencedClasses: [],
  4263. //>>excludeEnd("ide");
  4264. messageSends: ["stream"]
  4265. }),
  4266. $globals.SequenceableCollection);
  4267. $core.addMethod(
  4268. $core.method({
  4269. selector: "removeLast",
  4270. protocol: "adding/removing",
  4271. fn: function (){
  4272. var self=this,$self=this;
  4273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4274. return $core.withContext(function($ctx1) {
  4275. //>>excludeEnd("ctx");
  4276. return $self._remove_($self._last());
  4277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4278. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4279. //>>excludeEnd("ctx");
  4280. },
  4281. //>>excludeStart("ide", pragmas.excludeIdeData);
  4282. args: [],
  4283. source: "removeLast\x0a\x09^ self remove: self last",
  4284. referencedClasses: [],
  4285. //>>excludeEnd("ide");
  4286. messageSends: ["remove:", "last"]
  4287. }),
  4288. $globals.SequenceableCollection);
  4289. $core.addMethod(
  4290. $core.method({
  4291. selector: "reverseDo:",
  4292. protocol: "enumerating",
  4293. fn: function (aBlock){
  4294. var self=this,$self=this;
  4295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4296. return $core.withContext(function($ctx1) {
  4297. //>>excludeEnd("ctx");
  4298. $recv($self._reversed())._do_(aBlock);
  4299. return self;
  4300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4301. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4302. //>>excludeEnd("ctx");
  4303. },
  4304. //>>excludeStart("ide", pragmas.excludeIdeData);
  4305. args: ["aBlock"],
  4306. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4307. referencedClasses: [],
  4308. //>>excludeEnd("ide");
  4309. messageSends: ["do:", "reversed"]
  4310. }),
  4311. $globals.SequenceableCollection);
  4312. $core.addMethod(
  4313. $core.method({
  4314. selector: "reversed",
  4315. protocol: "converting",
  4316. fn: function (){
  4317. var self=this,$self=this;
  4318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4319. return $core.withContext(function($ctx1) {
  4320. //>>excludeEnd("ctx");
  4321. $self._subclassResponsibility();
  4322. return self;
  4323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4324. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4325. //>>excludeEnd("ctx");
  4326. },
  4327. //>>excludeStart("ide", pragmas.excludeIdeData);
  4328. args: [],
  4329. source: "reversed\x0a\x09self subclassResponsibility",
  4330. referencedClasses: [],
  4331. //>>excludeEnd("ide");
  4332. messageSends: ["subclassResponsibility"]
  4333. }),
  4334. $globals.SequenceableCollection);
  4335. $core.addMethod(
  4336. $core.method({
  4337. selector: "second",
  4338. protocol: "accessing",
  4339. fn: function (){
  4340. var self=this,$self=this;
  4341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4342. return $core.withContext(function($ctx1) {
  4343. //>>excludeEnd("ctx");
  4344. return $self._at_((2));
  4345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4346. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4347. //>>excludeEnd("ctx");
  4348. },
  4349. //>>excludeStart("ide", pragmas.excludeIdeData);
  4350. args: [],
  4351. source: "second\x0a\x09^ self at: 2",
  4352. referencedClasses: [],
  4353. //>>excludeEnd("ide");
  4354. messageSends: ["at:"]
  4355. }),
  4356. $globals.SequenceableCollection);
  4357. $core.addMethod(
  4358. $core.method({
  4359. selector: "single",
  4360. protocol: "accessing",
  4361. fn: function (){
  4362. var self=this,$self=this;
  4363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4364. return $core.withContext(function($ctx1) {
  4365. //>>excludeEnd("ctx");
  4366. if (self.length == 0) throw new Error("Collection is empty");
  4367. if (self.length > 1) throw new Error("Collection holds more than one element.");
  4368. return self[0];;
  4369. return self;
  4370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4371. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  4372. //>>excludeEnd("ctx");
  4373. },
  4374. //>>excludeStart("ide", pragmas.excludeIdeData);
  4375. args: [],
  4376. 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'>",
  4377. referencedClasses: [],
  4378. //>>excludeEnd("ide");
  4379. messageSends: []
  4380. }),
  4381. $globals.SequenceableCollection);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "stream",
  4385. protocol: "streaming",
  4386. fn: function (){
  4387. var self=this,$self=this;
  4388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4389. return $core.withContext(function($ctx1) {
  4390. //>>excludeEnd("ctx");
  4391. return $self._newStream();
  4392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4393. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4394. //>>excludeEnd("ctx");
  4395. },
  4396. //>>excludeStart("ide", pragmas.excludeIdeData);
  4397. args: [],
  4398. source: "stream\x0a\x09^ self newStream",
  4399. referencedClasses: [],
  4400. //>>excludeEnd("ide");
  4401. messageSends: ["newStream"]
  4402. }),
  4403. $globals.SequenceableCollection);
  4404. $core.addMethod(
  4405. $core.method({
  4406. selector: "streamClass",
  4407. protocol: "streaming",
  4408. fn: function (){
  4409. var self=this,$self=this;
  4410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4411. return $core.withContext(function($ctx1) {
  4412. //>>excludeEnd("ctx");
  4413. return $recv($self._class())._streamClass();
  4414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4415. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4416. //>>excludeEnd("ctx");
  4417. },
  4418. //>>excludeStart("ide", pragmas.excludeIdeData);
  4419. args: [],
  4420. source: "streamClass\x0a\x09^ self class streamClass",
  4421. referencedClasses: [],
  4422. //>>excludeEnd("ide");
  4423. messageSends: ["streamClass", "class"]
  4424. }),
  4425. $globals.SequenceableCollection);
  4426. $core.addMethod(
  4427. $core.method({
  4428. selector: "third",
  4429. protocol: "accessing",
  4430. fn: function (){
  4431. var self=this,$self=this;
  4432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4433. return $core.withContext(function($ctx1) {
  4434. //>>excludeEnd("ctx");
  4435. return $self._at_((3));
  4436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4437. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4438. //>>excludeEnd("ctx");
  4439. },
  4440. //>>excludeStart("ide", pragmas.excludeIdeData);
  4441. args: [],
  4442. source: "third\x0a\x09^ self at: 3",
  4443. referencedClasses: [],
  4444. //>>excludeEnd("ide");
  4445. messageSends: ["at:"]
  4446. }),
  4447. $globals.SequenceableCollection);
  4448. $core.addMethod(
  4449. $core.method({
  4450. selector: "with:do:",
  4451. protocol: "enumerating",
  4452. fn: function (anotherCollection,aBlock){
  4453. var self=this,$self=this;
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. return $core.withContext(function($ctx1) {
  4456. //>>excludeEnd("ctx");
  4457. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  4458. for(var i=0; i<self.length; i++) {
  4459. aBlock._value_value_(self[i], anotherCollection[i]);
  4460. }
  4461. ;
  4462. return self;
  4463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4464. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4465. //>>excludeEnd("ctx");
  4466. },
  4467. //>>excludeStart("ide", pragmas.excludeIdeData);
  4468. args: ["anotherCollection", "aBlock"],
  4469. 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'>",
  4470. referencedClasses: [],
  4471. //>>excludeEnd("ide");
  4472. messageSends: []
  4473. }),
  4474. $globals.SequenceableCollection);
  4475. $core.addMethod(
  4476. $core.method({
  4477. selector: "withIndexDo:",
  4478. protocol: "enumerating",
  4479. fn: function (aBlock){
  4480. var self=this,$self=this;
  4481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4482. return $core.withContext(function($ctx1) {
  4483. //>>excludeEnd("ctx");
  4484. for(var i=0; i < self.length; i++) {
  4485. aBlock._value_value_(self[i], i+1);
  4486. }
  4487. ;
  4488. return self;
  4489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4490. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4491. //>>excludeEnd("ctx");
  4492. },
  4493. //>>excludeStart("ide", pragmas.excludeIdeData);
  4494. args: ["aBlock"],
  4495. 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'>",
  4496. referencedClasses: [],
  4497. //>>excludeEnd("ide");
  4498. messageSends: []
  4499. }),
  4500. $globals.SequenceableCollection);
  4501. $core.addMethod(
  4502. $core.method({
  4503. selector: "writeStream",
  4504. protocol: "streaming",
  4505. fn: function (){
  4506. var self=this,$self=this;
  4507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4508. return $core.withContext(function($ctx1) {
  4509. //>>excludeEnd("ctx");
  4510. return $self._stream();
  4511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4512. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4513. //>>excludeEnd("ctx");
  4514. },
  4515. //>>excludeStart("ide", pragmas.excludeIdeData);
  4516. args: [],
  4517. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4518. referencedClasses: [],
  4519. //>>excludeEnd("ide");
  4520. messageSends: ["stream"]
  4521. }),
  4522. $globals.SequenceableCollection);
  4523. $core.addMethod(
  4524. $core.method({
  4525. selector: "streamClass",
  4526. protocol: "accessing",
  4527. fn: function (){
  4528. var self=this,$self=this;
  4529. return $globals.Stream;
  4530. },
  4531. //>>excludeStart("ide", pragmas.excludeIdeData);
  4532. args: [],
  4533. source: "streamClass\x0a\x09\x09^ Stream",
  4534. referencedClasses: ["Stream"],
  4535. //>>excludeEnd("ide");
  4536. messageSends: []
  4537. }),
  4538. $globals.SequenceableCollection.a$cls);
  4539. $core.addMethod(
  4540. $core.method({
  4541. selector: "streamContents:",
  4542. protocol: "streaming",
  4543. fn: function (aBlock){
  4544. var self=this,$self=this;
  4545. var stream;
  4546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4547. return $core.withContext(function($ctx1) {
  4548. //>>excludeEnd("ctx");
  4549. stream=$recv($self._streamClass())._on_($self._new());
  4550. $recv(aBlock)._value_(stream);
  4551. return $recv(stream)._contents();
  4552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4553. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4554. //>>excludeEnd("ctx");
  4555. },
  4556. //>>excludeStart("ide", pragmas.excludeIdeData);
  4557. args: ["aBlock"],
  4558. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4559. referencedClasses: [],
  4560. //>>excludeEnd("ide");
  4561. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4562. }),
  4563. $globals.SequenceableCollection.a$cls);
  4564. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4565. //>>excludeStart("ide", pragmas.excludeIdeData);
  4566. $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`.";
  4567. //>>excludeEnd("ide");
  4568. $core.addMethod(
  4569. $core.method({
  4570. selector: "add:",
  4571. protocol: "adding/removing",
  4572. fn: function (anObject){
  4573. var self=this,$self=this;
  4574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4575. return $core.withContext(function($ctx1) {
  4576. //>>excludeEnd("ctx");
  4577. self.push(anObject); return anObject;;
  4578. return self;
  4579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4580. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4581. //>>excludeEnd("ctx");
  4582. },
  4583. //>>excludeStart("ide", pragmas.excludeIdeData);
  4584. args: ["anObject"],
  4585. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4586. referencedClasses: [],
  4587. //>>excludeEnd("ide");
  4588. messageSends: []
  4589. }),
  4590. $globals.Array);
  4591. $core.addMethod(
  4592. $core.method({
  4593. selector: "addAll:",
  4594. protocol: "adding/removing",
  4595. fn: function (aCollection){
  4596. var self=this,$self=this;
  4597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4598. return $core.withContext(function($ctx1) {
  4599. //>>excludeEnd("ctx");
  4600. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4601. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4602. return aCollection;;
  4603. return self;
  4604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4605. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4606. //>>excludeEnd("ctx");
  4607. },
  4608. //>>excludeStart("ide", pragmas.excludeIdeData);
  4609. args: ["aCollection"],
  4610. 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'>",
  4611. referencedClasses: [],
  4612. //>>excludeEnd("ide");
  4613. messageSends: []
  4614. }),
  4615. $globals.Array);
  4616. $core.addMethod(
  4617. $core.method({
  4618. selector: "addFirst:",
  4619. protocol: "adding/removing",
  4620. fn: function (anObject){
  4621. var self=this,$self=this;
  4622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4623. return $core.withContext(function($ctx1) {
  4624. //>>excludeEnd("ctx");
  4625. self.unshift(anObject); return anObject;;
  4626. return self;
  4627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4628. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4629. //>>excludeEnd("ctx");
  4630. },
  4631. //>>excludeStart("ide", pragmas.excludeIdeData);
  4632. args: ["anObject"],
  4633. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4634. referencedClasses: [],
  4635. //>>excludeEnd("ide");
  4636. messageSends: []
  4637. }),
  4638. $globals.Array);
  4639. $core.addMethod(
  4640. $core.method({
  4641. selector: "asJavaScriptSource",
  4642. protocol: "converting",
  4643. fn: function (){
  4644. var self=this,$self=this;
  4645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4646. return $core.withContext(function($ctx1) {
  4647. //>>excludeEnd("ctx");
  4648. var $1;
  4649. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4651. return $core.withContext(function($ctx2) {
  4652. //>>excludeEnd("ctx");
  4653. return $recv(each)._asJavaScriptSource();
  4654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4655. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4656. //>>excludeEnd("ctx");
  4657. })))._join_(", "))).__comma("]");
  4658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4659. $ctx1.sendIdx[","]=1;
  4660. //>>excludeEnd("ctx");
  4661. return $1;
  4662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4663. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4664. //>>excludeEnd("ctx");
  4665. },
  4666. //>>excludeStart("ide", pragmas.excludeIdeData);
  4667. args: [],
  4668. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4669. referencedClasses: [],
  4670. //>>excludeEnd("ide");
  4671. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4672. }),
  4673. $globals.Array);
  4674. $core.addMethod(
  4675. $core.method({
  4676. selector: "at:ifAbsent:",
  4677. protocol: "accessing",
  4678. fn: function (anIndex,aBlock){
  4679. var self=this,$self=this;
  4680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4681. return $core.withContext(function($ctx1) {
  4682. //>>excludeEnd("ctx");
  4683. return anIndex >= 1 && anIndex <= self.length
  4684. ? self[anIndex - 1]
  4685. : aBlock._value()
  4686. ;
  4687. return self;
  4688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4689. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4690. //>>excludeEnd("ctx");
  4691. },
  4692. //>>excludeStart("ide", pragmas.excludeIdeData);
  4693. args: ["anIndex", "aBlock"],
  4694. 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'>",
  4695. referencedClasses: [],
  4696. //>>excludeEnd("ide");
  4697. messageSends: []
  4698. }),
  4699. $globals.Array);
  4700. $core.addMethod(
  4701. $core.method({
  4702. selector: "at:ifPresent:ifAbsent:",
  4703. protocol: "accessing",
  4704. fn: function (anIndex,aBlock,anotherBlock){
  4705. var self=this,$self=this;
  4706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4707. return $core.withContext(function($ctx1) {
  4708. //>>excludeEnd("ctx");
  4709. return anIndex >= 1 && anIndex <= self.length
  4710. ? aBlock._value_(self[anIndex - 1])
  4711. : anotherBlock._value()
  4712. ;
  4713. return self;
  4714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4715. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4716. //>>excludeEnd("ctx");
  4717. },
  4718. //>>excludeStart("ide", pragmas.excludeIdeData);
  4719. args: ["anIndex", "aBlock", "anotherBlock"],
  4720. 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'>",
  4721. referencedClasses: [],
  4722. //>>excludeEnd("ide");
  4723. messageSends: []
  4724. }),
  4725. $globals.Array);
  4726. $core.addMethod(
  4727. $core.method({
  4728. selector: "at:put:",
  4729. protocol: "accessing",
  4730. fn: function (anIndex,anObject){
  4731. var self=this,$self=this;
  4732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4733. return $core.withContext(function($ctx1) {
  4734. //>>excludeEnd("ctx");
  4735. return self[anIndex - 1] = anObject;
  4736. return self;
  4737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4738. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4739. //>>excludeEnd("ctx");
  4740. },
  4741. //>>excludeStart("ide", pragmas.excludeIdeData);
  4742. args: ["anIndex", "anObject"],
  4743. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4744. referencedClasses: [],
  4745. //>>excludeEnd("ide");
  4746. messageSends: []
  4747. }),
  4748. $globals.Array);
  4749. $core.addMethod(
  4750. $core.method({
  4751. selector: "collect:",
  4752. protocol: "enumerating",
  4753. fn: function (aBlock){
  4754. var self=this,$self=this;
  4755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4756. return $core.withContext(function($ctx1) {
  4757. //>>excludeEnd("ctx");
  4758. return self.map(function(each) {return aBlock._value_(each)});
  4759. return self;
  4760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4761. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4762. //>>excludeEnd("ctx");
  4763. },
  4764. //>>excludeStart("ide", pragmas.excludeIdeData);
  4765. args: ["aBlock"],
  4766. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4767. referencedClasses: [],
  4768. //>>excludeEnd("ide");
  4769. messageSends: []
  4770. }),
  4771. $globals.Array);
  4772. $core.addMethod(
  4773. $core.method({
  4774. selector: "copyFrom:to:",
  4775. protocol: "copying",
  4776. fn: function (anIndex,anotherIndex){
  4777. var self=this,$self=this;
  4778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4779. return $core.withContext(function($ctx1) {
  4780. //>>excludeEnd("ctx");
  4781. if (anIndex >= 1 && anotherIndex <= self.length) {
  4782. return self.slice(anIndex - 1, anotherIndex);
  4783. } else {
  4784. self._at_(anIndex);
  4785. self._at_(self.length + 1);
  4786. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4787. };
  4788. return self;
  4789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4790. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4791. //>>excludeEnd("ctx");
  4792. },
  4793. //>>excludeStart("ide", pragmas.excludeIdeData);
  4794. args: ["anIndex", "anotherIndex"],
  4795. 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'>",
  4796. referencedClasses: [],
  4797. //>>excludeEnd("ide");
  4798. messageSends: []
  4799. }),
  4800. $globals.Array);
  4801. $core.addMethod(
  4802. $core.method({
  4803. selector: "join:",
  4804. protocol: "enumerating",
  4805. fn: function (aString){
  4806. var self=this,$self=this;
  4807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4808. return $core.withContext(function($ctx1) {
  4809. //>>excludeEnd("ctx");
  4810. return self.join(aString);
  4811. return self;
  4812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4813. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4814. //>>excludeEnd("ctx");
  4815. },
  4816. //>>excludeStart("ide", pragmas.excludeIdeData);
  4817. args: ["aString"],
  4818. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4819. referencedClasses: [],
  4820. //>>excludeEnd("ide");
  4821. messageSends: []
  4822. }),
  4823. $globals.Array);
  4824. $core.addMethod(
  4825. $core.method({
  4826. selector: "printOn:",
  4827. protocol: "printing",
  4828. fn: function (aStream){
  4829. var self=this,$self=this;
  4830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4831. return $core.withContext(function($ctx1) {
  4832. //>>excludeEnd("ctx");
  4833. (
  4834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4835. $ctx1.supercall = true,
  4836. //>>excludeEnd("ctx");
  4837. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4839. $ctx1.supercall = false;
  4840. //>>excludeEnd("ctx");;
  4841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4842. $ctx1.sendIdx["printOn:"]=1;
  4843. //>>excludeEnd("ctx");
  4844. $recv(aStream)._nextPutAll_(" (");
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. $ctx1.sendIdx["nextPutAll:"]=1;
  4847. //>>excludeEnd("ctx");
  4848. $self._do_separatedBy_((function(each){
  4849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4850. return $core.withContext(function($ctx2) {
  4851. //>>excludeEnd("ctx");
  4852. return $recv(each)._printOn_(aStream);
  4853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4854. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4855. //>>excludeEnd("ctx");
  4856. }),(function(){
  4857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4858. return $core.withContext(function($ctx2) {
  4859. //>>excludeEnd("ctx");
  4860. return $recv(aStream)._nextPutAll_(" ");
  4861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4862. $ctx2.sendIdx["nextPutAll:"]=2;
  4863. //>>excludeEnd("ctx");
  4864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4866. //>>excludeEnd("ctx");
  4867. }));
  4868. $recv(aStream)._nextPutAll_(")");
  4869. return self;
  4870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4871. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4872. //>>excludeEnd("ctx");
  4873. },
  4874. //>>excludeStart("ide", pragmas.excludeIdeData);
  4875. args: ["aStream"],
  4876. 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: ')'",
  4877. referencedClasses: [],
  4878. //>>excludeEnd("ide");
  4879. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4880. }),
  4881. $globals.Array);
  4882. $core.addMethod(
  4883. $core.method({
  4884. selector: "remove:ifAbsent:",
  4885. protocol: "adding/removing",
  4886. fn: function (anObject,aBlock){
  4887. var self=this,$self=this;
  4888. var index;
  4889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4890. return $core.withContext(function($ctx1) {
  4891. //>>excludeEnd("ctx");
  4892. var $1;
  4893. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4894. return (0);
  4895. }));
  4896. $1=$recv(index).__eq((0));
  4897. if($core.assert($1)){
  4898. return $recv(aBlock)._value();
  4899. } else {
  4900. $self._removeIndex_(index);
  4901. return anObject;
  4902. }
  4903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4904. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4905. //>>excludeEnd("ctx");
  4906. },
  4907. //>>excludeStart("ide", pragmas.excludeIdeData);
  4908. args: ["anObject", "aBlock"],
  4909. 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 ]",
  4910. referencedClasses: [],
  4911. //>>excludeEnd("ide");
  4912. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4913. }),
  4914. $globals.Array);
  4915. $core.addMethod(
  4916. $core.method({
  4917. selector: "removeAll",
  4918. protocol: "adding/removing",
  4919. fn: function (){
  4920. var self=this,$self=this;
  4921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4922. return $core.withContext(function($ctx1) {
  4923. //>>excludeEnd("ctx");
  4924. self.length = 0;
  4925. return self;
  4926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4927. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4928. //>>excludeEnd("ctx");
  4929. },
  4930. //>>excludeStart("ide", pragmas.excludeIdeData);
  4931. args: [],
  4932. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4933. referencedClasses: [],
  4934. //>>excludeEnd("ide");
  4935. messageSends: []
  4936. }),
  4937. $globals.Array);
  4938. $core.addMethod(
  4939. $core.method({
  4940. selector: "removeFrom:to:",
  4941. protocol: "adding/removing",
  4942. fn: function (aNumber,anotherNumber){
  4943. var self=this,$self=this;
  4944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4945. return $core.withContext(function($ctx1) {
  4946. //>>excludeEnd("ctx");
  4947. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4948. return self;
  4949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4950. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4951. //>>excludeEnd("ctx");
  4952. },
  4953. //>>excludeStart("ide", pragmas.excludeIdeData);
  4954. args: ["aNumber", "anotherNumber"],
  4955. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4956. referencedClasses: [],
  4957. //>>excludeEnd("ide");
  4958. messageSends: []
  4959. }),
  4960. $globals.Array);
  4961. $core.addMethod(
  4962. $core.method({
  4963. selector: "removeIndex:",
  4964. protocol: "adding/removing",
  4965. fn: function (anInteger){
  4966. var self=this,$self=this;
  4967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4968. return $core.withContext(function($ctx1) {
  4969. //>>excludeEnd("ctx");
  4970. self.splice(anInteger - 1, 1);
  4971. return self;
  4972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4973. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4974. //>>excludeEnd("ctx");
  4975. },
  4976. //>>excludeStart("ide", pragmas.excludeIdeData);
  4977. args: ["anInteger"],
  4978. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4979. referencedClasses: [],
  4980. //>>excludeEnd("ide");
  4981. messageSends: []
  4982. }),
  4983. $globals.Array);
  4984. $core.addMethod(
  4985. $core.method({
  4986. selector: "removeLast",
  4987. protocol: "adding/removing",
  4988. fn: function (){
  4989. var self=this,$self=this;
  4990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4991. return $core.withContext(function($ctx1) {
  4992. //>>excludeEnd("ctx");
  4993. return self.pop();;
  4994. return self;
  4995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4996. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4997. //>>excludeEnd("ctx");
  4998. },
  4999. //>>excludeStart("ide", pragmas.excludeIdeData);
  5000. args: [],
  5001. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  5002. referencedClasses: [],
  5003. //>>excludeEnd("ide");
  5004. messageSends: []
  5005. }),
  5006. $globals.Array);
  5007. $core.addMethod(
  5008. $core.method({
  5009. selector: "reversed",
  5010. protocol: "converting",
  5011. fn: function (){
  5012. var self=this,$self=this;
  5013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5014. return $core.withContext(function($ctx1) {
  5015. //>>excludeEnd("ctx");
  5016. return self.slice().reverse();
  5017. return self;
  5018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5019. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  5020. //>>excludeEnd("ctx");
  5021. },
  5022. //>>excludeStart("ide", pragmas.excludeIdeData);
  5023. args: [],
  5024. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  5025. referencedClasses: [],
  5026. //>>excludeEnd("ide");
  5027. messageSends: []
  5028. }),
  5029. $globals.Array);
  5030. $core.addMethod(
  5031. $core.method({
  5032. selector: "select:",
  5033. protocol: "enumerating",
  5034. fn: function (aBlock){
  5035. var self=this,$self=this;
  5036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5037. return $core.withContext(function($ctx1) {
  5038. //>>excludeEnd("ctx");
  5039. return self.filter(function(each) {return aBlock._value_(each)});
  5040. return self;
  5041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5042. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  5043. //>>excludeEnd("ctx");
  5044. },
  5045. //>>excludeStart("ide", pragmas.excludeIdeData);
  5046. args: ["aBlock"],
  5047. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  5048. referencedClasses: [],
  5049. //>>excludeEnd("ide");
  5050. messageSends: []
  5051. }),
  5052. $globals.Array);
  5053. $core.addMethod(
  5054. $core.method({
  5055. selector: "shallowCopy",
  5056. protocol: "copying",
  5057. fn: function (){
  5058. var self=this,$self=this;
  5059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5060. return $core.withContext(function($ctx1) {
  5061. //>>excludeEnd("ctx");
  5062. return self.slice();
  5063. return self;
  5064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5065. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  5066. //>>excludeEnd("ctx");
  5067. },
  5068. //>>excludeStart("ide", pragmas.excludeIdeData);
  5069. args: [],
  5070. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  5071. referencedClasses: [],
  5072. //>>excludeEnd("ide");
  5073. messageSends: []
  5074. }),
  5075. $globals.Array);
  5076. $core.addMethod(
  5077. $core.method({
  5078. selector: "size",
  5079. protocol: "accessing",
  5080. fn: function (){
  5081. var self=this,$self=this;
  5082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5083. return $core.withContext(function($ctx1) {
  5084. //>>excludeEnd("ctx");
  5085. return self.length;
  5086. return self;
  5087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5088. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  5089. //>>excludeEnd("ctx");
  5090. },
  5091. //>>excludeStart("ide", pragmas.excludeIdeData);
  5092. args: [],
  5093. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  5094. referencedClasses: [],
  5095. //>>excludeEnd("ide");
  5096. messageSends: []
  5097. }),
  5098. $globals.Array);
  5099. $core.addMethod(
  5100. $core.method({
  5101. selector: "sort",
  5102. protocol: "enumerating",
  5103. fn: function (){
  5104. var self=this,$self=this;
  5105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5106. return $core.withContext(function($ctx1) {
  5107. //>>excludeEnd("ctx");
  5108. return $self._sort_((function(a,b){
  5109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5110. return $core.withContext(function($ctx2) {
  5111. //>>excludeEnd("ctx");
  5112. return $recv(a).__lt(b);
  5113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5114. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5115. //>>excludeEnd("ctx");
  5116. }));
  5117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5118. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  5119. //>>excludeEnd("ctx");
  5120. },
  5121. //>>excludeStart("ide", pragmas.excludeIdeData);
  5122. args: [],
  5123. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5124. referencedClasses: [],
  5125. //>>excludeEnd("ide");
  5126. messageSends: ["sort:", "<"]
  5127. }),
  5128. $globals.Array);
  5129. $core.addMethod(
  5130. $core.method({
  5131. selector: "sort:",
  5132. protocol: "enumerating",
  5133. fn: function (aBlock){
  5134. var self=this,$self=this;
  5135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5136. return $core.withContext(function($ctx1) {
  5137. //>>excludeEnd("ctx");
  5138. return self.sort(function(a, b) {
  5139. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5140. })
  5141. ;
  5142. return self;
  5143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5144. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5145. //>>excludeEnd("ctx");
  5146. },
  5147. //>>excludeStart("ide", pragmas.excludeIdeData);
  5148. args: ["aBlock"],
  5149. 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'>",
  5150. referencedClasses: [],
  5151. //>>excludeEnd("ide");
  5152. messageSends: []
  5153. }),
  5154. $globals.Array);
  5155. $core.addMethod(
  5156. $core.method({
  5157. selector: "sorted",
  5158. protocol: "enumerating",
  5159. fn: function (){
  5160. var self=this,$self=this;
  5161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5162. return $core.withContext(function($ctx1) {
  5163. //>>excludeEnd("ctx");
  5164. return $recv($self._copy())._sort();
  5165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5166. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5167. //>>excludeEnd("ctx");
  5168. },
  5169. //>>excludeStart("ide", pragmas.excludeIdeData);
  5170. args: [],
  5171. source: "sorted\x0a\x09^ self copy sort",
  5172. referencedClasses: [],
  5173. //>>excludeEnd("ide");
  5174. messageSends: ["sort", "copy"]
  5175. }),
  5176. $globals.Array);
  5177. $core.addMethod(
  5178. $core.method({
  5179. selector: "sorted:",
  5180. protocol: "enumerating",
  5181. fn: function (aBlock){
  5182. var self=this,$self=this;
  5183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5184. return $core.withContext(function($ctx1) {
  5185. //>>excludeEnd("ctx");
  5186. return $recv($self._copy())._sort_(aBlock);
  5187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5188. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5189. //>>excludeEnd("ctx");
  5190. },
  5191. //>>excludeStart("ide", pragmas.excludeIdeData);
  5192. args: ["aBlock"],
  5193. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5194. referencedClasses: [],
  5195. //>>excludeEnd("ide");
  5196. messageSends: ["sort:", "copy"]
  5197. }),
  5198. $globals.Array);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "new:",
  5202. protocol: "instance creation",
  5203. fn: function (anInteger){
  5204. var self=this,$self=this;
  5205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5206. return $core.withContext(function($ctx1) {
  5207. //>>excludeEnd("ctx");
  5208. return new Array(anInteger);
  5209. return self;
  5210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5211. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  5212. //>>excludeEnd("ctx");
  5213. },
  5214. //>>excludeStart("ide", pragmas.excludeIdeData);
  5215. args: ["anInteger"],
  5216. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5217. referencedClasses: [],
  5218. //>>excludeEnd("ide");
  5219. messageSends: []
  5220. }),
  5221. $globals.Array.a$cls);
  5222. $core.addMethod(
  5223. $core.method({
  5224. selector: "with:",
  5225. protocol: "instance creation",
  5226. fn: function (anObject){
  5227. var self=this,$self=this;
  5228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5229. return $core.withContext(function($ctx1) {
  5230. //>>excludeEnd("ctx");
  5231. var $1;
  5232. $1=$self._new_((1));
  5233. $recv($1)._at_put_((1),anObject);
  5234. return $recv($1)._yourself();
  5235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5236. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  5237. //>>excludeEnd("ctx");
  5238. },
  5239. //>>excludeStart("ide", pragmas.excludeIdeData);
  5240. args: ["anObject"],
  5241. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5242. referencedClasses: [],
  5243. //>>excludeEnd("ide");
  5244. messageSends: ["at:put:", "new:", "yourself"]
  5245. }),
  5246. $globals.Array.a$cls);
  5247. $core.addMethod(
  5248. $core.method({
  5249. selector: "with:with:",
  5250. protocol: "instance creation",
  5251. fn: function (anObject,anObject2){
  5252. var self=this,$self=this;
  5253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5254. return $core.withContext(function($ctx1) {
  5255. //>>excludeEnd("ctx");
  5256. var $1;
  5257. $1=$self._new_((2));
  5258. $recv($1)._at_put_((1),anObject);
  5259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5260. $ctx1.sendIdx["at:put:"]=1;
  5261. //>>excludeEnd("ctx");
  5262. $recv($1)._at_put_((2),anObject2);
  5263. return $recv($1)._yourself();
  5264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5265. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  5266. //>>excludeEnd("ctx");
  5267. },
  5268. //>>excludeStart("ide", pragmas.excludeIdeData);
  5269. args: ["anObject", "anObject2"],
  5270. 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",
  5271. referencedClasses: [],
  5272. //>>excludeEnd("ide");
  5273. messageSends: ["at:put:", "new:", "yourself"]
  5274. }),
  5275. $globals.Array.a$cls);
  5276. $core.addMethod(
  5277. $core.method({
  5278. selector: "with:with:with:",
  5279. protocol: "instance creation",
  5280. fn: function (anObject,anObject2,anObject3){
  5281. var self=this,$self=this;
  5282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5283. return $core.withContext(function($ctx1) {
  5284. //>>excludeEnd("ctx");
  5285. var $1;
  5286. $1=$self._new_((3));
  5287. $recv($1)._at_put_((1),anObject);
  5288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5289. $ctx1.sendIdx["at:put:"]=1;
  5290. //>>excludeEnd("ctx");
  5291. $recv($1)._at_put_((2),anObject2);
  5292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5293. $ctx1.sendIdx["at:put:"]=2;
  5294. //>>excludeEnd("ctx");
  5295. $recv($1)._at_put_((3),anObject3);
  5296. return $recv($1)._yourself();
  5297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5298. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  5299. //>>excludeEnd("ctx");
  5300. },
  5301. //>>excludeStart("ide", pragmas.excludeIdeData);
  5302. args: ["anObject", "anObject2", "anObject3"],
  5303. 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",
  5304. referencedClasses: [],
  5305. //>>excludeEnd("ide");
  5306. messageSends: ["at:put:", "new:", "yourself"]
  5307. }),
  5308. $globals.Array.a$cls);
  5309. $core.addMethod(
  5310. $core.method({
  5311. selector: "withAll:",
  5312. protocol: "instance creation",
  5313. fn: function (aCollection){
  5314. var self=this,$self=this;
  5315. var instance,index;
  5316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5317. return $core.withContext(function($ctx1) {
  5318. //>>excludeEnd("ctx");
  5319. index=(1);
  5320. instance=$self._new_($recv(aCollection)._size());
  5321. $recv(aCollection)._do_((function(each){
  5322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5323. return $core.withContext(function($ctx2) {
  5324. //>>excludeEnd("ctx");
  5325. $recv(instance)._at_put_(index,each);
  5326. index=$recv(index).__plus((1));
  5327. return index;
  5328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5330. //>>excludeEnd("ctx");
  5331. }));
  5332. return instance;
  5333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5334. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  5335. //>>excludeEnd("ctx");
  5336. },
  5337. //>>excludeStart("ide", pragmas.excludeIdeData);
  5338. args: ["aCollection"],
  5339. 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",
  5340. referencedClasses: [],
  5341. //>>excludeEnd("ide");
  5342. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5343. }),
  5344. $globals.Array.a$cls);
  5345. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  5346. //>>excludeStart("ide", pragmas.excludeIdeData);
  5347. $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 >> #,`";
  5348. //>>excludeEnd("ide");
  5349. $core.addMethod(
  5350. $core.method({
  5351. selector: ",",
  5352. protocol: "copying",
  5353. fn: function (aString){
  5354. var self=this,$self=this;
  5355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5356. return $core.withContext(function($ctx1) {
  5357. //>>excludeEnd("ctx");
  5358. return String(self) + aString;
  5359. return self;
  5360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5361. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5362. //>>excludeEnd("ctx");
  5363. },
  5364. //>>excludeStart("ide", pragmas.excludeIdeData);
  5365. args: ["aString"],
  5366. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5367. referencedClasses: [],
  5368. //>>excludeEnd("ide");
  5369. messageSends: []
  5370. }),
  5371. $globals.String);
  5372. $core.addMethod(
  5373. $core.method({
  5374. selector: "<",
  5375. protocol: "comparing",
  5376. fn: function (aString){
  5377. var self=this,$self=this;
  5378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5379. return $core.withContext(function($ctx1) {
  5380. //>>excludeEnd("ctx");
  5381. return String(self) < aString._asString();
  5382. return self;
  5383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5384. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5385. //>>excludeEnd("ctx");
  5386. },
  5387. //>>excludeStart("ide", pragmas.excludeIdeData);
  5388. args: ["aString"],
  5389. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5390. referencedClasses: [],
  5391. //>>excludeEnd("ide");
  5392. messageSends: []
  5393. }),
  5394. $globals.String);
  5395. $core.addMethod(
  5396. $core.method({
  5397. selector: "<=",
  5398. protocol: "comparing",
  5399. fn: function (aString){
  5400. var self=this,$self=this;
  5401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5402. return $core.withContext(function($ctx1) {
  5403. //>>excludeEnd("ctx");
  5404. return String(self) <= aString._asString();
  5405. return self;
  5406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5407. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5408. //>>excludeEnd("ctx");
  5409. },
  5410. //>>excludeStart("ide", pragmas.excludeIdeData);
  5411. args: ["aString"],
  5412. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5413. referencedClasses: [],
  5414. //>>excludeEnd("ide");
  5415. messageSends: []
  5416. }),
  5417. $globals.String);
  5418. $core.addMethod(
  5419. $core.method({
  5420. selector: "=",
  5421. protocol: "comparing",
  5422. fn: function (aString){
  5423. var self=this,$self=this;
  5424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5425. return $core.withContext(function($ctx1) {
  5426. //>>excludeEnd("ctx");
  5427. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5428. return self;
  5429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5430. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5431. //>>excludeEnd("ctx");
  5432. },
  5433. //>>excludeStart("ide", pragmas.excludeIdeData);
  5434. args: ["aString"],
  5435. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5436. referencedClasses: [],
  5437. //>>excludeEnd("ide");
  5438. messageSends: []
  5439. }),
  5440. $globals.String);
  5441. $core.addMethod(
  5442. $core.method({
  5443. selector: "==",
  5444. protocol: "comparing",
  5445. fn: function (aString){
  5446. var self=this,$self=this;
  5447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5448. return $core.withContext(function($ctx1) {
  5449. //>>excludeEnd("ctx");
  5450. if (typeof aString === "string") return String(self) === aString;
  5451. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5452. else return false;;
  5453. return self;
  5454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5455. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5456. //>>excludeEnd("ctx");
  5457. },
  5458. //>>excludeStart("ide", pragmas.excludeIdeData);
  5459. args: ["aString"],
  5460. 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'>",
  5461. referencedClasses: [],
  5462. //>>excludeEnd("ide");
  5463. messageSends: []
  5464. }),
  5465. $globals.String);
  5466. $core.addMethod(
  5467. $core.method({
  5468. selector: ">",
  5469. protocol: "comparing",
  5470. fn: function (aString){
  5471. var self=this,$self=this;
  5472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5473. return $core.withContext(function($ctx1) {
  5474. //>>excludeEnd("ctx");
  5475. return String(self) > aString._asString();
  5476. return self;
  5477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5478. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5479. //>>excludeEnd("ctx");
  5480. },
  5481. //>>excludeStart("ide", pragmas.excludeIdeData);
  5482. args: ["aString"],
  5483. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5484. referencedClasses: [],
  5485. //>>excludeEnd("ide");
  5486. messageSends: []
  5487. }),
  5488. $globals.String);
  5489. $core.addMethod(
  5490. $core.method({
  5491. selector: ">=",
  5492. protocol: "comparing",
  5493. fn: function (aString){
  5494. var self=this,$self=this;
  5495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5496. return $core.withContext(function($ctx1) {
  5497. //>>excludeEnd("ctx");
  5498. return String(self) >= aString._asString();
  5499. return self;
  5500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5501. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5502. //>>excludeEnd("ctx");
  5503. },
  5504. //>>excludeStart("ide", pragmas.excludeIdeData);
  5505. args: ["aString"],
  5506. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5507. referencedClasses: [],
  5508. //>>excludeEnd("ide");
  5509. messageSends: []
  5510. }),
  5511. $globals.String);
  5512. $core.addMethod(
  5513. $core.method({
  5514. selector: "add:",
  5515. protocol: "adding/removing",
  5516. fn: function (anObject){
  5517. var self=this,$self=this;
  5518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5519. return $core.withContext(function($ctx1) {
  5520. //>>excludeEnd("ctx");
  5521. $self._errorReadOnly();
  5522. return self;
  5523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5524. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  5525. //>>excludeEnd("ctx");
  5526. },
  5527. //>>excludeStart("ide", pragmas.excludeIdeData);
  5528. args: ["anObject"],
  5529. source: "add: anObject\x0a\x09self errorReadOnly",
  5530. referencedClasses: [],
  5531. //>>excludeEnd("ide");
  5532. messageSends: ["errorReadOnly"]
  5533. }),
  5534. $globals.String);
  5535. $core.addMethod(
  5536. $core.method({
  5537. selector: "asJavaScriptMethodName",
  5538. protocol: "converting",
  5539. fn: function (){
  5540. var self=this,$self=this;
  5541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5542. return $core.withContext(function($ctx1) {
  5543. //>>excludeEnd("ctx");
  5544. return $core.st2js(self);
  5545. return self;
  5546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5547. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5548. //>>excludeEnd("ctx");
  5549. },
  5550. //>>excludeStart("ide", pragmas.excludeIdeData);
  5551. args: [],
  5552. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5553. referencedClasses: [],
  5554. //>>excludeEnd("ide");
  5555. messageSends: []
  5556. }),
  5557. $globals.String);
  5558. $core.addMethod(
  5559. $core.method({
  5560. selector: "asJavaScriptObject",
  5561. protocol: "converting",
  5562. fn: function (){
  5563. var self=this,$self=this;
  5564. return self;
  5565. },
  5566. //>>excludeStart("ide", pragmas.excludeIdeData);
  5567. args: [],
  5568. source: "asJavaScriptObject\x0a\x09^ self",
  5569. referencedClasses: [],
  5570. //>>excludeEnd("ide");
  5571. messageSends: []
  5572. }),
  5573. $globals.String);
  5574. $core.addMethod(
  5575. $core.method({
  5576. selector: "asJavaScriptSource",
  5577. protocol: "converting",
  5578. fn: function (){
  5579. var self=this,$self=this;
  5580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5581. return $core.withContext(function($ctx1) {
  5582. //>>excludeEnd("ctx");
  5583. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5584. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5585. else
  5586. return "\"" + self + "\"";
  5587. ;
  5588. return self;
  5589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5590. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5591. //>>excludeEnd("ctx");
  5592. },
  5593. //>>excludeStart("ide", pragmas.excludeIdeData);
  5594. args: [],
  5595. 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'>",
  5596. referencedClasses: [],
  5597. //>>excludeEnd("ide");
  5598. messageSends: []
  5599. }),
  5600. $globals.String);
  5601. $core.addMethod(
  5602. $core.method({
  5603. selector: "asLowercase",
  5604. protocol: "converting",
  5605. fn: function (){
  5606. var self=this,$self=this;
  5607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5608. return $core.withContext(function($ctx1) {
  5609. //>>excludeEnd("ctx");
  5610. return self.toLowerCase();
  5611. return self;
  5612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5613. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5614. //>>excludeEnd("ctx");
  5615. },
  5616. //>>excludeStart("ide", pragmas.excludeIdeData);
  5617. args: [],
  5618. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5619. referencedClasses: [],
  5620. //>>excludeEnd("ide");
  5621. messageSends: []
  5622. }),
  5623. $globals.String);
  5624. $core.addMethod(
  5625. $core.method({
  5626. selector: "asMutator",
  5627. protocol: "converting",
  5628. fn: function (){
  5629. var self=this,$self=this;
  5630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5631. return $core.withContext(function($ctx1) {
  5632. //>>excludeEnd("ctx");
  5633. var $1;
  5634. $1=$recv($self._last()).__eq(":");
  5635. if(!$core.assert($1)){
  5636. return $self.__comma(":");
  5637. }
  5638. return self;
  5639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5640. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5641. //>>excludeEnd("ctx");
  5642. },
  5643. //>>excludeStart("ide", pragmas.excludeIdeData);
  5644. args: [],
  5645. 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",
  5646. referencedClasses: [],
  5647. //>>excludeEnd("ide");
  5648. messageSends: ["ifFalse:", "=", "last", ","]
  5649. }),
  5650. $globals.String);
  5651. $core.addMethod(
  5652. $core.method({
  5653. selector: "asNumber",
  5654. protocol: "converting",
  5655. fn: function (){
  5656. var self=this,$self=this;
  5657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5658. return $core.withContext(function($ctx1) {
  5659. //>>excludeEnd("ctx");
  5660. return Number(self);
  5661. return self;
  5662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5663. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5664. //>>excludeEnd("ctx");
  5665. },
  5666. //>>excludeStart("ide", pragmas.excludeIdeData);
  5667. args: [],
  5668. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5669. referencedClasses: [],
  5670. //>>excludeEnd("ide");
  5671. messageSends: []
  5672. }),
  5673. $globals.String);
  5674. $core.addMethod(
  5675. $core.method({
  5676. selector: "asRegexp",
  5677. protocol: "converting",
  5678. fn: function (){
  5679. var self=this,$self=this;
  5680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5681. return $core.withContext(function($ctx1) {
  5682. //>>excludeEnd("ctx");
  5683. return $recv($globals.RegularExpression)._fromString_(self);
  5684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5685. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5686. //>>excludeEnd("ctx");
  5687. },
  5688. //>>excludeStart("ide", pragmas.excludeIdeData);
  5689. args: [],
  5690. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5691. referencedClasses: ["RegularExpression"],
  5692. //>>excludeEnd("ide");
  5693. messageSends: ["fromString:"]
  5694. }),
  5695. $globals.String);
  5696. $core.addMethod(
  5697. $core.method({
  5698. selector: "asString",
  5699. protocol: "converting",
  5700. fn: function (){
  5701. var self=this,$self=this;
  5702. return self;
  5703. },
  5704. //>>excludeStart("ide", pragmas.excludeIdeData);
  5705. args: [],
  5706. source: "asString\x0a\x09^ self",
  5707. referencedClasses: [],
  5708. //>>excludeEnd("ide");
  5709. messageSends: []
  5710. }),
  5711. $globals.String);
  5712. $core.addMethod(
  5713. $core.method({
  5714. selector: "asSymbol",
  5715. protocol: "converting",
  5716. fn: function (){
  5717. var self=this,$self=this;
  5718. return self;
  5719. },
  5720. //>>excludeStart("ide", pragmas.excludeIdeData);
  5721. args: [],
  5722. source: "asSymbol\x0a\x09^ self",
  5723. referencedClasses: [],
  5724. //>>excludeEnd("ide");
  5725. messageSends: []
  5726. }),
  5727. $globals.String);
  5728. $core.addMethod(
  5729. $core.method({
  5730. selector: "asSymbolPrintOn:",
  5731. protocol: "printing",
  5732. fn: function (aStream){
  5733. var self=this,$self=this;
  5734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5735. return $core.withContext(function($ctx1) {
  5736. //>>excludeEnd("ctx");
  5737. var $1;
  5738. $recv(aStream)._nextPutAll_("#");
  5739. $1=$recv($self._asString())._isSelector();
  5740. if($core.assert($1)){
  5741. $recv(aStream)._nextPut_(self);
  5742. } else {
  5743. $self._printOn_(aStream);
  5744. }
  5745. return self;
  5746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5747. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  5748. //>>excludeEnd("ctx");
  5749. },
  5750. //>>excludeStart("ide", pragmas.excludeIdeData);
  5751. args: ["aStream"],
  5752. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5753. referencedClasses: [],
  5754. //>>excludeEnd("ide");
  5755. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5756. }),
  5757. $globals.String);
  5758. $core.addMethod(
  5759. $core.method({
  5760. selector: "asUppercase",
  5761. protocol: "converting",
  5762. fn: function (){
  5763. var self=this,$self=this;
  5764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5765. return $core.withContext(function($ctx1) {
  5766. //>>excludeEnd("ctx");
  5767. return self.toUpperCase();
  5768. return self;
  5769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5770. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5771. //>>excludeEnd("ctx");
  5772. },
  5773. //>>excludeStart("ide", pragmas.excludeIdeData);
  5774. args: [],
  5775. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5776. referencedClasses: [],
  5777. //>>excludeEnd("ide");
  5778. messageSends: []
  5779. }),
  5780. $globals.String);
  5781. $core.addMethod(
  5782. $core.method({
  5783. selector: "asciiValue",
  5784. protocol: "accessing",
  5785. fn: function (){
  5786. var self=this,$self=this;
  5787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5788. return $core.withContext(function($ctx1) {
  5789. //>>excludeEnd("ctx");
  5790. return self.charCodeAt(0);;
  5791. return self;
  5792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5793. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5794. //>>excludeEnd("ctx");
  5795. },
  5796. //>>excludeStart("ide", pragmas.excludeIdeData);
  5797. args: [],
  5798. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5799. referencedClasses: [],
  5800. //>>excludeEnd("ide");
  5801. messageSends: []
  5802. }),
  5803. $globals.String);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "at:ifAbsent:",
  5807. protocol: "accessing",
  5808. fn: function (anIndex,aBlock){
  5809. var self=this,$self=this;
  5810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5811. return $core.withContext(function($ctx1) {
  5812. //>>excludeEnd("ctx");
  5813. return String(self)[anIndex - 1] || aBlock._value();
  5814. return self;
  5815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5816. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5817. //>>excludeEnd("ctx");
  5818. },
  5819. //>>excludeStart("ide", pragmas.excludeIdeData);
  5820. args: ["anIndex", "aBlock"],
  5821. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5822. referencedClasses: [],
  5823. //>>excludeEnd("ide");
  5824. messageSends: []
  5825. }),
  5826. $globals.String);
  5827. $core.addMethod(
  5828. $core.method({
  5829. selector: "at:ifPresent:ifAbsent:",
  5830. protocol: "accessing",
  5831. fn: function (anIndex,aBlock,anotherBlock){
  5832. var self=this,$self=this;
  5833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5834. return $core.withContext(function($ctx1) {
  5835. //>>excludeEnd("ctx");
  5836. var result = String(self)[anIndex - 1];
  5837. return result ? aBlock._value_(result) : anotherBlock._value();
  5838. ;
  5839. return self;
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5842. //>>excludeEnd("ctx");
  5843. },
  5844. //>>excludeStart("ide", pragmas.excludeIdeData);
  5845. args: ["anIndex", "aBlock", "anotherBlock"],
  5846. 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'>",
  5847. referencedClasses: [],
  5848. //>>excludeEnd("ide");
  5849. messageSends: []
  5850. }),
  5851. $globals.String);
  5852. $core.addMethod(
  5853. $core.method({
  5854. selector: "at:put:",
  5855. protocol: "accessing",
  5856. fn: function (anIndex,anObject){
  5857. var self=this,$self=this;
  5858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5859. return $core.withContext(function($ctx1) {
  5860. //>>excludeEnd("ctx");
  5861. $self._errorReadOnly();
  5862. return self;
  5863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5864. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  5865. //>>excludeEnd("ctx");
  5866. },
  5867. //>>excludeStart("ide", pragmas.excludeIdeData);
  5868. args: ["anIndex", "anObject"],
  5869. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5870. referencedClasses: [],
  5871. //>>excludeEnd("ide");
  5872. messageSends: ["errorReadOnly"]
  5873. }),
  5874. $globals.String);
  5875. $core.addMethod(
  5876. $core.method({
  5877. selector: "capitalized",
  5878. protocol: "converting",
  5879. fn: function (){
  5880. var self=this,$self=this;
  5881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5882. return $core.withContext(function($ctx1) {
  5883. //>>excludeEnd("ctx");
  5884. return $self._ifNotEmpty_((function(){
  5885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5886. return $core.withContext(function($ctx2) {
  5887. //>>excludeEnd("ctx");
  5888. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5890. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5891. //>>excludeEnd("ctx");
  5892. }));
  5893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5894. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5895. //>>excludeEnd("ctx");
  5896. },
  5897. //>>excludeStart("ide", pragmas.excludeIdeData);
  5898. args: [],
  5899. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5900. referencedClasses: [],
  5901. //>>excludeEnd("ide");
  5902. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5903. }),
  5904. $globals.String);
  5905. $core.addMethod(
  5906. $core.method({
  5907. selector: "charCodeAt:",
  5908. protocol: "accessing",
  5909. fn: function (anInteger){
  5910. var self=this,$self=this;
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. return $core.withContext(function($ctx1) {
  5913. //>>excludeEnd("ctx");
  5914. return self.charCodeAt(anInteger - 1);
  5915. return self;
  5916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5917. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  5918. //>>excludeEnd("ctx");
  5919. },
  5920. //>>excludeStart("ide", pragmas.excludeIdeData);
  5921. args: ["anInteger"],
  5922. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5923. referencedClasses: [],
  5924. //>>excludeEnd("ide");
  5925. messageSends: []
  5926. }),
  5927. $globals.String);
  5928. $core.addMethod(
  5929. $core.method({
  5930. selector: "copyFrom:to:",
  5931. protocol: "copying",
  5932. fn: function (anIndex,anotherIndex){
  5933. var self=this,$self=this;
  5934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5935. return $core.withContext(function($ctx1) {
  5936. //>>excludeEnd("ctx");
  5937. return self.substring(anIndex - 1, anotherIndex);
  5938. return self;
  5939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5940. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  5941. //>>excludeEnd("ctx");
  5942. },
  5943. //>>excludeStart("ide", pragmas.excludeIdeData);
  5944. args: ["anIndex", "anotherIndex"],
  5945. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5946. referencedClasses: [],
  5947. //>>excludeEnd("ide");
  5948. messageSends: []
  5949. }),
  5950. $globals.String);
  5951. $core.addMethod(
  5952. $core.method({
  5953. selector: "crlfSanitized",
  5954. protocol: "converting",
  5955. fn: function (){
  5956. var self=this,$self=this;
  5957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5958. return $core.withContext(function($ctx1) {
  5959. //>>excludeEnd("ctx");
  5960. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5962. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  5963. //>>excludeEnd("ctx");
  5964. },
  5965. //>>excludeStart("ide", pragmas.excludeIdeData);
  5966. args: [],
  5967. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5968. referencedClasses: ["String"],
  5969. //>>excludeEnd("ide");
  5970. messageSends: ["join:", "lines", "lf"]
  5971. }),
  5972. $globals.String);
  5973. $core.addMethod(
  5974. $core.method({
  5975. selector: "deepCopy",
  5976. protocol: "copying",
  5977. fn: function (){
  5978. var self=this,$self=this;
  5979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5980. return $core.withContext(function($ctx1) {
  5981. //>>excludeEnd("ctx");
  5982. return $self._shallowCopy();
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  5985. //>>excludeEnd("ctx");
  5986. },
  5987. //>>excludeStart("ide", pragmas.excludeIdeData);
  5988. args: [],
  5989. source: "deepCopy\x0a\x09^ self shallowCopy",
  5990. referencedClasses: [],
  5991. //>>excludeEnd("ide");
  5992. messageSends: ["shallowCopy"]
  5993. }),
  5994. $globals.String);
  5995. $core.addMethod(
  5996. $core.method({
  5997. selector: "errorReadOnly",
  5998. protocol: "error handling",
  5999. fn: function (){
  6000. var self=this,$self=this;
  6001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6002. return $core.withContext(function($ctx1) {
  6003. //>>excludeEnd("ctx");
  6004. $self._error_("Object is read-only");
  6005. return self;
  6006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6007. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  6008. //>>excludeEnd("ctx");
  6009. },
  6010. //>>excludeStart("ide", pragmas.excludeIdeData);
  6011. args: [],
  6012. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  6013. referencedClasses: [],
  6014. //>>excludeEnd("ide");
  6015. messageSends: ["error:"]
  6016. }),
  6017. $globals.String);
  6018. $core.addMethod(
  6019. $core.method({
  6020. selector: "escaped",
  6021. protocol: "converting",
  6022. fn: function (){
  6023. var self=this,$self=this;
  6024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6025. return $core.withContext(function($ctx1) {
  6026. //>>excludeEnd("ctx");
  6027. return escape(self);
  6028. return self;
  6029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6030. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6031. //>>excludeEnd("ctx");
  6032. },
  6033. //>>excludeStart("ide", pragmas.excludeIdeData);
  6034. args: [],
  6035. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  6036. referencedClasses: [],
  6037. //>>excludeEnd("ide");
  6038. messageSends: []
  6039. }),
  6040. $globals.String);
  6041. $core.addMethod(
  6042. $core.method({
  6043. selector: "includesSubString:",
  6044. protocol: "testing",
  6045. fn: function (subString){
  6046. var self=this,$self=this;
  6047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6048. return $core.withContext(function($ctx1) {
  6049. //>>excludeEnd("ctx");
  6050. return self.indexOf(subString) != -1;
  6051. return self;
  6052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6053. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6054. //>>excludeEnd("ctx");
  6055. },
  6056. //>>excludeStart("ide", pragmas.excludeIdeData);
  6057. args: ["subString"],
  6058. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  6059. referencedClasses: [],
  6060. //>>excludeEnd("ide");
  6061. messageSends: []
  6062. }),
  6063. $globals.String);
  6064. $core.addMethod(
  6065. $core.method({
  6066. selector: "isCapitalized",
  6067. protocol: "testing",
  6068. fn: function (){
  6069. var self=this,$self=this;
  6070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6071. return $core.withContext(function($ctx1) {
  6072. //>>excludeEnd("ctx");
  6073. var $2,$1;
  6074. $2=$self._first();
  6075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6076. $ctx1.sendIdx["first"]=1;
  6077. //>>excludeEnd("ctx");
  6078. $1=$recv($2)._asUppercase();
  6079. return $recv($1).__eq_eq($self._first());
  6080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6081. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6082. //>>excludeEnd("ctx");
  6083. },
  6084. //>>excludeStart("ide", pragmas.excludeIdeData);
  6085. args: [],
  6086. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6087. referencedClasses: [],
  6088. //>>excludeEnd("ide");
  6089. messageSends: ["==", "asUppercase", "first"]
  6090. }),
  6091. $globals.String);
  6092. $core.addMethod(
  6093. $core.method({
  6094. selector: "isImmutable",
  6095. protocol: "testing",
  6096. fn: function (){
  6097. var self=this,$self=this;
  6098. return true;
  6099. },
  6100. //>>excludeStart("ide", pragmas.excludeIdeData);
  6101. args: [],
  6102. source: "isImmutable\x0a\x09^ true",
  6103. referencedClasses: [],
  6104. //>>excludeEnd("ide");
  6105. messageSends: []
  6106. }),
  6107. $globals.String);
  6108. $core.addMethod(
  6109. $core.method({
  6110. selector: "isSelector",
  6111. protocol: "testing",
  6112. fn: function (){
  6113. var self=this,$self=this;
  6114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6115. return $core.withContext(function($ctx1) {
  6116. //>>excludeEnd("ctx");
  6117. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  6118. return self;
  6119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6120. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  6121. //>>excludeEnd("ctx");
  6122. },
  6123. //>>excludeStart("ide", pragmas.excludeIdeData);
  6124. args: [],
  6125. 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>",
  6126. referencedClasses: [],
  6127. //>>excludeEnd("ide");
  6128. messageSends: []
  6129. }),
  6130. $globals.String);
  6131. $core.addMethod(
  6132. $core.method({
  6133. selector: "isString",
  6134. protocol: "testing",
  6135. fn: function (){
  6136. var self=this,$self=this;
  6137. return true;
  6138. },
  6139. //>>excludeStart("ide", pragmas.excludeIdeData);
  6140. args: [],
  6141. source: "isString\x0a\x09^ true",
  6142. referencedClasses: [],
  6143. //>>excludeEnd("ide");
  6144. messageSends: []
  6145. }),
  6146. $globals.String);
  6147. $core.addMethod(
  6148. $core.method({
  6149. selector: "isVowel",
  6150. protocol: "testing",
  6151. fn: function (){
  6152. var self=this,$self=this;
  6153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6154. return $core.withContext(function($ctx1) {
  6155. //>>excludeEnd("ctx");
  6156. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  6157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6158. return $core.withContext(function($ctx2) {
  6159. //>>excludeEnd("ctx");
  6160. return "aeiou"._includes_($self._asLowercase());
  6161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6163. //>>excludeEnd("ctx");
  6164. }));
  6165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6166. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6167. //>>excludeEnd("ctx");
  6168. },
  6169. //>>excludeStart("ide", pragmas.excludeIdeData);
  6170. args: [],
  6171. 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 ]",
  6172. referencedClasses: [],
  6173. //>>excludeEnd("ide");
  6174. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6175. }),
  6176. $globals.String);
  6177. $core.addMethod(
  6178. $core.method({
  6179. selector: "join:",
  6180. protocol: "split join",
  6181. fn: function (aCollection){
  6182. var self=this,$self=this;
  6183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6184. return $core.withContext(function($ctx1) {
  6185. //>>excludeEnd("ctx");
  6186. return $recv($globals.String)._streamContents_((function(stream){
  6187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6188. return $core.withContext(function($ctx2) {
  6189. //>>excludeEnd("ctx");
  6190. return $recv(aCollection)._do_separatedBy_((function(each){
  6191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6192. return $core.withContext(function($ctx3) {
  6193. //>>excludeEnd("ctx");
  6194. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6196. $ctx3.sendIdx["nextPutAll:"]=1;
  6197. //>>excludeEnd("ctx");
  6198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6199. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6200. //>>excludeEnd("ctx");
  6201. }),(function(){
  6202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6203. return $core.withContext(function($ctx3) {
  6204. //>>excludeEnd("ctx");
  6205. return $recv(stream)._nextPutAll_(self);
  6206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6207. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6208. //>>excludeEnd("ctx");
  6209. }));
  6210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6211. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6212. //>>excludeEnd("ctx");
  6213. }));
  6214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6215. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6216. //>>excludeEnd("ctx");
  6217. },
  6218. //>>excludeStart("ide", pragmas.excludeIdeData);
  6219. args: ["aCollection"],
  6220. 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 ]]",
  6221. referencedClasses: ["String"],
  6222. //>>excludeEnd("ide");
  6223. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6224. }),
  6225. $globals.String);
  6226. $core.addMethod(
  6227. $core.method({
  6228. selector: "lineIndicesDo:",
  6229. protocol: "split join",
  6230. fn: function (aBlock){
  6231. var self=this,$self=this;
  6232. var cr,lf,start,sz,nextLF,nextCR;
  6233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6234. return $core.withContext(function($ctx1) {
  6235. //>>excludeEnd("ctx");
  6236. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6237. var $early={};
  6238. try {
  6239. start=(1);
  6240. sz=$self._size();
  6241. cr=$recv($globals.String)._cr();
  6242. nextCR=$self._indexOf_startingAt_(cr,(1));
  6243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6244. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6245. //>>excludeEnd("ctx");
  6246. lf=$recv($globals.String)._lf();
  6247. nextLF=$self._indexOf_startingAt_(lf,(1));
  6248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6249. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6250. //>>excludeEnd("ctx");
  6251. $recv((function(){
  6252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6253. return $core.withContext(function($ctx2) {
  6254. //>>excludeEnd("ctx");
  6255. return $recv(start).__lt_eq(sz);
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6258. //>>excludeEnd("ctx");
  6259. }))._whileTrue_((function(){
  6260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6261. return $core.withContext(function($ctx2) {
  6262. //>>excludeEnd("ctx");
  6263. $2=$recv(nextLF).__eq((0));
  6264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6265. $ctx2.sendIdx["="]=1;
  6266. //>>excludeEnd("ctx");
  6267. $1=$recv($2)._and_((function(){
  6268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6269. return $core.withContext(function($ctx3) {
  6270. //>>excludeEnd("ctx");
  6271. return $recv(nextCR).__eq((0));
  6272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6273. $ctx3.sendIdx["="]=2;
  6274. //>>excludeEnd("ctx");
  6275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6276. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6277. //>>excludeEnd("ctx");
  6278. }));
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. $ctx2.sendIdx["and:"]=1;
  6281. //>>excludeEnd("ctx");
  6282. if($core.assert($1)){
  6283. $recv(aBlock)._value_value_value_(start,sz,sz);
  6284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6285. $ctx2.sendIdx["value:value:value:"]=1;
  6286. //>>excludeEnd("ctx");
  6287. throw $early=[self];
  6288. }
  6289. $4=$recv(nextCR).__eq((0));
  6290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6291. $ctx2.sendIdx["="]=3;
  6292. //>>excludeEnd("ctx");
  6293. $3=$recv($4)._or_((function(){
  6294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6295. return $core.withContext(function($ctx3) {
  6296. //>>excludeEnd("ctx");
  6297. $5=(0).__lt(nextLF);
  6298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6299. $ctx3.sendIdx["<"]=1;
  6300. //>>excludeEnd("ctx");
  6301. return $recv($5)._and_((function(){
  6302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6303. return $core.withContext(function($ctx4) {
  6304. //>>excludeEnd("ctx");
  6305. return $recv(nextLF).__lt(nextCR);
  6306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6307. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6308. //>>excludeEnd("ctx");
  6309. }));
  6310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6311. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6312. //>>excludeEnd("ctx");
  6313. }));
  6314. if($core.assert($3)){
  6315. $6=start;
  6316. $7=$recv(nextLF).__minus((1));
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. $ctx2.sendIdx["-"]=1;
  6319. //>>excludeEnd("ctx");
  6320. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6322. $ctx2.sendIdx["value:value:value:"]=2;
  6323. //>>excludeEnd("ctx");
  6324. start=(1).__plus(nextLF);
  6325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6326. $ctx2.sendIdx["+"]=1;
  6327. //>>excludeEnd("ctx");
  6328. nextLF=$self._indexOf_startingAt_(lf,start);
  6329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6330. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6331. //>>excludeEnd("ctx");
  6332. return nextLF;
  6333. } else {
  6334. $9=(1).__plus(nextCR);
  6335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6336. $ctx2.sendIdx["+"]=2;
  6337. //>>excludeEnd("ctx");
  6338. $8=$recv($9).__eq(nextLF);
  6339. if($core.assert($8)){
  6340. $10=start;
  6341. $11=$recv(nextCR).__minus((1));
  6342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6343. $ctx2.sendIdx["-"]=2;
  6344. //>>excludeEnd("ctx");
  6345. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6347. $ctx2.sendIdx["value:value:value:"]=3;
  6348. //>>excludeEnd("ctx");
  6349. start=(1).__plus(nextLF);
  6350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6351. $ctx2.sendIdx["+"]=3;
  6352. //>>excludeEnd("ctx");
  6353. nextCR=$self._indexOf_startingAt_(cr,start);
  6354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6355. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6356. //>>excludeEnd("ctx");
  6357. nextLF=$self._indexOf_startingAt_(lf,start);
  6358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6359. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6360. //>>excludeEnd("ctx");
  6361. return nextLF;
  6362. } else {
  6363. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6364. start=(1).__plus(nextCR);
  6365. nextCR=$self._indexOf_startingAt_(cr,start);
  6366. return nextCR;
  6367. }
  6368. }
  6369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6370. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6371. //>>excludeEnd("ctx");
  6372. }));
  6373. return self;
  6374. }
  6375. catch(e) {if(e===$early)return e[0]; throw e}
  6376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6377. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6378. //>>excludeEnd("ctx");
  6379. },
  6380. //>>excludeStart("ide", pragmas.excludeIdeData);
  6381. args: ["aBlock"],
  6382. 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 ] ]]",
  6383. referencedClasses: ["String"],
  6384. //>>excludeEnd("ide");
  6385. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6386. }),
  6387. $globals.String);
  6388. $core.addMethod(
  6389. $core.method({
  6390. selector: "lineNumber:",
  6391. protocol: "split join",
  6392. fn: function (anIndex){
  6393. var self=this,$self=this;
  6394. var lineCount;
  6395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6396. return $core.withContext(function($ctx1) {
  6397. //>>excludeEnd("ctx");
  6398. var $2,$1;
  6399. var $early={};
  6400. try {
  6401. lineCount=(0);
  6402. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. return $core.withContext(function($ctx2) {
  6405. //>>excludeEnd("ctx");
  6406. lineCount=$recv(lineCount).__plus((1));
  6407. $2=lineCount;
  6408. $1=$recv($2).__eq(anIndex);
  6409. if($core.assert($1)){
  6410. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6411. }
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6414. //>>excludeEnd("ctx");
  6415. }));
  6416. return nil;
  6417. }
  6418. catch(e) {if(e===$early)return e[0]; throw e}
  6419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6420. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6421. //>>excludeEnd("ctx");
  6422. },
  6423. //>>excludeStart("ide", pragmas.excludeIdeData);
  6424. args: ["anIndex"],
  6425. 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",
  6426. referencedClasses: [],
  6427. //>>excludeEnd("ide");
  6428. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6429. }),
  6430. $globals.String);
  6431. $core.addMethod(
  6432. $core.method({
  6433. selector: "lines",
  6434. protocol: "split join",
  6435. fn: function (){
  6436. var self=this,$self=this;
  6437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6438. return $core.withContext(function($ctx1) {
  6439. //>>excludeEnd("ctx");
  6440. var result = self.split(/\r\n|\r|\n/);
  6441. if (!result[result.length-1]) result.pop();
  6442. return result;;
  6443. return self;
  6444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6445. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6446. //>>excludeEnd("ctx");
  6447. },
  6448. //>>excludeStart("ide", pragmas.excludeIdeData);
  6449. args: [],
  6450. 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'>",
  6451. referencedClasses: [],
  6452. //>>excludeEnd("ide");
  6453. messageSends: []
  6454. }),
  6455. $globals.String);
  6456. $core.addMethod(
  6457. $core.method({
  6458. selector: "linesDo:",
  6459. protocol: "split join",
  6460. fn: function (aBlock){
  6461. var self=this,$self=this;
  6462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6463. return $core.withContext(function($ctx1) {
  6464. //>>excludeEnd("ctx");
  6465. $recv($self._lines())._do_(aBlock);
  6466. return self;
  6467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6468. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6469. //>>excludeEnd("ctx");
  6470. },
  6471. //>>excludeStart("ide", pragmas.excludeIdeData);
  6472. args: ["aBlock"],
  6473. 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",
  6474. referencedClasses: [],
  6475. //>>excludeEnd("ide");
  6476. messageSends: ["do:", "lines"]
  6477. }),
  6478. $globals.String);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "match:",
  6482. protocol: "regular expressions",
  6483. fn: function (aRegexp){
  6484. var self=this,$self=this;
  6485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6486. return $core.withContext(function($ctx1) {
  6487. //>>excludeEnd("ctx");
  6488. return self.search(aRegexp) != -1;
  6489. return self;
  6490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6491. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6492. //>>excludeEnd("ctx");
  6493. },
  6494. //>>excludeStart("ide", pragmas.excludeIdeData);
  6495. args: ["aRegexp"],
  6496. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6497. referencedClasses: [],
  6498. //>>excludeEnd("ide");
  6499. messageSends: []
  6500. }),
  6501. $globals.String);
  6502. $core.addMethod(
  6503. $core.method({
  6504. selector: "matchesOf:",
  6505. protocol: "regular expressions",
  6506. fn: function (aRegularExpression){
  6507. var self=this,$self=this;
  6508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6509. return $core.withContext(function($ctx1) {
  6510. //>>excludeEnd("ctx");
  6511. return self.match(aRegularExpression);
  6512. return self;
  6513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6514. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6515. //>>excludeEnd("ctx");
  6516. },
  6517. //>>excludeStart("ide", pragmas.excludeIdeData);
  6518. args: ["aRegularExpression"],
  6519. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6520. referencedClasses: [],
  6521. //>>excludeEnd("ide");
  6522. messageSends: []
  6523. }),
  6524. $globals.String);
  6525. $core.addMethod(
  6526. $core.method({
  6527. selector: "printNl",
  6528. protocol: "printing",
  6529. fn: function (){
  6530. var self=this,$self=this;
  6531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6532. return $core.withContext(function($ctx1) {
  6533. //>>excludeEnd("ctx");
  6534. console.log(self);
  6535. return self;
  6536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6537. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6538. //>>excludeEnd("ctx");
  6539. },
  6540. //>>excludeStart("ide", pragmas.excludeIdeData);
  6541. args: [],
  6542. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6543. referencedClasses: [],
  6544. //>>excludeEnd("ide");
  6545. messageSends: []
  6546. }),
  6547. $globals.String);
  6548. $core.addMethod(
  6549. $core.method({
  6550. selector: "printOn:",
  6551. protocol: "printing",
  6552. fn: function (aStream){
  6553. var self=this,$self=this;
  6554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6555. return $core.withContext(function($ctx1) {
  6556. //>>excludeEnd("ctx");
  6557. $recv(aStream)._nextPutAll_("'");
  6558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6559. $ctx1.sendIdx["nextPutAll:"]=1;
  6560. //>>excludeEnd("ctx");
  6561. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6563. $ctx1.sendIdx["nextPutAll:"]=2;
  6564. //>>excludeEnd("ctx");
  6565. $recv(aStream)._nextPutAll_("'");
  6566. return self;
  6567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6568. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6569. //>>excludeEnd("ctx");
  6570. },
  6571. //>>excludeStart("ide", pragmas.excludeIdeData);
  6572. args: ["aStream"],
  6573. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6574. referencedClasses: [],
  6575. //>>excludeEnd("ide");
  6576. messageSends: ["nextPutAll:", "replace:with:"]
  6577. }),
  6578. $globals.String);
  6579. $core.addMethod(
  6580. $core.method({
  6581. selector: "putOn:",
  6582. protocol: "streaming",
  6583. fn: function (aStream){
  6584. var self=this,$self=this;
  6585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6586. return $core.withContext(function($ctx1) {
  6587. //>>excludeEnd("ctx");
  6588. $recv(aStream)._nextPutString_(self);
  6589. return self;
  6590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6591. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  6592. //>>excludeEnd("ctx");
  6593. },
  6594. //>>excludeStart("ide", pragmas.excludeIdeData);
  6595. args: ["aStream"],
  6596. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6597. referencedClasses: [],
  6598. //>>excludeEnd("ide");
  6599. messageSends: ["nextPutString:"]
  6600. }),
  6601. $globals.String);
  6602. $core.addMethod(
  6603. $core.method({
  6604. selector: "remove:",
  6605. protocol: "adding/removing",
  6606. fn: function (anObject){
  6607. var self=this,$self=this;
  6608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6609. return $core.withContext(function($ctx1) {
  6610. //>>excludeEnd("ctx");
  6611. $self._errorReadOnly();
  6612. return self;
  6613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6614. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  6615. //>>excludeEnd("ctx");
  6616. },
  6617. //>>excludeStart("ide", pragmas.excludeIdeData);
  6618. args: ["anObject"],
  6619. source: "remove: anObject\x0a\x09self errorReadOnly",
  6620. referencedClasses: [],
  6621. //>>excludeEnd("ide");
  6622. messageSends: ["errorReadOnly"]
  6623. }),
  6624. $globals.String);
  6625. $core.addMethod(
  6626. $core.method({
  6627. selector: "remove:ifAbsent:",
  6628. protocol: "adding/removing",
  6629. fn: function (anObject,aBlock){
  6630. var self=this,$self=this;
  6631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6632. return $core.withContext(function($ctx1) {
  6633. //>>excludeEnd("ctx");
  6634. $self._errorReadOnly();
  6635. return self;
  6636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6637. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  6638. //>>excludeEnd("ctx");
  6639. },
  6640. //>>excludeStart("ide", pragmas.excludeIdeData);
  6641. args: ["anObject", "aBlock"],
  6642. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6643. referencedClasses: [],
  6644. //>>excludeEnd("ide");
  6645. messageSends: ["errorReadOnly"]
  6646. }),
  6647. $globals.String);
  6648. $core.addMethod(
  6649. $core.method({
  6650. selector: "replace:with:",
  6651. protocol: "regular expressions",
  6652. fn: function (aString,anotherString){
  6653. var self=this,$self=this;
  6654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6655. return $core.withContext(function($ctx1) {
  6656. //>>excludeEnd("ctx");
  6657. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6659. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6660. //>>excludeEnd("ctx");
  6661. },
  6662. //>>excludeStart("ide", pragmas.excludeIdeData);
  6663. args: ["aString", "anotherString"],
  6664. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6665. referencedClasses: ["RegularExpression"],
  6666. //>>excludeEnd("ide");
  6667. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6668. }),
  6669. $globals.String);
  6670. $core.addMethod(
  6671. $core.method({
  6672. selector: "replaceRegexp:with:",
  6673. protocol: "regular expressions",
  6674. fn: function (aRegexp,aString){
  6675. var self=this,$self=this;
  6676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6677. return $core.withContext(function($ctx1) {
  6678. //>>excludeEnd("ctx");
  6679. return self.replace(aRegexp, aString);
  6680. return self;
  6681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6682. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6683. //>>excludeEnd("ctx");
  6684. },
  6685. //>>excludeStart("ide", pragmas.excludeIdeData);
  6686. args: ["aRegexp", "aString"],
  6687. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6688. referencedClasses: [],
  6689. //>>excludeEnd("ide");
  6690. messageSends: []
  6691. }),
  6692. $globals.String);
  6693. $core.addMethod(
  6694. $core.method({
  6695. selector: "reversed",
  6696. protocol: "converting",
  6697. fn: function (){
  6698. var self=this,$self=this;
  6699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6700. return $core.withContext(function($ctx1) {
  6701. //>>excludeEnd("ctx");
  6702. return self.split("").reverse().join("");
  6703. return self;
  6704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6705. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6706. //>>excludeEnd("ctx");
  6707. },
  6708. //>>excludeStart("ide", pragmas.excludeIdeData);
  6709. args: [],
  6710. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6711. referencedClasses: [],
  6712. //>>excludeEnd("ide");
  6713. messageSends: []
  6714. }),
  6715. $globals.String);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "shallowCopy",
  6719. protocol: "copying",
  6720. fn: function (){
  6721. var self=this,$self=this;
  6722. return self;
  6723. },
  6724. //>>excludeStart("ide", pragmas.excludeIdeData);
  6725. args: [],
  6726. source: "shallowCopy\x0a\x09^ self",
  6727. referencedClasses: [],
  6728. //>>excludeEnd("ide");
  6729. messageSends: []
  6730. }),
  6731. $globals.String);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "size",
  6735. protocol: "accessing",
  6736. fn: function (){
  6737. var self=this,$self=this;
  6738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6739. return $core.withContext(function($ctx1) {
  6740. //>>excludeEnd("ctx");
  6741. return self.length;
  6742. return self;
  6743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6744. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6745. //>>excludeEnd("ctx");
  6746. },
  6747. //>>excludeStart("ide", pragmas.excludeIdeData);
  6748. args: [],
  6749. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  6750. referencedClasses: [],
  6751. //>>excludeEnd("ide");
  6752. messageSends: []
  6753. }),
  6754. $globals.String);
  6755. $core.addMethod(
  6756. $core.method({
  6757. selector: "subStrings:",
  6758. protocol: "split join",
  6759. fn: function (aString){
  6760. var self=this,$self=this;
  6761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6762. return $core.withContext(function($ctx1) {
  6763. //>>excludeEnd("ctx");
  6764. return $self._tokenize_(aString);
  6765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6766. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6767. //>>excludeEnd("ctx");
  6768. },
  6769. //>>excludeStart("ide", pragmas.excludeIdeData);
  6770. args: ["aString"],
  6771. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6772. referencedClasses: [],
  6773. //>>excludeEnd("ide");
  6774. messageSends: ["tokenize:"]
  6775. }),
  6776. $globals.String);
  6777. $core.addMethod(
  6778. $core.method({
  6779. selector: "symbolPrintString",
  6780. protocol: "printing",
  6781. fn: function (){
  6782. var self=this,$self=this;
  6783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6784. return $core.withContext(function($ctx1) {
  6785. //>>excludeEnd("ctx");
  6786. return $recv($globals.String)._streamContents_((function(str){
  6787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6788. return $core.withContext(function($ctx2) {
  6789. //>>excludeEnd("ctx");
  6790. return $self._asSymbolPrintOn_(str);
  6791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6792. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6793. //>>excludeEnd("ctx");
  6794. }));
  6795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6796. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  6797. //>>excludeEnd("ctx");
  6798. },
  6799. //>>excludeStart("ide", pragmas.excludeIdeData);
  6800. args: [],
  6801. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6802. referencedClasses: ["String"],
  6803. //>>excludeEnd("ide");
  6804. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6805. }),
  6806. $globals.String);
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "tokenize:",
  6810. protocol: "split join",
  6811. fn: function (aString){
  6812. var self=this,$self=this;
  6813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6814. return $core.withContext(function($ctx1) {
  6815. //>>excludeEnd("ctx");
  6816. return self.split(aString);
  6817. return self;
  6818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6819. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6820. //>>excludeEnd("ctx");
  6821. },
  6822. //>>excludeStart("ide", pragmas.excludeIdeData);
  6823. args: ["aString"],
  6824. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6825. referencedClasses: [],
  6826. //>>excludeEnd("ide");
  6827. messageSends: []
  6828. }),
  6829. $globals.String);
  6830. $core.addMethod(
  6831. $core.method({
  6832. selector: "trimBoth",
  6833. protocol: "regular expressions",
  6834. fn: function (){
  6835. var self=this,$self=this;
  6836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6837. return $core.withContext(function($ctx1) {
  6838. //>>excludeEnd("ctx");
  6839. return $self._trimBoth_("\x5cs");
  6840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6841. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6842. //>>excludeEnd("ctx");
  6843. },
  6844. //>>excludeStart("ide", pragmas.excludeIdeData);
  6845. args: [],
  6846. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6847. referencedClasses: [],
  6848. //>>excludeEnd("ide");
  6849. messageSends: ["trimBoth:"]
  6850. }),
  6851. $globals.String);
  6852. $core.addMethod(
  6853. $core.method({
  6854. selector: "trimBoth:",
  6855. protocol: "regular expressions",
  6856. fn: function (separators){
  6857. var self=this,$self=this;
  6858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6859. return $core.withContext(function($ctx1) {
  6860. //>>excludeEnd("ctx");
  6861. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6863. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6864. //>>excludeEnd("ctx");
  6865. },
  6866. //>>excludeStart("ide", pragmas.excludeIdeData);
  6867. args: ["separators"],
  6868. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6869. referencedClasses: [],
  6870. //>>excludeEnd("ide");
  6871. messageSends: ["trimRight:", "trimLeft:"]
  6872. }),
  6873. $globals.String);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "trimLeft",
  6877. protocol: "regular expressions",
  6878. fn: function (){
  6879. var self=this,$self=this;
  6880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6881. return $core.withContext(function($ctx1) {
  6882. //>>excludeEnd("ctx");
  6883. return $self._trimLeft_("\x5cs");
  6884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6885. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6886. //>>excludeEnd("ctx");
  6887. },
  6888. //>>excludeStart("ide", pragmas.excludeIdeData);
  6889. args: [],
  6890. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6891. referencedClasses: [],
  6892. //>>excludeEnd("ide");
  6893. messageSends: ["trimLeft:"]
  6894. }),
  6895. $globals.String);
  6896. $core.addMethod(
  6897. $core.method({
  6898. selector: "trimLeft:",
  6899. protocol: "regular expressions",
  6900. fn: function (separators){
  6901. var self=this,$self=this;
  6902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6903. return $core.withContext(function($ctx1) {
  6904. //>>excludeEnd("ctx");
  6905. var $2,$1;
  6906. $2=$recv("^[".__comma(separators)).__comma("]+");
  6907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6908. $ctx1.sendIdx[","]=1;
  6909. //>>excludeEnd("ctx");
  6910. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6911. return $self._replaceRegexp_with_($1,"");
  6912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6913. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6914. //>>excludeEnd("ctx");
  6915. },
  6916. //>>excludeStart("ide", pragmas.excludeIdeData);
  6917. args: ["separators"],
  6918. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6919. referencedClasses: ["RegularExpression"],
  6920. //>>excludeEnd("ide");
  6921. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6922. }),
  6923. $globals.String);
  6924. $core.addMethod(
  6925. $core.method({
  6926. selector: "trimRight",
  6927. protocol: "regular expressions",
  6928. fn: function (){
  6929. var self=this,$self=this;
  6930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6931. return $core.withContext(function($ctx1) {
  6932. //>>excludeEnd("ctx");
  6933. return $self._trimRight_("\x5cs");
  6934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6935. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6936. //>>excludeEnd("ctx");
  6937. },
  6938. //>>excludeStart("ide", pragmas.excludeIdeData);
  6939. args: [],
  6940. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6941. referencedClasses: [],
  6942. //>>excludeEnd("ide");
  6943. messageSends: ["trimRight:"]
  6944. }),
  6945. $globals.String);
  6946. $core.addMethod(
  6947. $core.method({
  6948. selector: "trimRight:",
  6949. protocol: "regular expressions",
  6950. fn: function (separators){
  6951. var self=this,$self=this;
  6952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6953. return $core.withContext(function($ctx1) {
  6954. //>>excludeEnd("ctx");
  6955. var $2,$1;
  6956. $2=$recv("[".__comma(separators)).__comma("]+$");
  6957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6958. $ctx1.sendIdx[","]=1;
  6959. //>>excludeEnd("ctx");
  6960. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6961. return $self._replaceRegexp_with_($1,"");
  6962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6963. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6964. //>>excludeEnd("ctx");
  6965. },
  6966. //>>excludeStart("ide", pragmas.excludeIdeData);
  6967. args: ["separators"],
  6968. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6969. referencedClasses: ["RegularExpression"],
  6970. //>>excludeEnd("ide");
  6971. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6972. }),
  6973. $globals.String);
  6974. $core.addMethod(
  6975. $core.method({
  6976. selector: "unescaped",
  6977. protocol: "converting",
  6978. fn: function (){
  6979. var self=this,$self=this;
  6980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6981. return $core.withContext(function($ctx1) {
  6982. //>>excludeEnd("ctx");
  6983. return unescape(self);
  6984. return self;
  6985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6986. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6987. //>>excludeEnd("ctx");
  6988. },
  6989. //>>excludeStart("ide", pragmas.excludeIdeData);
  6990. args: [],
  6991. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6992. referencedClasses: [],
  6993. //>>excludeEnd("ide");
  6994. messageSends: []
  6995. }),
  6996. $globals.String);
  6997. $core.addMethod(
  6998. $core.method({
  6999. selector: "uriComponentDecoded",
  7000. protocol: "converting",
  7001. fn: function (){
  7002. var self=this,$self=this;
  7003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7004. return $core.withContext(function($ctx1) {
  7005. //>>excludeEnd("ctx");
  7006. return decodeURIComponent(self);
  7007. return self;
  7008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7009. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7010. //>>excludeEnd("ctx");
  7011. },
  7012. //>>excludeStart("ide", pragmas.excludeIdeData);
  7013. args: [],
  7014. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7015. referencedClasses: [],
  7016. //>>excludeEnd("ide");
  7017. messageSends: []
  7018. }),
  7019. $globals.String);
  7020. $core.addMethod(
  7021. $core.method({
  7022. selector: "uriComponentEncoded",
  7023. protocol: "converting",
  7024. fn: function (){
  7025. var self=this,$self=this;
  7026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7027. return $core.withContext(function($ctx1) {
  7028. //>>excludeEnd("ctx");
  7029. return encodeURIComponent(self);
  7030. return self;
  7031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7032. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7033. //>>excludeEnd("ctx");
  7034. },
  7035. //>>excludeStart("ide", pragmas.excludeIdeData);
  7036. args: [],
  7037. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7038. referencedClasses: [],
  7039. //>>excludeEnd("ide");
  7040. messageSends: []
  7041. }),
  7042. $globals.String);
  7043. $core.addMethod(
  7044. $core.method({
  7045. selector: "uriDecoded",
  7046. protocol: "converting",
  7047. fn: function (){
  7048. var self=this,$self=this;
  7049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7050. return $core.withContext(function($ctx1) {
  7051. //>>excludeEnd("ctx");
  7052. return decodeURI(self);
  7053. return self;
  7054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7055. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7056. //>>excludeEnd("ctx");
  7057. },
  7058. //>>excludeStart("ide", pragmas.excludeIdeData);
  7059. args: [],
  7060. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7061. referencedClasses: [],
  7062. //>>excludeEnd("ide");
  7063. messageSends: []
  7064. }),
  7065. $globals.String);
  7066. $core.addMethod(
  7067. $core.method({
  7068. selector: "uriEncoded",
  7069. protocol: "converting",
  7070. fn: function (){
  7071. var self=this,$self=this;
  7072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7073. return $core.withContext(function($ctx1) {
  7074. //>>excludeEnd("ctx");
  7075. return encodeURI(self);
  7076. return self;
  7077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7078. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7079. //>>excludeEnd("ctx");
  7080. },
  7081. //>>excludeStart("ide", pragmas.excludeIdeData);
  7082. args: [],
  7083. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7084. referencedClasses: [],
  7085. //>>excludeEnd("ide");
  7086. messageSends: []
  7087. }),
  7088. $globals.String);
  7089. $core.addMethod(
  7090. $core.method({
  7091. selector: "value:",
  7092. protocol: "evaluating",
  7093. fn: function (anObject){
  7094. var self=this,$self=this;
  7095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7096. return $core.withContext(function($ctx1) {
  7097. //>>excludeEnd("ctx");
  7098. return $recv(anObject)._perform_(self);
  7099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7100. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7101. //>>excludeEnd("ctx");
  7102. },
  7103. //>>excludeStart("ide", pragmas.excludeIdeData);
  7104. args: ["anObject"],
  7105. source: "value: anObject \x0a\x09^ anObject perform: self",
  7106. referencedClasses: [],
  7107. //>>excludeEnd("ide");
  7108. messageSends: ["perform:"]
  7109. }),
  7110. $globals.String);
  7111. $core.addMethod(
  7112. $core.method({
  7113. selector: "cr",
  7114. protocol: "accessing",
  7115. fn: function (){
  7116. var self=this,$self=this;
  7117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7118. return $core.withContext(function($ctx1) {
  7119. //>>excludeEnd("ctx");
  7120. return "\r";
  7121. return self;
  7122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7123. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  7124. //>>excludeEnd("ctx");
  7125. },
  7126. //>>excludeStart("ide", pragmas.excludeIdeData);
  7127. args: [],
  7128. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7129. referencedClasses: [],
  7130. //>>excludeEnd("ide");
  7131. messageSends: []
  7132. }),
  7133. $globals.String.a$cls);
  7134. $core.addMethod(
  7135. $core.method({
  7136. selector: "crlf",
  7137. protocol: "accessing",
  7138. fn: function (){
  7139. var self=this,$self=this;
  7140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7141. return $core.withContext(function($ctx1) {
  7142. //>>excludeEnd("ctx");
  7143. return "\r\n";
  7144. return self;
  7145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7146. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  7147. //>>excludeEnd("ctx");
  7148. },
  7149. //>>excludeStart("ide", pragmas.excludeIdeData);
  7150. args: [],
  7151. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7152. referencedClasses: [],
  7153. //>>excludeEnd("ide");
  7154. messageSends: []
  7155. }),
  7156. $globals.String.a$cls);
  7157. $core.addMethod(
  7158. $core.method({
  7159. selector: "esc",
  7160. protocol: "accessing",
  7161. fn: function (){
  7162. var self=this,$self=this;
  7163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7164. return $core.withContext(function($ctx1) {
  7165. //>>excludeEnd("ctx");
  7166. return $self._fromCharCode_((27));
  7167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7168. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  7169. //>>excludeEnd("ctx");
  7170. },
  7171. //>>excludeStart("ide", pragmas.excludeIdeData);
  7172. args: [],
  7173. source: "esc\x0a\x09^ self fromCharCode: 27",
  7174. referencedClasses: [],
  7175. //>>excludeEnd("ide");
  7176. messageSends: ["fromCharCode:"]
  7177. }),
  7178. $globals.String.a$cls);
  7179. $core.addMethod(
  7180. $core.method({
  7181. selector: "fromCharCode:",
  7182. protocol: "instance creation",
  7183. fn: function (anInteger){
  7184. var self=this,$self=this;
  7185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7186. return $core.withContext(function($ctx1) {
  7187. //>>excludeEnd("ctx");
  7188. return String.fromCharCode(anInteger);
  7189. return self;
  7190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7191. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  7192. //>>excludeEnd("ctx");
  7193. },
  7194. //>>excludeStart("ide", pragmas.excludeIdeData);
  7195. args: ["anInteger"],
  7196. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7197. referencedClasses: [],
  7198. //>>excludeEnd("ide");
  7199. messageSends: []
  7200. }),
  7201. $globals.String.a$cls);
  7202. $core.addMethod(
  7203. $core.method({
  7204. selector: "fromString:",
  7205. protocol: "instance creation",
  7206. fn: function (aString){
  7207. var self=this,$self=this;
  7208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7209. return $core.withContext(function($ctx1) {
  7210. //>>excludeEnd("ctx");
  7211. return String(aString);
  7212. return self;
  7213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7214. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  7215. //>>excludeEnd("ctx");
  7216. },
  7217. //>>excludeStart("ide", pragmas.excludeIdeData);
  7218. args: ["aString"],
  7219. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7220. referencedClasses: [],
  7221. //>>excludeEnd("ide");
  7222. messageSends: []
  7223. }),
  7224. $globals.String.a$cls);
  7225. $core.addMethod(
  7226. $core.method({
  7227. selector: "lf",
  7228. protocol: "accessing",
  7229. fn: function (){
  7230. var self=this,$self=this;
  7231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7232. return $core.withContext(function($ctx1) {
  7233. //>>excludeEnd("ctx");
  7234. return "\n";
  7235. return self;
  7236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7237. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  7238. //>>excludeEnd("ctx");
  7239. },
  7240. //>>excludeStart("ide", pragmas.excludeIdeData);
  7241. args: [],
  7242. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7243. referencedClasses: [],
  7244. //>>excludeEnd("ide");
  7245. messageSends: []
  7246. }),
  7247. $globals.String.a$cls);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "random",
  7251. protocol: "random",
  7252. fn: function (){
  7253. var self=this,$self=this;
  7254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7255. return $core.withContext(function($ctx1) {
  7256. //>>excludeEnd("ctx");
  7257. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7258. return self;
  7259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7260. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  7261. //>>excludeEnd("ctx");
  7262. },
  7263. //>>excludeStart("ide", pragmas.excludeIdeData);
  7264. args: [],
  7265. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  7266. referencedClasses: [],
  7267. //>>excludeEnd("ide");
  7268. messageSends: []
  7269. }),
  7270. $globals.String.a$cls);
  7271. $core.addMethod(
  7272. $core.method({
  7273. selector: "randomNotIn:",
  7274. protocol: "random",
  7275. fn: function (aString){
  7276. var self=this,$self=this;
  7277. var result;
  7278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7279. return $core.withContext(function($ctx1) {
  7280. //>>excludeEnd("ctx");
  7281. $recv((function(){
  7282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7283. return $core.withContext(function($ctx2) {
  7284. //>>excludeEnd("ctx");
  7285. result=$self._random();
  7286. return $recv(aString)._includesSubString_(result);
  7287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7288. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7289. //>>excludeEnd("ctx");
  7290. }))._whileTrue();
  7291. return result;
  7292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7293. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  7294. //>>excludeEnd("ctx");
  7295. },
  7296. //>>excludeStart("ide", pragmas.excludeIdeData);
  7297. args: ["aString"],
  7298. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7299. referencedClasses: [],
  7300. //>>excludeEnd("ide");
  7301. messageSends: ["whileTrue", "random", "includesSubString:"]
  7302. }),
  7303. $globals.String.a$cls);
  7304. $core.addMethod(
  7305. $core.method({
  7306. selector: "space",
  7307. protocol: "accessing",
  7308. fn: function (){
  7309. var self=this,$self=this;
  7310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7311. return $core.withContext(function($ctx1) {
  7312. //>>excludeEnd("ctx");
  7313. return " ";
  7314. return self;
  7315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7316. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  7317. //>>excludeEnd("ctx");
  7318. },
  7319. //>>excludeStart("ide", pragmas.excludeIdeData);
  7320. args: [],
  7321. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7322. referencedClasses: [],
  7323. //>>excludeEnd("ide");
  7324. messageSends: []
  7325. }),
  7326. $globals.String.a$cls);
  7327. $core.addMethod(
  7328. $core.method({
  7329. selector: "streamClass",
  7330. protocol: "accessing",
  7331. fn: function (){
  7332. var self=this,$self=this;
  7333. return $globals.StringStream;
  7334. },
  7335. //>>excludeStart("ide", pragmas.excludeIdeData);
  7336. args: [],
  7337. source: "streamClass\x0a\x09\x09^ StringStream",
  7338. referencedClasses: ["StringStream"],
  7339. //>>excludeEnd("ide");
  7340. messageSends: []
  7341. }),
  7342. $globals.String.a$cls);
  7343. $core.addMethod(
  7344. $core.method({
  7345. selector: "tab",
  7346. protocol: "accessing",
  7347. fn: function (){
  7348. var self=this,$self=this;
  7349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7350. return $core.withContext(function($ctx1) {
  7351. //>>excludeEnd("ctx");
  7352. return "\t";
  7353. return self;
  7354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7355. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  7356. //>>excludeEnd("ctx");
  7357. },
  7358. //>>excludeStart("ide", pragmas.excludeIdeData);
  7359. args: [],
  7360. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7361. referencedClasses: [],
  7362. //>>excludeEnd("ide");
  7363. messageSends: []
  7364. }),
  7365. $globals.String.a$cls);
  7366. $core.addMethod(
  7367. $core.method({
  7368. selector: "value:",
  7369. protocol: "instance creation",
  7370. fn: function (aUTFCharCode){
  7371. var self=this,$self=this;
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. return $core.withContext(function($ctx1) {
  7374. //>>excludeEnd("ctx");
  7375. return String.fromCharCode(aUTFCharCode);;
  7376. return self;
  7377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7378. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  7379. //>>excludeEnd("ctx");
  7380. },
  7381. //>>excludeStart("ide", pragmas.excludeIdeData);
  7382. args: ["aUTFCharCode"],
  7383. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7384. referencedClasses: [],
  7385. //>>excludeEnd("ide");
  7386. messageSends: []
  7387. }),
  7388. $globals.String.a$cls);
  7389. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7390. //>>excludeStart("ide", pragmas.excludeIdeData);
  7391. $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`.";
  7392. //>>excludeEnd("ide");
  7393. $core.addMethod(
  7394. $core.method({
  7395. selector: "=",
  7396. protocol: "comparing",
  7397. fn: function (aCollection){
  7398. var self=this,$self=this;
  7399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7400. return $core.withContext(function($ctx1) {
  7401. //>>excludeEnd("ctx");
  7402. var $2,$1,$4,$3,$5;
  7403. var $early={};
  7404. try {
  7405. $2=$self._class();
  7406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7407. $ctx1.sendIdx["class"]=1;
  7408. //>>excludeEnd("ctx");
  7409. $1=$recv($2).__eq($recv(aCollection)._class());
  7410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7411. $ctx1.sendIdx["="]=1;
  7412. //>>excludeEnd("ctx");
  7413. if(!$core.assert($1)){
  7414. return false;
  7415. }
  7416. $4=$self._size();
  7417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7418. $ctx1.sendIdx["size"]=1;
  7419. //>>excludeEnd("ctx");
  7420. $3=$recv($4).__eq($recv(aCollection)._size());
  7421. if(!$core.assert($3)){
  7422. return false;
  7423. }
  7424. $self._do_((function(each){
  7425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7426. return $core.withContext(function($ctx2) {
  7427. //>>excludeEnd("ctx");
  7428. $5=$recv(aCollection)._includes_(each);
  7429. if(!$core.assert($5)){
  7430. throw $early=[false];
  7431. }
  7432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7434. //>>excludeEnd("ctx");
  7435. }));
  7436. return true;
  7437. }
  7438. catch(e) {if(e===$early)return e[0]; throw e}
  7439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7440. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7441. //>>excludeEnd("ctx");
  7442. },
  7443. //>>excludeStart("ide", pragmas.excludeIdeData);
  7444. args: ["aCollection"],
  7445. 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",
  7446. referencedClasses: [],
  7447. //>>excludeEnd("ide");
  7448. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7449. }),
  7450. $globals.Set);
  7451. $core.addMethod(
  7452. $core.method({
  7453. selector: "add:",
  7454. protocol: "adding/removing",
  7455. fn: function (anObject){
  7456. var self=this,$self=this;
  7457. var bucket;
  7458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7459. return $core.withContext(function($ctx1) {
  7460. //>>excludeEnd("ctx");
  7461. var $1,$receiver;
  7462. bucket=$self._bucketsOfElement_(anObject);
  7463. $1=$recv(bucket)._second();
  7464. if(($receiver = $1) == null || $receiver.a$nil){
  7465. var object,slowBucket;
  7466. object=$recv(bucket)._first();
  7467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7468. $ctx1.sendIdx["first"]=1;
  7469. //>>excludeEnd("ctx");
  7470. slowBucket=$recv(bucket)._third();
  7471. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7473. return $core.withContext(function($ctx2) {
  7474. //>>excludeEnd("ctx");
  7475. $recv(slowBucket)._add_(object);
  7476. $self["@size"]=$recv($self["@size"]).__plus((1));
  7477. return $self["@size"];
  7478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7480. //>>excludeEnd("ctx");
  7481. }));
  7482. return object;
  7483. } else {
  7484. var primitiveBucket;
  7485. primitiveBucket=$receiver;
  7486. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7487. }
  7488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7489. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7490. //>>excludeEnd("ctx");
  7491. },
  7492. //>>excludeStart("ide", pragmas.excludeIdeData);
  7493. args: ["anObject"],
  7494. 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 ]",
  7495. referencedClasses: [],
  7496. //>>excludeEnd("ide");
  7497. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7498. }),
  7499. $globals.Set);
  7500. $core.addMethod(
  7501. $core.method({
  7502. selector: "add:in:",
  7503. protocol: "private",
  7504. fn: function (anObject,anotherObject){
  7505. var self=this,$self=this;
  7506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7507. return $core.withContext(function($ctx1) {
  7508. //>>excludeEnd("ctx");
  7509. if (anObject in anotherObject.store) { return anObject; }
  7510. $self['@size']++;
  7511. anotherObject.store[anObject] = true;
  7512. return anObject;
  7513. ;
  7514. return self;
  7515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7516. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7517. //>>excludeEnd("ctx");
  7518. },
  7519. //>>excludeStart("ide", pragmas.excludeIdeData);
  7520. args: ["anObject", "anotherObject"],
  7521. 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'>",
  7522. referencedClasses: [],
  7523. //>>excludeEnd("ide");
  7524. messageSends: []
  7525. }),
  7526. $globals.Set);
  7527. $core.addMethod(
  7528. $core.method({
  7529. selector: "bucketsOfElement:",
  7530. protocol: "private",
  7531. fn: function (anObject){
  7532. var self=this,$self=this;
  7533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7534. return $core.withContext(function($ctx1) {
  7535. //>>excludeEnd("ctx");
  7536. // include nil to well-known objects under "boolean" fastBucket
  7537. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7538. var prim = anObject.valueOf();
  7539. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7540. var bucket = null;
  7541. $self['@slowBucketStores'].some(function (store) {
  7542. return bucket = store._bucketOfElement_(anObject);
  7543. });
  7544. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7545. }
  7546. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7547. ;
  7548. return self;
  7549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7550. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7551. //>>excludeEnd("ctx");
  7552. },
  7553. //>>excludeStart("ide", pragmas.excludeIdeData);
  7554. args: ["anObject"],
  7555. 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'>",
  7556. referencedClasses: [],
  7557. //>>excludeEnd("ide");
  7558. messageSends: []
  7559. }),
  7560. $globals.Set);
  7561. $core.addMethod(
  7562. $core.method({
  7563. selector: "classNameOf:",
  7564. protocol: "private",
  7565. fn: function (anObject){
  7566. var self=this,$self=this;
  7567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7568. return $core.withContext(function($ctx1) {
  7569. //>>excludeEnd("ctx");
  7570. return anObject.a$cls != null && anObject.a$cls.name;
  7571. return self;
  7572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7573. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7574. //>>excludeEnd("ctx");
  7575. },
  7576. //>>excludeStart("ide", pragmas.excludeIdeData);
  7577. args: ["anObject"],
  7578. 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'>",
  7579. referencedClasses: [],
  7580. //>>excludeEnd("ide");
  7581. messageSends: []
  7582. }),
  7583. $globals.Set);
  7584. $core.addMethod(
  7585. $core.method({
  7586. selector: "collect:",
  7587. protocol: "enumerating",
  7588. fn: function (aBlock){
  7589. var self=this,$self=this;
  7590. var collection;
  7591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7592. return $core.withContext(function($ctx1) {
  7593. //>>excludeEnd("ctx");
  7594. collection=$recv($self._class())._new();
  7595. $self._do_((function(each){
  7596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7597. return $core.withContext(function($ctx2) {
  7598. //>>excludeEnd("ctx");
  7599. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7602. //>>excludeEnd("ctx");
  7603. }));
  7604. return collection;
  7605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7606. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7607. //>>excludeEnd("ctx");
  7608. },
  7609. //>>excludeStart("ide", pragmas.excludeIdeData);
  7610. args: ["aBlock"],
  7611. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7612. referencedClasses: [],
  7613. //>>excludeEnd("ide");
  7614. messageSends: ["new", "class", "do:", "add:", "value:"]
  7615. }),
  7616. $globals.Set);
  7617. $core.addMethod(
  7618. $core.method({
  7619. selector: "detect:ifNone:",
  7620. protocol: "enumerating",
  7621. fn: function (aBlock,anotherBlock){
  7622. var self=this,$self=this;
  7623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7624. return $core.withContext(function($ctx1) {
  7625. //>>excludeEnd("ctx");
  7626. var $1;
  7627. var $early={};
  7628. try {
  7629. $self._do_((function(each){
  7630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7631. return $core.withContext(function($ctx2) {
  7632. //>>excludeEnd("ctx");
  7633. $1=$recv(aBlock)._value_(each);
  7634. if($core.assert($1)){
  7635. throw $early=[each];
  7636. }
  7637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7638. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7639. //>>excludeEnd("ctx");
  7640. }));
  7641. return $recv(anotherBlock)._value();
  7642. }
  7643. catch(e) {if(e===$early)return e[0]; throw e}
  7644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7645. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7646. //>>excludeEnd("ctx");
  7647. },
  7648. //>>excludeStart("ide", pragmas.excludeIdeData);
  7649. args: ["aBlock", "anotherBlock"],
  7650. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7651. referencedClasses: [],
  7652. //>>excludeEnd("ide");
  7653. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7654. }),
  7655. $globals.Set);
  7656. $core.addMethod(
  7657. $core.method({
  7658. selector: "do:",
  7659. protocol: "enumerating",
  7660. fn: function (aBlock){
  7661. var self=this,$self=this;
  7662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7663. return $core.withContext(function($ctx1) {
  7664. //>>excludeEnd("ctx");
  7665. var el, keys, i;
  7666. el = $self['@fastBuckets'];
  7667. keys = Object.keys(el);
  7668. for (i = 0; i < keys.length; ++i) {
  7669. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7670. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7671. else { store._do_(aBlock); }
  7672. }
  7673. el = $self['@slowBucketStores'];
  7674. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7675. $self['@defaultBucket']._do_(aBlock);
  7676. ;
  7677. return self;
  7678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7679. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7680. //>>excludeEnd("ctx");
  7681. },
  7682. //>>excludeStart("ide", pragmas.excludeIdeData);
  7683. args: ["aBlock"],
  7684. 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'>",
  7685. referencedClasses: [],
  7686. //>>excludeEnd("ide");
  7687. messageSends: []
  7688. }),
  7689. $globals.Set);
  7690. $core.addMethod(
  7691. $core.method({
  7692. selector: "includes:",
  7693. protocol: "testing",
  7694. fn: function (anObject){
  7695. var self=this,$self=this;
  7696. var bucket;
  7697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7698. return $core.withContext(function($ctx1) {
  7699. //>>excludeEnd("ctx");
  7700. var $1,$2,$3,$receiver;
  7701. bucket=$self._bucketsOfElement_(anObject);
  7702. $1=$recv(bucket)._second();
  7703. if(($receiver = $1) == null || $receiver.a$nil){
  7704. $2=$recv(bucket)._third();
  7705. $3=$recv(bucket)._first();
  7706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7707. $ctx1.sendIdx["first"]=1;
  7708. //>>excludeEnd("ctx");
  7709. return $recv($2)._includes_($3);
  7710. } else {
  7711. var primitiveBucket;
  7712. primitiveBucket=$receiver;
  7713. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7714. }
  7715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7716. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7717. //>>excludeEnd("ctx");
  7718. },
  7719. //>>excludeStart("ide", pragmas.excludeIdeData);
  7720. args: ["anObject"],
  7721. 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 ]",
  7722. referencedClasses: [],
  7723. //>>excludeEnd("ide");
  7724. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7725. }),
  7726. $globals.Set);
  7727. $core.addMethod(
  7728. $core.method({
  7729. selector: "includes:in:",
  7730. protocol: "private",
  7731. fn: function (anObject,anotherObject){
  7732. var self=this,$self=this;
  7733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7734. return $core.withContext(function($ctx1) {
  7735. //>>excludeEnd("ctx");
  7736. return anObject in anotherObject.store;
  7737. return self;
  7738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7739. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7740. //>>excludeEnd("ctx");
  7741. },
  7742. //>>excludeStart("ide", pragmas.excludeIdeData);
  7743. args: ["anObject", "anotherObject"],
  7744. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7745. referencedClasses: [],
  7746. //>>excludeEnd("ide");
  7747. messageSends: []
  7748. }),
  7749. $globals.Set);
  7750. $core.addMethod(
  7751. $core.method({
  7752. selector: "initialize",
  7753. protocol: "initialization",
  7754. fn: function (){
  7755. var self=this,$self=this;
  7756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7757. return $core.withContext(function($ctx1) {
  7758. //>>excludeEnd("ctx");
  7759. (
  7760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7761. $ctx1.supercall = true,
  7762. //>>excludeEnd("ctx");
  7763. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7765. $ctx1.supercall = false;
  7766. //>>excludeEnd("ctx");;
  7767. $self["@defaultBucket"]=[];
  7768. $self._initializeSlowBucketStores();
  7769. $self._removeAll();
  7770. return self;
  7771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7772. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7773. //>>excludeEnd("ctx");
  7774. },
  7775. //>>excludeStart("ide", pragmas.excludeIdeData);
  7776. args: [],
  7777. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7778. referencedClasses: [],
  7779. //>>excludeEnd("ide");
  7780. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7781. }),
  7782. $globals.Set);
  7783. $core.addMethod(
  7784. $core.method({
  7785. selector: "initializeSlowBucketStores",
  7786. protocol: "initialization",
  7787. fn: function (){
  7788. var self=this,$self=this;
  7789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7790. return $core.withContext(function($ctx1) {
  7791. //>>excludeEnd("ctx");
  7792. var $1;
  7793. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7795. return $core.withContext(function($ctx2) {
  7796. //>>excludeEnd("ctx");
  7797. return $self._classNameOf_(x);
  7798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7799. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7800. //>>excludeEnd("ctx");
  7801. }));
  7802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7803. $ctx1.sendIdx["hashBlock:"]=1;
  7804. //>>excludeEnd("ctx");
  7805. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7807. return $core.withContext(function($ctx2) {
  7808. //>>excludeEnd("ctx");
  7809. return $self._jsConstructorNameOf_(x);
  7810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7811. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7812. //>>excludeEnd("ctx");
  7813. }))];
  7814. return self;
  7815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7816. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7817. //>>excludeEnd("ctx");
  7818. },
  7819. //>>excludeStart("ide", pragmas.excludeIdeData);
  7820. args: [],
  7821. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7822. referencedClasses: ["ArrayBucketStore"],
  7823. //>>excludeEnd("ide");
  7824. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7825. }),
  7826. $globals.Set);
  7827. $core.addMethod(
  7828. $core.method({
  7829. selector: "jsConstructorNameOf:",
  7830. protocol: "private",
  7831. fn: function (anObject){
  7832. var self=this,$self=this;
  7833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7834. return $core.withContext(function($ctx1) {
  7835. //>>excludeEnd("ctx");
  7836. return anObject.constructor && anObject.constructor.name;
  7837. return self;
  7838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7839. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7840. //>>excludeEnd("ctx");
  7841. },
  7842. //>>excludeStart("ide", pragmas.excludeIdeData);
  7843. args: ["anObject"],
  7844. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7845. referencedClasses: [],
  7846. //>>excludeEnd("ide");
  7847. messageSends: []
  7848. }),
  7849. $globals.Set);
  7850. $core.addMethod(
  7851. $core.method({
  7852. selector: "printOn:",
  7853. protocol: "printing",
  7854. fn: function (aStream){
  7855. var self=this,$self=this;
  7856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7857. return $core.withContext(function($ctx1) {
  7858. //>>excludeEnd("ctx");
  7859. (
  7860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7861. $ctx1.supercall = true,
  7862. //>>excludeEnd("ctx");
  7863. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7865. $ctx1.supercall = false;
  7866. //>>excludeEnd("ctx");;
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. $ctx1.sendIdx["printOn:"]=1;
  7869. //>>excludeEnd("ctx");
  7870. $recv(aStream)._nextPutAll_(" (");
  7871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7872. $ctx1.sendIdx["nextPutAll:"]=1;
  7873. //>>excludeEnd("ctx");
  7874. $self._do_separatedBy_((function(each){
  7875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7876. return $core.withContext(function($ctx2) {
  7877. //>>excludeEnd("ctx");
  7878. return $recv(each)._printOn_(aStream);
  7879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7880. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7881. //>>excludeEnd("ctx");
  7882. }),(function(){
  7883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7884. return $core.withContext(function($ctx2) {
  7885. //>>excludeEnd("ctx");
  7886. return $recv(aStream)._nextPutAll_(" ");
  7887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7888. $ctx2.sendIdx["nextPutAll:"]=2;
  7889. //>>excludeEnd("ctx");
  7890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7891. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7892. //>>excludeEnd("ctx");
  7893. }));
  7894. $recv(aStream)._nextPutAll_(")");
  7895. return self;
  7896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7897. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7898. //>>excludeEnd("ctx");
  7899. },
  7900. //>>excludeStart("ide", pragmas.excludeIdeData);
  7901. args: ["aStream"],
  7902. 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: ')'",
  7903. referencedClasses: [],
  7904. //>>excludeEnd("ide");
  7905. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7906. }),
  7907. $globals.Set);
  7908. $core.addMethod(
  7909. $core.method({
  7910. selector: "remove:ifAbsent:",
  7911. protocol: "adding/removing",
  7912. fn: function (anObject,aBlock){
  7913. var self=this,$self=this;
  7914. var bucket;
  7915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7916. return $core.withContext(function($ctx1) {
  7917. //>>excludeEnd("ctx");
  7918. var $1,$2,$3,$receiver;
  7919. var $early={};
  7920. try {
  7921. bucket=$self._bucketsOfElement_(anObject);
  7922. $1=$recv(bucket)._second();
  7923. if(($receiver = $1) == null || $receiver.a$nil){
  7924. $2=$recv(bucket)._third();
  7925. $3=$recv(bucket)._first();
  7926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7927. $ctx1.sendIdx["first"]=1;
  7928. //>>excludeEnd("ctx");
  7929. $recv($2)._remove_ifAbsent_($3,(function(){
  7930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7931. return $core.withContext(function($ctx2) {
  7932. //>>excludeEnd("ctx");
  7933. throw $early=[$recv(aBlock)._value()];
  7934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7936. //>>excludeEnd("ctx");
  7937. }));
  7938. $self["@size"]=$recv($self["@size"]).__minus((1));
  7939. return $self["@size"];
  7940. } else {
  7941. var primitiveBucket;
  7942. primitiveBucket=$receiver;
  7943. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7944. }
  7945. }
  7946. catch(e) {if(e===$early)return e[0]; throw e}
  7947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7948. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7949. //>>excludeEnd("ctx");
  7950. },
  7951. //>>excludeStart("ide", pragmas.excludeIdeData);
  7952. args: ["anObject", "aBlock"],
  7953. 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 ]",
  7954. referencedClasses: [],
  7955. //>>excludeEnd("ide");
  7956. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7957. }),
  7958. $globals.Set);
  7959. $core.addMethod(
  7960. $core.method({
  7961. selector: "remove:in:ifAbsent:",
  7962. protocol: "private",
  7963. fn: function (anObject,anotherObject,aBlock){
  7964. var self=this,$self=this;
  7965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7966. return $core.withContext(function($ctx1) {
  7967. //>>excludeEnd("ctx");
  7968. if (anObject in anotherObject.store) {
  7969. delete anotherObject.store[anObject];
  7970. $self['@size']--;
  7971. return anObject;
  7972. } else {
  7973. return aBlock._value();
  7974. };
  7975. return self;
  7976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7977. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  7978. //>>excludeEnd("ctx");
  7979. },
  7980. //>>excludeStart("ide", pragmas.excludeIdeData);
  7981. args: ["anObject", "anotherObject", "aBlock"],
  7982. 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}'>",
  7983. referencedClasses: [],
  7984. //>>excludeEnd("ide");
  7985. messageSends: []
  7986. }),
  7987. $globals.Set);
  7988. $core.addMethod(
  7989. $core.method({
  7990. selector: "removeAll",
  7991. protocol: "adding/removing",
  7992. fn: function (){
  7993. var self=this,$self=this;
  7994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7995. return $core.withContext(function($ctx1) {
  7996. //>>excludeEnd("ctx");
  7997. $self['@fastBuckets'] = {
  7998. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7999. "number": { store: Object.create(null), fn: Number },
  8000. "string": { store: Object.create(null) }
  8001. };
  8002. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  8003. $self['@defaultBucket']._removeAll();
  8004. $self['@size'] = 0;
  8005. ;
  8006. return self;
  8007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8008. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8009. //>>excludeEnd("ctx");
  8010. },
  8011. //>>excludeStart("ide", pragmas.excludeIdeData);
  8012. args: [],
  8013. 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'>",
  8014. referencedClasses: [],
  8015. //>>excludeEnd("ide");
  8016. messageSends: []
  8017. }),
  8018. $globals.Set);
  8019. $core.addMethod(
  8020. $core.method({
  8021. selector: "select:",
  8022. protocol: "enumerating",
  8023. fn: function (aBlock){
  8024. var self=this,$self=this;
  8025. var collection;
  8026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8027. return $core.withContext(function($ctx1) {
  8028. //>>excludeEnd("ctx");
  8029. var $1;
  8030. collection=$recv($self._class())._new();
  8031. $self._do_((function(each){
  8032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8033. return $core.withContext(function($ctx2) {
  8034. //>>excludeEnd("ctx");
  8035. $1=$recv(aBlock)._value_(each);
  8036. if($core.assert($1)){
  8037. return $recv(collection)._add_(each);
  8038. }
  8039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8041. //>>excludeEnd("ctx");
  8042. }));
  8043. return collection;
  8044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8045. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8046. //>>excludeEnd("ctx");
  8047. },
  8048. //>>excludeStart("ide", pragmas.excludeIdeData);
  8049. args: ["aBlock"],
  8050. 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",
  8051. referencedClasses: [],
  8052. //>>excludeEnd("ide");
  8053. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8054. }),
  8055. $globals.Set);
  8056. $core.addMethod(
  8057. $core.method({
  8058. selector: "select:thenCollect:",
  8059. protocol: "enumerating",
  8060. fn: function (selectBlock,collectBlock){
  8061. var self=this,$self=this;
  8062. var collection;
  8063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8064. return $core.withContext(function($ctx1) {
  8065. //>>excludeEnd("ctx");
  8066. var $1;
  8067. collection=$recv($self._class())._new();
  8068. $self._do_((function(each){
  8069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8070. return $core.withContext(function($ctx2) {
  8071. //>>excludeEnd("ctx");
  8072. $1=$recv(selectBlock)._value_(each);
  8073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8074. $ctx2.sendIdx["value:"]=1;
  8075. //>>excludeEnd("ctx");
  8076. if($core.assert($1)){
  8077. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  8078. }
  8079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8081. //>>excludeEnd("ctx");
  8082. }));
  8083. return collection;
  8084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8085. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  8086. //>>excludeEnd("ctx");
  8087. },
  8088. //>>excludeStart("ide", pragmas.excludeIdeData);
  8089. args: ["selectBlock", "collectBlock"],
  8090. 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",
  8091. referencedClasses: [],
  8092. //>>excludeEnd("ide");
  8093. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8094. }),
  8095. $globals.Set);
  8096. $core.addMethod(
  8097. $core.method({
  8098. selector: "size",
  8099. protocol: "accessing",
  8100. fn: function (){
  8101. var self=this,$self=this;
  8102. return $self["@size"];
  8103. },
  8104. //>>excludeStart("ide", pragmas.excludeIdeData);
  8105. args: [],
  8106. source: "size\x0a\x09^ size",
  8107. referencedClasses: [],
  8108. //>>excludeEnd("ide");
  8109. messageSends: []
  8110. }),
  8111. $globals.Set);
  8112. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  8113. //>>excludeStart("ide", pragmas.excludeIdeData);
  8114. $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.";
  8115. //>>excludeEnd("ide");
  8116. $core.addMethod(
  8117. $core.method({
  8118. selector: "<<",
  8119. protocol: "writing",
  8120. fn: function (anObject){
  8121. var self=this,$self=this;
  8122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8123. return $core.withContext(function($ctx1) {
  8124. //>>excludeEnd("ctx");
  8125. $self._write_(anObject);
  8126. return self;
  8127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8128. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8129. //>>excludeEnd("ctx");
  8130. },
  8131. //>>excludeStart("ide", pragmas.excludeIdeData);
  8132. args: ["anObject"],
  8133. source: "<< anObject\x0a\x09self write: anObject",
  8134. referencedClasses: [],
  8135. //>>excludeEnd("ide");
  8136. messageSends: ["write:"]
  8137. }),
  8138. $globals.ProtoStream);
  8139. $core.addMethod(
  8140. $core.method({
  8141. selector: "atEnd",
  8142. protocol: "testing",
  8143. fn: function (){
  8144. var self=this,$self=this;
  8145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8146. return $core.withContext(function($ctx1) {
  8147. //>>excludeEnd("ctx");
  8148. $self._subclassResponsibility();
  8149. return self;
  8150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8151. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8152. //>>excludeEnd("ctx");
  8153. },
  8154. //>>excludeStart("ide", pragmas.excludeIdeData);
  8155. args: [],
  8156. source: "atEnd\x0a\x09self subclassResponsibility",
  8157. referencedClasses: [],
  8158. //>>excludeEnd("ide");
  8159. messageSends: ["subclassResponsibility"]
  8160. }),
  8161. $globals.ProtoStream);
  8162. $core.addMethod(
  8163. $core.method({
  8164. selector: "atStart",
  8165. protocol: "testing",
  8166. fn: function (){
  8167. var self=this,$self=this;
  8168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8169. return $core.withContext(function($ctx1) {
  8170. //>>excludeEnd("ctx");
  8171. $self._subclassResponsibility();
  8172. return self;
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8175. //>>excludeEnd("ctx");
  8176. },
  8177. //>>excludeStart("ide", pragmas.excludeIdeData);
  8178. args: [],
  8179. source: "atStart\x0a\x09self subclassResponsibility",
  8180. referencedClasses: [],
  8181. //>>excludeEnd("ide");
  8182. messageSends: ["subclassResponsibility"]
  8183. }),
  8184. $globals.ProtoStream);
  8185. $core.addMethod(
  8186. $core.method({
  8187. selector: "contents",
  8188. protocol: "accessing",
  8189. fn: function (){
  8190. var self=this,$self=this;
  8191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8192. return $core.withContext(function($ctx1) {
  8193. //>>excludeEnd("ctx");
  8194. $self._subclassResponsibility();
  8195. return self;
  8196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8197. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8198. //>>excludeEnd("ctx");
  8199. },
  8200. //>>excludeStart("ide", pragmas.excludeIdeData);
  8201. args: [],
  8202. source: "contents\x0a\x09self subclassResponsibility",
  8203. referencedClasses: [],
  8204. //>>excludeEnd("ide");
  8205. messageSends: ["subclassResponsibility"]
  8206. }),
  8207. $globals.ProtoStream);
  8208. $core.addMethod(
  8209. $core.method({
  8210. selector: "do:",
  8211. protocol: "enumerating",
  8212. fn: function (aBlock){
  8213. var self=this,$self=this;
  8214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8215. return $core.withContext(function($ctx1) {
  8216. //>>excludeEnd("ctx");
  8217. $recv((function(){
  8218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8219. return $core.withContext(function($ctx2) {
  8220. //>>excludeEnd("ctx");
  8221. return $self._atEnd();
  8222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8224. //>>excludeEnd("ctx");
  8225. }))._whileFalse_((function(){
  8226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8227. return $core.withContext(function($ctx2) {
  8228. //>>excludeEnd("ctx");
  8229. return $recv(aBlock)._value_($self._next());
  8230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8231. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8232. //>>excludeEnd("ctx");
  8233. }));
  8234. return self;
  8235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8236. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8237. //>>excludeEnd("ctx");
  8238. },
  8239. //>>excludeStart("ide", pragmas.excludeIdeData);
  8240. args: ["aBlock"],
  8241. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8242. referencedClasses: [],
  8243. //>>excludeEnd("ide");
  8244. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8245. }),
  8246. $globals.ProtoStream);
  8247. $core.addMethod(
  8248. $core.method({
  8249. selector: "isEmpty",
  8250. protocol: "testing",
  8251. fn: function (){
  8252. var self=this,$self=this;
  8253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8254. return $core.withContext(function($ctx1) {
  8255. //>>excludeEnd("ctx");
  8256. return $recv($self._atStart())._and_((function(){
  8257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8258. return $core.withContext(function($ctx2) {
  8259. //>>excludeEnd("ctx");
  8260. return $self._atEnd();
  8261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8263. //>>excludeEnd("ctx");
  8264. }));
  8265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8266. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8267. //>>excludeEnd("ctx");
  8268. },
  8269. //>>excludeStart("ide", pragmas.excludeIdeData);
  8270. args: [],
  8271. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8272. referencedClasses: [],
  8273. //>>excludeEnd("ide");
  8274. messageSends: ["and:", "atStart", "atEnd"]
  8275. }),
  8276. $globals.ProtoStream);
  8277. $core.addMethod(
  8278. $core.method({
  8279. selector: "next",
  8280. protocol: "reading",
  8281. fn: function (){
  8282. var self=this,$self=this;
  8283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8284. return $core.withContext(function($ctx1) {
  8285. //>>excludeEnd("ctx");
  8286. var $1;
  8287. $1=$self._atEnd();
  8288. if($core.assert($1)){
  8289. return nil;
  8290. } else {
  8291. return $self._subclassResponsibility();
  8292. }
  8293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8294. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8295. //>>excludeEnd("ctx");
  8296. },
  8297. //>>excludeStart("ide", pragmas.excludeIdeData);
  8298. args: [],
  8299. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8300. referencedClasses: [],
  8301. //>>excludeEnd("ide");
  8302. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8303. }),
  8304. $globals.ProtoStream);
  8305. $core.addMethod(
  8306. $core.method({
  8307. selector: "nextPut:",
  8308. protocol: "writing",
  8309. fn: function (anObject){
  8310. var self=this,$self=this;
  8311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8312. return $core.withContext(function($ctx1) {
  8313. //>>excludeEnd("ctx");
  8314. $self._subclassResponsibility();
  8315. return self;
  8316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8317. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8318. //>>excludeEnd("ctx");
  8319. },
  8320. //>>excludeStart("ide", pragmas.excludeIdeData);
  8321. args: ["anObject"],
  8322. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8323. referencedClasses: [],
  8324. //>>excludeEnd("ide");
  8325. messageSends: ["subclassResponsibility"]
  8326. }),
  8327. $globals.ProtoStream);
  8328. $core.addMethod(
  8329. $core.method({
  8330. selector: "nextPutAll:",
  8331. protocol: "writing",
  8332. fn: function (aCollection){
  8333. var self=this,$self=this;
  8334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8335. return $core.withContext(function($ctx1) {
  8336. //>>excludeEnd("ctx");
  8337. $recv(aCollection)._do_((function(each){
  8338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8339. return $core.withContext(function($ctx2) {
  8340. //>>excludeEnd("ctx");
  8341. return $self._nextPut_(each);
  8342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8344. //>>excludeEnd("ctx");
  8345. }));
  8346. return self;
  8347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8348. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8349. //>>excludeEnd("ctx");
  8350. },
  8351. //>>excludeStart("ide", pragmas.excludeIdeData);
  8352. args: ["aCollection"],
  8353. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8354. referencedClasses: [],
  8355. //>>excludeEnd("ide");
  8356. messageSends: ["do:", "nextPut:"]
  8357. }),
  8358. $globals.ProtoStream);
  8359. $core.addMethod(
  8360. $core.method({
  8361. selector: "nextPutString:",
  8362. protocol: "writing",
  8363. fn: function (aString){
  8364. var self=this,$self=this;
  8365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8366. return $core.withContext(function($ctx1) {
  8367. //>>excludeEnd("ctx");
  8368. $self._nextPut_(aString);
  8369. return self;
  8370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8371. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8372. //>>excludeEnd("ctx");
  8373. },
  8374. //>>excludeStart("ide", pragmas.excludeIdeData);
  8375. args: ["aString"],
  8376. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8377. referencedClasses: [],
  8378. //>>excludeEnd("ide");
  8379. messageSends: ["nextPut:"]
  8380. }),
  8381. $globals.ProtoStream);
  8382. $core.addMethod(
  8383. $core.method({
  8384. selector: "peek",
  8385. protocol: "reading",
  8386. fn: function (){
  8387. var self=this,$self=this;
  8388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8389. return $core.withContext(function($ctx1) {
  8390. //>>excludeEnd("ctx");
  8391. var $1;
  8392. $1=$self._atEnd();
  8393. if($core.assert($1)){
  8394. return nil;
  8395. } else {
  8396. return $self._subclassResponsibility();
  8397. }
  8398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8399. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8400. //>>excludeEnd("ctx");
  8401. },
  8402. //>>excludeStart("ide", pragmas.excludeIdeData);
  8403. args: [],
  8404. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8405. referencedClasses: [],
  8406. //>>excludeEnd("ide");
  8407. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8408. }),
  8409. $globals.ProtoStream);
  8410. $core.addMethod(
  8411. $core.method({
  8412. selector: "reset",
  8413. protocol: "actions",
  8414. fn: function (){
  8415. var self=this,$self=this;
  8416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8417. return $core.withContext(function($ctx1) {
  8418. //>>excludeEnd("ctx");
  8419. $self._subclassResponsibility();
  8420. return self;
  8421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8422. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8423. //>>excludeEnd("ctx");
  8424. },
  8425. //>>excludeStart("ide", pragmas.excludeIdeData);
  8426. args: [],
  8427. source: "reset\x0a\x09self subclassResponsibility",
  8428. referencedClasses: [],
  8429. //>>excludeEnd("ide");
  8430. messageSends: ["subclassResponsibility"]
  8431. }),
  8432. $globals.ProtoStream);
  8433. $core.addMethod(
  8434. $core.method({
  8435. selector: "resetContents",
  8436. protocol: "actions",
  8437. fn: function (){
  8438. var self=this,$self=this;
  8439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8440. return $core.withContext(function($ctx1) {
  8441. //>>excludeEnd("ctx");
  8442. $self._subclassResponsibility();
  8443. return self;
  8444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8445. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8446. //>>excludeEnd("ctx");
  8447. },
  8448. //>>excludeStart("ide", pragmas.excludeIdeData);
  8449. args: [],
  8450. source: "resetContents\x0a\x09self subclassResponsibility",
  8451. referencedClasses: [],
  8452. //>>excludeEnd("ide");
  8453. messageSends: ["subclassResponsibility"]
  8454. }),
  8455. $globals.ProtoStream);
  8456. $core.addMethod(
  8457. $core.method({
  8458. selector: "setToEnd",
  8459. protocol: "positioning",
  8460. fn: function (){
  8461. var self=this,$self=this;
  8462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8463. return $core.withContext(function($ctx1) {
  8464. //>>excludeEnd("ctx");
  8465. $self._subclassResponsibility();
  8466. return self;
  8467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8468. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8469. //>>excludeEnd("ctx");
  8470. },
  8471. //>>excludeStart("ide", pragmas.excludeIdeData);
  8472. args: [],
  8473. source: "setToEnd\x0a\x09self subclassResponsibility",
  8474. referencedClasses: [],
  8475. //>>excludeEnd("ide");
  8476. messageSends: ["subclassResponsibility"]
  8477. }),
  8478. $globals.ProtoStream);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "setToStart",
  8482. protocol: "positioning",
  8483. fn: function (){
  8484. var self=this,$self=this;
  8485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8486. return $core.withContext(function($ctx1) {
  8487. //>>excludeEnd("ctx");
  8488. $self._reset();
  8489. return self;
  8490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8491. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8492. //>>excludeEnd("ctx");
  8493. },
  8494. //>>excludeStart("ide", pragmas.excludeIdeData);
  8495. args: [],
  8496. source: "setToStart\x0a\x09self reset",
  8497. referencedClasses: [],
  8498. //>>excludeEnd("ide");
  8499. messageSends: ["reset"]
  8500. }),
  8501. $globals.ProtoStream);
  8502. $core.addMethod(
  8503. $core.method({
  8504. selector: "write:",
  8505. protocol: "writing",
  8506. fn: function (anObject){
  8507. var self=this,$self=this;
  8508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8509. return $core.withContext(function($ctx1) {
  8510. //>>excludeEnd("ctx");
  8511. $recv(anObject)._putOn_(self);
  8512. return self;
  8513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8514. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8515. //>>excludeEnd("ctx");
  8516. },
  8517. //>>excludeStart("ide", pragmas.excludeIdeData);
  8518. args: ["anObject"],
  8519. source: "write: anObject\x0a\x09anObject putOn: self",
  8520. referencedClasses: [],
  8521. //>>excludeEnd("ide");
  8522. messageSends: ["putOn:"]
  8523. }),
  8524. $globals.ProtoStream);
  8525. $core.addMethod(
  8526. $core.method({
  8527. selector: "on:",
  8528. protocol: "instance creation",
  8529. fn: function (aCollection){
  8530. var self=this,$self=this;
  8531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8532. return $core.withContext(function($ctx1) {
  8533. //>>excludeEnd("ctx");
  8534. var $1;
  8535. $1=$self._new();
  8536. $recv($1)._setCollection_(aCollection);
  8537. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8538. return $recv($1)._yourself();
  8539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8540. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  8541. //>>excludeEnd("ctx");
  8542. },
  8543. //>>excludeStart("ide", pragmas.excludeIdeData);
  8544. args: ["aCollection"],
  8545. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8546. referencedClasses: [],
  8547. //>>excludeEnd("ide");
  8548. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8549. }),
  8550. $globals.ProtoStream.a$cls);
  8551. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8552. //>>excludeStart("ide", pragmas.excludeIdeData);
  8553. $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.";
  8554. //>>excludeEnd("ide");
  8555. $core.addMethod(
  8556. $core.method({
  8557. selector: "atEnd",
  8558. protocol: "testing",
  8559. fn: function (){
  8560. var self=this,$self=this;
  8561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8562. return $core.withContext(function($ctx1) {
  8563. //>>excludeEnd("ctx");
  8564. return $recv($self._position()).__eq($self._size());
  8565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8566. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8567. //>>excludeEnd("ctx");
  8568. },
  8569. //>>excludeStart("ide", pragmas.excludeIdeData);
  8570. args: [],
  8571. source: "atEnd\x0a\x09^ self position = self size",
  8572. referencedClasses: [],
  8573. //>>excludeEnd("ide");
  8574. messageSends: ["=", "position", "size"]
  8575. }),
  8576. $globals.Stream);
  8577. $core.addMethod(
  8578. $core.method({
  8579. selector: "atStart",
  8580. protocol: "testing",
  8581. fn: function (){
  8582. var self=this,$self=this;
  8583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8584. return $core.withContext(function($ctx1) {
  8585. //>>excludeEnd("ctx");
  8586. return $recv($self._position()).__eq((0));
  8587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8588. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8589. //>>excludeEnd("ctx");
  8590. },
  8591. //>>excludeStart("ide", pragmas.excludeIdeData);
  8592. args: [],
  8593. source: "atStart\x0a\x09^ self position = 0",
  8594. referencedClasses: [],
  8595. //>>excludeEnd("ide");
  8596. messageSends: ["=", "position"]
  8597. }),
  8598. $globals.Stream);
  8599. $core.addMethod(
  8600. $core.method({
  8601. selector: "close",
  8602. protocol: "actions",
  8603. fn: function (){
  8604. var self=this,$self=this;
  8605. return self;
  8606. },
  8607. //>>excludeStart("ide", pragmas.excludeIdeData);
  8608. args: [],
  8609. source: "close",
  8610. referencedClasses: [],
  8611. //>>excludeEnd("ide");
  8612. messageSends: []
  8613. }),
  8614. $globals.Stream);
  8615. $core.addMethod(
  8616. $core.method({
  8617. selector: "collection",
  8618. protocol: "accessing",
  8619. fn: function (){
  8620. var self=this,$self=this;
  8621. return $self["@collection"];
  8622. },
  8623. //>>excludeStart("ide", pragmas.excludeIdeData);
  8624. args: [],
  8625. source: "collection\x0a\x09^ collection",
  8626. referencedClasses: [],
  8627. //>>excludeEnd("ide");
  8628. messageSends: []
  8629. }),
  8630. $globals.Stream);
  8631. $core.addMethod(
  8632. $core.method({
  8633. selector: "contents",
  8634. protocol: "accessing",
  8635. fn: function (){
  8636. var self=this,$self=this;
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. return $core.withContext(function($ctx1) {
  8639. //>>excludeEnd("ctx");
  8640. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8642. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8643. //>>excludeEnd("ctx");
  8644. },
  8645. //>>excludeStart("ide", pragmas.excludeIdeData);
  8646. args: [],
  8647. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8648. referencedClasses: [],
  8649. //>>excludeEnd("ide");
  8650. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8651. }),
  8652. $globals.Stream);
  8653. $core.addMethod(
  8654. $core.method({
  8655. selector: "flush",
  8656. protocol: "actions",
  8657. fn: function (){
  8658. var self=this,$self=this;
  8659. return self;
  8660. },
  8661. //>>excludeStart("ide", pragmas.excludeIdeData);
  8662. args: [],
  8663. source: "flush",
  8664. referencedClasses: [],
  8665. //>>excludeEnd("ide");
  8666. messageSends: []
  8667. }),
  8668. $globals.Stream);
  8669. $core.addMethod(
  8670. $core.method({
  8671. selector: "isEmpty",
  8672. protocol: "testing",
  8673. fn: function (){
  8674. var self=this,$self=this;
  8675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8676. return $core.withContext(function($ctx1) {
  8677. //>>excludeEnd("ctx");
  8678. return $recv($self._size()).__eq((0));
  8679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8680. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8681. //>>excludeEnd("ctx");
  8682. },
  8683. //>>excludeStart("ide", pragmas.excludeIdeData);
  8684. args: [],
  8685. source: "isEmpty\x0a\x09^ self size = 0",
  8686. referencedClasses: [],
  8687. //>>excludeEnd("ide");
  8688. messageSends: ["=", "size"]
  8689. }),
  8690. $globals.Stream);
  8691. $core.addMethod(
  8692. $core.method({
  8693. selector: "next",
  8694. protocol: "reading",
  8695. fn: function (){
  8696. var self=this,$self=this;
  8697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8698. return $core.withContext(function($ctx1) {
  8699. //>>excludeEnd("ctx");
  8700. var $1,$3,$2;
  8701. $1=$self._atEnd();
  8702. if($core.assert($1)){
  8703. return nil;
  8704. } else {
  8705. $3=$self._position();
  8706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8707. $ctx1.sendIdx["position"]=1;
  8708. //>>excludeEnd("ctx");
  8709. $2=$recv($3).__plus((1));
  8710. $self._position_($2);
  8711. return $recv($self["@collection"])._at_($self._position());
  8712. }
  8713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8714. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8715. //>>excludeEnd("ctx");
  8716. },
  8717. //>>excludeStart("ide", pragmas.excludeIdeData);
  8718. args: [],
  8719. 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 ]",
  8720. referencedClasses: [],
  8721. //>>excludeEnd("ide");
  8722. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8723. }),
  8724. $globals.Stream);
  8725. $core.addMethod(
  8726. $core.method({
  8727. selector: "next:",
  8728. protocol: "reading",
  8729. fn: function (anInteger){
  8730. var self=this,$self=this;
  8731. var tempCollection;
  8732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8733. return $core.withContext(function($ctx1) {
  8734. //>>excludeEnd("ctx");
  8735. var $1;
  8736. tempCollection=$recv($recv($self._collection())._class())._new();
  8737. $recv(anInteger)._timesRepeat_((function(){
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. return $core.withContext(function($ctx2) {
  8740. //>>excludeEnd("ctx");
  8741. $1=$self._atEnd();
  8742. if(!$core.assert($1)){
  8743. return $recv(tempCollection)._add_($self._next());
  8744. }
  8745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8747. //>>excludeEnd("ctx");
  8748. }));
  8749. return tempCollection;
  8750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8751. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8752. //>>excludeEnd("ctx");
  8753. },
  8754. //>>excludeStart("ide", pragmas.excludeIdeData);
  8755. args: ["anInteger"],
  8756. 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",
  8757. referencedClasses: [],
  8758. //>>excludeEnd("ide");
  8759. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8760. }),
  8761. $globals.Stream);
  8762. $core.addMethod(
  8763. $core.method({
  8764. selector: "nextPut:",
  8765. protocol: "writing",
  8766. fn: function (anObject){
  8767. var self=this,$self=this;
  8768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8769. return $core.withContext(function($ctx1) {
  8770. //>>excludeEnd("ctx");
  8771. var $2,$1,$3,$4;
  8772. $2=$self._position();
  8773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8774. $ctx1.sendIdx["position"]=1;
  8775. //>>excludeEnd("ctx");
  8776. $1=$recv($2).__plus((1));
  8777. $self._position_($1);
  8778. $3=$self._collection();
  8779. $4=$self._position();
  8780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8781. $ctx1.sendIdx["position"]=2;
  8782. //>>excludeEnd("ctx");
  8783. $recv($3)._at_put_($4,anObject);
  8784. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8785. return self;
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8788. //>>excludeEnd("ctx");
  8789. },
  8790. //>>excludeStart("ide", pragmas.excludeIdeData);
  8791. args: ["anObject"],
  8792. 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)",
  8793. referencedClasses: [],
  8794. //>>excludeEnd("ide");
  8795. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8796. }),
  8797. $globals.Stream);
  8798. $core.addMethod(
  8799. $core.method({
  8800. selector: "peek",
  8801. protocol: "reading",
  8802. fn: function (){
  8803. var self=this,$self=this;
  8804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8805. return $core.withContext(function($ctx1) {
  8806. //>>excludeEnd("ctx");
  8807. var $1;
  8808. $1=$self._atEnd();
  8809. if(!$core.assert($1)){
  8810. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8811. }
  8812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8813. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8814. //>>excludeEnd("ctx");
  8815. },
  8816. //>>excludeStart("ide", pragmas.excludeIdeData);
  8817. args: [],
  8818. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8819. referencedClasses: [],
  8820. //>>excludeEnd("ide");
  8821. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8822. }),
  8823. $globals.Stream);
  8824. $core.addMethod(
  8825. $core.method({
  8826. selector: "position",
  8827. protocol: "accessing",
  8828. fn: function (){
  8829. var self=this,$self=this;
  8830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8831. return $core.withContext(function($ctx1) {
  8832. //>>excludeEnd("ctx");
  8833. var $1,$receiver;
  8834. $1=$self["@position"];
  8835. if(($receiver = $1) == null || $receiver.a$nil){
  8836. $self["@position"]=(0);
  8837. return $self["@position"];
  8838. } else {
  8839. return $1;
  8840. }
  8841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8842. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8843. //>>excludeEnd("ctx");
  8844. },
  8845. //>>excludeStart("ide", pragmas.excludeIdeData);
  8846. args: [],
  8847. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8848. referencedClasses: [],
  8849. //>>excludeEnd("ide");
  8850. messageSends: ["ifNil:"]
  8851. }),
  8852. $globals.Stream);
  8853. $core.addMethod(
  8854. $core.method({
  8855. selector: "position:",
  8856. protocol: "accessing",
  8857. fn: function (anInteger){
  8858. var self=this,$self=this;
  8859. $self["@position"]=anInteger;
  8860. return self;
  8861. },
  8862. //>>excludeStart("ide", pragmas.excludeIdeData);
  8863. args: ["anInteger"],
  8864. source: "position: anInteger\x0a\x09position := anInteger",
  8865. referencedClasses: [],
  8866. //>>excludeEnd("ide");
  8867. messageSends: []
  8868. }),
  8869. $globals.Stream);
  8870. $core.addMethod(
  8871. $core.method({
  8872. selector: "reset",
  8873. protocol: "actions",
  8874. fn: function (){
  8875. var self=this,$self=this;
  8876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8877. return $core.withContext(function($ctx1) {
  8878. //>>excludeEnd("ctx");
  8879. $self._position_((0));
  8880. return self;
  8881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8882. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8883. //>>excludeEnd("ctx");
  8884. },
  8885. //>>excludeStart("ide", pragmas.excludeIdeData);
  8886. args: [],
  8887. source: "reset\x0a\x09self position: 0",
  8888. referencedClasses: [],
  8889. //>>excludeEnd("ide");
  8890. messageSends: ["position:"]
  8891. }),
  8892. $globals.Stream);
  8893. $core.addMethod(
  8894. $core.method({
  8895. selector: "resetContents",
  8896. protocol: "actions",
  8897. fn: function (){
  8898. var self=this,$self=this;
  8899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8900. return $core.withContext(function($ctx1) {
  8901. //>>excludeEnd("ctx");
  8902. $self._reset();
  8903. $self._setStreamSize_((0));
  8904. return self;
  8905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8906. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8907. //>>excludeEnd("ctx");
  8908. },
  8909. //>>excludeStart("ide", pragmas.excludeIdeData);
  8910. args: [],
  8911. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8912. referencedClasses: [],
  8913. //>>excludeEnd("ide");
  8914. messageSends: ["reset", "setStreamSize:"]
  8915. }),
  8916. $globals.Stream);
  8917. $core.addMethod(
  8918. $core.method({
  8919. selector: "setCollection:",
  8920. protocol: "accessing",
  8921. fn: function (aCollection){
  8922. var self=this,$self=this;
  8923. $self["@collection"]=aCollection;
  8924. return self;
  8925. },
  8926. //>>excludeStart("ide", pragmas.excludeIdeData);
  8927. args: ["aCollection"],
  8928. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8929. referencedClasses: [],
  8930. //>>excludeEnd("ide");
  8931. messageSends: []
  8932. }),
  8933. $globals.Stream);
  8934. $core.addMethod(
  8935. $core.method({
  8936. selector: "setStreamSize:",
  8937. protocol: "accessing",
  8938. fn: function (anInteger){
  8939. var self=this,$self=this;
  8940. $self["@streamSize"]=anInteger;
  8941. return self;
  8942. },
  8943. //>>excludeStart("ide", pragmas.excludeIdeData);
  8944. args: ["anInteger"],
  8945. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8946. referencedClasses: [],
  8947. //>>excludeEnd("ide");
  8948. messageSends: []
  8949. }),
  8950. $globals.Stream);
  8951. $core.addMethod(
  8952. $core.method({
  8953. selector: "setToEnd",
  8954. protocol: "positioning",
  8955. fn: function (){
  8956. var self=this,$self=this;
  8957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8958. return $core.withContext(function($ctx1) {
  8959. //>>excludeEnd("ctx");
  8960. $self._position_($self._size());
  8961. return self;
  8962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8963. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8964. //>>excludeEnd("ctx");
  8965. },
  8966. //>>excludeStart("ide", pragmas.excludeIdeData);
  8967. args: [],
  8968. source: "setToEnd\x0a\x09self position: self size",
  8969. referencedClasses: [],
  8970. //>>excludeEnd("ide");
  8971. messageSends: ["position:", "size"]
  8972. }),
  8973. $globals.Stream);
  8974. $core.addMethod(
  8975. $core.method({
  8976. selector: "size",
  8977. protocol: "accessing",
  8978. fn: function (){
  8979. var self=this,$self=this;
  8980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8981. return $core.withContext(function($ctx1) {
  8982. //>>excludeEnd("ctx");
  8983. return $self._streamSize();
  8984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8985. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8986. //>>excludeEnd("ctx");
  8987. },
  8988. //>>excludeStart("ide", pragmas.excludeIdeData);
  8989. args: [],
  8990. source: "size\x0a\x09^ self streamSize",
  8991. referencedClasses: [],
  8992. //>>excludeEnd("ide");
  8993. messageSends: ["streamSize"]
  8994. }),
  8995. $globals.Stream);
  8996. $core.addMethod(
  8997. $core.method({
  8998. selector: "skip:",
  8999. protocol: "positioning",
  9000. fn: function (anInteger){
  9001. var self=this,$self=this;
  9002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9003. return $core.withContext(function($ctx1) {
  9004. //>>excludeEnd("ctx");
  9005. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  9006. return self;
  9007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9008. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  9009. //>>excludeEnd("ctx");
  9010. },
  9011. //>>excludeStart("ide", pragmas.excludeIdeData);
  9012. args: ["anInteger"],
  9013. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9014. referencedClasses: [],
  9015. //>>excludeEnd("ide");
  9016. messageSends: ["position:", "min:max:", "+", "position", "size"]
  9017. }),
  9018. $globals.Stream);
  9019. $core.addMethod(
  9020. $core.method({
  9021. selector: "streamSize",
  9022. protocol: "accessing",
  9023. fn: function (){
  9024. var self=this,$self=this;
  9025. return $self["@streamSize"];
  9026. },
  9027. //>>excludeStart("ide", pragmas.excludeIdeData);
  9028. args: [],
  9029. source: "streamSize\x0a\x09^ streamSize",
  9030. referencedClasses: [],
  9031. //>>excludeEnd("ide");
  9032. messageSends: []
  9033. }),
  9034. $globals.Stream);
  9035. $core.addMethod(
  9036. $core.method({
  9037. selector: "on:",
  9038. protocol: "instance creation",
  9039. fn: function (aCollection){
  9040. var self=this,$self=this;
  9041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9042. return $core.withContext(function($ctx1) {
  9043. //>>excludeEnd("ctx");
  9044. var $1;
  9045. $1=$self._new();
  9046. $recv($1)._setCollection_(aCollection);
  9047. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9048. return $recv($1)._yourself();
  9049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9050. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  9051. //>>excludeEnd("ctx");
  9052. },
  9053. //>>excludeStart("ide", pragmas.excludeIdeData);
  9054. args: ["aCollection"],
  9055. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9056. referencedClasses: [],
  9057. //>>excludeEnd("ide");
  9058. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9059. }),
  9060. $globals.Stream.a$cls);
  9061. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  9062. //>>excludeStart("ide", pragmas.excludeIdeData);
  9063. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9064. //>>excludeEnd("ide");
  9065. $core.addMethod(
  9066. $core.method({
  9067. selector: "cr",
  9068. protocol: "writing",
  9069. fn: function (){
  9070. var self=this,$self=this;
  9071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9072. return $core.withContext(function($ctx1) {
  9073. //>>excludeEnd("ctx");
  9074. return $self._nextPutAll_($recv($globals.String)._cr());
  9075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9076. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9077. //>>excludeEnd("ctx");
  9078. },
  9079. //>>excludeStart("ide", pragmas.excludeIdeData);
  9080. args: [],
  9081. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9082. referencedClasses: ["String"],
  9083. //>>excludeEnd("ide");
  9084. messageSends: ["nextPutAll:", "cr"]
  9085. }),
  9086. $globals.StringStream);
  9087. $core.addMethod(
  9088. $core.method({
  9089. selector: "crlf",
  9090. protocol: "writing",
  9091. fn: function (){
  9092. var self=this,$self=this;
  9093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9094. return $core.withContext(function($ctx1) {
  9095. //>>excludeEnd("ctx");
  9096. return $self._nextPutAll_($recv($globals.String)._crlf());
  9097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9098. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9099. //>>excludeEnd("ctx");
  9100. },
  9101. //>>excludeStart("ide", pragmas.excludeIdeData);
  9102. args: [],
  9103. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9104. referencedClasses: ["String"],
  9105. //>>excludeEnd("ide");
  9106. messageSends: ["nextPutAll:", "crlf"]
  9107. }),
  9108. $globals.StringStream);
  9109. $core.addMethod(
  9110. $core.method({
  9111. selector: "lf",
  9112. protocol: "writing",
  9113. fn: function (){
  9114. var self=this,$self=this;
  9115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9116. return $core.withContext(function($ctx1) {
  9117. //>>excludeEnd("ctx");
  9118. return $self._nextPutAll_($recv($globals.String)._lf());
  9119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9120. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9121. //>>excludeEnd("ctx");
  9122. },
  9123. //>>excludeStart("ide", pragmas.excludeIdeData);
  9124. args: [],
  9125. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9126. referencedClasses: ["String"],
  9127. //>>excludeEnd("ide");
  9128. messageSends: ["nextPutAll:", "lf"]
  9129. }),
  9130. $globals.StringStream);
  9131. $core.addMethod(
  9132. $core.method({
  9133. selector: "next:",
  9134. protocol: "reading",
  9135. fn: function (anInteger){
  9136. var self=this,$self=this;
  9137. var tempCollection;
  9138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9139. return $core.withContext(function($ctx1) {
  9140. //>>excludeEnd("ctx");
  9141. var $1;
  9142. tempCollection=$recv($recv($self._collection())._class())._new();
  9143. $recv(anInteger)._timesRepeat_((function(){
  9144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9145. return $core.withContext(function($ctx2) {
  9146. //>>excludeEnd("ctx");
  9147. $1=$self._atEnd();
  9148. if(!$core.assert($1)){
  9149. tempCollection=$recv(tempCollection).__comma($self._next());
  9150. return tempCollection;
  9151. }
  9152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9153. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9154. //>>excludeEnd("ctx");
  9155. }));
  9156. return tempCollection;
  9157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9158. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9159. //>>excludeEnd("ctx");
  9160. },
  9161. //>>excludeStart("ide", pragmas.excludeIdeData);
  9162. args: ["anInteger"],
  9163. 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",
  9164. referencedClasses: [],
  9165. //>>excludeEnd("ide");
  9166. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9167. }),
  9168. $globals.StringStream);
  9169. $core.addMethod(
  9170. $core.method({
  9171. selector: "nextPut:",
  9172. protocol: "writing",
  9173. fn: function (aString){
  9174. var self=this,$self=this;
  9175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9176. return $core.withContext(function($ctx1) {
  9177. //>>excludeEnd("ctx");
  9178. $self._nextPutAll_(aString);
  9179. return self;
  9180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9181. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9182. //>>excludeEnd("ctx");
  9183. },
  9184. //>>excludeStart("ide", pragmas.excludeIdeData);
  9185. args: ["aString"],
  9186. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9187. referencedClasses: [],
  9188. //>>excludeEnd("ide");
  9189. messageSends: ["nextPutAll:"]
  9190. }),
  9191. $globals.StringStream);
  9192. $core.addMethod(
  9193. $core.method({
  9194. selector: "nextPutAll:",
  9195. protocol: "writing",
  9196. fn: function (aString){
  9197. var self=this,$self=this;
  9198. var pre,post;
  9199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9200. return $core.withContext(function($ctx1) {
  9201. //>>excludeEnd("ctx");
  9202. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9203. $1=$self._atEnd();
  9204. if($core.assert($1)){
  9205. $3=$self._collection();
  9206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9207. $ctx1.sendIdx["collection"]=1;
  9208. //>>excludeEnd("ctx");
  9209. $2=$recv($3).__comma(aString);
  9210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9211. $ctx1.sendIdx[","]=1;
  9212. //>>excludeEnd("ctx");
  9213. $self._setCollection_($2);
  9214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9215. $ctx1.sendIdx["setCollection:"]=1;
  9216. //>>excludeEnd("ctx");
  9217. } else {
  9218. $4=$self._collection();
  9219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9220. $ctx1.sendIdx["collection"]=2;
  9221. //>>excludeEnd("ctx");
  9222. $5=$self._position();
  9223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9224. $ctx1.sendIdx["position"]=1;
  9225. //>>excludeEnd("ctx");
  9226. pre=$recv($4)._copyFrom_to_((1),$5);
  9227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9228. $ctx1.sendIdx["copyFrom:to:"]=1;
  9229. //>>excludeEnd("ctx");
  9230. $6=$self._collection();
  9231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9232. $ctx1.sendIdx["collection"]=3;
  9233. //>>excludeEnd("ctx");
  9234. $9=$self._position();
  9235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9236. $ctx1.sendIdx["position"]=2;
  9237. //>>excludeEnd("ctx");
  9238. $8=$recv($9).__plus((1));
  9239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9240. $ctx1.sendIdx["+"]=2;
  9241. //>>excludeEnd("ctx");
  9242. $10=$recv(aString)._size();
  9243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9244. $ctx1.sendIdx["size"]=1;
  9245. //>>excludeEnd("ctx");
  9246. $7=$recv($8).__plus($10);
  9247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9248. $ctx1.sendIdx["+"]=1;
  9249. //>>excludeEnd("ctx");
  9250. $11=$recv($self._collection())._size();
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. $ctx1.sendIdx["size"]=2;
  9253. //>>excludeEnd("ctx");
  9254. post=$recv($6)._copyFrom_to_($7,$11);
  9255. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9257. $ctx1.sendIdx[","]=2;
  9258. //>>excludeEnd("ctx");
  9259. $self._setCollection_($12);
  9260. }
  9261. $14=$self._position();
  9262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9263. $ctx1.sendIdx["position"]=3;
  9264. //>>excludeEnd("ctx");
  9265. $13=$recv($14).__plus($recv(aString)._size());
  9266. $self._position_($13);
  9267. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9268. return self;
  9269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9270. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9271. //>>excludeEnd("ctx");
  9272. },
  9273. //>>excludeStart("ide", pragmas.excludeIdeData);
  9274. args: ["aString"],
  9275. 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)",
  9276. referencedClasses: [],
  9277. //>>excludeEnd("ide");
  9278. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9279. }),
  9280. $globals.StringStream);
  9281. $core.addMethod(
  9282. $core.method({
  9283. selector: "nextPutString:",
  9284. protocol: "writing",
  9285. fn: function (aString){
  9286. var self=this,$self=this;
  9287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9288. return $core.withContext(function($ctx1) {
  9289. //>>excludeEnd("ctx");
  9290. $self._nextPutAll_(aString);
  9291. return self;
  9292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9293. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9294. //>>excludeEnd("ctx");
  9295. },
  9296. //>>excludeStart("ide", pragmas.excludeIdeData);
  9297. args: ["aString"],
  9298. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9299. referencedClasses: [],
  9300. //>>excludeEnd("ide");
  9301. messageSends: ["nextPutAll:"]
  9302. }),
  9303. $globals.StringStream);
  9304. $core.addMethod(
  9305. $core.method({
  9306. selector: "print:",
  9307. protocol: "writing",
  9308. fn: function (anObject){
  9309. var self=this,$self=this;
  9310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9311. return $core.withContext(function($ctx1) {
  9312. //>>excludeEnd("ctx");
  9313. $recv(anObject)._printOn_(self);
  9314. return self;
  9315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9316. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  9317. //>>excludeEnd("ctx");
  9318. },
  9319. //>>excludeStart("ide", pragmas.excludeIdeData);
  9320. args: ["anObject"],
  9321. source: "print: anObject\x0a\x09anObject printOn: self",
  9322. referencedClasses: [],
  9323. //>>excludeEnd("ide");
  9324. messageSends: ["printOn:"]
  9325. }),
  9326. $globals.StringStream);
  9327. $core.addMethod(
  9328. $core.method({
  9329. selector: "printSymbol:",
  9330. protocol: "writing",
  9331. fn: function (anObject){
  9332. var self=this,$self=this;
  9333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9334. return $core.withContext(function($ctx1) {
  9335. //>>excludeEnd("ctx");
  9336. $recv(anObject)._asSymbolPrintOn_(self);
  9337. return self;
  9338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9339. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  9340. //>>excludeEnd("ctx");
  9341. },
  9342. //>>excludeStart("ide", pragmas.excludeIdeData);
  9343. args: ["anObject"],
  9344. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9345. referencedClasses: [],
  9346. //>>excludeEnd("ide");
  9347. messageSends: ["asSymbolPrintOn:"]
  9348. }),
  9349. $globals.StringStream);
  9350. $core.addMethod(
  9351. $core.method({
  9352. selector: "space",
  9353. protocol: "writing",
  9354. fn: function (){
  9355. var self=this,$self=this;
  9356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9357. return $core.withContext(function($ctx1) {
  9358. //>>excludeEnd("ctx");
  9359. $self._nextPut_(" ");
  9360. return self;
  9361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9362. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9363. //>>excludeEnd("ctx");
  9364. },
  9365. //>>excludeStart("ide", pragmas.excludeIdeData);
  9366. args: [],
  9367. source: "space\x0a\x09self nextPut: ' '",
  9368. referencedClasses: [],
  9369. //>>excludeEnd("ide");
  9370. messageSends: ["nextPut:"]
  9371. }),
  9372. $globals.StringStream);
  9373. $core.addMethod(
  9374. $core.method({
  9375. selector: "tab",
  9376. protocol: "writing",
  9377. fn: function (){
  9378. var self=this,$self=this;
  9379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9380. return $core.withContext(function($ctx1) {
  9381. //>>excludeEnd("ctx");
  9382. return $self._nextPutAll_($recv($globals.String)._tab());
  9383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9384. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9385. //>>excludeEnd("ctx");
  9386. },
  9387. //>>excludeStart("ide", pragmas.excludeIdeData);
  9388. args: [],
  9389. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9390. referencedClasses: ["String"],
  9391. //>>excludeEnd("ide");
  9392. messageSends: ["nextPutAll:", "tab"]
  9393. }),
  9394. $globals.StringStream);
  9395. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9396. //>>excludeStart("ide", pragmas.excludeIdeData);
  9397. $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.";
  9398. //>>excludeEnd("ide");
  9399. $core.addMethod(
  9400. $core.method({
  9401. selector: "initialize",
  9402. protocol: "initialization",
  9403. fn: function (){
  9404. var self=this,$self=this;
  9405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9406. return $core.withContext(function($ctx1) {
  9407. //>>excludeEnd("ctx");
  9408. (
  9409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9410. $ctx1.supercall = true,
  9411. //>>excludeEnd("ctx");
  9412. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9414. $ctx1.supercall = false;
  9415. //>>excludeEnd("ctx");;
  9416. $self["@read"]=$recv($globals.OrderedCollection)._new();
  9417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9418. $ctx1.sendIdx["new"]=1;
  9419. //>>excludeEnd("ctx");
  9420. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9421. $self["@readIndex"]=(1);
  9422. return self;
  9423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9424. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9425. //>>excludeEnd("ctx");
  9426. },
  9427. //>>excludeStart("ide", pragmas.excludeIdeData);
  9428. args: [],
  9429. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9430. referencedClasses: ["OrderedCollection"],
  9431. //>>excludeEnd("ide");
  9432. messageSends: ["initialize", "new"]
  9433. }),
  9434. $globals.Queue);
  9435. $core.addMethod(
  9436. $core.method({
  9437. selector: "next",
  9438. protocol: "accessing",
  9439. fn: function (){
  9440. var self=this,$self=this;
  9441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9442. return $core.withContext(function($ctx1) {
  9443. //>>excludeEnd("ctx");
  9444. return $self._nextIfAbsent_((function(){
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. return $core.withContext(function($ctx2) {
  9447. //>>excludeEnd("ctx");
  9448. return $self._error_("Cannot read from empty Queue.");
  9449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9450. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9451. //>>excludeEnd("ctx");
  9452. }));
  9453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9454. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9455. //>>excludeEnd("ctx");
  9456. },
  9457. //>>excludeStart("ide", pragmas.excludeIdeData);
  9458. args: [],
  9459. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9460. referencedClasses: [],
  9461. //>>excludeEnd("ide");
  9462. messageSends: ["nextIfAbsent:", "error:"]
  9463. }),
  9464. $globals.Queue);
  9465. $core.addMethod(
  9466. $core.method({
  9467. selector: "nextIfAbsent:",
  9468. protocol: "accessing",
  9469. fn: function (aBlock){
  9470. var self=this,$self=this;
  9471. var result;
  9472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9473. return $core.withContext(function($ctx1) {
  9474. //>>excludeEnd("ctx");
  9475. var $1;
  9476. var $early={};
  9477. try {
  9478. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  9479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9480. return $core.withContext(function($ctx2) {
  9481. //>>excludeEnd("ctx");
  9482. $recv($self["@write"])._ifEmpty_((function(){
  9483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9484. return $core.withContext(function($ctx3) {
  9485. //>>excludeEnd("ctx");
  9486. $1=$recv($self["@readIndex"]).__gt((1));
  9487. if($core.assert($1)){
  9488. $self["@read"]=[];
  9489. $self["@readIndex"]=(1);
  9490. $self["@readIndex"];
  9491. }
  9492. throw $early=[$recv(aBlock)._value()];
  9493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9494. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9495. //>>excludeEnd("ctx");
  9496. }));
  9497. $self["@read"]=$self["@write"];
  9498. $self["@readIndex"]=(1);
  9499. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9500. return $recv($self["@read"])._first();
  9501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9502. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9503. //>>excludeEnd("ctx");
  9504. }));
  9505. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  9506. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  9507. return result;
  9508. }
  9509. catch(e) {if(e===$early)return e[0]; throw e}
  9510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9511. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9512. //>>excludeEnd("ctx");
  9513. },
  9514. //>>excludeStart("ide", pragmas.excludeIdeData);
  9515. args: ["aBlock"],
  9516. 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",
  9517. referencedClasses: ["OrderedCollection"],
  9518. //>>excludeEnd("ide");
  9519. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9520. }),
  9521. $globals.Queue);
  9522. $core.addMethod(
  9523. $core.method({
  9524. selector: "nextPut:",
  9525. protocol: "accessing",
  9526. fn: function (anObject){
  9527. var self=this,$self=this;
  9528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9529. return $core.withContext(function($ctx1) {
  9530. //>>excludeEnd("ctx");
  9531. $recv($self["@write"])._add_(anObject);
  9532. return self;
  9533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9534. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9535. //>>excludeEnd("ctx");
  9536. },
  9537. //>>excludeStart("ide", pragmas.excludeIdeData);
  9538. args: ["anObject"],
  9539. source: "nextPut: anObject\x0a\x09write add: anObject",
  9540. referencedClasses: [],
  9541. //>>excludeEnd("ide");
  9542. messageSends: ["add:"]
  9543. }),
  9544. $globals.Queue);
  9545. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9546. //>>excludeStart("ide", pragmas.excludeIdeData);
  9547. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9548. //>>excludeEnd("ide");
  9549. $core.addMethod(
  9550. $core.method({
  9551. selector: "compile:",
  9552. protocol: "evaluating",
  9553. fn: function (aString){
  9554. var self=this,$self=this;
  9555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9556. return $core.withContext(function($ctx1) {
  9557. //>>excludeEnd("ctx");
  9558. return self.compile(aString);
  9559. return self;
  9560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9561. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9562. //>>excludeEnd("ctx");
  9563. },
  9564. //>>excludeStart("ide", pragmas.excludeIdeData);
  9565. args: ["aString"],
  9566. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9567. referencedClasses: [],
  9568. //>>excludeEnd("ide");
  9569. messageSends: []
  9570. }),
  9571. $globals.RegularExpression);
  9572. $core.addMethod(
  9573. $core.method({
  9574. selector: "exec:",
  9575. protocol: "evaluating",
  9576. fn: function (aString){
  9577. var self=this,$self=this;
  9578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9579. return $core.withContext(function($ctx1) {
  9580. //>>excludeEnd("ctx");
  9581. return self.exec(aString) || nil;
  9582. return self;
  9583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9584. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9585. //>>excludeEnd("ctx");
  9586. },
  9587. //>>excludeStart("ide", pragmas.excludeIdeData);
  9588. args: ["aString"],
  9589. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9590. referencedClasses: [],
  9591. //>>excludeEnd("ide");
  9592. messageSends: []
  9593. }),
  9594. $globals.RegularExpression);
  9595. $core.addMethod(
  9596. $core.method({
  9597. selector: "test:",
  9598. protocol: "evaluating",
  9599. fn: function (aString){
  9600. var self=this,$self=this;
  9601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9602. return $core.withContext(function($ctx1) {
  9603. //>>excludeEnd("ctx");
  9604. return self.test(aString);
  9605. return self;
  9606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9607. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9608. //>>excludeEnd("ctx");
  9609. },
  9610. //>>excludeStart("ide", pragmas.excludeIdeData);
  9611. args: ["aString"],
  9612. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9613. referencedClasses: [],
  9614. //>>excludeEnd("ide");
  9615. messageSends: []
  9616. }),
  9617. $globals.RegularExpression);
  9618. $core.addMethod(
  9619. $core.method({
  9620. selector: "fromString:",
  9621. protocol: "instance creation",
  9622. fn: function (aString){
  9623. var self=this,$self=this;
  9624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9625. return $core.withContext(function($ctx1) {
  9626. //>>excludeEnd("ctx");
  9627. return $self._fromString_flag_(aString,"");
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9630. //>>excludeEnd("ctx");
  9631. },
  9632. //>>excludeStart("ide", pragmas.excludeIdeData);
  9633. args: ["aString"],
  9634. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9635. referencedClasses: [],
  9636. //>>excludeEnd("ide");
  9637. messageSends: ["fromString:flag:"]
  9638. }),
  9639. $globals.RegularExpression.a$cls);
  9640. $core.addMethod(
  9641. $core.method({
  9642. selector: "fromString:flag:",
  9643. protocol: "instance creation",
  9644. fn: function (aString,anotherString){
  9645. var self=this,$self=this;
  9646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9647. return $core.withContext(function($ctx1) {
  9648. //>>excludeEnd("ctx");
  9649. return new RegExp(aString, anotherString);
  9650. return self;
  9651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9652. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9653. //>>excludeEnd("ctx");
  9654. },
  9655. //>>excludeStart("ide", pragmas.excludeIdeData);
  9656. args: ["aString", "anotherString"],
  9657. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9658. referencedClasses: [],
  9659. //>>excludeEnd("ide");
  9660. messageSends: []
  9661. }),
  9662. $globals.RegularExpression.a$cls);
  9663. });