Kernel-Collections.js 351 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anAssociation"],
  16. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["and:", "=", "class", "key", "value"]
  21. }, function ($methodClass){ return function (anAssociation){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. return [$recv([$recv([$self._class()
  27. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28. ,$ctx1.sendIdx["class"]=1
  29. //>>excludeEnd("ctx");
  30. ][0]).__eq($recv(anAssociation)._class())
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. ,$ctx1.sendIdx["="]=1
  33. //>>excludeEnd("ctx");
  34. ][0])._and_((function(){
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. return $core.withContext(function($ctx2) {
  37. //>>excludeEnd("ctx");
  38. return $recv([$recv([$self._key()
  39. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40. ,$ctx2.sendIdx["key"]=1
  41. //>>excludeEnd("ctx");
  42. ][0]).__eq($recv(anAssociation)._key())
  43. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44. ,$ctx2.sendIdx["="]=2
  45. //>>excludeEnd("ctx");
  46. ][0])._and_((function(){
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. return $core.withContext(function($ctx3) {
  49. //>>excludeEnd("ctx");
  50. return $recv([$self._value()
  51. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  52. ,$ctx3.sendIdx["value"]=1
  53. //>>excludeEnd("ctx");
  54. ][0]).__eq($recv(anAssociation)._value());
  55. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57. //>>excludeEnd("ctx");
  58. }));
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61. //>>excludeEnd("ctx");
  62. }))
  63. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64. ,$ctx1.sendIdx["and:"]=1
  65. //>>excludeEnd("ctx");
  66. ][0];
  67. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  69. //>>excludeEnd("ctx");
  70. }; }),
  71. $globals.Association);
  72. $core.addMethod(
  73. $core.method({
  74. selector: "key",
  75. protocol: "accessing",
  76. //>>excludeStart("ide", pragmas.excludeIdeData);
  77. args: [],
  78. source: "key\x0a\x09^ key",
  79. referencedClasses: [],
  80. //>>excludeEnd("ide");
  81. pragmas: [],
  82. messageSends: []
  83. }, function ($methodClass){ return function (){
  84. var self=this,$self=this;
  85. return $self.key;
  86. }; }),
  87. $globals.Association);
  88. $core.addMethod(
  89. $core.method({
  90. selector: "key:",
  91. protocol: "accessing",
  92. //>>excludeStart("ide", pragmas.excludeIdeData);
  93. args: ["aKey"],
  94. source: "key: aKey\x0a\x09key := aKey",
  95. referencedClasses: [],
  96. //>>excludeEnd("ide");
  97. pragmas: [],
  98. messageSends: []
  99. }, function ($methodClass){ return function (aKey){
  100. var self=this,$self=this;
  101. $self.key=aKey;
  102. return self;
  103. }; }),
  104. $globals.Association);
  105. $core.addMethod(
  106. $core.method({
  107. selector: "printOn:",
  108. protocol: "printing",
  109. //>>excludeStart("ide", pragmas.excludeIdeData);
  110. args: ["aStream"],
  111. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  112. referencedClasses: [],
  113. //>>excludeEnd("ide");
  114. pragmas: [],
  115. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  116. }, function ($methodClass){ return function (aStream){
  117. var self=this,$self=this;
  118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  119. return $core.withContext(function($ctx1) {
  120. //>>excludeEnd("ctx");
  121. [$recv($self._key())._printOn_(aStream)
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. ,$ctx1.sendIdx["printOn:"]=1
  124. //>>excludeEnd("ctx");
  125. ][0];
  126. $recv(aStream)._nextPutAll_(" -> ");
  127. $recv($self._value())._printOn_(aStream);
  128. return self;
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  131. //>>excludeEnd("ctx");
  132. }; }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: "accessing",
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: [],
  140. source: "value\x0a\x09^ value",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. pragmas: [],
  144. messageSends: []
  145. }, function ($methodClass){ return function (){
  146. var self=this,$self=this;
  147. return $self.value;
  148. }; }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: "accessing",
  154. //>>excludeStart("ide", pragmas.excludeIdeData);
  155. args: ["aValue"],
  156. source: "value: aValue\x0a\x09value := aValue",
  157. referencedClasses: [],
  158. //>>excludeEnd("ide");
  159. pragmas: [],
  160. messageSends: []
  161. }, function ($methodClass){ return function (aValue){
  162. var self=this,$self=this;
  163. $self.value=aValue;
  164. return self;
  165. }; }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: "instance creation",
  171. //>>excludeStart("ide", pragmas.excludeIdeData);
  172. args: ["aKey", "aValue"],
  173. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  174. referencedClasses: [],
  175. //>>excludeEnd("ide");
  176. pragmas: [],
  177. messageSends: ["key:", "new", "value:", "yourself"]
  178. }, function ($methodClass){ return function (aKey,aValue){
  179. var self=this,$self=this;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. return $core.withContext(function($ctx1) {
  182. //>>excludeEnd("ctx");
  183. var $1;
  184. $1=$self._new();
  185. $recv($1)._key_(aKey);
  186. $recv($1)._value_(aValue);
  187. return $recv($1)._yourself();
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  190. //>>excludeEnd("ctx");
  191. }; }),
  192. $globals.Association.a$cls);
  193. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: "accessing",
  201. //>>excludeStart("ide", pragmas.excludeIdeData);
  202. args: ["anObject"],
  203. 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'>",
  204. referencedClasses: [],
  205. //>>excludeEnd("ide");
  206. pragmas: [["inlineJS:", ["\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09"]]],
  207. messageSends: []
  208. }, function ($methodClass){ return function (anObject){
  209. var self=this,$self=this;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. return $core.withContext(function($ctx1) {
  212. //>>excludeEnd("ctx");
  213. var hash = $self.hashBlock(anObject);
  214. if (!hash) return null;
  215. var buckets = $self.buckets,
  216. bucket = buckets[hash];
  217. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  218. return bucket;
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  223. //>>excludeEnd("ctx");
  224. }; }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: "enumerating",
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["aBlock"],
  232. 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'>",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. pragmas: [["inlineJS:", ["\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09"]]],
  236. messageSends: []
  237. }, function ($methodClass){ return function (aBlock){
  238. var self=this,$self=this;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. return $core.withContext(function($ctx1) {
  241. //>>excludeEnd("ctx");
  242. var buckets = $self.buckets;
  243. var keys = Object.keys(buckets);
  244. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  245. ;
  246. return self;
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  249. //>>excludeEnd("ctx");
  250. }; }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: "accessing",
  256. //>>excludeStart("ide", pragmas.excludeIdeData);
  257. args: ["aBlock"],
  258. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  259. referencedClasses: [],
  260. //>>excludeEnd("ide");
  261. pragmas: [],
  262. messageSends: []
  263. }, function ($methodClass){ return function (aBlock){
  264. var self=this,$self=this;
  265. $self.hashBlock=aBlock;
  266. return self;
  267. }; }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: "initialization",
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. pragmas: [],
  279. messageSends: ["initialize", "removeAll"]
  280. }, function ($methodClass){ return function (){
  281. var self=this,$self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. [(
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. $ctx1.supercall = true,
  288. //>>excludeEnd("ctx");
  289. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. ,$ctx1.supercall = false
  292. //>>excludeEnd("ctx");
  293. ][0];
  294. $self._removeAll();
  295. return self;
  296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  297. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  298. //>>excludeEnd("ctx");
  299. }; }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. //>>excludeStart("ide", pragmas.excludeIdeData);
  306. args: [],
  307. source: "newBucket\x0a\x09self subclassResponsibility",
  308. referencedClasses: [],
  309. //>>excludeEnd("ide");
  310. pragmas: [],
  311. messageSends: ["subclassResponsibility"]
  312. }, function ($methodClass){ return function (){
  313. var self=this,$self=this;
  314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  315. return $core.withContext(function($ctx1) {
  316. //>>excludeEnd("ctx");
  317. $self._subclassResponsibility();
  318. return self;
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  321. //>>excludeEnd("ctx");
  322. }; }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. //>>excludeStart("ide", pragmas.excludeIdeData);
  329. args: [],
  330. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  331. referencedClasses: [],
  332. //>>excludeEnd("ide");
  333. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  334. messageSends: []
  335. }, function ($methodClass){ return function (){
  336. var self=this,$self=this;
  337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  338. return $core.withContext(function($ctx1) {
  339. //>>excludeEnd("ctx");
  340. $self.buckets = Object.create(null);;
  341. return self;
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  344. //>>excludeEnd("ctx");
  345. }; }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. //>>excludeStart("ide", pragmas.excludeIdeData);
  352. args: ["aBlock"],
  353. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  354. referencedClasses: [],
  355. //>>excludeEnd("ide");
  356. pragmas: [],
  357. messageSends: ["hashBlock:", "new", "yourself"]
  358. }, function ($methodClass){ return function (aBlock){
  359. var self=this,$self=this;
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. return $core.withContext(function($ctx1) {
  362. //>>excludeEnd("ctx");
  363. var $1;
  364. $1=$self._new();
  365. $recv($1)._hashBlock_(aBlock);
  366. return $recv($1)._yourself();
  367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  368. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  369. //>>excludeEnd("ctx");
  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. //>>excludeStart("ide", pragmas.excludeIdeData);
  381. args: [],
  382. source: "newBucket\x0a\x09^ #()",
  383. referencedClasses: [],
  384. //>>excludeEnd("ide");
  385. pragmas: [],
  386. messageSends: []
  387. }, function ($methodClass){ return function (){
  388. var self=this,$self=this;
  389. return [];
  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. //>>excludeStart("ide", pragmas.excludeIdeData);
  401. args: ["aCollection"],
  402. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  403. referencedClasses: [],
  404. //>>excludeEnd("ide");
  405. pragmas: [],
  406. messageSends: ["addAll:", "copy", "yourself"]
  407. }, function ($methodClass){ return function (aCollection){
  408. var self=this,$self=this;
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. return $core.withContext(function($ctx1) {
  411. //>>excludeEnd("ctx");
  412. var $1;
  413. $1=$self._copy();
  414. $recv($1)._addAll_(aCollection);
  415. return $recv($1)._yourself();
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  418. //>>excludeEnd("ctx");
  419. }; }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. //>>excludeStart("ide", pragmas.excludeIdeData);
  426. args: ["anObject"],
  427. source: "add: anObject\x0a\x09self subclassResponsibility",
  428. referencedClasses: [],
  429. //>>excludeEnd("ide");
  430. pragmas: [],
  431. messageSends: ["subclassResponsibility"]
  432. }, function ($methodClass){ return function (anObject){
  433. var self=this,$self=this;
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. return $core.withContext(function($ctx1) {
  436. //>>excludeEnd("ctx");
  437. $self._subclassResponsibility();
  438. return self;
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  441. //>>excludeEnd("ctx");
  442. }; }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. //>>excludeStart("ide", pragmas.excludeIdeData);
  449. args: ["aCollection"],
  450. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  451. referencedClasses: [],
  452. //>>excludeEnd("ide");
  453. pragmas: [],
  454. messageSends: ["do:", "add:"]
  455. }, function ($methodClass){ return function (aCollection){
  456. var self=this,$self=this;
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. return $core.withContext(function($ctx1) {
  459. //>>excludeEnd("ctx");
  460. $recv(aCollection)._do_((function(each){
  461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  462. return $core.withContext(function($ctx2) {
  463. //>>excludeEnd("ctx");
  464. return $self._add_(each);
  465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  467. //>>excludeEnd("ctx");
  468. }));
  469. return aCollection;
  470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  471. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  472. //>>excludeEnd("ctx");
  473. }; }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. //>>excludeStart("ide", pragmas.excludeIdeData);
  480. args: ["aBlock"],
  481. 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",
  482. referencedClasses: [],
  483. //>>excludeEnd("ide");
  484. pragmas: [],
  485. messageSends: ["do:", "ifFalse:", "value:"]
  486. }, function ($methodClass){ return function (aBlock){
  487. var self=this,$self=this;
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx1) {
  490. //>>excludeEnd("ctx");
  491. var $1;
  492. var $early={};
  493. try {
  494. $self._do_((function(each){
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. return $core.withContext(function($ctx2) {
  497. //>>excludeEnd("ctx");
  498. $1=$recv(aBlock)._value_(each);
  499. if(!$core.assert($1)){
  500. throw $early=[false];
  501. }
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  504. //>>excludeEnd("ctx");
  505. }));
  506. return true;
  507. }
  508. catch(e) {if(e===$early)return e[0]; throw e}
  509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  510. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  511. //>>excludeEnd("ctx");
  512. }; }),
  513. $globals.Collection);
  514. $core.addMethod(
  515. $core.method({
  516. selector: "anyOne",
  517. protocol: "accessing",
  518. //>>excludeStart("ide", pragmas.excludeIdeData);
  519. args: [],
  520. 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 ]",
  521. referencedClasses: [],
  522. //>>excludeEnd("ide");
  523. pragmas: [],
  524. messageSends: ["ifEmpty:", "error:", "do:"]
  525. }, function ($methodClass){ return function (){
  526. var self=this,$self=this;
  527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  528. return $core.withContext(function($ctx1) {
  529. //>>excludeEnd("ctx");
  530. var $early={};
  531. try {
  532. $self._ifEmpty_((function(){
  533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  534. return $core.withContext(function($ctx2) {
  535. //>>excludeEnd("ctx");
  536. return $self._error_("Collection is empty");
  537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  539. //>>excludeEnd("ctx");
  540. }));
  541. $self._do_((function(each){
  542. throw $early=[each];
  543. }));
  544. return self;
  545. }
  546. catch(e) {if(e===$early)return e[0]; throw e}
  547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  548. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  549. //>>excludeEnd("ctx");
  550. }; }),
  551. $globals.Collection);
  552. $core.addMethod(
  553. $core.method({
  554. selector: "anySatisfy:",
  555. protocol: "enumerating",
  556. //>>excludeStart("ide", pragmas.excludeIdeData);
  557. args: ["aBlock"],
  558. 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",
  559. referencedClasses: [],
  560. //>>excludeEnd("ide");
  561. pragmas: [],
  562. messageSends: ["do:", "ifTrue:", "value:"]
  563. }, function ($methodClass){ return function (aBlock){
  564. var self=this,$self=this;
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. return $core.withContext(function($ctx1) {
  567. //>>excludeEnd("ctx");
  568. var $1;
  569. var $early={};
  570. try {
  571. $self._do_((function(each){
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. return $core.withContext(function($ctx2) {
  574. //>>excludeEnd("ctx");
  575. $1=$recv(aBlock)._value_(each);
  576. if($core.assert($1)){
  577. throw $early=[true];
  578. }
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  581. //>>excludeEnd("ctx");
  582. }));
  583. return false;
  584. }
  585. catch(e) {if(e===$early)return e[0]; throw e}
  586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  587. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  588. //>>excludeEnd("ctx");
  589. }; }),
  590. $globals.Collection);
  591. $core.addMethod(
  592. $core.method({
  593. selector: "asArray",
  594. protocol: "converting",
  595. //>>excludeStart("ide", pragmas.excludeIdeData);
  596. args: [],
  597. source: "asArray\x0a\x09^ Array withAll: self",
  598. referencedClasses: ["Array"],
  599. //>>excludeEnd("ide");
  600. pragmas: [],
  601. messageSends: ["withAll:"]
  602. }, function ($methodClass){ return function (){
  603. var self=this,$self=this;
  604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  605. return $core.withContext(function($ctx1) {
  606. //>>excludeEnd("ctx");
  607. return $recv($globals.Array)._withAll_(self);
  608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  609. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  610. //>>excludeEnd("ctx");
  611. }; }),
  612. $globals.Collection);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "asJavaScriptObject",
  616. protocol: "converting",
  617. //>>excludeStart("ide", pragmas.excludeIdeData);
  618. args: [],
  619. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  620. referencedClasses: [],
  621. //>>excludeEnd("ide");
  622. pragmas: [],
  623. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  624. }, function ($methodClass){ return function (){
  625. var self=this,$self=this;
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. return $core.withContext(function($ctx1) {
  628. //>>excludeEnd("ctx");
  629. return $recv($self._asArray())._collect_((function(each){
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. return $core.withContext(function($ctx2) {
  632. //>>excludeEnd("ctx");
  633. return $recv(each)._asJavaScriptObject();
  634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  636. //>>excludeEnd("ctx");
  637. }));
  638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  639. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  640. //>>excludeEnd("ctx");
  641. }; }),
  642. $globals.Collection);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "asOrderedCollection",
  646. protocol: "converting",
  647. //>>excludeStart("ide", pragmas.excludeIdeData);
  648. args: [],
  649. source: "asOrderedCollection\x0a\x09^ self asArray",
  650. referencedClasses: [],
  651. //>>excludeEnd("ide");
  652. pragmas: [],
  653. messageSends: ["asArray"]
  654. }, function ($methodClass){ return function (){
  655. var self=this,$self=this;
  656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  657. return $core.withContext(function($ctx1) {
  658. //>>excludeEnd("ctx");
  659. return $self._asArray();
  660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  661. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  662. //>>excludeEnd("ctx");
  663. }; }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asSet",
  668. protocol: "converting",
  669. //>>excludeStart("ide", pragmas.excludeIdeData);
  670. args: [],
  671. source: "asSet\x0a\x09^ Set withAll: self",
  672. referencedClasses: ["Set"],
  673. //>>excludeEnd("ide");
  674. pragmas: [],
  675. messageSends: ["withAll:"]
  676. }, function ($methodClass){ return function (){
  677. var self=this,$self=this;
  678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  679. return $core.withContext(function($ctx1) {
  680. //>>excludeEnd("ctx");
  681. return $recv($globals.Set)._withAll_(self);
  682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  683. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  684. //>>excludeEnd("ctx");
  685. }; }),
  686. $globals.Collection);
  687. $core.addMethod(
  688. $core.method({
  689. selector: "collect:",
  690. protocol: "enumerating",
  691. //>>excludeStart("ide", pragmas.excludeIdeData);
  692. args: ["aBlock"],
  693. 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",
  694. referencedClasses: [],
  695. //>>excludeEnd("ide");
  696. pragmas: [],
  697. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  698. }, function ($methodClass){ return function (aBlock){
  699. var self=this,$self=this;
  700. var stream;
  701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  702. return $core.withContext(function($ctx1) {
  703. //>>excludeEnd("ctx");
  704. stream=$recv($recv($self._class())._new())._writeStream();
  705. $self._do_((function(each){
  706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  707. return $core.withContext(function($ctx2) {
  708. //>>excludeEnd("ctx");
  709. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  711. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  712. //>>excludeEnd("ctx");
  713. }));
  714. return $recv(stream)._contents();
  715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  716. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  717. //>>excludeEnd("ctx");
  718. }; }),
  719. $globals.Collection);
  720. $core.addMethod(
  721. $core.method({
  722. selector: "copyWith:",
  723. protocol: "copying",
  724. //>>excludeStart("ide", pragmas.excludeIdeData);
  725. args: ["anObject"],
  726. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  727. referencedClasses: [],
  728. //>>excludeEnd("ide");
  729. pragmas: [],
  730. messageSends: ["add:", "copy", "yourself"]
  731. }, function ($methodClass){ return function (anObject){
  732. var self=this,$self=this;
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. return $core.withContext(function($ctx1) {
  735. //>>excludeEnd("ctx");
  736. var $1;
  737. $1=$self._copy();
  738. $recv($1)._add_(anObject);
  739. return $recv($1)._yourself();
  740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  741. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  742. //>>excludeEnd("ctx");
  743. }; }),
  744. $globals.Collection);
  745. $core.addMethod(
  746. $core.method({
  747. selector: "copyWithAll:",
  748. protocol: "copying",
  749. //>>excludeStart("ide", pragmas.excludeIdeData);
  750. args: ["aCollection"],
  751. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  752. referencedClasses: [],
  753. //>>excludeEnd("ide");
  754. pragmas: [],
  755. messageSends: ["deprecatedAPI:", ","]
  756. }, function ($methodClass){ return function (aCollection){
  757. var self=this,$self=this;
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. return $core.withContext(function($ctx1) {
  760. //>>excludeEnd("ctx");
  761. $self._deprecatedAPI_("Use #, instead.");
  762. return $self.__comma(aCollection);
  763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  764. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  765. //>>excludeEnd("ctx");
  766. }; }),
  767. $globals.Collection);
  768. $core.addMethod(
  769. $core.method({
  770. selector: "copyWithout:",
  771. protocol: "copying",
  772. //>>excludeStart("ide", pragmas.excludeIdeData);
  773. args: ["anObject"],
  774. 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 ]",
  775. referencedClasses: [],
  776. //>>excludeEnd("ide");
  777. pragmas: [],
  778. messageSends: ["reject:", "="]
  779. }, function ($methodClass){ return function (anObject){
  780. var self=this,$self=this;
  781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  782. return $core.withContext(function($ctx1) {
  783. //>>excludeEnd("ctx");
  784. return $self._reject_((function(each){
  785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  786. return $core.withContext(function($ctx2) {
  787. //>>excludeEnd("ctx");
  788. return $recv(each).__eq(anObject);
  789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  790. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  791. //>>excludeEnd("ctx");
  792. }));
  793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  794. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  795. //>>excludeEnd("ctx");
  796. }; }),
  797. $globals.Collection);
  798. $core.addMethod(
  799. $core.method({
  800. selector: "copyWithoutAll:",
  801. protocol: "copying",
  802. //>>excludeStart("ide", pragmas.excludeIdeData);
  803. args: ["aCollection"],
  804. 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 ]",
  805. referencedClasses: [],
  806. //>>excludeEnd("ide");
  807. pragmas: [],
  808. messageSends: ["reject:", "includes:"]
  809. }, function ($methodClass){ return function (aCollection){
  810. var self=this,$self=this;
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. return $core.withContext(function($ctx1) {
  813. //>>excludeEnd("ctx");
  814. return $self._reject_((function(each){
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. return $core.withContext(function($ctx2) {
  817. //>>excludeEnd("ctx");
  818. return $recv(aCollection)._includes_(each);
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  821. //>>excludeEnd("ctx");
  822. }));
  823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  824. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  825. //>>excludeEnd("ctx");
  826. }; }),
  827. $globals.Collection);
  828. $core.addMethod(
  829. $core.method({
  830. selector: "deepCopy",
  831. protocol: "copying",
  832. //>>excludeStart("ide", pragmas.excludeIdeData);
  833. args: [],
  834. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  835. referencedClasses: [],
  836. //>>excludeEnd("ide");
  837. pragmas: [],
  838. messageSends: ["collect:", "deepCopy"]
  839. }, function ($methodClass){ return function (){
  840. var self=this,$self=this;
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx1) {
  843. //>>excludeEnd("ctx");
  844. return $self._collect_((function(each){
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. return $core.withContext(function($ctx2) {
  847. //>>excludeEnd("ctx");
  848. return $recv(each)._deepCopy();
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  851. //>>excludeEnd("ctx");
  852. }));
  853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  854. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  855. //>>excludeEnd("ctx");
  856. }; }),
  857. $globals.Collection);
  858. $core.addMethod(
  859. $core.method({
  860. selector: "detect:",
  861. protocol: "enumerating",
  862. //>>excludeStart("ide", pragmas.excludeIdeData);
  863. args: ["aBlock"],
  864. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  865. referencedClasses: [],
  866. //>>excludeEnd("ide");
  867. pragmas: [],
  868. messageSends: ["detect:ifNone:", "errorNotFound"]
  869. }, function ($methodClass){ return function (aBlock){
  870. var self=this,$self=this;
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. return $core.withContext(function($ctx1) {
  873. //>>excludeEnd("ctx");
  874. return $self._detect_ifNone_(aBlock,(function(){
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. return $core.withContext(function($ctx2) {
  877. //>>excludeEnd("ctx");
  878. return $self._errorNotFound();
  879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  880. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  881. //>>excludeEnd("ctx");
  882. }));
  883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  884. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  885. //>>excludeEnd("ctx");
  886. }; }),
  887. $globals.Collection);
  888. $core.addMethod(
  889. $core.method({
  890. selector: "detect:ifNone:",
  891. protocol: "enumerating",
  892. //>>excludeStart("ide", pragmas.excludeIdeData);
  893. args: ["aBlock", "anotherBlock"],
  894. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  895. referencedClasses: [],
  896. //>>excludeEnd("ide");
  897. pragmas: [],
  898. messageSends: ["do:", "ifTrue:", "value:", "value"]
  899. }, function ($methodClass){ return function (aBlock,anotherBlock){
  900. var self=this,$self=this;
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. return $core.withContext(function($ctx1) {
  903. //>>excludeEnd("ctx");
  904. var $1;
  905. var $early={};
  906. try {
  907. $self._do_((function(each){
  908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  909. return $core.withContext(function($ctx2) {
  910. //>>excludeEnd("ctx");
  911. $1=$recv(aBlock)._value_(each);
  912. if($core.assert($1)){
  913. throw $early=[each];
  914. }
  915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  916. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  917. //>>excludeEnd("ctx");
  918. }));
  919. return $recv(anotherBlock)._value();
  920. }
  921. catch(e) {if(e===$early)return e[0]; throw e}
  922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  923. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  924. //>>excludeEnd("ctx");
  925. }; }),
  926. $globals.Collection);
  927. $core.addMethod(
  928. $core.method({
  929. selector: "do:",
  930. protocol: "enumerating",
  931. //>>excludeStart("ide", pragmas.excludeIdeData);
  932. args: ["aBlock"],
  933. source: "do: aBlock\x0a\x09self subclassResponsibility",
  934. referencedClasses: [],
  935. //>>excludeEnd("ide");
  936. pragmas: [],
  937. messageSends: ["subclassResponsibility"]
  938. }, function ($methodClass){ return function (aBlock){
  939. var self=this,$self=this;
  940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  941. return $core.withContext(function($ctx1) {
  942. //>>excludeEnd("ctx");
  943. $self._subclassResponsibility();
  944. return self;
  945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  946. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  947. //>>excludeEnd("ctx");
  948. }; }),
  949. $globals.Collection);
  950. $core.addMethod(
  951. $core.method({
  952. selector: "do:separatedBy:",
  953. protocol: "enumerating",
  954. //>>excludeStart("ide", pragmas.excludeIdeData);
  955. args: ["aBlock", "anotherBlock"],
  956. 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 ]",
  957. referencedClasses: [],
  958. //>>excludeEnd("ide");
  959. pragmas: [],
  960. messageSends: ["do:", "value", "value:"]
  961. }, function ($methodClass){ return function (aBlock,anotherBlock){
  962. var self=this,$self=this;
  963. var actionBeforeElement;
  964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  965. return $core.withContext(function($ctx1) {
  966. //>>excludeEnd("ctx");
  967. actionBeforeElement=(function(){
  968. actionBeforeElement=anotherBlock;
  969. return actionBeforeElement;
  970. });
  971. $self._do_((function(each){
  972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  973. return $core.withContext(function($ctx2) {
  974. //>>excludeEnd("ctx");
  975. $recv(actionBeforeElement)._value();
  976. return $recv(aBlock)._value_(each);
  977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  978. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  979. //>>excludeEnd("ctx");
  980. }));
  981. return self;
  982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  983. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  984. //>>excludeEnd("ctx");
  985. }; }),
  986. $globals.Collection);
  987. $core.addMethod(
  988. $core.method({
  989. selector: "errorNotFound",
  990. protocol: "error handling",
  991. //>>excludeStart("ide", pragmas.excludeIdeData);
  992. args: [],
  993. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  994. referencedClasses: [],
  995. //>>excludeEnd("ide");
  996. pragmas: [],
  997. messageSends: ["error:"]
  998. }, function ($methodClass){ return function (){
  999. var self=this,$self=this;
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. return $core.withContext(function($ctx1) {
  1002. //>>excludeEnd("ctx");
  1003. $self._error_("Object is not in the collection");
  1004. return self;
  1005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1006. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1007. //>>excludeEnd("ctx");
  1008. }; }),
  1009. $globals.Collection);
  1010. $core.addMethod(
  1011. $core.method({
  1012. selector: "ifEmpty:",
  1013. protocol: "testing",
  1014. //>>excludeStart("ide", pragmas.excludeIdeData);
  1015. args: ["aBlock"],
  1016. 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 ]",
  1017. referencedClasses: [],
  1018. //>>excludeEnd("ide");
  1019. pragmas: [],
  1020. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1021. }, function ($methodClass){ return function (aBlock){
  1022. var self=this,$self=this;
  1023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1024. return $core.withContext(function($ctx1) {
  1025. //>>excludeEnd("ctx");
  1026. var $1;
  1027. $1=$self._isEmpty();
  1028. if($core.assert($1)){
  1029. return $recv(aBlock)._value();
  1030. } else {
  1031. return self;
  1032. }
  1033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1034. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1035. //>>excludeEnd("ctx");
  1036. }; }),
  1037. $globals.Collection);
  1038. $core.addMethod(
  1039. $core.method({
  1040. selector: "ifEmpty:ifNotEmpty:",
  1041. protocol: "testing",
  1042. //>>excludeStart("ide", pragmas.excludeIdeData);
  1043. args: ["aBlock", "anotherBlock"],
  1044. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1045. referencedClasses: [],
  1046. //>>excludeEnd("ide");
  1047. pragmas: [],
  1048. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1049. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1050. var self=this,$self=this;
  1051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1052. return $core.withContext(function($ctx1) {
  1053. //>>excludeEnd("ctx");
  1054. var $1;
  1055. $1=$self._isEmpty();
  1056. if($core.assert($1)){
  1057. return $recv(aBlock)._value();
  1058. } else {
  1059. return $recv(anotherBlock)._value_(self);
  1060. }
  1061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1062. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1063. //>>excludeEnd("ctx");
  1064. }; }),
  1065. $globals.Collection);
  1066. $core.addMethod(
  1067. $core.method({
  1068. selector: "ifNotEmpty:",
  1069. protocol: "testing",
  1070. //>>excludeStart("ide", pragmas.excludeIdeData);
  1071. args: ["aBlock"],
  1072. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1073. referencedClasses: [],
  1074. //>>excludeEnd("ide");
  1075. pragmas: [],
  1076. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1077. }, function ($methodClass){ return function (aBlock){
  1078. var self=this,$self=this;
  1079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1080. return $core.withContext(function($ctx1) {
  1081. //>>excludeEnd("ctx");
  1082. var $1;
  1083. $1=$self._notEmpty();
  1084. if($core.assert($1)){
  1085. return $recv(aBlock)._value_(self);
  1086. } else {
  1087. return self;
  1088. }
  1089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1090. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1091. //>>excludeEnd("ctx");
  1092. }; }),
  1093. $globals.Collection);
  1094. $core.addMethod(
  1095. $core.method({
  1096. selector: "ifNotEmpty:ifEmpty:",
  1097. protocol: "testing",
  1098. //>>excludeStart("ide", pragmas.excludeIdeData);
  1099. args: ["aBlock", "anotherBlock"],
  1100. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1101. referencedClasses: [],
  1102. //>>excludeEnd("ide");
  1103. pragmas: [],
  1104. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1105. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1106. var self=this,$self=this;
  1107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1108. return $core.withContext(function($ctx1) {
  1109. //>>excludeEnd("ctx");
  1110. var $1;
  1111. $1=$self._notEmpty();
  1112. if($core.assert($1)){
  1113. return $recv(aBlock)._value_(self);
  1114. } else {
  1115. return $recv(anotherBlock)._value();
  1116. }
  1117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1118. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1119. //>>excludeEnd("ctx");
  1120. }; }),
  1121. $globals.Collection);
  1122. $core.addMethod(
  1123. $core.method({
  1124. selector: "includes:",
  1125. protocol: "testing",
  1126. //>>excludeStart("ide", pragmas.excludeIdeData);
  1127. args: ["anObject"],
  1128. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1129. referencedClasses: [],
  1130. //>>excludeEnd("ide");
  1131. pragmas: [],
  1132. messageSends: ["anySatisfy:", "="]
  1133. }, function ($methodClass){ return function (anObject){
  1134. var self=this,$self=this;
  1135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1136. return $core.withContext(function($ctx1) {
  1137. //>>excludeEnd("ctx");
  1138. return $self._anySatisfy_((function(each){
  1139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1140. return $core.withContext(function($ctx2) {
  1141. //>>excludeEnd("ctx");
  1142. return $recv(each).__eq(anObject);
  1143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1144. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1145. //>>excludeEnd("ctx");
  1146. }));
  1147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1148. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1149. //>>excludeEnd("ctx");
  1150. }; }),
  1151. $globals.Collection);
  1152. $core.addMethod(
  1153. $core.method({
  1154. selector: "inject:into:",
  1155. protocol: "enumerating",
  1156. //>>excludeStart("ide", pragmas.excludeIdeData);
  1157. args: ["anObject", "aBlock"],
  1158. 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",
  1159. referencedClasses: [],
  1160. //>>excludeEnd("ide");
  1161. pragmas: [],
  1162. messageSends: ["do:", "value:value:"]
  1163. }, function ($methodClass){ return function (anObject,aBlock){
  1164. var self=this,$self=this;
  1165. var result;
  1166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1167. return $core.withContext(function($ctx1) {
  1168. //>>excludeEnd("ctx");
  1169. result=anObject;
  1170. $self._do_((function(each){
  1171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1172. return $core.withContext(function($ctx2) {
  1173. //>>excludeEnd("ctx");
  1174. result=$recv(aBlock)._value_value_(result,each);
  1175. return result;
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1178. //>>excludeEnd("ctx");
  1179. }));
  1180. return result;
  1181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1182. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1183. //>>excludeEnd("ctx");
  1184. }; }),
  1185. $globals.Collection);
  1186. $core.addMethod(
  1187. $core.method({
  1188. selector: "intersection:",
  1189. protocol: "enumerating",
  1190. //>>excludeStart("ide", pragmas.excludeIdeData);
  1191. args: ["aCollection"],
  1192. 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",
  1193. referencedClasses: ["Set"],
  1194. //>>excludeEnd("ide");
  1195. pragmas: [],
  1196. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1197. }, function ($methodClass){ return function (aCollection){
  1198. var self=this,$self=this;
  1199. var set,outputSet;
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. return $core.withContext(function($ctx1) {
  1202. //>>excludeEnd("ctx");
  1203. var $1;
  1204. set=$self._asSet();
  1205. outputSet=$recv($globals.Set)._new();
  1206. $recv(aCollection)._do_((function(each){
  1207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1208. return $core.withContext(function($ctx2) {
  1209. //>>excludeEnd("ctx");
  1210. $1=$recv([$recv(set)._includes_(each)
  1211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1212. ,$ctx2.sendIdx["includes:"]=1
  1213. //>>excludeEnd("ctx");
  1214. ][0])._and_((function(){
  1215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1216. return $core.withContext(function($ctx3) {
  1217. //>>excludeEnd("ctx");
  1218. return $recv($recv(outputSet)._includes_(each))._not();
  1219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1220. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1221. //>>excludeEnd("ctx");
  1222. }));
  1223. if($core.assert($1)){
  1224. return $recv(outputSet)._add_(each);
  1225. }
  1226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1227. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1228. //>>excludeEnd("ctx");
  1229. }));
  1230. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1232. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1233. //>>excludeEnd("ctx");
  1234. }; }),
  1235. $globals.Collection);
  1236. $core.addMethod(
  1237. $core.method({
  1238. selector: "isEmpty",
  1239. protocol: "testing",
  1240. //>>excludeStart("ide", pragmas.excludeIdeData);
  1241. args: [],
  1242. source: "isEmpty\x0a\x09^ self size = 0",
  1243. referencedClasses: [],
  1244. //>>excludeEnd("ide");
  1245. pragmas: [],
  1246. messageSends: ["=", "size"]
  1247. }, function ($methodClass){ return function (){
  1248. var self=this,$self=this;
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. return $core.withContext(function($ctx1) {
  1251. //>>excludeEnd("ctx");
  1252. return $recv($self._size()).__eq((0));
  1253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1254. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1255. //>>excludeEnd("ctx");
  1256. }; }),
  1257. $globals.Collection);
  1258. $core.addMethod(
  1259. $core.method({
  1260. selector: "noneSatisfy:",
  1261. protocol: "enumerating",
  1262. //>>excludeStart("ide", pragmas.excludeIdeData);
  1263. args: ["aBlock"],
  1264. 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",
  1265. referencedClasses: [],
  1266. //>>excludeEnd("ide");
  1267. pragmas: [],
  1268. messageSends: ["do:", "ifTrue:", "value:"]
  1269. }, function ($methodClass){ return function (aBlock){
  1270. var self=this,$self=this;
  1271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1272. return $core.withContext(function($ctx1) {
  1273. //>>excludeEnd("ctx");
  1274. var $1;
  1275. var $early={};
  1276. try {
  1277. $self._do_((function(item){
  1278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1279. return $core.withContext(function($ctx2) {
  1280. //>>excludeEnd("ctx");
  1281. $1=$recv(aBlock)._value_(item);
  1282. if($core.assert($1)){
  1283. throw $early=[false];
  1284. }
  1285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1286. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1287. //>>excludeEnd("ctx");
  1288. }));
  1289. return true;
  1290. }
  1291. catch(e) {if(e===$early)return e[0]; throw e}
  1292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1293. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1294. //>>excludeEnd("ctx");
  1295. }; }),
  1296. $globals.Collection);
  1297. $core.addMethod(
  1298. $core.method({
  1299. selector: "notEmpty",
  1300. protocol: "testing",
  1301. //>>excludeStart("ide", pragmas.excludeIdeData);
  1302. args: [],
  1303. source: "notEmpty\x0a\x09^ self isEmpty not",
  1304. referencedClasses: [],
  1305. //>>excludeEnd("ide");
  1306. pragmas: [],
  1307. messageSends: ["not", "isEmpty"]
  1308. }, function ($methodClass){ return function (){
  1309. var self=this,$self=this;
  1310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1311. return $core.withContext(function($ctx1) {
  1312. //>>excludeEnd("ctx");
  1313. return $recv($self._isEmpty())._not();
  1314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1315. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1316. //>>excludeEnd("ctx");
  1317. }; }),
  1318. $globals.Collection);
  1319. $core.addMethod(
  1320. $core.method({
  1321. selector: "occurrencesOf:",
  1322. protocol: "accessing",
  1323. //>>excludeStart("ide", pragmas.excludeIdeData);
  1324. args: ["anObject"],
  1325. 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",
  1326. referencedClasses: [],
  1327. //>>excludeEnd("ide");
  1328. pragmas: [],
  1329. messageSends: ["do:", "ifTrue:", "=", "+"]
  1330. }, function ($methodClass){ return function (anObject){
  1331. var self=this,$self=this;
  1332. var tally;
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. return $core.withContext(function($ctx1) {
  1335. //>>excludeEnd("ctx");
  1336. var $1;
  1337. tally=(0);
  1338. $self._do_((function(each){
  1339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1340. return $core.withContext(function($ctx2) {
  1341. //>>excludeEnd("ctx");
  1342. $1=$recv(anObject).__eq(each);
  1343. if($core.assert($1)){
  1344. tally=$recv(tally).__plus((1));
  1345. return tally;
  1346. }
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1349. //>>excludeEnd("ctx");
  1350. }));
  1351. return tally;
  1352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1353. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1354. //>>excludeEnd("ctx");
  1355. }; }),
  1356. $globals.Collection);
  1357. $core.addMethod(
  1358. $core.method({
  1359. selector: "putOn:",
  1360. protocol: "streaming",
  1361. //>>excludeStart("ide", pragmas.excludeIdeData);
  1362. args: ["aStream"],
  1363. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1364. referencedClasses: [],
  1365. //>>excludeEnd("ide");
  1366. pragmas: [],
  1367. messageSends: ["do:", "putOn:"]
  1368. }, function ($methodClass){ return function (aStream){
  1369. var self=this,$self=this;
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. return $core.withContext(function($ctx1) {
  1372. //>>excludeEnd("ctx");
  1373. $self._do_((function(each){
  1374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1375. return $core.withContext(function($ctx2) {
  1376. //>>excludeEnd("ctx");
  1377. return $recv(each)._putOn_(aStream);
  1378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1379. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1380. //>>excludeEnd("ctx");
  1381. }));
  1382. return self;
  1383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1384. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1385. //>>excludeEnd("ctx");
  1386. }; }),
  1387. $globals.Collection);
  1388. $core.addMethod(
  1389. $core.method({
  1390. selector: "reject:",
  1391. protocol: "enumerating",
  1392. //>>excludeStart("ide", pragmas.excludeIdeData);
  1393. args: ["aBlock"],
  1394. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1395. referencedClasses: [],
  1396. //>>excludeEnd("ide");
  1397. pragmas: [],
  1398. messageSends: ["select:", "=", "value:"]
  1399. }, function ($methodClass){ return function (aBlock){
  1400. var self=this,$self=this;
  1401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1402. return $core.withContext(function($ctx1) {
  1403. //>>excludeEnd("ctx");
  1404. return $self._select_((function(each){
  1405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1406. return $core.withContext(function($ctx2) {
  1407. //>>excludeEnd("ctx");
  1408. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1411. //>>excludeEnd("ctx");
  1412. }));
  1413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1414. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1415. //>>excludeEnd("ctx");
  1416. }; }),
  1417. $globals.Collection);
  1418. $core.addMethod(
  1419. $core.method({
  1420. selector: "remove:",
  1421. protocol: "adding/removing",
  1422. //>>excludeStart("ide", pragmas.excludeIdeData);
  1423. args: ["anObject"],
  1424. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1425. referencedClasses: [],
  1426. //>>excludeEnd("ide");
  1427. pragmas: [],
  1428. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1429. }, function ($methodClass){ return function (anObject){
  1430. var self=this,$self=this;
  1431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1432. return $core.withContext(function($ctx1) {
  1433. //>>excludeEnd("ctx");
  1434. return $self._remove_ifAbsent_(anObject,(function(){
  1435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1436. return $core.withContext(function($ctx2) {
  1437. //>>excludeEnd("ctx");
  1438. return $self._errorNotFound();
  1439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1441. //>>excludeEnd("ctx");
  1442. }));
  1443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1444. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1445. //>>excludeEnd("ctx");
  1446. }; }),
  1447. $globals.Collection);
  1448. $core.addMethod(
  1449. $core.method({
  1450. selector: "remove:ifAbsent:",
  1451. protocol: "adding/removing",
  1452. //>>excludeStart("ide", pragmas.excludeIdeData);
  1453. args: ["anObject", "aBlock"],
  1454. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1455. referencedClasses: [],
  1456. //>>excludeEnd("ide");
  1457. pragmas: [],
  1458. messageSends: ["subclassResponsibility"]
  1459. }, function ($methodClass){ return function (anObject,aBlock){
  1460. var self=this,$self=this;
  1461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1462. return $core.withContext(function($ctx1) {
  1463. //>>excludeEnd("ctx");
  1464. $self._subclassResponsibility();
  1465. return self;
  1466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1467. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1468. //>>excludeEnd("ctx");
  1469. }; }),
  1470. $globals.Collection);
  1471. $core.addMethod(
  1472. $core.method({
  1473. selector: "removeAll",
  1474. protocol: "adding/removing",
  1475. //>>excludeStart("ide", pragmas.excludeIdeData);
  1476. args: [],
  1477. source: "removeAll\x0a\x09self subclassResponsibility",
  1478. referencedClasses: [],
  1479. //>>excludeEnd("ide");
  1480. pragmas: [],
  1481. messageSends: ["subclassResponsibility"]
  1482. }, function ($methodClass){ return function (){
  1483. var self=this,$self=this;
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. return $core.withContext(function($ctx1) {
  1486. //>>excludeEnd("ctx");
  1487. $self._subclassResponsibility();
  1488. return self;
  1489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1490. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1491. //>>excludeEnd("ctx");
  1492. }; }),
  1493. $globals.Collection);
  1494. $core.addMethod(
  1495. $core.method({
  1496. selector: "select:",
  1497. protocol: "enumerating",
  1498. //>>excludeStart("ide", pragmas.excludeIdeData);
  1499. args: ["aBlock"],
  1500. 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",
  1501. referencedClasses: [],
  1502. //>>excludeEnd("ide");
  1503. pragmas: [],
  1504. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1505. }, function ($methodClass){ return function (aBlock){
  1506. var self=this,$self=this;
  1507. var stream;
  1508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1509. return $core.withContext(function($ctx1) {
  1510. //>>excludeEnd("ctx");
  1511. var $1;
  1512. stream=$recv($recv($self._class())._new())._writeStream();
  1513. $self._do_((function(each){
  1514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1515. return $core.withContext(function($ctx2) {
  1516. //>>excludeEnd("ctx");
  1517. $1=$recv(aBlock)._value_(each);
  1518. if($core.assert($1)){
  1519. return $recv(stream)._nextPut_(each);
  1520. }
  1521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1523. //>>excludeEnd("ctx");
  1524. }));
  1525. return $recv(stream)._contents();
  1526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1527. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1528. //>>excludeEnd("ctx");
  1529. }; }),
  1530. $globals.Collection);
  1531. $core.addMethod(
  1532. $core.method({
  1533. selector: "select:thenCollect:",
  1534. protocol: "enumerating",
  1535. //>>excludeStart("ide", pragmas.excludeIdeData);
  1536. args: ["selectBlock", "collectBlock"],
  1537. 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",
  1538. referencedClasses: [],
  1539. //>>excludeEnd("ide");
  1540. pragmas: [],
  1541. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1542. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1543. var self=this,$self=this;
  1544. var stream;
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. return $core.withContext(function($ctx1) {
  1547. //>>excludeEnd("ctx");
  1548. var $1;
  1549. stream=$recv($recv($self._class())._new())._writeStream();
  1550. $self._do_((function(each){
  1551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1552. return $core.withContext(function($ctx2) {
  1553. //>>excludeEnd("ctx");
  1554. $1=[$recv(selectBlock)._value_(each)
  1555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1556. ,$ctx2.sendIdx["value:"]=1
  1557. //>>excludeEnd("ctx");
  1558. ][0];
  1559. if($core.assert($1)){
  1560. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1561. }
  1562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1563. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1564. //>>excludeEnd("ctx");
  1565. }));
  1566. return $recv(stream)._contents();
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1569. //>>excludeEnd("ctx");
  1570. }; }),
  1571. $globals.Collection);
  1572. $core.addMethod(
  1573. $core.method({
  1574. selector: "shallowCopy",
  1575. protocol: "copying",
  1576. //>>excludeStart("ide", pragmas.excludeIdeData);
  1577. args: [],
  1578. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1579. referencedClasses: [],
  1580. //>>excludeEnd("ide");
  1581. pragmas: [],
  1582. messageSends: ["collect:"]
  1583. }, function ($methodClass){ return function (){
  1584. var self=this,$self=this;
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. return $core.withContext(function($ctx1) {
  1587. //>>excludeEnd("ctx");
  1588. return $self._collect_((function(each){
  1589. return each;
  1590. }));
  1591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1592. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1593. //>>excludeEnd("ctx");
  1594. }; }),
  1595. $globals.Collection);
  1596. $core.addMethod(
  1597. $core.method({
  1598. selector: "single",
  1599. protocol: "accessing",
  1600. //>>excludeStart("ide", pragmas.excludeIdeData);
  1601. args: [],
  1602. 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",
  1603. referencedClasses: [],
  1604. //>>excludeEnd("ide");
  1605. pragmas: [],
  1606. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1607. }, function ($methodClass){ return function (){
  1608. var self=this,$self=this;
  1609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1610. return $core.withContext(function($ctx1) {
  1611. //>>excludeEnd("ctx");
  1612. var $1;
  1613. $self._ifEmpty_((function(){
  1614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1615. return $core.withContext(function($ctx2) {
  1616. //>>excludeEnd("ctx");
  1617. return [$self._error_("Collection is empty")
  1618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1619. ,$ctx2.sendIdx["error:"]=1
  1620. //>>excludeEnd("ctx");
  1621. ][0];
  1622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1624. //>>excludeEnd("ctx");
  1625. }));
  1626. $1=$recv($self._size()).__gt((1));
  1627. if($core.assert($1)){
  1628. $self._error_("Collection holds more than one element");
  1629. }
  1630. return $self._anyOne();
  1631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1632. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1633. //>>excludeEnd("ctx");
  1634. }; }),
  1635. $globals.Collection);
  1636. $core.addMethod(
  1637. $core.method({
  1638. selector: "size",
  1639. protocol: "accessing",
  1640. //>>excludeStart("ide", pragmas.excludeIdeData);
  1641. args: [],
  1642. source: "size\x0a\x09self subclassResponsibility",
  1643. referencedClasses: [],
  1644. //>>excludeEnd("ide");
  1645. pragmas: [],
  1646. messageSends: ["subclassResponsibility"]
  1647. }, function ($methodClass){ return function (){
  1648. var self=this,$self=this;
  1649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1650. return $core.withContext(function($ctx1) {
  1651. //>>excludeEnd("ctx");
  1652. $self._subclassResponsibility();
  1653. return self;
  1654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1655. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1656. //>>excludeEnd("ctx");
  1657. }; }),
  1658. $globals.Collection);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "classTag",
  1662. protocol: "accessing",
  1663. //>>excludeStart("ide", pragmas.excludeIdeData);
  1664. args: [],
  1665. 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'",
  1666. referencedClasses: [],
  1667. //>>excludeEnd("ide");
  1668. pragmas: [],
  1669. messageSends: []
  1670. }, function ($methodClass){ return function (){
  1671. var self=this,$self=this;
  1672. return "collection";
  1673. }; }),
  1674. $globals.Collection.a$cls);
  1675. $core.addMethod(
  1676. $core.method({
  1677. selector: "new:",
  1678. protocol: "instance creation",
  1679. //>>excludeStart("ide", pragmas.excludeIdeData);
  1680. args: ["anInteger"],
  1681. source: "new: anInteger\x0a\x09^ self new",
  1682. referencedClasses: [],
  1683. //>>excludeEnd("ide");
  1684. pragmas: [],
  1685. messageSends: ["new"]
  1686. }, function ($methodClass){ return function (anInteger){
  1687. var self=this,$self=this;
  1688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1689. return $core.withContext(function($ctx1) {
  1690. //>>excludeEnd("ctx");
  1691. return $self._new();
  1692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1693. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1694. //>>excludeEnd("ctx");
  1695. }; }),
  1696. $globals.Collection.a$cls);
  1697. $core.addMethod(
  1698. $core.method({
  1699. selector: "with:",
  1700. protocol: "instance creation",
  1701. //>>excludeStart("ide", pragmas.excludeIdeData);
  1702. args: ["anObject"],
  1703. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1704. referencedClasses: [],
  1705. //>>excludeEnd("ide");
  1706. pragmas: [],
  1707. messageSends: ["add:", "new", "yourself"]
  1708. }, function ($methodClass){ return function (anObject){
  1709. var self=this,$self=this;
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. return $core.withContext(function($ctx1) {
  1712. //>>excludeEnd("ctx");
  1713. var $1;
  1714. $1=$self._new();
  1715. $recv($1)._add_(anObject);
  1716. return $recv($1)._yourself();
  1717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1718. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1719. //>>excludeEnd("ctx");
  1720. }; }),
  1721. $globals.Collection.a$cls);
  1722. $core.addMethod(
  1723. $core.method({
  1724. selector: "with:with:",
  1725. protocol: "instance creation",
  1726. //>>excludeStart("ide", pragmas.excludeIdeData);
  1727. args: ["anObject", "anotherObject"],
  1728. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1729. referencedClasses: [],
  1730. //>>excludeEnd("ide");
  1731. pragmas: [],
  1732. messageSends: ["add:", "new", "yourself"]
  1733. }, function ($methodClass){ return function (anObject,anotherObject){
  1734. var self=this,$self=this;
  1735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1736. return $core.withContext(function($ctx1) {
  1737. //>>excludeEnd("ctx");
  1738. var $1;
  1739. $1=$self._new();
  1740. [$recv($1)._add_(anObject)
  1741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1742. ,$ctx1.sendIdx["add:"]=1
  1743. //>>excludeEnd("ctx");
  1744. ][0];
  1745. $recv($1)._add_(anotherObject);
  1746. return $recv($1)._yourself();
  1747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1748. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1749. //>>excludeEnd("ctx");
  1750. }; }),
  1751. $globals.Collection.a$cls);
  1752. $core.addMethod(
  1753. $core.method({
  1754. selector: "with:with:with:",
  1755. protocol: "instance creation",
  1756. //>>excludeStart("ide", pragmas.excludeIdeData);
  1757. args: ["firstObject", "secondObject", "thirdObject"],
  1758. 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",
  1759. referencedClasses: [],
  1760. //>>excludeEnd("ide");
  1761. pragmas: [],
  1762. messageSends: ["add:", "new", "yourself"]
  1763. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1764. var self=this,$self=this;
  1765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1766. return $core.withContext(function($ctx1) {
  1767. //>>excludeEnd("ctx");
  1768. var $1;
  1769. $1=$self._new();
  1770. [$recv($1)._add_(firstObject)
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. ,$ctx1.sendIdx["add:"]=1
  1773. //>>excludeEnd("ctx");
  1774. ][0];
  1775. [$recv($1)._add_(secondObject)
  1776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1777. ,$ctx1.sendIdx["add:"]=2
  1778. //>>excludeEnd("ctx");
  1779. ][0];
  1780. $recv($1)._add_(thirdObject);
  1781. return $recv($1)._yourself();
  1782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1783. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1784. //>>excludeEnd("ctx");
  1785. }; }),
  1786. $globals.Collection.a$cls);
  1787. $core.addMethod(
  1788. $core.method({
  1789. selector: "withAll:",
  1790. protocol: "instance creation",
  1791. //>>excludeStart("ide", pragmas.excludeIdeData);
  1792. args: ["aCollection"],
  1793. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1794. referencedClasses: [],
  1795. //>>excludeEnd("ide");
  1796. pragmas: [],
  1797. messageSends: ["addAll:", "new", "yourself"]
  1798. }, function ($methodClass){ return function (aCollection){
  1799. var self=this,$self=this;
  1800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1801. return $core.withContext(function($ctx1) {
  1802. //>>excludeEnd("ctx");
  1803. var $1;
  1804. $1=$self._new();
  1805. $recv($1)._addAll_(aCollection);
  1806. return $recv($1)._yourself();
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1809. //>>excludeEnd("ctx");
  1810. }; }),
  1811. $globals.Collection.a$cls);
  1812. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1813. //>>excludeStart("ide", pragmas.excludeIdeData);
  1814. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1815. //>>excludeEnd("ide");
  1816. $core.addMethod(
  1817. $core.method({
  1818. selector: "=",
  1819. protocol: "comparing",
  1820. //>>excludeStart("ide", pragmas.excludeIdeData);
  1821. args: ["anAssocitativeCollection"],
  1822. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1823. referencedClasses: [],
  1824. //>>excludeEnd("ide");
  1825. pragmas: [],
  1826. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1827. }, function ($methodClass){ return function (anAssocitativeCollection){
  1828. var self=this,$self=this;
  1829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1830. return $core.withContext(function($ctx1) {
  1831. //>>excludeEnd("ctx");
  1832. var $1,$2;
  1833. $1=[$recv([$self._class()
  1834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1835. ,$ctx1.sendIdx["class"]=1
  1836. //>>excludeEnd("ctx");
  1837. ][0]).__eq($recv(anAssocitativeCollection)._class())
  1838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1839. ,$ctx1.sendIdx["="]=1
  1840. //>>excludeEnd("ctx");
  1841. ][0];
  1842. if(!$core.assert($1)){
  1843. return false;
  1844. }
  1845. $2=[$recv([$self._size()
  1846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1847. ,$ctx1.sendIdx["size"]=1
  1848. //>>excludeEnd("ctx");
  1849. ][0]).__eq($recv(anAssocitativeCollection)._size())
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. ,$ctx1.sendIdx["="]=2
  1852. //>>excludeEnd("ctx");
  1853. ][0];
  1854. if(!$core.assert($2)){
  1855. return false;
  1856. }
  1857. return $recv([$self._associations()
  1858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1859. ,$ctx1.sendIdx["associations"]=1
  1860. //>>excludeEnd("ctx");
  1861. ][0]).__eq($recv(anAssocitativeCollection)._associations());
  1862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1863. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1864. //>>excludeEnd("ctx");
  1865. }; }),
  1866. $globals.AssociativeCollection);
  1867. $core.addMethod(
  1868. $core.method({
  1869. selector: "add:",
  1870. protocol: "adding/removing",
  1871. //>>excludeStart("ide", pragmas.excludeIdeData);
  1872. args: ["anAssociation"],
  1873. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1874. referencedClasses: [],
  1875. //>>excludeEnd("ide");
  1876. pragmas: [],
  1877. messageSends: ["at:put:", "key", "value"]
  1878. }, function ($methodClass){ return function (anAssociation){
  1879. var self=this,$self=this;
  1880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1881. return $core.withContext(function($ctx1) {
  1882. //>>excludeEnd("ctx");
  1883. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1884. return self;
  1885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1886. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1887. //>>excludeEnd("ctx");
  1888. }; }),
  1889. $globals.AssociativeCollection);
  1890. $core.addMethod(
  1891. $core.method({
  1892. selector: "addAll:",
  1893. protocol: "adding/removing",
  1894. //>>excludeStart("ide", pragmas.excludeIdeData);
  1895. args: ["anAssociativeCollection"],
  1896. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1897. referencedClasses: [],
  1898. //>>excludeEnd("ide");
  1899. pragmas: [],
  1900. messageSends: ["addAll:", "associations"]
  1901. }, function ($methodClass){ return function (anAssociativeCollection){
  1902. var self=this,$self=this;
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. return $core.withContext(function($ctx1) {
  1905. //>>excludeEnd("ctx");
  1906. [(
  1907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1908. $ctx1.supercall = true,
  1909. //>>excludeEnd("ctx");
  1910. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1912. ,$ctx1.supercall = false
  1913. //>>excludeEnd("ctx");
  1914. ][0];
  1915. return anAssociativeCollection;
  1916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1917. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1918. //>>excludeEnd("ctx");
  1919. }; }),
  1920. $globals.AssociativeCollection);
  1921. $core.addMethod(
  1922. $core.method({
  1923. selector: "asDictionary",
  1924. protocol: "converting",
  1925. //>>excludeStart("ide", pragmas.excludeIdeData);
  1926. args: [],
  1927. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1928. referencedClasses: ["Dictionary"],
  1929. //>>excludeEnd("ide");
  1930. pragmas: [],
  1931. messageSends: ["from:", "associations"]
  1932. }, function ($methodClass){ return function (){
  1933. var self=this,$self=this;
  1934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1935. return $core.withContext(function($ctx1) {
  1936. //>>excludeEnd("ctx");
  1937. return $recv($globals.Dictionary)._from_($self._associations());
  1938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1939. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1940. //>>excludeEnd("ctx");
  1941. }; }),
  1942. $globals.AssociativeCollection);
  1943. $core.addMethod(
  1944. $core.method({
  1945. selector: "asHashedCollection",
  1946. protocol: "converting",
  1947. //>>excludeStart("ide", pragmas.excludeIdeData);
  1948. args: [],
  1949. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1950. referencedClasses: ["HashedCollection"],
  1951. //>>excludeEnd("ide");
  1952. pragmas: [],
  1953. messageSends: ["from:", "associations"]
  1954. }, function ($methodClass){ return function (){
  1955. var self=this,$self=this;
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. return $core.withContext(function($ctx1) {
  1958. //>>excludeEnd("ctx");
  1959. return $recv($globals.HashedCollection)._from_($self._associations());
  1960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1961. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1962. //>>excludeEnd("ctx");
  1963. }; }),
  1964. $globals.AssociativeCollection);
  1965. $core.addMethod(
  1966. $core.method({
  1967. selector: "asJavaScriptObject",
  1968. protocol: "converting",
  1969. //>>excludeStart("ide", pragmas.excludeIdeData);
  1970. args: [],
  1971. 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",
  1972. referencedClasses: ["HashedCollection"],
  1973. //>>excludeEnd("ide");
  1974. pragmas: [],
  1975. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1976. }, function ($methodClass){ return function (){
  1977. var self=this,$self=this;
  1978. var hash;
  1979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1980. return $core.withContext(function($ctx1) {
  1981. //>>excludeEnd("ctx");
  1982. hash=$recv($globals.HashedCollection)._new();
  1983. $self._keysAndValuesDo_((function(key,value){
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. return $core.withContext(function($ctx2) {
  1986. //>>excludeEnd("ctx");
  1987. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1990. //>>excludeEnd("ctx");
  1991. }));
  1992. return hash;
  1993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1994. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1995. //>>excludeEnd("ctx");
  1996. }; }),
  1997. $globals.AssociativeCollection);
  1998. $core.addMethod(
  1999. $core.method({
  2000. selector: "associations",
  2001. protocol: "accessing",
  2002. //>>excludeStart("ide", pragmas.excludeIdeData);
  2003. args: [],
  2004. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2005. referencedClasses: [],
  2006. //>>excludeEnd("ide");
  2007. pragmas: [],
  2008. messageSends: ["associationsDo:", "add:"]
  2009. }, function ($methodClass){ return function (){
  2010. var self=this,$self=this;
  2011. var associations;
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. return $core.withContext(function($ctx1) {
  2014. //>>excludeEnd("ctx");
  2015. associations=[];
  2016. $self._associationsDo_((function(each){
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. return $core.withContext(function($ctx2) {
  2019. //>>excludeEnd("ctx");
  2020. return $recv(associations)._add_(each);
  2021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2022. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2023. //>>excludeEnd("ctx");
  2024. }));
  2025. return associations;
  2026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2027. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2028. //>>excludeEnd("ctx");
  2029. }; }),
  2030. $globals.AssociativeCollection);
  2031. $core.addMethod(
  2032. $core.method({
  2033. selector: "associationsDo:",
  2034. protocol: "enumerating",
  2035. //>>excludeStart("ide", pragmas.excludeIdeData);
  2036. args: ["aBlock"],
  2037. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2038. referencedClasses: ["Association"],
  2039. //>>excludeEnd("ide");
  2040. pragmas: [],
  2041. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2042. }, function ($methodClass){ return function (aBlock){
  2043. var self=this,$self=this;
  2044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2045. return $core.withContext(function($ctx1) {
  2046. //>>excludeEnd("ctx");
  2047. $self._keysAndValuesDo_((function(key,value){
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. return $core.withContext(function($ctx2) {
  2050. //>>excludeEnd("ctx");
  2051. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2053. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2054. //>>excludeEnd("ctx");
  2055. }));
  2056. return self;
  2057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2058. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2059. //>>excludeEnd("ctx");
  2060. }; }),
  2061. $globals.AssociativeCollection);
  2062. $core.addMethod(
  2063. $core.method({
  2064. selector: "at:ifPresent:ifAbsent:",
  2065. protocol: "accessing",
  2066. //>>excludeStart("ide", pragmas.excludeIdeData);
  2067. args: ["aKey", "aBlock", "anotherBlock"],
  2068. 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 ]",
  2069. referencedClasses: [],
  2070. //>>excludeEnd("ide");
  2071. pragmas: [],
  2072. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2073. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2074. var self=this,$self=this;
  2075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2076. return $core.withContext(function($ctx1) {
  2077. //>>excludeEnd("ctx");
  2078. var $1;
  2079. $1=$self._includesKey_(aKey);
  2080. if($core.assert($1)){
  2081. return $recv(aBlock)._value_($self._at_(aKey));
  2082. } else {
  2083. return $recv(anotherBlock)._value();
  2084. }
  2085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2086. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2087. //>>excludeEnd("ctx");
  2088. }; }),
  2089. $globals.AssociativeCollection);
  2090. $core.addMethod(
  2091. $core.method({
  2092. selector: "collect:",
  2093. protocol: "enumerating",
  2094. //>>excludeStart("ide", pragmas.excludeIdeData);
  2095. args: ["aBlock"],
  2096. 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",
  2097. referencedClasses: [],
  2098. //>>excludeEnd("ide");
  2099. pragmas: [],
  2100. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2101. }, function ($methodClass){ return function (aBlock){
  2102. var self=this,$self=this;
  2103. var newDict;
  2104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2105. return $core.withContext(function($ctx1) {
  2106. //>>excludeEnd("ctx");
  2107. newDict=$recv($self._class())._new();
  2108. $self._keysAndValuesDo_((function(key,value){
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. return $core.withContext(function($ctx2) {
  2111. //>>excludeEnd("ctx");
  2112. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2114. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2115. //>>excludeEnd("ctx");
  2116. }));
  2117. return newDict;
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2120. //>>excludeEnd("ctx");
  2121. }; }),
  2122. $globals.AssociativeCollection);
  2123. $core.addMethod(
  2124. $core.method({
  2125. selector: "deepCopy",
  2126. protocol: "copying",
  2127. //>>excludeStart("ide", pragmas.excludeIdeData);
  2128. args: [],
  2129. 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",
  2130. referencedClasses: [],
  2131. //>>excludeEnd("ide");
  2132. pragmas: [],
  2133. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2134. }, function ($methodClass){ return function (){
  2135. var self=this,$self=this;
  2136. var copy;
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. return $core.withContext(function($ctx1) {
  2139. //>>excludeEnd("ctx");
  2140. copy=$recv($self._class())._new();
  2141. $self._keysAndValuesDo_((function(key,value){
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. return $core.withContext(function($ctx2) {
  2144. //>>excludeEnd("ctx");
  2145. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2147. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2148. //>>excludeEnd("ctx");
  2149. }));
  2150. return copy;
  2151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2152. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2153. //>>excludeEnd("ctx");
  2154. }; }),
  2155. $globals.AssociativeCollection);
  2156. $core.addMethod(
  2157. $core.method({
  2158. selector: "detect:ifNone:",
  2159. protocol: "enumerating",
  2160. //>>excludeStart("ide", pragmas.excludeIdeData);
  2161. args: ["aBlock", "anotherBlock"],
  2162. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2163. referencedClasses: [],
  2164. //>>excludeEnd("ide");
  2165. pragmas: [],
  2166. messageSends: ["detect:ifNone:", "values"]
  2167. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2168. var self=this,$self=this;
  2169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2170. return $core.withContext(function($ctx1) {
  2171. //>>excludeEnd("ctx");
  2172. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2174. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2175. //>>excludeEnd("ctx");
  2176. }; }),
  2177. $globals.AssociativeCollection);
  2178. $core.addMethod(
  2179. $core.method({
  2180. selector: "do:",
  2181. protocol: "enumerating",
  2182. //>>excludeStart("ide", pragmas.excludeIdeData);
  2183. args: ["aBlock"],
  2184. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2185. referencedClasses: [],
  2186. //>>excludeEnd("ide");
  2187. pragmas: [],
  2188. messageSends: ["valuesDo:"]
  2189. }, function ($methodClass){ return function (aBlock){
  2190. var self=this,$self=this;
  2191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2192. return $core.withContext(function($ctx1) {
  2193. //>>excludeEnd("ctx");
  2194. $self._valuesDo_(aBlock);
  2195. return self;
  2196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2197. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2198. //>>excludeEnd("ctx");
  2199. }; }),
  2200. $globals.AssociativeCollection);
  2201. $core.addMethod(
  2202. $core.method({
  2203. selector: "includes:",
  2204. protocol: "enumerating",
  2205. //>>excludeStart("ide", pragmas.excludeIdeData);
  2206. args: ["anObject"],
  2207. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2208. referencedClasses: [],
  2209. //>>excludeEnd("ide");
  2210. pragmas: [],
  2211. messageSends: ["includes:", "values"]
  2212. }, function ($methodClass){ return function (anObject){
  2213. var self=this,$self=this;
  2214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2215. return $core.withContext(function($ctx1) {
  2216. //>>excludeEnd("ctx");
  2217. return $recv($self._values())._includes_(anObject);
  2218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2219. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2220. //>>excludeEnd("ctx");
  2221. }; }),
  2222. $globals.AssociativeCollection);
  2223. $core.addMethod(
  2224. $core.method({
  2225. selector: "includesKey:",
  2226. protocol: "testing",
  2227. //>>excludeStart("ide", pragmas.excludeIdeData);
  2228. args: ["aKey"],
  2229. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2230. referencedClasses: [],
  2231. //>>excludeEnd("ide");
  2232. pragmas: [],
  2233. messageSends: ["subclassResponsibility"]
  2234. }, function ($methodClass){ return function (aKey){
  2235. var self=this,$self=this;
  2236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2237. return $core.withContext(function($ctx1) {
  2238. //>>excludeEnd("ctx");
  2239. $self._subclassResponsibility();
  2240. return self;
  2241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2242. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2243. //>>excludeEnd("ctx");
  2244. }; }),
  2245. $globals.AssociativeCollection);
  2246. $core.addMethod(
  2247. $core.method({
  2248. selector: "indexOf:ifAbsent:",
  2249. protocol: "accessing",
  2250. //>>excludeStart("ide", pragmas.excludeIdeData);
  2251. args: ["anObject", "aBlock"],
  2252. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2253. referencedClasses: [],
  2254. //>>excludeEnd("ide");
  2255. pragmas: [],
  2256. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2257. }, function ($methodClass){ return function (anObject,aBlock){
  2258. var self=this,$self=this;
  2259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2260. return $core.withContext(function($ctx1) {
  2261. //>>excludeEnd("ctx");
  2262. return $recv($self._keys())._detect_ifNone_((function(each){
  2263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2264. return $core.withContext(function($ctx2) {
  2265. //>>excludeEnd("ctx");
  2266. return $recv($self._at_(each)).__eq(anObject);
  2267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2269. //>>excludeEnd("ctx");
  2270. }),aBlock);
  2271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2272. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2273. //>>excludeEnd("ctx");
  2274. }; }),
  2275. $globals.AssociativeCollection);
  2276. $core.addMethod(
  2277. $core.method({
  2278. selector: "keyAtValue:",
  2279. protocol: "accessing",
  2280. //>>excludeStart("ide", pragmas.excludeIdeData);
  2281. args: ["anObject"],
  2282. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2283. referencedClasses: [],
  2284. //>>excludeEnd("ide");
  2285. pragmas: [],
  2286. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2287. }, function ($methodClass){ return function (anObject){
  2288. var self=this,$self=this;
  2289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2290. return $core.withContext(function($ctx1) {
  2291. //>>excludeEnd("ctx");
  2292. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2294. return $core.withContext(function($ctx2) {
  2295. //>>excludeEnd("ctx");
  2296. return $self._errorNotFound();
  2297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2298. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2299. //>>excludeEnd("ctx");
  2300. }));
  2301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2302. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2303. //>>excludeEnd("ctx");
  2304. }; }),
  2305. $globals.AssociativeCollection);
  2306. $core.addMethod(
  2307. $core.method({
  2308. selector: "keyAtValue:ifAbsent:",
  2309. protocol: "accessing",
  2310. //>>excludeStart("ide", pragmas.excludeIdeData);
  2311. args: ["anObject", "aBlock"],
  2312. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2313. referencedClasses: [],
  2314. //>>excludeEnd("ide");
  2315. pragmas: [],
  2316. messageSends: ["indexOf:ifAbsent:"]
  2317. }, function ($methodClass){ return function (anObject,aBlock){
  2318. var self=this,$self=this;
  2319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2320. return $core.withContext(function($ctx1) {
  2321. //>>excludeEnd("ctx");
  2322. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2324. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2325. //>>excludeEnd("ctx");
  2326. }; }),
  2327. $globals.AssociativeCollection);
  2328. $core.addMethod(
  2329. $core.method({
  2330. selector: "keys",
  2331. protocol: "accessing",
  2332. //>>excludeStart("ide", pragmas.excludeIdeData);
  2333. args: [],
  2334. source: "keys\x0a\x09self subclassResponsibility",
  2335. referencedClasses: [],
  2336. //>>excludeEnd("ide");
  2337. pragmas: [],
  2338. messageSends: ["subclassResponsibility"]
  2339. }, function ($methodClass){ return function (){
  2340. var self=this,$self=this;
  2341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2342. return $core.withContext(function($ctx1) {
  2343. //>>excludeEnd("ctx");
  2344. $self._subclassResponsibility();
  2345. return self;
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2348. //>>excludeEnd("ctx");
  2349. }; }),
  2350. $globals.AssociativeCollection);
  2351. $core.addMethod(
  2352. $core.method({
  2353. selector: "keysAndValuesDo:",
  2354. protocol: "enumerating",
  2355. //>>excludeStart("ide", pragmas.excludeIdeData);
  2356. args: ["aBlock"],
  2357. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2358. referencedClasses: [],
  2359. //>>excludeEnd("ide");
  2360. pragmas: [],
  2361. messageSends: ["keysDo:", "value:value:", "at:"]
  2362. }, function ($methodClass){ return function (aBlock){
  2363. var self=this,$self=this;
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. return $core.withContext(function($ctx1) {
  2366. //>>excludeEnd("ctx");
  2367. $self._keysDo_((function(each){
  2368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2369. return $core.withContext(function($ctx2) {
  2370. //>>excludeEnd("ctx");
  2371. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2374. //>>excludeEnd("ctx");
  2375. }));
  2376. return self;
  2377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2378. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2379. //>>excludeEnd("ctx");
  2380. }; }),
  2381. $globals.AssociativeCollection);
  2382. $core.addMethod(
  2383. $core.method({
  2384. selector: "keysDo:",
  2385. protocol: "enumerating",
  2386. //>>excludeStart("ide", pragmas.excludeIdeData);
  2387. args: ["aBlock"],
  2388. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2389. referencedClasses: [],
  2390. //>>excludeEnd("ide");
  2391. pragmas: [],
  2392. messageSends: ["subclassResponsibility"]
  2393. }, function ($methodClass){ return function (aBlock){
  2394. var self=this,$self=this;
  2395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2396. return $core.withContext(function($ctx1) {
  2397. //>>excludeEnd("ctx");
  2398. $self._subclassResponsibility();
  2399. return self;
  2400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2401. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2402. //>>excludeEnd("ctx");
  2403. }; }),
  2404. $globals.AssociativeCollection);
  2405. $core.addMethod(
  2406. $core.method({
  2407. selector: "printOn:",
  2408. protocol: "printing",
  2409. //>>excludeStart("ide", pragmas.excludeIdeData);
  2410. args: ["aStream"],
  2411. 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: ')'",
  2412. referencedClasses: [],
  2413. //>>excludeEnd("ide");
  2414. pragmas: [],
  2415. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2416. }, function ($methodClass){ return function (aStream){
  2417. var self=this,$self=this;
  2418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2419. return $core.withContext(function($ctx1) {
  2420. //>>excludeEnd("ctx");
  2421. [(
  2422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2423. $ctx1.supercall = true,
  2424. //>>excludeEnd("ctx");
  2425. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2427. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2428. //>>excludeEnd("ctx");
  2429. ][0];
  2430. [$recv(aStream)._nextPutAll_(" (")
  2431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2432. ,$ctx1.sendIdx["nextPutAll:"]=1
  2433. //>>excludeEnd("ctx");
  2434. ][0];
  2435. $recv($self._associations())._do_separatedBy_((function(each){
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. return $core.withContext(function($ctx2) {
  2438. //>>excludeEnd("ctx");
  2439. return $recv(each)._printOn_(aStream);
  2440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2442. //>>excludeEnd("ctx");
  2443. }),(function(){
  2444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2445. return $core.withContext(function($ctx2) {
  2446. //>>excludeEnd("ctx");
  2447. return [$recv(aStream)._nextPutAll_(" , ")
  2448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2449. ,$ctx2.sendIdx["nextPutAll:"]=2
  2450. //>>excludeEnd("ctx");
  2451. ][0];
  2452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2454. //>>excludeEnd("ctx");
  2455. }));
  2456. $recv(aStream)._nextPutAll_(")");
  2457. return self;
  2458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2459. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2460. //>>excludeEnd("ctx");
  2461. }; }),
  2462. $globals.AssociativeCollection);
  2463. $core.addMethod(
  2464. $core.method({
  2465. selector: "remove:ifAbsent:",
  2466. protocol: "adding/removing",
  2467. //>>excludeStart("ide", pragmas.excludeIdeData);
  2468. args: ["aKey", "aBlock"],
  2469. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2470. referencedClasses: [],
  2471. //>>excludeEnd("ide");
  2472. pragmas: [],
  2473. messageSends: ["removeKey:ifAbsent:"]
  2474. }, function ($methodClass){ return function (aKey,aBlock){
  2475. var self=this,$self=this;
  2476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2477. return $core.withContext(function($ctx1) {
  2478. //>>excludeEnd("ctx");
  2479. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2481. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2482. //>>excludeEnd("ctx");
  2483. }; }),
  2484. $globals.AssociativeCollection);
  2485. $core.addMethod(
  2486. $core.method({
  2487. selector: "removeAll",
  2488. protocol: "adding/removing",
  2489. //>>excludeStart("ide", pragmas.excludeIdeData);
  2490. args: [],
  2491. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2492. referencedClasses: [],
  2493. //>>excludeEnd("ide");
  2494. pragmas: [],
  2495. messageSends: ["do:", "keys", "removeKey:"]
  2496. }, function ($methodClass){ return function (){
  2497. var self=this,$self=this;
  2498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2499. return $core.withContext(function($ctx1) {
  2500. //>>excludeEnd("ctx");
  2501. return $recv($self._keys())._do_((function(each){
  2502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2503. return $core.withContext(function($ctx2) {
  2504. //>>excludeEnd("ctx");
  2505. return $self._removeKey_(each);
  2506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2508. //>>excludeEnd("ctx");
  2509. }));
  2510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2511. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2512. //>>excludeEnd("ctx");
  2513. }; }),
  2514. $globals.AssociativeCollection);
  2515. $core.addMethod(
  2516. $core.method({
  2517. selector: "removeKey:",
  2518. protocol: "adding/removing",
  2519. //>>excludeStart("ide", pragmas.excludeIdeData);
  2520. args: ["aKey"],
  2521. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2522. referencedClasses: [],
  2523. //>>excludeEnd("ide");
  2524. pragmas: [],
  2525. messageSends: ["remove:"]
  2526. }, function ($methodClass){ return function (aKey){
  2527. var self=this,$self=this;
  2528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2529. return $core.withContext(function($ctx1) {
  2530. //>>excludeEnd("ctx");
  2531. return $self._remove_(aKey);
  2532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2533. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2534. //>>excludeEnd("ctx");
  2535. }; }),
  2536. $globals.AssociativeCollection);
  2537. $core.addMethod(
  2538. $core.method({
  2539. selector: "removeKey:ifAbsent:",
  2540. protocol: "adding/removing",
  2541. //>>excludeStart("ide", pragmas.excludeIdeData);
  2542. args: ["aKey", "aBlock"],
  2543. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2544. referencedClasses: [],
  2545. //>>excludeEnd("ide");
  2546. pragmas: [],
  2547. messageSends: ["subclassResponsibility"]
  2548. }, function ($methodClass){ return function (aKey,aBlock){
  2549. var self=this,$self=this;
  2550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2551. return $core.withContext(function($ctx1) {
  2552. //>>excludeEnd("ctx");
  2553. $self._subclassResponsibility();
  2554. return self;
  2555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2556. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2557. //>>excludeEnd("ctx");
  2558. }; }),
  2559. $globals.AssociativeCollection);
  2560. $core.addMethod(
  2561. $core.method({
  2562. selector: "select:",
  2563. protocol: "enumerating",
  2564. //>>excludeStart("ide", pragmas.excludeIdeData);
  2565. args: ["aBlock"],
  2566. 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",
  2567. referencedClasses: [],
  2568. //>>excludeEnd("ide");
  2569. pragmas: [],
  2570. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2571. }, function ($methodClass){ return function (aBlock){
  2572. var self=this,$self=this;
  2573. var newDict;
  2574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2575. return $core.withContext(function($ctx1) {
  2576. //>>excludeEnd("ctx");
  2577. var $1;
  2578. newDict=$recv($self._class())._new();
  2579. $self._keysAndValuesDo_((function(key,value){
  2580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2581. return $core.withContext(function($ctx2) {
  2582. //>>excludeEnd("ctx");
  2583. $1=$recv(aBlock)._value_(value);
  2584. if($core.assert($1)){
  2585. return $recv(newDict)._at_put_(key,value);
  2586. }
  2587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2588. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2589. //>>excludeEnd("ctx");
  2590. }));
  2591. return newDict;
  2592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2593. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2594. //>>excludeEnd("ctx");
  2595. }; }),
  2596. $globals.AssociativeCollection);
  2597. $core.addMethod(
  2598. $core.method({
  2599. selector: "select:thenCollect:",
  2600. protocol: "enumerating",
  2601. //>>excludeStart("ide", pragmas.excludeIdeData);
  2602. args: ["selectBlock", "collectBlock"],
  2603. 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",
  2604. referencedClasses: [],
  2605. //>>excludeEnd("ide");
  2606. pragmas: [],
  2607. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2608. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2609. var self=this,$self=this;
  2610. var newDict;
  2611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2612. return $core.withContext(function($ctx1) {
  2613. //>>excludeEnd("ctx");
  2614. var $1;
  2615. newDict=$recv($self._class())._new();
  2616. $self._keysAndValuesDo_((function(key,value){
  2617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2618. return $core.withContext(function($ctx2) {
  2619. //>>excludeEnd("ctx");
  2620. $1=[$recv(selectBlock)._value_(value)
  2621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2622. ,$ctx2.sendIdx["value:"]=1
  2623. //>>excludeEnd("ctx");
  2624. ][0];
  2625. if($core.assert($1)){
  2626. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2627. }
  2628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2629. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2630. //>>excludeEnd("ctx");
  2631. }));
  2632. return newDict;
  2633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2634. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2635. //>>excludeEnd("ctx");
  2636. }; }),
  2637. $globals.AssociativeCollection);
  2638. $core.addMethod(
  2639. $core.method({
  2640. selector: "shallowCopy",
  2641. protocol: "copying",
  2642. //>>excludeStart("ide", pragmas.excludeIdeData);
  2643. args: [],
  2644. 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",
  2645. referencedClasses: [],
  2646. //>>excludeEnd("ide");
  2647. pragmas: [],
  2648. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2649. }, function ($methodClass){ return function (){
  2650. var self=this,$self=this;
  2651. var copy;
  2652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2653. return $core.withContext(function($ctx1) {
  2654. //>>excludeEnd("ctx");
  2655. copy=$recv($self._class())._new();
  2656. $self._keysAndValuesDo_((function(key,value){
  2657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2658. return $core.withContext(function($ctx2) {
  2659. //>>excludeEnd("ctx");
  2660. return $recv(copy)._at_put_(key,value);
  2661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2662. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2663. //>>excludeEnd("ctx");
  2664. }));
  2665. return copy;
  2666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2667. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2668. //>>excludeEnd("ctx");
  2669. }; }),
  2670. $globals.AssociativeCollection);
  2671. $core.addMethod(
  2672. $core.method({
  2673. selector: "size",
  2674. protocol: "accessing",
  2675. //>>excludeStart("ide", pragmas.excludeIdeData);
  2676. args: [],
  2677. source: "size\x0a\x09^ self keys size",
  2678. referencedClasses: [],
  2679. //>>excludeEnd("ide");
  2680. pragmas: [],
  2681. messageSends: ["size", "keys"]
  2682. }, function ($methodClass){ return function (){
  2683. var self=this,$self=this;
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. return $core.withContext(function($ctx1) {
  2686. //>>excludeEnd("ctx");
  2687. return $recv($self._keys())._size();
  2688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2689. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2690. //>>excludeEnd("ctx");
  2691. }; }),
  2692. $globals.AssociativeCollection);
  2693. $core.addMethod(
  2694. $core.method({
  2695. selector: "values",
  2696. protocol: "accessing",
  2697. //>>excludeStart("ide", pragmas.excludeIdeData);
  2698. args: [],
  2699. source: "values\x0a\x09self subclassResponsibility",
  2700. referencedClasses: [],
  2701. //>>excludeEnd("ide");
  2702. pragmas: [],
  2703. messageSends: ["subclassResponsibility"]
  2704. }, function ($methodClass){ return function (){
  2705. var self=this,$self=this;
  2706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2707. return $core.withContext(function($ctx1) {
  2708. //>>excludeEnd("ctx");
  2709. $self._subclassResponsibility();
  2710. return self;
  2711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2712. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2713. //>>excludeEnd("ctx");
  2714. }; }),
  2715. $globals.AssociativeCollection);
  2716. $core.addMethod(
  2717. $core.method({
  2718. selector: "valuesDo:",
  2719. protocol: "enumerating",
  2720. //>>excludeStart("ide", pragmas.excludeIdeData);
  2721. args: ["aBlock"],
  2722. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2723. referencedClasses: [],
  2724. //>>excludeEnd("ide");
  2725. pragmas: [],
  2726. messageSends: ["subclassResponsibility"]
  2727. }, function ($methodClass){ return function (aBlock){
  2728. var self=this,$self=this;
  2729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2730. return $core.withContext(function($ctx1) {
  2731. //>>excludeEnd("ctx");
  2732. $self._subclassResponsibility();
  2733. return self;
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2736. //>>excludeEnd("ctx");
  2737. }; }),
  2738. $globals.AssociativeCollection);
  2739. $core.addMethod(
  2740. $core.method({
  2741. selector: "withIndexDo:",
  2742. protocol: "enumerating",
  2743. //>>excludeStart("ide", pragmas.excludeIdeData);
  2744. args: ["aBlock"],
  2745. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2746. referencedClasses: [],
  2747. //>>excludeEnd("ide");
  2748. pragmas: [],
  2749. messageSends: ["keysAndValuesDo:", "value:value:"]
  2750. }, function ($methodClass){ return function (aBlock){
  2751. var self=this,$self=this;
  2752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2753. return $core.withContext(function($ctx1) {
  2754. //>>excludeEnd("ctx");
  2755. $self._keysAndValuesDo_((function(key,value){
  2756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2757. return $core.withContext(function($ctx2) {
  2758. //>>excludeEnd("ctx");
  2759. return $recv(aBlock)._value_value_(value,key);
  2760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2761. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2762. //>>excludeEnd("ctx");
  2763. }));
  2764. return self;
  2765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2766. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2767. //>>excludeEnd("ctx");
  2768. }; }),
  2769. $globals.AssociativeCollection);
  2770. $core.addMethod(
  2771. $core.method({
  2772. selector: "from:",
  2773. protocol: "instance creation",
  2774. //>>excludeStart("ide", pragmas.excludeIdeData);
  2775. args: ["aCollection"],
  2776. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2777. referencedClasses: [],
  2778. //>>excludeEnd("ide");
  2779. pragmas: [],
  2780. messageSends: ["new", "do:", "add:"]
  2781. }, function ($methodClass){ return function (aCollection){
  2782. var self=this,$self=this;
  2783. var newCollection;
  2784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2785. return $core.withContext(function($ctx1) {
  2786. //>>excludeEnd("ctx");
  2787. newCollection=$self._new();
  2788. $recv(aCollection)._do_((function(each){
  2789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2790. return $core.withContext(function($ctx2) {
  2791. //>>excludeEnd("ctx");
  2792. return $recv(newCollection)._add_(each);
  2793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2795. //>>excludeEnd("ctx");
  2796. }));
  2797. return newCollection;
  2798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2799. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2800. //>>excludeEnd("ctx");
  2801. }; }),
  2802. $globals.AssociativeCollection.a$cls);
  2803. $core.addMethod(
  2804. $core.method({
  2805. selector: "fromPairs:",
  2806. protocol: "instance creation",
  2807. //>>excludeStart("ide", pragmas.excludeIdeData);
  2808. args: ["aCollection"],
  2809. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2810. referencedClasses: [],
  2811. //>>excludeEnd("ide");
  2812. pragmas: [],
  2813. messageSends: ["from:"]
  2814. }, function ($methodClass){ return function (aCollection){
  2815. var self=this,$self=this;
  2816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2817. return $core.withContext(function($ctx1) {
  2818. //>>excludeEnd("ctx");
  2819. return $self._from_(aCollection);
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2822. //>>excludeEnd("ctx");
  2823. }; }),
  2824. $globals.AssociativeCollection.a$cls);
  2825. $core.addMethod(
  2826. $core.method({
  2827. selector: "newFromPairs:",
  2828. protocol: "instance creation",
  2829. //>>excludeStart("ide", pragmas.excludeIdeData);
  2830. args: ["aCollection"],
  2831. 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",
  2832. referencedClasses: [],
  2833. //>>excludeEnd("ide");
  2834. pragmas: [],
  2835. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2836. }, function ($methodClass){ return function (aCollection){
  2837. var self=this,$self=this;
  2838. var newCollection;
  2839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2840. return $core.withContext(function($ctx1) {
  2841. //>>excludeEnd("ctx");
  2842. var $1;
  2843. $1=$recv([$recv(aCollection)._size()
  2844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2845. ,$ctx1.sendIdx["size"]=1
  2846. //>>excludeEnd("ctx");
  2847. ][0])._even();
  2848. if(!$core.assert($1)){
  2849. $self._error_("#newFromPairs only accepts arrays of an even length");
  2850. }
  2851. newCollection=$self._new();
  2852. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2854. return $core.withContext(function($ctx2) {
  2855. //>>excludeEnd("ctx");
  2856. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2858. ,$ctx2.sendIdx["at:"]=1
  2859. //>>excludeEnd("ctx");
  2860. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2862. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2863. //>>excludeEnd("ctx");
  2864. }));
  2865. return newCollection;
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2868. //>>excludeEnd("ctx");
  2869. }; }),
  2870. $globals.AssociativeCollection.a$cls);
  2871. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2872. //>>excludeStart("ide", pragmas.excludeIdeData);
  2873. $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.";
  2874. //>>excludeEnd("ide");
  2875. $core.addMethod(
  2876. $core.method({
  2877. selector: "at:ifAbsent:",
  2878. protocol: "accessing",
  2879. //>>excludeStart("ide", pragmas.excludeIdeData);
  2880. args: ["aKey", "aBlock"],
  2881. 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'>",
  2882. referencedClasses: [],
  2883. //>>excludeEnd("ide");
  2884. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2885. messageSends: []
  2886. }, function ($methodClass){ return function (aKey,aBlock){
  2887. var self=this,$self=this;
  2888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2889. return $core.withContext(function($ctx1) {
  2890. //>>excludeEnd("ctx");
  2891. var index = $self._positionOfKey_(aKey);
  2892. return index >=0 ? $self.values[index] : aBlock._value();
  2893. ;
  2894. return self;
  2895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2896. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2897. //>>excludeEnd("ctx");
  2898. }; }),
  2899. $globals.Dictionary);
  2900. $core.addMethod(
  2901. $core.method({
  2902. selector: "at:put:",
  2903. protocol: "accessing",
  2904. //>>excludeStart("ide", pragmas.excludeIdeData);
  2905. args: ["aKey", "aValue"],
  2906. 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'>",
  2907. referencedClasses: [],
  2908. //>>excludeEnd("ide");
  2909. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self.keys;\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self.values[index] = aValue;\x0a\x09"]]],
  2910. messageSends: []
  2911. }, function ($methodClass){ return function (aKey,aValue){
  2912. var self=this,$self=this;
  2913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2914. return $core.withContext(function($ctx1) {
  2915. //>>excludeEnd("ctx");
  2916. var index = $self._positionOfKey_(aKey);
  2917. if(index === -1) {
  2918. var keys = $self.keys;
  2919. index = keys.length;
  2920. keys.push(aKey);
  2921. }
  2922. return $self.values[index] = aValue;
  2923. ;
  2924. return self;
  2925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2926. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2927. //>>excludeEnd("ctx");
  2928. }; }),
  2929. $globals.Dictionary);
  2930. $core.addMethod(
  2931. $core.method({
  2932. selector: "includesKey:",
  2933. protocol: "testing",
  2934. //>>excludeStart("ide", pragmas.excludeIdeData);
  2935. args: ["aKey"],
  2936. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2937. referencedClasses: [],
  2938. //>>excludeEnd("ide");
  2939. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2940. messageSends: []
  2941. }, function ($methodClass){ return function (aKey){
  2942. var self=this,$self=this;
  2943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2944. return $core.withContext(function($ctx1) {
  2945. //>>excludeEnd("ctx");
  2946. return $self._positionOfKey_(aKey) >= 0;;
  2947. return self;
  2948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2949. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2950. //>>excludeEnd("ctx");
  2951. }; }),
  2952. $globals.Dictionary);
  2953. $core.addMethod(
  2954. $core.method({
  2955. selector: "indexOf:ifAbsent:",
  2956. protocol: "accessing",
  2957. //>>excludeStart("ide", pragmas.excludeIdeData);
  2958. args: ["anObject", "aBlock"],
  2959. 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 ]",
  2960. referencedClasses: [],
  2961. //>>excludeEnd("ide");
  2962. pragmas: [],
  2963. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2964. }, function ($methodClass){ return function (anObject,aBlock){
  2965. var self=this,$self=this;
  2966. var index;
  2967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2968. return $core.withContext(function($ctx1) {
  2969. //>>excludeEnd("ctx");
  2970. var $1;
  2971. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2972. return (0);
  2973. }));
  2974. $1=$recv(index).__eq((0));
  2975. if($core.assert($1)){
  2976. return $recv(aBlock)._value();
  2977. } else {
  2978. return $recv($self.keys)._at_(index);
  2979. }
  2980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2981. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2982. //>>excludeEnd("ctx");
  2983. }; }),
  2984. $globals.Dictionary);
  2985. $core.addMethod(
  2986. $core.method({
  2987. selector: "initialize",
  2988. protocol: "initialization",
  2989. //>>excludeStart("ide", pragmas.excludeIdeData);
  2990. args: [],
  2991. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2992. referencedClasses: [],
  2993. //>>excludeEnd("ide");
  2994. pragmas: [],
  2995. messageSends: ["initialize"]
  2996. }, function ($methodClass){ return function (){
  2997. var self=this,$self=this;
  2998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2999. return $core.withContext(function($ctx1) {
  3000. //>>excludeEnd("ctx");
  3001. [(
  3002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3003. $ctx1.supercall = true,
  3004. //>>excludeEnd("ctx");
  3005. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  3006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3007. ,$ctx1.supercall = false
  3008. //>>excludeEnd("ctx");
  3009. ][0];
  3010. $self.keys=[];
  3011. $self.values=[];
  3012. return self;
  3013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3014. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3015. //>>excludeEnd("ctx");
  3016. }; }),
  3017. $globals.Dictionary);
  3018. $core.addMethod(
  3019. $core.method({
  3020. selector: "keys",
  3021. protocol: "accessing",
  3022. //>>excludeStart("ide", pragmas.excludeIdeData);
  3023. args: [],
  3024. source: "keys\x0a\x09^ keys copy",
  3025. referencedClasses: [],
  3026. //>>excludeEnd("ide");
  3027. pragmas: [],
  3028. messageSends: ["copy"]
  3029. }, function ($methodClass){ return function (){
  3030. var self=this,$self=this;
  3031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3032. return $core.withContext(function($ctx1) {
  3033. //>>excludeEnd("ctx");
  3034. return $recv($self.keys)._copy();
  3035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3036. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3037. //>>excludeEnd("ctx");
  3038. }; }),
  3039. $globals.Dictionary);
  3040. $core.addMethod(
  3041. $core.method({
  3042. selector: "keysAndValuesDo:",
  3043. protocol: "enumerating",
  3044. //>>excludeStart("ide", pragmas.excludeIdeData);
  3045. args: ["aBlock"],
  3046. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3047. referencedClasses: [],
  3048. //>>excludeEnd("ide");
  3049. pragmas: [],
  3050. messageSends: ["with:do:"]
  3051. }, function ($methodClass){ return function (aBlock){
  3052. var self=this,$self=this;
  3053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3054. return $core.withContext(function($ctx1) {
  3055. //>>excludeEnd("ctx");
  3056. return $recv($self.keys)._with_do_($self.values,aBlock);
  3057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3058. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3059. //>>excludeEnd("ctx");
  3060. }; }),
  3061. $globals.Dictionary);
  3062. $core.addMethod(
  3063. $core.method({
  3064. selector: "keysDo:",
  3065. protocol: "enumerating",
  3066. //>>excludeStart("ide", pragmas.excludeIdeData);
  3067. args: ["aBlock"],
  3068. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3069. referencedClasses: [],
  3070. //>>excludeEnd("ide");
  3071. pragmas: [],
  3072. messageSends: ["do:"]
  3073. }, function ($methodClass){ return function (aBlock){
  3074. var self=this,$self=this;
  3075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3076. return $core.withContext(function($ctx1) {
  3077. //>>excludeEnd("ctx");
  3078. return $recv($self.keys)._do_(aBlock);
  3079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3080. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3081. //>>excludeEnd("ctx");
  3082. }; }),
  3083. $globals.Dictionary);
  3084. $core.addMethod(
  3085. $core.method({
  3086. selector: "positionOfKey:",
  3087. protocol: "private",
  3088. //>>excludeStart("ide", pragmas.excludeIdeData);
  3089. args: ["anObject"],
  3090. 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'>",
  3091. referencedClasses: [],
  3092. //>>excludeEnd("ide");
  3093. pragmas: [["inlineJS:", ["\x0a\x09\x09var keys = $self.keys;\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09"]]],
  3094. messageSends: []
  3095. }, function ($methodClass){ return function (anObject){
  3096. var self=this,$self=this;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. return $core.withContext(function($ctx1) {
  3099. //>>excludeEnd("ctx");
  3100. var keys = $self.keys;
  3101. for(var i=0;i<keys.length;i++){
  3102. if(keys[i].__eq(anObject)) { return i;}
  3103. }
  3104. return -1;
  3105. ;
  3106. return self;
  3107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3108. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3109. //>>excludeEnd("ctx");
  3110. }; }),
  3111. $globals.Dictionary);
  3112. $core.addMethod(
  3113. $core.method({
  3114. selector: "removeAll",
  3115. protocol: "adding/removing",
  3116. //>>excludeStart("ide", pragmas.excludeIdeData);
  3117. args: [],
  3118. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3119. referencedClasses: [],
  3120. //>>excludeEnd("ide");
  3121. pragmas: [],
  3122. messageSends: ["removeAll"]
  3123. }, function ($methodClass){ return function (){
  3124. var self=this,$self=this;
  3125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3126. return $core.withContext(function($ctx1) {
  3127. //>>excludeEnd("ctx");
  3128. [$recv($self.keys)._removeAll()
  3129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3130. ,$ctx1.sendIdx["removeAll"]=1
  3131. //>>excludeEnd("ctx");
  3132. ][0];
  3133. $recv($self.values)._removeAll();
  3134. return self;
  3135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3136. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3137. //>>excludeEnd("ctx");
  3138. }; }),
  3139. $globals.Dictionary);
  3140. $core.addMethod(
  3141. $core.method({
  3142. selector: "removeKey:ifAbsent:",
  3143. protocol: "adding/removing",
  3144. //>>excludeStart("ide", pragmas.excludeIdeData);
  3145. args: ["aKey", "aBlock"],
  3146. 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'>",
  3147. referencedClasses: [],
  3148. //>>excludeEnd("ide");
  3149. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self.keys, values = $self.values;\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09"]]],
  3150. messageSends: []
  3151. }, function ($methodClass){ return function (aKey,aBlock){
  3152. var self=this,$self=this;
  3153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3154. return $core.withContext(function($ctx1) {
  3155. //>>excludeEnd("ctx");
  3156. var index = $self._positionOfKey_(aKey);
  3157. if(index === -1) {
  3158. return aBlock._value()
  3159. } else {
  3160. var keys = $self.keys, values = $self.values;
  3161. var value = values[index], l = keys.length;
  3162. keys[index] = keys[l-1];
  3163. keys.pop();
  3164. values[index] = values[l-1];
  3165. values.pop();
  3166. return value;
  3167. }
  3168. ;
  3169. return self;
  3170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3171. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3172. //>>excludeEnd("ctx");
  3173. }; }),
  3174. $globals.Dictionary);
  3175. $core.addMethod(
  3176. $core.method({
  3177. selector: "values",
  3178. protocol: "accessing",
  3179. //>>excludeStart("ide", pragmas.excludeIdeData);
  3180. args: [],
  3181. source: "values\x0a\x09^ values",
  3182. referencedClasses: [],
  3183. //>>excludeEnd("ide");
  3184. pragmas: [],
  3185. messageSends: []
  3186. }, function ($methodClass){ return function (){
  3187. var self=this,$self=this;
  3188. return $self.values;
  3189. }; }),
  3190. $globals.Dictionary);
  3191. $core.addMethod(
  3192. $core.method({
  3193. selector: "valuesDo:",
  3194. protocol: "enumerating",
  3195. //>>excludeStart("ide", pragmas.excludeIdeData);
  3196. args: ["aBlock"],
  3197. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3198. referencedClasses: [],
  3199. //>>excludeEnd("ide");
  3200. pragmas: [],
  3201. messageSends: ["do:"]
  3202. }, function ($methodClass){ return function (aBlock){
  3203. var self=this,$self=this;
  3204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3205. return $core.withContext(function($ctx1) {
  3206. //>>excludeEnd("ctx");
  3207. return $recv($self.values)._do_(aBlock);
  3208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3209. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3210. //>>excludeEnd("ctx");
  3211. }; }),
  3212. $globals.Dictionary);
  3213. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3214. //>>excludeStart("ide", pragmas.excludeIdeData);
  3215. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3216. //>>excludeEnd("ide");
  3217. $core.addMethod(
  3218. $core.method({
  3219. selector: "asJavaScriptSource",
  3220. protocol: "accessing",
  3221. //>>excludeStart("ide", pragmas.excludeIdeData);
  3222. args: [],
  3223. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str nextPut: '{'.\x0a\x09\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09str nextPutAll: key asJavaScriptSource; nextPut: ':'; nextPutAll: value asJavaScriptSource; nextPut: ',' ].\x0a\x09\x09str skip: -1; nextPut: '}' ]",
  3224. referencedClasses: ["String"],
  3225. //>>excludeEnd("ide");
  3226. pragmas: [],
  3227. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3228. }, function ($methodClass){ return function (){
  3229. var self=this,$self=this;
  3230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3231. return $core.withContext(function($ctx1) {
  3232. //>>excludeEnd("ctx");
  3233. return $recv($globals.String)._streamContents_((function(str){
  3234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3235. return $core.withContext(function($ctx2) {
  3236. //>>excludeEnd("ctx");
  3237. [$recv(str)._nextPut_("{")
  3238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3239. ,$ctx2.sendIdx["nextPut:"]=1
  3240. //>>excludeEnd("ctx");
  3241. ][0];
  3242. $self._keysAndValuesDo_((function(key,value){
  3243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3244. return $core.withContext(function($ctx3) {
  3245. //>>excludeEnd("ctx");
  3246. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3248. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3249. //>>excludeEnd("ctx");
  3250. ][0])
  3251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3252. ,$ctx3.sendIdx["nextPutAll:"]=1
  3253. //>>excludeEnd("ctx");
  3254. ][0];
  3255. [$recv(str)._nextPut_(":")
  3256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3257. ,$ctx3.sendIdx["nextPut:"]=2
  3258. //>>excludeEnd("ctx");
  3259. ][0];
  3260. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3261. return [$recv(str)._nextPut_(",")
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. ,$ctx3.sendIdx["nextPut:"]=3
  3264. //>>excludeEnd("ctx");
  3265. ][0];
  3266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3267. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3268. //>>excludeEnd("ctx");
  3269. }));
  3270. $recv(str)._skip_((-1));
  3271. return $recv(str)._nextPut_("}");
  3272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3273. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3274. //>>excludeEnd("ctx");
  3275. }));
  3276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3277. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3278. //>>excludeEnd("ctx");
  3279. }; }),
  3280. $globals.HashedCollection);
  3281. $core.addMethod(
  3282. $core.method({
  3283. selector: "at:ifAbsent:",
  3284. protocol: "accessing",
  3285. //>>excludeStart("ide", pragmas.excludeIdeData);
  3286. args: ["aKey", "aBlock"],
  3287. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3288. referencedClasses: [],
  3289. //>>excludeEnd("ide");
  3290. pragmas: [],
  3291. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3292. }, function ($methodClass){ return function (aKey,aBlock){
  3293. var self=this,$self=this;
  3294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3295. return $core.withContext(function($ctx1) {
  3296. //>>excludeEnd("ctx");
  3297. var $1;
  3298. $1=$self._includesKey_(aKey);
  3299. if($core.assert($1)){
  3300. return $self._basicAt_(aKey);
  3301. } else {
  3302. return $recv(aBlock)._value();
  3303. }
  3304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3305. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3306. //>>excludeEnd("ctx");
  3307. }; }),
  3308. $globals.HashedCollection);
  3309. $core.addMethod(
  3310. $core.method({
  3311. selector: "at:put:",
  3312. protocol: "accessing",
  3313. //>>excludeStart("ide", pragmas.excludeIdeData);
  3314. args: ["aKey", "aValue"],
  3315. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3316. referencedClasses: [],
  3317. //>>excludeEnd("ide");
  3318. pragmas: [],
  3319. messageSends: ["basicAt:put:"]
  3320. }, function ($methodClass){ return function (aKey,aValue){
  3321. var self=this,$self=this;
  3322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3323. return $core.withContext(function($ctx1) {
  3324. //>>excludeEnd("ctx");
  3325. return $self._basicAt_put_(aKey,aValue);
  3326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3327. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3328. //>>excludeEnd("ctx");
  3329. }; }),
  3330. $globals.HashedCollection);
  3331. $core.addMethod(
  3332. $core.method({
  3333. selector: "includesKey:",
  3334. protocol: "testing",
  3335. //>>excludeStart("ide", pragmas.excludeIdeData);
  3336. args: ["aKey"],
  3337. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3338. referencedClasses: [],
  3339. //>>excludeEnd("ide");
  3340. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3341. messageSends: []
  3342. }, function ($methodClass){ return function (aKey){
  3343. var self=this,$self=this;
  3344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3345. return $core.withContext(function($ctx1) {
  3346. //>>excludeEnd("ctx");
  3347. return self.hasOwnProperty(aKey);
  3348. return self;
  3349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3350. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3351. //>>excludeEnd("ctx");
  3352. }; }),
  3353. $globals.HashedCollection);
  3354. $core.addMethod(
  3355. $core.method({
  3356. selector: "keys",
  3357. protocol: "accessing",
  3358. //>>excludeStart("ide", pragmas.excludeIdeData);
  3359. args: [],
  3360. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3361. referencedClasses: [],
  3362. //>>excludeEnd("ide");
  3363. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3364. messageSends: []
  3365. }, function ($methodClass){ return function (){
  3366. var self=this,$self=this;
  3367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3368. return $core.withContext(function($ctx1) {
  3369. //>>excludeEnd("ctx");
  3370. return Object.keys(self);
  3371. return self;
  3372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3373. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3374. //>>excludeEnd("ctx");
  3375. }; }),
  3376. $globals.HashedCollection);
  3377. $core.addMethod(
  3378. $core.method({
  3379. selector: "keysDo:",
  3380. protocol: "enumerating",
  3381. //>>excludeStart("ide", pragmas.excludeIdeData);
  3382. args: ["aBlock"],
  3383. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3384. referencedClasses: [],
  3385. //>>excludeEnd("ide");
  3386. pragmas: [],
  3387. messageSends: ["do:", "keys"]
  3388. }, function ($methodClass){ return function (aBlock){
  3389. var self=this,$self=this;
  3390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3391. return $core.withContext(function($ctx1) {
  3392. //>>excludeEnd("ctx");
  3393. $recv($self._keys())._do_(aBlock);
  3394. return self;
  3395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3396. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3397. //>>excludeEnd("ctx");
  3398. }; }),
  3399. $globals.HashedCollection);
  3400. $core.addMethod(
  3401. $core.method({
  3402. selector: "removeKey:ifAbsent:",
  3403. protocol: "adding/removing",
  3404. //>>excludeStart("ide", pragmas.excludeIdeData);
  3405. args: ["aKey", "aBlock"],
  3406. 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 ]",
  3407. referencedClasses: [],
  3408. //>>excludeEnd("ide");
  3409. pragmas: [],
  3410. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3411. }, function ($methodClass){ return function (aKey,aBlock){
  3412. var self=this,$self=this;
  3413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3414. return $core.withContext(function($ctx1) {
  3415. //>>excludeEnd("ctx");
  3416. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3418. return $core.withContext(function($ctx2) {
  3419. //>>excludeEnd("ctx");
  3420. $self._basicDelete_(aKey);
  3421. return removed;
  3422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3423. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3424. //>>excludeEnd("ctx");
  3425. }),(function(){
  3426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3427. return $core.withContext(function($ctx2) {
  3428. //>>excludeEnd("ctx");
  3429. return $recv(aBlock)._value();
  3430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3432. //>>excludeEnd("ctx");
  3433. }));
  3434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3435. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3436. //>>excludeEnd("ctx");
  3437. }; }),
  3438. $globals.HashedCollection);
  3439. $core.addMethod(
  3440. $core.method({
  3441. selector: "values",
  3442. protocol: "accessing",
  3443. //>>excludeStart("ide", pragmas.excludeIdeData);
  3444. args: [],
  3445. 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'>",
  3446. referencedClasses: [],
  3447. //>>excludeEnd("ide");
  3448. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3449. messageSends: []
  3450. }, function ($methodClass){ return function (){
  3451. var self=this,$self=this;
  3452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3453. return $core.withContext(function($ctx1) {
  3454. //>>excludeEnd("ctx");
  3455. return $self._keys().map(function(key){
  3456. return $self._at_(key);
  3457. });
  3458. ;
  3459. return self;
  3460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3461. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3462. //>>excludeEnd("ctx");
  3463. }; }),
  3464. $globals.HashedCollection);
  3465. $core.addMethod(
  3466. $core.method({
  3467. selector: "valuesDo:",
  3468. protocol: "enumerating",
  3469. //>>excludeStart("ide", pragmas.excludeIdeData);
  3470. args: ["aBlock"],
  3471. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3472. referencedClasses: [],
  3473. //>>excludeEnd("ide");
  3474. pragmas: [],
  3475. messageSends: ["do:", "values"]
  3476. }, function ($methodClass){ return function (aBlock){
  3477. var self=this,$self=this;
  3478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3479. return $core.withContext(function($ctx1) {
  3480. //>>excludeEnd("ctx");
  3481. $recv($self._values())._do_(aBlock);
  3482. return self;
  3483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3484. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3485. //>>excludeEnd("ctx");
  3486. }; }),
  3487. $globals.HashedCollection);
  3488. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3489. //>>excludeStart("ide", pragmas.excludeIdeData);
  3490. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3491. //>>excludeEnd("ide");
  3492. $core.addMethod(
  3493. $core.method({
  3494. selector: "=",
  3495. protocol: "comparing",
  3496. //>>excludeStart("ide", pragmas.excludeIdeData);
  3497. args: ["aCollection"],
  3498. 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",
  3499. referencedClasses: [],
  3500. //>>excludeEnd("ide");
  3501. pragmas: [],
  3502. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3503. }, function ($methodClass){ return function (aCollection){
  3504. var self=this,$self=this;
  3505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3506. return $core.withContext(function($ctx1) {
  3507. //>>excludeEnd("ctx");
  3508. var $1,$2;
  3509. var $early={};
  3510. try {
  3511. $1=$recv([$recv([$self._class()
  3512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3513. ,$ctx1.sendIdx["class"]=1
  3514. //>>excludeEnd("ctx");
  3515. ][0]).__eq($recv(aCollection)._class())
  3516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3517. ,$ctx1.sendIdx["="]=1
  3518. //>>excludeEnd("ctx");
  3519. ][0])._and_((function(){
  3520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3521. return $core.withContext(function($ctx2) {
  3522. //>>excludeEnd("ctx");
  3523. return [$recv([$self._size()
  3524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3525. ,$ctx2.sendIdx["size"]=1
  3526. //>>excludeEnd("ctx");
  3527. ][0]).__eq($recv(aCollection)._size())
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. ,$ctx2.sendIdx["="]=2
  3530. //>>excludeEnd("ctx");
  3531. ][0];
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3534. //>>excludeEnd("ctx");
  3535. }));
  3536. if(!$core.assert($1)){
  3537. return false;
  3538. }
  3539. $self._withIndexDo_((function(each,i){
  3540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3541. return $core.withContext(function($ctx2) {
  3542. //>>excludeEnd("ctx");
  3543. $2=$recv($recv(aCollection)._at_(i)).__eq(each);
  3544. if(!$core.assert($2)){
  3545. throw $early=[false];
  3546. }
  3547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3548. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3549. //>>excludeEnd("ctx");
  3550. }));
  3551. return true;
  3552. }
  3553. catch(e) {if(e===$early)return e[0]; throw e}
  3554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3555. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3556. //>>excludeEnd("ctx");
  3557. }; }),
  3558. $globals.SequenceableCollection);
  3559. $core.addMethod(
  3560. $core.method({
  3561. selector: "addLast:",
  3562. protocol: "adding/removing",
  3563. //>>excludeStart("ide", pragmas.excludeIdeData);
  3564. args: ["anObject"],
  3565. source: "addLast: anObject\x0a\x09self add: anObject",
  3566. referencedClasses: [],
  3567. //>>excludeEnd("ide");
  3568. pragmas: [],
  3569. messageSends: ["add:"]
  3570. }, function ($methodClass){ return function (anObject){
  3571. var self=this,$self=this;
  3572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3573. return $core.withContext(function($ctx1) {
  3574. //>>excludeEnd("ctx");
  3575. $self._add_(anObject);
  3576. return self;
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3579. //>>excludeEnd("ctx");
  3580. }; }),
  3581. $globals.SequenceableCollection);
  3582. $core.addMethod(
  3583. $core.method({
  3584. selector: "allButFirst",
  3585. protocol: "accessing",
  3586. //>>excludeStart("ide", pragmas.excludeIdeData);
  3587. args: [],
  3588. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3589. referencedClasses: [],
  3590. //>>excludeEnd("ide");
  3591. pragmas: [],
  3592. messageSends: ["copyFrom:to:", "size"]
  3593. }, function ($methodClass){ return function (){
  3594. var self=this,$self=this;
  3595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3596. return $core.withContext(function($ctx1) {
  3597. //>>excludeEnd("ctx");
  3598. return $self._copyFrom_to_((2),$self._size());
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3601. //>>excludeEnd("ctx");
  3602. }; }),
  3603. $globals.SequenceableCollection);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "allButLast",
  3607. protocol: "accessing",
  3608. //>>excludeStart("ide", pragmas.excludeIdeData);
  3609. args: [],
  3610. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3611. referencedClasses: [],
  3612. //>>excludeEnd("ide");
  3613. pragmas: [],
  3614. messageSends: ["copyFrom:to:", "-", "size"]
  3615. }, function ($methodClass){ return function (){
  3616. var self=this,$self=this;
  3617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3618. return $core.withContext(function($ctx1) {
  3619. //>>excludeEnd("ctx");
  3620. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3623. //>>excludeEnd("ctx");
  3624. }; }),
  3625. $globals.SequenceableCollection);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "anyOne",
  3629. protocol: "accessing",
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: [],
  3632. source: "anyOne\x0a\x09^ self at: 1",
  3633. referencedClasses: [],
  3634. //>>excludeEnd("ide");
  3635. pragmas: [],
  3636. messageSends: ["at:"]
  3637. }, function ($methodClass){ return function (){
  3638. var self=this,$self=this;
  3639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3640. return $core.withContext(function($ctx1) {
  3641. //>>excludeEnd("ctx");
  3642. return $self._at_((1));
  3643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3644. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3645. //>>excludeEnd("ctx");
  3646. }; }),
  3647. $globals.SequenceableCollection);
  3648. $core.addMethod(
  3649. $core.method({
  3650. selector: "atRandom",
  3651. protocol: "accessing",
  3652. //>>excludeStart("ide", pragmas.excludeIdeData);
  3653. args: [],
  3654. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3655. referencedClasses: [],
  3656. //>>excludeEnd("ide");
  3657. pragmas: [],
  3658. messageSends: ["at:", "atRandom", "size"]
  3659. }, function ($methodClass){ return function (){
  3660. var self=this,$self=this;
  3661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3662. return $core.withContext(function($ctx1) {
  3663. //>>excludeEnd("ctx");
  3664. return $self._at_($recv($self._size())._atRandom());
  3665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3666. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3667. //>>excludeEnd("ctx");
  3668. }; }),
  3669. $globals.SequenceableCollection);
  3670. $core.addMethod(
  3671. $core.method({
  3672. selector: "beginsWith:",
  3673. protocol: "testing",
  3674. //>>excludeStart("ide", pragmas.excludeIdeData);
  3675. args: ["prefix"],
  3676. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3677. referencedClasses: [],
  3678. //>>excludeEnd("ide");
  3679. pragmas: [],
  3680. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3681. }, function ($methodClass){ return function (prefix){
  3682. var self=this,$self=this;
  3683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3684. return $core.withContext(function($ctx1) {
  3685. //>>excludeEnd("ctx");
  3686. var $1;
  3687. $1=$recv([$self._size()
  3688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3689. ,$ctx1.sendIdx["size"]=1
  3690. //>>excludeEnd("ctx");
  3691. ][0]).__lt([$recv(prefix)._size()
  3692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3693. ,$ctx1.sendIdx["size"]=2
  3694. //>>excludeEnd("ctx");
  3695. ][0]);
  3696. if($core.assert($1)){
  3697. return false;
  3698. }
  3699. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3701. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3702. //>>excludeEnd("ctx");
  3703. }; }),
  3704. $globals.SequenceableCollection);
  3705. $core.addMethod(
  3706. $core.method({
  3707. selector: "copyFrom:to:",
  3708. protocol: "copying",
  3709. //>>excludeStart("ide", pragmas.excludeIdeData);
  3710. args: ["anIndex", "anotherIndex"],
  3711. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3712. referencedClasses: [],
  3713. //>>excludeEnd("ide");
  3714. pragmas: [],
  3715. messageSends: ["subclassResponsibility"]
  3716. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3717. var self=this,$self=this;
  3718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3719. return $core.withContext(function($ctx1) {
  3720. //>>excludeEnd("ctx");
  3721. $self._subclassResponsibility();
  3722. return self;
  3723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3724. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3725. //>>excludeEnd("ctx");
  3726. }; }),
  3727. $globals.SequenceableCollection);
  3728. $core.addMethod(
  3729. $core.method({
  3730. selector: "copyWithFirst:",
  3731. protocol: "copying",
  3732. //>>excludeStart("ide", pragmas.excludeIdeData);
  3733. args: ["anObject"],
  3734. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3735. referencedClasses: [],
  3736. //>>excludeEnd("ide");
  3737. pragmas: [],
  3738. messageSends: ["addAll:", "with:", "class", "yourself"]
  3739. }, function ($methodClass){ return function (anObject){
  3740. var self=this,$self=this;
  3741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3742. return $core.withContext(function($ctx1) {
  3743. //>>excludeEnd("ctx");
  3744. var $1;
  3745. $1=$recv($self._class())._with_(anObject);
  3746. $recv($1)._addAll_(self);
  3747. return $recv($1)._yourself();
  3748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3749. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3750. //>>excludeEnd("ctx");
  3751. }; }),
  3752. $globals.SequenceableCollection);
  3753. $core.addMethod(
  3754. $core.method({
  3755. selector: "endsWith:",
  3756. protocol: "testing",
  3757. //>>excludeStart("ide", pragmas.excludeIdeData);
  3758. args: ["suffix"],
  3759. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3760. referencedClasses: [],
  3761. //>>excludeEnd("ide");
  3762. pragmas: [],
  3763. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3764. }, function ($methodClass){ return function (suffix){
  3765. var self=this,$self=this;
  3766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3767. return $core.withContext(function($ctx1) {
  3768. //>>excludeEnd("ctx");
  3769. var $1;
  3770. $1=$recv([$self._size()
  3771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3772. ,$ctx1.sendIdx["size"]=1
  3773. //>>excludeEnd("ctx");
  3774. ][0]).__lt([$recv(suffix)._size()
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. ,$ctx1.sendIdx["size"]=2
  3777. //>>excludeEnd("ctx");
  3778. ][0]);
  3779. if($core.assert($1)){
  3780. return false;
  3781. }
  3782. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3784. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3785. //>>excludeEnd("ctx");
  3786. }; }),
  3787. $globals.SequenceableCollection);
  3788. $core.addMethod(
  3789. $core.method({
  3790. selector: "first",
  3791. protocol: "accessing",
  3792. //>>excludeStart("ide", pragmas.excludeIdeData);
  3793. args: [],
  3794. source: "first\x0a\x09^ self at: 1",
  3795. referencedClasses: [],
  3796. //>>excludeEnd("ide");
  3797. pragmas: [],
  3798. messageSends: ["at:"]
  3799. }, function ($methodClass){ return function (){
  3800. var self=this,$self=this;
  3801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3802. return $core.withContext(function($ctx1) {
  3803. //>>excludeEnd("ctx");
  3804. return $self._at_((1));
  3805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3806. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3807. //>>excludeEnd("ctx");
  3808. }; }),
  3809. $globals.SequenceableCollection);
  3810. $core.addMethod(
  3811. $core.method({
  3812. selector: "first:",
  3813. protocol: "accessing",
  3814. //>>excludeStart("ide", pragmas.excludeIdeData);
  3815. args: ["aNumber"],
  3816. 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",
  3817. referencedClasses: [],
  3818. //>>excludeEnd("ide");
  3819. pragmas: [],
  3820. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3821. }, function ($methodClass){ return function (aNumber){
  3822. var self=this,$self=this;
  3823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3824. return $core.withContext(function($ctx1) {
  3825. //>>excludeEnd("ctx");
  3826. var $1;
  3827. $1=$recv($self._size()).__lt(aNumber);
  3828. if($core.assert($1)){
  3829. $self._error_("Invalid number of elements");
  3830. }
  3831. return $self._copyFrom_to_((1),aNumber);
  3832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3833. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3834. //>>excludeEnd("ctx");
  3835. }; }),
  3836. $globals.SequenceableCollection);
  3837. $core.addMethod(
  3838. $core.method({
  3839. selector: "fourth",
  3840. protocol: "accessing",
  3841. //>>excludeStart("ide", pragmas.excludeIdeData);
  3842. args: [],
  3843. source: "fourth\x0a\x09^ self at: 4",
  3844. referencedClasses: [],
  3845. //>>excludeEnd("ide");
  3846. pragmas: [],
  3847. messageSends: ["at:"]
  3848. }, function ($methodClass){ return function (){
  3849. var self=this,$self=this;
  3850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3851. return $core.withContext(function($ctx1) {
  3852. //>>excludeEnd("ctx");
  3853. return $self._at_((4));
  3854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3855. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3856. //>>excludeEnd("ctx");
  3857. }; }),
  3858. $globals.SequenceableCollection);
  3859. $core.addMethod(
  3860. $core.method({
  3861. selector: "includes:",
  3862. protocol: "testing",
  3863. //>>excludeStart("ide", pragmas.excludeIdeData);
  3864. args: ["anObject"],
  3865. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3866. referencedClasses: [],
  3867. //>>excludeEnd("ide");
  3868. pragmas: [],
  3869. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3870. }, function ($methodClass){ return function (anObject){
  3871. var self=this,$self=this;
  3872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3873. return $core.withContext(function($ctx1) {
  3874. //>>excludeEnd("ctx");
  3875. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3876. return nil;
  3877. })))._notNil();
  3878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3879. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3880. //>>excludeEnd("ctx");
  3881. }; }),
  3882. $globals.SequenceableCollection);
  3883. $core.addMethod(
  3884. $core.method({
  3885. selector: "indexOf:startingAt:",
  3886. protocol: "accessing",
  3887. //>>excludeStart("ide", pragmas.excludeIdeData);
  3888. args: ["anObject", "start"],
  3889. 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 ]",
  3890. referencedClasses: [],
  3891. //>>excludeEnd("ide");
  3892. pragmas: [],
  3893. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3894. }, function ($methodClass){ return function (anObject,start){
  3895. var self=this,$self=this;
  3896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3897. return $core.withContext(function($ctx1) {
  3898. //>>excludeEnd("ctx");
  3899. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3900. return (0);
  3901. }));
  3902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3903. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3904. //>>excludeEnd("ctx");
  3905. }; }),
  3906. $globals.SequenceableCollection);
  3907. $core.addMethod(
  3908. $core.method({
  3909. selector: "indexOf:startingAt:ifAbsent:",
  3910. protocol: "accessing",
  3911. //>>excludeStart("ide", pragmas.excludeIdeData);
  3912. args: ["anObject", "start", "aBlock"],
  3913. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3914. referencedClasses: [],
  3915. //>>excludeEnd("ide");
  3916. pragmas: [],
  3917. messageSends: ["subclassResponsibility"]
  3918. }, function ($methodClass){ return function (anObject,start,aBlock){
  3919. var self=this,$self=this;
  3920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3921. return $core.withContext(function($ctx1) {
  3922. //>>excludeEnd("ctx");
  3923. $self._subclassResponsibility();
  3924. return self;
  3925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3926. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3927. //>>excludeEnd("ctx");
  3928. }; }),
  3929. $globals.SequenceableCollection);
  3930. $core.addMethod(
  3931. $core.method({
  3932. selector: "last",
  3933. protocol: "accessing",
  3934. //>>excludeStart("ide", pragmas.excludeIdeData);
  3935. args: [],
  3936. source: "last\x0a\x09^ self at: self size",
  3937. referencedClasses: [],
  3938. //>>excludeEnd("ide");
  3939. pragmas: [],
  3940. messageSends: ["at:", "size"]
  3941. }, function ($methodClass){ return function (){
  3942. var self=this,$self=this;
  3943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3944. return $core.withContext(function($ctx1) {
  3945. //>>excludeEnd("ctx");
  3946. return $self._at_($self._size());
  3947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3948. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3949. //>>excludeEnd("ctx");
  3950. }; }),
  3951. $globals.SequenceableCollection);
  3952. $core.addMethod(
  3953. $core.method({
  3954. selector: "last:",
  3955. protocol: "accessing",
  3956. //>>excludeStart("ide", pragmas.excludeIdeData);
  3957. args: ["aNumber"],
  3958. 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",
  3959. referencedClasses: [],
  3960. //>>excludeEnd("ide");
  3961. pragmas: [],
  3962. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3963. }, function ($methodClass){ return function (aNumber){
  3964. var self=this,$self=this;
  3965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3966. return $core.withContext(function($ctx1) {
  3967. //>>excludeEnd("ctx");
  3968. var $1;
  3969. $1=$recv([$self._size()
  3970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3971. ,$ctx1.sendIdx["size"]=1
  3972. //>>excludeEnd("ctx");
  3973. ][0]).__lt(aNumber);
  3974. if($core.assert($1)){
  3975. $self._error_("Invalid number of elements");
  3976. }
  3977. return $self._copyFrom_to_($recv($recv([$self._size()
  3978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3979. ,$ctx1.sendIdx["size"]=2
  3980. //>>excludeEnd("ctx");
  3981. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  3982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3983. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3984. //>>excludeEnd("ctx");
  3985. }; }),
  3986. $globals.SequenceableCollection);
  3987. $core.addMethod(
  3988. $core.method({
  3989. selector: "newStream",
  3990. protocol: "streaming",
  3991. //>>excludeStart("ide", pragmas.excludeIdeData);
  3992. args: [],
  3993. source: "newStream\x0a\x09^ self streamClass on: self",
  3994. referencedClasses: [],
  3995. //>>excludeEnd("ide");
  3996. pragmas: [],
  3997. messageSends: ["on:", "streamClass"]
  3998. }, function ($methodClass){ return function (){
  3999. var self=this,$self=this;
  4000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4001. return $core.withContext(function($ctx1) {
  4002. //>>excludeEnd("ctx");
  4003. return $recv($self._streamClass())._on_(self);
  4004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4005. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  4006. //>>excludeEnd("ctx");
  4007. }; }),
  4008. $globals.SequenceableCollection);
  4009. $core.addMethod(
  4010. $core.method({
  4011. selector: "readStream",
  4012. protocol: "streaming",
  4013. //>>excludeStart("ide", pragmas.excludeIdeData);
  4014. args: [],
  4015. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4016. referencedClasses: [],
  4017. //>>excludeEnd("ide");
  4018. pragmas: [],
  4019. messageSends: ["stream"]
  4020. }, function ($methodClass){ return function (){
  4021. var self=this,$self=this;
  4022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4023. return $core.withContext(function($ctx1) {
  4024. //>>excludeEnd("ctx");
  4025. return $self._stream();
  4026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4027. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  4028. //>>excludeEnd("ctx");
  4029. }; }),
  4030. $globals.SequenceableCollection);
  4031. $core.addMethod(
  4032. $core.method({
  4033. selector: "removeLast",
  4034. protocol: "adding/removing",
  4035. //>>excludeStart("ide", pragmas.excludeIdeData);
  4036. args: [],
  4037. source: "removeLast\x0a\x09^ self remove: self last",
  4038. referencedClasses: [],
  4039. //>>excludeEnd("ide");
  4040. pragmas: [],
  4041. messageSends: ["remove:", "last"]
  4042. }, function ($methodClass){ return function (){
  4043. var self=this,$self=this;
  4044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4045. return $core.withContext(function($ctx1) {
  4046. //>>excludeEnd("ctx");
  4047. return $self._remove_($self._last());
  4048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4049. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4050. //>>excludeEnd("ctx");
  4051. }; }),
  4052. $globals.SequenceableCollection);
  4053. $core.addMethod(
  4054. $core.method({
  4055. selector: "reverseDo:",
  4056. protocol: "enumerating",
  4057. //>>excludeStart("ide", pragmas.excludeIdeData);
  4058. args: ["aBlock"],
  4059. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4060. referencedClasses: [],
  4061. //>>excludeEnd("ide");
  4062. pragmas: [],
  4063. messageSends: ["do:", "reversed"]
  4064. }, function ($methodClass){ return function (aBlock){
  4065. var self=this,$self=this;
  4066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4067. return $core.withContext(function($ctx1) {
  4068. //>>excludeEnd("ctx");
  4069. $recv($self._reversed())._do_(aBlock);
  4070. return self;
  4071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4072. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4073. //>>excludeEnd("ctx");
  4074. }; }),
  4075. $globals.SequenceableCollection);
  4076. $core.addMethod(
  4077. $core.method({
  4078. selector: "reversed",
  4079. protocol: "converting",
  4080. //>>excludeStart("ide", pragmas.excludeIdeData);
  4081. args: [],
  4082. source: "reversed\x0a\x09self subclassResponsibility",
  4083. referencedClasses: [],
  4084. //>>excludeEnd("ide");
  4085. pragmas: [],
  4086. messageSends: ["subclassResponsibility"]
  4087. }, function ($methodClass){ return function (){
  4088. var self=this,$self=this;
  4089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4090. return $core.withContext(function($ctx1) {
  4091. //>>excludeEnd("ctx");
  4092. $self._subclassResponsibility();
  4093. return self;
  4094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4095. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4096. //>>excludeEnd("ctx");
  4097. }; }),
  4098. $globals.SequenceableCollection);
  4099. $core.addMethod(
  4100. $core.method({
  4101. selector: "second",
  4102. protocol: "accessing",
  4103. //>>excludeStart("ide", pragmas.excludeIdeData);
  4104. args: [],
  4105. source: "second\x0a\x09^ self at: 2",
  4106. referencedClasses: [],
  4107. //>>excludeEnd("ide");
  4108. pragmas: [],
  4109. messageSends: ["at:"]
  4110. }, function ($methodClass){ return function (){
  4111. var self=this,$self=this;
  4112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4113. return $core.withContext(function($ctx1) {
  4114. //>>excludeEnd("ctx");
  4115. return $self._at_((2));
  4116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4117. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4118. //>>excludeEnd("ctx");
  4119. }; }),
  4120. $globals.SequenceableCollection);
  4121. $core.addMethod(
  4122. $core.method({
  4123. selector: "stream",
  4124. protocol: "streaming",
  4125. //>>excludeStart("ide", pragmas.excludeIdeData);
  4126. args: [],
  4127. source: "stream\x0a\x09^ self newStream",
  4128. referencedClasses: [],
  4129. //>>excludeEnd("ide");
  4130. pragmas: [],
  4131. messageSends: ["newStream"]
  4132. }, function ($methodClass){ return function (){
  4133. var self=this,$self=this;
  4134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4135. return $core.withContext(function($ctx1) {
  4136. //>>excludeEnd("ctx");
  4137. return $self._newStream();
  4138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4139. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4140. //>>excludeEnd("ctx");
  4141. }; }),
  4142. $globals.SequenceableCollection);
  4143. $core.addMethod(
  4144. $core.method({
  4145. selector: "streamClass",
  4146. protocol: "streaming",
  4147. //>>excludeStart("ide", pragmas.excludeIdeData);
  4148. args: [],
  4149. source: "streamClass\x0a\x09^ self class streamClass",
  4150. referencedClasses: [],
  4151. //>>excludeEnd("ide");
  4152. pragmas: [],
  4153. messageSends: ["streamClass", "class"]
  4154. }, function ($methodClass){ return function (){
  4155. var self=this,$self=this;
  4156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4157. return $core.withContext(function($ctx1) {
  4158. //>>excludeEnd("ctx");
  4159. return $recv($self._class())._streamClass();
  4160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4161. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4162. //>>excludeEnd("ctx");
  4163. }; }),
  4164. $globals.SequenceableCollection);
  4165. $core.addMethod(
  4166. $core.method({
  4167. selector: "third",
  4168. protocol: "accessing",
  4169. //>>excludeStart("ide", pragmas.excludeIdeData);
  4170. args: [],
  4171. source: "third\x0a\x09^ self at: 3",
  4172. referencedClasses: [],
  4173. //>>excludeEnd("ide");
  4174. pragmas: [],
  4175. messageSends: ["at:"]
  4176. }, function ($methodClass){ return function (){
  4177. var self=this,$self=this;
  4178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4179. return $core.withContext(function($ctx1) {
  4180. //>>excludeEnd("ctx");
  4181. return $self._at_((3));
  4182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4183. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4184. //>>excludeEnd("ctx");
  4185. }; }),
  4186. $globals.SequenceableCollection);
  4187. $core.addMethod(
  4188. $core.method({
  4189. selector: "writeStream",
  4190. protocol: "streaming",
  4191. //>>excludeStart("ide", pragmas.excludeIdeData);
  4192. args: [],
  4193. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4194. referencedClasses: [],
  4195. //>>excludeEnd("ide");
  4196. pragmas: [],
  4197. messageSends: ["stream"]
  4198. }, function ($methodClass){ return function (){
  4199. var self=this,$self=this;
  4200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4201. return $core.withContext(function($ctx1) {
  4202. //>>excludeEnd("ctx");
  4203. return $self._stream();
  4204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4205. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4206. //>>excludeEnd("ctx");
  4207. }; }),
  4208. $globals.SequenceableCollection);
  4209. $core.addMethod(
  4210. $core.method({
  4211. selector: "streamClass",
  4212. protocol: "accessing",
  4213. //>>excludeStart("ide", pragmas.excludeIdeData);
  4214. args: [],
  4215. source: "streamClass\x0a\x09\x09^ Stream",
  4216. referencedClasses: ["Stream"],
  4217. //>>excludeEnd("ide");
  4218. pragmas: [],
  4219. messageSends: []
  4220. }, function ($methodClass){ return function (){
  4221. var self=this,$self=this;
  4222. return $globals.Stream;
  4223. }; }),
  4224. $globals.SequenceableCollection.a$cls);
  4225. $core.addMethod(
  4226. $core.method({
  4227. selector: "streamContents:",
  4228. protocol: "streaming",
  4229. //>>excludeStart("ide", pragmas.excludeIdeData);
  4230. args: ["aBlock"],
  4231. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4232. referencedClasses: [],
  4233. //>>excludeEnd("ide");
  4234. pragmas: [],
  4235. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4236. }, function ($methodClass){ return function (aBlock){
  4237. var self=this,$self=this;
  4238. var stream;
  4239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4240. return $core.withContext(function($ctx1) {
  4241. //>>excludeEnd("ctx");
  4242. stream=$recv($self._streamClass())._on_($self._new());
  4243. $recv(aBlock)._value_(stream);
  4244. return $recv(stream)._contents();
  4245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4246. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4247. //>>excludeEnd("ctx");
  4248. }; }),
  4249. $globals.SequenceableCollection.a$cls);
  4250. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4251. //>>excludeStart("ide", pragmas.excludeIdeData);
  4252. $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`.";
  4253. //>>excludeEnd("ide");
  4254. $core.addMethod(
  4255. $core.method({
  4256. selector: "add:",
  4257. protocol: "adding/removing",
  4258. //>>excludeStart("ide", pragmas.excludeIdeData);
  4259. args: ["anObject"],
  4260. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4261. referencedClasses: [],
  4262. //>>excludeEnd("ide");
  4263. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4264. messageSends: []
  4265. }, function ($methodClass){ return function (anObject){
  4266. var self=this,$self=this;
  4267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4268. return $core.withContext(function($ctx1) {
  4269. //>>excludeEnd("ctx");
  4270. self.push(anObject); return anObject;;
  4271. return self;
  4272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4273. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4274. //>>excludeEnd("ctx");
  4275. }; }),
  4276. $globals.Array);
  4277. $core.addMethod(
  4278. $core.method({
  4279. selector: "addAll:",
  4280. protocol: "adding/removing",
  4281. //>>excludeStart("ide", pragmas.excludeIdeData);
  4282. args: ["aCollection"],
  4283. 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'>",
  4284. referencedClasses: [],
  4285. //>>excludeEnd("ide");
  4286. pragmas: [["inlineJS:", ["\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;"]]],
  4287. messageSends: []
  4288. }, function ($methodClass){ return function (aCollection){
  4289. var self=this,$self=this;
  4290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4291. return $core.withContext(function($ctx1) {
  4292. //>>excludeEnd("ctx");
  4293. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4294. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4295. return aCollection;;
  4296. return self;
  4297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4298. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4299. //>>excludeEnd("ctx");
  4300. }; }),
  4301. $globals.Array);
  4302. $core.addMethod(
  4303. $core.method({
  4304. selector: "addFirst:",
  4305. protocol: "adding/removing",
  4306. //>>excludeStart("ide", pragmas.excludeIdeData);
  4307. args: ["anObject"],
  4308. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4309. referencedClasses: [],
  4310. //>>excludeEnd("ide");
  4311. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4312. messageSends: []
  4313. }, function ($methodClass){ return function (anObject){
  4314. var self=this,$self=this;
  4315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4316. return $core.withContext(function($ctx1) {
  4317. //>>excludeEnd("ctx");
  4318. self.unshift(anObject); return anObject;;
  4319. return self;
  4320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4321. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4322. //>>excludeEnd("ctx");
  4323. }; }),
  4324. $globals.Array);
  4325. $core.addMethod(
  4326. $core.method({
  4327. selector: "asJavaScriptSource",
  4328. protocol: "converting",
  4329. //>>excludeStart("ide", pragmas.excludeIdeData);
  4330. args: [],
  4331. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4332. referencedClasses: [],
  4333. //>>excludeEnd("ide");
  4334. pragmas: [],
  4335. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4336. }, function ($methodClass){ return function (){
  4337. var self=this,$self=this;
  4338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4339. return $core.withContext(function($ctx1) {
  4340. //>>excludeEnd("ctx");
  4341. return [$recv("[".__comma($recv($self._collect_((function(each){
  4342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4343. return $core.withContext(function($ctx2) {
  4344. //>>excludeEnd("ctx");
  4345. return $recv(each)._asJavaScriptSource();
  4346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4348. //>>excludeEnd("ctx");
  4349. })))._join_(", "))).__comma("]")
  4350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4351. ,$ctx1.sendIdx[","]=1
  4352. //>>excludeEnd("ctx");
  4353. ][0];
  4354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4355. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4356. //>>excludeEnd("ctx");
  4357. }; }),
  4358. $globals.Array);
  4359. $core.addMethod(
  4360. $core.method({
  4361. selector: "at:put:",
  4362. protocol: "accessing",
  4363. //>>excludeStart("ide", pragmas.excludeIdeData);
  4364. args: ["anIndex", "anObject"],
  4365. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4366. referencedClasses: [],
  4367. //>>excludeEnd("ide");
  4368. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4369. messageSends: []
  4370. }, function ($methodClass){ return function (anIndex,anObject){
  4371. var self=this,$self=this;
  4372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4373. return $core.withContext(function($ctx1) {
  4374. //>>excludeEnd("ctx");
  4375. return self[anIndex - 1] = anObject;
  4376. return self;
  4377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4378. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4379. //>>excludeEnd("ctx");
  4380. }; }),
  4381. $globals.Array);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "collect:",
  4385. protocol: "enumerating",
  4386. //>>excludeStart("ide", pragmas.excludeIdeData);
  4387. args: ["aBlock"],
  4388. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4389. referencedClasses: [],
  4390. //>>excludeEnd("ide");
  4391. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4392. messageSends: []
  4393. }, function ($methodClass){ return function (aBlock){
  4394. var self=this,$self=this;
  4395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4396. return $core.withContext(function($ctx1) {
  4397. //>>excludeEnd("ctx");
  4398. return self.map(function(each) {return aBlock._value_(each)});
  4399. return self;
  4400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4401. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4402. //>>excludeEnd("ctx");
  4403. }; }),
  4404. $globals.Array);
  4405. $core.addMethod(
  4406. $core.method({
  4407. selector: "copyFrom:to:",
  4408. protocol: "copying",
  4409. //>>excludeStart("ide", pragmas.excludeIdeData);
  4410. args: ["anIndex", "anotherIndex"],
  4411. 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'>",
  4412. referencedClasses: [],
  4413. //>>excludeEnd("ide");
  4414. pragmas: [["inlineJS:", ["\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}"]]],
  4415. messageSends: []
  4416. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4417. var self=this,$self=this;
  4418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4419. return $core.withContext(function($ctx1) {
  4420. //>>excludeEnd("ctx");
  4421. if (anIndex >= 1 && anotherIndex <= self.length) {
  4422. return self.slice(anIndex - 1, anotherIndex);
  4423. } else {
  4424. self._at_(anIndex);
  4425. self._at_(self.length + 1);
  4426. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4427. };
  4428. return self;
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4431. //>>excludeEnd("ctx");
  4432. }; }),
  4433. $globals.Array);
  4434. $core.addMethod(
  4435. $core.method({
  4436. selector: "join:",
  4437. protocol: "enumerating",
  4438. //>>excludeStart("ide", pragmas.excludeIdeData);
  4439. args: ["aString"],
  4440. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4441. referencedClasses: [],
  4442. //>>excludeEnd("ide");
  4443. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4444. messageSends: []
  4445. }, function ($methodClass){ return function (aString){
  4446. var self=this,$self=this;
  4447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4448. return $core.withContext(function($ctx1) {
  4449. //>>excludeEnd("ctx");
  4450. return self.join(aString);
  4451. return self;
  4452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4453. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4454. //>>excludeEnd("ctx");
  4455. }; }),
  4456. $globals.Array);
  4457. $core.addMethod(
  4458. $core.method({
  4459. selector: "printOn:",
  4460. protocol: "printing",
  4461. //>>excludeStart("ide", pragmas.excludeIdeData);
  4462. args: ["aStream"],
  4463. 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: ')'",
  4464. referencedClasses: [],
  4465. //>>excludeEnd("ide");
  4466. pragmas: [],
  4467. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4468. }, function ($methodClass){ return function (aStream){
  4469. var self=this,$self=this;
  4470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4471. return $core.withContext(function($ctx1) {
  4472. //>>excludeEnd("ctx");
  4473. [(
  4474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4475. $ctx1.supercall = true,
  4476. //>>excludeEnd("ctx");
  4477. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4479. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4480. //>>excludeEnd("ctx");
  4481. ][0];
  4482. [$recv(aStream)._nextPutAll_(" (")
  4483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4484. ,$ctx1.sendIdx["nextPutAll:"]=1
  4485. //>>excludeEnd("ctx");
  4486. ][0];
  4487. $self._do_separatedBy_((function(each){
  4488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4489. return $core.withContext(function($ctx2) {
  4490. //>>excludeEnd("ctx");
  4491. return $recv(each)._printOn_(aStream);
  4492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4493. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4494. //>>excludeEnd("ctx");
  4495. }),(function(){
  4496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4497. return $core.withContext(function($ctx2) {
  4498. //>>excludeEnd("ctx");
  4499. return [$recv(aStream)._nextPutAll_(" ")
  4500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4501. ,$ctx2.sendIdx["nextPutAll:"]=2
  4502. //>>excludeEnd("ctx");
  4503. ][0];
  4504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4506. //>>excludeEnd("ctx");
  4507. }));
  4508. $recv(aStream)._nextPutAll_(")");
  4509. return self;
  4510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4511. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4512. //>>excludeEnd("ctx");
  4513. }; }),
  4514. $globals.Array);
  4515. $core.addMethod(
  4516. $core.method({
  4517. selector: "remove:ifAbsent:",
  4518. protocol: "adding/removing",
  4519. //>>excludeStart("ide", pragmas.excludeIdeData);
  4520. args: ["anObject", "aBlock"],
  4521. 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 ]",
  4522. referencedClasses: [],
  4523. //>>excludeEnd("ide");
  4524. pragmas: [],
  4525. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4526. }, function ($methodClass){ return function (anObject,aBlock){
  4527. var self=this,$self=this;
  4528. var index;
  4529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4530. return $core.withContext(function($ctx1) {
  4531. //>>excludeEnd("ctx");
  4532. var $1;
  4533. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4534. return (0);
  4535. }));
  4536. $1=$recv(index).__eq((0));
  4537. if($core.assert($1)){
  4538. return $recv(aBlock)._value();
  4539. } else {
  4540. $self._removeIndex_(index);
  4541. return anObject;
  4542. }
  4543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4544. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4545. //>>excludeEnd("ctx");
  4546. }; }),
  4547. $globals.Array);
  4548. $core.addMethod(
  4549. $core.method({
  4550. selector: "removeAll",
  4551. protocol: "adding/removing",
  4552. //>>excludeStart("ide", pragmas.excludeIdeData);
  4553. args: [],
  4554. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4555. referencedClasses: [],
  4556. //>>excludeEnd("ide");
  4557. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4558. messageSends: []
  4559. }, function ($methodClass){ return function (){
  4560. var self=this,$self=this;
  4561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4562. return $core.withContext(function($ctx1) {
  4563. //>>excludeEnd("ctx");
  4564. self.length = 0;
  4565. return self;
  4566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4567. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4568. //>>excludeEnd("ctx");
  4569. }; }),
  4570. $globals.Array);
  4571. $core.addMethod(
  4572. $core.method({
  4573. selector: "removeFrom:to:",
  4574. protocol: "adding/removing",
  4575. //>>excludeStart("ide", pragmas.excludeIdeData);
  4576. args: ["aNumber", "anotherNumber"],
  4577. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4578. referencedClasses: [],
  4579. //>>excludeEnd("ide");
  4580. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4581. messageSends: []
  4582. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4583. var self=this,$self=this;
  4584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4585. return $core.withContext(function($ctx1) {
  4586. //>>excludeEnd("ctx");
  4587. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4588. return self;
  4589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4590. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4591. //>>excludeEnd("ctx");
  4592. }; }),
  4593. $globals.Array);
  4594. $core.addMethod(
  4595. $core.method({
  4596. selector: "removeIndex:",
  4597. protocol: "adding/removing",
  4598. //>>excludeStart("ide", pragmas.excludeIdeData);
  4599. args: ["anInteger"],
  4600. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4601. referencedClasses: [],
  4602. //>>excludeEnd("ide");
  4603. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4604. messageSends: []
  4605. }, function ($methodClass){ return function (anInteger){
  4606. var self=this,$self=this;
  4607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4608. return $core.withContext(function($ctx1) {
  4609. //>>excludeEnd("ctx");
  4610. self.splice(anInteger - 1, 1);
  4611. return self;
  4612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4613. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4614. //>>excludeEnd("ctx");
  4615. }; }),
  4616. $globals.Array);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "removeLast",
  4620. protocol: "adding/removing",
  4621. //>>excludeStart("ide", pragmas.excludeIdeData);
  4622. args: [],
  4623. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4624. referencedClasses: [],
  4625. //>>excludeEnd("ide");
  4626. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4627. messageSends: []
  4628. }, function ($methodClass){ return function (){
  4629. var self=this,$self=this;
  4630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4631. return $core.withContext(function($ctx1) {
  4632. //>>excludeEnd("ctx");
  4633. return self.pop();;
  4634. return self;
  4635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4636. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4637. //>>excludeEnd("ctx");
  4638. }; }),
  4639. $globals.Array);
  4640. $core.addMethod(
  4641. $core.method({
  4642. selector: "reversed",
  4643. protocol: "converting",
  4644. //>>excludeStart("ide", pragmas.excludeIdeData);
  4645. args: [],
  4646. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4647. referencedClasses: [],
  4648. //>>excludeEnd("ide");
  4649. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4650. messageSends: []
  4651. }, function ($methodClass){ return function (){
  4652. var self=this,$self=this;
  4653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4654. return $core.withContext(function($ctx1) {
  4655. //>>excludeEnd("ctx");
  4656. return self.slice().reverse();
  4657. return self;
  4658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4659. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4660. //>>excludeEnd("ctx");
  4661. }; }),
  4662. $globals.Array);
  4663. $core.addMethod(
  4664. $core.method({
  4665. selector: "select:",
  4666. protocol: "enumerating",
  4667. //>>excludeStart("ide", pragmas.excludeIdeData);
  4668. args: ["aBlock"],
  4669. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4670. referencedClasses: [],
  4671. //>>excludeEnd("ide");
  4672. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4673. messageSends: []
  4674. }, function ($methodClass){ return function (aBlock){
  4675. var self=this,$self=this;
  4676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4677. return $core.withContext(function($ctx1) {
  4678. //>>excludeEnd("ctx");
  4679. return self.filter(function(each) {return aBlock._value_(each)});
  4680. return self;
  4681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4682. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4683. //>>excludeEnd("ctx");
  4684. }; }),
  4685. $globals.Array);
  4686. $core.addMethod(
  4687. $core.method({
  4688. selector: "shallowCopy",
  4689. protocol: "copying",
  4690. //>>excludeStart("ide", pragmas.excludeIdeData);
  4691. args: [],
  4692. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4693. referencedClasses: [],
  4694. //>>excludeEnd("ide");
  4695. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4696. messageSends: []
  4697. }, function ($methodClass){ return function (){
  4698. var self=this,$self=this;
  4699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4700. return $core.withContext(function($ctx1) {
  4701. //>>excludeEnd("ctx");
  4702. return self.slice();
  4703. return self;
  4704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4705. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4706. //>>excludeEnd("ctx");
  4707. }; }),
  4708. $globals.Array);
  4709. $core.addMethod(
  4710. $core.method({
  4711. selector: "sort",
  4712. protocol: "enumerating",
  4713. //>>excludeStart("ide", pragmas.excludeIdeData);
  4714. args: [],
  4715. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4716. referencedClasses: [],
  4717. //>>excludeEnd("ide");
  4718. pragmas: [],
  4719. messageSends: ["sort:", "<"]
  4720. }, function ($methodClass){ return function (){
  4721. var self=this,$self=this;
  4722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4723. return $core.withContext(function($ctx1) {
  4724. //>>excludeEnd("ctx");
  4725. return $self._sort_((function(a,b){
  4726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4727. return $core.withContext(function($ctx2) {
  4728. //>>excludeEnd("ctx");
  4729. return $recv(a).__lt(b);
  4730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4731. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4732. //>>excludeEnd("ctx");
  4733. }));
  4734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4735. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4736. //>>excludeEnd("ctx");
  4737. }; }),
  4738. $globals.Array);
  4739. $core.addMethod(
  4740. $core.method({
  4741. selector: "sort:",
  4742. protocol: "enumerating",
  4743. //>>excludeStart("ide", pragmas.excludeIdeData);
  4744. args: ["aBlock"],
  4745. 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'>",
  4746. referencedClasses: [],
  4747. //>>excludeEnd("ide");
  4748. pragmas: [["inlineJS:", ["\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09"]]],
  4749. messageSends: []
  4750. }, function ($methodClass){ return function (aBlock){
  4751. var self=this,$self=this;
  4752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4753. return $core.withContext(function($ctx1) {
  4754. //>>excludeEnd("ctx");
  4755. return self.sort(function(a, b) {
  4756. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4757. })
  4758. ;
  4759. return self;
  4760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4761. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4762. //>>excludeEnd("ctx");
  4763. }; }),
  4764. $globals.Array);
  4765. $core.addMethod(
  4766. $core.method({
  4767. selector: "sorted",
  4768. protocol: "enumerating",
  4769. //>>excludeStart("ide", pragmas.excludeIdeData);
  4770. args: [],
  4771. source: "sorted\x0a\x09^ self copy sort",
  4772. referencedClasses: [],
  4773. //>>excludeEnd("ide");
  4774. pragmas: [],
  4775. messageSends: ["sort", "copy"]
  4776. }, function ($methodClass){ return function (){
  4777. var self=this,$self=this;
  4778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4779. return $core.withContext(function($ctx1) {
  4780. //>>excludeEnd("ctx");
  4781. return $recv($self._copy())._sort();
  4782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4783. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4784. //>>excludeEnd("ctx");
  4785. }; }),
  4786. $globals.Array);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "sorted:",
  4790. protocol: "enumerating",
  4791. //>>excludeStart("ide", pragmas.excludeIdeData);
  4792. args: ["aBlock"],
  4793. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4794. referencedClasses: [],
  4795. //>>excludeEnd("ide");
  4796. pragmas: [],
  4797. messageSends: ["sort:", "copy"]
  4798. }, function ($methodClass){ return function (aBlock){
  4799. var self=this,$self=this;
  4800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4801. return $core.withContext(function($ctx1) {
  4802. //>>excludeEnd("ctx");
  4803. return $recv($self._copy())._sort_(aBlock);
  4804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4805. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4806. //>>excludeEnd("ctx");
  4807. }; }),
  4808. $globals.Array);
  4809. $core.addMethod(
  4810. $core.method({
  4811. selector: "new:",
  4812. protocol: "instance creation",
  4813. //>>excludeStart("ide", pragmas.excludeIdeData);
  4814. args: ["anInteger"],
  4815. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4816. referencedClasses: [],
  4817. //>>excludeEnd("ide");
  4818. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4819. messageSends: []
  4820. }, function ($methodClass){ return function (anInteger){
  4821. var self=this,$self=this;
  4822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4823. return $core.withContext(function($ctx1) {
  4824. //>>excludeEnd("ctx");
  4825. return new Array(anInteger);
  4826. return self;
  4827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4828. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4829. //>>excludeEnd("ctx");
  4830. }; }),
  4831. $globals.Array.a$cls);
  4832. $core.addMethod(
  4833. $core.method({
  4834. selector: "with:",
  4835. protocol: "instance creation",
  4836. //>>excludeStart("ide", pragmas.excludeIdeData);
  4837. args: ["anObject"],
  4838. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4839. referencedClasses: [],
  4840. //>>excludeEnd("ide");
  4841. pragmas: [],
  4842. messageSends: ["at:put:", "new:", "yourself"]
  4843. }, function ($methodClass){ return function (anObject){
  4844. var self=this,$self=this;
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. return $core.withContext(function($ctx1) {
  4847. //>>excludeEnd("ctx");
  4848. var $1;
  4849. $1=$self._new_((1));
  4850. $recv($1)._at_put_((1),anObject);
  4851. return $recv($1)._yourself();
  4852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4853. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4854. //>>excludeEnd("ctx");
  4855. }; }),
  4856. $globals.Array.a$cls);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "with:with:",
  4860. protocol: "instance creation",
  4861. //>>excludeStart("ide", pragmas.excludeIdeData);
  4862. args: ["anObject", "anObject2"],
  4863. 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",
  4864. referencedClasses: [],
  4865. //>>excludeEnd("ide");
  4866. pragmas: [],
  4867. messageSends: ["at:put:", "new:", "yourself"]
  4868. }, function ($methodClass){ return function (anObject,anObject2){
  4869. var self=this,$self=this;
  4870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4871. return $core.withContext(function($ctx1) {
  4872. //>>excludeEnd("ctx");
  4873. var $1;
  4874. $1=$self._new_((2));
  4875. [$recv($1)._at_put_((1),anObject)
  4876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4877. ,$ctx1.sendIdx["at:put:"]=1
  4878. //>>excludeEnd("ctx");
  4879. ][0];
  4880. $recv($1)._at_put_((2),anObject2);
  4881. return $recv($1)._yourself();
  4882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4883. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4884. //>>excludeEnd("ctx");
  4885. }; }),
  4886. $globals.Array.a$cls);
  4887. $core.addMethod(
  4888. $core.method({
  4889. selector: "with:with:with:",
  4890. protocol: "instance creation",
  4891. //>>excludeStart("ide", pragmas.excludeIdeData);
  4892. args: ["anObject", "anObject2", "anObject3"],
  4893. source: "with: anObject with: anObject2 with: anObject3\x0a\x09\x09^ (self new: 3)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09at: 3 put: anObject3;\x0a\x09\x09yourself",
  4894. referencedClasses: [],
  4895. //>>excludeEnd("ide");
  4896. pragmas: [],
  4897. messageSends: ["at:put:", "new:", "yourself"]
  4898. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4899. var self=this,$self=this;
  4900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4901. return $core.withContext(function($ctx1) {
  4902. //>>excludeEnd("ctx");
  4903. var $1;
  4904. $1=$self._new_((3));
  4905. [$recv($1)._at_put_((1),anObject)
  4906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4907. ,$ctx1.sendIdx["at:put:"]=1
  4908. //>>excludeEnd("ctx");
  4909. ][0];
  4910. [$recv($1)._at_put_((2),anObject2)
  4911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4912. ,$ctx1.sendIdx["at:put:"]=2
  4913. //>>excludeEnd("ctx");
  4914. ][0];
  4915. $recv($1)._at_put_((3),anObject3);
  4916. return $recv($1)._yourself();
  4917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4918. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4919. //>>excludeEnd("ctx");
  4920. }; }),
  4921. $globals.Array.a$cls);
  4922. $core.addMethod(
  4923. $core.method({
  4924. selector: "withAll:",
  4925. protocol: "instance creation",
  4926. //>>excludeStart("ide", pragmas.excludeIdeData);
  4927. args: ["aCollection"],
  4928. 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",
  4929. referencedClasses: [],
  4930. //>>excludeEnd("ide");
  4931. pragmas: [],
  4932. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4933. }, function ($methodClass){ return function (aCollection){
  4934. var self=this,$self=this;
  4935. var instance,index;
  4936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4937. return $core.withContext(function($ctx1) {
  4938. //>>excludeEnd("ctx");
  4939. index=(1);
  4940. instance=$self._new_($recv(aCollection)._size());
  4941. $recv(aCollection)._do_((function(each){
  4942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4943. return $core.withContext(function($ctx2) {
  4944. //>>excludeEnd("ctx");
  4945. $recv(instance)._at_put_(index,each);
  4946. index=$recv(index).__plus((1));
  4947. return index;
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4950. //>>excludeEnd("ctx");
  4951. }));
  4952. return instance;
  4953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4954. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4955. //>>excludeEnd("ctx");
  4956. }; }),
  4957. $globals.Array.a$cls);
  4958. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4959. //>>excludeStart("ide", pragmas.excludeIdeData);
  4960. $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 >> #,`";
  4961. //>>excludeEnd("ide");
  4962. $core.addMethod(
  4963. $core.method({
  4964. selector: ",",
  4965. protocol: "copying",
  4966. //>>excludeStart("ide", pragmas.excludeIdeData);
  4967. args: ["aString"],
  4968. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4969. referencedClasses: [],
  4970. //>>excludeEnd("ide");
  4971. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4972. messageSends: []
  4973. }, function ($methodClass){ return function (aString){
  4974. var self=this,$self=this;
  4975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4976. return $core.withContext(function($ctx1) {
  4977. //>>excludeEnd("ctx");
  4978. return String(self) + aString;
  4979. return self;
  4980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4981. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4982. //>>excludeEnd("ctx");
  4983. }; }),
  4984. $globals.String);
  4985. $core.addMethod(
  4986. $core.method({
  4987. selector: "<",
  4988. protocol: "comparing",
  4989. //>>excludeStart("ide", pragmas.excludeIdeData);
  4990. args: ["aString"],
  4991. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4992. referencedClasses: [],
  4993. //>>excludeEnd("ide");
  4994. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4995. messageSends: []
  4996. }, function ($methodClass){ return function (aString){
  4997. var self=this,$self=this;
  4998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4999. return $core.withContext(function($ctx1) {
  5000. //>>excludeEnd("ctx");
  5001. return String(self) < aString._asString();
  5002. return self;
  5003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5004. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5005. //>>excludeEnd("ctx");
  5006. }; }),
  5007. $globals.String);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "<=",
  5011. protocol: "comparing",
  5012. //>>excludeStart("ide", pragmas.excludeIdeData);
  5013. args: ["aString"],
  5014. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5015. referencedClasses: [],
  5016. //>>excludeEnd("ide");
  5017. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5018. messageSends: []
  5019. }, function ($methodClass){ return function (aString){
  5020. var self=this,$self=this;
  5021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5022. return $core.withContext(function($ctx1) {
  5023. //>>excludeEnd("ctx");
  5024. return String(self) <= aString._asString();
  5025. return self;
  5026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5027. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5028. //>>excludeEnd("ctx");
  5029. }; }),
  5030. $globals.String);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: "=",
  5034. protocol: "comparing",
  5035. //>>excludeStart("ide", pragmas.excludeIdeData);
  5036. args: ["aString"],
  5037. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5038. referencedClasses: [],
  5039. //>>excludeEnd("ide");
  5040. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5041. messageSends: []
  5042. }, function ($methodClass){ return function (aString){
  5043. var self=this,$self=this;
  5044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5045. return $core.withContext(function($ctx1) {
  5046. //>>excludeEnd("ctx");
  5047. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5048. return self;
  5049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5050. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5051. //>>excludeEnd("ctx");
  5052. }; }),
  5053. $globals.String);
  5054. $core.addMethod(
  5055. $core.method({
  5056. selector: "==",
  5057. protocol: "comparing",
  5058. //>>excludeStart("ide", pragmas.excludeIdeData);
  5059. args: ["aString"],
  5060. 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'>",
  5061. referencedClasses: [],
  5062. //>>excludeEnd("ide");
  5063. pragmas: [["inlineJS:", ["\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;"]]],
  5064. messageSends: []
  5065. }, function ($methodClass){ return function (aString){
  5066. var self=this,$self=this;
  5067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5068. return $core.withContext(function($ctx1) {
  5069. //>>excludeEnd("ctx");
  5070. if (typeof aString === "string") return String(self) === aString;
  5071. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5072. else return false;;
  5073. return self;
  5074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5075. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5076. //>>excludeEnd("ctx");
  5077. }; }),
  5078. $globals.String);
  5079. $core.addMethod(
  5080. $core.method({
  5081. selector: ">",
  5082. protocol: "comparing",
  5083. //>>excludeStart("ide", pragmas.excludeIdeData);
  5084. args: ["aString"],
  5085. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5086. referencedClasses: [],
  5087. //>>excludeEnd("ide");
  5088. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5089. messageSends: []
  5090. }, function ($methodClass){ return function (aString){
  5091. var self=this,$self=this;
  5092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5093. return $core.withContext(function($ctx1) {
  5094. //>>excludeEnd("ctx");
  5095. return String(self) > aString._asString();
  5096. return self;
  5097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5098. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5099. //>>excludeEnd("ctx");
  5100. }; }),
  5101. $globals.String);
  5102. $core.addMethod(
  5103. $core.method({
  5104. selector: ">=",
  5105. protocol: "comparing",
  5106. //>>excludeStart("ide", pragmas.excludeIdeData);
  5107. args: ["aString"],
  5108. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5109. referencedClasses: [],
  5110. //>>excludeEnd("ide");
  5111. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5112. messageSends: []
  5113. }, function ($methodClass){ return function (aString){
  5114. var self=this,$self=this;
  5115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5116. return $core.withContext(function($ctx1) {
  5117. //>>excludeEnd("ctx");
  5118. return String(self) >= aString._asString();
  5119. return self;
  5120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5121. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5122. //>>excludeEnd("ctx");
  5123. }; }),
  5124. $globals.String);
  5125. $core.addMethod(
  5126. $core.method({
  5127. selector: "add:",
  5128. protocol: "adding/removing",
  5129. //>>excludeStart("ide", pragmas.excludeIdeData);
  5130. args: ["anObject"],
  5131. source: "add: anObject\x0a\x09self errorReadOnly",
  5132. referencedClasses: [],
  5133. //>>excludeEnd("ide");
  5134. pragmas: [],
  5135. messageSends: ["errorReadOnly"]
  5136. }, function ($methodClass){ return function (anObject){
  5137. var self=this,$self=this;
  5138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5139. return $core.withContext(function($ctx1) {
  5140. //>>excludeEnd("ctx");
  5141. $self._errorReadOnly();
  5142. return self;
  5143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5144. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5145. //>>excludeEnd("ctx");
  5146. }; }),
  5147. $globals.String);
  5148. $core.addMethod(
  5149. $core.method({
  5150. selector: "asJavaScriptMethodName",
  5151. protocol: "converting",
  5152. //>>excludeStart("ide", pragmas.excludeIdeData);
  5153. args: [],
  5154. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5155. referencedClasses: [],
  5156. //>>excludeEnd("ide");
  5157. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5158. messageSends: []
  5159. }, function ($methodClass){ return function (){
  5160. var self=this,$self=this;
  5161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5162. return $core.withContext(function($ctx1) {
  5163. //>>excludeEnd("ctx");
  5164. return $core.st2js(self);
  5165. return self;
  5166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5167. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5168. //>>excludeEnd("ctx");
  5169. }; }),
  5170. $globals.String);
  5171. $core.addMethod(
  5172. $core.method({
  5173. selector: "asJavaScriptObject",
  5174. protocol: "converting",
  5175. //>>excludeStart("ide", pragmas.excludeIdeData);
  5176. args: [],
  5177. source: "asJavaScriptObject\x0a\x09^ self",
  5178. referencedClasses: [],
  5179. //>>excludeEnd("ide");
  5180. pragmas: [],
  5181. messageSends: []
  5182. }, function ($methodClass){ return function (){
  5183. var self=this,$self=this;
  5184. return self;
  5185. }; }),
  5186. $globals.String);
  5187. $core.addMethod(
  5188. $core.method({
  5189. selector: "asJavaScriptSource",
  5190. protocol: "converting",
  5191. //>>excludeStart("ide", pragmas.excludeIdeData);
  5192. args: [],
  5193. 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'>",
  5194. referencedClasses: [],
  5195. //>>excludeEnd("ide");
  5196. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09"]]],
  5197. messageSends: []
  5198. }, function ($methodClass){ return function (){
  5199. var self=this,$self=this;
  5200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5201. return $core.withContext(function($ctx1) {
  5202. //>>excludeEnd("ctx");
  5203. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5204. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5205. else
  5206. return "\"" + self + "\"";
  5207. ;
  5208. return self;
  5209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5210. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5211. //>>excludeEnd("ctx");
  5212. }; }),
  5213. $globals.String);
  5214. $core.addMethod(
  5215. $core.method({
  5216. selector: "asLowercase",
  5217. protocol: "converting",
  5218. //>>excludeStart("ide", pragmas.excludeIdeData);
  5219. args: [],
  5220. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5221. referencedClasses: [],
  5222. //>>excludeEnd("ide");
  5223. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5224. messageSends: []
  5225. }, function ($methodClass){ return function (){
  5226. var self=this,$self=this;
  5227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5228. return $core.withContext(function($ctx1) {
  5229. //>>excludeEnd("ctx");
  5230. return self.toLowerCase();
  5231. return self;
  5232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5233. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5234. //>>excludeEnd("ctx");
  5235. }; }),
  5236. $globals.String);
  5237. $core.addMethod(
  5238. $core.method({
  5239. selector: "asMutator",
  5240. protocol: "converting",
  5241. //>>excludeStart("ide", pragmas.excludeIdeData);
  5242. args: [],
  5243. 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",
  5244. referencedClasses: [],
  5245. //>>excludeEnd("ide");
  5246. pragmas: [],
  5247. messageSends: ["ifFalse:", "=", "last", ","]
  5248. }, function ($methodClass){ return function (){
  5249. var self=this,$self=this;
  5250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5251. return $core.withContext(function($ctx1) {
  5252. //>>excludeEnd("ctx");
  5253. var $1;
  5254. $1=$recv($self._last()).__eq(":");
  5255. if(!$core.assert($1)){
  5256. return $self.__comma(":");
  5257. }
  5258. return self;
  5259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5260. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5261. //>>excludeEnd("ctx");
  5262. }; }),
  5263. $globals.String);
  5264. $core.addMethod(
  5265. $core.method({
  5266. selector: "asNumber",
  5267. protocol: "converting",
  5268. //>>excludeStart("ide", pragmas.excludeIdeData);
  5269. args: [],
  5270. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5271. referencedClasses: [],
  5272. //>>excludeEnd("ide");
  5273. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5274. messageSends: []
  5275. }, function ($methodClass){ return function (){
  5276. var self=this,$self=this;
  5277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5278. return $core.withContext(function($ctx1) {
  5279. //>>excludeEnd("ctx");
  5280. return Number(self);
  5281. return self;
  5282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5283. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5284. //>>excludeEnd("ctx");
  5285. }; }),
  5286. $globals.String);
  5287. $core.addMethod(
  5288. $core.method({
  5289. selector: "asRegexp",
  5290. protocol: "converting",
  5291. //>>excludeStart("ide", pragmas.excludeIdeData);
  5292. args: [],
  5293. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5294. referencedClasses: ["RegularExpression"],
  5295. //>>excludeEnd("ide");
  5296. pragmas: [],
  5297. messageSends: ["fromString:"]
  5298. }, function ($methodClass){ return function (){
  5299. var self=this,$self=this;
  5300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5301. return $core.withContext(function($ctx1) {
  5302. //>>excludeEnd("ctx");
  5303. return $recv($globals.RegularExpression)._fromString_(self);
  5304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5305. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5306. //>>excludeEnd("ctx");
  5307. }; }),
  5308. $globals.String);
  5309. $core.addMethod(
  5310. $core.method({
  5311. selector: "asString",
  5312. protocol: "converting",
  5313. //>>excludeStart("ide", pragmas.excludeIdeData);
  5314. args: [],
  5315. source: "asString\x0a\x09^ self",
  5316. referencedClasses: [],
  5317. //>>excludeEnd("ide");
  5318. pragmas: [],
  5319. messageSends: []
  5320. }, function ($methodClass){ return function (){
  5321. var self=this,$self=this;
  5322. return self;
  5323. }; }),
  5324. $globals.String);
  5325. $core.addMethod(
  5326. $core.method({
  5327. selector: "asSymbol",
  5328. protocol: "converting",
  5329. //>>excludeStart("ide", pragmas.excludeIdeData);
  5330. args: [],
  5331. source: "asSymbol\x0a\x09^ self",
  5332. referencedClasses: [],
  5333. //>>excludeEnd("ide");
  5334. pragmas: [],
  5335. messageSends: []
  5336. }, function ($methodClass){ return function (){
  5337. var self=this,$self=this;
  5338. return self;
  5339. }; }),
  5340. $globals.String);
  5341. $core.addMethod(
  5342. $core.method({
  5343. selector: "asSymbolPrintOn:",
  5344. protocol: "printing",
  5345. //>>excludeStart("ide", pragmas.excludeIdeData);
  5346. args: ["aStream"],
  5347. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5348. referencedClasses: [],
  5349. //>>excludeEnd("ide");
  5350. pragmas: [],
  5351. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5352. }, function ($methodClass){ return function (aStream){
  5353. var self=this,$self=this;
  5354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5355. return $core.withContext(function($ctx1) {
  5356. //>>excludeEnd("ctx");
  5357. var $1;
  5358. $recv(aStream)._nextPutAll_("#");
  5359. $1=$recv($self._asString())._isSelector();
  5360. if($core.assert($1)){
  5361. $recv(aStream)._nextPut_(self);
  5362. } else {
  5363. $self._printOn_(aStream);
  5364. }
  5365. return self;
  5366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5367. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5368. //>>excludeEnd("ctx");
  5369. }; }),
  5370. $globals.String);
  5371. $core.addMethod(
  5372. $core.method({
  5373. selector: "asUppercase",
  5374. protocol: "converting",
  5375. //>>excludeStart("ide", pragmas.excludeIdeData);
  5376. args: [],
  5377. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5378. referencedClasses: [],
  5379. //>>excludeEnd("ide");
  5380. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5381. messageSends: []
  5382. }, function ($methodClass){ return function (){
  5383. var self=this,$self=this;
  5384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5385. return $core.withContext(function($ctx1) {
  5386. //>>excludeEnd("ctx");
  5387. return self.toUpperCase();
  5388. return self;
  5389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5390. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5391. //>>excludeEnd("ctx");
  5392. }; }),
  5393. $globals.String);
  5394. $core.addMethod(
  5395. $core.method({
  5396. selector: "asciiValue",
  5397. protocol: "accessing",
  5398. //>>excludeStart("ide", pragmas.excludeIdeData);
  5399. args: [],
  5400. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5401. referencedClasses: [],
  5402. //>>excludeEnd("ide");
  5403. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5404. messageSends: []
  5405. }, function ($methodClass){ return function (){
  5406. var self=this,$self=this;
  5407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5408. return $core.withContext(function($ctx1) {
  5409. //>>excludeEnd("ctx");
  5410. return self.charCodeAt(0);;
  5411. return self;
  5412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5413. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5414. //>>excludeEnd("ctx");
  5415. }; }),
  5416. $globals.String);
  5417. $core.addMethod(
  5418. $core.method({
  5419. selector: "at:ifAbsent:",
  5420. protocol: "accessing",
  5421. //>>excludeStart("ide", pragmas.excludeIdeData);
  5422. args: ["anIndex", "aBlock"],
  5423. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5424. referencedClasses: [],
  5425. //>>excludeEnd("ide");
  5426. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5427. messageSends: []
  5428. }, function ($methodClass){ return function (anIndex,aBlock){
  5429. var self=this,$self=this;
  5430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5431. return $core.withContext(function($ctx1) {
  5432. //>>excludeEnd("ctx");
  5433. return String(self)[anIndex - 1] || aBlock._value();
  5434. return self;
  5435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5436. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5437. //>>excludeEnd("ctx");
  5438. }; }),
  5439. $globals.String);
  5440. $core.addMethod(
  5441. $core.method({
  5442. selector: "at:ifPresent:ifAbsent:",
  5443. protocol: "accessing",
  5444. //>>excludeStart("ide", pragmas.excludeIdeData);
  5445. args: ["anIndex", "aBlock", "anotherBlock"],
  5446. 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'>",
  5447. referencedClasses: [],
  5448. //>>excludeEnd("ide");
  5449. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5450. messageSends: []
  5451. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5452. var self=this,$self=this;
  5453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5454. return $core.withContext(function($ctx1) {
  5455. //>>excludeEnd("ctx");
  5456. var result = String(self)[anIndex - 1];
  5457. return result ? aBlock._value_(result) : anotherBlock._value();
  5458. ;
  5459. return self;
  5460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5461. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5462. //>>excludeEnd("ctx");
  5463. }; }),
  5464. $globals.String);
  5465. $core.addMethod(
  5466. $core.method({
  5467. selector: "at:put:",
  5468. protocol: "accessing",
  5469. //>>excludeStart("ide", pragmas.excludeIdeData);
  5470. args: ["anIndex", "anObject"],
  5471. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5472. referencedClasses: [],
  5473. //>>excludeEnd("ide");
  5474. pragmas: [],
  5475. messageSends: ["errorReadOnly"]
  5476. }, function ($methodClass){ return function (anIndex,anObject){
  5477. var self=this,$self=this;
  5478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5479. return $core.withContext(function($ctx1) {
  5480. //>>excludeEnd("ctx");
  5481. $self._errorReadOnly();
  5482. return self;
  5483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5484. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5485. //>>excludeEnd("ctx");
  5486. }; }),
  5487. $globals.String);
  5488. $core.addMethod(
  5489. $core.method({
  5490. selector: "capitalized",
  5491. protocol: "converting",
  5492. //>>excludeStart("ide", pragmas.excludeIdeData);
  5493. args: [],
  5494. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5495. referencedClasses: [],
  5496. //>>excludeEnd("ide");
  5497. pragmas: [],
  5498. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5499. }, function ($methodClass){ return function (){
  5500. var self=this,$self=this;
  5501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5502. return $core.withContext(function($ctx1) {
  5503. //>>excludeEnd("ctx");
  5504. return $self._ifNotEmpty_((function(){
  5505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5506. return $core.withContext(function($ctx2) {
  5507. //>>excludeEnd("ctx");
  5508. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5510. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5511. //>>excludeEnd("ctx");
  5512. }));
  5513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5514. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5515. //>>excludeEnd("ctx");
  5516. }; }),
  5517. $globals.String);
  5518. $core.addMethod(
  5519. $core.method({
  5520. selector: "charCodeAt:",
  5521. protocol: "accessing",
  5522. //>>excludeStart("ide", pragmas.excludeIdeData);
  5523. args: ["anInteger"],
  5524. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5525. referencedClasses: [],
  5526. //>>excludeEnd("ide");
  5527. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5528. messageSends: []
  5529. }, function ($methodClass){ return function (anInteger){
  5530. var self=this,$self=this;
  5531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5532. return $core.withContext(function($ctx1) {
  5533. //>>excludeEnd("ctx");
  5534. return self.charCodeAt(anInteger - 1);
  5535. return self;
  5536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5537. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5538. //>>excludeEnd("ctx");
  5539. }; }),
  5540. $globals.String);
  5541. $core.addMethod(
  5542. $core.method({
  5543. selector: "copyFrom:to:",
  5544. protocol: "copying",
  5545. //>>excludeStart("ide", pragmas.excludeIdeData);
  5546. args: ["anIndex", "anotherIndex"],
  5547. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5548. referencedClasses: [],
  5549. //>>excludeEnd("ide");
  5550. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5551. messageSends: []
  5552. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5553. var self=this,$self=this;
  5554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5555. return $core.withContext(function($ctx1) {
  5556. //>>excludeEnd("ctx");
  5557. return self.substring(anIndex - 1, anotherIndex);
  5558. return self;
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5561. //>>excludeEnd("ctx");
  5562. }; }),
  5563. $globals.String);
  5564. $core.addMethod(
  5565. $core.method({
  5566. selector: "copyWithFirst:",
  5567. protocol: "copying",
  5568. //>>excludeStart("ide", pragmas.excludeIdeData);
  5569. args: ["anObject"],
  5570. source: "copyWithFirst: anObject\x0a\x09(anObject isString and: [ anObject size = 1 ]) \x22character is one-char string in JS\x22\x0a\x09\x09ifFalse: [ self error: 'Cannot put ', anObject class name, ' in a String' ].\x0a\x09^ anObject, self",
  5571. referencedClasses: [],
  5572. //>>excludeEnd("ide");
  5573. pragmas: [],
  5574. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5575. }, function ($methodClass){ return function (anObject){
  5576. var self=this,$self=this;
  5577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5578. return $core.withContext(function($ctx1) {
  5579. //>>excludeEnd("ctx");
  5580. var $1;
  5581. $1=$recv($recv(anObject)._isString())._and_((function(){
  5582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5583. return $core.withContext(function($ctx2) {
  5584. //>>excludeEnd("ctx");
  5585. return $recv($recv(anObject)._size()).__eq((1));
  5586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5588. //>>excludeEnd("ctx");
  5589. }));
  5590. if(!$core.assert($1)){
  5591. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5593. ,$ctx1.sendIdx[","]=2
  5594. //>>excludeEnd("ctx");
  5595. ][0]).__comma(" in a String")
  5596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5597. ,$ctx1.sendIdx[","]=1
  5598. //>>excludeEnd("ctx");
  5599. ][0]);
  5600. }
  5601. return $recv(anObject).__comma(self);
  5602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5603. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5604. //>>excludeEnd("ctx");
  5605. }; }),
  5606. $globals.String);
  5607. $core.addMethod(
  5608. $core.method({
  5609. selector: "crlfSanitized",
  5610. protocol: "converting",
  5611. //>>excludeStart("ide", pragmas.excludeIdeData);
  5612. args: [],
  5613. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5614. referencedClasses: ["String"],
  5615. //>>excludeEnd("ide");
  5616. pragmas: [],
  5617. messageSends: ["join:", "lines", "lf"]
  5618. }, function ($methodClass){ return function (){
  5619. var self=this,$self=this;
  5620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5621. return $core.withContext(function($ctx1) {
  5622. //>>excludeEnd("ctx");
  5623. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5625. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5626. //>>excludeEnd("ctx");
  5627. }; }),
  5628. $globals.String);
  5629. $core.addMethod(
  5630. $core.method({
  5631. selector: "deepCopy",
  5632. protocol: "copying",
  5633. //>>excludeStart("ide", pragmas.excludeIdeData);
  5634. args: [],
  5635. source: "deepCopy\x0a\x09^ self shallowCopy",
  5636. referencedClasses: [],
  5637. //>>excludeEnd("ide");
  5638. pragmas: [],
  5639. messageSends: ["shallowCopy"]
  5640. }, function ($methodClass){ return function (){
  5641. var self=this,$self=this;
  5642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5643. return $core.withContext(function($ctx1) {
  5644. //>>excludeEnd("ctx");
  5645. return $self._shallowCopy();
  5646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5647. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5648. //>>excludeEnd("ctx");
  5649. }; }),
  5650. $globals.String);
  5651. $core.addMethod(
  5652. $core.method({
  5653. selector: "errorReadOnly",
  5654. protocol: "error handling",
  5655. //>>excludeStart("ide", pragmas.excludeIdeData);
  5656. args: [],
  5657. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5658. referencedClasses: [],
  5659. //>>excludeEnd("ide");
  5660. pragmas: [],
  5661. messageSends: ["error:"]
  5662. }, function ($methodClass){ return function (){
  5663. var self=this,$self=this;
  5664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5665. return $core.withContext(function($ctx1) {
  5666. //>>excludeEnd("ctx");
  5667. $self._error_("Object is read-only");
  5668. return self;
  5669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5670. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5671. //>>excludeEnd("ctx");
  5672. }; }),
  5673. $globals.String);
  5674. $core.addMethod(
  5675. $core.method({
  5676. selector: "escaped",
  5677. protocol: "converting",
  5678. //>>excludeStart("ide", pragmas.excludeIdeData);
  5679. args: [],
  5680. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5681. referencedClasses: [],
  5682. //>>excludeEnd("ide");
  5683. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5684. messageSends: []
  5685. }, function ($methodClass){ return function (){
  5686. var self=this,$self=this;
  5687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5688. return $core.withContext(function($ctx1) {
  5689. //>>excludeEnd("ctx");
  5690. return escape(self);
  5691. return self;
  5692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5693. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5694. //>>excludeEnd("ctx");
  5695. }; }),
  5696. $globals.String);
  5697. $core.addMethod(
  5698. $core.method({
  5699. selector: "includesSubString:",
  5700. protocol: "testing",
  5701. //>>excludeStart("ide", pragmas.excludeIdeData);
  5702. args: ["subString"],
  5703. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5704. referencedClasses: [],
  5705. //>>excludeEnd("ide");
  5706. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5707. messageSends: []
  5708. }, function ($methodClass){ return function (subString){
  5709. var self=this,$self=this;
  5710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5711. return $core.withContext(function($ctx1) {
  5712. //>>excludeEnd("ctx");
  5713. return self.indexOf(subString) != -1;
  5714. return self;
  5715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5716. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5717. //>>excludeEnd("ctx");
  5718. }; }),
  5719. $globals.String);
  5720. $core.addMethod(
  5721. $core.method({
  5722. selector: "isCapitalized",
  5723. protocol: "testing",
  5724. //>>excludeStart("ide", pragmas.excludeIdeData);
  5725. args: [],
  5726. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5727. referencedClasses: [],
  5728. //>>excludeEnd("ide");
  5729. pragmas: [],
  5730. messageSends: ["==", "asUppercase", "first"]
  5731. }, function ($methodClass){ return function (){
  5732. var self=this,$self=this;
  5733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5734. return $core.withContext(function($ctx1) {
  5735. //>>excludeEnd("ctx");
  5736. return $recv($recv([$self._first()
  5737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5738. ,$ctx1.sendIdx["first"]=1
  5739. //>>excludeEnd("ctx");
  5740. ][0])._asUppercase()).__eq_eq($self._first());
  5741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5742. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5743. //>>excludeEnd("ctx");
  5744. }; }),
  5745. $globals.String);
  5746. $core.addMethod(
  5747. $core.method({
  5748. selector: "isImmutable",
  5749. protocol: "testing",
  5750. //>>excludeStart("ide", pragmas.excludeIdeData);
  5751. args: [],
  5752. source: "isImmutable\x0a\x09^ true",
  5753. referencedClasses: [],
  5754. //>>excludeEnd("ide");
  5755. pragmas: [],
  5756. messageSends: []
  5757. }, function ($methodClass){ return function (){
  5758. var self=this,$self=this;
  5759. return true;
  5760. }; }),
  5761. $globals.String);
  5762. $core.addMethod(
  5763. $core.method({
  5764. selector: "isSelector",
  5765. protocol: "testing",
  5766. //>>excludeStart("ide", pragmas.excludeIdeData);
  5767. args: [],
  5768. 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>",
  5769. referencedClasses: [],
  5770. //>>excludeEnd("ide");
  5771. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5772. messageSends: []
  5773. }, function ($methodClass){ return function (){
  5774. var self=this,$self=this;
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. return $core.withContext(function($ctx1) {
  5777. //>>excludeEnd("ctx");
  5778. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5779. return self;
  5780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5781. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5782. //>>excludeEnd("ctx");
  5783. }; }),
  5784. $globals.String);
  5785. $core.addMethod(
  5786. $core.method({
  5787. selector: "isString",
  5788. protocol: "testing",
  5789. //>>excludeStart("ide", pragmas.excludeIdeData);
  5790. args: [],
  5791. source: "isString\x0a\x09^ true",
  5792. referencedClasses: [],
  5793. //>>excludeEnd("ide");
  5794. pragmas: [],
  5795. messageSends: []
  5796. }, function ($methodClass){ return function (){
  5797. var self=this,$self=this;
  5798. return true;
  5799. }; }),
  5800. $globals.String);
  5801. $core.addMethod(
  5802. $core.method({
  5803. selector: "isVowel",
  5804. protocol: "testing",
  5805. //>>excludeStart("ide", pragmas.excludeIdeData);
  5806. args: [],
  5807. 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 ]",
  5808. referencedClasses: [],
  5809. //>>excludeEnd("ide");
  5810. pragmas: [],
  5811. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5812. }, function ($methodClass){ return function (){
  5813. var self=this,$self=this;
  5814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5815. return $core.withContext(function($ctx1) {
  5816. //>>excludeEnd("ctx");
  5817. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5819. return $core.withContext(function($ctx2) {
  5820. //>>excludeEnd("ctx");
  5821. return "aeiou"._includes_($self._asLowercase());
  5822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5824. //>>excludeEnd("ctx");
  5825. }));
  5826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5827. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5828. //>>excludeEnd("ctx");
  5829. }; }),
  5830. $globals.String);
  5831. $core.addMethod(
  5832. $core.method({
  5833. selector: "join:",
  5834. protocol: "split join",
  5835. //>>excludeStart("ide", pragmas.excludeIdeData);
  5836. args: ["aCollection"],
  5837. 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 ]]",
  5838. referencedClasses: ["String"],
  5839. //>>excludeEnd("ide");
  5840. pragmas: [],
  5841. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5842. }, function ($methodClass){ return function (aCollection){
  5843. var self=this,$self=this;
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. return $core.withContext(function($ctx1) {
  5846. //>>excludeEnd("ctx");
  5847. return $recv($globals.String)._streamContents_((function(stream){
  5848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5849. return $core.withContext(function($ctx2) {
  5850. //>>excludeEnd("ctx");
  5851. return $recv(aCollection)._do_separatedBy_((function(each){
  5852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5853. return $core.withContext(function($ctx3) {
  5854. //>>excludeEnd("ctx");
  5855. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  5856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5857. ,$ctx3.sendIdx["nextPutAll:"]=1
  5858. //>>excludeEnd("ctx");
  5859. ][0];
  5860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5861. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5862. //>>excludeEnd("ctx");
  5863. }),(function(){
  5864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5865. return $core.withContext(function($ctx3) {
  5866. //>>excludeEnd("ctx");
  5867. return $recv(stream)._nextPutAll_(self);
  5868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5869. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5870. //>>excludeEnd("ctx");
  5871. }));
  5872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5873. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5874. //>>excludeEnd("ctx");
  5875. }));
  5876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5877. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5878. //>>excludeEnd("ctx");
  5879. }; }),
  5880. $globals.String);
  5881. $core.addMethod(
  5882. $core.method({
  5883. selector: "lineIndicesDo:",
  5884. protocol: "split join",
  5885. //>>excludeStart("ide", pragmas.excludeIdeData);
  5886. args: ["aBlock"],
  5887. 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 ] ]]",
  5888. referencedClasses: ["String"],
  5889. //>>excludeEnd("ide");
  5890. pragmas: [],
  5891. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5892. }, function ($methodClass){ return function (aBlock){
  5893. var self=this,$self=this;
  5894. var cr,lf,start,sz,nextLF,nextCR;
  5895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5896. return $core.withContext(function($ctx1) {
  5897. //>>excludeEnd("ctx");
  5898. var $1,$2,$3;
  5899. var $early={};
  5900. try {
  5901. start=(1);
  5902. sz=$self._size();
  5903. cr=$recv($globals.String)._cr();
  5904. nextCR=[$self._indexOf_startingAt_(cr,(1))
  5905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5906. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  5907. //>>excludeEnd("ctx");
  5908. ][0];
  5909. lf=$recv($globals.String)._lf();
  5910. nextLF=[$self._indexOf_startingAt_(lf,(1))
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  5913. //>>excludeEnd("ctx");
  5914. ][0];
  5915. $recv((function(){
  5916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5917. return $core.withContext(function($ctx2) {
  5918. //>>excludeEnd("ctx");
  5919. return $recv(start).__lt_eq(sz);
  5920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5921. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5922. //>>excludeEnd("ctx");
  5923. }))._whileTrue_((function(){
  5924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5925. return $core.withContext(function($ctx2) {
  5926. //>>excludeEnd("ctx");
  5927. $1=[$recv([$recv(nextLF).__eq((0))
  5928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5929. ,$ctx2.sendIdx["="]=1
  5930. //>>excludeEnd("ctx");
  5931. ][0])._and_((function(){
  5932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5933. return $core.withContext(function($ctx3) {
  5934. //>>excludeEnd("ctx");
  5935. return [$recv(nextCR).__eq((0))
  5936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5937. ,$ctx3.sendIdx["="]=2
  5938. //>>excludeEnd("ctx");
  5939. ][0];
  5940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5941. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5942. //>>excludeEnd("ctx");
  5943. }))
  5944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5945. ,$ctx2.sendIdx["and:"]=1
  5946. //>>excludeEnd("ctx");
  5947. ][0];
  5948. if($core.assert($1)){
  5949. [$recv(aBlock)._value_value_value_(start,sz,sz)
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. ,$ctx2.sendIdx["value:value:value:"]=1
  5952. //>>excludeEnd("ctx");
  5953. ][0];
  5954. throw $early=[self];
  5955. }
  5956. $2=$recv([$recv(nextCR).__eq((0))
  5957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5958. ,$ctx2.sendIdx["="]=3
  5959. //>>excludeEnd("ctx");
  5960. ][0])._or_((function(){
  5961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5962. return $core.withContext(function($ctx3) {
  5963. //>>excludeEnd("ctx");
  5964. return $recv([(0).__lt(nextLF)
  5965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5966. ,$ctx3.sendIdx["<"]=1
  5967. //>>excludeEnd("ctx");
  5968. ][0])._and_((function(){
  5969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5970. return $core.withContext(function($ctx4) {
  5971. //>>excludeEnd("ctx");
  5972. return $recv(nextLF).__lt(nextCR);
  5973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5974. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5975. //>>excludeEnd("ctx");
  5976. }));
  5977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5978. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5979. //>>excludeEnd("ctx");
  5980. }));
  5981. if($core.assert($2)){
  5982. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. ,$ctx2.sendIdx["-"]=1
  5985. //>>excludeEnd("ctx");
  5986. ][0],nextLF)
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. ,$ctx2.sendIdx["value:value:value:"]=2
  5989. //>>excludeEnd("ctx");
  5990. ][0];
  5991. start=[(1).__plus(nextLF)
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. ,$ctx2.sendIdx["+"]=1
  5994. //>>excludeEnd("ctx");
  5995. ][0];
  5996. nextLF=[$self._indexOf_startingAt_(lf,start)
  5997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5998. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  5999. //>>excludeEnd("ctx");
  6000. ][0];
  6001. return nextLF;
  6002. } else {
  6003. $3=$recv([(1).__plus(nextCR)
  6004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6005. ,$ctx2.sendIdx["+"]=2
  6006. //>>excludeEnd("ctx");
  6007. ][0]).__eq(nextLF);
  6008. if($core.assert($3)){
  6009. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  6010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6011. ,$ctx2.sendIdx["-"]=2
  6012. //>>excludeEnd("ctx");
  6013. ][0],nextLF)
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. ,$ctx2.sendIdx["value:value:value:"]=3
  6016. //>>excludeEnd("ctx");
  6017. ][0];
  6018. start=[(1).__plus(nextLF)
  6019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6020. ,$ctx2.sendIdx["+"]=3
  6021. //>>excludeEnd("ctx");
  6022. ][0];
  6023. nextCR=[$self._indexOf_startingAt_(cr,start)
  6024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6025. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  6026. //>>excludeEnd("ctx");
  6027. ][0];
  6028. nextLF=[$self._indexOf_startingAt_(lf,start)
  6029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6030. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  6031. //>>excludeEnd("ctx");
  6032. ][0];
  6033. return nextLF;
  6034. } else {
  6035. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6036. start=(1).__plus(nextCR);
  6037. nextCR=$self._indexOf_startingAt_(cr,start);
  6038. return nextCR;
  6039. }
  6040. }
  6041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6043. //>>excludeEnd("ctx");
  6044. }));
  6045. return self;
  6046. }
  6047. catch(e) {if(e===$early)return e[0]; throw e}
  6048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6049. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6050. //>>excludeEnd("ctx");
  6051. }; }),
  6052. $globals.String);
  6053. $core.addMethod(
  6054. $core.method({
  6055. selector: "lineNumber:",
  6056. protocol: "split join",
  6057. //>>excludeStart("ide", pragmas.excludeIdeData);
  6058. args: ["anIndex"],
  6059. 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",
  6060. referencedClasses: [],
  6061. //>>excludeEnd("ide");
  6062. pragmas: [],
  6063. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6064. }, function ($methodClass){ return function (anIndex){
  6065. var self=this,$self=this;
  6066. var lineCount;
  6067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6068. return $core.withContext(function($ctx1) {
  6069. //>>excludeEnd("ctx");
  6070. var $1,$2;
  6071. var $early={};
  6072. try {
  6073. lineCount=(0);
  6074. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6076. return $core.withContext(function($ctx2) {
  6077. //>>excludeEnd("ctx");
  6078. lineCount=$recv(lineCount).__plus((1));
  6079. $1=lineCount;
  6080. $2=$recv($1).__eq(anIndex);
  6081. if($core.assert($2)){
  6082. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6083. }
  6084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6085. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6086. //>>excludeEnd("ctx");
  6087. }));
  6088. return nil;
  6089. }
  6090. catch(e) {if(e===$early)return e[0]; throw e}
  6091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6092. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6093. //>>excludeEnd("ctx");
  6094. }; }),
  6095. $globals.String);
  6096. $core.addMethod(
  6097. $core.method({
  6098. selector: "lines",
  6099. protocol: "split join",
  6100. //>>excludeStart("ide", pragmas.excludeIdeData);
  6101. args: [],
  6102. 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'>",
  6103. referencedClasses: [],
  6104. //>>excludeEnd("ide");
  6105. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6106. messageSends: []
  6107. }, function ($methodClass){ return function (){
  6108. var self=this,$self=this;
  6109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6110. return $core.withContext(function($ctx1) {
  6111. //>>excludeEnd("ctx");
  6112. var result = self.split(/\r\n|\r|\n/);
  6113. if (!result[result.length-1]) result.pop();
  6114. return result;;
  6115. return self;
  6116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6117. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6118. //>>excludeEnd("ctx");
  6119. }; }),
  6120. $globals.String);
  6121. $core.addMethod(
  6122. $core.method({
  6123. selector: "linesDo:",
  6124. protocol: "split join",
  6125. //>>excludeStart("ide", pragmas.excludeIdeData);
  6126. args: ["aBlock"],
  6127. 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",
  6128. referencedClasses: [],
  6129. //>>excludeEnd("ide");
  6130. pragmas: [],
  6131. messageSends: ["do:", "lines"]
  6132. }, function ($methodClass){ return function (aBlock){
  6133. var self=this,$self=this;
  6134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6135. return $core.withContext(function($ctx1) {
  6136. //>>excludeEnd("ctx");
  6137. $recv($self._lines())._do_(aBlock);
  6138. return self;
  6139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6140. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6141. //>>excludeEnd("ctx");
  6142. }; }),
  6143. $globals.String);
  6144. $core.addMethod(
  6145. $core.method({
  6146. selector: "match:",
  6147. protocol: "regular expressions",
  6148. //>>excludeStart("ide", pragmas.excludeIdeData);
  6149. args: ["aRegexp"],
  6150. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6151. referencedClasses: [],
  6152. //>>excludeEnd("ide");
  6153. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6154. messageSends: []
  6155. }, function ($methodClass){ return function (aRegexp){
  6156. var self=this,$self=this;
  6157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6158. return $core.withContext(function($ctx1) {
  6159. //>>excludeEnd("ctx");
  6160. return self.search(aRegexp) != -1;
  6161. return self;
  6162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6163. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6164. //>>excludeEnd("ctx");
  6165. }; }),
  6166. $globals.String);
  6167. $core.addMethod(
  6168. $core.method({
  6169. selector: "matchesOf:",
  6170. protocol: "regular expressions",
  6171. //>>excludeStart("ide", pragmas.excludeIdeData);
  6172. args: ["aRegularExpression"],
  6173. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6174. referencedClasses: [],
  6175. //>>excludeEnd("ide");
  6176. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6177. messageSends: []
  6178. }, function ($methodClass){ return function (aRegularExpression){
  6179. var self=this,$self=this;
  6180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6181. return $core.withContext(function($ctx1) {
  6182. //>>excludeEnd("ctx");
  6183. return self.match(aRegularExpression);
  6184. return self;
  6185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6186. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6187. //>>excludeEnd("ctx");
  6188. }; }),
  6189. $globals.String);
  6190. $core.addMethod(
  6191. $core.method({
  6192. selector: "printNl",
  6193. protocol: "printing",
  6194. //>>excludeStart("ide", pragmas.excludeIdeData);
  6195. args: [],
  6196. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6197. referencedClasses: [],
  6198. //>>excludeEnd("ide");
  6199. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6200. messageSends: []
  6201. }, function ($methodClass){ return function (){
  6202. var self=this,$self=this;
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. return $core.withContext(function($ctx1) {
  6205. //>>excludeEnd("ctx");
  6206. console.log(self);
  6207. return self;
  6208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6209. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6210. //>>excludeEnd("ctx");
  6211. }; }),
  6212. $globals.String);
  6213. $core.addMethod(
  6214. $core.method({
  6215. selector: "printOn:",
  6216. protocol: "printing",
  6217. //>>excludeStart("ide", pragmas.excludeIdeData);
  6218. args: ["aStream"],
  6219. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6220. referencedClasses: [],
  6221. //>>excludeEnd("ide");
  6222. pragmas: [],
  6223. messageSends: ["nextPutAll:", "replace:with:"]
  6224. }, function ($methodClass){ return function (aStream){
  6225. var self=this,$self=this;
  6226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6227. return $core.withContext(function($ctx1) {
  6228. //>>excludeEnd("ctx");
  6229. [$recv(aStream)._nextPutAll_("'")
  6230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6231. ,$ctx1.sendIdx["nextPutAll:"]=1
  6232. //>>excludeEnd("ctx");
  6233. ][0];
  6234. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6236. ,$ctx1.sendIdx["nextPutAll:"]=2
  6237. //>>excludeEnd("ctx");
  6238. ][0];
  6239. $recv(aStream)._nextPutAll_("'");
  6240. return self;
  6241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6242. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6243. //>>excludeEnd("ctx");
  6244. }; }),
  6245. $globals.String);
  6246. $core.addMethod(
  6247. $core.method({
  6248. selector: "putOn:",
  6249. protocol: "streaming",
  6250. //>>excludeStart("ide", pragmas.excludeIdeData);
  6251. args: ["aStream"],
  6252. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6253. referencedClasses: [],
  6254. //>>excludeEnd("ide");
  6255. pragmas: [],
  6256. messageSends: ["nextPutString:"]
  6257. }, function ($methodClass){ return function (aStream){
  6258. var self=this,$self=this;
  6259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6260. return $core.withContext(function($ctx1) {
  6261. //>>excludeEnd("ctx");
  6262. $recv(aStream)._nextPutString_(self);
  6263. return self;
  6264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6265. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6266. //>>excludeEnd("ctx");
  6267. }; }),
  6268. $globals.String);
  6269. $core.addMethod(
  6270. $core.method({
  6271. selector: "remove:",
  6272. protocol: "adding/removing",
  6273. //>>excludeStart("ide", pragmas.excludeIdeData);
  6274. args: ["anObject"],
  6275. source: "remove: anObject\x0a\x09self errorReadOnly",
  6276. referencedClasses: [],
  6277. //>>excludeEnd("ide");
  6278. pragmas: [],
  6279. messageSends: ["errorReadOnly"]
  6280. }, function ($methodClass){ return function (anObject){
  6281. var self=this,$self=this;
  6282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6283. return $core.withContext(function($ctx1) {
  6284. //>>excludeEnd("ctx");
  6285. $self._errorReadOnly();
  6286. return self;
  6287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6288. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6289. //>>excludeEnd("ctx");
  6290. }; }),
  6291. $globals.String);
  6292. $core.addMethod(
  6293. $core.method({
  6294. selector: "remove:ifAbsent:",
  6295. protocol: "adding/removing",
  6296. //>>excludeStart("ide", pragmas.excludeIdeData);
  6297. args: ["anObject", "aBlock"],
  6298. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6299. referencedClasses: [],
  6300. //>>excludeEnd("ide");
  6301. pragmas: [],
  6302. messageSends: ["errorReadOnly"]
  6303. }, function ($methodClass){ return function (anObject,aBlock){
  6304. var self=this,$self=this;
  6305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6306. return $core.withContext(function($ctx1) {
  6307. //>>excludeEnd("ctx");
  6308. $self._errorReadOnly();
  6309. return self;
  6310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6311. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6312. //>>excludeEnd("ctx");
  6313. }; }),
  6314. $globals.String);
  6315. $core.addMethod(
  6316. $core.method({
  6317. selector: "replace:with:",
  6318. protocol: "regular expressions",
  6319. //>>excludeStart("ide", pragmas.excludeIdeData);
  6320. args: ["aString", "anotherString"],
  6321. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6322. referencedClasses: ["RegularExpression"],
  6323. //>>excludeEnd("ide");
  6324. pragmas: [],
  6325. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6326. }, function ($methodClass){ return function (aString,anotherString){
  6327. var self=this,$self=this;
  6328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6329. return $core.withContext(function($ctx1) {
  6330. //>>excludeEnd("ctx");
  6331. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6333. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6334. //>>excludeEnd("ctx");
  6335. }; }),
  6336. $globals.String);
  6337. $core.addMethod(
  6338. $core.method({
  6339. selector: "replaceRegexp:with:",
  6340. protocol: "regular expressions",
  6341. //>>excludeStart("ide", pragmas.excludeIdeData);
  6342. args: ["aRegexp", "aString"],
  6343. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6344. referencedClasses: [],
  6345. //>>excludeEnd("ide");
  6346. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6347. messageSends: []
  6348. }, function ($methodClass){ return function (aRegexp,aString){
  6349. var self=this,$self=this;
  6350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6351. return $core.withContext(function($ctx1) {
  6352. //>>excludeEnd("ctx");
  6353. return self.replace(aRegexp, aString);
  6354. return self;
  6355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6356. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6357. //>>excludeEnd("ctx");
  6358. }; }),
  6359. $globals.String);
  6360. $core.addMethod(
  6361. $core.method({
  6362. selector: "reversed",
  6363. protocol: "converting",
  6364. //>>excludeStart("ide", pragmas.excludeIdeData);
  6365. args: [],
  6366. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6367. referencedClasses: [],
  6368. //>>excludeEnd("ide");
  6369. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6370. messageSends: []
  6371. }, function ($methodClass){ return function (){
  6372. var self=this,$self=this;
  6373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6374. return $core.withContext(function($ctx1) {
  6375. //>>excludeEnd("ctx");
  6376. return self.split("").reverse().join("");
  6377. return self;
  6378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6379. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6380. //>>excludeEnd("ctx");
  6381. }; }),
  6382. $globals.String);
  6383. $core.addMethod(
  6384. $core.method({
  6385. selector: "shallowCopy",
  6386. protocol: "copying",
  6387. //>>excludeStart("ide", pragmas.excludeIdeData);
  6388. args: [],
  6389. source: "shallowCopy\x0a\x09^ self",
  6390. referencedClasses: [],
  6391. //>>excludeEnd("ide");
  6392. pragmas: [],
  6393. messageSends: []
  6394. }, function ($methodClass){ return function (){
  6395. var self=this,$self=this;
  6396. return self;
  6397. }; }),
  6398. $globals.String);
  6399. $core.addMethod(
  6400. $core.method({
  6401. selector: "subStrings:",
  6402. protocol: "split join",
  6403. //>>excludeStart("ide", pragmas.excludeIdeData);
  6404. args: ["aString"],
  6405. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6406. referencedClasses: [],
  6407. //>>excludeEnd("ide");
  6408. pragmas: [],
  6409. messageSends: ["tokenize:"]
  6410. }, function ($methodClass){ return function (aString){
  6411. var self=this,$self=this;
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. return $core.withContext(function($ctx1) {
  6414. //>>excludeEnd("ctx");
  6415. return $self._tokenize_(aString);
  6416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6417. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6418. //>>excludeEnd("ctx");
  6419. }; }),
  6420. $globals.String);
  6421. $core.addMethod(
  6422. $core.method({
  6423. selector: "symbolPrintString",
  6424. protocol: "printing",
  6425. //>>excludeStart("ide", pragmas.excludeIdeData);
  6426. args: [],
  6427. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6428. referencedClasses: ["String"],
  6429. //>>excludeEnd("ide");
  6430. pragmas: [],
  6431. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6432. }, function ($methodClass){ return function (){
  6433. var self=this,$self=this;
  6434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6435. return $core.withContext(function($ctx1) {
  6436. //>>excludeEnd("ctx");
  6437. return $recv($globals.String)._streamContents_((function(str){
  6438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6439. return $core.withContext(function($ctx2) {
  6440. //>>excludeEnd("ctx");
  6441. return $self._asSymbolPrintOn_(str);
  6442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6443. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6444. //>>excludeEnd("ctx");
  6445. }));
  6446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6447. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6448. //>>excludeEnd("ctx");
  6449. }; }),
  6450. $globals.String);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "tokenize:",
  6454. protocol: "split join",
  6455. //>>excludeStart("ide", pragmas.excludeIdeData);
  6456. args: ["aString"],
  6457. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6458. referencedClasses: [],
  6459. //>>excludeEnd("ide");
  6460. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6461. messageSends: []
  6462. }, function ($methodClass){ return function (aString){
  6463. var self=this,$self=this;
  6464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6465. return $core.withContext(function($ctx1) {
  6466. //>>excludeEnd("ctx");
  6467. return self.split(aString);
  6468. return self;
  6469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6470. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6471. //>>excludeEnd("ctx");
  6472. }; }),
  6473. $globals.String);
  6474. $core.addMethod(
  6475. $core.method({
  6476. selector: "trimBoth",
  6477. protocol: "regular expressions",
  6478. //>>excludeStart("ide", pragmas.excludeIdeData);
  6479. args: [],
  6480. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6481. referencedClasses: [],
  6482. //>>excludeEnd("ide");
  6483. pragmas: [],
  6484. messageSends: ["trimBoth:"]
  6485. }, function ($methodClass){ return function (){
  6486. var self=this,$self=this;
  6487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6488. return $core.withContext(function($ctx1) {
  6489. //>>excludeEnd("ctx");
  6490. return $self._trimBoth_("\x5cs");
  6491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6492. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6493. //>>excludeEnd("ctx");
  6494. }; }),
  6495. $globals.String);
  6496. $core.addMethod(
  6497. $core.method({
  6498. selector: "trimBoth:",
  6499. protocol: "regular expressions",
  6500. //>>excludeStart("ide", pragmas.excludeIdeData);
  6501. args: ["separators"],
  6502. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6503. referencedClasses: [],
  6504. //>>excludeEnd("ide");
  6505. pragmas: [],
  6506. messageSends: ["trimRight:", "trimLeft:"]
  6507. }, function ($methodClass){ return function (separators){
  6508. var self=this,$self=this;
  6509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6510. return $core.withContext(function($ctx1) {
  6511. //>>excludeEnd("ctx");
  6512. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6514. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6515. //>>excludeEnd("ctx");
  6516. }; }),
  6517. $globals.String);
  6518. $core.addMethod(
  6519. $core.method({
  6520. selector: "trimLeft",
  6521. protocol: "regular expressions",
  6522. //>>excludeStart("ide", pragmas.excludeIdeData);
  6523. args: [],
  6524. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6525. referencedClasses: [],
  6526. //>>excludeEnd("ide");
  6527. pragmas: [],
  6528. messageSends: ["trimLeft:"]
  6529. }, function ($methodClass){ return function (){
  6530. var self=this,$self=this;
  6531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6532. return $core.withContext(function($ctx1) {
  6533. //>>excludeEnd("ctx");
  6534. return $self._trimLeft_("\x5cs");
  6535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6536. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6537. //>>excludeEnd("ctx");
  6538. }; }),
  6539. $globals.String);
  6540. $core.addMethod(
  6541. $core.method({
  6542. selector: "trimLeft:",
  6543. protocol: "regular expressions",
  6544. //>>excludeStart("ide", pragmas.excludeIdeData);
  6545. args: ["separators"],
  6546. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6547. referencedClasses: ["RegularExpression"],
  6548. //>>excludeEnd("ide");
  6549. pragmas: [],
  6550. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6551. }, function ($methodClass){ return function (separators){
  6552. var self=this,$self=this;
  6553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6554. return $core.withContext(function($ctx1) {
  6555. //>>excludeEnd("ctx");
  6556. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6558. ,$ctx1.sendIdx[","]=1
  6559. //>>excludeEnd("ctx");
  6560. ][0],"g"),"");
  6561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6562. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6563. //>>excludeEnd("ctx");
  6564. }; }),
  6565. $globals.String);
  6566. $core.addMethod(
  6567. $core.method({
  6568. selector: "trimRight",
  6569. protocol: "regular expressions",
  6570. //>>excludeStart("ide", pragmas.excludeIdeData);
  6571. args: [],
  6572. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6573. referencedClasses: [],
  6574. //>>excludeEnd("ide");
  6575. pragmas: [],
  6576. messageSends: ["trimRight:"]
  6577. }, function ($methodClass){ return function (){
  6578. var self=this,$self=this;
  6579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6580. return $core.withContext(function($ctx1) {
  6581. //>>excludeEnd("ctx");
  6582. return $self._trimRight_("\x5cs");
  6583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6584. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6585. //>>excludeEnd("ctx");
  6586. }; }),
  6587. $globals.String);
  6588. $core.addMethod(
  6589. $core.method({
  6590. selector: "trimRight:",
  6591. protocol: "regular expressions",
  6592. //>>excludeStart("ide", pragmas.excludeIdeData);
  6593. args: ["separators"],
  6594. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6595. referencedClasses: ["RegularExpression"],
  6596. //>>excludeEnd("ide");
  6597. pragmas: [],
  6598. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6599. }, function ($methodClass){ return function (separators){
  6600. var self=this,$self=this;
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. return $core.withContext(function($ctx1) {
  6603. //>>excludeEnd("ctx");
  6604. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6606. ,$ctx1.sendIdx[","]=1
  6607. //>>excludeEnd("ctx");
  6608. ][0],"g"),"");
  6609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6610. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6611. //>>excludeEnd("ctx");
  6612. }; }),
  6613. $globals.String);
  6614. $core.addMethod(
  6615. $core.method({
  6616. selector: "unescaped",
  6617. protocol: "converting",
  6618. //>>excludeStart("ide", pragmas.excludeIdeData);
  6619. args: [],
  6620. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6621. referencedClasses: [],
  6622. //>>excludeEnd("ide");
  6623. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6624. messageSends: []
  6625. }, function ($methodClass){ return function (){
  6626. var self=this,$self=this;
  6627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6628. return $core.withContext(function($ctx1) {
  6629. //>>excludeEnd("ctx");
  6630. return unescape(self);
  6631. return self;
  6632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6633. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6634. //>>excludeEnd("ctx");
  6635. }; }),
  6636. $globals.String);
  6637. $core.addMethod(
  6638. $core.method({
  6639. selector: "uriComponentDecoded",
  6640. protocol: "converting",
  6641. //>>excludeStart("ide", pragmas.excludeIdeData);
  6642. args: [],
  6643. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6644. referencedClasses: [],
  6645. //>>excludeEnd("ide");
  6646. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6647. messageSends: []
  6648. }, function ($methodClass){ return function (){
  6649. var self=this,$self=this;
  6650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6651. return $core.withContext(function($ctx1) {
  6652. //>>excludeEnd("ctx");
  6653. return decodeURIComponent(self);
  6654. return self;
  6655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6656. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6657. //>>excludeEnd("ctx");
  6658. }; }),
  6659. $globals.String);
  6660. $core.addMethod(
  6661. $core.method({
  6662. selector: "uriComponentEncoded",
  6663. protocol: "converting",
  6664. //>>excludeStart("ide", pragmas.excludeIdeData);
  6665. args: [],
  6666. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6667. referencedClasses: [],
  6668. //>>excludeEnd("ide");
  6669. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6670. messageSends: []
  6671. }, function ($methodClass){ return function (){
  6672. var self=this,$self=this;
  6673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6674. return $core.withContext(function($ctx1) {
  6675. //>>excludeEnd("ctx");
  6676. return encodeURIComponent(self);
  6677. return self;
  6678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6679. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6680. //>>excludeEnd("ctx");
  6681. }; }),
  6682. $globals.String);
  6683. $core.addMethod(
  6684. $core.method({
  6685. selector: "uriDecoded",
  6686. protocol: "converting",
  6687. //>>excludeStart("ide", pragmas.excludeIdeData);
  6688. args: [],
  6689. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6690. referencedClasses: [],
  6691. //>>excludeEnd("ide");
  6692. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6693. messageSends: []
  6694. }, function ($methodClass){ return function (){
  6695. var self=this,$self=this;
  6696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6697. return $core.withContext(function($ctx1) {
  6698. //>>excludeEnd("ctx");
  6699. return decodeURI(self);
  6700. return self;
  6701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6702. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6703. //>>excludeEnd("ctx");
  6704. }; }),
  6705. $globals.String);
  6706. $core.addMethod(
  6707. $core.method({
  6708. selector: "uriEncoded",
  6709. protocol: "converting",
  6710. //>>excludeStart("ide", pragmas.excludeIdeData);
  6711. args: [],
  6712. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6713. referencedClasses: [],
  6714. //>>excludeEnd("ide");
  6715. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6716. messageSends: []
  6717. }, function ($methodClass){ return function (){
  6718. var self=this,$self=this;
  6719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6720. return $core.withContext(function($ctx1) {
  6721. //>>excludeEnd("ctx");
  6722. return encodeURI(self);
  6723. return self;
  6724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6725. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6726. //>>excludeEnd("ctx");
  6727. }; }),
  6728. $globals.String);
  6729. $core.addMethod(
  6730. $core.method({
  6731. selector: "value:",
  6732. protocol: "evaluating",
  6733. //>>excludeStart("ide", pragmas.excludeIdeData);
  6734. args: ["anObject"],
  6735. source: "value: anObject \x0a\x09^ anObject perform: self",
  6736. referencedClasses: [],
  6737. //>>excludeEnd("ide");
  6738. pragmas: [],
  6739. messageSends: ["perform:"]
  6740. }, function ($methodClass){ return function (anObject){
  6741. var self=this,$self=this;
  6742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6743. return $core.withContext(function($ctx1) {
  6744. //>>excludeEnd("ctx");
  6745. return $recv(anObject)._perform_(self);
  6746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6747. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6748. //>>excludeEnd("ctx");
  6749. }; }),
  6750. $globals.String);
  6751. $core.addMethod(
  6752. $core.method({
  6753. selector: "cr",
  6754. protocol: "accessing",
  6755. //>>excludeStart("ide", pragmas.excludeIdeData);
  6756. args: [],
  6757. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6758. referencedClasses: [],
  6759. //>>excludeEnd("ide");
  6760. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6761. messageSends: []
  6762. }, function ($methodClass){ return function (){
  6763. var self=this,$self=this;
  6764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6765. return $core.withContext(function($ctx1) {
  6766. //>>excludeEnd("ctx");
  6767. return "\r";
  6768. return self;
  6769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6770. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6771. //>>excludeEnd("ctx");
  6772. }; }),
  6773. $globals.String.a$cls);
  6774. $core.addMethod(
  6775. $core.method({
  6776. selector: "crlf",
  6777. protocol: "accessing",
  6778. //>>excludeStart("ide", pragmas.excludeIdeData);
  6779. args: [],
  6780. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6781. referencedClasses: [],
  6782. //>>excludeEnd("ide");
  6783. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6784. messageSends: []
  6785. }, function ($methodClass){ return function (){
  6786. var self=this,$self=this;
  6787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6788. return $core.withContext(function($ctx1) {
  6789. //>>excludeEnd("ctx");
  6790. return "\r\n";
  6791. return self;
  6792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6793. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6794. //>>excludeEnd("ctx");
  6795. }; }),
  6796. $globals.String.a$cls);
  6797. $core.addMethod(
  6798. $core.method({
  6799. selector: "esc",
  6800. protocol: "accessing",
  6801. //>>excludeStart("ide", pragmas.excludeIdeData);
  6802. args: [],
  6803. source: "esc\x0a\x09^ self fromCharCode: 27",
  6804. referencedClasses: [],
  6805. //>>excludeEnd("ide");
  6806. pragmas: [],
  6807. messageSends: ["fromCharCode:"]
  6808. }, function ($methodClass){ return function (){
  6809. var self=this,$self=this;
  6810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6811. return $core.withContext(function($ctx1) {
  6812. //>>excludeEnd("ctx");
  6813. return $self._fromCharCode_((27));
  6814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6815. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6816. //>>excludeEnd("ctx");
  6817. }; }),
  6818. $globals.String.a$cls);
  6819. $core.addMethod(
  6820. $core.method({
  6821. selector: "fromCharCode:",
  6822. protocol: "instance creation",
  6823. //>>excludeStart("ide", pragmas.excludeIdeData);
  6824. args: ["anInteger"],
  6825. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6826. referencedClasses: [],
  6827. //>>excludeEnd("ide");
  6828. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6829. messageSends: []
  6830. }, function ($methodClass){ return function (anInteger){
  6831. var self=this,$self=this;
  6832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6833. return $core.withContext(function($ctx1) {
  6834. //>>excludeEnd("ctx");
  6835. return String.fromCharCode(anInteger);
  6836. return self;
  6837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6838. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6839. //>>excludeEnd("ctx");
  6840. }; }),
  6841. $globals.String.a$cls);
  6842. $core.addMethod(
  6843. $core.method({
  6844. selector: "fromString:",
  6845. protocol: "instance creation",
  6846. //>>excludeStart("ide", pragmas.excludeIdeData);
  6847. args: ["aString"],
  6848. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6849. referencedClasses: [],
  6850. //>>excludeEnd("ide");
  6851. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6852. messageSends: []
  6853. }, function ($methodClass){ return function (aString){
  6854. var self=this,$self=this;
  6855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6856. return $core.withContext(function($ctx1) {
  6857. //>>excludeEnd("ctx");
  6858. return String(aString);
  6859. return self;
  6860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6861. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6862. //>>excludeEnd("ctx");
  6863. }; }),
  6864. $globals.String.a$cls);
  6865. $core.addMethod(
  6866. $core.method({
  6867. selector: "lf",
  6868. protocol: "accessing",
  6869. //>>excludeStart("ide", pragmas.excludeIdeData);
  6870. args: [],
  6871. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6872. referencedClasses: [],
  6873. //>>excludeEnd("ide");
  6874. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6875. messageSends: []
  6876. }, function ($methodClass){ return function (){
  6877. var self=this,$self=this;
  6878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6879. return $core.withContext(function($ctx1) {
  6880. //>>excludeEnd("ctx");
  6881. return "\n";
  6882. return self;
  6883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6884. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6885. //>>excludeEnd("ctx");
  6886. }; }),
  6887. $globals.String.a$cls);
  6888. $core.addMethod(
  6889. $core.method({
  6890. selector: "random",
  6891. protocol: "random",
  6892. //>>excludeStart("ide", pragmas.excludeIdeData);
  6893. args: [],
  6894. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  6895. referencedClasses: [],
  6896. //>>excludeEnd("ide");
  6897. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6898. messageSends: []
  6899. }, function ($methodClass){ return function (){
  6900. var self=this,$self=this;
  6901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6902. return $core.withContext(function($ctx1) {
  6903. //>>excludeEnd("ctx");
  6904. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6905. return self;
  6906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6907. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6908. //>>excludeEnd("ctx");
  6909. }; }),
  6910. $globals.String.a$cls);
  6911. $core.addMethod(
  6912. $core.method({
  6913. selector: "randomNotIn:",
  6914. protocol: "random",
  6915. //>>excludeStart("ide", pragmas.excludeIdeData);
  6916. args: ["aString"],
  6917. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6918. referencedClasses: [],
  6919. //>>excludeEnd("ide");
  6920. pragmas: [],
  6921. messageSends: ["whileTrue", "random", "includesSubString:"]
  6922. }, function ($methodClass){ return function (aString){
  6923. var self=this,$self=this;
  6924. var result;
  6925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6926. return $core.withContext(function($ctx1) {
  6927. //>>excludeEnd("ctx");
  6928. $recv((function(){
  6929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6930. return $core.withContext(function($ctx2) {
  6931. //>>excludeEnd("ctx");
  6932. result=$self._random();
  6933. return $recv(aString)._includesSubString_(result);
  6934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6935. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6936. //>>excludeEnd("ctx");
  6937. }))._whileTrue();
  6938. return result;
  6939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6940. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6941. //>>excludeEnd("ctx");
  6942. }; }),
  6943. $globals.String.a$cls);
  6944. $core.addMethod(
  6945. $core.method({
  6946. selector: "space",
  6947. protocol: "accessing",
  6948. //>>excludeStart("ide", pragmas.excludeIdeData);
  6949. args: [],
  6950. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6951. referencedClasses: [],
  6952. //>>excludeEnd("ide");
  6953. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6954. messageSends: []
  6955. }, function ($methodClass){ return function (){
  6956. var self=this,$self=this;
  6957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6958. return $core.withContext(function($ctx1) {
  6959. //>>excludeEnd("ctx");
  6960. return " ";
  6961. return self;
  6962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6963. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6964. //>>excludeEnd("ctx");
  6965. }; }),
  6966. $globals.String.a$cls);
  6967. $core.addMethod(
  6968. $core.method({
  6969. selector: "streamClass",
  6970. protocol: "accessing",
  6971. //>>excludeStart("ide", pragmas.excludeIdeData);
  6972. args: [],
  6973. source: "streamClass\x0a\x09\x09^ StringStream",
  6974. referencedClasses: ["StringStream"],
  6975. //>>excludeEnd("ide");
  6976. pragmas: [],
  6977. messageSends: []
  6978. }, function ($methodClass){ return function (){
  6979. var self=this,$self=this;
  6980. return $globals.StringStream;
  6981. }; }),
  6982. $globals.String.a$cls);
  6983. $core.addMethod(
  6984. $core.method({
  6985. selector: "tab",
  6986. protocol: "accessing",
  6987. //>>excludeStart("ide", pragmas.excludeIdeData);
  6988. args: [],
  6989. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6990. referencedClasses: [],
  6991. //>>excludeEnd("ide");
  6992. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6993. messageSends: []
  6994. }, function ($methodClass){ return function (){
  6995. var self=this,$self=this;
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. return $core.withContext(function($ctx1) {
  6998. //>>excludeEnd("ctx");
  6999. return "\t";
  7000. return self;
  7001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7002. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  7003. //>>excludeEnd("ctx");
  7004. }; }),
  7005. $globals.String.a$cls);
  7006. $core.addMethod(
  7007. $core.method({
  7008. selector: "value:",
  7009. protocol: "instance creation",
  7010. //>>excludeStart("ide", pragmas.excludeIdeData);
  7011. args: ["aUTFCharCode"],
  7012. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7013. referencedClasses: [],
  7014. //>>excludeEnd("ide");
  7015. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7016. messageSends: []
  7017. }, function ($methodClass){ return function (aUTFCharCode){
  7018. var self=this,$self=this;
  7019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7020. return $core.withContext(function($ctx1) {
  7021. //>>excludeEnd("ctx");
  7022. return String.fromCharCode(aUTFCharCode);;
  7023. return self;
  7024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7025. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7026. //>>excludeEnd("ctx");
  7027. }; }),
  7028. $globals.String.a$cls);
  7029. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7030. //>>excludeStart("ide", pragmas.excludeIdeData);
  7031. $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`.";
  7032. //>>excludeEnd("ide");
  7033. $core.addMethod(
  7034. $core.method({
  7035. selector: "=",
  7036. protocol: "comparing",
  7037. //>>excludeStart("ide", pragmas.excludeIdeData);
  7038. args: ["aCollection"],
  7039. 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",
  7040. referencedClasses: [],
  7041. //>>excludeEnd("ide");
  7042. pragmas: [],
  7043. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7044. }, function ($methodClass){ return function (aCollection){
  7045. var self=this,$self=this;
  7046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7047. return $core.withContext(function($ctx1) {
  7048. //>>excludeEnd("ctx");
  7049. var $1,$2,$3;
  7050. var $early={};
  7051. try {
  7052. $1=[$recv([$self._class()
  7053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7054. ,$ctx1.sendIdx["class"]=1
  7055. //>>excludeEnd("ctx");
  7056. ][0]).__eq($recv(aCollection)._class())
  7057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7058. ,$ctx1.sendIdx["="]=1
  7059. //>>excludeEnd("ctx");
  7060. ][0];
  7061. if(!$core.assert($1)){
  7062. return false;
  7063. }
  7064. $2=$recv([$self._size()
  7065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7066. ,$ctx1.sendIdx["size"]=1
  7067. //>>excludeEnd("ctx");
  7068. ][0]).__eq($recv(aCollection)._size());
  7069. if(!$core.assert($2)){
  7070. return false;
  7071. }
  7072. $self._do_((function(each){
  7073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7074. return $core.withContext(function($ctx2) {
  7075. //>>excludeEnd("ctx");
  7076. $3=$recv(aCollection)._includes_(each);
  7077. if(!$core.assert($3)){
  7078. throw $early=[false];
  7079. }
  7080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7081. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7082. //>>excludeEnd("ctx");
  7083. }));
  7084. return true;
  7085. }
  7086. catch(e) {if(e===$early)return e[0]; throw e}
  7087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7088. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7089. //>>excludeEnd("ctx");
  7090. }; }),
  7091. $globals.Set);
  7092. $core.addMethod(
  7093. $core.method({
  7094. selector: "add:",
  7095. protocol: "adding/removing",
  7096. //>>excludeStart("ide", pragmas.excludeIdeData);
  7097. args: ["anObject"],
  7098. 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 ]",
  7099. referencedClasses: [],
  7100. //>>excludeEnd("ide");
  7101. pragmas: [],
  7102. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7103. }, function ($methodClass){ return function (anObject){
  7104. var self=this,$self=this;
  7105. var bucket;
  7106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7107. return $core.withContext(function($ctx1) {
  7108. //>>excludeEnd("ctx");
  7109. var $1;
  7110. bucket=$self._bucketsOfElement_(anObject);
  7111. $1=$recv(bucket)._second();
  7112. if($1 == null || $1.a$nil){
  7113. var object,slowBucket;
  7114. object=[$recv(bucket)._first()
  7115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7116. ,$ctx1.sendIdx["first"]=1
  7117. //>>excludeEnd("ctx");
  7118. ][0];
  7119. slowBucket=$recv(bucket)._third();
  7120. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7122. return $core.withContext(function($ctx2) {
  7123. //>>excludeEnd("ctx");
  7124. $recv(slowBucket)._add_(object);
  7125. $self.size=$recv($self.size).__plus((1));
  7126. return $self.size;
  7127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7129. //>>excludeEnd("ctx");
  7130. }));
  7131. return object;
  7132. } else {
  7133. var primitiveBucket;
  7134. primitiveBucket=$1;
  7135. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7136. }
  7137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7138. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7139. //>>excludeEnd("ctx");
  7140. }; }),
  7141. $globals.Set);
  7142. $core.addMethod(
  7143. $core.method({
  7144. selector: "add:in:",
  7145. protocol: "private",
  7146. //>>excludeStart("ide", pragmas.excludeIdeData);
  7147. args: ["anObject", "anotherObject"],
  7148. 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'>",
  7149. referencedClasses: [],
  7150. //>>excludeEnd("ide");
  7151. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09"]]],
  7152. messageSends: []
  7153. }, function ($methodClass){ return function (anObject,anotherObject){
  7154. var self=this,$self=this;
  7155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7156. return $core.withContext(function($ctx1) {
  7157. //>>excludeEnd("ctx");
  7158. if (anObject in anotherObject.store) { return anObject; }
  7159. $self.size++;
  7160. anotherObject.store[anObject] = true;
  7161. return anObject;
  7162. ;
  7163. return self;
  7164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7165. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7166. //>>excludeEnd("ctx");
  7167. }; }),
  7168. $globals.Set);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "bucketsOfElement:",
  7172. protocol: "private",
  7173. //>>excludeStart("ide", pragmas.excludeIdeData);
  7174. args: ["anObject"],
  7175. 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'>",
  7176. referencedClasses: [],
  7177. //>>excludeEnd("ide");
  7178. pragmas: [["inlineJS:", ["\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self.fastBuckets[typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self.slowBucketStores.some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self.defaultBucket ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self.fastBuckets[typeof prim] ];\x0a\x09"]]],
  7179. messageSends: []
  7180. }, function ($methodClass){ return function (anObject){
  7181. var self=this,$self=this;
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. return $core.withContext(function($ctx1) {
  7184. //>>excludeEnd("ctx");
  7185. // include nil to well-known objects under "boolean" fastBucket
  7186. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7187. var prim = anObject.valueOf();
  7188. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7189. var bucket = null;
  7190. $self.slowBucketStores.some(function (store) {
  7191. return bucket = store._bucketOfElement_(anObject);
  7192. });
  7193. return [ anObject, null, bucket || $self.defaultBucket ];
  7194. }
  7195. return [ prim, $self.fastBuckets[typeof prim] ];
  7196. ;
  7197. return self;
  7198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7199. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7200. //>>excludeEnd("ctx");
  7201. }; }),
  7202. $globals.Set);
  7203. $core.addMethod(
  7204. $core.method({
  7205. selector: "classNameOf:",
  7206. protocol: "private",
  7207. //>>excludeStart("ide", pragmas.excludeIdeData);
  7208. args: ["anObject"],
  7209. 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'>",
  7210. referencedClasses: [],
  7211. //>>excludeEnd("ide");
  7212. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7213. messageSends: []
  7214. }, function ($methodClass){ return function (anObject){
  7215. var self=this,$self=this;
  7216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7217. return $core.withContext(function($ctx1) {
  7218. //>>excludeEnd("ctx");
  7219. return anObject.a$cls != null && anObject.a$cls.name;
  7220. return self;
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7223. //>>excludeEnd("ctx");
  7224. }; }),
  7225. $globals.Set);
  7226. $core.addMethod(
  7227. $core.method({
  7228. selector: "collect:",
  7229. protocol: "enumerating",
  7230. //>>excludeStart("ide", pragmas.excludeIdeData);
  7231. args: ["aBlock"],
  7232. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7233. referencedClasses: [],
  7234. //>>excludeEnd("ide");
  7235. pragmas: [],
  7236. messageSends: ["new", "class", "do:", "add:", "value:"]
  7237. }, function ($methodClass){ return function (aBlock){
  7238. var self=this,$self=this;
  7239. var collection;
  7240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7241. return $core.withContext(function($ctx1) {
  7242. //>>excludeEnd("ctx");
  7243. collection=$recv($self._class())._new();
  7244. $self._do_((function(each){
  7245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7246. return $core.withContext(function($ctx2) {
  7247. //>>excludeEnd("ctx");
  7248. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7250. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7251. //>>excludeEnd("ctx");
  7252. }));
  7253. return collection;
  7254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7255. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7256. //>>excludeEnd("ctx");
  7257. }; }),
  7258. $globals.Set);
  7259. $core.addMethod(
  7260. $core.method({
  7261. selector: "do:",
  7262. protocol: "enumerating",
  7263. //>>excludeStart("ide", pragmas.excludeIdeData);
  7264. args: ["aBlock"],
  7265. 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'>",
  7266. referencedClasses: [],
  7267. //>>excludeEnd("ide");
  7268. pragmas: [["inlineJS:", ["\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self.fastBuckets;\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self.slowBucketStores;\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self.defaultBucket._do_(aBlock);\x0a\x09"]]],
  7269. messageSends: []
  7270. }, function ($methodClass){ return function (aBlock){
  7271. var self=this,$self=this;
  7272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7273. return $core.withContext(function($ctx1) {
  7274. //>>excludeEnd("ctx");
  7275. var el, keys, i;
  7276. el = $self.fastBuckets;
  7277. keys = Object.keys(el);
  7278. for (i = 0; i < keys.length; ++i) {
  7279. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7280. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7281. else { store._do_(aBlock); }
  7282. }
  7283. el = $self.slowBucketStores;
  7284. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7285. $self.defaultBucket._do_(aBlock);
  7286. ;
  7287. return self;
  7288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7289. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7290. //>>excludeEnd("ctx");
  7291. }; }),
  7292. $globals.Set);
  7293. $core.addMethod(
  7294. $core.method({
  7295. selector: "includes:",
  7296. protocol: "testing",
  7297. //>>excludeStart("ide", pragmas.excludeIdeData);
  7298. args: ["anObject"],
  7299. 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 ]",
  7300. referencedClasses: [],
  7301. //>>excludeEnd("ide");
  7302. pragmas: [],
  7303. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7304. }, function ($methodClass){ return function (anObject){
  7305. var self=this,$self=this;
  7306. var bucket;
  7307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7308. return $core.withContext(function($ctx1) {
  7309. //>>excludeEnd("ctx");
  7310. var $1;
  7311. bucket=$self._bucketsOfElement_(anObject);
  7312. $1=$recv(bucket)._second();
  7313. if($1 == null || $1.a$nil){
  7314. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7316. ,$ctx1.sendIdx["first"]=1
  7317. //>>excludeEnd("ctx");
  7318. ][0]);
  7319. } else {
  7320. var primitiveBucket;
  7321. primitiveBucket=$1;
  7322. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7323. }
  7324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7325. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7326. //>>excludeEnd("ctx");
  7327. }; }),
  7328. $globals.Set);
  7329. $core.addMethod(
  7330. $core.method({
  7331. selector: "includes:in:",
  7332. protocol: "private",
  7333. //>>excludeStart("ide", pragmas.excludeIdeData);
  7334. args: ["anObject", "anotherObject"],
  7335. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7336. referencedClasses: [],
  7337. //>>excludeEnd("ide");
  7338. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7339. messageSends: []
  7340. }, function ($methodClass){ return function (anObject,anotherObject){
  7341. var self=this,$self=this;
  7342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7343. return $core.withContext(function($ctx1) {
  7344. //>>excludeEnd("ctx");
  7345. return anObject in anotherObject.store;
  7346. return self;
  7347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7348. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7349. //>>excludeEnd("ctx");
  7350. }; }),
  7351. $globals.Set);
  7352. $core.addMethod(
  7353. $core.method({
  7354. selector: "initialize",
  7355. protocol: "initialization",
  7356. //>>excludeStart("ide", pragmas.excludeIdeData);
  7357. args: [],
  7358. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7359. referencedClasses: [],
  7360. //>>excludeEnd("ide");
  7361. pragmas: [],
  7362. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7363. }, function ($methodClass){ return function (){
  7364. var self=this,$self=this;
  7365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7366. return $core.withContext(function($ctx1) {
  7367. //>>excludeEnd("ctx");
  7368. [(
  7369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7370. $ctx1.supercall = true,
  7371. //>>excludeEnd("ctx");
  7372. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7374. ,$ctx1.supercall = false
  7375. //>>excludeEnd("ctx");
  7376. ][0];
  7377. $self.defaultBucket=[];
  7378. $self._initializeSlowBucketStores();
  7379. $self._removeAll();
  7380. return self;
  7381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7382. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7383. //>>excludeEnd("ctx");
  7384. }; }),
  7385. $globals.Set);
  7386. $core.addMethod(
  7387. $core.method({
  7388. selector: "initializeSlowBucketStores",
  7389. protocol: "initialization",
  7390. //>>excludeStart("ide", pragmas.excludeIdeData);
  7391. args: [],
  7392. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7393. referencedClasses: ["ArrayBucketStore"],
  7394. //>>excludeEnd("ide");
  7395. pragmas: [],
  7396. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7397. }, function ($methodClass){ return function (){
  7398. var self=this,$self=this;
  7399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7400. return $core.withContext(function($ctx1) {
  7401. //>>excludeEnd("ctx");
  7402. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7404. return $core.withContext(function($ctx2) {
  7405. //>>excludeEnd("ctx");
  7406. return $self._classNameOf_(x);
  7407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7408. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7409. //>>excludeEnd("ctx");
  7410. }))
  7411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7412. ,$ctx1.sendIdx["hashBlock:"]=1
  7413. //>>excludeEnd("ctx");
  7414. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7416. return $core.withContext(function($ctx2) {
  7417. //>>excludeEnd("ctx");
  7418. return $self._jsConstructorNameOf_(x);
  7419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7420. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7421. //>>excludeEnd("ctx");
  7422. }))];
  7423. return self;
  7424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7425. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7426. //>>excludeEnd("ctx");
  7427. }; }),
  7428. $globals.Set);
  7429. $core.addMethod(
  7430. $core.method({
  7431. selector: "jsConstructorNameOf:",
  7432. protocol: "private",
  7433. //>>excludeStart("ide", pragmas.excludeIdeData);
  7434. args: ["anObject"],
  7435. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7436. referencedClasses: [],
  7437. //>>excludeEnd("ide");
  7438. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7439. messageSends: []
  7440. }, function ($methodClass){ return function (anObject){
  7441. var self=this,$self=this;
  7442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7443. return $core.withContext(function($ctx1) {
  7444. //>>excludeEnd("ctx");
  7445. return anObject.constructor && anObject.constructor.name;
  7446. return self;
  7447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7448. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7449. //>>excludeEnd("ctx");
  7450. }; }),
  7451. $globals.Set);
  7452. $core.addMethod(
  7453. $core.method({
  7454. selector: "printOn:",
  7455. protocol: "printing",
  7456. //>>excludeStart("ide", pragmas.excludeIdeData);
  7457. args: ["aStream"],
  7458. 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: ')'",
  7459. referencedClasses: [],
  7460. //>>excludeEnd("ide");
  7461. pragmas: [],
  7462. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7463. }, function ($methodClass){ return function (aStream){
  7464. var self=this,$self=this;
  7465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7466. return $core.withContext(function($ctx1) {
  7467. //>>excludeEnd("ctx");
  7468. [(
  7469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7470. $ctx1.supercall = true,
  7471. //>>excludeEnd("ctx");
  7472. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7474. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7475. //>>excludeEnd("ctx");
  7476. ][0];
  7477. [$recv(aStream)._nextPutAll_(" (")
  7478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7479. ,$ctx1.sendIdx["nextPutAll:"]=1
  7480. //>>excludeEnd("ctx");
  7481. ][0];
  7482. $self._do_separatedBy_((function(each){
  7483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7484. return $core.withContext(function($ctx2) {
  7485. //>>excludeEnd("ctx");
  7486. return $recv(each)._printOn_(aStream);
  7487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7488. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7489. //>>excludeEnd("ctx");
  7490. }),(function(){
  7491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7492. return $core.withContext(function($ctx2) {
  7493. //>>excludeEnd("ctx");
  7494. return [$recv(aStream)._nextPutAll_(" ")
  7495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7496. ,$ctx2.sendIdx["nextPutAll:"]=2
  7497. //>>excludeEnd("ctx");
  7498. ][0];
  7499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7501. //>>excludeEnd("ctx");
  7502. }));
  7503. $recv(aStream)._nextPutAll_(")");
  7504. return self;
  7505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7506. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7507. //>>excludeEnd("ctx");
  7508. }; }),
  7509. $globals.Set);
  7510. $core.addMethod(
  7511. $core.method({
  7512. selector: "remove:ifAbsent:",
  7513. protocol: "adding/removing",
  7514. //>>excludeStart("ide", pragmas.excludeIdeData);
  7515. args: ["anObject", "aBlock"],
  7516. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ | obj | obj := bucket first. bucket third remove: obj ifAbsent: [ ^aBlock value ]. size := size - 1. obj ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  7517. referencedClasses: [],
  7518. //>>excludeEnd("ide");
  7519. pragmas: [],
  7520. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7521. }, function ($methodClass){ return function (anObject,aBlock){
  7522. var self=this,$self=this;
  7523. var bucket;
  7524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7525. return $core.withContext(function($ctx1) {
  7526. //>>excludeEnd("ctx");
  7527. var $1;
  7528. var $early={};
  7529. try {
  7530. bucket=$self._bucketsOfElement_(anObject);
  7531. $1=$recv(bucket)._second();
  7532. if($1 == null || $1.a$nil){
  7533. var obj;
  7534. obj=[$recv(bucket)._first()
  7535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7536. ,$ctx1.sendIdx["first"]=1
  7537. //>>excludeEnd("ctx");
  7538. ][0];
  7539. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7541. return $core.withContext(function($ctx2) {
  7542. //>>excludeEnd("ctx");
  7543. throw $early=[$recv(aBlock)._value()];
  7544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7546. //>>excludeEnd("ctx");
  7547. }));
  7548. $self.size=$recv($self.size).__minus((1));
  7549. return obj;
  7550. } else {
  7551. var primitiveBucket;
  7552. primitiveBucket=$1;
  7553. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7554. }
  7555. }
  7556. catch(e) {if(e===$early)return e[0]; throw e}
  7557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7558. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7559. //>>excludeEnd("ctx");
  7560. }; }),
  7561. $globals.Set);
  7562. $core.addMethod(
  7563. $core.method({
  7564. selector: "remove:in:ifAbsent:",
  7565. protocol: "private",
  7566. //>>excludeStart("ide", pragmas.excludeIdeData);
  7567. args: ["anObject", "anotherObject", "aBlock"],
  7568. 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}'>",
  7569. referencedClasses: [],
  7570. //>>excludeEnd("ide");
  7571. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}"]]],
  7572. messageSends: []
  7573. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7574. var self=this,$self=this;
  7575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7576. return $core.withContext(function($ctx1) {
  7577. //>>excludeEnd("ctx");
  7578. if (anObject in anotherObject.store) {
  7579. delete anotherObject.store[anObject];
  7580. $self.size--;
  7581. return anObject;
  7582. } else {
  7583. return aBlock._value();
  7584. };
  7585. return self;
  7586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7587. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7588. //>>excludeEnd("ctx");
  7589. }; }),
  7590. $globals.Set);
  7591. $core.addMethod(
  7592. $core.method({
  7593. selector: "removeAll",
  7594. protocol: "adding/removing",
  7595. //>>excludeStart("ide", pragmas.excludeIdeData);
  7596. args: [],
  7597. 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'>",
  7598. referencedClasses: [],
  7599. //>>excludeEnd("ide");
  7600. pragmas: [["inlineJS:", ["\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09"]]],
  7601. messageSends: []
  7602. }, function ($methodClass){ return function (){
  7603. var self=this,$self=this;
  7604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7605. return $core.withContext(function($ctx1) {
  7606. //>>excludeEnd("ctx");
  7607. $self.fastBuckets = {
  7608. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7609. "number": { store: Object.create(null), fn: Number },
  7610. "string": { store: Object.create(null) }
  7611. };
  7612. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7613. $self.defaultBucket._removeAll();
  7614. $self.size = 0;
  7615. ;
  7616. return self;
  7617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7618. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7619. //>>excludeEnd("ctx");
  7620. }; }),
  7621. $globals.Set);
  7622. $core.addMethod(
  7623. $core.method({
  7624. selector: "select:",
  7625. protocol: "enumerating",
  7626. //>>excludeStart("ide", pragmas.excludeIdeData);
  7627. args: ["aBlock"],
  7628. 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",
  7629. referencedClasses: [],
  7630. //>>excludeEnd("ide");
  7631. pragmas: [],
  7632. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7633. }, function ($methodClass){ return function (aBlock){
  7634. var self=this,$self=this;
  7635. var collection;
  7636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7637. return $core.withContext(function($ctx1) {
  7638. //>>excludeEnd("ctx");
  7639. var $1;
  7640. collection=$recv($self._class())._new();
  7641. $self._do_((function(each){
  7642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7643. return $core.withContext(function($ctx2) {
  7644. //>>excludeEnd("ctx");
  7645. $1=$recv(aBlock)._value_(each);
  7646. if($core.assert($1)){
  7647. return $recv(collection)._add_(each);
  7648. }
  7649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7650. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7651. //>>excludeEnd("ctx");
  7652. }));
  7653. return collection;
  7654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7655. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7656. //>>excludeEnd("ctx");
  7657. }; }),
  7658. $globals.Set);
  7659. $core.addMethod(
  7660. $core.method({
  7661. selector: "select:thenCollect:",
  7662. protocol: "enumerating",
  7663. //>>excludeStart("ide", pragmas.excludeIdeData);
  7664. args: ["selectBlock", "collectBlock"],
  7665. 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",
  7666. referencedClasses: [],
  7667. //>>excludeEnd("ide");
  7668. pragmas: [],
  7669. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7670. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7671. var self=this,$self=this;
  7672. var collection;
  7673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7674. return $core.withContext(function($ctx1) {
  7675. //>>excludeEnd("ctx");
  7676. var $1;
  7677. collection=$recv($self._class())._new();
  7678. $self._do_((function(each){
  7679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7680. return $core.withContext(function($ctx2) {
  7681. //>>excludeEnd("ctx");
  7682. $1=[$recv(selectBlock)._value_(each)
  7683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7684. ,$ctx2.sendIdx["value:"]=1
  7685. //>>excludeEnd("ctx");
  7686. ][0];
  7687. if($core.assert($1)){
  7688. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7689. }
  7690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7691. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7692. //>>excludeEnd("ctx");
  7693. }));
  7694. return collection;
  7695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7696. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7697. //>>excludeEnd("ctx");
  7698. }; }),
  7699. $globals.Set);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "size",
  7703. protocol: "accessing",
  7704. //>>excludeStart("ide", pragmas.excludeIdeData);
  7705. args: [],
  7706. source: "size\x0a\x09^ size",
  7707. referencedClasses: [],
  7708. //>>excludeEnd("ide");
  7709. pragmas: [],
  7710. messageSends: []
  7711. }, function ($methodClass){ return function (){
  7712. var self=this,$self=this;
  7713. return $self.size;
  7714. }; }),
  7715. $globals.Set);
  7716. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7717. //>>excludeStart("ide", pragmas.excludeIdeData);
  7718. $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.";
  7719. //>>excludeEnd("ide");
  7720. $core.addMethod(
  7721. $core.method({
  7722. selector: "<<",
  7723. protocol: "writing",
  7724. //>>excludeStart("ide", pragmas.excludeIdeData);
  7725. args: ["anObject"],
  7726. source: "<< anObject\x0a\x09self write: anObject",
  7727. referencedClasses: [],
  7728. //>>excludeEnd("ide");
  7729. pragmas: [],
  7730. messageSends: ["write:"]
  7731. }, function ($methodClass){ return function (anObject){
  7732. var self=this,$self=this;
  7733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7734. return $core.withContext(function($ctx1) {
  7735. //>>excludeEnd("ctx");
  7736. $self._write_(anObject);
  7737. return self;
  7738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7739. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7740. //>>excludeEnd("ctx");
  7741. }; }),
  7742. $globals.ProtoStream);
  7743. $core.addMethod(
  7744. $core.method({
  7745. selector: "atEnd",
  7746. protocol: "testing",
  7747. //>>excludeStart("ide", pragmas.excludeIdeData);
  7748. args: [],
  7749. source: "atEnd\x0a\x09self subclassResponsibility",
  7750. referencedClasses: [],
  7751. //>>excludeEnd("ide");
  7752. pragmas: [],
  7753. messageSends: ["subclassResponsibility"]
  7754. }, function ($methodClass){ return function (){
  7755. var self=this,$self=this;
  7756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7757. return $core.withContext(function($ctx1) {
  7758. //>>excludeEnd("ctx");
  7759. $self._subclassResponsibility();
  7760. return self;
  7761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7762. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7763. //>>excludeEnd("ctx");
  7764. }; }),
  7765. $globals.ProtoStream);
  7766. $core.addMethod(
  7767. $core.method({
  7768. selector: "atStart",
  7769. protocol: "testing",
  7770. //>>excludeStart("ide", pragmas.excludeIdeData);
  7771. args: [],
  7772. source: "atStart\x0a\x09self subclassResponsibility",
  7773. referencedClasses: [],
  7774. //>>excludeEnd("ide");
  7775. pragmas: [],
  7776. messageSends: ["subclassResponsibility"]
  7777. }, function ($methodClass){ return function (){
  7778. var self=this,$self=this;
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. return $core.withContext(function($ctx1) {
  7781. //>>excludeEnd("ctx");
  7782. $self._subclassResponsibility();
  7783. return self;
  7784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7785. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7786. //>>excludeEnd("ctx");
  7787. }; }),
  7788. $globals.ProtoStream);
  7789. $core.addMethod(
  7790. $core.method({
  7791. selector: "contents",
  7792. protocol: "accessing",
  7793. //>>excludeStart("ide", pragmas.excludeIdeData);
  7794. args: [],
  7795. source: "contents\x0a\x09self subclassResponsibility",
  7796. referencedClasses: [],
  7797. //>>excludeEnd("ide");
  7798. pragmas: [],
  7799. messageSends: ["subclassResponsibility"]
  7800. }, function ($methodClass){ return function (){
  7801. var self=this,$self=this;
  7802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7803. return $core.withContext(function($ctx1) {
  7804. //>>excludeEnd("ctx");
  7805. $self._subclassResponsibility();
  7806. return self;
  7807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7808. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7809. //>>excludeEnd("ctx");
  7810. }; }),
  7811. $globals.ProtoStream);
  7812. $core.addMethod(
  7813. $core.method({
  7814. selector: "do:",
  7815. protocol: "enumerating",
  7816. //>>excludeStart("ide", pragmas.excludeIdeData);
  7817. args: ["aBlock"],
  7818. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7819. referencedClasses: [],
  7820. //>>excludeEnd("ide");
  7821. pragmas: [],
  7822. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7823. }, function ($methodClass){ return function (aBlock){
  7824. var self=this,$self=this;
  7825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7826. return $core.withContext(function($ctx1) {
  7827. //>>excludeEnd("ctx");
  7828. $recv((function(){
  7829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7830. return $core.withContext(function($ctx2) {
  7831. //>>excludeEnd("ctx");
  7832. return $self._atEnd();
  7833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7834. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7835. //>>excludeEnd("ctx");
  7836. }))._whileFalse_((function(){
  7837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7838. return $core.withContext(function($ctx2) {
  7839. //>>excludeEnd("ctx");
  7840. return $recv(aBlock)._value_($self._next());
  7841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7842. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7843. //>>excludeEnd("ctx");
  7844. }));
  7845. return self;
  7846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7847. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7848. //>>excludeEnd("ctx");
  7849. }; }),
  7850. $globals.ProtoStream);
  7851. $core.addMethod(
  7852. $core.method({
  7853. selector: "isEmpty",
  7854. protocol: "testing",
  7855. //>>excludeStart("ide", pragmas.excludeIdeData);
  7856. args: [],
  7857. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7858. referencedClasses: [],
  7859. //>>excludeEnd("ide");
  7860. pragmas: [],
  7861. messageSends: ["and:", "atStart", "atEnd"]
  7862. }, function ($methodClass){ return function (){
  7863. var self=this,$self=this;
  7864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7865. return $core.withContext(function($ctx1) {
  7866. //>>excludeEnd("ctx");
  7867. return $recv($self._atStart())._and_((function(){
  7868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7869. return $core.withContext(function($ctx2) {
  7870. //>>excludeEnd("ctx");
  7871. return $self._atEnd();
  7872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7874. //>>excludeEnd("ctx");
  7875. }));
  7876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7877. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7878. //>>excludeEnd("ctx");
  7879. }; }),
  7880. $globals.ProtoStream);
  7881. $core.addMethod(
  7882. $core.method({
  7883. selector: "next",
  7884. protocol: "reading",
  7885. //>>excludeStart("ide", pragmas.excludeIdeData);
  7886. args: [],
  7887. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7888. referencedClasses: [],
  7889. //>>excludeEnd("ide");
  7890. pragmas: [],
  7891. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7892. }, function ($methodClass){ return function (){
  7893. var self=this,$self=this;
  7894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7895. return $core.withContext(function($ctx1) {
  7896. //>>excludeEnd("ctx");
  7897. var $1;
  7898. $1=$self._atEnd();
  7899. if($core.assert($1)){
  7900. return nil;
  7901. } else {
  7902. return $self._subclassResponsibility();
  7903. }
  7904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7905. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7906. //>>excludeEnd("ctx");
  7907. }; }),
  7908. $globals.ProtoStream);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "nextPut:",
  7912. protocol: "writing",
  7913. //>>excludeStart("ide", pragmas.excludeIdeData);
  7914. args: ["anObject"],
  7915. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7916. referencedClasses: [],
  7917. //>>excludeEnd("ide");
  7918. pragmas: [],
  7919. messageSends: ["subclassResponsibility"]
  7920. }, function ($methodClass){ return function (anObject){
  7921. var self=this,$self=this;
  7922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7923. return $core.withContext(function($ctx1) {
  7924. //>>excludeEnd("ctx");
  7925. $self._subclassResponsibility();
  7926. return self;
  7927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7928. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7929. //>>excludeEnd("ctx");
  7930. }; }),
  7931. $globals.ProtoStream);
  7932. $core.addMethod(
  7933. $core.method({
  7934. selector: "nextPutAll:",
  7935. protocol: "writing",
  7936. //>>excludeStart("ide", pragmas.excludeIdeData);
  7937. args: ["aCollection"],
  7938. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7939. referencedClasses: [],
  7940. //>>excludeEnd("ide");
  7941. pragmas: [],
  7942. messageSends: ["do:", "nextPut:"]
  7943. }, function ($methodClass){ return function (aCollection){
  7944. var self=this,$self=this;
  7945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7946. return $core.withContext(function($ctx1) {
  7947. //>>excludeEnd("ctx");
  7948. $recv(aCollection)._do_((function(each){
  7949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7950. return $core.withContext(function($ctx2) {
  7951. //>>excludeEnd("ctx");
  7952. return $self._nextPut_(each);
  7953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7955. //>>excludeEnd("ctx");
  7956. }));
  7957. return self;
  7958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7959. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7960. //>>excludeEnd("ctx");
  7961. }; }),
  7962. $globals.ProtoStream);
  7963. $core.addMethod(
  7964. $core.method({
  7965. selector: "nextPutString:",
  7966. protocol: "writing",
  7967. //>>excludeStart("ide", pragmas.excludeIdeData);
  7968. args: ["aString"],
  7969. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7970. referencedClasses: [],
  7971. //>>excludeEnd("ide");
  7972. pragmas: [],
  7973. messageSends: ["nextPut:"]
  7974. }, function ($methodClass){ return function (aString){
  7975. var self=this,$self=this;
  7976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7977. return $core.withContext(function($ctx1) {
  7978. //>>excludeEnd("ctx");
  7979. $self._nextPut_(aString);
  7980. return self;
  7981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7982. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7983. //>>excludeEnd("ctx");
  7984. }; }),
  7985. $globals.ProtoStream);
  7986. $core.addMethod(
  7987. $core.method({
  7988. selector: "peek",
  7989. protocol: "reading",
  7990. //>>excludeStart("ide", pragmas.excludeIdeData);
  7991. args: [],
  7992. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7993. referencedClasses: [],
  7994. //>>excludeEnd("ide");
  7995. pragmas: [],
  7996. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7997. }, function ($methodClass){ return function (){
  7998. var self=this,$self=this;
  7999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8000. return $core.withContext(function($ctx1) {
  8001. //>>excludeEnd("ctx");
  8002. var $1;
  8003. $1=$self._atEnd();
  8004. if($core.assert($1)){
  8005. return nil;
  8006. } else {
  8007. return $self._subclassResponsibility();
  8008. }
  8009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8010. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8011. //>>excludeEnd("ctx");
  8012. }; }),
  8013. $globals.ProtoStream);
  8014. $core.addMethod(
  8015. $core.method({
  8016. selector: "reset",
  8017. protocol: "actions",
  8018. //>>excludeStart("ide", pragmas.excludeIdeData);
  8019. args: [],
  8020. source: "reset\x0a\x09self subclassResponsibility",
  8021. referencedClasses: [],
  8022. //>>excludeEnd("ide");
  8023. pragmas: [],
  8024. messageSends: ["subclassResponsibility"]
  8025. }, function ($methodClass){ return function (){
  8026. var self=this,$self=this;
  8027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8028. return $core.withContext(function($ctx1) {
  8029. //>>excludeEnd("ctx");
  8030. $self._subclassResponsibility();
  8031. return self;
  8032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8033. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8034. //>>excludeEnd("ctx");
  8035. }; }),
  8036. $globals.ProtoStream);
  8037. $core.addMethod(
  8038. $core.method({
  8039. selector: "resetContents",
  8040. protocol: "actions",
  8041. //>>excludeStart("ide", pragmas.excludeIdeData);
  8042. args: [],
  8043. source: "resetContents\x0a\x09self subclassResponsibility",
  8044. referencedClasses: [],
  8045. //>>excludeEnd("ide");
  8046. pragmas: [],
  8047. messageSends: ["subclassResponsibility"]
  8048. }, function ($methodClass){ return function (){
  8049. var self=this,$self=this;
  8050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8051. return $core.withContext(function($ctx1) {
  8052. //>>excludeEnd("ctx");
  8053. $self._subclassResponsibility();
  8054. return self;
  8055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8056. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8057. //>>excludeEnd("ctx");
  8058. }; }),
  8059. $globals.ProtoStream);
  8060. $core.addMethod(
  8061. $core.method({
  8062. selector: "setToEnd",
  8063. protocol: "positioning",
  8064. //>>excludeStart("ide", pragmas.excludeIdeData);
  8065. args: [],
  8066. source: "setToEnd\x0a\x09self subclassResponsibility",
  8067. referencedClasses: [],
  8068. //>>excludeEnd("ide");
  8069. pragmas: [],
  8070. messageSends: ["subclassResponsibility"]
  8071. }, function ($methodClass){ return function (){
  8072. var self=this,$self=this;
  8073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8074. return $core.withContext(function($ctx1) {
  8075. //>>excludeEnd("ctx");
  8076. $self._subclassResponsibility();
  8077. return self;
  8078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8079. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8080. //>>excludeEnd("ctx");
  8081. }; }),
  8082. $globals.ProtoStream);
  8083. $core.addMethod(
  8084. $core.method({
  8085. selector: "setToStart",
  8086. protocol: "positioning",
  8087. //>>excludeStart("ide", pragmas.excludeIdeData);
  8088. args: [],
  8089. source: "setToStart\x0a\x09self reset",
  8090. referencedClasses: [],
  8091. //>>excludeEnd("ide");
  8092. pragmas: [],
  8093. messageSends: ["reset"]
  8094. }, function ($methodClass){ return function (){
  8095. var self=this,$self=this;
  8096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8097. return $core.withContext(function($ctx1) {
  8098. //>>excludeEnd("ctx");
  8099. $self._reset();
  8100. return self;
  8101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8102. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8103. //>>excludeEnd("ctx");
  8104. }; }),
  8105. $globals.ProtoStream);
  8106. $core.addMethod(
  8107. $core.method({
  8108. selector: "write:",
  8109. protocol: "writing",
  8110. //>>excludeStart("ide", pragmas.excludeIdeData);
  8111. args: ["anObject"],
  8112. source: "write: anObject\x0a\x09anObject putOn: self",
  8113. referencedClasses: [],
  8114. //>>excludeEnd("ide");
  8115. pragmas: [],
  8116. messageSends: ["putOn:"]
  8117. }, function ($methodClass){ return function (anObject){
  8118. var self=this,$self=this;
  8119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8120. return $core.withContext(function($ctx1) {
  8121. //>>excludeEnd("ctx");
  8122. $recv(anObject)._putOn_(self);
  8123. return self;
  8124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8125. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8126. //>>excludeEnd("ctx");
  8127. }; }),
  8128. $globals.ProtoStream);
  8129. $core.addMethod(
  8130. $core.method({
  8131. selector: "on:",
  8132. protocol: "instance creation",
  8133. //>>excludeStart("ide", pragmas.excludeIdeData);
  8134. args: ["aCollection"],
  8135. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8136. referencedClasses: [],
  8137. //>>excludeEnd("ide");
  8138. pragmas: [],
  8139. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8140. }, function ($methodClass){ return function (aCollection){
  8141. var self=this,$self=this;
  8142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8143. return $core.withContext(function($ctx1) {
  8144. //>>excludeEnd("ctx");
  8145. var $1;
  8146. $1=$self._new();
  8147. $recv($1)._setCollection_(aCollection);
  8148. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8149. return $recv($1)._yourself();
  8150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8151. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8152. //>>excludeEnd("ctx");
  8153. }; }),
  8154. $globals.ProtoStream.a$cls);
  8155. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8156. //>>excludeStart("ide", pragmas.excludeIdeData);
  8157. $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.";
  8158. //>>excludeEnd("ide");
  8159. $core.addMethod(
  8160. $core.method({
  8161. selector: "atEnd",
  8162. protocol: "testing",
  8163. //>>excludeStart("ide", pragmas.excludeIdeData);
  8164. args: [],
  8165. source: "atEnd\x0a\x09^ self position = self size",
  8166. referencedClasses: [],
  8167. //>>excludeEnd("ide");
  8168. pragmas: [],
  8169. messageSends: ["=", "position", "size"]
  8170. }, function ($methodClass){ return function (){
  8171. var self=this,$self=this;
  8172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8173. return $core.withContext(function($ctx1) {
  8174. //>>excludeEnd("ctx");
  8175. return $recv($self._position()).__eq($self._size());
  8176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8177. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8178. //>>excludeEnd("ctx");
  8179. }; }),
  8180. $globals.Stream);
  8181. $core.addMethod(
  8182. $core.method({
  8183. selector: "atStart",
  8184. protocol: "testing",
  8185. //>>excludeStart("ide", pragmas.excludeIdeData);
  8186. args: [],
  8187. source: "atStart\x0a\x09^ self position = 0",
  8188. referencedClasses: [],
  8189. //>>excludeEnd("ide");
  8190. pragmas: [],
  8191. messageSends: ["=", "position"]
  8192. }, function ($methodClass){ return function (){
  8193. var self=this,$self=this;
  8194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8195. return $core.withContext(function($ctx1) {
  8196. //>>excludeEnd("ctx");
  8197. return $recv($self._position()).__eq((0));
  8198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8199. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8200. //>>excludeEnd("ctx");
  8201. }; }),
  8202. $globals.Stream);
  8203. $core.addMethod(
  8204. $core.method({
  8205. selector: "close",
  8206. protocol: "actions",
  8207. //>>excludeStart("ide", pragmas.excludeIdeData);
  8208. args: [],
  8209. source: "close",
  8210. referencedClasses: [],
  8211. //>>excludeEnd("ide");
  8212. pragmas: [],
  8213. messageSends: []
  8214. }, function ($methodClass){ return function (){
  8215. var self=this,$self=this;
  8216. return self;
  8217. }; }),
  8218. $globals.Stream);
  8219. $core.addMethod(
  8220. $core.method({
  8221. selector: "collection",
  8222. protocol: "accessing",
  8223. //>>excludeStart("ide", pragmas.excludeIdeData);
  8224. args: [],
  8225. source: "collection\x0a\x09^ collection",
  8226. referencedClasses: [],
  8227. //>>excludeEnd("ide");
  8228. pragmas: [],
  8229. messageSends: []
  8230. }, function ($methodClass){ return function (){
  8231. var self=this,$self=this;
  8232. return $self.collection;
  8233. }; }),
  8234. $globals.Stream);
  8235. $core.addMethod(
  8236. $core.method({
  8237. selector: "contents",
  8238. protocol: "accessing",
  8239. //>>excludeStart("ide", pragmas.excludeIdeData);
  8240. args: [],
  8241. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8242. referencedClasses: [],
  8243. //>>excludeEnd("ide");
  8244. pragmas: [],
  8245. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8246. }, function ($methodClass){ return function (){
  8247. var self=this,$self=this;
  8248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8249. return $core.withContext(function($ctx1) {
  8250. //>>excludeEnd("ctx");
  8251. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8253. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8254. //>>excludeEnd("ctx");
  8255. }; }),
  8256. $globals.Stream);
  8257. $core.addMethod(
  8258. $core.method({
  8259. selector: "flush",
  8260. protocol: "actions",
  8261. //>>excludeStart("ide", pragmas.excludeIdeData);
  8262. args: [],
  8263. source: "flush",
  8264. referencedClasses: [],
  8265. //>>excludeEnd("ide");
  8266. pragmas: [],
  8267. messageSends: []
  8268. }, function ($methodClass){ return function (){
  8269. var self=this,$self=this;
  8270. return self;
  8271. }; }),
  8272. $globals.Stream);
  8273. $core.addMethod(
  8274. $core.method({
  8275. selector: "isEmpty",
  8276. protocol: "testing",
  8277. //>>excludeStart("ide", pragmas.excludeIdeData);
  8278. args: [],
  8279. source: "isEmpty\x0a\x09^ self size = 0",
  8280. referencedClasses: [],
  8281. //>>excludeEnd("ide");
  8282. pragmas: [],
  8283. messageSends: ["=", "size"]
  8284. }, function ($methodClass){ return function (){
  8285. var self=this,$self=this;
  8286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8287. return $core.withContext(function($ctx1) {
  8288. //>>excludeEnd("ctx");
  8289. return $recv($self._size()).__eq((0));
  8290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8291. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8292. //>>excludeEnd("ctx");
  8293. }; }),
  8294. $globals.Stream);
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "next",
  8298. protocol: "reading",
  8299. //>>excludeStart("ide", pragmas.excludeIdeData);
  8300. args: [],
  8301. 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 ]",
  8302. referencedClasses: [],
  8303. //>>excludeEnd("ide");
  8304. pragmas: [],
  8305. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8306. }, function ($methodClass){ return function (){
  8307. var self=this,$self=this;
  8308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8309. return $core.withContext(function($ctx1) {
  8310. //>>excludeEnd("ctx");
  8311. var $1;
  8312. $1=$self._atEnd();
  8313. if($core.assert($1)){
  8314. return nil;
  8315. } else {
  8316. $self._position_($recv([$self._position()
  8317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8318. ,$ctx1.sendIdx["position"]=1
  8319. //>>excludeEnd("ctx");
  8320. ][0]).__plus((1)));
  8321. return $recv($self.collection)._at_($self._position());
  8322. }
  8323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8324. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8325. //>>excludeEnd("ctx");
  8326. }; }),
  8327. $globals.Stream);
  8328. $core.addMethod(
  8329. $core.method({
  8330. selector: "next:",
  8331. protocol: "reading",
  8332. //>>excludeStart("ide", pragmas.excludeIdeData);
  8333. args: ["anInteger"],
  8334. 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",
  8335. referencedClasses: [],
  8336. //>>excludeEnd("ide");
  8337. pragmas: [],
  8338. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8339. }, function ($methodClass){ return function (anInteger){
  8340. var self=this,$self=this;
  8341. var tempCollection;
  8342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8343. return $core.withContext(function($ctx1) {
  8344. //>>excludeEnd("ctx");
  8345. var $1;
  8346. tempCollection=$recv($recv($self._collection())._class())._new();
  8347. $recv(anInteger)._timesRepeat_((function(){
  8348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8349. return $core.withContext(function($ctx2) {
  8350. //>>excludeEnd("ctx");
  8351. $1=$self._atEnd();
  8352. if(!$core.assert($1)){
  8353. return $recv(tempCollection)._add_($self._next());
  8354. }
  8355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8357. //>>excludeEnd("ctx");
  8358. }));
  8359. return tempCollection;
  8360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8361. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8362. //>>excludeEnd("ctx");
  8363. }; }),
  8364. $globals.Stream);
  8365. $core.addMethod(
  8366. $core.method({
  8367. selector: "nextPut:",
  8368. protocol: "writing",
  8369. //>>excludeStart("ide", pragmas.excludeIdeData);
  8370. args: ["anObject"],
  8371. 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)",
  8372. referencedClasses: [],
  8373. //>>excludeEnd("ide");
  8374. pragmas: [],
  8375. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8376. }, function ($methodClass){ return function (anObject){
  8377. var self=this,$self=this;
  8378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8379. return $core.withContext(function($ctx1) {
  8380. //>>excludeEnd("ctx");
  8381. $self._position_($recv([$self._position()
  8382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8383. ,$ctx1.sendIdx["position"]=1
  8384. //>>excludeEnd("ctx");
  8385. ][0]).__plus((1)));
  8386. $recv($self._collection())._at_put_([$self._position()
  8387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8388. ,$ctx1.sendIdx["position"]=2
  8389. //>>excludeEnd("ctx");
  8390. ][0],anObject);
  8391. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8392. return self;
  8393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8394. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8395. //>>excludeEnd("ctx");
  8396. }; }),
  8397. $globals.Stream);
  8398. $core.addMethod(
  8399. $core.method({
  8400. selector: "peek",
  8401. protocol: "reading",
  8402. //>>excludeStart("ide", pragmas.excludeIdeData);
  8403. args: [],
  8404. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8405. referencedClasses: [],
  8406. //>>excludeEnd("ide");
  8407. pragmas: [],
  8408. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8409. }, function ($methodClass){ return function (){
  8410. var self=this,$self=this;
  8411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8412. return $core.withContext(function($ctx1) {
  8413. //>>excludeEnd("ctx");
  8414. var $1;
  8415. $1=$self._atEnd();
  8416. if(!$core.assert($1)){
  8417. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8418. }
  8419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8420. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8421. //>>excludeEnd("ctx");
  8422. }; }),
  8423. $globals.Stream);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "position",
  8427. protocol: "accessing",
  8428. //>>excludeStart("ide", pragmas.excludeIdeData);
  8429. args: [],
  8430. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8431. referencedClasses: [],
  8432. //>>excludeEnd("ide");
  8433. pragmas: [],
  8434. messageSends: ["ifNil:"]
  8435. }, function ($methodClass){ return function (){
  8436. var self=this,$self=this;
  8437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8438. return $core.withContext(function($ctx1) {
  8439. //>>excludeEnd("ctx");
  8440. var $1;
  8441. $1=$self.position;
  8442. if($1 == null || $1.a$nil){
  8443. $self.position=(0);
  8444. return $self.position;
  8445. } else {
  8446. return $1;
  8447. }
  8448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8449. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8450. //>>excludeEnd("ctx");
  8451. }; }),
  8452. $globals.Stream);
  8453. $core.addMethod(
  8454. $core.method({
  8455. selector: "position:",
  8456. protocol: "accessing",
  8457. //>>excludeStart("ide", pragmas.excludeIdeData);
  8458. args: ["anInteger"],
  8459. source: "position: anInteger\x0a\x09position := anInteger",
  8460. referencedClasses: [],
  8461. //>>excludeEnd("ide");
  8462. pragmas: [],
  8463. messageSends: []
  8464. }, function ($methodClass){ return function (anInteger){
  8465. var self=this,$self=this;
  8466. $self.position=anInteger;
  8467. return self;
  8468. }; }),
  8469. $globals.Stream);
  8470. $core.addMethod(
  8471. $core.method({
  8472. selector: "reset",
  8473. protocol: "actions",
  8474. //>>excludeStart("ide", pragmas.excludeIdeData);
  8475. args: [],
  8476. source: "reset\x0a\x09self position: 0",
  8477. referencedClasses: [],
  8478. //>>excludeEnd("ide");
  8479. pragmas: [],
  8480. messageSends: ["position:"]
  8481. }, function ($methodClass){ return function (){
  8482. var self=this,$self=this;
  8483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8484. return $core.withContext(function($ctx1) {
  8485. //>>excludeEnd("ctx");
  8486. $self._position_((0));
  8487. return self;
  8488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8489. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8490. //>>excludeEnd("ctx");
  8491. }; }),
  8492. $globals.Stream);
  8493. $core.addMethod(
  8494. $core.method({
  8495. selector: "resetContents",
  8496. protocol: "actions",
  8497. //>>excludeStart("ide", pragmas.excludeIdeData);
  8498. args: [],
  8499. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8500. referencedClasses: [],
  8501. //>>excludeEnd("ide");
  8502. pragmas: [],
  8503. messageSends: ["reset", "setStreamSize:"]
  8504. }, function ($methodClass){ return function (){
  8505. var self=this,$self=this;
  8506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8507. return $core.withContext(function($ctx1) {
  8508. //>>excludeEnd("ctx");
  8509. $self._reset();
  8510. $self._setStreamSize_((0));
  8511. return self;
  8512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8513. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8514. //>>excludeEnd("ctx");
  8515. }; }),
  8516. $globals.Stream);
  8517. $core.addMethod(
  8518. $core.method({
  8519. selector: "setCollection:",
  8520. protocol: "accessing",
  8521. //>>excludeStart("ide", pragmas.excludeIdeData);
  8522. args: ["aCollection"],
  8523. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8524. referencedClasses: [],
  8525. //>>excludeEnd("ide");
  8526. pragmas: [],
  8527. messageSends: []
  8528. }, function ($methodClass){ return function (aCollection){
  8529. var self=this,$self=this;
  8530. $self.collection=aCollection;
  8531. return self;
  8532. }; }),
  8533. $globals.Stream);
  8534. $core.addMethod(
  8535. $core.method({
  8536. selector: "setStreamSize:",
  8537. protocol: "accessing",
  8538. //>>excludeStart("ide", pragmas.excludeIdeData);
  8539. args: ["anInteger"],
  8540. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8541. referencedClasses: [],
  8542. //>>excludeEnd("ide");
  8543. pragmas: [],
  8544. messageSends: []
  8545. }, function ($methodClass){ return function (anInteger){
  8546. var self=this,$self=this;
  8547. $self.streamSize=anInteger;
  8548. return self;
  8549. }; }),
  8550. $globals.Stream);
  8551. $core.addMethod(
  8552. $core.method({
  8553. selector: "setToEnd",
  8554. protocol: "positioning",
  8555. //>>excludeStart("ide", pragmas.excludeIdeData);
  8556. args: [],
  8557. source: "setToEnd\x0a\x09self position: self size",
  8558. referencedClasses: [],
  8559. //>>excludeEnd("ide");
  8560. pragmas: [],
  8561. messageSends: ["position:", "size"]
  8562. }, function ($methodClass){ return function (){
  8563. var self=this,$self=this;
  8564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8565. return $core.withContext(function($ctx1) {
  8566. //>>excludeEnd("ctx");
  8567. $self._position_($self._size());
  8568. return self;
  8569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8570. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8571. //>>excludeEnd("ctx");
  8572. }; }),
  8573. $globals.Stream);
  8574. $core.addMethod(
  8575. $core.method({
  8576. selector: "size",
  8577. protocol: "accessing",
  8578. //>>excludeStart("ide", pragmas.excludeIdeData);
  8579. args: [],
  8580. source: "size\x0a\x09^ self streamSize",
  8581. referencedClasses: [],
  8582. //>>excludeEnd("ide");
  8583. pragmas: [],
  8584. messageSends: ["streamSize"]
  8585. }, function ($methodClass){ return function (){
  8586. var self=this,$self=this;
  8587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8588. return $core.withContext(function($ctx1) {
  8589. //>>excludeEnd("ctx");
  8590. return $self._streamSize();
  8591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8592. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8593. //>>excludeEnd("ctx");
  8594. }; }),
  8595. $globals.Stream);
  8596. $core.addMethod(
  8597. $core.method({
  8598. selector: "skip:",
  8599. protocol: "positioning",
  8600. //>>excludeStart("ide", pragmas.excludeIdeData);
  8601. args: ["anInteger"],
  8602. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8603. referencedClasses: [],
  8604. //>>excludeEnd("ide");
  8605. pragmas: [],
  8606. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8607. }, function ($methodClass){ return function (anInteger){
  8608. var self=this,$self=this;
  8609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8610. return $core.withContext(function($ctx1) {
  8611. //>>excludeEnd("ctx");
  8612. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8613. return self;
  8614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8615. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8616. //>>excludeEnd("ctx");
  8617. }; }),
  8618. $globals.Stream);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "streamSize",
  8622. protocol: "accessing",
  8623. //>>excludeStart("ide", pragmas.excludeIdeData);
  8624. args: [],
  8625. source: "streamSize\x0a\x09^ streamSize",
  8626. referencedClasses: [],
  8627. //>>excludeEnd("ide");
  8628. pragmas: [],
  8629. messageSends: []
  8630. }, function ($methodClass){ return function (){
  8631. var self=this,$self=this;
  8632. return $self.streamSize;
  8633. }; }),
  8634. $globals.Stream);
  8635. $core.addMethod(
  8636. $core.method({
  8637. selector: "on:",
  8638. protocol: "instance creation",
  8639. //>>excludeStart("ide", pragmas.excludeIdeData);
  8640. args: ["aCollection"],
  8641. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8642. referencedClasses: [],
  8643. //>>excludeEnd("ide");
  8644. pragmas: [],
  8645. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8646. }, function ($methodClass){ return function (aCollection){
  8647. var self=this,$self=this;
  8648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8649. return $core.withContext(function($ctx1) {
  8650. //>>excludeEnd("ctx");
  8651. var $1;
  8652. $1=$self._new();
  8653. $recv($1)._setCollection_(aCollection);
  8654. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8655. return $recv($1)._yourself();
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8658. //>>excludeEnd("ctx");
  8659. }; }),
  8660. $globals.Stream.a$cls);
  8661. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8662. //>>excludeStart("ide", pragmas.excludeIdeData);
  8663. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8664. //>>excludeEnd("ide");
  8665. $core.addMethod(
  8666. $core.method({
  8667. selector: "cr",
  8668. protocol: "writing",
  8669. //>>excludeStart("ide", pragmas.excludeIdeData);
  8670. args: [],
  8671. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8672. referencedClasses: ["String"],
  8673. //>>excludeEnd("ide");
  8674. pragmas: [],
  8675. messageSends: ["nextPutAll:", "cr"]
  8676. }, function ($methodClass){ return function (){
  8677. var self=this,$self=this;
  8678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8679. return $core.withContext(function($ctx1) {
  8680. //>>excludeEnd("ctx");
  8681. return $self._nextPutAll_($recv($globals.String)._cr());
  8682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8683. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8684. //>>excludeEnd("ctx");
  8685. }; }),
  8686. $globals.StringStream);
  8687. $core.addMethod(
  8688. $core.method({
  8689. selector: "crlf",
  8690. protocol: "writing",
  8691. //>>excludeStart("ide", pragmas.excludeIdeData);
  8692. args: [],
  8693. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8694. referencedClasses: ["String"],
  8695. //>>excludeEnd("ide");
  8696. pragmas: [],
  8697. messageSends: ["nextPutAll:", "crlf"]
  8698. }, function ($methodClass){ return function (){
  8699. var self=this,$self=this;
  8700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8701. return $core.withContext(function($ctx1) {
  8702. //>>excludeEnd("ctx");
  8703. return $self._nextPutAll_($recv($globals.String)._crlf());
  8704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8705. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8706. //>>excludeEnd("ctx");
  8707. }; }),
  8708. $globals.StringStream);
  8709. $core.addMethod(
  8710. $core.method({
  8711. selector: "lf",
  8712. protocol: "writing",
  8713. //>>excludeStart("ide", pragmas.excludeIdeData);
  8714. args: [],
  8715. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8716. referencedClasses: ["String"],
  8717. //>>excludeEnd("ide");
  8718. pragmas: [],
  8719. messageSends: ["nextPutAll:", "lf"]
  8720. }, function ($methodClass){ return function (){
  8721. var self=this,$self=this;
  8722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8723. return $core.withContext(function($ctx1) {
  8724. //>>excludeEnd("ctx");
  8725. return $self._nextPutAll_($recv($globals.String)._lf());
  8726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8727. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8728. //>>excludeEnd("ctx");
  8729. }; }),
  8730. $globals.StringStream);
  8731. $core.addMethod(
  8732. $core.method({
  8733. selector: "next:",
  8734. protocol: "reading",
  8735. //>>excludeStart("ide", pragmas.excludeIdeData);
  8736. args: ["anInteger"],
  8737. 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",
  8738. referencedClasses: [],
  8739. //>>excludeEnd("ide");
  8740. pragmas: [],
  8741. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8742. }, function ($methodClass){ return function (anInteger){
  8743. var self=this,$self=this;
  8744. var tempCollection;
  8745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8746. return $core.withContext(function($ctx1) {
  8747. //>>excludeEnd("ctx");
  8748. var $1;
  8749. tempCollection=$recv($recv($self._collection())._class())._new();
  8750. $recv(anInteger)._timesRepeat_((function(){
  8751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8752. return $core.withContext(function($ctx2) {
  8753. //>>excludeEnd("ctx");
  8754. $1=$self._atEnd();
  8755. if(!$core.assert($1)){
  8756. tempCollection=$recv(tempCollection).__comma($self._next());
  8757. return tempCollection;
  8758. }
  8759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8761. //>>excludeEnd("ctx");
  8762. }));
  8763. return tempCollection;
  8764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8765. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8766. //>>excludeEnd("ctx");
  8767. }; }),
  8768. $globals.StringStream);
  8769. $core.addMethod(
  8770. $core.method({
  8771. selector: "nextPut:",
  8772. protocol: "writing",
  8773. //>>excludeStart("ide", pragmas.excludeIdeData);
  8774. args: ["aString"],
  8775. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8776. referencedClasses: [],
  8777. //>>excludeEnd("ide");
  8778. pragmas: [],
  8779. messageSends: ["nextPutAll:"]
  8780. }, function ($methodClass){ return function (aString){
  8781. var self=this,$self=this;
  8782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8783. return $core.withContext(function($ctx1) {
  8784. //>>excludeEnd("ctx");
  8785. $self._nextPutAll_(aString);
  8786. return self;
  8787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8788. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8789. //>>excludeEnd("ctx");
  8790. }; }),
  8791. $globals.StringStream);
  8792. $core.addMethod(
  8793. $core.method({
  8794. selector: "nextPutAll:",
  8795. protocol: "writing",
  8796. //>>excludeStart("ide", pragmas.excludeIdeData);
  8797. args: ["aString"],
  8798. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  8799. referencedClasses: [],
  8800. //>>excludeEnd("ide");
  8801. pragmas: [],
  8802. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8803. }, function ($methodClass){ return function (aString){
  8804. var self=this,$self=this;
  8805. var pre,post;
  8806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8807. return $core.withContext(function($ctx1) {
  8808. //>>excludeEnd("ctx");
  8809. var $1;
  8810. $1=$recv([$self._position()
  8811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8812. ,$ctx1.sendIdx["position"]=1
  8813. //>>excludeEnd("ctx");
  8814. ][0]).__eq([$recv([$self._collection()
  8815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8816. ,$ctx1.sendIdx["collection"]=1
  8817. //>>excludeEnd("ctx");
  8818. ][0])._size()
  8819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8820. ,$ctx1.sendIdx["size"]=1
  8821. //>>excludeEnd("ctx");
  8822. ][0]);
  8823. if($core.assert($1)){
  8824. [$self._setCollection_([$recv([$self._collection()
  8825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8826. ,$ctx1.sendIdx["collection"]=2
  8827. //>>excludeEnd("ctx");
  8828. ][0]).__comma(aString)
  8829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8830. ,$ctx1.sendIdx[","]=1
  8831. //>>excludeEnd("ctx");
  8832. ][0])
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. ,$ctx1.sendIdx["setCollection:"]=1
  8835. //>>excludeEnd("ctx");
  8836. ][0];
  8837. } else {
  8838. pre=[$recv([$self._collection()
  8839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8840. ,$ctx1.sendIdx["collection"]=3
  8841. //>>excludeEnd("ctx");
  8842. ][0])._copyFrom_to_((1),[$self._position()
  8843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8844. ,$ctx1.sendIdx["position"]=2
  8845. //>>excludeEnd("ctx");
  8846. ][0])
  8847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8848. ,$ctx1.sendIdx["copyFrom:to:"]=1
  8849. //>>excludeEnd("ctx");
  8850. ][0];
  8851. post=$recv([$self._collection()
  8852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8853. ,$ctx1.sendIdx["collection"]=4
  8854. //>>excludeEnd("ctx");
  8855. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  8856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8857. ,$ctx1.sendIdx["position"]=3
  8858. //>>excludeEnd("ctx");
  8859. ][0]).__plus((1))
  8860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8861. ,$ctx1.sendIdx["+"]=2
  8862. //>>excludeEnd("ctx");
  8863. ][0]).__plus([$recv(aString)._size()
  8864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8865. ,$ctx1.sendIdx["size"]=2
  8866. //>>excludeEnd("ctx");
  8867. ][0])
  8868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8869. ,$ctx1.sendIdx["+"]=1
  8870. //>>excludeEnd("ctx");
  8871. ][0],[$recv($self._collection())._size()
  8872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8873. ,$ctx1.sendIdx["size"]=3
  8874. //>>excludeEnd("ctx");
  8875. ][0]);
  8876. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  8877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8878. ,$ctx1.sendIdx[","]=2
  8879. //>>excludeEnd("ctx");
  8880. ][0]);
  8881. }
  8882. $self._position_($recv([$self._position()
  8883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8884. ,$ctx1.sendIdx["position"]=4
  8885. //>>excludeEnd("ctx");
  8886. ][0]).__plus($recv(aString)._size()));
  8887. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8888. return self;
  8889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8890. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8891. //>>excludeEnd("ctx");
  8892. }; }),
  8893. $globals.StringStream);
  8894. $core.addMethod(
  8895. $core.method({
  8896. selector: "nextPutString:",
  8897. protocol: "writing",
  8898. //>>excludeStart("ide", pragmas.excludeIdeData);
  8899. args: ["aString"],
  8900. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8901. referencedClasses: [],
  8902. //>>excludeEnd("ide");
  8903. pragmas: [],
  8904. messageSends: ["nextPutAll:"]
  8905. }, function ($methodClass){ return function (aString){
  8906. var self=this,$self=this;
  8907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8908. return $core.withContext(function($ctx1) {
  8909. //>>excludeEnd("ctx");
  8910. $self._nextPutAll_(aString);
  8911. return self;
  8912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8913. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8914. //>>excludeEnd("ctx");
  8915. }; }),
  8916. $globals.StringStream);
  8917. $core.addMethod(
  8918. $core.method({
  8919. selector: "print:",
  8920. protocol: "writing",
  8921. //>>excludeStart("ide", pragmas.excludeIdeData);
  8922. args: ["anObject"],
  8923. source: "print: anObject\x0a\x09anObject printOn: self",
  8924. referencedClasses: [],
  8925. //>>excludeEnd("ide");
  8926. pragmas: [],
  8927. messageSends: ["printOn:"]
  8928. }, function ($methodClass){ return function (anObject){
  8929. var self=this,$self=this;
  8930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8931. return $core.withContext(function($ctx1) {
  8932. //>>excludeEnd("ctx");
  8933. $recv(anObject)._printOn_(self);
  8934. return self;
  8935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8936. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8937. //>>excludeEnd("ctx");
  8938. }; }),
  8939. $globals.StringStream);
  8940. $core.addMethod(
  8941. $core.method({
  8942. selector: "printSymbol:",
  8943. protocol: "writing",
  8944. //>>excludeStart("ide", pragmas.excludeIdeData);
  8945. args: ["anObject"],
  8946. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8947. referencedClasses: [],
  8948. //>>excludeEnd("ide");
  8949. pragmas: [],
  8950. messageSends: ["asSymbolPrintOn:"]
  8951. }, function ($methodClass){ return function (anObject){
  8952. var self=this,$self=this;
  8953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8954. return $core.withContext(function($ctx1) {
  8955. //>>excludeEnd("ctx");
  8956. $recv(anObject)._asSymbolPrintOn_(self);
  8957. return self;
  8958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8959. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8960. //>>excludeEnd("ctx");
  8961. }; }),
  8962. $globals.StringStream);
  8963. $core.addMethod(
  8964. $core.method({
  8965. selector: "space",
  8966. protocol: "writing",
  8967. //>>excludeStart("ide", pragmas.excludeIdeData);
  8968. args: [],
  8969. source: "space\x0a\x09self nextPut: ' '",
  8970. referencedClasses: [],
  8971. //>>excludeEnd("ide");
  8972. pragmas: [],
  8973. messageSends: ["nextPut:"]
  8974. }, function ($methodClass){ return function (){
  8975. var self=this,$self=this;
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. return $core.withContext(function($ctx1) {
  8978. //>>excludeEnd("ctx");
  8979. $self._nextPut_(" ");
  8980. return self;
  8981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8982. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8983. //>>excludeEnd("ctx");
  8984. }; }),
  8985. $globals.StringStream);
  8986. $core.addMethod(
  8987. $core.method({
  8988. selector: "tab",
  8989. protocol: "writing",
  8990. //>>excludeStart("ide", pragmas.excludeIdeData);
  8991. args: [],
  8992. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8993. referencedClasses: ["String"],
  8994. //>>excludeEnd("ide");
  8995. pragmas: [],
  8996. messageSends: ["nextPutAll:", "tab"]
  8997. }, function ($methodClass){ return function (){
  8998. var self=this,$self=this;
  8999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9000. return $core.withContext(function($ctx1) {
  9001. //>>excludeEnd("ctx");
  9002. return $self._nextPutAll_($recv($globals.String)._tab());
  9003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9004. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  9005. //>>excludeEnd("ctx");
  9006. }; }),
  9007. $globals.StringStream);
  9008. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9009. //>>excludeStart("ide", pragmas.excludeIdeData);
  9010. $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.";
  9011. //>>excludeEnd("ide");
  9012. $core.addMethod(
  9013. $core.method({
  9014. selector: "initialize",
  9015. protocol: "initialization",
  9016. //>>excludeStart("ide", pragmas.excludeIdeData);
  9017. args: [],
  9018. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9019. referencedClasses: ["OrderedCollection"],
  9020. //>>excludeEnd("ide");
  9021. pragmas: [],
  9022. messageSends: ["initialize", "new"]
  9023. }, function ($methodClass){ return function (){
  9024. var self=this,$self=this;
  9025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9026. return $core.withContext(function($ctx1) {
  9027. //>>excludeEnd("ctx");
  9028. [(
  9029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9030. $ctx1.supercall = true,
  9031. //>>excludeEnd("ctx");
  9032. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  9033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9034. ,$ctx1.supercall = false
  9035. //>>excludeEnd("ctx");
  9036. ][0];
  9037. $self.read=[$recv($globals.OrderedCollection)._new()
  9038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9039. ,$ctx1.sendIdx["new"]=1
  9040. //>>excludeEnd("ctx");
  9041. ][0];
  9042. $self.write=$recv($globals.OrderedCollection)._new();
  9043. $self.readIndex=(1);
  9044. return self;
  9045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9046. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9047. //>>excludeEnd("ctx");
  9048. }; }),
  9049. $globals.Queue);
  9050. $core.addMethod(
  9051. $core.method({
  9052. selector: "next",
  9053. protocol: "accessing",
  9054. //>>excludeStart("ide", pragmas.excludeIdeData);
  9055. args: [],
  9056. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9057. referencedClasses: [],
  9058. //>>excludeEnd("ide");
  9059. pragmas: [],
  9060. messageSends: ["nextIfAbsent:", "error:"]
  9061. }, function ($methodClass){ return function (){
  9062. var self=this,$self=this;
  9063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9064. return $core.withContext(function($ctx1) {
  9065. //>>excludeEnd("ctx");
  9066. return $self._nextIfAbsent_((function(){
  9067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9068. return $core.withContext(function($ctx2) {
  9069. //>>excludeEnd("ctx");
  9070. return $self._error_("Cannot read from empty Queue.");
  9071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9072. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9073. //>>excludeEnd("ctx");
  9074. }));
  9075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9076. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9077. //>>excludeEnd("ctx");
  9078. }; }),
  9079. $globals.Queue);
  9080. $core.addMethod(
  9081. $core.method({
  9082. selector: "nextIfAbsent:",
  9083. protocol: "accessing",
  9084. //>>excludeStart("ide", pragmas.excludeIdeData);
  9085. args: ["aBlock"],
  9086. 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",
  9087. referencedClasses: ["OrderedCollection"],
  9088. //>>excludeEnd("ide");
  9089. pragmas: [],
  9090. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9091. }, function ($methodClass){ return function (aBlock){
  9092. var self=this,$self=this;
  9093. var result;
  9094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9095. return $core.withContext(function($ctx1) {
  9096. //>>excludeEnd("ctx");
  9097. var $1;
  9098. var $early={};
  9099. try {
  9100. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9102. return $core.withContext(function($ctx2) {
  9103. //>>excludeEnd("ctx");
  9104. $recv($self.write)._ifEmpty_((function(){
  9105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9106. return $core.withContext(function($ctx3) {
  9107. //>>excludeEnd("ctx");
  9108. $1=$recv($self.readIndex).__gt((1));
  9109. if($core.assert($1)){
  9110. $self.read=[];
  9111. $self.readIndex=(1);
  9112. $self.readIndex;
  9113. }
  9114. throw $early=[$recv(aBlock)._value()];
  9115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9116. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9117. //>>excludeEnd("ctx");
  9118. }));
  9119. $self.read=$self.write;
  9120. $self.readIndex=(1);
  9121. $self.write=$recv($globals.OrderedCollection)._new();
  9122. return $recv($self.read)._first();
  9123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9125. //>>excludeEnd("ctx");
  9126. }));
  9127. $recv($self.read)._at_put_($self.readIndex,nil);
  9128. $self.readIndex=$recv($self.readIndex).__plus((1));
  9129. return result;
  9130. }
  9131. catch(e) {if(e===$early)return e[0]; throw e}
  9132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9133. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9134. //>>excludeEnd("ctx");
  9135. }; }),
  9136. $globals.Queue);
  9137. $core.addMethod(
  9138. $core.method({
  9139. selector: "nextPut:",
  9140. protocol: "accessing",
  9141. //>>excludeStart("ide", pragmas.excludeIdeData);
  9142. args: ["anObject"],
  9143. source: "nextPut: anObject\x0a\x09write add: anObject",
  9144. referencedClasses: [],
  9145. //>>excludeEnd("ide");
  9146. pragmas: [],
  9147. messageSends: ["add:"]
  9148. }, function ($methodClass){ return function (anObject){
  9149. var self=this,$self=this;
  9150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9151. return $core.withContext(function($ctx1) {
  9152. //>>excludeEnd("ctx");
  9153. $recv($self.write)._add_(anObject);
  9154. return self;
  9155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9156. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9157. //>>excludeEnd("ctx");
  9158. }; }),
  9159. $globals.Queue);
  9160. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9161. //>>excludeStart("ide", pragmas.excludeIdeData);
  9162. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9163. //>>excludeEnd("ide");
  9164. $core.addMethod(
  9165. $core.method({
  9166. selector: "compile:",
  9167. protocol: "evaluating",
  9168. //>>excludeStart("ide", pragmas.excludeIdeData);
  9169. args: ["aString"],
  9170. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9171. referencedClasses: [],
  9172. //>>excludeEnd("ide");
  9173. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9174. messageSends: []
  9175. }, function ($methodClass){ return function (aString){
  9176. var self=this,$self=this;
  9177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9178. return $core.withContext(function($ctx1) {
  9179. //>>excludeEnd("ctx");
  9180. return self.compile(aString);
  9181. return self;
  9182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9183. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9184. //>>excludeEnd("ctx");
  9185. }; }),
  9186. $globals.RegularExpression);
  9187. $core.addMethod(
  9188. $core.method({
  9189. selector: "exec:",
  9190. protocol: "evaluating",
  9191. //>>excludeStart("ide", pragmas.excludeIdeData);
  9192. args: ["aString"],
  9193. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9194. referencedClasses: [],
  9195. //>>excludeEnd("ide");
  9196. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9197. messageSends: []
  9198. }, function ($methodClass){ return function (aString){
  9199. var self=this,$self=this;
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. return $core.withContext(function($ctx1) {
  9202. //>>excludeEnd("ctx");
  9203. return self.exec(aString) || nil;
  9204. return self;
  9205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9206. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9207. //>>excludeEnd("ctx");
  9208. }; }),
  9209. $globals.RegularExpression);
  9210. $core.addMethod(
  9211. $core.method({
  9212. selector: "test:",
  9213. protocol: "evaluating",
  9214. //>>excludeStart("ide", pragmas.excludeIdeData);
  9215. args: ["aString"],
  9216. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9217. referencedClasses: [],
  9218. //>>excludeEnd("ide");
  9219. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9220. messageSends: []
  9221. }, function ($methodClass){ return function (aString){
  9222. var self=this,$self=this;
  9223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9224. return $core.withContext(function($ctx1) {
  9225. //>>excludeEnd("ctx");
  9226. return self.test(aString);
  9227. return self;
  9228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9229. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9230. //>>excludeEnd("ctx");
  9231. }; }),
  9232. $globals.RegularExpression);
  9233. $core.addMethod(
  9234. $core.method({
  9235. selector: "fromString:",
  9236. protocol: "instance creation",
  9237. //>>excludeStart("ide", pragmas.excludeIdeData);
  9238. args: ["aString"],
  9239. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9240. referencedClasses: [],
  9241. //>>excludeEnd("ide");
  9242. pragmas: [],
  9243. messageSends: ["fromString:flag:"]
  9244. }, function ($methodClass){ return function (aString){
  9245. var self=this,$self=this;
  9246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9247. return $core.withContext(function($ctx1) {
  9248. //>>excludeEnd("ctx");
  9249. return $self._fromString_flag_(aString,"");
  9250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9251. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9252. //>>excludeEnd("ctx");
  9253. }; }),
  9254. $globals.RegularExpression.a$cls);
  9255. $core.addMethod(
  9256. $core.method({
  9257. selector: "fromString:flag:",
  9258. protocol: "instance creation",
  9259. //>>excludeStart("ide", pragmas.excludeIdeData);
  9260. args: ["aString", "anotherString"],
  9261. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9262. referencedClasses: [],
  9263. //>>excludeEnd("ide");
  9264. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9265. messageSends: []
  9266. }, function ($methodClass){ return function (aString,anotherString){
  9267. var self=this,$self=this;
  9268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9269. return $core.withContext(function($ctx1) {
  9270. //>>excludeEnd("ctx");
  9271. return new RegExp(aString, anotherString);
  9272. return self;
  9273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9274. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9275. //>>excludeEnd("ctx");
  9276. }; }),
  9277. $globals.RegularExpression.a$cls);
  9278. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9279. $core.addMethod(
  9280. $core.method({
  9281. selector: "at:",
  9282. protocol: "accessing",
  9283. //>>excludeStart("ide", pragmas.excludeIdeData);
  9284. args: ["anIndex"],
  9285. 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 ]",
  9286. referencedClasses: [],
  9287. //>>excludeEnd("ide");
  9288. pragmas: [],
  9289. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9290. }, function ($methodClass){ return function (anIndex){
  9291. var self=this,$self=this;
  9292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9293. return $core.withContext(function($ctx1) {
  9294. //>>excludeEnd("ctx");
  9295. return $self._at_ifAbsent_(anIndex,(function(){
  9296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9297. return $core.withContext(function($ctx2) {
  9298. //>>excludeEnd("ctx");
  9299. return $self._errorNotFound();
  9300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9302. //>>excludeEnd("ctx");
  9303. }));
  9304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9305. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9306. //>>excludeEnd("ctx");
  9307. }; }),
  9308. $globals.TKeyValueCollection);
  9309. $core.addMethod(
  9310. $core.method({
  9311. selector: "at:ifAbsent:",
  9312. protocol: "accessing",
  9313. //>>excludeStart("ide", pragmas.excludeIdeData);
  9314. args: ["anIndex", "aBlock"],
  9315. 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",
  9316. referencedClasses: [],
  9317. //>>excludeEnd("ide");
  9318. pragmas: [],
  9319. messageSends: ["subclassResponsibility"]
  9320. }, function ($methodClass){ return function (anIndex,aBlock){
  9321. var self=this,$self=this;
  9322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9323. return $core.withContext(function($ctx1) {
  9324. //>>excludeEnd("ctx");
  9325. $self._subclassResponsibility();
  9326. return self;
  9327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9328. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9329. //>>excludeEnd("ctx");
  9330. }; }),
  9331. $globals.TKeyValueCollection);
  9332. $core.addMethod(
  9333. $core.method({
  9334. selector: "at:ifAbsentPut:",
  9335. protocol: "accessing",
  9336. //>>excludeStart("ide", pragmas.excludeIdeData);
  9337. args: ["aKey", "aBlock"],
  9338. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9339. referencedClasses: [],
  9340. //>>excludeEnd("ide");
  9341. pragmas: [],
  9342. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9343. }, function ($methodClass){ return function (aKey,aBlock){
  9344. var self=this,$self=this;
  9345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9346. return $core.withContext(function($ctx1) {
  9347. //>>excludeEnd("ctx");
  9348. return $self._at_ifAbsent_(aKey,(function(){
  9349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9350. return $core.withContext(function($ctx2) {
  9351. //>>excludeEnd("ctx");
  9352. return $self._at_put_(aKey,$recv(aBlock)._value());
  9353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9355. //>>excludeEnd("ctx");
  9356. }));
  9357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9358. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9359. //>>excludeEnd("ctx");
  9360. }; }),
  9361. $globals.TKeyValueCollection);
  9362. $core.addMethod(
  9363. $core.method({
  9364. selector: "at:ifPresent:",
  9365. protocol: "accessing",
  9366. //>>excludeStart("ide", pragmas.excludeIdeData);
  9367. args: ["anIndex", "aBlock"],
  9368. 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 ]",
  9369. referencedClasses: [],
  9370. //>>excludeEnd("ide");
  9371. pragmas: [],
  9372. messageSends: ["at:ifPresent:ifAbsent:"]
  9373. }, function ($methodClass){ return function (anIndex,aBlock){
  9374. var self=this,$self=this;
  9375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9376. return $core.withContext(function($ctx1) {
  9377. //>>excludeEnd("ctx");
  9378. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9379. return nil;
  9380. }));
  9381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9382. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9383. //>>excludeEnd("ctx");
  9384. }; }),
  9385. $globals.TKeyValueCollection);
  9386. $core.addMethod(
  9387. $core.method({
  9388. selector: "at:ifPresent:ifAbsent:",
  9389. protocol: "accessing",
  9390. //>>excludeStart("ide", pragmas.excludeIdeData);
  9391. args: ["anIndex", "aBlock", "anotherBlock"],
  9392. 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",
  9393. referencedClasses: [],
  9394. //>>excludeEnd("ide");
  9395. pragmas: [],
  9396. messageSends: ["subclassResponsibility"]
  9397. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9398. var self=this,$self=this;
  9399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9400. return $core.withContext(function($ctx1) {
  9401. //>>excludeEnd("ctx");
  9402. $self._subclassResponsibility();
  9403. return self;
  9404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9405. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9406. //>>excludeEnd("ctx");
  9407. }; }),
  9408. $globals.TKeyValueCollection);
  9409. $core.addMethod(
  9410. $core.method({
  9411. selector: "at:put:",
  9412. protocol: "accessing",
  9413. //>>excludeStart("ide", pragmas.excludeIdeData);
  9414. args: ["anIndex", "anObject"],
  9415. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9416. referencedClasses: [],
  9417. //>>excludeEnd("ide");
  9418. pragmas: [],
  9419. messageSends: ["subclassResponsibility"]
  9420. }, function ($methodClass){ return function (anIndex,anObject){
  9421. var self=this,$self=this;
  9422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9423. return $core.withContext(function($ctx1) {
  9424. //>>excludeEnd("ctx");
  9425. $self._subclassResponsibility();
  9426. return self;
  9427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9428. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9429. //>>excludeEnd("ctx");
  9430. }; }),
  9431. $globals.TKeyValueCollection);
  9432. $core.addMethod(
  9433. $core.method({
  9434. selector: "indexOf:",
  9435. protocol: "accessing",
  9436. //>>excludeStart("ide", pragmas.excludeIdeData);
  9437. args: ["anObject"],
  9438. 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 ]",
  9439. referencedClasses: [],
  9440. //>>excludeEnd("ide");
  9441. pragmas: [],
  9442. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9443. }, function ($methodClass){ return function (anObject){
  9444. var self=this,$self=this;
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. return $core.withContext(function($ctx1) {
  9447. //>>excludeEnd("ctx");
  9448. return $self._indexOf_ifAbsent_(anObject,(function(){
  9449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9450. return $core.withContext(function($ctx2) {
  9451. //>>excludeEnd("ctx");
  9452. return $self._errorNotFound();
  9453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9455. //>>excludeEnd("ctx");
  9456. }));
  9457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9458. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9459. //>>excludeEnd("ctx");
  9460. }; }),
  9461. $globals.TKeyValueCollection);
  9462. $core.addMethod(
  9463. $core.method({
  9464. selector: "indexOf:ifAbsent:",
  9465. protocol: "accessing",
  9466. //>>excludeStart("ide", pragmas.excludeIdeData);
  9467. args: ["anObject", "aBlock"],
  9468. 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",
  9469. referencedClasses: [],
  9470. //>>excludeEnd("ide");
  9471. pragmas: [],
  9472. messageSends: ["subclassResponsibility"]
  9473. }, function ($methodClass){ return function (anObject,aBlock){
  9474. var self=this,$self=this;
  9475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9476. return $core.withContext(function($ctx1) {
  9477. //>>excludeEnd("ctx");
  9478. $self._subclassResponsibility();
  9479. return self;
  9480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9481. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9482. //>>excludeEnd("ctx");
  9483. }; }),
  9484. $globals.TKeyValueCollection);
  9485. $core.addMethod(
  9486. $core.method({
  9487. selector: "with:do:",
  9488. protocol: "enumerating",
  9489. //>>excludeStart("ide", pragmas.excludeIdeData);
  9490. args: ["anotherCollection", "aBlock"],
  9491. 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) ]",
  9492. referencedClasses: [],
  9493. //>>excludeEnd("ide");
  9494. pragmas: [],
  9495. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9496. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9497. var self=this,$self=this;
  9498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9499. return $core.withContext(function($ctx1) {
  9500. //>>excludeEnd("ctx");
  9501. $self._withIndexDo_((function(each,index){
  9502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9503. return $core.withContext(function($ctx2) {
  9504. //>>excludeEnd("ctx");
  9505. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9507. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9508. //>>excludeEnd("ctx");
  9509. }));
  9510. return self;
  9511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9512. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9513. //>>excludeEnd("ctx");
  9514. }; }),
  9515. $globals.TKeyValueCollection);
  9516. $core.addMethod(
  9517. $core.method({
  9518. selector: "withIndexDo:",
  9519. protocol: "enumerating",
  9520. //>>excludeStart("ide", pragmas.excludeIdeData);
  9521. args: ["aBlock"],
  9522. 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",
  9523. referencedClasses: [],
  9524. //>>excludeEnd("ide");
  9525. pragmas: [],
  9526. messageSends: ["subclassResponsibility"]
  9527. }, function ($methodClass){ return function (aBlock){
  9528. var self=this,$self=this;
  9529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9530. return $core.withContext(function($ctx1) {
  9531. //>>excludeEnd("ctx");
  9532. $self._subclassResponsibility();
  9533. return self;
  9534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9535. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9536. //>>excludeEnd("ctx");
  9537. }; }),
  9538. $globals.TKeyValueCollection);
  9539. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9540. $core.addMethod(
  9541. $core.method({
  9542. selector: "at:ifAbsent:",
  9543. protocol: "accessing",
  9544. //>>excludeStart("ide", pragmas.excludeIdeData);
  9545. args: ["anIndex", "aBlock"],
  9546. 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'>",
  9547. referencedClasses: [],
  9548. //>>excludeEnd("ide");
  9549. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  9550. messageSends: []
  9551. }, function ($methodClass){ return function (anIndex,aBlock){
  9552. var self=this,$self=this;
  9553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9554. return $core.withContext(function($ctx1) {
  9555. //>>excludeEnd("ctx");
  9556. return anIndex >= 1 && anIndex <= self.length
  9557. ? self[anIndex - 1]
  9558. : aBlock._value()
  9559. ;
  9560. return self;
  9561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9562. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9563. //>>excludeEnd("ctx");
  9564. }; }),
  9565. $globals.TNativeZeroBasedCollection);
  9566. $core.addMethod(
  9567. $core.method({
  9568. selector: "at:ifPresent:ifAbsent:",
  9569. protocol: "accessing",
  9570. //>>excludeStart("ide", pragmas.excludeIdeData);
  9571. args: ["anIndex", "aBlock", "anotherBlock"],
  9572. 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'>",
  9573. referencedClasses: [],
  9574. //>>excludeEnd("ide");
  9575. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09"]]],
  9576. messageSends: []
  9577. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9578. var self=this,$self=this;
  9579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9580. return $core.withContext(function($ctx1) {
  9581. //>>excludeEnd("ctx");
  9582. return anIndex >= 1 && anIndex <= self.length
  9583. ? aBlock._value_(self[anIndex - 1])
  9584. : anotherBlock._value()
  9585. ;
  9586. return self;
  9587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9588. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9589. //>>excludeEnd("ctx");
  9590. }; }),
  9591. $globals.TNativeZeroBasedCollection);
  9592. $core.addMethod(
  9593. $core.method({
  9594. selector: "detect:ifNone:",
  9595. protocol: "enumerating",
  9596. //>>excludeStart("ide", pragmas.excludeIdeData);
  9597. args: ["aBlock", "anotherBlock"],
  9598. 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'>",
  9599. referencedClasses: [],
  9600. //>>excludeEnd("ide");
  9601. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09"]]],
  9602. messageSends: []
  9603. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9604. var self=this,$self=this;
  9605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9606. return $core.withContext(function($ctx1) {
  9607. //>>excludeEnd("ctx");
  9608. for(var i = 0; i < self.length; i++)
  9609. if(aBlock._value_(self[i]))
  9610. return self[i];
  9611. return anotherBlock._value();
  9612. ;
  9613. return self;
  9614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9615. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9616. //>>excludeEnd("ctx");
  9617. }; }),
  9618. $globals.TNativeZeroBasedCollection);
  9619. $core.addMethod(
  9620. $core.method({
  9621. selector: "do:",
  9622. protocol: "enumerating",
  9623. //>>excludeStart("ide", pragmas.excludeIdeData);
  9624. args: ["aBlock"],
  9625. 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'>",
  9626. referencedClasses: [],
  9627. //>>excludeEnd("ide");
  9628. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9629. messageSends: []
  9630. }, function ($methodClass){ return function (aBlock){
  9631. var self=this,$self=this;
  9632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9633. return $core.withContext(function($ctx1) {
  9634. //>>excludeEnd("ctx");
  9635. for(var i=0; i < self.length; i++) {
  9636. aBlock._value_(self[i]);
  9637. }
  9638. ;
  9639. return self;
  9640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9641. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9642. //>>excludeEnd("ctx");
  9643. }; }),
  9644. $globals.TNativeZeroBasedCollection);
  9645. $core.addMethod(
  9646. $core.method({
  9647. selector: "indexOf:ifAbsent:",
  9648. protocol: "accessing",
  9649. //>>excludeStart("ide", pragmas.excludeIdeData);
  9650. args: ["anObject", "aBlock"],
  9651. 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'>",
  9652. referencedClasses: [],
  9653. //>>excludeEnd("ide");
  9654. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  9655. messageSends: []
  9656. }, function ($methodClass){ return function (anObject,aBlock){
  9657. var self=this,$self=this;
  9658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9659. return $core.withContext(function($ctx1) {
  9660. //>>excludeEnd("ctx");
  9661. for(var i=0; i < self.length; i++) {
  9662. if($recv(self[i]).__eq(anObject)) {return i+1}
  9663. };
  9664. return aBlock._value();
  9665. ;
  9666. return self;
  9667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9668. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9669. //>>excludeEnd("ctx");
  9670. }; }),
  9671. $globals.TNativeZeroBasedCollection);
  9672. $core.addMethod(
  9673. $core.method({
  9674. selector: "indexOf:startingAt:ifAbsent:",
  9675. protocol: "accessing",
  9676. //>>excludeStart("ide", pragmas.excludeIdeData);
  9677. args: ["anObject", "start", "aBlock"],
  9678. 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'>",
  9679. referencedClasses: [],
  9680. //>>excludeEnd("ide");
  9681. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  9682. messageSends: []
  9683. }, function ($methodClass){ return function (anObject,start,aBlock){
  9684. var self=this,$self=this;
  9685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9686. return $core.withContext(function($ctx1) {
  9687. //>>excludeEnd("ctx");
  9688. for(var i=start - 1; i < self.length; i++){
  9689. if($recv(self[i]).__eq(anObject)) {return i+1}
  9690. }
  9691. return aBlock._value();
  9692. ;
  9693. return self;
  9694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9695. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9696. //>>excludeEnd("ctx");
  9697. }; }),
  9698. $globals.TNativeZeroBasedCollection);
  9699. $core.addMethod(
  9700. $core.method({
  9701. selector: "single",
  9702. protocol: "accessing",
  9703. //>>excludeStart("ide", pragmas.excludeIdeData);
  9704. args: [],
  9705. 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'>",
  9706. referencedClasses: [],
  9707. //>>excludeEnd("ide");
  9708. pragmas: [["inlineJS:", ["\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];"]]],
  9709. messageSends: []
  9710. }, function ($methodClass){ return function (){
  9711. var self=this,$self=this;
  9712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9713. return $core.withContext(function($ctx1) {
  9714. //>>excludeEnd("ctx");
  9715. if (self.length == 0) throw new Error("Collection is empty");
  9716. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9717. return self[0];;
  9718. return self;
  9719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9720. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9721. //>>excludeEnd("ctx");
  9722. }; }),
  9723. $globals.TNativeZeroBasedCollection);
  9724. $core.addMethod(
  9725. $core.method({
  9726. selector: "size",
  9727. protocol: "accessing",
  9728. //>>excludeStart("ide", pragmas.excludeIdeData);
  9729. args: [],
  9730. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9731. referencedClasses: [],
  9732. //>>excludeEnd("ide");
  9733. pragmas: [["inlineJS:", ["return self.length"]]],
  9734. messageSends: []
  9735. }, function ($methodClass){ return function (){
  9736. var self=this,$self=this;
  9737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9738. return $core.withContext(function($ctx1) {
  9739. //>>excludeEnd("ctx");
  9740. return self.length;
  9741. return self;
  9742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9743. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9744. //>>excludeEnd("ctx");
  9745. }; }),
  9746. $globals.TNativeZeroBasedCollection);
  9747. $core.addMethod(
  9748. $core.method({
  9749. selector: "with:do:",
  9750. protocol: "enumerating",
  9751. //>>excludeStart("ide", pragmas.excludeIdeData);
  9752. args: ["anotherCollection", "aBlock"],
  9753. 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'>",
  9754. referencedClasses: [],
  9755. //>>excludeEnd("ide");
  9756. pragmas: [["inlineJS:", ["\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09"]]],
  9757. messageSends: []
  9758. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9759. var self=this,$self=this;
  9760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9761. return $core.withContext(function($ctx1) {
  9762. //>>excludeEnd("ctx");
  9763. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9764. for(var i=0; i<self.length; i++) {
  9765. aBlock._value_value_(self[i], anotherCollection[i]);
  9766. }
  9767. ;
  9768. return self;
  9769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9770. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9771. //>>excludeEnd("ctx");
  9772. }; }),
  9773. $globals.TNativeZeroBasedCollection);
  9774. $core.addMethod(
  9775. $core.method({
  9776. selector: "withIndexDo:",
  9777. protocol: "enumerating",
  9778. //>>excludeStart("ide", pragmas.excludeIdeData);
  9779. args: ["aBlock"],
  9780. 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'>",
  9781. referencedClasses: [],
  9782. //>>excludeEnd("ide");
  9783. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09"]]],
  9784. messageSends: []
  9785. }, function ($methodClass){ return function (aBlock){
  9786. var self=this,$self=this;
  9787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9788. return $core.withContext(function($ctx1) {
  9789. //>>excludeEnd("ctx");
  9790. for(var i=0; i < self.length; i++) {
  9791. aBlock._value_value_(self[i], i+1);
  9792. }
  9793. ;
  9794. return self;
  9795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9796. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9797. //>>excludeEnd("ctx");
  9798. }; }),
  9799. $globals.TNativeZeroBasedCollection);
  9800. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9801. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9802. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9803. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9804. });