Kernel-Collections.js 352 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199
  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 $early={};
  492. try {
  493. $self._do_((function(each){
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx2) {
  496. //>>excludeEnd("ctx");
  497. if(!$core.assert($recv(aBlock)._value_(each))){
  498. throw $early=[false];
  499. }
  500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  502. //>>excludeEnd("ctx");
  503. }));
  504. return true;
  505. }
  506. catch(e) {if(e===$early)return e[0]; throw e}
  507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  508. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  509. //>>excludeEnd("ctx");
  510. }; }),
  511. $globals.Collection);
  512. $core.addMethod(
  513. $core.method({
  514. selector: "anyOne",
  515. protocol: "accessing",
  516. //>>excludeStart("ide", pragmas.excludeIdeData);
  517. args: [],
  518. 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 ]",
  519. referencedClasses: [],
  520. //>>excludeEnd("ide");
  521. pragmas: [],
  522. messageSends: ["ifEmpty:", "error:", "do:"]
  523. }, function ($methodClass){ return function (){
  524. var self=this,$self=this;
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. return $core.withContext(function($ctx1) {
  527. //>>excludeEnd("ctx");
  528. var $early={};
  529. try {
  530. $self._ifEmpty_((function(){
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. return $core.withContext(function($ctx2) {
  533. //>>excludeEnd("ctx");
  534. return $self._error_("Collection is empty");
  535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  537. //>>excludeEnd("ctx");
  538. }));
  539. $self._do_((function(each){
  540. throw $early=[each];
  541. }));
  542. return self;
  543. }
  544. catch(e) {if(e===$early)return e[0]; throw e}
  545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  546. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  547. //>>excludeEnd("ctx");
  548. }; }),
  549. $globals.Collection);
  550. $core.addMethod(
  551. $core.method({
  552. selector: "anySatisfy:",
  553. protocol: "enumerating",
  554. //>>excludeStart("ide", pragmas.excludeIdeData);
  555. args: ["aBlock"],
  556. 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",
  557. referencedClasses: [],
  558. //>>excludeEnd("ide");
  559. pragmas: [],
  560. messageSends: ["do:", "ifTrue:", "value:"]
  561. }, function ($methodClass){ return function (aBlock){
  562. var self=this,$self=this;
  563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  564. return $core.withContext(function($ctx1) {
  565. //>>excludeEnd("ctx");
  566. var $early={};
  567. try {
  568. $self._do_((function(each){
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. return $core.withContext(function($ctx2) {
  571. //>>excludeEnd("ctx");
  572. if($core.assert($recv(aBlock)._value_(each))){
  573. throw $early=[true];
  574. }
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  577. //>>excludeEnd("ctx");
  578. }));
  579. return false;
  580. }
  581. catch(e) {if(e===$early)return e[0]; throw e}
  582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  583. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  584. //>>excludeEnd("ctx");
  585. }; }),
  586. $globals.Collection);
  587. $core.addMethod(
  588. $core.method({
  589. selector: "asArray",
  590. protocol: "converting",
  591. //>>excludeStart("ide", pragmas.excludeIdeData);
  592. args: [],
  593. source: "asArray\x0a\x09^ Array withAll: self",
  594. referencedClasses: ["Array"],
  595. //>>excludeEnd("ide");
  596. pragmas: [],
  597. messageSends: ["withAll:"]
  598. }, function ($methodClass){ return function (){
  599. var self=this,$self=this;
  600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  601. return $core.withContext(function($ctx1) {
  602. //>>excludeEnd("ctx");
  603. return $recv($globals.Array)._withAll_(self);
  604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  605. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  606. //>>excludeEnd("ctx");
  607. }; }),
  608. $globals.Collection);
  609. $core.addMethod(
  610. $core.method({
  611. selector: "asJavaScriptObject",
  612. protocol: "converting",
  613. //>>excludeStart("ide", pragmas.excludeIdeData);
  614. args: [],
  615. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  616. referencedClasses: [],
  617. //>>excludeEnd("ide");
  618. pragmas: [],
  619. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  620. }, function ($methodClass){ return function (){
  621. var self=this,$self=this;
  622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  623. return $core.withContext(function($ctx1) {
  624. //>>excludeEnd("ctx");
  625. return $recv($self._asArray())._collect_((function(each){
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. return $core.withContext(function($ctx2) {
  628. //>>excludeEnd("ctx");
  629. return $recv(each)._asJavaScriptObject();
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  632. //>>excludeEnd("ctx");
  633. }));
  634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  635. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  636. //>>excludeEnd("ctx");
  637. }; }),
  638. $globals.Collection);
  639. $core.addMethod(
  640. $core.method({
  641. selector: "asOrderedCollection",
  642. protocol: "converting",
  643. //>>excludeStart("ide", pragmas.excludeIdeData);
  644. args: [],
  645. source: "asOrderedCollection\x0a\x09^ self asArray",
  646. referencedClasses: [],
  647. //>>excludeEnd("ide");
  648. pragmas: [],
  649. messageSends: ["asArray"]
  650. }, function ($methodClass){ return function (){
  651. var self=this,$self=this;
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. return $core.withContext(function($ctx1) {
  654. //>>excludeEnd("ctx");
  655. return $self._asArray();
  656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  657. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  658. //>>excludeEnd("ctx");
  659. }; }),
  660. $globals.Collection);
  661. $core.addMethod(
  662. $core.method({
  663. selector: "asSet",
  664. protocol: "converting",
  665. //>>excludeStart("ide", pragmas.excludeIdeData);
  666. args: [],
  667. source: "asSet\x0a\x09^ Set withAll: self",
  668. referencedClasses: ["Set"],
  669. //>>excludeEnd("ide");
  670. pragmas: [],
  671. messageSends: ["withAll:"]
  672. }, function ($methodClass){ return function (){
  673. var self=this,$self=this;
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. return $core.withContext(function($ctx1) {
  676. //>>excludeEnd("ctx");
  677. return $recv($globals.Set)._withAll_(self);
  678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  679. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  680. //>>excludeEnd("ctx");
  681. }; }),
  682. $globals.Collection);
  683. $core.addMethod(
  684. $core.method({
  685. selector: "collect:",
  686. protocol: "enumerating",
  687. //>>excludeStart("ide", pragmas.excludeIdeData);
  688. args: ["aBlock"],
  689. 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",
  690. referencedClasses: [],
  691. //>>excludeEnd("ide");
  692. pragmas: [],
  693. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  694. }, function ($methodClass){ return function (aBlock){
  695. var self=this,$self=this;
  696. var stream;
  697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  698. return $core.withContext(function($ctx1) {
  699. //>>excludeEnd("ctx");
  700. stream=$recv($recv($self._class())._new())._writeStream();
  701. $self._do_((function(each){
  702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  703. return $core.withContext(function($ctx2) {
  704. //>>excludeEnd("ctx");
  705. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  708. //>>excludeEnd("ctx");
  709. }));
  710. return $recv(stream)._contents();
  711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  712. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  713. //>>excludeEnd("ctx");
  714. }; }),
  715. $globals.Collection);
  716. $core.addMethod(
  717. $core.method({
  718. selector: "copyWith:",
  719. protocol: "copying",
  720. //>>excludeStart("ide", pragmas.excludeIdeData);
  721. args: ["anObject"],
  722. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  723. referencedClasses: [],
  724. //>>excludeEnd("ide");
  725. pragmas: [],
  726. messageSends: ["add:", "copy", "yourself"]
  727. }, function ($methodClass){ return function (anObject){
  728. var self=this,$self=this;
  729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  730. return $core.withContext(function($ctx1) {
  731. //>>excludeEnd("ctx");
  732. var $1;
  733. $1=$self._copy();
  734. $recv($1)._add_(anObject);
  735. return $recv($1)._yourself();
  736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  737. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  738. //>>excludeEnd("ctx");
  739. }; }),
  740. $globals.Collection);
  741. $core.addMethod(
  742. $core.method({
  743. selector: "copyWithAll:",
  744. protocol: "copying",
  745. //>>excludeStart("ide", pragmas.excludeIdeData);
  746. args: ["aCollection"],
  747. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  748. referencedClasses: [],
  749. //>>excludeEnd("ide");
  750. pragmas: [],
  751. messageSends: ["deprecatedAPI:", ","]
  752. }, function ($methodClass){ return function (aCollection){
  753. var self=this,$self=this;
  754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  755. return $core.withContext(function($ctx1) {
  756. //>>excludeEnd("ctx");
  757. $self._deprecatedAPI_("Use #, instead.");
  758. return $self.__comma(aCollection);
  759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  760. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  761. //>>excludeEnd("ctx");
  762. }; }),
  763. $globals.Collection);
  764. $core.addMethod(
  765. $core.method({
  766. selector: "copyWithout:",
  767. protocol: "copying",
  768. //>>excludeStart("ide", pragmas.excludeIdeData);
  769. args: ["anObject"],
  770. 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 ]",
  771. referencedClasses: [],
  772. //>>excludeEnd("ide");
  773. pragmas: [],
  774. messageSends: ["reject:", "="]
  775. }, function ($methodClass){ return function (anObject){
  776. var self=this,$self=this;
  777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  778. return $core.withContext(function($ctx1) {
  779. //>>excludeEnd("ctx");
  780. return $self._reject_((function(each){
  781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  782. return $core.withContext(function($ctx2) {
  783. //>>excludeEnd("ctx");
  784. return $recv(each).__eq(anObject);
  785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  787. //>>excludeEnd("ctx");
  788. }));
  789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  790. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  791. //>>excludeEnd("ctx");
  792. }; }),
  793. $globals.Collection);
  794. $core.addMethod(
  795. $core.method({
  796. selector: "copyWithoutAll:",
  797. protocol: "copying",
  798. //>>excludeStart("ide", pragmas.excludeIdeData);
  799. args: ["aCollection"],
  800. 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 ]",
  801. referencedClasses: [],
  802. //>>excludeEnd("ide");
  803. pragmas: [],
  804. messageSends: ["reject:", "includes:"]
  805. }, function ($methodClass){ return function (aCollection){
  806. var self=this,$self=this;
  807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  808. return $core.withContext(function($ctx1) {
  809. //>>excludeEnd("ctx");
  810. return $self._reject_((function(each){
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. return $core.withContext(function($ctx2) {
  813. //>>excludeEnd("ctx");
  814. return $recv(aCollection)._includes_(each);
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  817. //>>excludeEnd("ctx");
  818. }));
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  821. //>>excludeEnd("ctx");
  822. }; }),
  823. $globals.Collection);
  824. $core.addMethod(
  825. $core.method({
  826. selector: "deepCopy",
  827. protocol: "copying",
  828. //>>excludeStart("ide", pragmas.excludeIdeData);
  829. args: [],
  830. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  831. referencedClasses: [],
  832. //>>excludeEnd("ide");
  833. pragmas: [],
  834. messageSends: ["collect:", "deepCopy"]
  835. }, function ($methodClass){ return function (){
  836. var self=this,$self=this;
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. return $core.withContext(function($ctx1) {
  839. //>>excludeEnd("ctx");
  840. return $self._collect_((function(each){
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx2) {
  843. //>>excludeEnd("ctx");
  844. return $recv(each)._deepCopy();
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  847. //>>excludeEnd("ctx");
  848. }));
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  851. //>>excludeEnd("ctx");
  852. }; }),
  853. $globals.Collection);
  854. $core.addMethod(
  855. $core.method({
  856. selector: "detect:",
  857. protocol: "enumerating",
  858. //>>excludeStart("ide", pragmas.excludeIdeData);
  859. args: ["aBlock"],
  860. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  861. referencedClasses: [],
  862. //>>excludeEnd("ide");
  863. pragmas: [],
  864. messageSends: ["detect:ifNone:", "errorNotFound"]
  865. }, function ($methodClass){ return function (aBlock){
  866. var self=this,$self=this;
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. return $core.withContext(function($ctx1) {
  869. //>>excludeEnd("ctx");
  870. return $self._detect_ifNone_(aBlock,(function(){
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. return $core.withContext(function($ctx2) {
  873. //>>excludeEnd("ctx");
  874. return $self._errorNotFound();
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  877. //>>excludeEnd("ctx");
  878. }));
  879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  880. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  881. //>>excludeEnd("ctx");
  882. }; }),
  883. $globals.Collection);
  884. $core.addMethod(
  885. $core.method({
  886. selector: "detect:ifNone:",
  887. protocol: "enumerating",
  888. //>>excludeStart("ide", pragmas.excludeIdeData);
  889. args: ["aBlock", "anotherBlock"],
  890. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  891. referencedClasses: [],
  892. //>>excludeEnd("ide");
  893. pragmas: [],
  894. messageSends: ["do:", "ifTrue:", "value:", "value"]
  895. }, function ($methodClass){ return function (aBlock,anotherBlock){
  896. var self=this,$self=this;
  897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  898. return $core.withContext(function($ctx1) {
  899. //>>excludeEnd("ctx");
  900. var $early={};
  901. try {
  902. $self._do_((function(each){
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. return $core.withContext(function($ctx2) {
  905. //>>excludeEnd("ctx");
  906. if($core.assert($recv(aBlock)._value_(each))){
  907. throw $early=[each];
  908. }
  909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  911. //>>excludeEnd("ctx");
  912. }));
  913. return $recv(anotherBlock)._value();
  914. }
  915. catch(e) {if(e===$early)return e[0]; throw e}
  916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  917. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  918. //>>excludeEnd("ctx");
  919. }; }),
  920. $globals.Collection);
  921. $core.addMethod(
  922. $core.method({
  923. selector: "do:",
  924. protocol: "enumerating",
  925. //>>excludeStart("ide", pragmas.excludeIdeData);
  926. args: ["aBlock"],
  927. source: "do: aBlock\x0a\x09self subclassResponsibility",
  928. referencedClasses: [],
  929. //>>excludeEnd("ide");
  930. pragmas: [],
  931. messageSends: ["subclassResponsibility"]
  932. }, function ($methodClass){ return function (aBlock){
  933. var self=this,$self=this;
  934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  935. return $core.withContext(function($ctx1) {
  936. //>>excludeEnd("ctx");
  937. $self._subclassResponsibility();
  938. return self;
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  941. //>>excludeEnd("ctx");
  942. }; }),
  943. $globals.Collection);
  944. $core.addMethod(
  945. $core.method({
  946. selector: "do:separatedBy:",
  947. protocol: "enumerating",
  948. //>>excludeStart("ide", pragmas.excludeIdeData);
  949. args: ["aBlock", "anotherBlock"],
  950. 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 ]",
  951. referencedClasses: [],
  952. //>>excludeEnd("ide");
  953. pragmas: [],
  954. messageSends: ["do:", "value", "value:"]
  955. }, function ($methodClass){ return function (aBlock,anotherBlock){
  956. var self=this,$self=this;
  957. var actionBeforeElement;
  958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  959. return $core.withContext(function($ctx1) {
  960. //>>excludeEnd("ctx");
  961. actionBeforeElement=(function(){
  962. actionBeforeElement=anotherBlock;
  963. return actionBeforeElement;
  964. });
  965. $self._do_((function(each){
  966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  967. return $core.withContext(function($ctx2) {
  968. //>>excludeEnd("ctx");
  969. $recv(actionBeforeElement)._value();
  970. return $recv(aBlock)._value_(each);
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  973. //>>excludeEnd("ctx");
  974. }));
  975. return self;
  976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  977. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  978. //>>excludeEnd("ctx");
  979. }; }),
  980. $globals.Collection);
  981. $core.addMethod(
  982. $core.method({
  983. selector: "errorNotFound",
  984. protocol: "error handling",
  985. //>>excludeStart("ide", pragmas.excludeIdeData);
  986. args: [],
  987. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  988. referencedClasses: [],
  989. //>>excludeEnd("ide");
  990. pragmas: [],
  991. messageSends: ["error:"]
  992. }, function ($methodClass){ return function (){
  993. var self=this,$self=this;
  994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  995. return $core.withContext(function($ctx1) {
  996. //>>excludeEnd("ctx");
  997. $self._error_("Object is not in the collection");
  998. return self;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1001. //>>excludeEnd("ctx");
  1002. }; }),
  1003. $globals.Collection);
  1004. $core.addMethod(
  1005. $core.method({
  1006. selector: "ifEmpty:",
  1007. protocol: "testing",
  1008. //>>excludeStart("ide", pragmas.excludeIdeData);
  1009. args: ["aBlock"],
  1010. 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 ]",
  1011. referencedClasses: [],
  1012. //>>excludeEnd("ide");
  1013. pragmas: [],
  1014. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1015. }, function ($methodClass){ return function (aBlock){
  1016. var self=this,$self=this;
  1017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1018. return $core.withContext(function($ctx1) {
  1019. //>>excludeEnd("ctx");
  1020. if($core.assert($self._isEmpty())){
  1021. return $recv(aBlock)._value();
  1022. } else {
  1023. return self;
  1024. }
  1025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1026. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1027. //>>excludeEnd("ctx");
  1028. }; }),
  1029. $globals.Collection);
  1030. $core.addMethod(
  1031. $core.method({
  1032. selector: "ifEmpty:ifNotEmpty:",
  1033. protocol: "testing",
  1034. //>>excludeStart("ide", pragmas.excludeIdeData);
  1035. args: ["aBlock", "anotherBlock"],
  1036. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1037. referencedClasses: [],
  1038. //>>excludeEnd("ide");
  1039. pragmas: [],
  1040. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1041. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1042. var self=this,$self=this;
  1043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1044. return $core.withContext(function($ctx1) {
  1045. //>>excludeEnd("ctx");
  1046. if($core.assert($self._isEmpty())){
  1047. return $recv(aBlock)._value();
  1048. } else {
  1049. return $recv(anotherBlock)._value_(self);
  1050. }
  1051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1052. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1053. //>>excludeEnd("ctx");
  1054. }; }),
  1055. $globals.Collection);
  1056. $core.addMethod(
  1057. $core.method({
  1058. selector: "ifNotEmpty:",
  1059. protocol: "testing",
  1060. //>>excludeStart("ide", pragmas.excludeIdeData);
  1061. args: ["aBlock"],
  1062. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1063. referencedClasses: [],
  1064. //>>excludeEnd("ide");
  1065. pragmas: [],
  1066. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1067. }, function ($methodClass){ return function (aBlock){
  1068. var self=this,$self=this;
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. return $core.withContext(function($ctx1) {
  1071. //>>excludeEnd("ctx");
  1072. if($core.assert($self._notEmpty())){
  1073. return $recv(aBlock)._value_(self);
  1074. } else {
  1075. return self;
  1076. }
  1077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1078. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1079. //>>excludeEnd("ctx");
  1080. }; }),
  1081. $globals.Collection);
  1082. $core.addMethod(
  1083. $core.method({
  1084. selector: "ifNotEmpty:ifEmpty:",
  1085. protocol: "testing",
  1086. //>>excludeStart("ide", pragmas.excludeIdeData);
  1087. args: ["aBlock", "anotherBlock"],
  1088. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1089. referencedClasses: [],
  1090. //>>excludeEnd("ide");
  1091. pragmas: [],
  1092. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1093. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1094. var self=this,$self=this;
  1095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1096. return $core.withContext(function($ctx1) {
  1097. //>>excludeEnd("ctx");
  1098. if($core.assert($self._notEmpty())){
  1099. return $recv(aBlock)._value_(self);
  1100. } else {
  1101. return $recv(anotherBlock)._value();
  1102. }
  1103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1104. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1105. //>>excludeEnd("ctx");
  1106. }; }),
  1107. $globals.Collection);
  1108. $core.addMethod(
  1109. $core.method({
  1110. selector: "includes:",
  1111. protocol: "testing",
  1112. //>>excludeStart("ide", pragmas.excludeIdeData);
  1113. args: ["anObject"],
  1114. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1115. referencedClasses: [],
  1116. //>>excludeEnd("ide");
  1117. pragmas: [],
  1118. messageSends: ["anySatisfy:", "="]
  1119. }, function ($methodClass){ return function (anObject){
  1120. var self=this,$self=this;
  1121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1122. return $core.withContext(function($ctx1) {
  1123. //>>excludeEnd("ctx");
  1124. return $self._anySatisfy_((function(each){
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. return $core.withContext(function($ctx2) {
  1127. //>>excludeEnd("ctx");
  1128. return $recv(each).__eq(anObject);
  1129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1131. //>>excludeEnd("ctx");
  1132. }));
  1133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1134. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1135. //>>excludeEnd("ctx");
  1136. }; }),
  1137. $globals.Collection);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "inject:into:",
  1141. protocol: "enumerating",
  1142. //>>excludeStart("ide", pragmas.excludeIdeData);
  1143. args: ["anObject", "aBlock"],
  1144. 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",
  1145. referencedClasses: [],
  1146. //>>excludeEnd("ide");
  1147. pragmas: [],
  1148. messageSends: ["do:", "value:value:"]
  1149. }, function ($methodClass){ return function (anObject,aBlock){
  1150. var self=this,$self=this;
  1151. var result;
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. return $core.withContext(function($ctx1) {
  1154. //>>excludeEnd("ctx");
  1155. result=anObject;
  1156. $self._do_((function(each){
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. return $core.withContext(function($ctx2) {
  1159. //>>excludeEnd("ctx");
  1160. result=$recv(aBlock)._value_value_(result,each);
  1161. return result;
  1162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1164. //>>excludeEnd("ctx");
  1165. }));
  1166. return result;
  1167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1168. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1169. //>>excludeEnd("ctx");
  1170. }; }),
  1171. $globals.Collection);
  1172. $core.addMethod(
  1173. $core.method({
  1174. selector: "intersection:",
  1175. protocol: "enumerating",
  1176. //>>excludeStart("ide", pragmas.excludeIdeData);
  1177. args: ["aCollection"],
  1178. 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",
  1179. referencedClasses: ["Set"],
  1180. //>>excludeEnd("ide");
  1181. pragmas: [],
  1182. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1183. }, function ($methodClass){ return function (aCollection){
  1184. var self=this,$self=this;
  1185. var set,outputSet;
  1186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1187. return $core.withContext(function($ctx1) {
  1188. //>>excludeEnd("ctx");
  1189. set=$self._asSet();
  1190. outputSet=$recv($globals.Set)._new();
  1191. $recv(aCollection)._do_((function(each){
  1192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1193. return $core.withContext(function($ctx2) {
  1194. //>>excludeEnd("ctx");
  1195. if($core.assert($recv([$recv(set)._includes_(each)
  1196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1197. ,$ctx2.sendIdx["includes:"]=1
  1198. //>>excludeEnd("ctx");
  1199. ][0])._and_((function(){
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. return $core.withContext(function($ctx3) {
  1202. //>>excludeEnd("ctx");
  1203. return $recv($recv(outputSet)._includes_(each))._not();
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1206. //>>excludeEnd("ctx");
  1207. })))){
  1208. return $recv(outputSet)._add_(each);
  1209. }
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1212. //>>excludeEnd("ctx");
  1213. }));
  1214. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1216. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1217. //>>excludeEnd("ctx");
  1218. }; }),
  1219. $globals.Collection);
  1220. $core.addMethod(
  1221. $core.method({
  1222. selector: "isEmpty",
  1223. protocol: "testing",
  1224. //>>excludeStart("ide", pragmas.excludeIdeData);
  1225. args: [],
  1226. source: "isEmpty\x0a\x09^ self size = 0",
  1227. referencedClasses: [],
  1228. //>>excludeEnd("ide");
  1229. pragmas: [],
  1230. messageSends: ["=", "size"]
  1231. }, function ($methodClass){ return function (){
  1232. var self=this,$self=this;
  1233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1234. return $core.withContext(function($ctx1) {
  1235. //>>excludeEnd("ctx");
  1236. return $recv($self._size()).__eq((0));
  1237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1238. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1239. //>>excludeEnd("ctx");
  1240. }; }),
  1241. $globals.Collection);
  1242. $core.addMethod(
  1243. $core.method({
  1244. selector: "noneSatisfy:",
  1245. protocol: "enumerating",
  1246. //>>excludeStart("ide", pragmas.excludeIdeData);
  1247. args: ["aBlock"],
  1248. 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",
  1249. referencedClasses: [],
  1250. //>>excludeEnd("ide");
  1251. pragmas: [],
  1252. messageSends: ["do:", "ifTrue:", "value:"]
  1253. }, function ($methodClass){ return function (aBlock){
  1254. var self=this,$self=this;
  1255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1256. return $core.withContext(function($ctx1) {
  1257. //>>excludeEnd("ctx");
  1258. var $early={};
  1259. try {
  1260. $self._do_((function(item){
  1261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1262. return $core.withContext(function($ctx2) {
  1263. //>>excludeEnd("ctx");
  1264. if($core.assert($recv(aBlock)._value_(item))){
  1265. throw $early=[false];
  1266. }
  1267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1268. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1269. //>>excludeEnd("ctx");
  1270. }));
  1271. return true;
  1272. }
  1273. catch(e) {if(e===$early)return e[0]; throw e}
  1274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1275. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1276. //>>excludeEnd("ctx");
  1277. }; }),
  1278. $globals.Collection);
  1279. $core.addMethod(
  1280. $core.method({
  1281. selector: "notEmpty",
  1282. protocol: "testing",
  1283. //>>excludeStart("ide", pragmas.excludeIdeData);
  1284. args: [],
  1285. source: "notEmpty\x0a\x09^ self isEmpty not",
  1286. referencedClasses: [],
  1287. //>>excludeEnd("ide");
  1288. pragmas: [],
  1289. messageSends: ["not", "isEmpty"]
  1290. }, function ($methodClass){ return function (){
  1291. var self=this,$self=this;
  1292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1293. return $core.withContext(function($ctx1) {
  1294. //>>excludeEnd("ctx");
  1295. return $recv($self._isEmpty())._not();
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1298. //>>excludeEnd("ctx");
  1299. }; }),
  1300. $globals.Collection);
  1301. $core.addMethod(
  1302. $core.method({
  1303. selector: "occurrencesOf:",
  1304. protocol: "accessing",
  1305. //>>excludeStart("ide", pragmas.excludeIdeData);
  1306. args: ["anObject"],
  1307. 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",
  1308. referencedClasses: [],
  1309. //>>excludeEnd("ide");
  1310. pragmas: [],
  1311. messageSends: ["do:", "ifTrue:", "=", "+"]
  1312. }, function ($methodClass){ return function (anObject){
  1313. var self=this,$self=this;
  1314. var tally;
  1315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1316. return $core.withContext(function($ctx1) {
  1317. //>>excludeEnd("ctx");
  1318. tally=(0);
  1319. $self._do_((function(each){
  1320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1321. return $core.withContext(function($ctx2) {
  1322. //>>excludeEnd("ctx");
  1323. if($core.assert($recv(anObject).__eq(each))){
  1324. tally=$recv(tally).__plus((1));
  1325. return tally;
  1326. }
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1329. //>>excludeEnd("ctx");
  1330. }));
  1331. return tally;
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1334. //>>excludeEnd("ctx");
  1335. }; }),
  1336. $globals.Collection);
  1337. $core.addMethod(
  1338. $core.method({
  1339. selector: "putOn:",
  1340. protocol: "streaming",
  1341. //>>excludeStart("ide", pragmas.excludeIdeData);
  1342. args: ["aStream"],
  1343. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1344. referencedClasses: [],
  1345. //>>excludeEnd("ide");
  1346. pragmas: [],
  1347. messageSends: ["do:", "putOn:"]
  1348. }, function ($methodClass){ return function (aStream){
  1349. var self=this,$self=this;
  1350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1351. return $core.withContext(function($ctx1) {
  1352. //>>excludeEnd("ctx");
  1353. $self._do_((function(each){
  1354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1355. return $core.withContext(function($ctx2) {
  1356. //>>excludeEnd("ctx");
  1357. return $recv(each)._putOn_(aStream);
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1360. //>>excludeEnd("ctx");
  1361. }));
  1362. return self;
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1365. //>>excludeEnd("ctx");
  1366. }; }),
  1367. $globals.Collection);
  1368. $core.addMethod(
  1369. $core.method({
  1370. selector: "reject:",
  1371. protocol: "enumerating",
  1372. //>>excludeStart("ide", pragmas.excludeIdeData);
  1373. args: ["aBlock"],
  1374. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1375. referencedClasses: [],
  1376. //>>excludeEnd("ide");
  1377. pragmas: [],
  1378. messageSends: ["select:", "=", "value:"]
  1379. }, function ($methodClass){ return function (aBlock){
  1380. var self=this,$self=this;
  1381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1382. return $core.withContext(function($ctx1) {
  1383. //>>excludeEnd("ctx");
  1384. return $self._select_((function(each){
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. return $core.withContext(function($ctx2) {
  1387. //>>excludeEnd("ctx");
  1388. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1391. //>>excludeEnd("ctx");
  1392. }));
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1395. //>>excludeEnd("ctx");
  1396. }; }),
  1397. $globals.Collection);
  1398. $core.addMethod(
  1399. $core.method({
  1400. selector: "remove:",
  1401. protocol: "adding/removing",
  1402. //>>excludeStart("ide", pragmas.excludeIdeData);
  1403. args: ["anObject"],
  1404. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1405. referencedClasses: [],
  1406. //>>excludeEnd("ide");
  1407. pragmas: [],
  1408. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1409. }, function ($methodClass){ return function (anObject){
  1410. var self=this,$self=this;
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. return $core.withContext(function($ctx1) {
  1413. //>>excludeEnd("ctx");
  1414. return $self._remove_ifAbsent_(anObject,(function(){
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. return $core.withContext(function($ctx2) {
  1417. //>>excludeEnd("ctx");
  1418. return $self._errorNotFound();
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1421. //>>excludeEnd("ctx");
  1422. }));
  1423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1424. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1425. //>>excludeEnd("ctx");
  1426. }; }),
  1427. $globals.Collection);
  1428. $core.addMethod(
  1429. $core.method({
  1430. selector: "remove:ifAbsent:",
  1431. protocol: "adding/removing",
  1432. //>>excludeStart("ide", pragmas.excludeIdeData);
  1433. args: ["anObject", "aBlock"],
  1434. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1435. referencedClasses: [],
  1436. //>>excludeEnd("ide");
  1437. pragmas: [],
  1438. messageSends: ["subclassResponsibility"]
  1439. }, function ($methodClass){ return function (anObject,aBlock){
  1440. var self=this,$self=this;
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. return $core.withContext(function($ctx1) {
  1443. //>>excludeEnd("ctx");
  1444. $self._subclassResponsibility();
  1445. return self;
  1446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1447. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1448. //>>excludeEnd("ctx");
  1449. }; }),
  1450. $globals.Collection);
  1451. $core.addMethod(
  1452. $core.method({
  1453. selector: "removeAll",
  1454. protocol: "adding/removing",
  1455. //>>excludeStart("ide", pragmas.excludeIdeData);
  1456. args: [],
  1457. source: "removeAll\x0a\x09self subclassResponsibility",
  1458. referencedClasses: [],
  1459. //>>excludeEnd("ide");
  1460. pragmas: [],
  1461. messageSends: ["subclassResponsibility"]
  1462. }, function ($methodClass){ return function (){
  1463. var self=this,$self=this;
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. return $core.withContext(function($ctx1) {
  1466. //>>excludeEnd("ctx");
  1467. $self._subclassResponsibility();
  1468. return self;
  1469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1470. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1471. //>>excludeEnd("ctx");
  1472. }; }),
  1473. $globals.Collection);
  1474. $core.addMethod(
  1475. $core.method({
  1476. selector: "select:",
  1477. protocol: "enumerating",
  1478. //>>excludeStart("ide", pragmas.excludeIdeData);
  1479. args: ["aBlock"],
  1480. 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",
  1481. referencedClasses: [],
  1482. //>>excludeEnd("ide");
  1483. pragmas: [],
  1484. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1485. }, function ($methodClass){ return function (aBlock){
  1486. var self=this,$self=this;
  1487. var stream;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. return $core.withContext(function($ctx1) {
  1490. //>>excludeEnd("ctx");
  1491. stream=$recv($recv($self._class())._new())._writeStream();
  1492. $self._do_((function(each){
  1493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1494. return $core.withContext(function($ctx2) {
  1495. //>>excludeEnd("ctx");
  1496. if($core.assert($recv(aBlock)._value_(each))){
  1497. return $recv(stream)._nextPut_(each);
  1498. }
  1499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1501. //>>excludeEnd("ctx");
  1502. }));
  1503. return $recv(stream)._contents();
  1504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1505. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1506. //>>excludeEnd("ctx");
  1507. }; }),
  1508. $globals.Collection);
  1509. $core.addMethod(
  1510. $core.method({
  1511. selector: "select:thenCollect:",
  1512. protocol: "enumerating",
  1513. //>>excludeStart("ide", pragmas.excludeIdeData);
  1514. args: ["selectBlock", "collectBlock"],
  1515. 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",
  1516. referencedClasses: [],
  1517. //>>excludeEnd("ide");
  1518. pragmas: [],
  1519. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1520. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1521. var self=this,$self=this;
  1522. var stream;
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. return $core.withContext(function($ctx1) {
  1525. //>>excludeEnd("ctx");
  1526. stream=$recv($recv($self._class())._new())._writeStream();
  1527. $self._do_((function(each){
  1528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1529. return $core.withContext(function($ctx2) {
  1530. //>>excludeEnd("ctx");
  1531. if($core.assert([$recv(selectBlock)._value_(each)
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. ,$ctx2.sendIdx["value:"]=1
  1534. //>>excludeEnd("ctx");
  1535. ][0])){
  1536. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1537. }
  1538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1539. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1540. //>>excludeEnd("ctx");
  1541. }));
  1542. return $recv(stream)._contents();
  1543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1544. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1545. //>>excludeEnd("ctx");
  1546. }; }),
  1547. $globals.Collection);
  1548. $core.addMethod(
  1549. $core.method({
  1550. selector: "shallowCopy",
  1551. protocol: "copying",
  1552. //>>excludeStart("ide", pragmas.excludeIdeData);
  1553. args: [],
  1554. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1555. referencedClasses: [],
  1556. //>>excludeEnd("ide");
  1557. pragmas: [],
  1558. messageSends: ["collect:"]
  1559. }, function ($methodClass){ return function (){
  1560. var self=this,$self=this;
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. return $core.withContext(function($ctx1) {
  1563. //>>excludeEnd("ctx");
  1564. return $self._collect_((function(each){
  1565. return each;
  1566. }));
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1569. //>>excludeEnd("ctx");
  1570. }; }),
  1571. $globals.Collection);
  1572. $core.addMethod(
  1573. $core.method({
  1574. selector: "single",
  1575. protocol: "accessing",
  1576. //>>excludeStart("ide", pragmas.excludeIdeData);
  1577. args: [],
  1578. 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",
  1579. referencedClasses: [],
  1580. //>>excludeEnd("ide");
  1581. pragmas: [],
  1582. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  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. $self._ifEmpty_((function(){
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. return $core.withContext(function($ctx2) {
  1591. //>>excludeEnd("ctx");
  1592. return [$self._error_("Collection is empty")
  1593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1594. ,$ctx2.sendIdx["error:"]=1
  1595. //>>excludeEnd("ctx");
  1596. ][0];
  1597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1599. //>>excludeEnd("ctx");
  1600. }));
  1601. if($core.assert($recv($self._size()).__gt((1)))){
  1602. $self._error_("Collection holds more than one element");
  1603. }
  1604. return $self._anyOne();
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1607. //>>excludeEnd("ctx");
  1608. }; }),
  1609. $globals.Collection);
  1610. $core.addMethod(
  1611. $core.method({
  1612. selector: "size",
  1613. protocol: "accessing",
  1614. //>>excludeStart("ide", pragmas.excludeIdeData);
  1615. args: [],
  1616. source: "size\x0a\x09self subclassResponsibility",
  1617. referencedClasses: [],
  1618. //>>excludeEnd("ide");
  1619. pragmas: [],
  1620. messageSends: ["subclassResponsibility"]
  1621. }, function ($methodClass){ return function (){
  1622. var self=this,$self=this;
  1623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1624. return $core.withContext(function($ctx1) {
  1625. //>>excludeEnd("ctx");
  1626. $self._subclassResponsibility();
  1627. return self;
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1630. //>>excludeEnd("ctx");
  1631. }; }),
  1632. $globals.Collection);
  1633. $core.addMethod(
  1634. $core.method({
  1635. selector: "classTag",
  1636. protocol: "accessing",
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: [],
  1639. 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'",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. pragmas: [],
  1643. messageSends: []
  1644. }, function ($methodClass){ return function (){
  1645. var self=this,$self=this;
  1646. return "collection";
  1647. }; }),
  1648. $globals.Collection.a$cls);
  1649. $core.addMethod(
  1650. $core.method({
  1651. selector: "new:",
  1652. protocol: "instance creation",
  1653. //>>excludeStart("ide", pragmas.excludeIdeData);
  1654. args: ["anInteger"],
  1655. source: "new: anInteger\x0a\x09^ self new",
  1656. referencedClasses: [],
  1657. //>>excludeEnd("ide");
  1658. pragmas: [],
  1659. messageSends: ["new"]
  1660. }, function ($methodClass){ return function (anInteger){
  1661. var self=this,$self=this;
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. return $core.withContext(function($ctx1) {
  1664. //>>excludeEnd("ctx");
  1665. return $self._new();
  1666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1667. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1668. //>>excludeEnd("ctx");
  1669. }; }),
  1670. $globals.Collection.a$cls);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "with:",
  1674. protocol: "instance creation",
  1675. //>>excludeStart("ide", pragmas.excludeIdeData);
  1676. args: ["anObject"],
  1677. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1678. referencedClasses: [],
  1679. //>>excludeEnd("ide");
  1680. pragmas: [],
  1681. messageSends: ["add:", "new", "yourself"]
  1682. }, function ($methodClass){ return function (anObject){
  1683. var self=this,$self=this;
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. return $core.withContext(function($ctx1) {
  1686. //>>excludeEnd("ctx");
  1687. var $1;
  1688. $1=$self._new();
  1689. $recv($1)._add_(anObject);
  1690. return $recv($1)._yourself();
  1691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1692. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1693. //>>excludeEnd("ctx");
  1694. }; }),
  1695. $globals.Collection.a$cls);
  1696. $core.addMethod(
  1697. $core.method({
  1698. selector: "with:with:",
  1699. protocol: "instance creation",
  1700. //>>excludeStart("ide", pragmas.excludeIdeData);
  1701. args: ["anObject", "anotherObject"],
  1702. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1703. referencedClasses: [],
  1704. //>>excludeEnd("ide");
  1705. pragmas: [],
  1706. messageSends: ["add:", "new", "yourself"]
  1707. }, function ($methodClass){ return function (anObject,anotherObject){
  1708. var self=this,$self=this;
  1709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1710. return $core.withContext(function($ctx1) {
  1711. //>>excludeEnd("ctx");
  1712. var $1;
  1713. $1=$self._new();
  1714. [$recv($1)._add_(anObject)
  1715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1716. ,$ctx1.sendIdx["add:"]=1
  1717. //>>excludeEnd("ctx");
  1718. ][0];
  1719. $recv($1)._add_(anotherObject);
  1720. return $recv($1)._yourself();
  1721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1722. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1723. //>>excludeEnd("ctx");
  1724. }; }),
  1725. $globals.Collection.a$cls);
  1726. $core.addMethod(
  1727. $core.method({
  1728. selector: "with:with:with:",
  1729. protocol: "instance creation",
  1730. //>>excludeStart("ide", pragmas.excludeIdeData);
  1731. args: ["firstObject", "secondObject", "thirdObject"],
  1732. 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",
  1733. referencedClasses: [],
  1734. //>>excludeEnd("ide");
  1735. pragmas: [],
  1736. messageSends: ["add:", "new", "yourself"]
  1737. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1738. var self=this,$self=this;
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. return $core.withContext(function($ctx1) {
  1741. //>>excludeEnd("ctx");
  1742. var $1;
  1743. $1=$self._new();
  1744. [$recv($1)._add_(firstObject)
  1745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1746. ,$ctx1.sendIdx["add:"]=1
  1747. //>>excludeEnd("ctx");
  1748. ][0];
  1749. [$recv($1)._add_(secondObject)
  1750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1751. ,$ctx1.sendIdx["add:"]=2
  1752. //>>excludeEnd("ctx");
  1753. ][0];
  1754. $recv($1)._add_(thirdObject);
  1755. return $recv($1)._yourself();
  1756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1757. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1758. //>>excludeEnd("ctx");
  1759. }; }),
  1760. $globals.Collection.a$cls);
  1761. $core.addMethod(
  1762. $core.method({
  1763. selector: "withAll:",
  1764. protocol: "instance creation",
  1765. //>>excludeStart("ide", pragmas.excludeIdeData);
  1766. args: ["aCollection"],
  1767. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1768. referencedClasses: [],
  1769. //>>excludeEnd("ide");
  1770. pragmas: [],
  1771. messageSends: ["addAll:", "new", "yourself"]
  1772. }, function ($methodClass){ return function (aCollection){
  1773. var self=this,$self=this;
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. return $core.withContext(function($ctx1) {
  1776. //>>excludeEnd("ctx");
  1777. var $1;
  1778. $1=$self._new();
  1779. $recv($1)._addAll_(aCollection);
  1780. return $recv($1)._yourself();
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1783. //>>excludeEnd("ctx");
  1784. }; }),
  1785. $globals.Collection.a$cls);
  1786. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1787. //>>excludeStart("ide", pragmas.excludeIdeData);
  1788. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1789. //>>excludeEnd("ide");
  1790. $core.addMethod(
  1791. $core.method({
  1792. selector: "=",
  1793. protocol: "comparing",
  1794. //>>excludeStart("ide", pragmas.excludeIdeData);
  1795. args: ["anAssocitativeCollection"],
  1796. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1797. referencedClasses: [],
  1798. //>>excludeEnd("ide");
  1799. pragmas: [],
  1800. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1801. }, function ($methodClass){ return function (anAssocitativeCollection){
  1802. var self=this,$self=this;
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. return $core.withContext(function($ctx1) {
  1805. //>>excludeEnd("ctx");
  1806. if(!$core.assert([$recv([$self._class()
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. ,$ctx1.sendIdx["class"]=1
  1809. //>>excludeEnd("ctx");
  1810. ][0]).__eq($recv(anAssocitativeCollection)._class())
  1811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1812. ,$ctx1.sendIdx["="]=1
  1813. //>>excludeEnd("ctx");
  1814. ][0])){
  1815. return false;
  1816. }
  1817. if(!$core.assert([$recv([$self._size()
  1818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1819. ,$ctx1.sendIdx["size"]=1
  1820. //>>excludeEnd("ctx");
  1821. ][0]).__eq($recv(anAssocitativeCollection)._size())
  1822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1823. ,$ctx1.sendIdx["="]=2
  1824. //>>excludeEnd("ctx");
  1825. ][0])){
  1826. return false;
  1827. }
  1828. return $recv([$self._associations()
  1829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1830. ,$ctx1.sendIdx["associations"]=1
  1831. //>>excludeEnd("ctx");
  1832. ][0]).__eq($recv(anAssocitativeCollection)._associations());
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1835. //>>excludeEnd("ctx");
  1836. }; }),
  1837. $globals.AssociativeCollection);
  1838. $core.addMethod(
  1839. $core.method({
  1840. selector: "add:",
  1841. protocol: "adding/removing",
  1842. //>>excludeStart("ide", pragmas.excludeIdeData);
  1843. args: ["anAssociation"],
  1844. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1845. referencedClasses: [],
  1846. //>>excludeEnd("ide");
  1847. pragmas: [],
  1848. messageSends: ["at:put:", "key", "value"]
  1849. }, function ($methodClass){ return function (anAssociation){
  1850. var self=this,$self=this;
  1851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1852. return $core.withContext(function($ctx1) {
  1853. //>>excludeEnd("ctx");
  1854. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1855. return self;
  1856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1857. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1858. //>>excludeEnd("ctx");
  1859. }; }),
  1860. $globals.AssociativeCollection);
  1861. $core.addMethod(
  1862. $core.method({
  1863. selector: "addAll:",
  1864. protocol: "adding/removing",
  1865. //>>excludeStart("ide", pragmas.excludeIdeData);
  1866. args: ["anAssociativeCollection"],
  1867. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1868. referencedClasses: [],
  1869. //>>excludeEnd("ide");
  1870. pragmas: [],
  1871. messageSends: ["addAll:", "associations"]
  1872. }, function ($methodClass){ return function (anAssociativeCollection){
  1873. var self=this,$self=this;
  1874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1875. return $core.withContext(function($ctx1) {
  1876. //>>excludeEnd("ctx");
  1877. [(
  1878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1879. $ctx1.supercall = true,
  1880. //>>excludeEnd("ctx");
  1881. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1883. ,$ctx1.supercall = false
  1884. //>>excludeEnd("ctx");
  1885. ][0];
  1886. return anAssociativeCollection;
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1889. //>>excludeEnd("ctx");
  1890. }; }),
  1891. $globals.AssociativeCollection);
  1892. $core.addMethod(
  1893. $core.method({
  1894. selector: "asDictionary",
  1895. protocol: "converting",
  1896. //>>excludeStart("ide", pragmas.excludeIdeData);
  1897. args: [],
  1898. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1899. referencedClasses: ["Dictionary"],
  1900. //>>excludeEnd("ide");
  1901. pragmas: [],
  1902. messageSends: ["from:", "associations"]
  1903. }, function ($methodClass){ return function (){
  1904. var self=this,$self=this;
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. return $core.withContext(function($ctx1) {
  1907. //>>excludeEnd("ctx");
  1908. return $recv($globals.Dictionary)._from_($self._associations());
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1911. //>>excludeEnd("ctx");
  1912. }; }),
  1913. $globals.AssociativeCollection);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "asHashedCollection",
  1917. protocol: "converting",
  1918. //>>excludeStart("ide", pragmas.excludeIdeData);
  1919. args: [],
  1920. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1921. referencedClasses: ["HashedCollection"],
  1922. //>>excludeEnd("ide");
  1923. pragmas: [],
  1924. messageSends: ["from:", "associations"]
  1925. }, function ($methodClass){ return function (){
  1926. var self=this,$self=this;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. return $core.withContext(function($ctx1) {
  1929. //>>excludeEnd("ctx");
  1930. return $recv($globals.HashedCollection)._from_($self._associations());
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1933. //>>excludeEnd("ctx");
  1934. }; }),
  1935. $globals.AssociativeCollection);
  1936. $core.addMethod(
  1937. $core.method({
  1938. selector: "asJavaScriptObject",
  1939. protocol: "converting",
  1940. //>>excludeStart("ide", pragmas.excludeIdeData);
  1941. args: [],
  1942. 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",
  1943. referencedClasses: ["HashedCollection"],
  1944. //>>excludeEnd("ide");
  1945. pragmas: [],
  1946. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1947. }, function ($methodClass){ return function (){
  1948. var self=this,$self=this;
  1949. var hash;
  1950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1951. return $core.withContext(function($ctx1) {
  1952. //>>excludeEnd("ctx");
  1953. hash=$recv($globals.HashedCollection)._new();
  1954. $self._keysAndValuesDo_((function(key,value){
  1955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1956. return $core.withContext(function($ctx2) {
  1957. //>>excludeEnd("ctx");
  1958. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1960. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1961. //>>excludeEnd("ctx");
  1962. }));
  1963. return hash;
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1966. //>>excludeEnd("ctx");
  1967. }; }),
  1968. $globals.AssociativeCollection);
  1969. $core.addMethod(
  1970. $core.method({
  1971. selector: "associations",
  1972. protocol: "accessing",
  1973. //>>excludeStart("ide", pragmas.excludeIdeData);
  1974. args: [],
  1975. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1976. referencedClasses: [],
  1977. //>>excludeEnd("ide");
  1978. pragmas: [],
  1979. messageSends: ["associationsDo:", "add:"]
  1980. }, function ($methodClass){ return function (){
  1981. var self=this,$self=this;
  1982. var associations;
  1983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1984. return $core.withContext(function($ctx1) {
  1985. //>>excludeEnd("ctx");
  1986. associations=[];
  1987. $self._associationsDo_((function(each){
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. return $core.withContext(function($ctx2) {
  1990. //>>excludeEnd("ctx");
  1991. return $recv(associations)._add_(each);
  1992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1994. //>>excludeEnd("ctx");
  1995. }));
  1996. return associations;
  1997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1998. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  1999. //>>excludeEnd("ctx");
  2000. }; }),
  2001. $globals.AssociativeCollection);
  2002. $core.addMethod(
  2003. $core.method({
  2004. selector: "associationsDo:",
  2005. protocol: "enumerating",
  2006. //>>excludeStart("ide", pragmas.excludeIdeData);
  2007. args: ["aBlock"],
  2008. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2009. referencedClasses: ["Association"],
  2010. //>>excludeEnd("ide");
  2011. pragmas: [],
  2012. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2013. }, function ($methodClass){ return function (aBlock){
  2014. var self=this,$self=this;
  2015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2016. return $core.withContext(function($ctx1) {
  2017. //>>excludeEnd("ctx");
  2018. $self._keysAndValuesDo_((function(key,value){
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. return $core.withContext(function($ctx2) {
  2021. //>>excludeEnd("ctx");
  2022. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2025. //>>excludeEnd("ctx");
  2026. }));
  2027. return self;
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2030. //>>excludeEnd("ctx");
  2031. }; }),
  2032. $globals.AssociativeCollection);
  2033. $core.addMethod(
  2034. $core.method({
  2035. selector: "at:ifPresent:ifAbsent:",
  2036. protocol: "accessing",
  2037. //>>excludeStart("ide", pragmas.excludeIdeData);
  2038. args: ["aKey", "aBlock", "anotherBlock"],
  2039. 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 ]",
  2040. referencedClasses: [],
  2041. //>>excludeEnd("ide");
  2042. pragmas: [],
  2043. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2044. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2045. var self=this,$self=this;
  2046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2047. return $core.withContext(function($ctx1) {
  2048. //>>excludeEnd("ctx");
  2049. if($core.assert($self._includesKey_(aKey))){
  2050. return $recv(aBlock)._value_($self._at_(aKey));
  2051. } else {
  2052. return $recv(anotherBlock)._value();
  2053. }
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2056. //>>excludeEnd("ctx");
  2057. }; }),
  2058. $globals.AssociativeCollection);
  2059. $core.addMethod(
  2060. $core.method({
  2061. selector: "collect:",
  2062. protocol: "enumerating",
  2063. //>>excludeStart("ide", pragmas.excludeIdeData);
  2064. args: ["aBlock"],
  2065. 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",
  2066. referencedClasses: [],
  2067. //>>excludeEnd("ide");
  2068. pragmas: [],
  2069. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2070. }, function ($methodClass){ return function (aBlock){
  2071. var self=this,$self=this;
  2072. var newDict;
  2073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2074. return $core.withContext(function($ctx1) {
  2075. //>>excludeEnd("ctx");
  2076. newDict=$recv($self._class())._new();
  2077. $self._keysAndValuesDo_((function(key,value){
  2078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2079. return $core.withContext(function($ctx2) {
  2080. //>>excludeEnd("ctx");
  2081. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2083. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2084. //>>excludeEnd("ctx");
  2085. }));
  2086. return newDict;
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2089. //>>excludeEnd("ctx");
  2090. }; }),
  2091. $globals.AssociativeCollection);
  2092. $core.addMethod(
  2093. $core.method({
  2094. selector: "deepCopy",
  2095. protocol: "copying",
  2096. //>>excludeStart("ide", pragmas.excludeIdeData);
  2097. args: [],
  2098. 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",
  2099. referencedClasses: [],
  2100. //>>excludeEnd("ide");
  2101. pragmas: [],
  2102. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2103. }, function ($methodClass){ return function (){
  2104. var self=this,$self=this;
  2105. var copy;
  2106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2107. return $core.withContext(function($ctx1) {
  2108. //>>excludeEnd("ctx");
  2109. copy=$recv($self._class())._new();
  2110. $self._keysAndValuesDo_((function(key,value){
  2111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2112. return $core.withContext(function($ctx2) {
  2113. //>>excludeEnd("ctx");
  2114. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2116. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2117. //>>excludeEnd("ctx");
  2118. }));
  2119. return copy;
  2120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2121. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2122. //>>excludeEnd("ctx");
  2123. }; }),
  2124. $globals.AssociativeCollection);
  2125. $core.addMethod(
  2126. $core.method({
  2127. selector: "detect:ifNone:",
  2128. protocol: "enumerating",
  2129. //>>excludeStart("ide", pragmas.excludeIdeData);
  2130. args: ["aBlock", "anotherBlock"],
  2131. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2132. referencedClasses: [],
  2133. //>>excludeEnd("ide");
  2134. pragmas: [],
  2135. messageSends: ["detect:ifNone:", "values"]
  2136. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2137. var self=this,$self=this;
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. return $core.withContext(function($ctx1) {
  2140. //>>excludeEnd("ctx");
  2141. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2144. //>>excludeEnd("ctx");
  2145. }; }),
  2146. $globals.AssociativeCollection);
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: "do:",
  2150. protocol: "enumerating",
  2151. //>>excludeStart("ide", pragmas.excludeIdeData);
  2152. args: ["aBlock"],
  2153. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2154. referencedClasses: [],
  2155. //>>excludeEnd("ide");
  2156. pragmas: [],
  2157. messageSends: ["valuesDo:"]
  2158. }, function ($methodClass){ return function (aBlock){
  2159. var self=this,$self=this;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. $self._valuesDo_(aBlock);
  2164. return self;
  2165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2166. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2167. //>>excludeEnd("ctx");
  2168. }; }),
  2169. $globals.AssociativeCollection);
  2170. $core.addMethod(
  2171. $core.method({
  2172. selector: "includes:",
  2173. protocol: "enumerating",
  2174. //>>excludeStart("ide", pragmas.excludeIdeData);
  2175. args: ["anObject"],
  2176. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2177. referencedClasses: [],
  2178. //>>excludeEnd("ide");
  2179. pragmas: [],
  2180. messageSends: ["includes:", "values"]
  2181. }, function ($methodClass){ return function (anObject){
  2182. var self=this,$self=this;
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. return $core.withContext(function($ctx1) {
  2185. //>>excludeEnd("ctx");
  2186. return $recv($self._values())._includes_(anObject);
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2189. //>>excludeEnd("ctx");
  2190. }; }),
  2191. $globals.AssociativeCollection);
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "includesKey:",
  2195. protocol: "testing",
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["aKey"],
  2198. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. pragmas: [],
  2202. messageSends: ["subclassResponsibility"]
  2203. }, function ($methodClass){ return function (aKey){
  2204. var self=this,$self=this;
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return $core.withContext(function($ctx1) {
  2207. //>>excludeEnd("ctx");
  2208. $self._subclassResponsibility();
  2209. return self;
  2210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2211. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2212. //>>excludeEnd("ctx");
  2213. }; }),
  2214. $globals.AssociativeCollection);
  2215. $core.addMethod(
  2216. $core.method({
  2217. selector: "indexOf:ifAbsent:",
  2218. protocol: "accessing",
  2219. //>>excludeStart("ide", pragmas.excludeIdeData);
  2220. args: ["anObject", "aBlock"],
  2221. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2222. referencedClasses: [],
  2223. //>>excludeEnd("ide");
  2224. pragmas: [],
  2225. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2226. }, function ($methodClass){ return function (anObject,aBlock){
  2227. var self=this,$self=this;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. return $core.withContext(function($ctx1) {
  2230. //>>excludeEnd("ctx");
  2231. return $recv($self._keys())._detect_ifNone_((function(each){
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. return $core.withContext(function($ctx2) {
  2234. //>>excludeEnd("ctx");
  2235. return $recv($self._at_(each)).__eq(anObject);
  2236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2238. //>>excludeEnd("ctx");
  2239. }),aBlock);
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2242. //>>excludeEnd("ctx");
  2243. }; }),
  2244. $globals.AssociativeCollection);
  2245. $core.addMethod(
  2246. $core.method({
  2247. selector: "keyAtValue:",
  2248. protocol: "accessing",
  2249. //>>excludeStart("ide", pragmas.excludeIdeData);
  2250. args: ["anObject"],
  2251. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2252. referencedClasses: [],
  2253. //>>excludeEnd("ide");
  2254. pragmas: [],
  2255. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2256. }, function ($methodClass){ return function (anObject){
  2257. var self=this,$self=this;
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. return $core.withContext(function($ctx1) {
  2260. //>>excludeEnd("ctx");
  2261. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. return $core.withContext(function($ctx2) {
  2264. //>>excludeEnd("ctx");
  2265. return $self._errorNotFound();
  2266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2268. //>>excludeEnd("ctx");
  2269. }));
  2270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2271. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2272. //>>excludeEnd("ctx");
  2273. }; }),
  2274. $globals.AssociativeCollection);
  2275. $core.addMethod(
  2276. $core.method({
  2277. selector: "keyAtValue:ifAbsent:",
  2278. protocol: "accessing",
  2279. //>>excludeStart("ide", pragmas.excludeIdeData);
  2280. args: ["anObject", "aBlock"],
  2281. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2282. referencedClasses: [],
  2283. //>>excludeEnd("ide");
  2284. pragmas: [],
  2285. messageSends: ["indexOf:ifAbsent:"]
  2286. }, function ($methodClass){ return function (anObject,aBlock){
  2287. var self=this,$self=this;
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. return $core.withContext(function($ctx1) {
  2290. //>>excludeEnd("ctx");
  2291. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2294. //>>excludeEnd("ctx");
  2295. }; }),
  2296. $globals.AssociativeCollection);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "keys",
  2300. protocol: "accessing",
  2301. //>>excludeStart("ide", pragmas.excludeIdeData);
  2302. args: [],
  2303. source: "keys\x0a\x09self subclassResponsibility",
  2304. referencedClasses: [],
  2305. //>>excludeEnd("ide");
  2306. pragmas: [],
  2307. messageSends: ["subclassResponsibility"]
  2308. }, function ($methodClass){ return function (){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. $self._subclassResponsibility();
  2314. return self;
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2317. //>>excludeEnd("ctx");
  2318. }; }),
  2319. $globals.AssociativeCollection);
  2320. $core.addMethod(
  2321. $core.method({
  2322. selector: "keysAndValuesDo:",
  2323. protocol: "enumerating",
  2324. //>>excludeStart("ide", pragmas.excludeIdeData);
  2325. args: ["aBlock"],
  2326. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2327. referencedClasses: [],
  2328. //>>excludeEnd("ide");
  2329. pragmas: [],
  2330. messageSends: ["keysDo:", "value:value:", "at:"]
  2331. }, function ($methodClass){ return function (aBlock){
  2332. var self=this,$self=this;
  2333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2334. return $core.withContext(function($ctx1) {
  2335. //>>excludeEnd("ctx");
  2336. $self._keysDo_((function(each){
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. return $core.withContext(function($ctx2) {
  2339. //>>excludeEnd("ctx");
  2340. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2343. //>>excludeEnd("ctx");
  2344. }));
  2345. return self;
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2348. //>>excludeEnd("ctx");
  2349. }; }),
  2350. $globals.AssociativeCollection);
  2351. $core.addMethod(
  2352. $core.method({
  2353. selector: "keysDo:",
  2354. protocol: "enumerating",
  2355. //>>excludeStart("ide", pragmas.excludeIdeData);
  2356. args: ["aBlock"],
  2357. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2358. referencedClasses: [],
  2359. //>>excludeEnd("ide");
  2360. pragmas: [],
  2361. messageSends: ["subclassResponsibility"]
  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._subclassResponsibility();
  2368. return self;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2371. //>>excludeEnd("ctx");
  2372. }; }),
  2373. $globals.AssociativeCollection);
  2374. $core.addMethod(
  2375. $core.method({
  2376. selector: "printOn:",
  2377. protocol: "printing",
  2378. //>>excludeStart("ide", pragmas.excludeIdeData);
  2379. args: ["aStream"],
  2380. 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: ')'",
  2381. referencedClasses: [],
  2382. //>>excludeEnd("ide");
  2383. pragmas: [],
  2384. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2385. }, function ($methodClass){ return function (aStream){
  2386. var self=this,$self=this;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. return $core.withContext(function($ctx1) {
  2389. //>>excludeEnd("ctx");
  2390. [(
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. $ctx1.supercall = true,
  2393. //>>excludeEnd("ctx");
  2394. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2396. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2397. //>>excludeEnd("ctx");
  2398. ][0];
  2399. [$recv(aStream)._nextPutAll_(" (")
  2400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2401. ,$ctx1.sendIdx["nextPutAll:"]=1
  2402. //>>excludeEnd("ctx");
  2403. ][0];
  2404. $recv($self._associations())._do_separatedBy_((function(each){
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. return $core.withContext(function($ctx2) {
  2407. //>>excludeEnd("ctx");
  2408. return $recv(each)._printOn_(aStream);
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2411. //>>excludeEnd("ctx");
  2412. }),(function(){
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. return $core.withContext(function($ctx2) {
  2415. //>>excludeEnd("ctx");
  2416. return [$recv(aStream)._nextPutAll_(" , ")
  2417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2418. ,$ctx2.sendIdx["nextPutAll:"]=2
  2419. //>>excludeEnd("ctx");
  2420. ][0];
  2421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2423. //>>excludeEnd("ctx");
  2424. }));
  2425. $recv(aStream)._nextPutAll_(")");
  2426. return self;
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2429. //>>excludeEnd("ctx");
  2430. }; }),
  2431. $globals.AssociativeCollection);
  2432. $core.addMethod(
  2433. $core.method({
  2434. selector: "remove:ifAbsent:",
  2435. protocol: "adding/removing",
  2436. //>>excludeStart("ide", pragmas.excludeIdeData);
  2437. args: ["aKey", "aBlock"],
  2438. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2439. referencedClasses: [],
  2440. //>>excludeEnd("ide");
  2441. pragmas: [],
  2442. messageSends: ["removeKey:ifAbsent:"]
  2443. }, function ($methodClass){ return function (aKey,aBlock){
  2444. var self=this,$self=this;
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. return $core.withContext(function($ctx1) {
  2447. //>>excludeEnd("ctx");
  2448. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2451. //>>excludeEnd("ctx");
  2452. }; }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "removeAll",
  2457. protocol: "adding/removing",
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: [],
  2460. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2461. referencedClasses: [],
  2462. //>>excludeEnd("ide");
  2463. pragmas: [],
  2464. messageSends: ["do:", "keys", "removeKey:"]
  2465. }, function ($methodClass){ return function (){
  2466. var self=this,$self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. return $recv($self._keys())._do_((function(each){
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. return $core.withContext(function($ctx2) {
  2473. //>>excludeEnd("ctx");
  2474. return $self._removeKey_(each);
  2475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2477. //>>excludeEnd("ctx");
  2478. }));
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2481. //>>excludeEnd("ctx");
  2482. }; }),
  2483. $globals.AssociativeCollection);
  2484. $core.addMethod(
  2485. $core.method({
  2486. selector: "removeKey:",
  2487. protocol: "adding/removing",
  2488. //>>excludeStart("ide", pragmas.excludeIdeData);
  2489. args: ["aKey"],
  2490. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2491. referencedClasses: [],
  2492. //>>excludeEnd("ide");
  2493. pragmas: [],
  2494. messageSends: ["remove:"]
  2495. }, function ($methodClass){ return function (aKey){
  2496. var self=this,$self=this;
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. return $core.withContext(function($ctx1) {
  2499. //>>excludeEnd("ctx");
  2500. return $self._remove_(aKey);
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2503. //>>excludeEnd("ctx");
  2504. }; }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "removeKey:ifAbsent:",
  2509. protocol: "adding/removing",
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["aKey", "aBlock"],
  2512. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. pragmas: [],
  2516. messageSends: ["subclassResponsibility"]
  2517. }, function ($methodClass){ return function (aKey,aBlock){
  2518. var self=this,$self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. $self._subclassResponsibility();
  2523. return self;
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2526. //>>excludeEnd("ctx");
  2527. }; }),
  2528. $globals.AssociativeCollection);
  2529. $core.addMethod(
  2530. $core.method({
  2531. selector: "select:",
  2532. protocol: "enumerating",
  2533. //>>excludeStart("ide", pragmas.excludeIdeData);
  2534. args: ["aBlock"],
  2535. 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",
  2536. referencedClasses: [],
  2537. //>>excludeEnd("ide");
  2538. pragmas: [],
  2539. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2540. }, function ($methodClass){ return function (aBlock){
  2541. var self=this,$self=this;
  2542. var newDict;
  2543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2544. return $core.withContext(function($ctx1) {
  2545. //>>excludeEnd("ctx");
  2546. newDict=$recv($self._class())._new();
  2547. $self._keysAndValuesDo_((function(key,value){
  2548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2549. return $core.withContext(function($ctx2) {
  2550. //>>excludeEnd("ctx");
  2551. if($core.assert($recv(aBlock)._value_(value))){
  2552. return $recv(newDict)._at_put_(key,value);
  2553. }
  2554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2555. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2556. //>>excludeEnd("ctx");
  2557. }));
  2558. return newDict;
  2559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2560. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2561. //>>excludeEnd("ctx");
  2562. }; }),
  2563. $globals.AssociativeCollection);
  2564. $core.addMethod(
  2565. $core.method({
  2566. selector: "select:thenCollect:",
  2567. protocol: "enumerating",
  2568. //>>excludeStart("ide", pragmas.excludeIdeData);
  2569. args: ["selectBlock", "collectBlock"],
  2570. 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",
  2571. referencedClasses: [],
  2572. //>>excludeEnd("ide");
  2573. pragmas: [],
  2574. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2575. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2576. var self=this,$self=this;
  2577. var newDict;
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. return $core.withContext(function($ctx1) {
  2580. //>>excludeEnd("ctx");
  2581. newDict=$recv($self._class())._new();
  2582. $self._keysAndValuesDo_((function(key,value){
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. return $core.withContext(function($ctx2) {
  2585. //>>excludeEnd("ctx");
  2586. if($core.assert([$recv(selectBlock)._value_(value)
  2587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2588. ,$ctx2.sendIdx["value:"]=1
  2589. //>>excludeEnd("ctx");
  2590. ][0])){
  2591. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2592. }
  2593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2594. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2595. //>>excludeEnd("ctx");
  2596. }));
  2597. return newDict;
  2598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2599. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2600. //>>excludeEnd("ctx");
  2601. }; }),
  2602. $globals.AssociativeCollection);
  2603. $core.addMethod(
  2604. $core.method({
  2605. selector: "shallowCopy",
  2606. protocol: "copying",
  2607. //>>excludeStart("ide", pragmas.excludeIdeData);
  2608. args: [],
  2609. 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",
  2610. referencedClasses: [],
  2611. //>>excludeEnd("ide");
  2612. pragmas: [],
  2613. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2614. }, function ($methodClass){ return function (){
  2615. var self=this,$self=this;
  2616. var copy;
  2617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2618. return $core.withContext(function($ctx1) {
  2619. //>>excludeEnd("ctx");
  2620. copy=$recv($self._class())._new();
  2621. $self._keysAndValuesDo_((function(key,value){
  2622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2623. return $core.withContext(function($ctx2) {
  2624. //>>excludeEnd("ctx");
  2625. return $recv(copy)._at_put_(key,value);
  2626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2627. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2628. //>>excludeEnd("ctx");
  2629. }));
  2630. return copy;
  2631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2632. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2633. //>>excludeEnd("ctx");
  2634. }; }),
  2635. $globals.AssociativeCollection);
  2636. $core.addMethod(
  2637. $core.method({
  2638. selector: "size",
  2639. protocol: "accessing",
  2640. //>>excludeStart("ide", pragmas.excludeIdeData);
  2641. args: [],
  2642. source: "size\x0a\x09^ self keys size",
  2643. referencedClasses: [],
  2644. //>>excludeEnd("ide");
  2645. pragmas: [],
  2646. messageSends: ["size", "keys"]
  2647. }, function ($methodClass){ return function (){
  2648. var self=this,$self=this;
  2649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2650. return $core.withContext(function($ctx1) {
  2651. //>>excludeEnd("ctx");
  2652. return $recv($self._keys())._size();
  2653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2654. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2655. //>>excludeEnd("ctx");
  2656. }; }),
  2657. $globals.AssociativeCollection);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "values",
  2661. protocol: "accessing",
  2662. //>>excludeStart("ide", pragmas.excludeIdeData);
  2663. args: [],
  2664. source: "values\x0a\x09self subclassResponsibility",
  2665. referencedClasses: [],
  2666. //>>excludeEnd("ide");
  2667. pragmas: [],
  2668. messageSends: ["subclassResponsibility"]
  2669. }, function ($methodClass){ return function (){
  2670. var self=this,$self=this;
  2671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2672. return $core.withContext(function($ctx1) {
  2673. //>>excludeEnd("ctx");
  2674. $self._subclassResponsibility();
  2675. return self;
  2676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2677. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2678. //>>excludeEnd("ctx");
  2679. }; }),
  2680. $globals.AssociativeCollection);
  2681. $core.addMethod(
  2682. $core.method({
  2683. selector: "valuesDo:",
  2684. protocol: "enumerating",
  2685. //>>excludeStart("ide", pragmas.excludeIdeData);
  2686. args: ["aBlock"],
  2687. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2688. referencedClasses: [],
  2689. //>>excludeEnd("ide");
  2690. pragmas: [],
  2691. messageSends: ["subclassResponsibility"]
  2692. }, function ($methodClass){ return function (aBlock){
  2693. var self=this,$self=this;
  2694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2695. return $core.withContext(function($ctx1) {
  2696. //>>excludeEnd("ctx");
  2697. $self._subclassResponsibility();
  2698. return self;
  2699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2700. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2701. //>>excludeEnd("ctx");
  2702. }; }),
  2703. $globals.AssociativeCollection);
  2704. $core.addMethod(
  2705. $core.method({
  2706. selector: "withIndexDo:",
  2707. protocol: "enumerating",
  2708. //>>excludeStart("ide", pragmas.excludeIdeData);
  2709. args: ["aBlock"],
  2710. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2711. referencedClasses: [],
  2712. //>>excludeEnd("ide");
  2713. pragmas: [],
  2714. messageSends: ["keysAndValuesDo:", "value:value:"]
  2715. }, function ($methodClass){ return function (aBlock){
  2716. var self=this,$self=this;
  2717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2718. return $core.withContext(function($ctx1) {
  2719. //>>excludeEnd("ctx");
  2720. $self._keysAndValuesDo_((function(key,value){
  2721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2722. return $core.withContext(function($ctx2) {
  2723. //>>excludeEnd("ctx");
  2724. return $recv(aBlock)._value_value_(value,key);
  2725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2726. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2727. //>>excludeEnd("ctx");
  2728. }));
  2729. return self;
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2732. //>>excludeEnd("ctx");
  2733. }; }),
  2734. $globals.AssociativeCollection);
  2735. $core.addMethod(
  2736. $core.method({
  2737. selector: "from:",
  2738. protocol: "instance creation",
  2739. //>>excludeStart("ide", pragmas.excludeIdeData);
  2740. args: ["aCollection"],
  2741. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2742. referencedClasses: [],
  2743. //>>excludeEnd("ide");
  2744. pragmas: [],
  2745. messageSends: ["new", "do:", "add:"]
  2746. }, function ($methodClass){ return function (aCollection){
  2747. var self=this,$self=this;
  2748. var newCollection;
  2749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2750. return $core.withContext(function($ctx1) {
  2751. //>>excludeEnd("ctx");
  2752. newCollection=$self._new();
  2753. $recv(aCollection)._do_((function(each){
  2754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2755. return $core.withContext(function($ctx2) {
  2756. //>>excludeEnd("ctx");
  2757. return $recv(newCollection)._add_(each);
  2758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2760. //>>excludeEnd("ctx");
  2761. }));
  2762. return newCollection;
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2765. //>>excludeEnd("ctx");
  2766. }; }),
  2767. $globals.AssociativeCollection.a$cls);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "fromPairs:",
  2771. protocol: "instance creation",
  2772. //>>excludeStart("ide", pragmas.excludeIdeData);
  2773. args: ["aCollection"],
  2774. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2775. referencedClasses: [],
  2776. //>>excludeEnd("ide");
  2777. pragmas: [],
  2778. messageSends: ["from:"]
  2779. }, function ($methodClass){ return function (aCollection){
  2780. var self=this,$self=this;
  2781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2782. return $core.withContext(function($ctx1) {
  2783. //>>excludeEnd("ctx");
  2784. return $self._from_(aCollection);
  2785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2786. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2787. //>>excludeEnd("ctx");
  2788. }; }),
  2789. $globals.AssociativeCollection.a$cls);
  2790. $core.addMethod(
  2791. $core.method({
  2792. selector: "newFromPairs:",
  2793. protocol: "instance creation",
  2794. //>>excludeStart("ide", pragmas.excludeIdeData);
  2795. args: ["aCollection"],
  2796. 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",
  2797. referencedClasses: [],
  2798. //>>excludeEnd("ide");
  2799. pragmas: [],
  2800. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2801. }, function ($methodClass){ return function (aCollection){
  2802. var self=this,$self=this;
  2803. var newCollection;
  2804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2805. return $core.withContext(function($ctx1) {
  2806. //>>excludeEnd("ctx");
  2807. if(!$core.assert($recv([$recv(aCollection)._size()
  2808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2809. ,$ctx1.sendIdx["size"]=1
  2810. //>>excludeEnd("ctx");
  2811. ][0])._even())){
  2812. $self._error_("#newFromPairs only accepts arrays of an even length");
  2813. }
  2814. newCollection=$self._new();
  2815. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2817. return $core.withContext(function($ctx2) {
  2818. //>>excludeEnd("ctx");
  2819. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. ,$ctx2.sendIdx["at:"]=1
  2822. //>>excludeEnd("ctx");
  2823. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2826. //>>excludeEnd("ctx");
  2827. }));
  2828. return newCollection;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2831. //>>excludeEnd("ctx");
  2832. }; }),
  2833. $globals.AssociativeCollection.a$cls);
  2834. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2835. //>>excludeStart("ide", pragmas.excludeIdeData);
  2836. $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.";
  2837. //>>excludeEnd("ide");
  2838. $core.addMethod(
  2839. $core.method({
  2840. selector: "at:ifAbsent:",
  2841. protocol: "accessing",
  2842. //>>excludeStart("ide", pragmas.excludeIdeData);
  2843. args: ["aKey", "aBlock"],
  2844. 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'>",
  2845. referencedClasses: [],
  2846. //>>excludeEnd("ide");
  2847. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2848. messageSends: []
  2849. }, function ($methodClass){ return function (aKey,aBlock){
  2850. var self=this,$self=this;
  2851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2852. return $core.withContext(function($ctx1) {
  2853. //>>excludeEnd("ctx");
  2854. var index = $self._positionOfKey_(aKey);
  2855. return index >=0 ? $self.values[index] : aBlock._value();
  2856. ;
  2857. return self;
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2860. //>>excludeEnd("ctx");
  2861. }; }),
  2862. $globals.Dictionary);
  2863. $core.addMethod(
  2864. $core.method({
  2865. selector: "at:put:",
  2866. protocol: "accessing",
  2867. //>>excludeStart("ide", pragmas.excludeIdeData);
  2868. args: ["aKey", "aValue"],
  2869. 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'>",
  2870. referencedClasses: [],
  2871. //>>excludeEnd("ide");
  2872. 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"]]],
  2873. messageSends: []
  2874. }, function ($methodClass){ return function (aKey,aValue){
  2875. var self=this,$self=this;
  2876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2877. return $core.withContext(function($ctx1) {
  2878. //>>excludeEnd("ctx");
  2879. var index = $self._positionOfKey_(aKey);
  2880. if(index === -1) {
  2881. var keys = $self.keys;
  2882. index = keys.length;
  2883. keys.push(aKey);
  2884. }
  2885. return $self.values[index] = aValue;
  2886. ;
  2887. return self;
  2888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2889. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2890. //>>excludeEnd("ctx");
  2891. }; }),
  2892. $globals.Dictionary);
  2893. $core.addMethod(
  2894. $core.method({
  2895. selector: "includesKey:",
  2896. protocol: "testing",
  2897. //>>excludeStart("ide", pragmas.excludeIdeData);
  2898. args: ["aKey"],
  2899. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2900. referencedClasses: [],
  2901. //>>excludeEnd("ide");
  2902. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2903. messageSends: []
  2904. }, function ($methodClass){ return function (aKey){
  2905. var self=this,$self=this;
  2906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2907. return $core.withContext(function($ctx1) {
  2908. //>>excludeEnd("ctx");
  2909. return $self._positionOfKey_(aKey) >= 0;;
  2910. return self;
  2911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2912. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2913. //>>excludeEnd("ctx");
  2914. }; }),
  2915. $globals.Dictionary);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "indexOf:ifAbsent:",
  2919. protocol: "accessing",
  2920. //>>excludeStart("ide", pragmas.excludeIdeData);
  2921. args: ["anObject", "aBlock"],
  2922. 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 ]",
  2923. referencedClasses: [],
  2924. //>>excludeEnd("ide");
  2925. pragmas: [],
  2926. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2927. }, function ($methodClass){ return function (anObject,aBlock){
  2928. var self=this,$self=this;
  2929. var index;
  2930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2931. return $core.withContext(function($ctx1) {
  2932. //>>excludeEnd("ctx");
  2933. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2934. return (0);
  2935. }));
  2936. if($core.assert($recv(index).__eq((0)))){
  2937. return $recv(aBlock)._value();
  2938. } else {
  2939. return $recv($self.keys)._at_(index);
  2940. }
  2941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2942. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2943. //>>excludeEnd("ctx");
  2944. }; }),
  2945. $globals.Dictionary);
  2946. $core.addMethod(
  2947. $core.method({
  2948. selector: "initialize",
  2949. protocol: "initialization",
  2950. //>>excludeStart("ide", pragmas.excludeIdeData);
  2951. args: [],
  2952. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2953. referencedClasses: [],
  2954. //>>excludeEnd("ide");
  2955. pragmas: [],
  2956. messageSends: ["initialize"]
  2957. }, function ($methodClass){ return function (){
  2958. var self=this,$self=this;
  2959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2960. return $core.withContext(function($ctx1) {
  2961. //>>excludeEnd("ctx");
  2962. [(
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. $ctx1.supercall = true,
  2965. //>>excludeEnd("ctx");
  2966. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  2967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2968. ,$ctx1.supercall = false
  2969. //>>excludeEnd("ctx");
  2970. ][0];
  2971. $self.keys=[];
  2972. $self.values=[];
  2973. return self;
  2974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2975. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  2976. //>>excludeEnd("ctx");
  2977. }; }),
  2978. $globals.Dictionary);
  2979. $core.addMethod(
  2980. $core.method({
  2981. selector: "keys",
  2982. protocol: "accessing",
  2983. //>>excludeStart("ide", pragmas.excludeIdeData);
  2984. args: [],
  2985. source: "keys\x0a\x09^ keys copy",
  2986. referencedClasses: [],
  2987. //>>excludeEnd("ide");
  2988. pragmas: [],
  2989. messageSends: ["copy"]
  2990. }, function ($methodClass){ return function (){
  2991. var self=this,$self=this;
  2992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2993. return $core.withContext(function($ctx1) {
  2994. //>>excludeEnd("ctx");
  2995. return $recv($self.keys)._copy();
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2998. //>>excludeEnd("ctx");
  2999. }; }),
  3000. $globals.Dictionary);
  3001. $core.addMethod(
  3002. $core.method({
  3003. selector: "keysAndValuesDo:",
  3004. protocol: "enumerating",
  3005. //>>excludeStart("ide", pragmas.excludeIdeData);
  3006. args: ["aBlock"],
  3007. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3008. referencedClasses: [],
  3009. //>>excludeEnd("ide");
  3010. pragmas: [],
  3011. messageSends: ["with:do:"]
  3012. }, function ($methodClass){ return function (aBlock){
  3013. var self=this,$self=this;
  3014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3015. return $core.withContext(function($ctx1) {
  3016. //>>excludeEnd("ctx");
  3017. return $recv($self.keys)._with_do_($self.values,aBlock);
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3020. //>>excludeEnd("ctx");
  3021. }; }),
  3022. $globals.Dictionary);
  3023. $core.addMethod(
  3024. $core.method({
  3025. selector: "keysDo:",
  3026. protocol: "enumerating",
  3027. //>>excludeStart("ide", pragmas.excludeIdeData);
  3028. args: ["aBlock"],
  3029. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3030. referencedClasses: [],
  3031. //>>excludeEnd("ide");
  3032. pragmas: [],
  3033. messageSends: ["do:"]
  3034. }, function ($methodClass){ return function (aBlock){
  3035. var self=this,$self=this;
  3036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3037. return $core.withContext(function($ctx1) {
  3038. //>>excludeEnd("ctx");
  3039. return $recv($self.keys)._do_(aBlock);
  3040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3041. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3042. //>>excludeEnd("ctx");
  3043. }; }),
  3044. $globals.Dictionary);
  3045. $core.addMethod(
  3046. $core.method({
  3047. selector: "positionOfKey:",
  3048. protocol: "private",
  3049. //>>excludeStart("ide", pragmas.excludeIdeData);
  3050. args: ["anObject"],
  3051. 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'>",
  3052. referencedClasses: [],
  3053. //>>excludeEnd("ide");
  3054. 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"]]],
  3055. messageSends: []
  3056. }, function ($methodClass){ return function (anObject){
  3057. var self=this,$self=this;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. return $core.withContext(function($ctx1) {
  3060. //>>excludeEnd("ctx");
  3061. var keys = $self.keys;
  3062. for(var i=0;i<keys.length;i++){
  3063. if(keys[i].__eq(anObject)) { return i;}
  3064. }
  3065. return -1;
  3066. ;
  3067. return self;
  3068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3069. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3070. //>>excludeEnd("ctx");
  3071. }; }),
  3072. $globals.Dictionary);
  3073. $core.addMethod(
  3074. $core.method({
  3075. selector: "removeAll",
  3076. protocol: "adding/removing",
  3077. //>>excludeStart("ide", pragmas.excludeIdeData);
  3078. args: [],
  3079. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3080. referencedClasses: [],
  3081. //>>excludeEnd("ide");
  3082. pragmas: [],
  3083. messageSends: ["removeAll"]
  3084. }, function ($methodClass){ return function (){
  3085. var self=this,$self=this;
  3086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3087. return $core.withContext(function($ctx1) {
  3088. //>>excludeEnd("ctx");
  3089. [$recv($self.keys)._removeAll()
  3090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3091. ,$ctx1.sendIdx["removeAll"]=1
  3092. //>>excludeEnd("ctx");
  3093. ][0];
  3094. $recv($self.values)._removeAll();
  3095. return self;
  3096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3097. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3098. //>>excludeEnd("ctx");
  3099. }; }),
  3100. $globals.Dictionary);
  3101. $core.addMethod(
  3102. $core.method({
  3103. selector: "removeKey:ifAbsent:",
  3104. protocol: "adding/removing",
  3105. //>>excludeStart("ide", pragmas.excludeIdeData);
  3106. args: ["aKey", "aBlock"],
  3107. 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'>",
  3108. referencedClasses: [],
  3109. //>>excludeEnd("ide");
  3110. 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"]]],
  3111. messageSends: []
  3112. }, function ($methodClass){ return function (aKey,aBlock){
  3113. var self=this,$self=this;
  3114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3115. return $core.withContext(function($ctx1) {
  3116. //>>excludeEnd("ctx");
  3117. var index = $self._positionOfKey_(aKey);
  3118. if(index === -1) {
  3119. return aBlock._value()
  3120. } else {
  3121. var keys = $self.keys, values = $self.values;
  3122. var value = values[index], l = keys.length;
  3123. keys[index] = keys[l-1];
  3124. keys.pop();
  3125. values[index] = values[l-1];
  3126. values.pop();
  3127. return value;
  3128. }
  3129. ;
  3130. return self;
  3131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3132. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3133. //>>excludeEnd("ctx");
  3134. }; }),
  3135. $globals.Dictionary);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "values",
  3139. protocol: "accessing",
  3140. //>>excludeStart("ide", pragmas.excludeIdeData);
  3141. args: [],
  3142. source: "values\x0a\x09^ values",
  3143. referencedClasses: [],
  3144. //>>excludeEnd("ide");
  3145. pragmas: [],
  3146. messageSends: []
  3147. }, function ($methodClass){ return function (){
  3148. var self=this,$self=this;
  3149. return $self.values;
  3150. }; }),
  3151. $globals.Dictionary);
  3152. $core.addMethod(
  3153. $core.method({
  3154. selector: "valuesDo:",
  3155. protocol: "enumerating",
  3156. //>>excludeStart("ide", pragmas.excludeIdeData);
  3157. args: ["aBlock"],
  3158. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3159. referencedClasses: [],
  3160. //>>excludeEnd("ide");
  3161. pragmas: [],
  3162. messageSends: ["do:"]
  3163. }, function ($methodClass){ return function (aBlock){
  3164. var self=this,$self=this;
  3165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3166. return $core.withContext(function($ctx1) {
  3167. //>>excludeEnd("ctx");
  3168. return $recv($self.values)._do_(aBlock);
  3169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3170. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3171. //>>excludeEnd("ctx");
  3172. }; }),
  3173. $globals.Dictionary);
  3174. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3175. //>>excludeStart("ide", pragmas.excludeIdeData);
  3176. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3177. //>>excludeEnd("ide");
  3178. $core.addMethod(
  3179. $core.method({
  3180. selector: "asJavaScriptSource",
  3181. protocol: "accessing",
  3182. //>>excludeStart("ide", pragmas.excludeIdeData);
  3183. args: [],
  3184. 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: '}' ]",
  3185. referencedClasses: ["String"],
  3186. //>>excludeEnd("ide");
  3187. pragmas: [],
  3188. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3189. }, function ($methodClass){ return function (){
  3190. var self=this,$self=this;
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. return $core.withContext(function($ctx1) {
  3193. //>>excludeEnd("ctx");
  3194. return $recv($globals.String)._streamContents_((function(str){
  3195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3196. return $core.withContext(function($ctx2) {
  3197. //>>excludeEnd("ctx");
  3198. [$recv(str)._nextPut_("{")
  3199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3200. ,$ctx2.sendIdx["nextPut:"]=1
  3201. //>>excludeEnd("ctx");
  3202. ][0];
  3203. $self._keysAndValuesDo_((function(key,value){
  3204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3205. return $core.withContext(function($ctx3) {
  3206. //>>excludeEnd("ctx");
  3207. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3209. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3210. //>>excludeEnd("ctx");
  3211. ][0])
  3212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3213. ,$ctx3.sendIdx["nextPutAll:"]=1
  3214. //>>excludeEnd("ctx");
  3215. ][0];
  3216. [$recv(str)._nextPut_(":")
  3217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3218. ,$ctx3.sendIdx["nextPut:"]=2
  3219. //>>excludeEnd("ctx");
  3220. ][0];
  3221. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3222. return [$recv(str)._nextPut_(",")
  3223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3224. ,$ctx3.sendIdx["nextPut:"]=3
  3225. //>>excludeEnd("ctx");
  3226. ][0];
  3227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3228. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3229. //>>excludeEnd("ctx");
  3230. }));
  3231. $recv(str)._skip_((-1));
  3232. return $recv(str)._nextPut_("}");
  3233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3234. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3235. //>>excludeEnd("ctx");
  3236. }));
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3239. //>>excludeEnd("ctx");
  3240. }; }),
  3241. $globals.HashedCollection);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "at:ifAbsent:",
  3245. protocol: "accessing",
  3246. //>>excludeStart("ide", pragmas.excludeIdeData);
  3247. args: ["aKey", "aBlock"],
  3248. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3249. referencedClasses: [],
  3250. //>>excludeEnd("ide");
  3251. pragmas: [],
  3252. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3253. }, function ($methodClass){ return function (aKey,aBlock){
  3254. var self=this,$self=this;
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. return $core.withContext(function($ctx1) {
  3257. //>>excludeEnd("ctx");
  3258. if($core.assert($self._includesKey_(aKey))){
  3259. return $self._basicAt_(aKey);
  3260. } else {
  3261. return $recv(aBlock)._value();
  3262. }
  3263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3264. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3265. //>>excludeEnd("ctx");
  3266. }; }),
  3267. $globals.HashedCollection);
  3268. $core.addMethod(
  3269. $core.method({
  3270. selector: "at:put:",
  3271. protocol: "accessing",
  3272. //>>excludeStart("ide", pragmas.excludeIdeData);
  3273. args: ["aKey", "aValue"],
  3274. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3275. referencedClasses: [],
  3276. //>>excludeEnd("ide");
  3277. pragmas: [],
  3278. messageSends: ["basicAt:put:"]
  3279. }, function ($methodClass){ return function (aKey,aValue){
  3280. var self=this,$self=this;
  3281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3282. return $core.withContext(function($ctx1) {
  3283. //>>excludeEnd("ctx");
  3284. return $self._basicAt_put_(aKey,aValue);
  3285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3286. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3287. //>>excludeEnd("ctx");
  3288. }; }),
  3289. $globals.HashedCollection);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "includesKey:",
  3293. protocol: "testing",
  3294. //>>excludeStart("ide", pragmas.excludeIdeData);
  3295. args: ["aKey"],
  3296. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3297. referencedClasses: [],
  3298. //>>excludeEnd("ide");
  3299. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3300. messageSends: []
  3301. }, function ($methodClass){ return function (aKey){
  3302. var self=this,$self=this;
  3303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3304. return $core.withContext(function($ctx1) {
  3305. //>>excludeEnd("ctx");
  3306. return self.hasOwnProperty(aKey);
  3307. return self;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3310. //>>excludeEnd("ctx");
  3311. }; }),
  3312. $globals.HashedCollection);
  3313. $core.addMethod(
  3314. $core.method({
  3315. selector: "keys",
  3316. protocol: "accessing",
  3317. //>>excludeStart("ide", pragmas.excludeIdeData);
  3318. args: [],
  3319. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3320. referencedClasses: [],
  3321. //>>excludeEnd("ide");
  3322. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3323. messageSends: []
  3324. }, function ($methodClass){ return function (){
  3325. var self=this,$self=this;
  3326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3327. return $core.withContext(function($ctx1) {
  3328. //>>excludeEnd("ctx");
  3329. return Object.keys(self);
  3330. return self;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3333. //>>excludeEnd("ctx");
  3334. }; }),
  3335. $globals.HashedCollection);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: "keysDo:",
  3339. protocol: "enumerating",
  3340. //>>excludeStart("ide", pragmas.excludeIdeData);
  3341. args: ["aBlock"],
  3342. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3343. referencedClasses: [],
  3344. //>>excludeEnd("ide");
  3345. pragmas: [],
  3346. messageSends: ["do:", "keys"]
  3347. }, function ($methodClass){ return function (aBlock){
  3348. var self=this,$self=this;
  3349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3350. return $core.withContext(function($ctx1) {
  3351. //>>excludeEnd("ctx");
  3352. $recv($self._keys())._do_(aBlock);
  3353. return self;
  3354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3355. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3356. //>>excludeEnd("ctx");
  3357. }; }),
  3358. $globals.HashedCollection);
  3359. $core.addMethod(
  3360. $core.method({
  3361. selector: "removeKey:ifAbsent:",
  3362. protocol: "adding/removing",
  3363. //>>excludeStart("ide", pragmas.excludeIdeData);
  3364. args: ["aKey", "aBlock"],
  3365. 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 ]",
  3366. referencedClasses: [],
  3367. //>>excludeEnd("ide");
  3368. pragmas: [],
  3369. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3370. }, function ($methodClass){ return function (aKey,aBlock){
  3371. var self=this,$self=this;
  3372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3373. return $core.withContext(function($ctx1) {
  3374. //>>excludeEnd("ctx");
  3375. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return $core.withContext(function($ctx2) {
  3378. //>>excludeEnd("ctx");
  3379. $self._basicDelete_(aKey);
  3380. return removed;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3383. //>>excludeEnd("ctx");
  3384. }),(function(){
  3385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3386. return $core.withContext(function($ctx2) {
  3387. //>>excludeEnd("ctx");
  3388. return $recv(aBlock)._value();
  3389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3391. //>>excludeEnd("ctx");
  3392. }));
  3393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3394. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3395. //>>excludeEnd("ctx");
  3396. }; }),
  3397. $globals.HashedCollection);
  3398. $core.addMethod(
  3399. $core.method({
  3400. selector: "values",
  3401. protocol: "accessing",
  3402. //>>excludeStart("ide", pragmas.excludeIdeData);
  3403. args: [],
  3404. 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'>",
  3405. referencedClasses: [],
  3406. //>>excludeEnd("ide");
  3407. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3408. messageSends: []
  3409. }, function ($methodClass){ return function (){
  3410. var self=this,$self=this;
  3411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3412. return $core.withContext(function($ctx1) {
  3413. //>>excludeEnd("ctx");
  3414. return $self._keys().map(function(key){
  3415. return $self._at_(key);
  3416. });
  3417. ;
  3418. return self;
  3419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3420. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3421. //>>excludeEnd("ctx");
  3422. }; }),
  3423. $globals.HashedCollection);
  3424. $core.addMethod(
  3425. $core.method({
  3426. selector: "valuesDo:",
  3427. protocol: "enumerating",
  3428. //>>excludeStart("ide", pragmas.excludeIdeData);
  3429. args: ["aBlock"],
  3430. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3431. referencedClasses: [],
  3432. //>>excludeEnd("ide");
  3433. pragmas: [],
  3434. messageSends: ["do:", "values"]
  3435. }, function ($methodClass){ return function (aBlock){
  3436. var self=this,$self=this;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. return $core.withContext(function($ctx1) {
  3439. //>>excludeEnd("ctx");
  3440. $recv($self._values())._do_(aBlock);
  3441. return self;
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3444. //>>excludeEnd("ctx");
  3445. }; }),
  3446. $globals.HashedCollection);
  3447. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3448. //>>excludeStart("ide", pragmas.excludeIdeData);
  3449. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3450. //>>excludeEnd("ide");
  3451. $core.addMethod(
  3452. $core.method({
  3453. selector: "=",
  3454. protocol: "comparing",
  3455. //>>excludeStart("ide", pragmas.excludeIdeData);
  3456. args: ["aCollection"],
  3457. 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",
  3458. referencedClasses: [],
  3459. //>>excludeEnd("ide");
  3460. pragmas: [],
  3461. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3462. }, function ($methodClass){ return function (aCollection){
  3463. var self=this,$self=this;
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. return $core.withContext(function($ctx1) {
  3466. //>>excludeEnd("ctx");
  3467. var $early={};
  3468. try {
  3469. if(!$core.assert($recv([$recv([$self._class()
  3470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3471. ,$ctx1.sendIdx["class"]=1
  3472. //>>excludeEnd("ctx");
  3473. ][0]).__eq($recv(aCollection)._class())
  3474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3475. ,$ctx1.sendIdx["="]=1
  3476. //>>excludeEnd("ctx");
  3477. ][0])._and_((function(){
  3478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3479. return $core.withContext(function($ctx2) {
  3480. //>>excludeEnd("ctx");
  3481. return [$recv([$self._size()
  3482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3483. ,$ctx2.sendIdx["size"]=1
  3484. //>>excludeEnd("ctx");
  3485. ][0]).__eq($recv(aCollection)._size())
  3486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3487. ,$ctx2.sendIdx["="]=2
  3488. //>>excludeEnd("ctx");
  3489. ][0];
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3492. //>>excludeEnd("ctx");
  3493. })))){
  3494. return false;
  3495. }
  3496. $self._withIndexDo_((function(each,i){
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. return $core.withContext(function($ctx2) {
  3499. //>>excludeEnd("ctx");
  3500. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  3501. throw $early=[false];
  3502. }
  3503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3504. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3505. //>>excludeEnd("ctx");
  3506. }));
  3507. return true;
  3508. }
  3509. catch(e) {if(e===$early)return e[0]; throw e}
  3510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3511. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3512. //>>excludeEnd("ctx");
  3513. }; }),
  3514. $globals.SequenceableCollection);
  3515. $core.addMethod(
  3516. $core.method({
  3517. selector: "addLast:",
  3518. protocol: "adding/removing",
  3519. //>>excludeStart("ide", pragmas.excludeIdeData);
  3520. args: ["anObject"],
  3521. source: "addLast: anObject\x0a\x09self add: anObject",
  3522. referencedClasses: [],
  3523. //>>excludeEnd("ide");
  3524. pragmas: [],
  3525. messageSends: ["add:"]
  3526. }, function ($methodClass){ return function (anObject){
  3527. var self=this,$self=this;
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. return $core.withContext(function($ctx1) {
  3530. //>>excludeEnd("ctx");
  3531. $self._add_(anObject);
  3532. return self;
  3533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3534. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3535. //>>excludeEnd("ctx");
  3536. }; }),
  3537. $globals.SequenceableCollection);
  3538. $core.addMethod(
  3539. $core.method({
  3540. selector: "allButFirst",
  3541. protocol: "accessing",
  3542. //>>excludeStart("ide", pragmas.excludeIdeData);
  3543. args: [],
  3544. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3545. referencedClasses: [],
  3546. //>>excludeEnd("ide");
  3547. pragmas: [],
  3548. messageSends: ["copyFrom:to:", "size"]
  3549. }, function ($methodClass){ return function (){
  3550. var self=this,$self=this;
  3551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3552. return $core.withContext(function($ctx1) {
  3553. //>>excludeEnd("ctx");
  3554. return $self._copyFrom_to_((2),$self._size());
  3555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3556. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3557. //>>excludeEnd("ctx");
  3558. }; }),
  3559. $globals.SequenceableCollection);
  3560. $core.addMethod(
  3561. $core.method({
  3562. selector: "allButLast",
  3563. protocol: "accessing",
  3564. //>>excludeStart("ide", pragmas.excludeIdeData);
  3565. args: [],
  3566. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3567. referencedClasses: [],
  3568. //>>excludeEnd("ide");
  3569. pragmas: [],
  3570. messageSends: ["copyFrom:to:", "-", "size"]
  3571. }, function ($methodClass){ return function (){
  3572. var self=this,$self=this;
  3573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3574. return $core.withContext(function($ctx1) {
  3575. //>>excludeEnd("ctx");
  3576. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3579. //>>excludeEnd("ctx");
  3580. }; }),
  3581. $globals.SequenceableCollection);
  3582. $core.addMethod(
  3583. $core.method({
  3584. selector: "anyOne",
  3585. protocol: "accessing",
  3586. //>>excludeStart("ide", pragmas.excludeIdeData);
  3587. args: [],
  3588. source: "anyOne\x0a\x09^ self at: 1",
  3589. referencedClasses: [],
  3590. //>>excludeEnd("ide");
  3591. pragmas: [],
  3592. messageSends: ["at:"]
  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._at_((1));
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3601. //>>excludeEnd("ctx");
  3602. }; }),
  3603. $globals.SequenceableCollection);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "atRandom",
  3607. protocol: "accessing",
  3608. //>>excludeStart("ide", pragmas.excludeIdeData);
  3609. args: [],
  3610. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3611. referencedClasses: [],
  3612. //>>excludeEnd("ide");
  3613. pragmas: [],
  3614. messageSends: ["at:", "atRandom", "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._at_($recv($self._size())._atRandom());
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3623. //>>excludeEnd("ctx");
  3624. }; }),
  3625. $globals.SequenceableCollection);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "beginsWith:",
  3629. protocol: "testing",
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: ["prefix"],
  3632. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3633. referencedClasses: [],
  3634. //>>excludeEnd("ide");
  3635. pragmas: [],
  3636. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3637. }, function ($methodClass){ return function (prefix){
  3638. var self=this,$self=this;
  3639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3640. return $core.withContext(function($ctx1) {
  3641. //>>excludeEnd("ctx");
  3642. if($core.assert($recv([$self._size()
  3643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3644. ,$ctx1.sendIdx["size"]=1
  3645. //>>excludeEnd("ctx");
  3646. ][0]).__lt([$recv(prefix)._size()
  3647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3648. ,$ctx1.sendIdx["size"]=2
  3649. //>>excludeEnd("ctx");
  3650. ][0]))){
  3651. return false;
  3652. }
  3653. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3655. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3656. //>>excludeEnd("ctx");
  3657. }; }),
  3658. $globals.SequenceableCollection);
  3659. $core.addMethod(
  3660. $core.method({
  3661. selector: "copyFrom:to:",
  3662. protocol: "copying",
  3663. //>>excludeStart("ide", pragmas.excludeIdeData);
  3664. args: ["anIndex", "anotherIndex"],
  3665. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3666. referencedClasses: [],
  3667. //>>excludeEnd("ide");
  3668. pragmas: [],
  3669. messageSends: ["subclassResponsibility"]
  3670. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3671. var self=this,$self=this;
  3672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3673. return $core.withContext(function($ctx1) {
  3674. //>>excludeEnd("ctx");
  3675. $self._subclassResponsibility();
  3676. return self;
  3677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3678. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3679. //>>excludeEnd("ctx");
  3680. }; }),
  3681. $globals.SequenceableCollection);
  3682. $core.addMethod(
  3683. $core.method({
  3684. selector: "copyWithFirst:",
  3685. protocol: "copying",
  3686. //>>excludeStart("ide", pragmas.excludeIdeData);
  3687. args: ["anObject"],
  3688. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3689. referencedClasses: [],
  3690. //>>excludeEnd("ide");
  3691. pragmas: [],
  3692. messageSends: ["addAll:", "with:", "class", "yourself"]
  3693. }, function ($methodClass){ return function (anObject){
  3694. var self=this,$self=this;
  3695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3696. return $core.withContext(function($ctx1) {
  3697. //>>excludeEnd("ctx");
  3698. var $1;
  3699. $1=$recv($self._class())._with_(anObject);
  3700. $recv($1)._addAll_(self);
  3701. return $recv($1)._yourself();
  3702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3703. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3704. //>>excludeEnd("ctx");
  3705. }; }),
  3706. $globals.SequenceableCollection);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "endsWith:",
  3710. protocol: "testing",
  3711. //>>excludeStart("ide", pragmas.excludeIdeData);
  3712. args: ["suffix"],
  3713. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3714. referencedClasses: [],
  3715. //>>excludeEnd("ide");
  3716. pragmas: [],
  3717. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3718. }, function ($methodClass){ return function (suffix){
  3719. var self=this,$self=this;
  3720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3721. return $core.withContext(function($ctx1) {
  3722. //>>excludeEnd("ctx");
  3723. if($core.assert($recv([$self._size()
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. ,$ctx1.sendIdx["size"]=1
  3726. //>>excludeEnd("ctx");
  3727. ][0]).__lt([$recv(suffix)._size()
  3728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3729. ,$ctx1.sendIdx["size"]=2
  3730. //>>excludeEnd("ctx");
  3731. ][0]))){
  3732. return false;
  3733. }
  3734. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3736. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3737. //>>excludeEnd("ctx");
  3738. }; }),
  3739. $globals.SequenceableCollection);
  3740. $core.addMethod(
  3741. $core.method({
  3742. selector: "first",
  3743. protocol: "accessing",
  3744. //>>excludeStart("ide", pragmas.excludeIdeData);
  3745. args: [],
  3746. source: "first\x0a\x09^ self at: 1",
  3747. referencedClasses: [],
  3748. //>>excludeEnd("ide");
  3749. pragmas: [],
  3750. messageSends: ["at:"]
  3751. }, function ($methodClass){ return function (){
  3752. var self=this,$self=this;
  3753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3754. return $core.withContext(function($ctx1) {
  3755. //>>excludeEnd("ctx");
  3756. return $self._at_((1));
  3757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3758. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3759. //>>excludeEnd("ctx");
  3760. }; }),
  3761. $globals.SequenceableCollection);
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "first:",
  3765. protocol: "accessing",
  3766. //>>excludeStart("ide", pragmas.excludeIdeData);
  3767. args: ["aNumber"],
  3768. 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",
  3769. referencedClasses: [],
  3770. //>>excludeEnd("ide");
  3771. pragmas: [],
  3772. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3773. }, function ($methodClass){ return function (aNumber){
  3774. var self=this,$self=this;
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. return $core.withContext(function($ctx1) {
  3777. //>>excludeEnd("ctx");
  3778. if($core.assert($recv($self._size()).__lt(aNumber))){
  3779. $self._error_("Invalid number of elements");
  3780. }
  3781. return $self._copyFrom_to_((1),aNumber);
  3782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3783. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3784. //>>excludeEnd("ctx");
  3785. }; }),
  3786. $globals.SequenceableCollection);
  3787. $core.addMethod(
  3788. $core.method({
  3789. selector: "fourth",
  3790. protocol: "accessing",
  3791. //>>excludeStart("ide", pragmas.excludeIdeData);
  3792. args: [],
  3793. source: "fourth\x0a\x09^ self at: 4",
  3794. referencedClasses: [],
  3795. //>>excludeEnd("ide");
  3796. pragmas: [],
  3797. messageSends: ["at:"]
  3798. }, function ($methodClass){ return function (){
  3799. var self=this,$self=this;
  3800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3801. return $core.withContext(function($ctx1) {
  3802. //>>excludeEnd("ctx");
  3803. return $self._at_((4));
  3804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3805. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3806. //>>excludeEnd("ctx");
  3807. }; }),
  3808. $globals.SequenceableCollection);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "includes:",
  3812. protocol: "testing",
  3813. //>>excludeStart("ide", pragmas.excludeIdeData);
  3814. args: ["anObject"],
  3815. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3816. referencedClasses: [],
  3817. //>>excludeEnd("ide");
  3818. pragmas: [],
  3819. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3820. }, function ($methodClass){ return function (anObject){
  3821. var self=this,$self=this;
  3822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3823. return $core.withContext(function($ctx1) {
  3824. //>>excludeEnd("ctx");
  3825. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3826. return nil;
  3827. })))._notNil();
  3828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3829. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3830. //>>excludeEnd("ctx");
  3831. }; }),
  3832. $globals.SequenceableCollection);
  3833. $core.addMethod(
  3834. $core.method({
  3835. selector: "indexOf:startingAt:",
  3836. protocol: "accessing",
  3837. //>>excludeStart("ide", pragmas.excludeIdeData);
  3838. args: ["anObject", "start"],
  3839. 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 ]",
  3840. referencedClasses: [],
  3841. //>>excludeEnd("ide");
  3842. pragmas: [],
  3843. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3844. }, function ($methodClass){ return function (anObject,start){
  3845. var self=this,$self=this;
  3846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3847. return $core.withContext(function($ctx1) {
  3848. //>>excludeEnd("ctx");
  3849. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3850. return (0);
  3851. }));
  3852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3853. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3854. //>>excludeEnd("ctx");
  3855. }; }),
  3856. $globals.SequenceableCollection);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "indexOf:startingAt:ifAbsent:",
  3860. protocol: "accessing",
  3861. //>>excludeStart("ide", pragmas.excludeIdeData);
  3862. args: ["anObject", "start", "aBlock"],
  3863. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3864. referencedClasses: [],
  3865. //>>excludeEnd("ide");
  3866. pragmas: [],
  3867. messageSends: ["subclassResponsibility"]
  3868. }, function ($methodClass){ return function (anObject,start,aBlock){
  3869. var self=this,$self=this;
  3870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3871. return $core.withContext(function($ctx1) {
  3872. //>>excludeEnd("ctx");
  3873. $self._subclassResponsibility();
  3874. return self;
  3875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3876. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3877. //>>excludeEnd("ctx");
  3878. }; }),
  3879. $globals.SequenceableCollection);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "last",
  3883. protocol: "accessing",
  3884. //>>excludeStart("ide", pragmas.excludeIdeData);
  3885. args: [],
  3886. source: "last\x0a\x09^ self at: self size",
  3887. referencedClasses: [],
  3888. //>>excludeEnd("ide");
  3889. pragmas: [],
  3890. messageSends: ["at:", "size"]
  3891. }, function ($methodClass){ return function (){
  3892. var self=this,$self=this;
  3893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3894. return $core.withContext(function($ctx1) {
  3895. //>>excludeEnd("ctx");
  3896. return $self._at_($self._size());
  3897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3898. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3899. //>>excludeEnd("ctx");
  3900. }; }),
  3901. $globals.SequenceableCollection);
  3902. $core.addMethod(
  3903. $core.method({
  3904. selector: "last:",
  3905. protocol: "accessing",
  3906. //>>excludeStart("ide", pragmas.excludeIdeData);
  3907. args: ["aNumber"],
  3908. 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",
  3909. referencedClasses: [],
  3910. //>>excludeEnd("ide");
  3911. pragmas: [],
  3912. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3913. }, function ($methodClass){ return function (aNumber){
  3914. var self=this,$self=this;
  3915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3916. return $core.withContext(function($ctx1) {
  3917. //>>excludeEnd("ctx");
  3918. if($core.assert($recv([$self._size()
  3919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3920. ,$ctx1.sendIdx["size"]=1
  3921. //>>excludeEnd("ctx");
  3922. ][0]).__lt(aNumber))){
  3923. $self._error_("Invalid number of elements");
  3924. }
  3925. return $self._copyFrom_to_($recv($recv([$self._size()
  3926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3927. ,$ctx1.sendIdx["size"]=2
  3928. //>>excludeEnd("ctx");
  3929. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  3930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3931. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3932. //>>excludeEnd("ctx");
  3933. }; }),
  3934. $globals.SequenceableCollection);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "newStream",
  3938. protocol: "streaming",
  3939. //>>excludeStart("ide", pragmas.excludeIdeData);
  3940. args: [],
  3941. source: "newStream\x0a\x09^ self streamClass on: self",
  3942. referencedClasses: [],
  3943. //>>excludeEnd("ide");
  3944. pragmas: [],
  3945. messageSends: ["on:", "streamClass"]
  3946. }, function ($methodClass){ return function (){
  3947. var self=this,$self=this;
  3948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3949. return $core.withContext(function($ctx1) {
  3950. //>>excludeEnd("ctx");
  3951. return $recv($self._streamClass())._on_(self);
  3952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3953. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  3954. //>>excludeEnd("ctx");
  3955. }; }),
  3956. $globals.SequenceableCollection);
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "readStream",
  3960. protocol: "streaming",
  3961. //>>excludeStart("ide", pragmas.excludeIdeData);
  3962. args: [],
  3963. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3964. referencedClasses: [],
  3965. //>>excludeEnd("ide");
  3966. pragmas: [],
  3967. messageSends: ["stream"]
  3968. }, function ($methodClass){ return function (){
  3969. var self=this,$self=this;
  3970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3971. return $core.withContext(function($ctx1) {
  3972. //>>excludeEnd("ctx");
  3973. return $self._stream();
  3974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3975. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  3976. //>>excludeEnd("ctx");
  3977. }; }),
  3978. $globals.SequenceableCollection);
  3979. $core.addMethod(
  3980. $core.method({
  3981. selector: "removeLast",
  3982. protocol: "adding/removing",
  3983. //>>excludeStart("ide", pragmas.excludeIdeData);
  3984. args: [],
  3985. source: "removeLast\x0a\x09^ self remove: self last",
  3986. referencedClasses: [],
  3987. //>>excludeEnd("ide");
  3988. pragmas: [],
  3989. messageSends: ["remove:", "last"]
  3990. }, function ($methodClass){ return function (){
  3991. var self=this,$self=this;
  3992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3993. return $core.withContext(function($ctx1) {
  3994. //>>excludeEnd("ctx");
  3995. return $self._remove_($self._last());
  3996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3997. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  3998. //>>excludeEnd("ctx");
  3999. }; }),
  4000. $globals.SequenceableCollection);
  4001. $core.addMethod(
  4002. $core.method({
  4003. selector: "reverseDo:",
  4004. protocol: "enumerating",
  4005. //>>excludeStart("ide", pragmas.excludeIdeData);
  4006. args: ["aBlock"],
  4007. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4008. referencedClasses: [],
  4009. //>>excludeEnd("ide");
  4010. pragmas: [],
  4011. messageSends: ["do:", "reversed"]
  4012. }, function ($methodClass){ return function (aBlock){
  4013. var self=this,$self=this;
  4014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4015. return $core.withContext(function($ctx1) {
  4016. //>>excludeEnd("ctx");
  4017. $recv($self._reversed())._do_(aBlock);
  4018. return self;
  4019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4020. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4021. //>>excludeEnd("ctx");
  4022. }; }),
  4023. $globals.SequenceableCollection);
  4024. $core.addMethod(
  4025. $core.method({
  4026. selector: "reversed",
  4027. protocol: "converting",
  4028. //>>excludeStart("ide", pragmas.excludeIdeData);
  4029. args: [],
  4030. source: "reversed\x0a\x09self subclassResponsibility",
  4031. referencedClasses: [],
  4032. //>>excludeEnd("ide");
  4033. pragmas: [],
  4034. messageSends: ["subclassResponsibility"]
  4035. }, function ($methodClass){ return function (){
  4036. var self=this,$self=this;
  4037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4038. return $core.withContext(function($ctx1) {
  4039. //>>excludeEnd("ctx");
  4040. $self._subclassResponsibility();
  4041. return self;
  4042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4043. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4044. //>>excludeEnd("ctx");
  4045. }; }),
  4046. $globals.SequenceableCollection);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "second",
  4050. protocol: "accessing",
  4051. //>>excludeStart("ide", pragmas.excludeIdeData);
  4052. args: [],
  4053. source: "second\x0a\x09^ self at: 2",
  4054. referencedClasses: [],
  4055. //>>excludeEnd("ide");
  4056. pragmas: [],
  4057. messageSends: ["at:"]
  4058. }, function ($methodClass){ return function (){
  4059. var self=this,$self=this;
  4060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4061. return $core.withContext(function($ctx1) {
  4062. //>>excludeEnd("ctx");
  4063. return $self._at_((2));
  4064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4065. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4066. //>>excludeEnd("ctx");
  4067. }; }),
  4068. $globals.SequenceableCollection);
  4069. $core.addMethod(
  4070. $core.method({
  4071. selector: "stream",
  4072. protocol: "streaming",
  4073. //>>excludeStart("ide", pragmas.excludeIdeData);
  4074. args: [],
  4075. source: "stream\x0a\x09^ self newStream",
  4076. referencedClasses: [],
  4077. //>>excludeEnd("ide");
  4078. pragmas: [],
  4079. messageSends: ["newStream"]
  4080. }, function ($methodClass){ return function (){
  4081. var self=this,$self=this;
  4082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4083. return $core.withContext(function($ctx1) {
  4084. //>>excludeEnd("ctx");
  4085. return $self._newStream();
  4086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4087. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4088. //>>excludeEnd("ctx");
  4089. }; }),
  4090. $globals.SequenceableCollection);
  4091. $core.addMethod(
  4092. $core.method({
  4093. selector: "streamClass",
  4094. protocol: "streaming",
  4095. //>>excludeStart("ide", pragmas.excludeIdeData);
  4096. args: [],
  4097. source: "streamClass\x0a\x09^ self class streamClass",
  4098. referencedClasses: [],
  4099. //>>excludeEnd("ide");
  4100. pragmas: [],
  4101. messageSends: ["streamClass", "class"]
  4102. }, function ($methodClass){ return function (){
  4103. var self=this,$self=this;
  4104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4105. return $core.withContext(function($ctx1) {
  4106. //>>excludeEnd("ctx");
  4107. return $recv($self._class())._streamClass();
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4110. //>>excludeEnd("ctx");
  4111. }; }),
  4112. $globals.SequenceableCollection);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "third",
  4116. protocol: "accessing",
  4117. //>>excludeStart("ide", pragmas.excludeIdeData);
  4118. args: [],
  4119. source: "third\x0a\x09^ self at: 3",
  4120. referencedClasses: [],
  4121. //>>excludeEnd("ide");
  4122. pragmas: [],
  4123. messageSends: ["at:"]
  4124. }, function ($methodClass){ return function (){
  4125. var self=this,$self=this;
  4126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4127. return $core.withContext(function($ctx1) {
  4128. //>>excludeEnd("ctx");
  4129. return $self._at_((3));
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4132. //>>excludeEnd("ctx");
  4133. }; }),
  4134. $globals.SequenceableCollection);
  4135. $core.addMethod(
  4136. $core.method({
  4137. selector: "writeStream",
  4138. protocol: "streaming",
  4139. //>>excludeStart("ide", pragmas.excludeIdeData);
  4140. args: [],
  4141. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4142. referencedClasses: [],
  4143. //>>excludeEnd("ide");
  4144. pragmas: [],
  4145. messageSends: ["stream"]
  4146. }, function ($methodClass){ return function (){
  4147. var self=this,$self=this;
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. return $core.withContext(function($ctx1) {
  4150. //>>excludeEnd("ctx");
  4151. return $self._stream();
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4154. //>>excludeEnd("ctx");
  4155. }; }),
  4156. $globals.SequenceableCollection);
  4157. $core.addMethod(
  4158. $core.method({
  4159. selector: "streamClass",
  4160. protocol: "accessing",
  4161. //>>excludeStart("ide", pragmas.excludeIdeData);
  4162. args: [],
  4163. source: "streamClass\x0a\x09\x09^ Stream",
  4164. referencedClasses: ["Stream"],
  4165. //>>excludeEnd("ide");
  4166. pragmas: [],
  4167. messageSends: []
  4168. }, function ($methodClass){ return function (){
  4169. var self=this,$self=this;
  4170. return $globals.Stream;
  4171. }; }),
  4172. $globals.SequenceableCollection.a$cls);
  4173. $core.addMethod(
  4174. $core.method({
  4175. selector: "streamContents:",
  4176. protocol: "streaming",
  4177. //>>excludeStart("ide", pragmas.excludeIdeData);
  4178. args: ["aBlock"],
  4179. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4180. referencedClasses: [],
  4181. //>>excludeEnd("ide");
  4182. pragmas: [],
  4183. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4184. }, function ($methodClass){ return function (aBlock){
  4185. var self=this,$self=this;
  4186. var stream;
  4187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4188. return $core.withContext(function($ctx1) {
  4189. //>>excludeEnd("ctx");
  4190. stream=$recv($self._streamClass())._on_($self._new());
  4191. $recv(aBlock)._value_(stream);
  4192. return $recv(stream)._contents();
  4193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4194. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4195. //>>excludeEnd("ctx");
  4196. }; }),
  4197. $globals.SequenceableCollection.a$cls);
  4198. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4199. //>>excludeStart("ide", pragmas.excludeIdeData);
  4200. $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`.";
  4201. //>>excludeEnd("ide");
  4202. $core.addMethod(
  4203. $core.method({
  4204. selector: "add:",
  4205. protocol: "adding/removing",
  4206. //>>excludeStart("ide", pragmas.excludeIdeData);
  4207. args: ["anObject"],
  4208. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4209. referencedClasses: [],
  4210. //>>excludeEnd("ide");
  4211. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4212. messageSends: []
  4213. }, function ($methodClass){ return function (anObject){
  4214. var self=this,$self=this;
  4215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4216. return $core.withContext(function($ctx1) {
  4217. //>>excludeEnd("ctx");
  4218. self.push(anObject); return anObject;;
  4219. return self;
  4220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4221. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4222. //>>excludeEnd("ctx");
  4223. }; }),
  4224. $globals.Array);
  4225. $core.addMethod(
  4226. $core.method({
  4227. selector: "addAll:",
  4228. protocol: "adding/removing",
  4229. //>>excludeStart("ide", pragmas.excludeIdeData);
  4230. args: ["aCollection"],
  4231. 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'>",
  4232. referencedClasses: [],
  4233. //>>excludeEnd("ide");
  4234. 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;"]]],
  4235. messageSends: []
  4236. }, function ($methodClass){ return function (aCollection){
  4237. var self=this,$self=this;
  4238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4239. return $core.withContext(function($ctx1) {
  4240. //>>excludeEnd("ctx");
  4241. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4242. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4243. return aCollection;;
  4244. return self;
  4245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4246. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4247. //>>excludeEnd("ctx");
  4248. }; }),
  4249. $globals.Array);
  4250. $core.addMethod(
  4251. $core.method({
  4252. selector: "addFirst:",
  4253. protocol: "adding/removing",
  4254. //>>excludeStart("ide", pragmas.excludeIdeData);
  4255. args: ["anObject"],
  4256. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4257. referencedClasses: [],
  4258. //>>excludeEnd("ide");
  4259. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4260. messageSends: []
  4261. }, function ($methodClass){ return function (anObject){
  4262. var self=this,$self=this;
  4263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4264. return $core.withContext(function($ctx1) {
  4265. //>>excludeEnd("ctx");
  4266. self.unshift(anObject); return anObject;;
  4267. return self;
  4268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4269. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4270. //>>excludeEnd("ctx");
  4271. }; }),
  4272. $globals.Array);
  4273. $core.addMethod(
  4274. $core.method({
  4275. selector: "allIn:",
  4276. protocol: "enumerating",
  4277. //>>excludeStart("ide", pragmas.excludeIdeData);
  4278. args: ["aBlock"],
  4279. source: "allIn: aBlock\x0a\x09^ aBlock valueWithPossibleArguments:\x0a\x09\x09\x22collect to match #in: behaviour\x22\x0a\x09\x09(self collect: [ :each | each in: [ :x | x ] ])",
  4280. referencedClasses: [],
  4281. //>>excludeEnd("ide");
  4282. pragmas: [],
  4283. messageSends: ["valueWithPossibleArguments:", "collect:", "in:"]
  4284. }, function ($methodClass){ return function (aBlock){
  4285. var self=this,$self=this;
  4286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4287. return $core.withContext(function($ctx1) {
  4288. //>>excludeEnd("ctx");
  4289. return $recv(aBlock)._valueWithPossibleArguments_($self._collect_((function(each){
  4290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4291. return $core.withContext(function($ctx2) {
  4292. //>>excludeEnd("ctx");
  4293. return $recv(each)._in_((function(x){
  4294. return x;
  4295. }));
  4296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4298. //>>excludeEnd("ctx");
  4299. })));
  4300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4301. }, function($ctx1) {$ctx1.fill(self,"allIn:",{aBlock:aBlock})});
  4302. //>>excludeEnd("ctx");
  4303. }; }),
  4304. $globals.Array);
  4305. $core.addMethod(
  4306. $core.method({
  4307. selector: "asJavaScriptSource",
  4308. protocol: "converting",
  4309. //>>excludeStart("ide", pragmas.excludeIdeData);
  4310. args: [],
  4311. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4312. referencedClasses: [],
  4313. //>>excludeEnd("ide");
  4314. pragmas: [],
  4315. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4316. }, function ($methodClass){ return function (){
  4317. var self=this,$self=this;
  4318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4319. return $core.withContext(function($ctx1) {
  4320. //>>excludeEnd("ctx");
  4321. return [$recv("[".__comma($recv($self._collect_((function(each){
  4322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4323. return $core.withContext(function($ctx2) {
  4324. //>>excludeEnd("ctx");
  4325. return $recv(each)._asJavaScriptSource();
  4326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4327. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4328. //>>excludeEnd("ctx");
  4329. })))._join_(", "))).__comma("]")
  4330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4331. ,$ctx1.sendIdx[","]=1
  4332. //>>excludeEnd("ctx");
  4333. ][0];
  4334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4335. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4336. //>>excludeEnd("ctx");
  4337. }; }),
  4338. $globals.Array);
  4339. $core.addMethod(
  4340. $core.method({
  4341. selector: "at:put:",
  4342. protocol: "accessing",
  4343. //>>excludeStart("ide", pragmas.excludeIdeData);
  4344. args: ["anIndex", "anObject"],
  4345. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4346. referencedClasses: [],
  4347. //>>excludeEnd("ide");
  4348. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4349. messageSends: []
  4350. }, function ($methodClass){ return function (anIndex,anObject){
  4351. var self=this,$self=this;
  4352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4353. return $core.withContext(function($ctx1) {
  4354. //>>excludeEnd("ctx");
  4355. return self[anIndex - 1] = anObject;
  4356. return self;
  4357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4358. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4359. //>>excludeEnd("ctx");
  4360. }; }),
  4361. $globals.Array);
  4362. $core.addMethod(
  4363. $core.method({
  4364. selector: "collect:",
  4365. protocol: "enumerating",
  4366. //>>excludeStart("ide", pragmas.excludeIdeData);
  4367. args: ["aBlock"],
  4368. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4369. referencedClasses: [],
  4370. //>>excludeEnd("ide");
  4371. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4372. messageSends: []
  4373. }, function ($methodClass){ return function (aBlock){
  4374. var self=this,$self=this;
  4375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4376. return $core.withContext(function($ctx1) {
  4377. //>>excludeEnd("ctx");
  4378. return self.map(function(each) {return aBlock._value_(each)});
  4379. return self;
  4380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4381. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4382. //>>excludeEnd("ctx");
  4383. }; }),
  4384. $globals.Array);
  4385. $core.addMethod(
  4386. $core.method({
  4387. selector: "copyFrom:to:",
  4388. protocol: "copying",
  4389. //>>excludeStart("ide", pragmas.excludeIdeData);
  4390. args: ["anIndex", "anotherIndex"],
  4391. 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'>",
  4392. referencedClasses: [],
  4393. //>>excludeEnd("ide");
  4394. 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}"]]],
  4395. messageSends: []
  4396. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4397. var self=this,$self=this;
  4398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4399. return $core.withContext(function($ctx1) {
  4400. //>>excludeEnd("ctx");
  4401. if (anIndex >= 1 && anotherIndex <= self.length) {
  4402. return self.slice(anIndex - 1, anotherIndex);
  4403. } else {
  4404. self._at_(anIndex);
  4405. self._at_(self.length + 1);
  4406. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4407. };
  4408. return self;
  4409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4410. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4411. //>>excludeEnd("ctx");
  4412. }; }),
  4413. $globals.Array);
  4414. $core.addMethod(
  4415. $core.method({
  4416. selector: "join:",
  4417. protocol: "enumerating",
  4418. //>>excludeStart("ide", pragmas.excludeIdeData);
  4419. args: ["aString"],
  4420. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4421. referencedClasses: [],
  4422. //>>excludeEnd("ide");
  4423. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4424. messageSends: []
  4425. }, function ($methodClass){ return function (aString){
  4426. var self=this,$self=this;
  4427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4428. return $core.withContext(function($ctx1) {
  4429. //>>excludeEnd("ctx");
  4430. return self.join(aString);
  4431. return self;
  4432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4433. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4434. //>>excludeEnd("ctx");
  4435. }; }),
  4436. $globals.Array);
  4437. $core.addMethod(
  4438. $core.method({
  4439. selector: "printOn:",
  4440. protocol: "printing",
  4441. //>>excludeStart("ide", pragmas.excludeIdeData);
  4442. args: ["aStream"],
  4443. 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: ')'",
  4444. referencedClasses: [],
  4445. //>>excludeEnd("ide");
  4446. pragmas: [],
  4447. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4448. }, function ($methodClass){ return function (aStream){
  4449. var self=this,$self=this;
  4450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4451. return $core.withContext(function($ctx1) {
  4452. //>>excludeEnd("ctx");
  4453. [(
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. $ctx1.supercall = true,
  4456. //>>excludeEnd("ctx");
  4457. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4459. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4460. //>>excludeEnd("ctx");
  4461. ][0];
  4462. [$recv(aStream)._nextPutAll_(" (")
  4463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4464. ,$ctx1.sendIdx["nextPutAll:"]=1
  4465. //>>excludeEnd("ctx");
  4466. ][0];
  4467. $self._do_separatedBy_((function(each){
  4468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4469. return $core.withContext(function($ctx2) {
  4470. //>>excludeEnd("ctx");
  4471. return $recv(each)._printOn_(aStream);
  4472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4473. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4474. //>>excludeEnd("ctx");
  4475. }),(function(){
  4476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4477. return $core.withContext(function($ctx2) {
  4478. //>>excludeEnd("ctx");
  4479. return [$recv(aStream)._nextPutAll_(" ")
  4480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4481. ,$ctx2.sendIdx["nextPutAll:"]=2
  4482. //>>excludeEnd("ctx");
  4483. ][0];
  4484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4485. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4486. //>>excludeEnd("ctx");
  4487. }));
  4488. $recv(aStream)._nextPutAll_(")");
  4489. return self;
  4490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4491. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4492. //>>excludeEnd("ctx");
  4493. }; }),
  4494. $globals.Array);
  4495. $core.addMethod(
  4496. $core.method({
  4497. selector: "remove:ifAbsent:",
  4498. protocol: "adding/removing",
  4499. //>>excludeStart("ide", pragmas.excludeIdeData);
  4500. args: ["anObject", "aBlock"],
  4501. 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 ]",
  4502. referencedClasses: [],
  4503. //>>excludeEnd("ide");
  4504. pragmas: [],
  4505. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4506. }, function ($methodClass){ return function (anObject,aBlock){
  4507. var self=this,$self=this;
  4508. var index;
  4509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4510. return $core.withContext(function($ctx1) {
  4511. //>>excludeEnd("ctx");
  4512. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4513. return (0);
  4514. }));
  4515. if($core.assert($recv(index).__eq((0)))){
  4516. return $recv(aBlock)._value();
  4517. } else {
  4518. $self._removeIndex_(index);
  4519. return anObject;
  4520. }
  4521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4522. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4523. //>>excludeEnd("ctx");
  4524. }; }),
  4525. $globals.Array);
  4526. $core.addMethod(
  4527. $core.method({
  4528. selector: "removeAll",
  4529. protocol: "adding/removing",
  4530. //>>excludeStart("ide", pragmas.excludeIdeData);
  4531. args: [],
  4532. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4533. referencedClasses: [],
  4534. //>>excludeEnd("ide");
  4535. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4536. messageSends: []
  4537. }, function ($methodClass){ return function (){
  4538. var self=this,$self=this;
  4539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4540. return $core.withContext(function($ctx1) {
  4541. //>>excludeEnd("ctx");
  4542. self.length = 0;
  4543. return self;
  4544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4545. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4546. //>>excludeEnd("ctx");
  4547. }; }),
  4548. $globals.Array);
  4549. $core.addMethod(
  4550. $core.method({
  4551. selector: "removeFrom:to:",
  4552. protocol: "adding/removing",
  4553. //>>excludeStart("ide", pragmas.excludeIdeData);
  4554. args: ["aNumber", "anotherNumber"],
  4555. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4556. referencedClasses: [],
  4557. //>>excludeEnd("ide");
  4558. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4559. messageSends: []
  4560. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4561. var self=this,$self=this;
  4562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4563. return $core.withContext(function($ctx1) {
  4564. //>>excludeEnd("ctx");
  4565. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4566. return self;
  4567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4568. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4569. //>>excludeEnd("ctx");
  4570. }; }),
  4571. $globals.Array);
  4572. $core.addMethod(
  4573. $core.method({
  4574. selector: "removeIndex:",
  4575. protocol: "adding/removing",
  4576. //>>excludeStart("ide", pragmas.excludeIdeData);
  4577. args: ["anInteger"],
  4578. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4579. referencedClasses: [],
  4580. //>>excludeEnd("ide");
  4581. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4582. messageSends: []
  4583. }, function ($methodClass){ return function (anInteger){
  4584. var self=this,$self=this;
  4585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4586. return $core.withContext(function($ctx1) {
  4587. //>>excludeEnd("ctx");
  4588. self.splice(anInteger - 1, 1);
  4589. return self;
  4590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4591. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4592. //>>excludeEnd("ctx");
  4593. }; }),
  4594. $globals.Array);
  4595. $core.addMethod(
  4596. $core.method({
  4597. selector: "removeLast",
  4598. protocol: "adding/removing",
  4599. //>>excludeStart("ide", pragmas.excludeIdeData);
  4600. args: [],
  4601. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4602. referencedClasses: [],
  4603. //>>excludeEnd("ide");
  4604. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4605. messageSends: []
  4606. }, function ($methodClass){ return function (){
  4607. var self=this,$self=this;
  4608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4609. return $core.withContext(function($ctx1) {
  4610. //>>excludeEnd("ctx");
  4611. return self.pop();;
  4612. return self;
  4613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4614. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4615. //>>excludeEnd("ctx");
  4616. }; }),
  4617. $globals.Array);
  4618. $core.addMethod(
  4619. $core.method({
  4620. selector: "reversed",
  4621. protocol: "converting",
  4622. //>>excludeStart("ide", pragmas.excludeIdeData);
  4623. args: [],
  4624. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4625. referencedClasses: [],
  4626. //>>excludeEnd("ide");
  4627. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4628. messageSends: []
  4629. }, function ($methodClass){ return function (){
  4630. var self=this,$self=this;
  4631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4632. return $core.withContext(function($ctx1) {
  4633. //>>excludeEnd("ctx");
  4634. return self.slice().reverse();
  4635. return self;
  4636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4637. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4638. //>>excludeEnd("ctx");
  4639. }; }),
  4640. $globals.Array);
  4641. $core.addMethod(
  4642. $core.method({
  4643. selector: "select:",
  4644. protocol: "enumerating",
  4645. //>>excludeStart("ide", pragmas.excludeIdeData);
  4646. args: ["aBlock"],
  4647. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4648. referencedClasses: [],
  4649. //>>excludeEnd("ide");
  4650. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4651. messageSends: []
  4652. }, function ($methodClass){ return function (aBlock){
  4653. var self=this,$self=this;
  4654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4655. return $core.withContext(function($ctx1) {
  4656. //>>excludeEnd("ctx");
  4657. return self.filter(function(each) {return aBlock._value_(each)});
  4658. return self;
  4659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4660. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4661. //>>excludeEnd("ctx");
  4662. }; }),
  4663. $globals.Array);
  4664. $core.addMethod(
  4665. $core.method({
  4666. selector: "shallowCopy",
  4667. protocol: "copying",
  4668. //>>excludeStart("ide", pragmas.excludeIdeData);
  4669. args: [],
  4670. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4671. referencedClasses: [],
  4672. //>>excludeEnd("ide");
  4673. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4674. messageSends: []
  4675. }, function ($methodClass){ return function (){
  4676. var self=this,$self=this;
  4677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4678. return $core.withContext(function($ctx1) {
  4679. //>>excludeEnd("ctx");
  4680. return self.slice();
  4681. return self;
  4682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4683. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4684. //>>excludeEnd("ctx");
  4685. }; }),
  4686. $globals.Array);
  4687. $core.addMethod(
  4688. $core.method({
  4689. selector: "sort",
  4690. protocol: "enumerating",
  4691. //>>excludeStart("ide", pragmas.excludeIdeData);
  4692. args: [],
  4693. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4694. referencedClasses: [],
  4695. //>>excludeEnd("ide");
  4696. pragmas: [],
  4697. messageSends: ["sort:", "<"]
  4698. }, function ($methodClass){ return function (){
  4699. var self=this,$self=this;
  4700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4701. return $core.withContext(function($ctx1) {
  4702. //>>excludeEnd("ctx");
  4703. return $self._sort_((function(a,b){
  4704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4705. return $core.withContext(function($ctx2) {
  4706. //>>excludeEnd("ctx");
  4707. return $recv(a).__lt(b);
  4708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4709. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4710. //>>excludeEnd("ctx");
  4711. }));
  4712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4713. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4714. //>>excludeEnd("ctx");
  4715. }; }),
  4716. $globals.Array);
  4717. $core.addMethod(
  4718. $core.method({
  4719. selector: "sort:",
  4720. protocol: "enumerating",
  4721. //>>excludeStart("ide", pragmas.excludeIdeData);
  4722. args: ["aBlock"],
  4723. 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'>",
  4724. referencedClasses: [],
  4725. //>>excludeEnd("ide");
  4726. 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"]]],
  4727. messageSends: []
  4728. }, function ($methodClass){ return function (aBlock){
  4729. var self=this,$self=this;
  4730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4731. return $core.withContext(function($ctx1) {
  4732. //>>excludeEnd("ctx");
  4733. return self.sort(function(a, b) {
  4734. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4735. })
  4736. ;
  4737. return self;
  4738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4739. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4740. //>>excludeEnd("ctx");
  4741. }; }),
  4742. $globals.Array);
  4743. $core.addMethod(
  4744. $core.method({
  4745. selector: "sorted",
  4746. protocol: "enumerating",
  4747. //>>excludeStart("ide", pragmas.excludeIdeData);
  4748. args: [],
  4749. source: "sorted\x0a\x09^ self copy sort",
  4750. referencedClasses: [],
  4751. //>>excludeEnd("ide");
  4752. pragmas: [],
  4753. messageSends: ["sort", "copy"]
  4754. }, function ($methodClass){ return function (){
  4755. var self=this,$self=this;
  4756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4757. return $core.withContext(function($ctx1) {
  4758. //>>excludeEnd("ctx");
  4759. return $recv($self._copy())._sort();
  4760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4761. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  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: ["aBlock"],
  4771. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4772. referencedClasses: [],
  4773. //>>excludeEnd("ide");
  4774. pragmas: [],
  4775. messageSends: ["sort:", "copy"]
  4776. }, function ($methodClass){ return function (aBlock){
  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_(aBlock);
  4782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4783. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4784. //>>excludeEnd("ctx");
  4785. }; }),
  4786. $globals.Array);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "new:",
  4790. protocol: "instance creation",
  4791. //>>excludeStart("ide", pragmas.excludeIdeData);
  4792. args: ["anInteger"],
  4793. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4794. referencedClasses: [],
  4795. //>>excludeEnd("ide");
  4796. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4797. messageSends: []
  4798. }, function ($methodClass){ return function (anInteger){
  4799. var self=this,$self=this;
  4800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4801. return $core.withContext(function($ctx1) {
  4802. //>>excludeEnd("ctx");
  4803. return new Array(anInteger);
  4804. return self;
  4805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4806. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4807. //>>excludeEnd("ctx");
  4808. }; }),
  4809. $globals.Array.a$cls);
  4810. $core.addMethod(
  4811. $core.method({
  4812. selector: "with:",
  4813. protocol: "instance creation",
  4814. //>>excludeStart("ide", pragmas.excludeIdeData);
  4815. args: ["anObject"],
  4816. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4817. referencedClasses: [],
  4818. //>>excludeEnd("ide");
  4819. pragmas: [],
  4820. messageSends: ["at:put:", "new:", "yourself"]
  4821. }, function ($methodClass){ return function (anObject){
  4822. var self=this,$self=this;
  4823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4824. return $core.withContext(function($ctx1) {
  4825. //>>excludeEnd("ctx");
  4826. var $1;
  4827. $1=$self._new_((1));
  4828. $recv($1)._at_put_((1),anObject);
  4829. return $recv($1)._yourself();
  4830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4831. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4832. //>>excludeEnd("ctx");
  4833. }; }),
  4834. $globals.Array.a$cls);
  4835. $core.addMethod(
  4836. $core.method({
  4837. selector: "with:with:",
  4838. protocol: "instance creation",
  4839. //>>excludeStart("ide", pragmas.excludeIdeData);
  4840. args: ["anObject", "anObject2"],
  4841. 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",
  4842. referencedClasses: [],
  4843. //>>excludeEnd("ide");
  4844. pragmas: [],
  4845. messageSends: ["at:put:", "new:", "yourself"]
  4846. }, function ($methodClass){ return function (anObject,anObject2){
  4847. var self=this,$self=this;
  4848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4849. return $core.withContext(function($ctx1) {
  4850. //>>excludeEnd("ctx");
  4851. var $1;
  4852. $1=$self._new_((2));
  4853. [$recv($1)._at_put_((1),anObject)
  4854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4855. ,$ctx1.sendIdx["at:put:"]=1
  4856. //>>excludeEnd("ctx");
  4857. ][0];
  4858. $recv($1)._at_put_((2),anObject2);
  4859. return $recv($1)._yourself();
  4860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4861. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4862. //>>excludeEnd("ctx");
  4863. }; }),
  4864. $globals.Array.a$cls);
  4865. $core.addMethod(
  4866. $core.method({
  4867. selector: "with:with:with:",
  4868. protocol: "instance creation",
  4869. //>>excludeStart("ide", pragmas.excludeIdeData);
  4870. args: ["anObject", "anObject2", "anObject3"],
  4871. 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",
  4872. referencedClasses: [],
  4873. //>>excludeEnd("ide");
  4874. pragmas: [],
  4875. messageSends: ["at:put:", "new:", "yourself"]
  4876. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4877. var self=this,$self=this;
  4878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4879. return $core.withContext(function($ctx1) {
  4880. //>>excludeEnd("ctx");
  4881. var $1;
  4882. $1=$self._new_((3));
  4883. [$recv($1)._at_put_((1),anObject)
  4884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4885. ,$ctx1.sendIdx["at:put:"]=1
  4886. //>>excludeEnd("ctx");
  4887. ][0];
  4888. [$recv($1)._at_put_((2),anObject2)
  4889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4890. ,$ctx1.sendIdx["at:put:"]=2
  4891. //>>excludeEnd("ctx");
  4892. ][0];
  4893. $recv($1)._at_put_((3),anObject3);
  4894. return $recv($1)._yourself();
  4895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4896. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4897. //>>excludeEnd("ctx");
  4898. }; }),
  4899. $globals.Array.a$cls);
  4900. $core.addMethod(
  4901. $core.method({
  4902. selector: "withAll:",
  4903. protocol: "instance creation",
  4904. //>>excludeStart("ide", pragmas.excludeIdeData);
  4905. args: ["aCollection"],
  4906. 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",
  4907. referencedClasses: [],
  4908. //>>excludeEnd("ide");
  4909. pragmas: [],
  4910. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4911. }, function ($methodClass){ return function (aCollection){
  4912. var self=this,$self=this;
  4913. var instance,index;
  4914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4915. return $core.withContext(function($ctx1) {
  4916. //>>excludeEnd("ctx");
  4917. index=(1);
  4918. instance=$self._new_($recv(aCollection)._size());
  4919. $recv(aCollection)._do_((function(each){
  4920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4921. return $core.withContext(function($ctx2) {
  4922. //>>excludeEnd("ctx");
  4923. $recv(instance)._at_put_(index,each);
  4924. index=$recv(index).__plus((1));
  4925. return index;
  4926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4927. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4928. //>>excludeEnd("ctx");
  4929. }));
  4930. return instance;
  4931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4932. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4933. //>>excludeEnd("ctx");
  4934. }; }),
  4935. $globals.Array.a$cls);
  4936. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4937. //>>excludeStart("ide", pragmas.excludeIdeData);
  4938. $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 >> #,`";
  4939. //>>excludeEnd("ide");
  4940. $core.addMethod(
  4941. $core.method({
  4942. selector: ",",
  4943. protocol: "copying",
  4944. //>>excludeStart("ide", pragmas.excludeIdeData);
  4945. args: ["aString"],
  4946. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4947. referencedClasses: [],
  4948. //>>excludeEnd("ide");
  4949. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4950. messageSends: []
  4951. }, function ($methodClass){ return function (aString){
  4952. var self=this,$self=this;
  4953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4954. return $core.withContext(function($ctx1) {
  4955. //>>excludeEnd("ctx");
  4956. return String(self) + aString;
  4957. return self;
  4958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4959. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4960. //>>excludeEnd("ctx");
  4961. }; }),
  4962. $globals.String);
  4963. $core.addMethod(
  4964. $core.method({
  4965. selector: "<",
  4966. protocol: "comparing",
  4967. //>>excludeStart("ide", pragmas.excludeIdeData);
  4968. args: ["aString"],
  4969. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4970. referencedClasses: [],
  4971. //>>excludeEnd("ide");
  4972. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4973. messageSends: []
  4974. }, function ($methodClass){ return function (aString){
  4975. var self=this,$self=this;
  4976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4977. return $core.withContext(function($ctx1) {
  4978. //>>excludeEnd("ctx");
  4979. return String(self) < aString._asString();
  4980. return self;
  4981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4982. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  4983. //>>excludeEnd("ctx");
  4984. }; }),
  4985. $globals.String);
  4986. $core.addMethod(
  4987. $core.method({
  4988. selector: "<=",
  4989. protocol: "comparing",
  4990. //>>excludeStart("ide", pragmas.excludeIdeData);
  4991. args: ["aString"],
  4992. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4993. referencedClasses: [],
  4994. //>>excludeEnd("ide");
  4995. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  4996. messageSends: []
  4997. }, function ($methodClass){ return function (aString){
  4998. var self=this,$self=this;
  4999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5000. return $core.withContext(function($ctx1) {
  5001. //>>excludeEnd("ctx");
  5002. return String(self) <= aString._asString();
  5003. return self;
  5004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5005. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5006. //>>excludeEnd("ctx");
  5007. }; }),
  5008. $globals.String);
  5009. $core.addMethod(
  5010. $core.method({
  5011. selector: "=",
  5012. protocol: "comparing",
  5013. //>>excludeStart("ide", pragmas.excludeIdeData);
  5014. args: ["aString"],
  5015. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5016. referencedClasses: [],
  5017. //>>excludeEnd("ide");
  5018. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5019. messageSends: []
  5020. }, function ($methodClass){ return function (aString){
  5021. var self=this,$self=this;
  5022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5023. return $core.withContext(function($ctx1) {
  5024. //>>excludeEnd("ctx");
  5025. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5026. return self;
  5027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5028. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5029. //>>excludeEnd("ctx");
  5030. }; }),
  5031. $globals.String);
  5032. $core.addMethod(
  5033. $core.method({
  5034. selector: "==",
  5035. protocol: "comparing",
  5036. //>>excludeStart("ide", pragmas.excludeIdeData);
  5037. args: ["aString"],
  5038. 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'>",
  5039. referencedClasses: [],
  5040. //>>excludeEnd("ide");
  5041. 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;"]]],
  5042. messageSends: []
  5043. }, function ($methodClass){ return function (aString){
  5044. var self=this,$self=this;
  5045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5046. return $core.withContext(function($ctx1) {
  5047. //>>excludeEnd("ctx");
  5048. if (typeof aString === "string") return String(self) === aString;
  5049. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5050. else return false;;
  5051. return self;
  5052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5053. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5054. //>>excludeEnd("ctx");
  5055. }; }),
  5056. $globals.String);
  5057. $core.addMethod(
  5058. $core.method({
  5059. selector: ">",
  5060. protocol: "comparing",
  5061. //>>excludeStart("ide", pragmas.excludeIdeData);
  5062. args: ["aString"],
  5063. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5064. referencedClasses: [],
  5065. //>>excludeEnd("ide");
  5066. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5067. messageSends: []
  5068. }, function ($methodClass){ return function (aString){
  5069. var self=this,$self=this;
  5070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5071. return $core.withContext(function($ctx1) {
  5072. //>>excludeEnd("ctx");
  5073. return String(self) > aString._asString();
  5074. return self;
  5075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5076. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5077. //>>excludeEnd("ctx");
  5078. }; }),
  5079. $globals.String);
  5080. $core.addMethod(
  5081. $core.method({
  5082. selector: ">=",
  5083. protocol: "comparing",
  5084. //>>excludeStart("ide", pragmas.excludeIdeData);
  5085. args: ["aString"],
  5086. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5087. referencedClasses: [],
  5088. //>>excludeEnd("ide");
  5089. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5090. messageSends: []
  5091. }, function ($methodClass){ return function (aString){
  5092. var self=this,$self=this;
  5093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5094. return $core.withContext(function($ctx1) {
  5095. //>>excludeEnd("ctx");
  5096. return String(self) >= aString._asString();
  5097. return self;
  5098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5099. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5100. //>>excludeEnd("ctx");
  5101. }; }),
  5102. $globals.String);
  5103. $core.addMethod(
  5104. $core.method({
  5105. selector: "add:",
  5106. protocol: "adding/removing",
  5107. //>>excludeStart("ide", pragmas.excludeIdeData);
  5108. args: ["anObject"],
  5109. source: "add: anObject\x0a\x09self errorReadOnly",
  5110. referencedClasses: [],
  5111. //>>excludeEnd("ide");
  5112. pragmas: [],
  5113. messageSends: ["errorReadOnly"]
  5114. }, function ($methodClass){ return function (anObject){
  5115. var self=this,$self=this;
  5116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5117. return $core.withContext(function($ctx1) {
  5118. //>>excludeEnd("ctx");
  5119. $self._errorReadOnly();
  5120. return self;
  5121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5122. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5123. //>>excludeEnd("ctx");
  5124. }; }),
  5125. $globals.String);
  5126. $core.addMethod(
  5127. $core.method({
  5128. selector: "asJavaScriptMethodName",
  5129. protocol: "converting",
  5130. //>>excludeStart("ide", pragmas.excludeIdeData);
  5131. args: [],
  5132. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5133. referencedClasses: [],
  5134. //>>excludeEnd("ide");
  5135. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5136. messageSends: []
  5137. }, function ($methodClass){ return function (){
  5138. var self=this,$self=this;
  5139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5140. return $core.withContext(function($ctx1) {
  5141. //>>excludeEnd("ctx");
  5142. return $core.st2js(self);
  5143. return self;
  5144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5145. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5146. //>>excludeEnd("ctx");
  5147. }; }),
  5148. $globals.String);
  5149. $core.addMethod(
  5150. $core.method({
  5151. selector: "asJavaScriptObject",
  5152. protocol: "converting",
  5153. //>>excludeStart("ide", pragmas.excludeIdeData);
  5154. args: [],
  5155. source: "asJavaScriptObject\x0a\x09^ self",
  5156. referencedClasses: [],
  5157. //>>excludeEnd("ide");
  5158. pragmas: [],
  5159. messageSends: []
  5160. }, function ($methodClass){ return function (){
  5161. var self=this,$self=this;
  5162. return self;
  5163. }; }),
  5164. $globals.String);
  5165. $core.addMethod(
  5166. $core.method({
  5167. selector: "asJavaScriptSource",
  5168. protocol: "converting",
  5169. //>>excludeStart("ide", pragmas.excludeIdeData);
  5170. args: [],
  5171. 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'>",
  5172. referencedClasses: [],
  5173. //>>excludeEnd("ide");
  5174. 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"]]],
  5175. messageSends: []
  5176. }, function ($methodClass){ return function (){
  5177. var self=this,$self=this;
  5178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5179. return $core.withContext(function($ctx1) {
  5180. //>>excludeEnd("ctx");
  5181. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5182. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5183. else
  5184. return "\"" + self + "\"";
  5185. ;
  5186. return self;
  5187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5188. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5189. //>>excludeEnd("ctx");
  5190. }; }),
  5191. $globals.String);
  5192. $core.addMethod(
  5193. $core.method({
  5194. selector: "asLowercase",
  5195. protocol: "converting",
  5196. //>>excludeStart("ide", pragmas.excludeIdeData);
  5197. args: [],
  5198. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5199. referencedClasses: [],
  5200. //>>excludeEnd("ide");
  5201. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5202. messageSends: []
  5203. }, function ($methodClass){ return function (){
  5204. var self=this,$self=this;
  5205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5206. return $core.withContext(function($ctx1) {
  5207. //>>excludeEnd("ctx");
  5208. return self.toLowerCase();
  5209. return self;
  5210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5211. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5212. //>>excludeEnd("ctx");
  5213. }; }),
  5214. $globals.String);
  5215. $core.addMethod(
  5216. $core.method({
  5217. selector: "asMutator",
  5218. protocol: "converting",
  5219. //>>excludeStart("ide", pragmas.excludeIdeData);
  5220. args: [],
  5221. 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",
  5222. referencedClasses: [],
  5223. //>>excludeEnd("ide");
  5224. pragmas: [],
  5225. messageSends: ["ifFalse:", "=", "last", ","]
  5226. }, function ($methodClass){ return function (){
  5227. var self=this,$self=this;
  5228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5229. return $core.withContext(function($ctx1) {
  5230. //>>excludeEnd("ctx");
  5231. if(!$core.assert($recv($self._last()).__eq(":"))){
  5232. return $self.__comma(":");
  5233. }
  5234. return self;
  5235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5236. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5237. //>>excludeEnd("ctx");
  5238. }; }),
  5239. $globals.String);
  5240. $core.addMethod(
  5241. $core.method({
  5242. selector: "asNumber",
  5243. protocol: "converting",
  5244. //>>excludeStart("ide", pragmas.excludeIdeData);
  5245. args: [],
  5246. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5247. referencedClasses: [],
  5248. //>>excludeEnd("ide");
  5249. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5250. messageSends: []
  5251. }, function ($methodClass){ return function (){
  5252. var self=this,$self=this;
  5253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5254. return $core.withContext(function($ctx1) {
  5255. //>>excludeEnd("ctx");
  5256. return Number(self);
  5257. return self;
  5258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5259. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5260. //>>excludeEnd("ctx");
  5261. }; }),
  5262. $globals.String);
  5263. $core.addMethod(
  5264. $core.method({
  5265. selector: "asRegexp",
  5266. protocol: "converting",
  5267. //>>excludeStart("ide", pragmas.excludeIdeData);
  5268. args: [],
  5269. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5270. referencedClasses: ["RegularExpression"],
  5271. //>>excludeEnd("ide");
  5272. pragmas: [],
  5273. messageSends: ["fromString:"]
  5274. }, function ($methodClass){ return function (){
  5275. var self=this,$self=this;
  5276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5277. return $core.withContext(function($ctx1) {
  5278. //>>excludeEnd("ctx");
  5279. return $recv($globals.RegularExpression)._fromString_(self);
  5280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5281. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5282. //>>excludeEnd("ctx");
  5283. }; }),
  5284. $globals.String);
  5285. $core.addMethod(
  5286. $core.method({
  5287. selector: "asString",
  5288. protocol: "converting",
  5289. //>>excludeStart("ide", pragmas.excludeIdeData);
  5290. args: [],
  5291. source: "asString\x0a\x09^ self",
  5292. referencedClasses: [],
  5293. //>>excludeEnd("ide");
  5294. pragmas: [],
  5295. messageSends: []
  5296. }, function ($methodClass){ return function (){
  5297. var self=this,$self=this;
  5298. return self;
  5299. }; }),
  5300. $globals.String);
  5301. $core.addMethod(
  5302. $core.method({
  5303. selector: "asSymbol",
  5304. protocol: "converting",
  5305. //>>excludeStart("ide", pragmas.excludeIdeData);
  5306. args: [],
  5307. source: "asSymbol\x0a\x09^ self",
  5308. referencedClasses: [],
  5309. //>>excludeEnd("ide");
  5310. pragmas: [],
  5311. messageSends: []
  5312. }, function ($methodClass){ return function (){
  5313. var self=this,$self=this;
  5314. return self;
  5315. }; }),
  5316. $globals.String);
  5317. $core.addMethod(
  5318. $core.method({
  5319. selector: "asSymbolPrintOn:",
  5320. protocol: "printing",
  5321. //>>excludeStart("ide", pragmas.excludeIdeData);
  5322. args: ["aStream"],
  5323. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5324. referencedClasses: [],
  5325. //>>excludeEnd("ide");
  5326. pragmas: [],
  5327. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5328. }, function ($methodClass){ return function (aStream){
  5329. var self=this,$self=this;
  5330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5331. return $core.withContext(function($ctx1) {
  5332. //>>excludeEnd("ctx");
  5333. $recv(aStream)._nextPutAll_("#");
  5334. if($core.assert($recv($self._asString())._isSelector())){
  5335. $recv(aStream)._nextPut_(self);
  5336. } else {
  5337. $self._printOn_(aStream);
  5338. }
  5339. return self;
  5340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5341. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5342. //>>excludeEnd("ctx");
  5343. }; }),
  5344. $globals.String);
  5345. $core.addMethod(
  5346. $core.method({
  5347. selector: "asUppercase",
  5348. protocol: "converting",
  5349. //>>excludeStart("ide", pragmas.excludeIdeData);
  5350. args: [],
  5351. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5352. referencedClasses: [],
  5353. //>>excludeEnd("ide");
  5354. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5355. messageSends: []
  5356. }, function ($methodClass){ return function (){
  5357. var self=this,$self=this;
  5358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5359. return $core.withContext(function($ctx1) {
  5360. //>>excludeEnd("ctx");
  5361. return self.toUpperCase();
  5362. return self;
  5363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5364. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5365. //>>excludeEnd("ctx");
  5366. }; }),
  5367. $globals.String);
  5368. $core.addMethod(
  5369. $core.method({
  5370. selector: "asciiValue",
  5371. protocol: "accessing",
  5372. //>>excludeStart("ide", pragmas.excludeIdeData);
  5373. args: [],
  5374. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5375. referencedClasses: [],
  5376. //>>excludeEnd("ide");
  5377. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5378. messageSends: []
  5379. }, function ($methodClass){ return function (){
  5380. var self=this,$self=this;
  5381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5382. return $core.withContext(function($ctx1) {
  5383. //>>excludeEnd("ctx");
  5384. return self.charCodeAt(0);;
  5385. return self;
  5386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5387. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5388. //>>excludeEnd("ctx");
  5389. }; }),
  5390. $globals.String);
  5391. $core.addMethod(
  5392. $core.method({
  5393. selector: "at:ifAbsent:",
  5394. protocol: "accessing",
  5395. //>>excludeStart("ide", pragmas.excludeIdeData);
  5396. args: ["anIndex", "aBlock"],
  5397. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5398. referencedClasses: [],
  5399. //>>excludeEnd("ide");
  5400. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5401. messageSends: []
  5402. }, function ($methodClass){ return function (anIndex,aBlock){
  5403. var self=this,$self=this;
  5404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5405. return $core.withContext(function($ctx1) {
  5406. //>>excludeEnd("ctx");
  5407. return String(self)[anIndex - 1] || aBlock._value();
  5408. return self;
  5409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5410. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5411. //>>excludeEnd("ctx");
  5412. }; }),
  5413. $globals.String);
  5414. $core.addMethod(
  5415. $core.method({
  5416. selector: "at:ifPresent:ifAbsent:",
  5417. protocol: "accessing",
  5418. //>>excludeStart("ide", pragmas.excludeIdeData);
  5419. args: ["anIndex", "aBlock", "anotherBlock"],
  5420. 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'>",
  5421. referencedClasses: [],
  5422. //>>excludeEnd("ide");
  5423. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5424. messageSends: []
  5425. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5426. var self=this,$self=this;
  5427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5428. return $core.withContext(function($ctx1) {
  5429. //>>excludeEnd("ctx");
  5430. var result = String(self)[anIndex - 1];
  5431. return result ? aBlock._value_(result) : anotherBlock._value();
  5432. ;
  5433. return self;
  5434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5435. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5436. //>>excludeEnd("ctx");
  5437. }; }),
  5438. $globals.String);
  5439. $core.addMethod(
  5440. $core.method({
  5441. selector: "at:put:",
  5442. protocol: "accessing",
  5443. //>>excludeStart("ide", pragmas.excludeIdeData);
  5444. args: ["anIndex", "anObject"],
  5445. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5446. referencedClasses: [],
  5447. //>>excludeEnd("ide");
  5448. pragmas: [],
  5449. messageSends: ["errorReadOnly"]
  5450. }, function ($methodClass){ return function (anIndex,anObject){
  5451. var self=this,$self=this;
  5452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5453. return $core.withContext(function($ctx1) {
  5454. //>>excludeEnd("ctx");
  5455. $self._errorReadOnly();
  5456. return self;
  5457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5458. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5459. //>>excludeEnd("ctx");
  5460. }; }),
  5461. $globals.String);
  5462. $core.addMethod(
  5463. $core.method({
  5464. selector: "capitalized",
  5465. protocol: "converting",
  5466. //>>excludeStart("ide", pragmas.excludeIdeData);
  5467. args: [],
  5468. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5469. referencedClasses: [],
  5470. //>>excludeEnd("ide");
  5471. pragmas: [],
  5472. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5473. }, function ($methodClass){ return function (){
  5474. var self=this,$self=this;
  5475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5476. return $core.withContext(function($ctx1) {
  5477. //>>excludeEnd("ctx");
  5478. return $self._ifNotEmpty_((function(){
  5479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5480. return $core.withContext(function($ctx2) {
  5481. //>>excludeEnd("ctx");
  5482. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5484. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5485. //>>excludeEnd("ctx");
  5486. }));
  5487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5488. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5489. //>>excludeEnd("ctx");
  5490. }; }),
  5491. $globals.String);
  5492. $core.addMethod(
  5493. $core.method({
  5494. selector: "charCodeAt:",
  5495. protocol: "accessing",
  5496. //>>excludeStart("ide", pragmas.excludeIdeData);
  5497. args: ["anInteger"],
  5498. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5499. referencedClasses: [],
  5500. //>>excludeEnd("ide");
  5501. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5502. messageSends: []
  5503. }, function ($methodClass){ return function (anInteger){
  5504. var self=this,$self=this;
  5505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5506. return $core.withContext(function($ctx1) {
  5507. //>>excludeEnd("ctx");
  5508. return self.charCodeAt(anInteger - 1);
  5509. return self;
  5510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5511. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5512. //>>excludeEnd("ctx");
  5513. }; }),
  5514. $globals.String);
  5515. $core.addMethod(
  5516. $core.method({
  5517. selector: "copyFrom:to:",
  5518. protocol: "copying",
  5519. //>>excludeStart("ide", pragmas.excludeIdeData);
  5520. args: ["anIndex", "anotherIndex"],
  5521. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5522. referencedClasses: [],
  5523. //>>excludeEnd("ide");
  5524. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5525. messageSends: []
  5526. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5527. var self=this,$self=this;
  5528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5529. return $core.withContext(function($ctx1) {
  5530. //>>excludeEnd("ctx");
  5531. return self.substring(anIndex - 1, anotherIndex);
  5532. return self;
  5533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5534. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5535. //>>excludeEnd("ctx");
  5536. }; }),
  5537. $globals.String);
  5538. $core.addMethod(
  5539. $core.method({
  5540. selector: "copyWithFirst:",
  5541. protocol: "copying",
  5542. //>>excludeStart("ide", pragmas.excludeIdeData);
  5543. args: ["anObject"],
  5544. 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",
  5545. referencedClasses: [],
  5546. //>>excludeEnd("ide");
  5547. pragmas: [],
  5548. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5549. }, function ($methodClass){ return function (anObject){
  5550. var self=this,$self=this;
  5551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5552. return $core.withContext(function($ctx1) {
  5553. //>>excludeEnd("ctx");
  5554. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  5555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5556. return $core.withContext(function($ctx2) {
  5557. //>>excludeEnd("ctx");
  5558. return $recv($recv(anObject)._size()).__eq((1));
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5561. //>>excludeEnd("ctx");
  5562. })))){
  5563. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5565. ,$ctx1.sendIdx[","]=2
  5566. //>>excludeEnd("ctx");
  5567. ][0]).__comma(" in a String")
  5568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5569. ,$ctx1.sendIdx[","]=1
  5570. //>>excludeEnd("ctx");
  5571. ][0]);
  5572. }
  5573. return $recv(anObject).__comma(self);
  5574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5575. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5576. //>>excludeEnd("ctx");
  5577. }; }),
  5578. $globals.String);
  5579. $core.addMethod(
  5580. $core.method({
  5581. selector: "crlfSanitized",
  5582. protocol: "converting",
  5583. //>>excludeStart("ide", pragmas.excludeIdeData);
  5584. args: [],
  5585. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5586. referencedClasses: ["String"],
  5587. //>>excludeEnd("ide");
  5588. pragmas: [],
  5589. messageSends: ["join:", "lines", "lf"]
  5590. }, function ($methodClass){ return function (){
  5591. var self=this,$self=this;
  5592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5593. return $core.withContext(function($ctx1) {
  5594. //>>excludeEnd("ctx");
  5595. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5597. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5598. //>>excludeEnd("ctx");
  5599. }; }),
  5600. $globals.String);
  5601. $core.addMethod(
  5602. $core.method({
  5603. selector: "deepCopy",
  5604. protocol: "copying",
  5605. //>>excludeStart("ide", pragmas.excludeIdeData);
  5606. args: [],
  5607. source: "deepCopy\x0a\x09^ self shallowCopy",
  5608. referencedClasses: [],
  5609. //>>excludeEnd("ide");
  5610. pragmas: [],
  5611. messageSends: ["shallowCopy"]
  5612. }, function ($methodClass){ return function (){
  5613. var self=this,$self=this;
  5614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5615. return $core.withContext(function($ctx1) {
  5616. //>>excludeEnd("ctx");
  5617. return $self._shallowCopy();
  5618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5619. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5620. //>>excludeEnd("ctx");
  5621. }; }),
  5622. $globals.String);
  5623. $core.addMethod(
  5624. $core.method({
  5625. selector: "errorReadOnly",
  5626. protocol: "error handling",
  5627. //>>excludeStart("ide", pragmas.excludeIdeData);
  5628. args: [],
  5629. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5630. referencedClasses: [],
  5631. //>>excludeEnd("ide");
  5632. pragmas: [],
  5633. messageSends: ["error:"]
  5634. }, function ($methodClass){ return function (){
  5635. var self=this,$self=this;
  5636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5637. return $core.withContext(function($ctx1) {
  5638. //>>excludeEnd("ctx");
  5639. $self._error_("Object is read-only");
  5640. return self;
  5641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5642. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5643. //>>excludeEnd("ctx");
  5644. }; }),
  5645. $globals.String);
  5646. $core.addMethod(
  5647. $core.method({
  5648. selector: "escaped",
  5649. protocol: "converting",
  5650. //>>excludeStart("ide", pragmas.excludeIdeData);
  5651. args: [],
  5652. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5653. referencedClasses: [],
  5654. //>>excludeEnd("ide");
  5655. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5656. messageSends: []
  5657. }, function ($methodClass){ return function (){
  5658. var self=this,$self=this;
  5659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5660. return $core.withContext(function($ctx1) {
  5661. //>>excludeEnd("ctx");
  5662. return escape(self);
  5663. return self;
  5664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5665. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5666. //>>excludeEnd("ctx");
  5667. }; }),
  5668. $globals.String);
  5669. $core.addMethod(
  5670. $core.method({
  5671. selector: "includesSubString:",
  5672. protocol: "testing",
  5673. //>>excludeStart("ide", pragmas.excludeIdeData);
  5674. args: ["subString"],
  5675. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5676. referencedClasses: [],
  5677. //>>excludeEnd("ide");
  5678. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5679. messageSends: []
  5680. }, function ($methodClass){ return function (subString){
  5681. var self=this,$self=this;
  5682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5683. return $core.withContext(function($ctx1) {
  5684. //>>excludeEnd("ctx");
  5685. return self.indexOf(subString) != -1;
  5686. return self;
  5687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5688. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5689. //>>excludeEnd("ctx");
  5690. }; }),
  5691. $globals.String);
  5692. $core.addMethod(
  5693. $core.method({
  5694. selector: "isCapitalized",
  5695. protocol: "testing",
  5696. //>>excludeStart("ide", pragmas.excludeIdeData);
  5697. args: [],
  5698. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5699. referencedClasses: [],
  5700. //>>excludeEnd("ide");
  5701. pragmas: [],
  5702. messageSends: ["==", "asUppercase", "first"]
  5703. }, function ($methodClass){ return function (){
  5704. var self=this,$self=this;
  5705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5706. return $core.withContext(function($ctx1) {
  5707. //>>excludeEnd("ctx");
  5708. return $recv($recv([$self._first()
  5709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5710. ,$ctx1.sendIdx["first"]=1
  5711. //>>excludeEnd("ctx");
  5712. ][0])._asUppercase()).__eq_eq($self._first());
  5713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5714. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5715. //>>excludeEnd("ctx");
  5716. }; }),
  5717. $globals.String);
  5718. $core.addMethod(
  5719. $core.method({
  5720. selector: "isImmutable",
  5721. protocol: "testing",
  5722. //>>excludeStart("ide", pragmas.excludeIdeData);
  5723. args: [],
  5724. source: "isImmutable\x0a\x09^ true",
  5725. referencedClasses: [],
  5726. //>>excludeEnd("ide");
  5727. pragmas: [],
  5728. messageSends: []
  5729. }, function ($methodClass){ return function (){
  5730. var self=this,$self=this;
  5731. return true;
  5732. }; }),
  5733. $globals.String);
  5734. $core.addMethod(
  5735. $core.method({
  5736. selector: "isSelector",
  5737. protocol: "testing",
  5738. //>>excludeStart("ide", pragmas.excludeIdeData);
  5739. args: [],
  5740. 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>",
  5741. referencedClasses: [],
  5742. //>>excludeEnd("ide");
  5743. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5744. messageSends: []
  5745. }, function ($methodClass){ return function (){
  5746. var self=this,$self=this;
  5747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5748. return $core.withContext(function($ctx1) {
  5749. //>>excludeEnd("ctx");
  5750. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5751. return self;
  5752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5753. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5754. //>>excludeEnd("ctx");
  5755. }; }),
  5756. $globals.String);
  5757. $core.addMethod(
  5758. $core.method({
  5759. selector: "isString",
  5760. protocol: "testing",
  5761. //>>excludeStart("ide", pragmas.excludeIdeData);
  5762. args: [],
  5763. source: "isString\x0a\x09^ true",
  5764. referencedClasses: [],
  5765. //>>excludeEnd("ide");
  5766. pragmas: [],
  5767. messageSends: []
  5768. }, function ($methodClass){ return function (){
  5769. var self=this,$self=this;
  5770. return true;
  5771. }; }),
  5772. $globals.String);
  5773. $core.addMethod(
  5774. $core.method({
  5775. selector: "isVowel",
  5776. protocol: "testing",
  5777. //>>excludeStart("ide", pragmas.excludeIdeData);
  5778. args: [],
  5779. 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 ]",
  5780. referencedClasses: [],
  5781. //>>excludeEnd("ide");
  5782. pragmas: [],
  5783. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5784. }, function ($methodClass){ return function (){
  5785. var self=this,$self=this;
  5786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5787. return $core.withContext(function($ctx1) {
  5788. //>>excludeEnd("ctx");
  5789. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5791. return $core.withContext(function($ctx2) {
  5792. //>>excludeEnd("ctx");
  5793. return "aeiou"._includes_($self._asLowercase());
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5796. //>>excludeEnd("ctx");
  5797. }));
  5798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5799. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5800. //>>excludeEnd("ctx");
  5801. }; }),
  5802. $globals.String);
  5803. $core.addMethod(
  5804. $core.method({
  5805. selector: "join:",
  5806. protocol: "split join",
  5807. //>>excludeStart("ide", pragmas.excludeIdeData);
  5808. args: ["aCollection"],
  5809. 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 ]]",
  5810. referencedClasses: ["String"],
  5811. //>>excludeEnd("ide");
  5812. pragmas: [],
  5813. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5814. }, function ($methodClass){ return function (aCollection){
  5815. var self=this,$self=this;
  5816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5817. return $core.withContext(function($ctx1) {
  5818. //>>excludeEnd("ctx");
  5819. return $recv($globals.String)._streamContents_((function(stream){
  5820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5821. return $core.withContext(function($ctx2) {
  5822. //>>excludeEnd("ctx");
  5823. return $recv(aCollection)._do_separatedBy_((function(each){
  5824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5825. return $core.withContext(function($ctx3) {
  5826. //>>excludeEnd("ctx");
  5827. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  5828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5829. ,$ctx3.sendIdx["nextPutAll:"]=1
  5830. //>>excludeEnd("ctx");
  5831. ][0];
  5832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5833. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5834. //>>excludeEnd("ctx");
  5835. }),(function(){
  5836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5837. return $core.withContext(function($ctx3) {
  5838. //>>excludeEnd("ctx");
  5839. return $recv(stream)._nextPutAll_(self);
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5842. //>>excludeEnd("ctx");
  5843. }));
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5846. //>>excludeEnd("ctx");
  5847. }));
  5848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5849. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5850. //>>excludeEnd("ctx");
  5851. }; }),
  5852. $globals.String);
  5853. $core.addMethod(
  5854. $core.method({
  5855. selector: "lineIndicesDo:",
  5856. protocol: "split join",
  5857. //>>excludeStart("ide", pragmas.excludeIdeData);
  5858. args: ["aBlock"],
  5859. 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 ] ]]",
  5860. referencedClasses: ["String"],
  5861. //>>excludeEnd("ide");
  5862. pragmas: [],
  5863. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5864. }, function ($methodClass){ return function (aBlock){
  5865. var self=this,$self=this;
  5866. var cr,lf,start,sz,nextLF,nextCR;
  5867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5868. return $core.withContext(function($ctx1) {
  5869. //>>excludeEnd("ctx");
  5870. var $early={};
  5871. try {
  5872. start=(1);
  5873. sz=$self._size();
  5874. cr=$recv($globals.String)._cr();
  5875. nextCR=[$self._indexOf_startingAt_(cr,(1))
  5876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5877. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  5878. //>>excludeEnd("ctx");
  5879. ][0];
  5880. lf=$recv($globals.String)._lf();
  5881. nextLF=[$self._indexOf_startingAt_(lf,(1))
  5882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5883. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  5884. //>>excludeEnd("ctx");
  5885. ][0];
  5886. $recv((function(){
  5887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5888. return $core.withContext(function($ctx2) {
  5889. //>>excludeEnd("ctx");
  5890. return $recv(start).__lt_eq(sz);
  5891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5892. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5893. //>>excludeEnd("ctx");
  5894. }))._whileTrue_((function(){
  5895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5896. return $core.withContext(function($ctx2) {
  5897. //>>excludeEnd("ctx");
  5898. if($core.assert([$recv([$recv(nextLF).__eq((0))
  5899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5900. ,$ctx2.sendIdx["="]=1
  5901. //>>excludeEnd("ctx");
  5902. ][0])._and_((function(){
  5903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5904. return $core.withContext(function($ctx3) {
  5905. //>>excludeEnd("ctx");
  5906. return [$recv(nextCR).__eq((0))
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. ,$ctx3.sendIdx["="]=2
  5909. //>>excludeEnd("ctx");
  5910. ][0];
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5913. //>>excludeEnd("ctx");
  5914. }))
  5915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5916. ,$ctx2.sendIdx["and:"]=1
  5917. //>>excludeEnd("ctx");
  5918. ][0])){
  5919. [$recv(aBlock)._value_value_value_(start,sz,sz)
  5920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5921. ,$ctx2.sendIdx["value:value:value:"]=1
  5922. //>>excludeEnd("ctx");
  5923. ][0];
  5924. throw $early=[self];
  5925. }
  5926. if($core.assert($recv([$recv(nextCR).__eq((0))
  5927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5928. ,$ctx2.sendIdx["="]=3
  5929. //>>excludeEnd("ctx");
  5930. ][0])._or_((function(){
  5931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5932. return $core.withContext(function($ctx3) {
  5933. //>>excludeEnd("ctx");
  5934. return $recv([(0).__lt(nextLF)
  5935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5936. ,$ctx3.sendIdx["<"]=1
  5937. //>>excludeEnd("ctx");
  5938. ][0])._and_((function(){
  5939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5940. return $core.withContext(function($ctx4) {
  5941. //>>excludeEnd("ctx");
  5942. return $recv(nextLF).__lt(nextCR);
  5943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5944. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5945. //>>excludeEnd("ctx");
  5946. }));
  5947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5948. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5949. //>>excludeEnd("ctx");
  5950. })))){
  5951. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  5952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5953. ,$ctx2.sendIdx["-"]=1
  5954. //>>excludeEnd("ctx");
  5955. ][0],nextLF)
  5956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5957. ,$ctx2.sendIdx["value:value:value:"]=2
  5958. //>>excludeEnd("ctx");
  5959. ][0];
  5960. start=[(1).__plus(nextLF)
  5961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5962. ,$ctx2.sendIdx["+"]=1
  5963. //>>excludeEnd("ctx");
  5964. ][0];
  5965. nextLF=[$self._indexOf_startingAt_(lf,start)
  5966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5967. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  5968. //>>excludeEnd("ctx");
  5969. ][0];
  5970. return nextLF;
  5971. } else {
  5972. if($core.assert($recv([(1).__plus(nextCR)
  5973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5974. ,$ctx2.sendIdx["+"]=2
  5975. //>>excludeEnd("ctx");
  5976. ][0]).__eq(nextLF))){
  5977. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  5978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5979. ,$ctx2.sendIdx["-"]=2
  5980. //>>excludeEnd("ctx");
  5981. ][0],nextLF)
  5982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5983. ,$ctx2.sendIdx["value:value:value:"]=3
  5984. //>>excludeEnd("ctx");
  5985. ][0];
  5986. start=[(1).__plus(nextLF)
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. ,$ctx2.sendIdx["+"]=3
  5989. //>>excludeEnd("ctx");
  5990. ][0];
  5991. nextCR=[$self._indexOf_startingAt_(cr,start)
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  5994. //>>excludeEnd("ctx");
  5995. ][0];
  5996. nextLF=[$self._indexOf_startingAt_(lf,start)
  5997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5998. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  5999. //>>excludeEnd("ctx");
  6000. ][0];
  6001. return nextLF;
  6002. } else {
  6003. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6004. start=(1).__plus(nextCR);
  6005. nextCR=$self._indexOf_startingAt_(cr,start);
  6006. return nextCR;
  6007. }
  6008. }
  6009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6011. //>>excludeEnd("ctx");
  6012. }));
  6013. return self;
  6014. }
  6015. catch(e) {if(e===$early)return e[0]; throw e}
  6016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6017. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6018. //>>excludeEnd("ctx");
  6019. }; }),
  6020. $globals.String);
  6021. $core.addMethod(
  6022. $core.method({
  6023. selector: "lineNumber:",
  6024. protocol: "split join",
  6025. //>>excludeStart("ide", pragmas.excludeIdeData);
  6026. args: ["anIndex"],
  6027. 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",
  6028. referencedClasses: [],
  6029. //>>excludeEnd("ide");
  6030. pragmas: [],
  6031. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6032. }, function ($methodClass){ return function (anIndex){
  6033. var self=this,$self=this;
  6034. var lineCount;
  6035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6036. return $core.withContext(function($ctx1) {
  6037. //>>excludeEnd("ctx");
  6038. var $early={};
  6039. try {
  6040. lineCount=(0);
  6041. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. return $core.withContext(function($ctx2) {
  6044. //>>excludeEnd("ctx");
  6045. lineCount=$recv(lineCount).__plus((1));
  6046. if($core.assert($recv(lineCount).__eq(anIndex))){
  6047. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6048. }
  6049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6050. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6051. //>>excludeEnd("ctx");
  6052. }));
  6053. return nil;
  6054. }
  6055. catch(e) {if(e===$early)return e[0]; throw e}
  6056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6057. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6058. //>>excludeEnd("ctx");
  6059. }; }),
  6060. $globals.String);
  6061. $core.addMethod(
  6062. $core.method({
  6063. selector: "lines",
  6064. protocol: "split join",
  6065. //>>excludeStart("ide", pragmas.excludeIdeData);
  6066. args: [],
  6067. 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'>",
  6068. referencedClasses: [],
  6069. //>>excludeEnd("ide");
  6070. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6071. messageSends: []
  6072. }, function ($methodClass){ return function (){
  6073. var self=this,$self=this;
  6074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6075. return $core.withContext(function($ctx1) {
  6076. //>>excludeEnd("ctx");
  6077. var result = self.split(/\r\n|\r|\n/);
  6078. if (!result[result.length-1]) result.pop();
  6079. return result;;
  6080. return self;
  6081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6082. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6083. //>>excludeEnd("ctx");
  6084. }; }),
  6085. $globals.String);
  6086. $core.addMethod(
  6087. $core.method({
  6088. selector: "linesDo:",
  6089. protocol: "split join",
  6090. //>>excludeStart("ide", pragmas.excludeIdeData);
  6091. args: ["aBlock"],
  6092. 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",
  6093. referencedClasses: [],
  6094. //>>excludeEnd("ide");
  6095. pragmas: [],
  6096. messageSends: ["do:", "lines"]
  6097. }, function ($methodClass){ return function (aBlock){
  6098. var self=this,$self=this;
  6099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6100. return $core.withContext(function($ctx1) {
  6101. //>>excludeEnd("ctx");
  6102. $recv($self._lines())._do_(aBlock);
  6103. return self;
  6104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6105. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6106. //>>excludeEnd("ctx");
  6107. }; }),
  6108. $globals.String);
  6109. $core.addMethod(
  6110. $core.method({
  6111. selector: "match:",
  6112. protocol: "regular expressions",
  6113. //>>excludeStart("ide", pragmas.excludeIdeData);
  6114. args: ["aRegexp"],
  6115. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6116. referencedClasses: [],
  6117. //>>excludeEnd("ide");
  6118. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6119. messageSends: []
  6120. }, function ($methodClass){ return function (aRegexp){
  6121. var self=this,$self=this;
  6122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6123. return $core.withContext(function($ctx1) {
  6124. //>>excludeEnd("ctx");
  6125. return self.search(aRegexp) != -1;
  6126. return self;
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6129. //>>excludeEnd("ctx");
  6130. }; }),
  6131. $globals.String);
  6132. $core.addMethod(
  6133. $core.method({
  6134. selector: "matchesOf:",
  6135. protocol: "regular expressions",
  6136. //>>excludeStart("ide", pragmas.excludeIdeData);
  6137. args: ["aRegularExpression"],
  6138. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6139. referencedClasses: [],
  6140. //>>excludeEnd("ide");
  6141. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6142. messageSends: []
  6143. }, function ($methodClass){ return function (aRegularExpression){
  6144. var self=this,$self=this;
  6145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6146. return $core.withContext(function($ctx1) {
  6147. //>>excludeEnd("ctx");
  6148. return self.match(aRegularExpression);
  6149. return self;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6152. //>>excludeEnd("ctx");
  6153. }; }),
  6154. $globals.String);
  6155. $core.addMethod(
  6156. $core.method({
  6157. selector: "printNl",
  6158. protocol: "printing",
  6159. //>>excludeStart("ide", pragmas.excludeIdeData);
  6160. args: [],
  6161. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6162. referencedClasses: [],
  6163. //>>excludeEnd("ide");
  6164. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6165. messageSends: []
  6166. }, function ($methodClass){ return function (){
  6167. var self=this,$self=this;
  6168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6169. return $core.withContext(function($ctx1) {
  6170. //>>excludeEnd("ctx");
  6171. console.log(self);
  6172. return self;
  6173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6174. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6175. //>>excludeEnd("ctx");
  6176. }; }),
  6177. $globals.String);
  6178. $core.addMethod(
  6179. $core.method({
  6180. selector: "printOn:",
  6181. protocol: "printing",
  6182. //>>excludeStart("ide", pragmas.excludeIdeData);
  6183. args: ["aStream"],
  6184. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6185. referencedClasses: [],
  6186. //>>excludeEnd("ide");
  6187. pragmas: [],
  6188. messageSends: ["nextPutAll:", "replace:with:"]
  6189. }, function ($methodClass){ return function (aStream){
  6190. var self=this,$self=this;
  6191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6192. return $core.withContext(function($ctx1) {
  6193. //>>excludeEnd("ctx");
  6194. [$recv(aStream)._nextPutAll_("'")
  6195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6196. ,$ctx1.sendIdx["nextPutAll:"]=1
  6197. //>>excludeEnd("ctx");
  6198. ][0];
  6199. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6201. ,$ctx1.sendIdx["nextPutAll:"]=2
  6202. //>>excludeEnd("ctx");
  6203. ][0];
  6204. $recv(aStream)._nextPutAll_("'");
  6205. return self;
  6206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6207. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6208. //>>excludeEnd("ctx");
  6209. }; }),
  6210. $globals.String);
  6211. $core.addMethod(
  6212. $core.method({
  6213. selector: "putOn:",
  6214. protocol: "streaming",
  6215. //>>excludeStart("ide", pragmas.excludeIdeData);
  6216. args: ["aStream"],
  6217. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6218. referencedClasses: [],
  6219. //>>excludeEnd("ide");
  6220. pragmas: [],
  6221. messageSends: ["nextPutString:"]
  6222. }, function ($methodClass){ return function (aStream){
  6223. var self=this,$self=this;
  6224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6225. return $core.withContext(function($ctx1) {
  6226. //>>excludeEnd("ctx");
  6227. $recv(aStream)._nextPutString_(self);
  6228. return self;
  6229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6230. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6231. //>>excludeEnd("ctx");
  6232. }; }),
  6233. $globals.String);
  6234. $core.addMethod(
  6235. $core.method({
  6236. selector: "remove:",
  6237. protocol: "adding/removing",
  6238. //>>excludeStart("ide", pragmas.excludeIdeData);
  6239. args: ["anObject"],
  6240. source: "remove: anObject\x0a\x09self errorReadOnly",
  6241. referencedClasses: [],
  6242. //>>excludeEnd("ide");
  6243. pragmas: [],
  6244. messageSends: ["errorReadOnly"]
  6245. }, function ($methodClass){ return function (anObject){
  6246. var self=this,$self=this;
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. return $core.withContext(function($ctx1) {
  6249. //>>excludeEnd("ctx");
  6250. $self._errorReadOnly();
  6251. return self;
  6252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6253. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6254. //>>excludeEnd("ctx");
  6255. }; }),
  6256. $globals.String);
  6257. $core.addMethod(
  6258. $core.method({
  6259. selector: "remove:ifAbsent:",
  6260. protocol: "adding/removing",
  6261. //>>excludeStart("ide", pragmas.excludeIdeData);
  6262. args: ["anObject", "aBlock"],
  6263. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6264. referencedClasses: [],
  6265. //>>excludeEnd("ide");
  6266. pragmas: [],
  6267. messageSends: ["errorReadOnly"]
  6268. }, function ($methodClass){ return function (anObject,aBlock){
  6269. var self=this,$self=this;
  6270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6271. return $core.withContext(function($ctx1) {
  6272. //>>excludeEnd("ctx");
  6273. $self._errorReadOnly();
  6274. return self;
  6275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6276. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6277. //>>excludeEnd("ctx");
  6278. }; }),
  6279. $globals.String);
  6280. $core.addMethod(
  6281. $core.method({
  6282. selector: "replace:with:",
  6283. protocol: "regular expressions",
  6284. //>>excludeStart("ide", pragmas.excludeIdeData);
  6285. args: ["aString", "anotherString"],
  6286. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6287. referencedClasses: ["RegularExpression"],
  6288. //>>excludeEnd("ide");
  6289. pragmas: [],
  6290. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6291. }, function ($methodClass){ return function (aString,anotherString){
  6292. var self=this,$self=this;
  6293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6294. return $core.withContext(function($ctx1) {
  6295. //>>excludeEnd("ctx");
  6296. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6298. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6299. //>>excludeEnd("ctx");
  6300. }; }),
  6301. $globals.String);
  6302. $core.addMethod(
  6303. $core.method({
  6304. selector: "replaceRegexp:with:",
  6305. protocol: "regular expressions",
  6306. //>>excludeStart("ide", pragmas.excludeIdeData);
  6307. args: ["aRegexp", "aString"],
  6308. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6309. referencedClasses: [],
  6310. //>>excludeEnd("ide");
  6311. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6312. messageSends: []
  6313. }, function ($methodClass){ return function (aRegexp,aString){
  6314. var self=this,$self=this;
  6315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6316. return $core.withContext(function($ctx1) {
  6317. //>>excludeEnd("ctx");
  6318. return self.replace(aRegexp, aString);
  6319. return self;
  6320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6321. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6322. //>>excludeEnd("ctx");
  6323. }; }),
  6324. $globals.String);
  6325. $core.addMethod(
  6326. $core.method({
  6327. selector: "reversed",
  6328. protocol: "converting",
  6329. //>>excludeStart("ide", pragmas.excludeIdeData);
  6330. args: [],
  6331. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6332. referencedClasses: [],
  6333. //>>excludeEnd("ide");
  6334. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6335. messageSends: []
  6336. }, function ($methodClass){ return function (){
  6337. var self=this,$self=this;
  6338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6339. return $core.withContext(function($ctx1) {
  6340. //>>excludeEnd("ctx");
  6341. return self.split("").reverse().join("");
  6342. return self;
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6345. //>>excludeEnd("ctx");
  6346. }; }),
  6347. $globals.String);
  6348. $core.addMethod(
  6349. $core.method({
  6350. selector: "shallowCopy",
  6351. protocol: "copying",
  6352. //>>excludeStart("ide", pragmas.excludeIdeData);
  6353. args: [],
  6354. source: "shallowCopy\x0a\x09^ self",
  6355. referencedClasses: [],
  6356. //>>excludeEnd("ide");
  6357. pragmas: [],
  6358. messageSends: []
  6359. }, function ($methodClass){ return function (){
  6360. var self=this,$self=this;
  6361. return self;
  6362. }; }),
  6363. $globals.String);
  6364. $core.addMethod(
  6365. $core.method({
  6366. selector: "subStrings:",
  6367. protocol: "split join",
  6368. //>>excludeStart("ide", pragmas.excludeIdeData);
  6369. args: ["aString"],
  6370. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6371. referencedClasses: [],
  6372. //>>excludeEnd("ide");
  6373. pragmas: [],
  6374. messageSends: ["tokenize:"]
  6375. }, function ($methodClass){ return function (aString){
  6376. var self=this,$self=this;
  6377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6378. return $core.withContext(function($ctx1) {
  6379. //>>excludeEnd("ctx");
  6380. return $self._tokenize_(aString);
  6381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6382. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6383. //>>excludeEnd("ctx");
  6384. }; }),
  6385. $globals.String);
  6386. $core.addMethod(
  6387. $core.method({
  6388. selector: "symbolPrintString",
  6389. protocol: "printing",
  6390. //>>excludeStart("ide", pragmas.excludeIdeData);
  6391. args: [],
  6392. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6393. referencedClasses: ["String"],
  6394. //>>excludeEnd("ide");
  6395. pragmas: [],
  6396. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6397. }, function ($methodClass){ return function (){
  6398. var self=this,$self=this;
  6399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6400. return $core.withContext(function($ctx1) {
  6401. //>>excludeEnd("ctx");
  6402. return $recv($globals.String)._streamContents_((function(str){
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. return $core.withContext(function($ctx2) {
  6405. //>>excludeEnd("ctx");
  6406. return $self._asSymbolPrintOn_(str);
  6407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6408. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6409. //>>excludeEnd("ctx");
  6410. }));
  6411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6412. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6413. //>>excludeEnd("ctx");
  6414. }; }),
  6415. $globals.String);
  6416. $core.addMethod(
  6417. $core.method({
  6418. selector: "tokenize:",
  6419. protocol: "split join",
  6420. //>>excludeStart("ide", pragmas.excludeIdeData);
  6421. args: ["aString"],
  6422. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6423. referencedClasses: [],
  6424. //>>excludeEnd("ide");
  6425. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6426. messageSends: []
  6427. }, function ($methodClass){ return function (aString){
  6428. var self=this,$self=this;
  6429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6430. return $core.withContext(function($ctx1) {
  6431. //>>excludeEnd("ctx");
  6432. return self.split(aString);
  6433. return self;
  6434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6435. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6436. //>>excludeEnd("ctx");
  6437. }; }),
  6438. $globals.String);
  6439. $core.addMethod(
  6440. $core.method({
  6441. selector: "trimBoth",
  6442. protocol: "regular expressions",
  6443. //>>excludeStart("ide", pragmas.excludeIdeData);
  6444. args: [],
  6445. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6446. referencedClasses: [],
  6447. //>>excludeEnd("ide");
  6448. pragmas: [],
  6449. messageSends: ["trimBoth:"]
  6450. }, function ($methodClass){ return function (){
  6451. var self=this,$self=this;
  6452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6453. return $core.withContext(function($ctx1) {
  6454. //>>excludeEnd("ctx");
  6455. return $self._trimBoth_("\x5cs");
  6456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6457. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6458. //>>excludeEnd("ctx");
  6459. }; }),
  6460. $globals.String);
  6461. $core.addMethod(
  6462. $core.method({
  6463. selector: "trimBoth:",
  6464. protocol: "regular expressions",
  6465. //>>excludeStart("ide", pragmas.excludeIdeData);
  6466. args: ["separators"],
  6467. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6468. referencedClasses: [],
  6469. //>>excludeEnd("ide");
  6470. pragmas: [],
  6471. messageSends: ["trimRight:", "trimLeft:"]
  6472. }, function ($methodClass){ return function (separators){
  6473. var self=this,$self=this;
  6474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6475. return $core.withContext(function($ctx1) {
  6476. //>>excludeEnd("ctx");
  6477. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6479. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6480. //>>excludeEnd("ctx");
  6481. }; }),
  6482. $globals.String);
  6483. $core.addMethod(
  6484. $core.method({
  6485. selector: "trimLeft",
  6486. protocol: "regular expressions",
  6487. //>>excludeStart("ide", pragmas.excludeIdeData);
  6488. args: [],
  6489. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6490. referencedClasses: [],
  6491. //>>excludeEnd("ide");
  6492. pragmas: [],
  6493. messageSends: ["trimLeft:"]
  6494. }, function ($methodClass){ return function (){
  6495. var self=this,$self=this;
  6496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6497. return $core.withContext(function($ctx1) {
  6498. //>>excludeEnd("ctx");
  6499. return $self._trimLeft_("\x5cs");
  6500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6501. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6502. //>>excludeEnd("ctx");
  6503. }; }),
  6504. $globals.String);
  6505. $core.addMethod(
  6506. $core.method({
  6507. selector: "trimLeft:",
  6508. protocol: "regular expressions",
  6509. //>>excludeStart("ide", pragmas.excludeIdeData);
  6510. args: ["separators"],
  6511. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6512. referencedClasses: ["RegularExpression"],
  6513. //>>excludeEnd("ide");
  6514. pragmas: [],
  6515. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6516. }, function ($methodClass){ return function (separators){
  6517. var self=this,$self=this;
  6518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6519. return $core.withContext(function($ctx1) {
  6520. //>>excludeEnd("ctx");
  6521. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6523. ,$ctx1.sendIdx[","]=1
  6524. //>>excludeEnd("ctx");
  6525. ][0],"g"),"");
  6526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6527. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6528. //>>excludeEnd("ctx");
  6529. }; }),
  6530. $globals.String);
  6531. $core.addMethod(
  6532. $core.method({
  6533. selector: "trimRight",
  6534. protocol: "regular expressions",
  6535. //>>excludeStart("ide", pragmas.excludeIdeData);
  6536. args: [],
  6537. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6538. referencedClasses: [],
  6539. //>>excludeEnd("ide");
  6540. pragmas: [],
  6541. messageSends: ["trimRight:"]
  6542. }, function ($methodClass){ return function (){
  6543. var self=this,$self=this;
  6544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6545. return $core.withContext(function($ctx1) {
  6546. //>>excludeEnd("ctx");
  6547. return $self._trimRight_("\x5cs");
  6548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6549. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6550. //>>excludeEnd("ctx");
  6551. }; }),
  6552. $globals.String);
  6553. $core.addMethod(
  6554. $core.method({
  6555. selector: "trimRight:",
  6556. protocol: "regular expressions",
  6557. //>>excludeStart("ide", pragmas.excludeIdeData);
  6558. args: ["separators"],
  6559. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6560. referencedClasses: ["RegularExpression"],
  6561. //>>excludeEnd("ide");
  6562. pragmas: [],
  6563. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6564. }, function ($methodClass){ return function (separators){
  6565. var self=this,$self=this;
  6566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6567. return $core.withContext(function($ctx1) {
  6568. //>>excludeEnd("ctx");
  6569. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6571. ,$ctx1.sendIdx[","]=1
  6572. //>>excludeEnd("ctx");
  6573. ][0],"g"),"");
  6574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6575. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6576. //>>excludeEnd("ctx");
  6577. }; }),
  6578. $globals.String);
  6579. $core.addMethod(
  6580. $core.method({
  6581. selector: "unescaped",
  6582. protocol: "converting",
  6583. //>>excludeStart("ide", pragmas.excludeIdeData);
  6584. args: [],
  6585. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6586. referencedClasses: [],
  6587. //>>excludeEnd("ide");
  6588. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6589. messageSends: []
  6590. }, function ($methodClass){ return function (){
  6591. var self=this,$self=this;
  6592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6593. return $core.withContext(function($ctx1) {
  6594. //>>excludeEnd("ctx");
  6595. return unescape(self);
  6596. return self;
  6597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6598. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6599. //>>excludeEnd("ctx");
  6600. }; }),
  6601. $globals.String);
  6602. $core.addMethod(
  6603. $core.method({
  6604. selector: "uriComponentDecoded",
  6605. protocol: "converting",
  6606. //>>excludeStart("ide", pragmas.excludeIdeData);
  6607. args: [],
  6608. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6609. referencedClasses: [],
  6610. //>>excludeEnd("ide");
  6611. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6612. messageSends: []
  6613. }, function ($methodClass){ return function (){
  6614. var self=this,$self=this;
  6615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6616. return $core.withContext(function($ctx1) {
  6617. //>>excludeEnd("ctx");
  6618. return decodeURIComponent(self);
  6619. return self;
  6620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6621. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6622. //>>excludeEnd("ctx");
  6623. }; }),
  6624. $globals.String);
  6625. $core.addMethod(
  6626. $core.method({
  6627. selector: "uriComponentEncoded",
  6628. protocol: "converting",
  6629. //>>excludeStart("ide", pragmas.excludeIdeData);
  6630. args: [],
  6631. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6632. referencedClasses: [],
  6633. //>>excludeEnd("ide");
  6634. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6635. messageSends: []
  6636. }, function ($methodClass){ return function (){
  6637. var self=this,$self=this;
  6638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6639. return $core.withContext(function($ctx1) {
  6640. //>>excludeEnd("ctx");
  6641. return encodeURIComponent(self);
  6642. return self;
  6643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6644. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6645. //>>excludeEnd("ctx");
  6646. }; }),
  6647. $globals.String);
  6648. $core.addMethod(
  6649. $core.method({
  6650. selector: "uriDecoded",
  6651. protocol: "converting",
  6652. //>>excludeStart("ide", pragmas.excludeIdeData);
  6653. args: [],
  6654. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6655. referencedClasses: [],
  6656. //>>excludeEnd("ide");
  6657. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6658. messageSends: []
  6659. }, function ($methodClass){ return function (){
  6660. var self=this,$self=this;
  6661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6662. return $core.withContext(function($ctx1) {
  6663. //>>excludeEnd("ctx");
  6664. return decodeURI(self);
  6665. return self;
  6666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6667. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6668. //>>excludeEnd("ctx");
  6669. }; }),
  6670. $globals.String);
  6671. $core.addMethod(
  6672. $core.method({
  6673. selector: "uriEncoded",
  6674. protocol: "converting",
  6675. //>>excludeStart("ide", pragmas.excludeIdeData);
  6676. args: [],
  6677. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6678. referencedClasses: [],
  6679. //>>excludeEnd("ide");
  6680. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6681. messageSends: []
  6682. }, function ($methodClass){ return function (){
  6683. var self=this,$self=this;
  6684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6685. return $core.withContext(function($ctx1) {
  6686. //>>excludeEnd("ctx");
  6687. return encodeURI(self);
  6688. return self;
  6689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6690. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6691. //>>excludeEnd("ctx");
  6692. }; }),
  6693. $globals.String);
  6694. $core.addMethod(
  6695. $core.method({
  6696. selector: "value:",
  6697. protocol: "evaluating",
  6698. //>>excludeStart("ide", pragmas.excludeIdeData);
  6699. args: ["anObject"],
  6700. source: "value: anObject \x0a\x09^ anObject perform: self",
  6701. referencedClasses: [],
  6702. //>>excludeEnd("ide");
  6703. pragmas: [],
  6704. messageSends: ["perform:"]
  6705. }, function ($methodClass){ return function (anObject){
  6706. var self=this,$self=this;
  6707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6708. return $core.withContext(function($ctx1) {
  6709. //>>excludeEnd("ctx");
  6710. return $recv(anObject)._perform_(self);
  6711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6712. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6713. //>>excludeEnd("ctx");
  6714. }; }),
  6715. $globals.String);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "cr",
  6719. protocol: "accessing",
  6720. //>>excludeStart("ide", pragmas.excludeIdeData);
  6721. args: [],
  6722. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6723. referencedClasses: [],
  6724. //>>excludeEnd("ide");
  6725. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6726. messageSends: []
  6727. }, function ($methodClass){ return function (){
  6728. var self=this,$self=this;
  6729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6730. return $core.withContext(function($ctx1) {
  6731. //>>excludeEnd("ctx");
  6732. return "\r";
  6733. return self;
  6734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6735. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6736. //>>excludeEnd("ctx");
  6737. }; }),
  6738. $globals.String.a$cls);
  6739. $core.addMethod(
  6740. $core.method({
  6741. selector: "crlf",
  6742. protocol: "accessing",
  6743. //>>excludeStart("ide", pragmas.excludeIdeData);
  6744. args: [],
  6745. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6746. referencedClasses: [],
  6747. //>>excludeEnd("ide");
  6748. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6749. messageSends: []
  6750. }, function ($methodClass){ return function (){
  6751. var self=this,$self=this;
  6752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6753. return $core.withContext(function($ctx1) {
  6754. //>>excludeEnd("ctx");
  6755. return "\r\n";
  6756. return self;
  6757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6758. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6759. //>>excludeEnd("ctx");
  6760. }; }),
  6761. $globals.String.a$cls);
  6762. $core.addMethod(
  6763. $core.method({
  6764. selector: "esc",
  6765. protocol: "accessing",
  6766. //>>excludeStart("ide", pragmas.excludeIdeData);
  6767. args: [],
  6768. source: "esc\x0a\x09^ self fromCharCode: 27",
  6769. referencedClasses: [],
  6770. //>>excludeEnd("ide");
  6771. pragmas: [],
  6772. messageSends: ["fromCharCode:"]
  6773. }, function ($methodClass){ return function (){
  6774. var self=this,$self=this;
  6775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6776. return $core.withContext(function($ctx1) {
  6777. //>>excludeEnd("ctx");
  6778. return $self._fromCharCode_((27));
  6779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6780. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6781. //>>excludeEnd("ctx");
  6782. }; }),
  6783. $globals.String.a$cls);
  6784. $core.addMethod(
  6785. $core.method({
  6786. selector: "fromCharCode:",
  6787. protocol: "instance creation",
  6788. //>>excludeStart("ide", pragmas.excludeIdeData);
  6789. args: ["anInteger"],
  6790. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6791. referencedClasses: [],
  6792. //>>excludeEnd("ide");
  6793. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6794. messageSends: []
  6795. }, function ($methodClass){ return function (anInteger){
  6796. var self=this,$self=this;
  6797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6798. return $core.withContext(function($ctx1) {
  6799. //>>excludeEnd("ctx");
  6800. return String.fromCharCode(anInteger);
  6801. return self;
  6802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6803. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6804. //>>excludeEnd("ctx");
  6805. }; }),
  6806. $globals.String.a$cls);
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "fromString:",
  6810. protocol: "instance creation",
  6811. //>>excludeStart("ide", pragmas.excludeIdeData);
  6812. args: ["aString"],
  6813. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6814. referencedClasses: [],
  6815. //>>excludeEnd("ide");
  6816. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6817. messageSends: []
  6818. }, function ($methodClass){ return function (aString){
  6819. var self=this,$self=this;
  6820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6821. return $core.withContext(function($ctx1) {
  6822. //>>excludeEnd("ctx");
  6823. return String(aString);
  6824. return self;
  6825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6826. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6827. //>>excludeEnd("ctx");
  6828. }; }),
  6829. $globals.String.a$cls);
  6830. $core.addMethod(
  6831. $core.method({
  6832. selector: "lf",
  6833. protocol: "accessing",
  6834. //>>excludeStart("ide", pragmas.excludeIdeData);
  6835. args: [],
  6836. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6837. referencedClasses: [],
  6838. //>>excludeEnd("ide");
  6839. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6840. messageSends: []
  6841. }, function ($methodClass){ return function (){
  6842. var self=this,$self=this;
  6843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6844. return $core.withContext(function($ctx1) {
  6845. //>>excludeEnd("ctx");
  6846. return "\n";
  6847. return self;
  6848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6849. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6850. //>>excludeEnd("ctx");
  6851. }; }),
  6852. $globals.String.a$cls);
  6853. $core.addMethod(
  6854. $core.method({
  6855. selector: "random",
  6856. protocol: "random",
  6857. //>>excludeStart("ide", pragmas.excludeIdeData);
  6858. args: [],
  6859. 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);'>",
  6860. referencedClasses: [],
  6861. //>>excludeEnd("ide");
  6862. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6863. messageSends: []
  6864. }, function ($methodClass){ return function (){
  6865. var self=this,$self=this;
  6866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6867. return $core.withContext(function($ctx1) {
  6868. //>>excludeEnd("ctx");
  6869. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6870. return self;
  6871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6872. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6873. //>>excludeEnd("ctx");
  6874. }; }),
  6875. $globals.String.a$cls);
  6876. $core.addMethod(
  6877. $core.method({
  6878. selector: "randomNotIn:",
  6879. protocol: "random",
  6880. //>>excludeStart("ide", pragmas.excludeIdeData);
  6881. args: ["aString"],
  6882. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6883. referencedClasses: [],
  6884. //>>excludeEnd("ide");
  6885. pragmas: [],
  6886. messageSends: ["whileTrue", "random", "includesSubString:"]
  6887. }, function ($methodClass){ return function (aString){
  6888. var self=this,$self=this;
  6889. var result;
  6890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6891. return $core.withContext(function($ctx1) {
  6892. //>>excludeEnd("ctx");
  6893. $recv((function(){
  6894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6895. return $core.withContext(function($ctx2) {
  6896. //>>excludeEnd("ctx");
  6897. result=$self._random();
  6898. return $recv(aString)._includesSubString_(result);
  6899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6901. //>>excludeEnd("ctx");
  6902. }))._whileTrue();
  6903. return result;
  6904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6905. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6906. //>>excludeEnd("ctx");
  6907. }; }),
  6908. $globals.String.a$cls);
  6909. $core.addMethod(
  6910. $core.method({
  6911. selector: "space",
  6912. protocol: "accessing",
  6913. //>>excludeStart("ide", pragmas.excludeIdeData);
  6914. args: [],
  6915. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6916. referencedClasses: [],
  6917. //>>excludeEnd("ide");
  6918. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6919. messageSends: []
  6920. }, function ($methodClass){ return function (){
  6921. var self=this,$self=this;
  6922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6923. return $core.withContext(function($ctx1) {
  6924. //>>excludeEnd("ctx");
  6925. return " ";
  6926. return self;
  6927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6928. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6929. //>>excludeEnd("ctx");
  6930. }; }),
  6931. $globals.String.a$cls);
  6932. $core.addMethod(
  6933. $core.method({
  6934. selector: "streamClass",
  6935. protocol: "accessing",
  6936. //>>excludeStart("ide", pragmas.excludeIdeData);
  6937. args: [],
  6938. source: "streamClass\x0a\x09\x09^ StringStream",
  6939. referencedClasses: ["StringStream"],
  6940. //>>excludeEnd("ide");
  6941. pragmas: [],
  6942. messageSends: []
  6943. }, function ($methodClass){ return function (){
  6944. var self=this,$self=this;
  6945. return $globals.StringStream;
  6946. }; }),
  6947. $globals.String.a$cls);
  6948. $core.addMethod(
  6949. $core.method({
  6950. selector: "tab",
  6951. protocol: "accessing",
  6952. //>>excludeStart("ide", pragmas.excludeIdeData);
  6953. args: [],
  6954. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6955. referencedClasses: [],
  6956. //>>excludeEnd("ide");
  6957. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6958. messageSends: []
  6959. }, function ($methodClass){ return function (){
  6960. var self=this,$self=this;
  6961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6962. return $core.withContext(function($ctx1) {
  6963. //>>excludeEnd("ctx");
  6964. return "\t";
  6965. return self;
  6966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6967. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  6968. //>>excludeEnd("ctx");
  6969. }; }),
  6970. $globals.String.a$cls);
  6971. $core.addMethod(
  6972. $core.method({
  6973. selector: "value:",
  6974. protocol: "instance creation",
  6975. //>>excludeStart("ide", pragmas.excludeIdeData);
  6976. args: ["aUTFCharCode"],
  6977. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6978. referencedClasses: [],
  6979. //>>excludeEnd("ide");
  6980. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  6981. messageSends: []
  6982. }, function ($methodClass){ return function (aUTFCharCode){
  6983. var self=this,$self=this;
  6984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6985. return $core.withContext(function($ctx1) {
  6986. //>>excludeEnd("ctx");
  6987. return String.fromCharCode(aUTFCharCode);;
  6988. return self;
  6989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6990. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  6991. //>>excludeEnd("ctx");
  6992. }; }),
  6993. $globals.String.a$cls);
  6994. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6995. //>>excludeStart("ide", pragmas.excludeIdeData);
  6996. $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`.";
  6997. //>>excludeEnd("ide");
  6998. $core.addMethod(
  6999. $core.method({
  7000. selector: "=",
  7001. protocol: "comparing",
  7002. //>>excludeStart("ide", pragmas.excludeIdeData);
  7003. args: ["aCollection"],
  7004. 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",
  7005. referencedClasses: [],
  7006. //>>excludeEnd("ide");
  7007. pragmas: [],
  7008. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7009. }, function ($methodClass){ return function (aCollection){
  7010. var self=this,$self=this;
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. return $core.withContext(function($ctx1) {
  7013. //>>excludeEnd("ctx");
  7014. var $early={};
  7015. try {
  7016. if(!$core.assert([$recv([$self._class()
  7017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7018. ,$ctx1.sendIdx["class"]=1
  7019. //>>excludeEnd("ctx");
  7020. ][0]).__eq($recv(aCollection)._class())
  7021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7022. ,$ctx1.sendIdx["="]=1
  7023. //>>excludeEnd("ctx");
  7024. ][0])){
  7025. return false;
  7026. }
  7027. if(!$core.assert($recv([$self._size()
  7028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7029. ,$ctx1.sendIdx["size"]=1
  7030. //>>excludeEnd("ctx");
  7031. ][0]).__eq($recv(aCollection)._size()))){
  7032. return false;
  7033. }
  7034. $self._do_((function(each){
  7035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7036. return $core.withContext(function($ctx2) {
  7037. //>>excludeEnd("ctx");
  7038. if(!$core.assert($recv(aCollection)._includes_(each))){
  7039. throw $early=[false];
  7040. }
  7041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7043. //>>excludeEnd("ctx");
  7044. }));
  7045. return true;
  7046. }
  7047. catch(e) {if(e===$early)return e[0]; throw e}
  7048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7049. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7050. //>>excludeEnd("ctx");
  7051. }; }),
  7052. $globals.Set);
  7053. $core.addMethod(
  7054. $core.method({
  7055. selector: "add:",
  7056. protocol: "adding/removing",
  7057. //>>excludeStart("ide", pragmas.excludeIdeData);
  7058. args: ["anObject"],
  7059. 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 ]",
  7060. referencedClasses: [],
  7061. //>>excludeEnd("ide");
  7062. pragmas: [],
  7063. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7064. }, function ($methodClass){ return function (anObject){
  7065. var self=this,$self=this;
  7066. var bucket;
  7067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7068. return $core.withContext(function($ctx1) {
  7069. //>>excludeEnd("ctx");
  7070. var $1;
  7071. bucket=$self._bucketsOfElement_(anObject);
  7072. $1=$recv(bucket)._second();
  7073. if($1 == null || $1.a$nil){
  7074. var object,slowBucket;
  7075. object=[$recv(bucket)._first()
  7076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7077. ,$ctx1.sendIdx["first"]=1
  7078. //>>excludeEnd("ctx");
  7079. ][0];
  7080. slowBucket=$recv(bucket)._third();
  7081. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7083. return $core.withContext(function($ctx2) {
  7084. //>>excludeEnd("ctx");
  7085. $recv(slowBucket)._add_(object);
  7086. $self.size=$recv($self.size).__plus((1));
  7087. return $self.size;
  7088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7089. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7090. //>>excludeEnd("ctx");
  7091. }));
  7092. return object;
  7093. } else {
  7094. var primitiveBucket;
  7095. primitiveBucket=$1;
  7096. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7097. }
  7098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7099. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7100. //>>excludeEnd("ctx");
  7101. }; }),
  7102. $globals.Set);
  7103. $core.addMethod(
  7104. $core.method({
  7105. selector: "add:in:",
  7106. protocol: "private",
  7107. //>>excludeStart("ide", pragmas.excludeIdeData);
  7108. args: ["anObject", "anotherObject"],
  7109. 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'>",
  7110. referencedClasses: [],
  7111. //>>excludeEnd("ide");
  7112. 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"]]],
  7113. messageSends: []
  7114. }, function ($methodClass){ return function (anObject,anotherObject){
  7115. var self=this,$self=this;
  7116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7117. return $core.withContext(function($ctx1) {
  7118. //>>excludeEnd("ctx");
  7119. if (anObject in anotherObject.store) { return anObject; }
  7120. $self.size++;
  7121. anotherObject.store[anObject] = true;
  7122. return anObject;
  7123. ;
  7124. return self;
  7125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7126. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7127. //>>excludeEnd("ctx");
  7128. }; }),
  7129. $globals.Set);
  7130. $core.addMethod(
  7131. $core.method({
  7132. selector: "bucketsOfElement:",
  7133. protocol: "private",
  7134. //>>excludeStart("ide", pragmas.excludeIdeData);
  7135. args: ["anObject"],
  7136. 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'>",
  7137. referencedClasses: [],
  7138. //>>excludeEnd("ide");
  7139. 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"]]],
  7140. messageSends: []
  7141. }, function ($methodClass){ return function (anObject){
  7142. var self=this,$self=this;
  7143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7144. return $core.withContext(function($ctx1) {
  7145. //>>excludeEnd("ctx");
  7146. // include nil to well-known objects under "boolean" fastBucket
  7147. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7148. var prim = anObject.valueOf();
  7149. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7150. var bucket = null;
  7151. $self.slowBucketStores.some(function (store) {
  7152. return bucket = store._bucketOfElement_(anObject);
  7153. });
  7154. return [ anObject, null, bucket || $self.defaultBucket ];
  7155. }
  7156. return [ prim, $self.fastBuckets[typeof prim] ];
  7157. ;
  7158. return self;
  7159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7160. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7161. //>>excludeEnd("ctx");
  7162. }; }),
  7163. $globals.Set);
  7164. $core.addMethod(
  7165. $core.method({
  7166. selector: "classNameOf:",
  7167. protocol: "private",
  7168. //>>excludeStart("ide", pragmas.excludeIdeData);
  7169. args: ["anObject"],
  7170. 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'>",
  7171. referencedClasses: [],
  7172. //>>excludeEnd("ide");
  7173. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7174. messageSends: []
  7175. }, function ($methodClass){ return function (anObject){
  7176. var self=this,$self=this;
  7177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7178. return $core.withContext(function($ctx1) {
  7179. //>>excludeEnd("ctx");
  7180. return anObject.a$cls != null && anObject.a$cls.name;
  7181. return self;
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7184. //>>excludeEnd("ctx");
  7185. }; }),
  7186. $globals.Set);
  7187. $core.addMethod(
  7188. $core.method({
  7189. selector: "collect:",
  7190. protocol: "enumerating",
  7191. //>>excludeStart("ide", pragmas.excludeIdeData);
  7192. args: ["aBlock"],
  7193. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7194. referencedClasses: [],
  7195. //>>excludeEnd("ide");
  7196. pragmas: [],
  7197. messageSends: ["new", "class", "do:", "add:", "value:"]
  7198. }, function ($methodClass){ return function (aBlock){
  7199. var self=this,$self=this;
  7200. var collection;
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return $core.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. collection=$recv($self._class())._new();
  7205. $self._do_((function(each){
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. return $core.withContext(function($ctx2) {
  7208. //>>excludeEnd("ctx");
  7209. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7212. //>>excludeEnd("ctx");
  7213. }));
  7214. return collection;
  7215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7216. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7217. //>>excludeEnd("ctx");
  7218. }; }),
  7219. $globals.Set);
  7220. $core.addMethod(
  7221. $core.method({
  7222. selector: "do:",
  7223. protocol: "enumerating",
  7224. //>>excludeStart("ide", pragmas.excludeIdeData);
  7225. args: ["aBlock"],
  7226. 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'>",
  7227. referencedClasses: [],
  7228. //>>excludeEnd("ide");
  7229. 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"]]],
  7230. messageSends: []
  7231. }, function ($methodClass){ return function (aBlock){
  7232. var self=this,$self=this;
  7233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7234. return $core.withContext(function($ctx1) {
  7235. //>>excludeEnd("ctx");
  7236. var el, keys, i;
  7237. el = $self.fastBuckets;
  7238. keys = Object.keys(el);
  7239. for (i = 0; i < keys.length; ++i) {
  7240. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7241. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7242. else { store._do_(aBlock); }
  7243. }
  7244. el = $self.slowBucketStores;
  7245. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7246. $self.defaultBucket._do_(aBlock);
  7247. ;
  7248. return self;
  7249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7250. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7251. //>>excludeEnd("ctx");
  7252. }; }),
  7253. $globals.Set);
  7254. $core.addMethod(
  7255. $core.method({
  7256. selector: "includes:",
  7257. protocol: "testing",
  7258. //>>excludeStart("ide", pragmas.excludeIdeData);
  7259. args: ["anObject"],
  7260. 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 ]",
  7261. referencedClasses: [],
  7262. //>>excludeEnd("ide");
  7263. pragmas: [],
  7264. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7265. }, function ($methodClass){ return function (anObject){
  7266. var self=this,$self=this;
  7267. var bucket;
  7268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7269. return $core.withContext(function($ctx1) {
  7270. //>>excludeEnd("ctx");
  7271. var $1;
  7272. bucket=$self._bucketsOfElement_(anObject);
  7273. $1=$recv(bucket)._second();
  7274. if($1 == null || $1.a$nil){
  7275. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7277. ,$ctx1.sendIdx["first"]=1
  7278. //>>excludeEnd("ctx");
  7279. ][0]);
  7280. } else {
  7281. var primitiveBucket;
  7282. primitiveBucket=$1;
  7283. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7284. }
  7285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7286. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7287. //>>excludeEnd("ctx");
  7288. }; }),
  7289. $globals.Set);
  7290. $core.addMethod(
  7291. $core.method({
  7292. selector: "includes:in:",
  7293. protocol: "private",
  7294. //>>excludeStart("ide", pragmas.excludeIdeData);
  7295. args: ["anObject", "anotherObject"],
  7296. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7297. referencedClasses: [],
  7298. //>>excludeEnd("ide");
  7299. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7300. messageSends: []
  7301. }, function ($methodClass){ return function (anObject,anotherObject){
  7302. var self=this,$self=this;
  7303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7304. return $core.withContext(function($ctx1) {
  7305. //>>excludeEnd("ctx");
  7306. return anObject in anotherObject.store;
  7307. return self;
  7308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7309. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7310. //>>excludeEnd("ctx");
  7311. }; }),
  7312. $globals.Set);
  7313. $core.addMethod(
  7314. $core.method({
  7315. selector: "initialize",
  7316. protocol: "initialization",
  7317. //>>excludeStart("ide", pragmas.excludeIdeData);
  7318. args: [],
  7319. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7320. referencedClasses: [],
  7321. //>>excludeEnd("ide");
  7322. pragmas: [],
  7323. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7324. }, function ($methodClass){ return function (){
  7325. var self=this,$self=this;
  7326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7327. return $core.withContext(function($ctx1) {
  7328. //>>excludeEnd("ctx");
  7329. [(
  7330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7331. $ctx1.supercall = true,
  7332. //>>excludeEnd("ctx");
  7333. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7335. ,$ctx1.supercall = false
  7336. //>>excludeEnd("ctx");
  7337. ][0];
  7338. $self.defaultBucket=[];
  7339. $self._initializeSlowBucketStores();
  7340. $self._removeAll();
  7341. return self;
  7342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7343. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7344. //>>excludeEnd("ctx");
  7345. }; }),
  7346. $globals.Set);
  7347. $core.addMethod(
  7348. $core.method({
  7349. selector: "initializeSlowBucketStores",
  7350. protocol: "initialization",
  7351. //>>excludeStart("ide", pragmas.excludeIdeData);
  7352. args: [],
  7353. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7354. referencedClasses: ["ArrayBucketStore"],
  7355. //>>excludeEnd("ide");
  7356. pragmas: [],
  7357. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7358. }, function ($methodClass){ return function (){
  7359. var self=this,$self=this;
  7360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7361. return $core.withContext(function($ctx1) {
  7362. //>>excludeEnd("ctx");
  7363. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7365. return $core.withContext(function($ctx2) {
  7366. //>>excludeEnd("ctx");
  7367. return $self._classNameOf_(x);
  7368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7369. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7370. //>>excludeEnd("ctx");
  7371. }))
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. ,$ctx1.sendIdx["hashBlock:"]=1
  7374. //>>excludeEnd("ctx");
  7375. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7377. return $core.withContext(function($ctx2) {
  7378. //>>excludeEnd("ctx");
  7379. return $self._jsConstructorNameOf_(x);
  7380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7381. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7382. //>>excludeEnd("ctx");
  7383. }))];
  7384. return self;
  7385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7386. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7387. //>>excludeEnd("ctx");
  7388. }; }),
  7389. $globals.Set);
  7390. $core.addMethod(
  7391. $core.method({
  7392. selector: "jsConstructorNameOf:",
  7393. protocol: "private",
  7394. //>>excludeStart("ide", pragmas.excludeIdeData);
  7395. args: ["anObject"],
  7396. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7397. referencedClasses: [],
  7398. //>>excludeEnd("ide");
  7399. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7400. messageSends: []
  7401. }, function ($methodClass){ return function (anObject){
  7402. var self=this,$self=this;
  7403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7404. return $core.withContext(function($ctx1) {
  7405. //>>excludeEnd("ctx");
  7406. return anObject.constructor && anObject.constructor.name;
  7407. return self;
  7408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7409. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7410. //>>excludeEnd("ctx");
  7411. }; }),
  7412. $globals.Set);
  7413. $core.addMethod(
  7414. $core.method({
  7415. selector: "printOn:",
  7416. protocol: "printing",
  7417. //>>excludeStart("ide", pragmas.excludeIdeData);
  7418. args: ["aStream"],
  7419. 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: ')'",
  7420. referencedClasses: [],
  7421. //>>excludeEnd("ide");
  7422. pragmas: [],
  7423. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7424. }, function ($methodClass){ return function (aStream){
  7425. var self=this,$self=this;
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. return $core.withContext(function($ctx1) {
  7428. //>>excludeEnd("ctx");
  7429. [(
  7430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7431. $ctx1.supercall = true,
  7432. //>>excludeEnd("ctx");
  7433. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7435. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7436. //>>excludeEnd("ctx");
  7437. ][0];
  7438. [$recv(aStream)._nextPutAll_(" (")
  7439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7440. ,$ctx1.sendIdx["nextPutAll:"]=1
  7441. //>>excludeEnd("ctx");
  7442. ][0];
  7443. $self._do_separatedBy_((function(each){
  7444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7445. return $core.withContext(function($ctx2) {
  7446. //>>excludeEnd("ctx");
  7447. return $recv(each)._printOn_(aStream);
  7448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7450. //>>excludeEnd("ctx");
  7451. }),(function(){
  7452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7453. return $core.withContext(function($ctx2) {
  7454. //>>excludeEnd("ctx");
  7455. return [$recv(aStream)._nextPutAll_(" ")
  7456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7457. ,$ctx2.sendIdx["nextPutAll:"]=2
  7458. //>>excludeEnd("ctx");
  7459. ][0];
  7460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7461. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7462. //>>excludeEnd("ctx");
  7463. }));
  7464. $recv(aStream)._nextPutAll_(")");
  7465. return self;
  7466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7467. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7468. //>>excludeEnd("ctx");
  7469. }; }),
  7470. $globals.Set);
  7471. $core.addMethod(
  7472. $core.method({
  7473. selector: "remove:ifAbsent:",
  7474. protocol: "adding/removing",
  7475. //>>excludeStart("ide", pragmas.excludeIdeData);
  7476. args: ["anObject", "aBlock"],
  7477. 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 ]",
  7478. referencedClasses: [],
  7479. //>>excludeEnd("ide");
  7480. pragmas: [],
  7481. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7482. }, function ($methodClass){ return function (anObject,aBlock){
  7483. var self=this,$self=this;
  7484. var bucket;
  7485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7486. return $core.withContext(function($ctx1) {
  7487. //>>excludeEnd("ctx");
  7488. var $1;
  7489. var $early={};
  7490. try {
  7491. bucket=$self._bucketsOfElement_(anObject);
  7492. $1=$recv(bucket)._second();
  7493. if($1 == null || $1.a$nil){
  7494. var obj;
  7495. obj=[$recv(bucket)._first()
  7496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7497. ,$ctx1.sendIdx["first"]=1
  7498. //>>excludeEnd("ctx");
  7499. ][0];
  7500. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7502. return $core.withContext(function($ctx2) {
  7503. //>>excludeEnd("ctx");
  7504. throw $early=[$recv(aBlock)._value()];
  7505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7507. //>>excludeEnd("ctx");
  7508. }));
  7509. $self.size=$recv($self.size).__minus((1));
  7510. return obj;
  7511. } else {
  7512. var primitiveBucket;
  7513. primitiveBucket=$1;
  7514. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7515. }
  7516. }
  7517. catch(e) {if(e===$early)return e[0]; throw e}
  7518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7519. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7520. //>>excludeEnd("ctx");
  7521. }; }),
  7522. $globals.Set);
  7523. $core.addMethod(
  7524. $core.method({
  7525. selector: "remove:in:ifAbsent:",
  7526. protocol: "private",
  7527. //>>excludeStart("ide", pragmas.excludeIdeData);
  7528. args: ["anObject", "anotherObject", "aBlock"],
  7529. 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}'>",
  7530. referencedClasses: [],
  7531. //>>excludeEnd("ide");
  7532. 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}"]]],
  7533. messageSends: []
  7534. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7535. var self=this,$self=this;
  7536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7537. return $core.withContext(function($ctx1) {
  7538. //>>excludeEnd("ctx");
  7539. if (anObject in anotherObject.store) {
  7540. delete anotherObject.store[anObject];
  7541. $self.size--;
  7542. return anObject;
  7543. } else {
  7544. return aBlock._value();
  7545. };
  7546. return self;
  7547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7548. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7549. //>>excludeEnd("ctx");
  7550. }; }),
  7551. $globals.Set);
  7552. $core.addMethod(
  7553. $core.method({
  7554. selector: "removeAll",
  7555. protocol: "adding/removing",
  7556. //>>excludeStart("ide", pragmas.excludeIdeData);
  7557. args: [],
  7558. 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'>",
  7559. referencedClasses: [],
  7560. //>>excludeEnd("ide");
  7561. 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"]]],
  7562. messageSends: []
  7563. }, function ($methodClass){ return function (){
  7564. var self=this,$self=this;
  7565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7566. return $core.withContext(function($ctx1) {
  7567. //>>excludeEnd("ctx");
  7568. $self.fastBuckets = {
  7569. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7570. "number": { store: Object.create(null), fn: Number },
  7571. "string": { store: Object.create(null) }
  7572. };
  7573. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7574. $self.defaultBucket._removeAll();
  7575. $self.size = 0;
  7576. ;
  7577. return self;
  7578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7579. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7580. //>>excludeEnd("ctx");
  7581. }; }),
  7582. $globals.Set);
  7583. $core.addMethod(
  7584. $core.method({
  7585. selector: "select:",
  7586. protocol: "enumerating",
  7587. //>>excludeStart("ide", pragmas.excludeIdeData);
  7588. args: ["aBlock"],
  7589. 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",
  7590. referencedClasses: [],
  7591. //>>excludeEnd("ide");
  7592. pragmas: [],
  7593. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7594. }, function ($methodClass){ return function (aBlock){
  7595. var self=this,$self=this;
  7596. var collection;
  7597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7598. return $core.withContext(function($ctx1) {
  7599. //>>excludeEnd("ctx");
  7600. collection=$recv($self._class())._new();
  7601. $self._do_((function(each){
  7602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7603. return $core.withContext(function($ctx2) {
  7604. //>>excludeEnd("ctx");
  7605. if($core.assert($recv(aBlock)._value_(each))){
  7606. return $recv(collection)._add_(each);
  7607. }
  7608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7610. //>>excludeEnd("ctx");
  7611. }));
  7612. return collection;
  7613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7614. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7615. //>>excludeEnd("ctx");
  7616. }; }),
  7617. $globals.Set);
  7618. $core.addMethod(
  7619. $core.method({
  7620. selector: "select:thenCollect:",
  7621. protocol: "enumerating",
  7622. //>>excludeStart("ide", pragmas.excludeIdeData);
  7623. args: ["selectBlock", "collectBlock"],
  7624. 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",
  7625. referencedClasses: [],
  7626. //>>excludeEnd("ide");
  7627. pragmas: [],
  7628. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7629. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7630. var self=this,$self=this;
  7631. var collection;
  7632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7633. return $core.withContext(function($ctx1) {
  7634. //>>excludeEnd("ctx");
  7635. collection=$recv($self._class())._new();
  7636. $self._do_((function(each){
  7637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7638. return $core.withContext(function($ctx2) {
  7639. //>>excludeEnd("ctx");
  7640. if($core.assert([$recv(selectBlock)._value_(each)
  7641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7642. ,$ctx2.sendIdx["value:"]=1
  7643. //>>excludeEnd("ctx");
  7644. ][0])){
  7645. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7646. }
  7647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7649. //>>excludeEnd("ctx");
  7650. }));
  7651. return collection;
  7652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7653. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7654. //>>excludeEnd("ctx");
  7655. }; }),
  7656. $globals.Set);
  7657. $core.addMethod(
  7658. $core.method({
  7659. selector: "size",
  7660. protocol: "accessing",
  7661. //>>excludeStart("ide", pragmas.excludeIdeData);
  7662. args: [],
  7663. source: "size\x0a\x09^ size",
  7664. referencedClasses: [],
  7665. //>>excludeEnd("ide");
  7666. pragmas: [],
  7667. messageSends: []
  7668. }, function ($methodClass){ return function (){
  7669. var self=this,$self=this;
  7670. return $self.size;
  7671. }; }),
  7672. $globals.Set);
  7673. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7674. //>>excludeStart("ide", pragmas.excludeIdeData);
  7675. $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.";
  7676. //>>excludeEnd("ide");
  7677. $core.addMethod(
  7678. $core.method({
  7679. selector: "<<",
  7680. protocol: "writing",
  7681. //>>excludeStart("ide", pragmas.excludeIdeData);
  7682. args: ["anObject"],
  7683. source: "<< anObject\x0a\x09self write: anObject",
  7684. referencedClasses: [],
  7685. //>>excludeEnd("ide");
  7686. pragmas: [],
  7687. messageSends: ["write:"]
  7688. }, function ($methodClass){ return function (anObject){
  7689. var self=this,$self=this;
  7690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7691. return $core.withContext(function($ctx1) {
  7692. //>>excludeEnd("ctx");
  7693. $self._write_(anObject);
  7694. return self;
  7695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7696. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7697. //>>excludeEnd("ctx");
  7698. }; }),
  7699. $globals.ProtoStream);
  7700. $core.addMethod(
  7701. $core.method({
  7702. selector: "atEnd",
  7703. protocol: "testing",
  7704. //>>excludeStart("ide", pragmas.excludeIdeData);
  7705. args: [],
  7706. source: "atEnd\x0a\x09self subclassResponsibility",
  7707. referencedClasses: [],
  7708. //>>excludeEnd("ide");
  7709. pragmas: [],
  7710. messageSends: ["subclassResponsibility"]
  7711. }, function ($methodClass){ return function (){
  7712. var self=this,$self=this;
  7713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7714. return $core.withContext(function($ctx1) {
  7715. //>>excludeEnd("ctx");
  7716. $self._subclassResponsibility();
  7717. return self;
  7718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7719. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7720. //>>excludeEnd("ctx");
  7721. }; }),
  7722. $globals.ProtoStream);
  7723. $core.addMethod(
  7724. $core.method({
  7725. selector: "atStart",
  7726. protocol: "testing",
  7727. //>>excludeStart("ide", pragmas.excludeIdeData);
  7728. args: [],
  7729. source: "atStart\x0a\x09self subclassResponsibility",
  7730. referencedClasses: [],
  7731. //>>excludeEnd("ide");
  7732. pragmas: [],
  7733. messageSends: ["subclassResponsibility"]
  7734. }, function ($methodClass){ return function (){
  7735. var self=this,$self=this;
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return $core.withContext(function($ctx1) {
  7738. //>>excludeEnd("ctx");
  7739. $self._subclassResponsibility();
  7740. return self;
  7741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7742. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7743. //>>excludeEnd("ctx");
  7744. }; }),
  7745. $globals.ProtoStream);
  7746. $core.addMethod(
  7747. $core.method({
  7748. selector: "contents",
  7749. protocol: "accessing",
  7750. //>>excludeStart("ide", pragmas.excludeIdeData);
  7751. args: [],
  7752. source: "contents\x0a\x09self subclassResponsibility",
  7753. referencedClasses: [],
  7754. //>>excludeEnd("ide");
  7755. pragmas: [],
  7756. messageSends: ["subclassResponsibility"]
  7757. }, function ($methodClass){ return function (){
  7758. var self=this,$self=this;
  7759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7760. return $core.withContext(function($ctx1) {
  7761. //>>excludeEnd("ctx");
  7762. $self._subclassResponsibility();
  7763. return self;
  7764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7765. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7766. //>>excludeEnd("ctx");
  7767. }; }),
  7768. $globals.ProtoStream);
  7769. $core.addMethod(
  7770. $core.method({
  7771. selector: "do:",
  7772. protocol: "enumerating",
  7773. //>>excludeStart("ide", pragmas.excludeIdeData);
  7774. args: ["aBlock"],
  7775. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7776. referencedClasses: [],
  7777. //>>excludeEnd("ide");
  7778. pragmas: [],
  7779. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7780. }, function ($methodClass){ return function (aBlock){
  7781. var self=this,$self=this;
  7782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7783. return $core.withContext(function($ctx1) {
  7784. //>>excludeEnd("ctx");
  7785. $recv((function(){
  7786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7787. return $core.withContext(function($ctx2) {
  7788. //>>excludeEnd("ctx");
  7789. return $self._atEnd();
  7790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7792. //>>excludeEnd("ctx");
  7793. }))._whileFalse_((function(){
  7794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7795. return $core.withContext(function($ctx2) {
  7796. //>>excludeEnd("ctx");
  7797. return $recv(aBlock)._value_($self._next());
  7798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7799. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7800. //>>excludeEnd("ctx");
  7801. }));
  7802. return self;
  7803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7804. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7805. //>>excludeEnd("ctx");
  7806. }; }),
  7807. $globals.ProtoStream);
  7808. $core.addMethod(
  7809. $core.method({
  7810. selector: "isEmpty",
  7811. protocol: "testing",
  7812. //>>excludeStart("ide", pragmas.excludeIdeData);
  7813. args: [],
  7814. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7815. referencedClasses: [],
  7816. //>>excludeEnd("ide");
  7817. pragmas: [],
  7818. messageSends: ["and:", "atStart", "atEnd"]
  7819. }, function ($methodClass){ return function (){
  7820. var self=this,$self=this;
  7821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7822. return $core.withContext(function($ctx1) {
  7823. //>>excludeEnd("ctx");
  7824. return $recv($self._atStart())._and_((function(){
  7825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7826. return $core.withContext(function($ctx2) {
  7827. //>>excludeEnd("ctx");
  7828. return $self._atEnd();
  7829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7831. //>>excludeEnd("ctx");
  7832. }));
  7833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7834. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7835. //>>excludeEnd("ctx");
  7836. }; }),
  7837. $globals.ProtoStream);
  7838. $core.addMethod(
  7839. $core.method({
  7840. selector: "next",
  7841. protocol: "reading",
  7842. //>>excludeStart("ide", pragmas.excludeIdeData);
  7843. args: [],
  7844. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7845. referencedClasses: [],
  7846. //>>excludeEnd("ide");
  7847. pragmas: [],
  7848. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7849. }, function ($methodClass){ return function (){
  7850. var self=this,$self=this;
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. return $core.withContext(function($ctx1) {
  7853. //>>excludeEnd("ctx");
  7854. if($core.assert($self._atEnd())){
  7855. return nil;
  7856. } else {
  7857. return $self._subclassResponsibility();
  7858. }
  7859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7860. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7861. //>>excludeEnd("ctx");
  7862. }; }),
  7863. $globals.ProtoStream);
  7864. $core.addMethod(
  7865. $core.method({
  7866. selector: "nextPut:",
  7867. protocol: "writing",
  7868. //>>excludeStart("ide", pragmas.excludeIdeData);
  7869. args: ["anObject"],
  7870. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7871. referencedClasses: [],
  7872. //>>excludeEnd("ide");
  7873. pragmas: [],
  7874. messageSends: ["subclassResponsibility"]
  7875. }, function ($methodClass){ return function (anObject){
  7876. var self=this,$self=this;
  7877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7878. return $core.withContext(function($ctx1) {
  7879. //>>excludeEnd("ctx");
  7880. $self._subclassResponsibility();
  7881. return self;
  7882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7883. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7884. //>>excludeEnd("ctx");
  7885. }; }),
  7886. $globals.ProtoStream);
  7887. $core.addMethod(
  7888. $core.method({
  7889. selector: "nextPutAll:",
  7890. protocol: "writing",
  7891. //>>excludeStart("ide", pragmas.excludeIdeData);
  7892. args: ["aCollection"],
  7893. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7894. referencedClasses: [],
  7895. //>>excludeEnd("ide");
  7896. pragmas: [],
  7897. messageSends: ["do:", "nextPut:"]
  7898. }, function ($methodClass){ return function (aCollection){
  7899. var self=this,$self=this;
  7900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7901. return $core.withContext(function($ctx1) {
  7902. //>>excludeEnd("ctx");
  7903. $recv(aCollection)._do_((function(each){
  7904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7905. return $core.withContext(function($ctx2) {
  7906. //>>excludeEnd("ctx");
  7907. return $self._nextPut_(each);
  7908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7910. //>>excludeEnd("ctx");
  7911. }));
  7912. return self;
  7913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7914. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7915. //>>excludeEnd("ctx");
  7916. }; }),
  7917. $globals.ProtoStream);
  7918. $core.addMethod(
  7919. $core.method({
  7920. selector: "nextPutString:",
  7921. protocol: "writing",
  7922. //>>excludeStart("ide", pragmas.excludeIdeData);
  7923. args: ["aString"],
  7924. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7925. referencedClasses: [],
  7926. //>>excludeEnd("ide");
  7927. pragmas: [],
  7928. messageSends: ["nextPut:"]
  7929. }, function ($methodClass){ return function (aString){
  7930. var self=this,$self=this;
  7931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7932. return $core.withContext(function($ctx1) {
  7933. //>>excludeEnd("ctx");
  7934. $self._nextPut_(aString);
  7935. return self;
  7936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7937. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7938. //>>excludeEnd("ctx");
  7939. }; }),
  7940. $globals.ProtoStream);
  7941. $core.addMethod(
  7942. $core.method({
  7943. selector: "peek",
  7944. protocol: "reading",
  7945. //>>excludeStart("ide", pragmas.excludeIdeData);
  7946. args: [],
  7947. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7948. referencedClasses: [],
  7949. //>>excludeEnd("ide");
  7950. pragmas: [],
  7951. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7952. }, function ($methodClass){ return function (){
  7953. var self=this,$self=this;
  7954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7955. return $core.withContext(function($ctx1) {
  7956. //>>excludeEnd("ctx");
  7957. if($core.assert($self._atEnd())){
  7958. return nil;
  7959. } else {
  7960. return $self._subclassResponsibility();
  7961. }
  7962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7963. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  7964. //>>excludeEnd("ctx");
  7965. }; }),
  7966. $globals.ProtoStream);
  7967. $core.addMethod(
  7968. $core.method({
  7969. selector: "reset",
  7970. protocol: "actions",
  7971. //>>excludeStart("ide", pragmas.excludeIdeData);
  7972. args: [],
  7973. source: "reset\x0a\x09self subclassResponsibility",
  7974. referencedClasses: [],
  7975. //>>excludeEnd("ide");
  7976. pragmas: [],
  7977. messageSends: ["subclassResponsibility"]
  7978. }, function ($methodClass){ return function (){
  7979. var self=this,$self=this;
  7980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7981. return $core.withContext(function($ctx1) {
  7982. //>>excludeEnd("ctx");
  7983. $self._subclassResponsibility();
  7984. return self;
  7985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7986. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  7987. //>>excludeEnd("ctx");
  7988. }; }),
  7989. $globals.ProtoStream);
  7990. $core.addMethod(
  7991. $core.method({
  7992. selector: "resetContents",
  7993. protocol: "actions",
  7994. //>>excludeStart("ide", pragmas.excludeIdeData);
  7995. args: [],
  7996. source: "resetContents\x0a\x09self subclassResponsibility",
  7997. referencedClasses: [],
  7998. //>>excludeEnd("ide");
  7999. pragmas: [],
  8000. messageSends: ["subclassResponsibility"]
  8001. }, function ($methodClass){ return function (){
  8002. var self=this,$self=this;
  8003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8004. return $core.withContext(function($ctx1) {
  8005. //>>excludeEnd("ctx");
  8006. $self._subclassResponsibility();
  8007. return self;
  8008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8009. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8010. //>>excludeEnd("ctx");
  8011. }; }),
  8012. $globals.ProtoStream);
  8013. $core.addMethod(
  8014. $core.method({
  8015. selector: "setToEnd",
  8016. protocol: "positioning",
  8017. //>>excludeStart("ide", pragmas.excludeIdeData);
  8018. args: [],
  8019. source: "setToEnd\x0a\x09self subclassResponsibility",
  8020. referencedClasses: [],
  8021. //>>excludeEnd("ide");
  8022. pragmas: [],
  8023. messageSends: ["subclassResponsibility"]
  8024. }, function ($methodClass){ return function (){
  8025. var self=this,$self=this;
  8026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8027. return $core.withContext(function($ctx1) {
  8028. //>>excludeEnd("ctx");
  8029. $self._subclassResponsibility();
  8030. return self;
  8031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8032. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8033. //>>excludeEnd("ctx");
  8034. }; }),
  8035. $globals.ProtoStream);
  8036. $core.addMethod(
  8037. $core.method({
  8038. selector: "setToStart",
  8039. protocol: "positioning",
  8040. //>>excludeStart("ide", pragmas.excludeIdeData);
  8041. args: [],
  8042. source: "setToStart\x0a\x09self reset",
  8043. referencedClasses: [],
  8044. //>>excludeEnd("ide");
  8045. pragmas: [],
  8046. messageSends: ["reset"]
  8047. }, function ($methodClass){ return function (){
  8048. var self=this,$self=this;
  8049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8050. return $core.withContext(function($ctx1) {
  8051. //>>excludeEnd("ctx");
  8052. $self._reset();
  8053. return self;
  8054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8055. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8056. //>>excludeEnd("ctx");
  8057. }; }),
  8058. $globals.ProtoStream);
  8059. $core.addMethod(
  8060. $core.method({
  8061. selector: "write:",
  8062. protocol: "writing",
  8063. //>>excludeStart("ide", pragmas.excludeIdeData);
  8064. args: ["anObject"],
  8065. source: "write: anObject\x0a\x09anObject putOn: self",
  8066. referencedClasses: [],
  8067. //>>excludeEnd("ide");
  8068. pragmas: [],
  8069. messageSends: ["putOn:"]
  8070. }, function ($methodClass){ return function (anObject){
  8071. var self=this,$self=this;
  8072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8073. return $core.withContext(function($ctx1) {
  8074. //>>excludeEnd("ctx");
  8075. $recv(anObject)._putOn_(self);
  8076. return self;
  8077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8078. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8079. //>>excludeEnd("ctx");
  8080. }; }),
  8081. $globals.ProtoStream);
  8082. $core.addMethod(
  8083. $core.method({
  8084. selector: "on:",
  8085. protocol: "instance creation",
  8086. //>>excludeStart("ide", pragmas.excludeIdeData);
  8087. args: ["aCollection"],
  8088. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8089. referencedClasses: [],
  8090. //>>excludeEnd("ide");
  8091. pragmas: [],
  8092. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8093. }, function ($methodClass){ return function (aCollection){
  8094. var self=this,$self=this;
  8095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8096. return $core.withContext(function($ctx1) {
  8097. //>>excludeEnd("ctx");
  8098. var $1;
  8099. $1=$self._new();
  8100. $recv($1)._setCollection_(aCollection);
  8101. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8102. return $recv($1)._yourself();
  8103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8104. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8105. //>>excludeEnd("ctx");
  8106. }; }),
  8107. $globals.ProtoStream.a$cls);
  8108. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8109. //>>excludeStart("ide", pragmas.excludeIdeData);
  8110. $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.";
  8111. //>>excludeEnd("ide");
  8112. $core.addMethod(
  8113. $core.method({
  8114. selector: "atEnd",
  8115. protocol: "testing",
  8116. //>>excludeStart("ide", pragmas.excludeIdeData);
  8117. args: [],
  8118. source: "atEnd\x0a\x09^ self position = self size",
  8119. referencedClasses: [],
  8120. //>>excludeEnd("ide");
  8121. pragmas: [],
  8122. messageSends: ["=", "position", "size"]
  8123. }, function ($methodClass){ return function (){
  8124. var self=this,$self=this;
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. return $core.withContext(function($ctx1) {
  8127. //>>excludeEnd("ctx");
  8128. return $recv($self._position()).__eq($self._size());
  8129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8130. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8131. //>>excludeEnd("ctx");
  8132. }; }),
  8133. $globals.Stream);
  8134. $core.addMethod(
  8135. $core.method({
  8136. selector: "atStart",
  8137. protocol: "testing",
  8138. //>>excludeStart("ide", pragmas.excludeIdeData);
  8139. args: [],
  8140. source: "atStart\x0a\x09^ self position = 0",
  8141. referencedClasses: [],
  8142. //>>excludeEnd("ide");
  8143. pragmas: [],
  8144. messageSends: ["=", "position"]
  8145. }, function ($methodClass){ return function (){
  8146. var self=this,$self=this;
  8147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8148. return $core.withContext(function($ctx1) {
  8149. //>>excludeEnd("ctx");
  8150. return $recv($self._position()).__eq((0));
  8151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8152. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8153. //>>excludeEnd("ctx");
  8154. }; }),
  8155. $globals.Stream);
  8156. $core.addMethod(
  8157. $core.method({
  8158. selector: "close",
  8159. protocol: "actions",
  8160. //>>excludeStart("ide", pragmas.excludeIdeData);
  8161. args: [],
  8162. source: "close",
  8163. referencedClasses: [],
  8164. //>>excludeEnd("ide");
  8165. pragmas: [],
  8166. messageSends: []
  8167. }, function ($methodClass){ return function (){
  8168. var self=this,$self=this;
  8169. return self;
  8170. }; }),
  8171. $globals.Stream);
  8172. $core.addMethod(
  8173. $core.method({
  8174. selector: "collection",
  8175. protocol: "accessing",
  8176. //>>excludeStart("ide", pragmas.excludeIdeData);
  8177. args: [],
  8178. source: "collection\x0a\x09^ collection",
  8179. referencedClasses: [],
  8180. //>>excludeEnd("ide");
  8181. pragmas: [],
  8182. messageSends: []
  8183. }, function ($methodClass){ return function (){
  8184. var self=this,$self=this;
  8185. return $self.collection;
  8186. }; }),
  8187. $globals.Stream);
  8188. $core.addMethod(
  8189. $core.method({
  8190. selector: "contents",
  8191. protocol: "accessing",
  8192. //>>excludeStart("ide", pragmas.excludeIdeData);
  8193. args: [],
  8194. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8195. referencedClasses: [],
  8196. //>>excludeEnd("ide");
  8197. pragmas: [],
  8198. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8199. }, function ($methodClass){ return function (){
  8200. var self=this,$self=this;
  8201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8202. return $core.withContext(function($ctx1) {
  8203. //>>excludeEnd("ctx");
  8204. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8206. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8207. //>>excludeEnd("ctx");
  8208. }; }),
  8209. $globals.Stream);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "flush",
  8213. protocol: "actions",
  8214. //>>excludeStart("ide", pragmas.excludeIdeData);
  8215. args: [],
  8216. source: "flush",
  8217. referencedClasses: [],
  8218. //>>excludeEnd("ide");
  8219. pragmas: [],
  8220. messageSends: []
  8221. }, function ($methodClass){ return function (){
  8222. var self=this,$self=this;
  8223. return self;
  8224. }; }),
  8225. $globals.Stream);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "isEmpty",
  8229. protocol: "testing",
  8230. //>>excludeStart("ide", pragmas.excludeIdeData);
  8231. args: [],
  8232. source: "isEmpty\x0a\x09^ self size = 0",
  8233. referencedClasses: [],
  8234. //>>excludeEnd("ide");
  8235. pragmas: [],
  8236. messageSends: ["=", "size"]
  8237. }, function ($methodClass){ return function (){
  8238. var self=this,$self=this;
  8239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8240. return $core.withContext(function($ctx1) {
  8241. //>>excludeEnd("ctx");
  8242. return $recv($self._size()).__eq((0));
  8243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8244. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8245. //>>excludeEnd("ctx");
  8246. }; }),
  8247. $globals.Stream);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "next",
  8251. protocol: "reading",
  8252. //>>excludeStart("ide", pragmas.excludeIdeData);
  8253. args: [],
  8254. 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 ]",
  8255. referencedClasses: [],
  8256. //>>excludeEnd("ide");
  8257. pragmas: [],
  8258. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8259. }, function ($methodClass){ return function (){
  8260. var self=this,$self=this;
  8261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8262. return $core.withContext(function($ctx1) {
  8263. //>>excludeEnd("ctx");
  8264. if($core.assert($self._atEnd())){
  8265. return nil;
  8266. } else {
  8267. $self._position_($recv([$self._position()
  8268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8269. ,$ctx1.sendIdx["position"]=1
  8270. //>>excludeEnd("ctx");
  8271. ][0]).__plus((1)));
  8272. return $recv($self.collection)._at_($self._position());
  8273. }
  8274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8275. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8276. //>>excludeEnd("ctx");
  8277. }; }),
  8278. $globals.Stream);
  8279. $core.addMethod(
  8280. $core.method({
  8281. selector: "next:",
  8282. protocol: "reading",
  8283. //>>excludeStart("ide", pragmas.excludeIdeData);
  8284. args: ["anInteger"],
  8285. 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",
  8286. referencedClasses: [],
  8287. //>>excludeEnd("ide");
  8288. pragmas: [],
  8289. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8290. }, function ($methodClass){ return function (anInteger){
  8291. var self=this,$self=this;
  8292. var tempCollection;
  8293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8294. return $core.withContext(function($ctx1) {
  8295. //>>excludeEnd("ctx");
  8296. tempCollection=$recv($recv($self._collection())._class())._new();
  8297. $recv(anInteger)._timesRepeat_((function(){
  8298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8299. return $core.withContext(function($ctx2) {
  8300. //>>excludeEnd("ctx");
  8301. if(!$core.assert($self._atEnd())){
  8302. return $recv(tempCollection)._add_($self._next());
  8303. }
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8306. //>>excludeEnd("ctx");
  8307. }));
  8308. return tempCollection;
  8309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8310. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8311. //>>excludeEnd("ctx");
  8312. }; }),
  8313. $globals.Stream);
  8314. $core.addMethod(
  8315. $core.method({
  8316. selector: "nextPut:",
  8317. protocol: "writing",
  8318. //>>excludeStart("ide", pragmas.excludeIdeData);
  8319. args: ["anObject"],
  8320. 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)",
  8321. referencedClasses: [],
  8322. //>>excludeEnd("ide");
  8323. pragmas: [],
  8324. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8325. }, function ($methodClass){ return function (anObject){
  8326. var self=this,$self=this;
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. return $core.withContext(function($ctx1) {
  8329. //>>excludeEnd("ctx");
  8330. $self._position_($recv([$self._position()
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. ,$ctx1.sendIdx["position"]=1
  8333. //>>excludeEnd("ctx");
  8334. ][0]).__plus((1)));
  8335. $recv($self._collection())._at_put_([$self._position()
  8336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8337. ,$ctx1.sendIdx["position"]=2
  8338. //>>excludeEnd("ctx");
  8339. ][0],anObject);
  8340. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8341. return self;
  8342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8343. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8344. //>>excludeEnd("ctx");
  8345. }; }),
  8346. $globals.Stream);
  8347. $core.addMethod(
  8348. $core.method({
  8349. selector: "peek",
  8350. protocol: "reading",
  8351. //>>excludeStart("ide", pragmas.excludeIdeData);
  8352. args: [],
  8353. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8354. referencedClasses: [],
  8355. //>>excludeEnd("ide");
  8356. pragmas: [],
  8357. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8358. }, function ($methodClass){ return function (){
  8359. var self=this,$self=this;
  8360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8361. return $core.withContext(function($ctx1) {
  8362. //>>excludeEnd("ctx");
  8363. if(!$core.assert($self._atEnd())){
  8364. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8365. }
  8366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8367. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8368. //>>excludeEnd("ctx");
  8369. }; }),
  8370. $globals.Stream);
  8371. $core.addMethod(
  8372. $core.method({
  8373. selector: "position",
  8374. protocol: "accessing",
  8375. //>>excludeStart("ide", pragmas.excludeIdeData);
  8376. args: [],
  8377. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8378. referencedClasses: [],
  8379. //>>excludeEnd("ide");
  8380. pragmas: [],
  8381. messageSends: ["ifNil:"]
  8382. }, function ($methodClass){ return function (){
  8383. var self=this,$self=this;
  8384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8385. return $core.withContext(function($ctx1) {
  8386. //>>excludeEnd("ctx");
  8387. var $1;
  8388. $1=$self.position;
  8389. if($1 == null || $1.a$nil){
  8390. $self.position=(0);
  8391. return $self.position;
  8392. } else {
  8393. return $1;
  8394. }
  8395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8396. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8397. //>>excludeEnd("ctx");
  8398. }; }),
  8399. $globals.Stream);
  8400. $core.addMethod(
  8401. $core.method({
  8402. selector: "position:",
  8403. protocol: "accessing",
  8404. //>>excludeStart("ide", pragmas.excludeIdeData);
  8405. args: ["anInteger"],
  8406. source: "position: anInteger\x0a\x09position := anInteger",
  8407. referencedClasses: [],
  8408. //>>excludeEnd("ide");
  8409. pragmas: [],
  8410. messageSends: []
  8411. }, function ($methodClass){ return function (anInteger){
  8412. var self=this,$self=this;
  8413. $self.position=anInteger;
  8414. return self;
  8415. }; }),
  8416. $globals.Stream);
  8417. $core.addMethod(
  8418. $core.method({
  8419. selector: "reset",
  8420. protocol: "actions",
  8421. //>>excludeStart("ide", pragmas.excludeIdeData);
  8422. args: [],
  8423. source: "reset\x0a\x09self position: 0",
  8424. referencedClasses: [],
  8425. //>>excludeEnd("ide");
  8426. pragmas: [],
  8427. messageSends: ["position:"]
  8428. }, function ($methodClass){ return function (){
  8429. var self=this,$self=this;
  8430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8431. return $core.withContext(function($ctx1) {
  8432. //>>excludeEnd("ctx");
  8433. $self._position_((0));
  8434. return self;
  8435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8436. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8437. //>>excludeEnd("ctx");
  8438. }; }),
  8439. $globals.Stream);
  8440. $core.addMethod(
  8441. $core.method({
  8442. selector: "resetContents",
  8443. protocol: "actions",
  8444. //>>excludeStart("ide", pragmas.excludeIdeData);
  8445. args: [],
  8446. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8447. referencedClasses: [],
  8448. //>>excludeEnd("ide");
  8449. pragmas: [],
  8450. messageSends: ["reset", "setStreamSize:"]
  8451. }, function ($methodClass){ return function (){
  8452. var self=this,$self=this;
  8453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8454. return $core.withContext(function($ctx1) {
  8455. //>>excludeEnd("ctx");
  8456. $self._reset();
  8457. $self._setStreamSize_((0));
  8458. return self;
  8459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8460. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8461. //>>excludeEnd("ctx");
  8462. }; }),
  8463. $globals.Stream);
  8464. $core.addMethod(
  8465. $core.method({
  8466. selector: "setCollection:",
  8467. protocol: "accessing",
  8468. //>>excludeStart("ide", pragmas.excludeIdeData);
  8469. args: ["aCollection"],
  8470. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8471. referencedClasses: [],
  8472. //>>excludeEnd("ide");
  8473. pragmas: [],
  8474. messageSends: []
  8475. }, function ($methodClass){ return function (aCollection){
  8476. var self=this,$self=this;
  8477. $self.collection=aCollection;
  8478. return self;
  8479. }; }),
  8480. $globals.Stream);
  8481. $core.addMethod(
  8482. $core.method({
  8483. selector: "setStreamSize:",
  8484. protocol: "accessing",
  8485. //>>excludeStart("ide", pragmas.excludeIdeData);
  8486. args: ["anInteger"],
  8487. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8488. referencedClasses: [],
  8489. //>>excludeEnd("ide");
  8490. pragmas: [],
  8491. messageSends: []
  8492. }, function ($methodClass){ return function (anInteger){
  8493. var self=this,$self=this;
  8494. $self.streamSize=anInteger;
  8495. return self;
  8496. }; }),
  8497. $globals.Stream);
  8498. $core.addMethod(
  8499. $core.method({
  8500. selector: "setToEnd",
  8501. protocol: "positioning",
  8502. //>>excludeStart("ide", pragmas.excludeIdeData);
  8503. args: [],
  8504. source: "setToEnd\x0a\x09self position: self size",
  8505. referencedClasses: [],
  8506. //>>excludeEnd("ide");
  8507. pragmas: [],
  8508. messageSends: ["position:", "size"]
  8509. }, function ($methodClass){ return function (){
  8510. var self=this,$self=this;
  8511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8512. return $core.withContext(function($ctx1) {
  8513. //>>excludeEnd("ctx");
  8514. $self._position_($self._size());
  8515. return self;
  8516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8517. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8518. //>>excludeEnd("ctx");
  8519. }; }),
  8520. $globals.Stream);
  8521. $core.addMethod(
  8522. $core.method({
  8523. selector: "size",
  8524. protocol: "accessing",
  8525. //>>excludeStart("ide", pragmas.excludeIdeData);
  8526. args: [],
  8527. source: "size\x0a\x09^ self streamSize",
  8528. referencedClasses: [],
  8529. //>>excludeEnd("ide");
  8530. pragmas: [],
  8531. messageSends: ["streamSize"]
  8532. }, function ($methodClass){ return function (){
  8533. var self=this,$self=this;
  8534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8535. return $core.withContext(function($ctx1) {
  8536. //>>excludeEnd("ctx");
  8537. return $self._streamSize();
  8538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8539. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8540. //>>excludeEnd("ctx");
  8541. }; }),
  8542. $globals.Stream);
  8543. $core.addMethod(
  8544. $core.method({
  8545. selector: "skip:",
  8546. protocol: "positioning",
  8547. //>>excludeStart("ide", pragmas.excludeIdeData);
  8548. args: ["anInteger"],
  8549. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8550. referencedClasses: [],
  8551. //>>excludeEnd("ide");
  8552. pragmas: [],
  8553. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8554. }, function ($methodClass){ return function (anInteger){
  8555. var self=this,$self=this;
  8556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8557. return $core.withContext(function($ctx1) {
  8558. //>>excludeEnd("ctx");
  8559. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8560. return self;
  8561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8562. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8563. //>>excludeEnd("ctx");
  8564. }; }),
  8565. $globals.Stream);
  8566. $core.addMethod(
  8567. $core.method({
  8568. selector: "streamSize",
  8569. protocol: "accessing",
  8570. //>>excludeStart("ide", pragmas.excludeIdeData);
  8571. args: [],
  8572. source: "streamSize\x0a\x09^ streamSize",
  8573. referencedClasses: [],
  8574. //>>excludeEnd("ide");
  8575. pragmas: [],
  8576. messageSends: []
  8577. }, function ($methodClass){ return function (){
  8578. var self=this,$self=this;
  8579. return $self.streamSize;
  8580. }; }),
  8581. $globals.Stream);
  8582. $core.addMethod(
  8583. $core.method({
  8584. selector: "on:",
  8585. protocol: "instance creation",
  8586. //>>excludeStart("ide", pragmas.excludeIdeData);
  8587. args: ["aCollection"],
  8588. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8589. referencedClasses: [],
  8590. //>>excludeEnd("ide");
  8591. pragmas: [],
  8592. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8593. }, function ($methodClass){ return function (aCollection){
  8594. var self=this,$self=this;
  8595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8596. return $core.withContext(function($ctx1) {
  8597. //>>excludeEnd("ctx");
  8598. var $1;
  8599. $1=$self._new();
  8600. $recv($1)._setCollection_(aCollection);
  8601. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8602. return $recv($1)._yourself();
  8603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8604. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8605. //>>excludeEnd("ctx");
  8606. }; }),
  8607. $globals.Stream.a$cls);
  8608. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8609. //>>excludeStart("ide", pragmas.excludeIdeData);
  8610. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8611. //>>excludeEnd("ide");
  8612. $core.addMethod(
  8613. $core.method({
  8614. selector: "cr",
  8615. protocol: "writing",
  8616. //>>excludeStart("ide", pragmas.excludeIdeData);
  8617. args: [],
  8618. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8619. referencedClasses: ["String"],
  8620. //>>excludeEnd("ide");
  8621. pragmas: [],
  8622. messageSends: ["nextPutAll:", "cr"]
  8623. }, function ($methodClass){ return function (){
  8624. var self=this,$self=this;
  8625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8626. return $core.withContext(function($ctx1) {
  8627. //>>excludeEnd("ctx");
  8628. return $self._nextPutAll_($recv($globals.String)._cr());
  8629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8630. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8631. //>>excludeEnd("ctx");
  8632. }; }),
  8633. $globals.StringStream);
  8634. $core.addMethod(
  8635. $core.method({
  8636. selector: "crlf",
  8637. protocol: "writing",
  8638. //>>excludeStart("ide", pragmas.excludeIdeData);
  8639. args: [],
  8640. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8641. referencedClasses: ["String"],
  8642. //>>excludeEnd("ide");
  8643. pragmas: [],
  8644. messageSends: ["nextPutAll:", "crlf"]
  8645. }, function ($methodClass){ return function (){
  8646. var self=this,$self=this;
  8647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8648. return $core.withContext(function($ctx1) {
  8649. //>>excludeEnd("ctx");
  8650. return $self._nextPutAll_($recv($globals.String)._crlf());
  8651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8652. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8653. //>>excludeEnd("ctx");
  8654. }; }),
  8655. $globals.StringStream);
  8656. $core.addMethod(
  8657. $core.method({
  8658. selector: "lf",
  8659. protocol: "writing",
  8660. //>>excludeStart("ide", pragmas.excludeIdeData);
  8661. args: [],
  8662. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8663. referencedClasses: ["String"],
  8664. //>>excludeEnd("ide");
  8665. pragmas: [],
  8666. messageSends: ["nextPutAll:", "lf"]
  8667. }, function ($methodClass){ return function (){
  8668. var self=this,$self=this;
  8669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8670. return $core.withContext(function($ctx1) {
  8671. //>>excludeEnd("ctx");
  8672. return $self._nextPutAll_($recv($globals.String)._lf());
  8673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8674. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8675. //>>excludeEnd("ctx");
  8676. }; }),
  8677. $globals.StringStream);
  8678. $core.addMethod(
  8679. $core.method({
  8680. selector: "next:",
  8681. protocol: "reading",
  8682. //>>excludeStart("ide", pragmas.excludeIdeData);
  8683. args: ["anInteger"],
  8684. 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",
  8685. referencedClasses: [],
  8686. //>>excludeEnd("ide");
  8687. pragmas: [],
  8688. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8689. }, function ($methodClass){ return function (anInteger){
  8690. var self=this,$self=this;
  8691. var tempCollection;
  8692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8693. return $core.withContext(function($ctx1) {
  8694. //>>excludeEnd("ctx");
  8695. tempCollection=$recv($recv($self._collection())._class())._new();
  8696. $recv(anInteger)._timesRepeat_((function(){
  8697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8698. return $core.withContext(function($ctx2) {
  8699. //>>excludeEnd("ctx");
  8700. if(!$core.assert($self._atEnd())){
  8701. tempCollection=$recv(tempCollection).__comma($self._next());
  8702. return tempCollection;
  8703. }
  8704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8706. //>>excludeEnd("ctx");
  8707. }));
  8708. return tempCollection;
  8709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8710. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8711. //>>excludeEnd("ctx");
  8712. }; }),
  8713. $globals.StringStream);
  8714. $core.addMethod(
  8715. $core.method({
  8716. selector: "nextPut:",
  8717. protocol: "writing",
  8718. //>>excludeStart("ide", pragmas.excludeIdeData);
  8719. args: ["aString"],
  8720. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8721. referencedClasses: [],
  8722. //>>excludeEnd("ide");
  8723. pragmas: [],
  8724. messageSends: ["nextPutAll:"]
  8725. }, function ($methodClass){ return function (aString){
  8726. var self=this,$self=this;
  8727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8728. return $core.withContext(function($ctx1) {
  8729. //>>excludeEnd("ctx");
  8730. $self._nextPutAll_(aString);
  8731. return self;
  8732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8733. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8734. //>>excludeEnd("ctx");
  8735. }; }),
  8736. $globals.StringStream);
  8737. $core.addMethod(
  8738. $core.method({
  8739. selector: "nextPutAll:",
  8740. protocol: "writing",
  8741. //>>excludeStart("ide", pragmas.excludeIdeData);
  8742. args: ["aString"],
  8743. 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)",
  8744. referencedClasses: [],
  8745. //>>excludeEnd("ide");
  8746. pragmas: [],
  8747. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8748. }, function ($methodClass){ return function (aString){
  8749. var self=this,$self=this;
  8750. var pre,post;
  8751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8752. return $core.withContext(function($ctx1) {
  8753. //>>excludeEnd("ctx");
  8754. if($core.assert($recv([$self._position()
  8755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8756. ,$ctx1.sendIdx["position"]=1
  8757. //>>excludeEnd("ctx");
  8758. ][0]).__eq([$recv([$self._collection()
  8759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8760. ,$ctx1.sendIdx["collection"]=1
  8761. //>>excludeEnd("ctx");
  8762. ][0])._size()
  8763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8764. ,$ctx1.sendIdx["size"]=1
  8765. //>>excludeEnd("ctx");
  8766. ][0]))){
  8767. [$self._setCollection_([$recv([$self._collection()
  8768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8769. ,$ctx1.sendIdx["collection"]=2
  8770. //>>excludeEnd("ctx");
  8771. ][0]).__comma(aString)
  8772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8773. ,$ctx1.sendIdx[","]=1
  8774. //>>excludeEnd("ctx");
  8775. ][0])
  8776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8777. ,$ctx1.sendIdx["setCollection:"]=1
  8778. //>>excludeEnd("ctx");
  8779. ][0];
  8780. } else {
  8781. pre=[$recv([$self._collection()
  8782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8783. ,$ctx1.sendIdx["collection"]=3
  8784. //>>excludeEnd("ctx");
  8785. ][0])._copyFrom_to_((1),[$self._position()
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. ,$ctx1.sendIdx["position"]=2
  8788. //>>excludeEnd("ctx");
  8789. ][0])
  8790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8791. ,$ctx1.sendIdx["copyFrom:to:"]=1
  8792. //>>excludeEnd("ctx");
  8793. ][0];
  8794. post=$recv([$self._collection()
  8795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8796. ,$ctx1.sendIdx["collection"]=4
  8797. //>>excludeEnd("ctx");
  8798. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  8799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8800. ,$ctx1.sendIdx["position"]=3
  8801. //>>excludeEnd("ctx");
  8802. ][0]).__plus((1))
  8803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8804. ,$ctx1.sendIdx["+"]=2
  8805. //>>excludeEnd("ctx");
  8806. ][0]).__plus([$recv(aString)._size()
  8807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8808. ,$ctx1.sendIdx["size"]=2
  8809. //>>excludeEnd("ctx");
  8810. ][0])
  8811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8812. ,$ctx1.sendIdx["+"]=1
  8813. //>>excludeEnd("ctx");
  8814. ][0],[$recv($self._collection())._size()
  8815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8816. ,$ctx1.sendIdx["size"]=3
  8817. //>>excludeEnd("ctx");
  8818. ][0]);
  8819. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  8820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8821. ,$ctx1.sendIdx[","]=2
  8822. //>>excludeEnd("ctx");
  8823. ][0]);
  8824. }
  8825. $self._position_($recv([$self._position()
  8826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8827. ,$ctx1.sendIdx["position"]=4
  8828. //>>excludeEnd("ctx");
  8829. ][0]).__plus($recv(aString)._size()));
  8830. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8831. return self;
  8832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8833. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8834. //>>excludeEnd("ctx");
  8835. }; }),
  8836. $globals.StringStream);
  8837. $core.addMethod(
  8838. $core.method({
  8839. selector: "nextPutString:",
  8840. protocol: "writing",
  8841. //>>excludeStart("ide", pragmas.excludeIdeData);
  8842. args: ["aString"],
  8843. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8844. referencedClasses: [],
  8845. //>>excludeEnd("ide");
  8846. pragmas: [],
  8847. messageSends: ["nextPutAll:"]
  8848. }, function ($methodClass){ return function (aString){
  8849. var self=this,$self=this;
  8850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8851. return $core.withContext(function($ctx1) {
  8852. //>>excludeEnd("ctx");
  8853. $self._nextPutAll_(aString);
  8854. return self;
  8855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8856. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8857. //>>excludeEnd("ctx");
  8858. }; }),
  8859. $globals.StringStream);
  8860. $core.addMethod(
  8861. $core.method({
  8862. selector: "print:",
  8863. protocol: "writing",
  8864. //>>excludeStart("ide", pragmas.excludeIdeData);
  8865. args: ["anObject"],
  8866. source: "print: anObject\x0a\x09anObject printOn: self",
  8867. referencedClasses: [],
  8868. //>>excludeEnd("ide");
  8869. pragmas: [],
  8870. messageSends: ["printOn:"]
  8871. }, function ($methodClass){ return function (anObject){
  8872. var self=this,$self=this;
  8873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8874. return $core.withContext(function($ctx1) {
  8875. //>>excludeEnd("ctx");
  8876. $recv(anObject)._printOn_(self);
  8877. return self;
  8878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8879. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8880. //>>excludeEnd("ctx");
  8881. }; }),
  8882. $globals.StringStream);
  8883. $core.addMethod(
  8884. $core.method({
  8885. selector: "printSymbol:",
  8886. protocol: "writing",
  8887. //>>excludeStart("ide", pragmas.excludeIdeData);
  8888. args: ["anObject"],
  8889. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8890. referencedClasses: [],
  8891. //>>excludeEnd("ide");
  8892. pragmas: [],
  8893. messageSends: ["asSymbolPrintOn:"]
  8894. }, function ($methodClass){ return function (anObject){
  8895. var self=this,$self=this;
  8896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8897. return $core.withContext(function($ctx1) {
  8898. //>>excludeEnd("ctx");
  8899. $recv(anObject)._asSymbolPrintOn_(self);
  8900. return self;
  8901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8902. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8903. //>>excludeEnd("ctx");
  8904. }; }),
  8905. $globals.StringStream);
  8906. $core.addMethod(
  8907. $core.method({
  8908. selector: "space",
  8909. protocol: "writing",
  8910. //>>excludeStart("ide", pragmas.excludeIdeData);
  8911. args: [],
  8912. source: "space\x0a\x09self nextPut: ' '",
  8913. referencedClasses: [],
  8914. //>>excludeEnd("ide");
  8915. pragmas: [],
  8916. messageSends: ["nextPut:"]
  8917. }, function ($methodClass){ return function (){
  8918. var self=this,$self=this;
  8919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8920. return $core.withContext(function($ctx1) {
  8921. //>>excludeEnd("ctx");
  8922. $self._nextPut_(" ");
  8923. return self;
  8924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8925. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8926. //>>excludeEnd("ctx");
  8927. }; }),
  8928. $globals.StringStream);
  8929. $core.addMethod(
  8930. $core.method({
  8931. selector: "tab",
  8932. protocol: "writing",
  8933. //>>excludeStart("ide", pragmas.excludeIdeData);
  8934. args: [],
  8935. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8936. referencedClasses: ["String"],
  8937. //>>excludeEnd("ide");
  8938. pragmas: [],
  8939. messageSends: ["nextPutAll:", "tab"]
  8940. }, function ($methodClass){ return function (){
  8941. var self=this,$self=this;
  8942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8943. return $core.withContext(function($ctx1) {
  8944. //>>excludeEnd("ctx");
  8945. return $self._nextPutAll_($recv($globals.String)._tab());
  8946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8947. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  8948. //>>excludeEnd("ctx");
  8949. }; }),
  8950. $globals.StringStream);
  8951. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8952. //>>excludeStart("ide", pragmas.excludeIdeData);
  8953. $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.";
  8954. //>>excludeEnd("ide");
  8955. $core.addMethod(
  8956. $core.method({
  8957. selector: "initialize",
  8958. protocol: "initialization",
  8959. //>>excludeStart("ide", pragmas.excludeIdeData);
  8960. args: [],
  8961. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8962. referencedClasses: ["OrderedCollection"],
  8963. //>>excludeEnd("ide");
  8964. pragmas: [],
  8965. messageSends: ["initialize", "new"]
  8966. }, function ($methodClass){ return function (){
  8967. var self=this,$self=this;
  8968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8969. return $core.withContext(function($ctx1) {
  8970. //>>excludeEnd("ctx");
  8971. [(
  8972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8973. $ctx1.supercall = true,
  8974. //>>excludeEnd("ctx");
  8975. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. ,$ctx1.supercall = false
  8978. //>>excludeEnd("ctx");
  8979. ][0];
  8980. $self.read=[$recv($globals.OrderedCollection)._new()
  8981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8982. ,$ctx1.sendIdx["new"]=1
  8983. //>>excludeEnd("ctx");
  8984. ][0];
  8985. $self.write=$recv($globals.OrderedCollection)._new();
  8986. $self.readIndex=(1);
  8987. return self;
  8988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8989. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  8990. //>>excludeEnd("ctx");
  8991. }; }),
  8992. $globals.Queue);
  8993. $core.addMethod(
  8994. $core.method({
  8995. selector: "next",
  8996. protocol: "accessing",
  8997. //>>excludeStart("ide", pragmas.excludeIdeData);
  8998. args: [],
  8999. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9000. referencedClasses: [],
  9001. //>>excludeEnd("ide");
  9002. pragmas: [],
  9003. messageSends: ["nextIfAbsent:", "error:"]
  9004. }, function ($methodClass){ return function (){
  9005. var self=this,$self=this;
  9006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9007. return $core.withContext(function($ctx1) {
  9008. //>>excludeEnd("ctx");
  9009. return $self._nextIfAbsent_((function(){
  9010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9011. return $core.withContext(function($ctx2) {
  9012. //>>excludeEnd("ctx");
  9013. return $self._error_("Cannot read from empty Queue.");
  9014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9015. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9016. //>>excludeEnd("ctx");
  9017. }));
  9018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9019. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9020. //>>excludeEnd("ctx");
  9021. }; }),
  9022. $globals.Queue);
  9023. $core.addMethod(
  9024. $core.method({
  9025. selector: "nextIfAbsent:",
  9026. protocol: "accessing",
  9027. //>>excludeStart("ide", pragmas.excludeIdeData);
  9028. args: ["aBlock"],
  9029. 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",
  9030. referencedClasses: ["OrderedCollection"],
  9031. //>>excludeEnd("ide");
  9032. pragmas: [],
  9033. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9034. }, function ($methodClass){ return function (aBlock){
  9035. var self=this,$self=this;
  9036. var result;
  9037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9038. return $core.withContext(function($ctx1) {
  9039. //>>excludeEnd("ctx");
  9040. var $early={};
  9041. try {
  9042. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9044. return $core.withContext(function($ctx2) {
  9045. //>>excludeEnd("ctx");
  9046. $recv($self.write)._ifEmpty_((function(){
  9047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9048. return $core.withContext(function($ctx3) {
  9049. //>>excludeEnd("ctx");
  9050. if($core.assert($recv($self.readIndex).__gt((1)))){
  9051. $self.read=[];
  9052. $self.readIndex=(1);
  9053. $self.readIndex;
  9054. }
  9055. throw $early=[$recv(aBlock)._value()];
  9056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9057. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9058. //>>excludeEnd("ctx");
  9059. }));
  9060. $self.read=$self.write;
  9061. $self.readIndex=(1);
  9062. $self.write=$recv($globals.OrderedCollection)._new();
  9063. return $recv($self.read)._first();
  9064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9065. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9066. //>>excludeEnd("ctx");
  9067. }));
  9068. $recv($self.read)._at_put_($self.readIndex,nil);
  9069. $self.readIndex=$recv($self.readIndex).__plus((1));
  9070. return result;
  9071. }
  9072. catch(e) {if(e===$early)return e[0]; throw e}
  9073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9074. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9075. //>>excludeEnd("ctx");
  9076. }; }),
  9077. $globals.Queue);
  9078. $core.addMethod(
  9079. $core.method({
  9080. selector: "nextPut:",
  9081. protocol: "accessing",
  9082. //>>excludeStart("ide", pragmas.excludeIdeData);
  9083. args: ["anObject"],
  9084. source: "nextPut: anObject\x0a\x09write add: anObject",
  9085. referencedClasses: [],
  9086. //>>excludeEnd("ide");
  9087. pragmas: [],
  9088. messageSends: ["add:"]
  9089. }, function ($methodClass){ return function (anObject){
  9090. var self=this,$self=this;
  9091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9092. return $core.withContext(function($ctx1) {
  9093. //>>excludeEnd("ctx");
  9094. $recv($self.write)._add_(anObject);
  9095. return self;
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9098. //>>excludeEnd("ctx");
  9099. }; }),
  9100. $globals.Queue);
  9101. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9102. //>>excludeStart("ide", pragmas.excludeIdeData);
  9103. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9104. //>>excludeEnd("ide");
  9105. $core.addMethod(
  9106. $core.method({
  9107. selector: "compile:",
  9108. protocol: "evaluating",
  9109. //>>excludeStart("ide", pragmas.excludeIdeData);
  9110. args: ["aString"],
  9111. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9112. referencedClasses: [],
  9113. //>>excludeEnd("ide");
  9114. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9115. messageSends: []
  9116. }, function ($methodClass){ return function (aString){
  9117. var self=this,$self=this;
  9118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9119. return $core.withContext(function($ctx1) {
  9120. //>>excludeEnd("ctx");
  9121. return self.compile(aString);
  9122. return self;
  9123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9124. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9125. //>>excludeEnd("ctx");
  9126. }; }),
  9127. $globals.RegularExpression);
  9128. $core.addMethod(
  9129. $core.method({
  9130. selector: "exec:",
  9131. protocol: "evaluating",
  9132. //>>excludeStart("ide", pragmas.excludeIdeData);
  9133. args: ["aString"],
  9134. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9135. referencedClasses: [],
  9136. //>>excludeEnd("ide");
  9137. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9138. messageSends: []
  9139. }, function ($methodClass){ return function (aString){
  9140. var self=this,$self=this;
  9141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9142. return $core.withContext(function($ctx1) {
  9143. //>>excludeEnd("ctx");
  9144. return self.exec(aString) || nil;
  9145. return self;
  9146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9147. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9148. //>>excludeEnd("ctx");
  9149. }; }),
  9150. $globals.RegularExpression);
  9151. $core.addMethod(
  9152. $core.method({
  9153. selector: "test:",
  9154. protocol: "evaluating",
  9155. //>>excludeStart("ide", pragmas.excludeIdeData);
  9156. args: ["aString"],
  9157. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9158. referencedClasses: [],
  9159. //>>excludeEnd("ide");
  9160. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9161. messageSends: []
  9162. }, function ($methodClass){ return function (aString){
  9163. var self=this,$self=this;
  9164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9165. return $core.withContext(function($ctx1) {
  9166. //>>excludeEnd("ctx");
  9167. return self.test(aString);
  9168. return self;
  9169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9170. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9171. //>>excludeEnd("ctx");
  9172. }; }),
  9173. $globals.RegularExpression);
  9174. $core.addMethod(
  9175. $core.method({
  9176. selector: "fromString:",
  9177. protocol: "instance creation",
  9178. //>>excludeStart("ide", pragmas.excludeIdeData);
  9179. args: ["aString"],
  9180. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9181. referencedClasses: [],
  9182. //>>excludeEnd("ide");
  9183. pragmas: [],
  9184. messageSends: ["fromString:flag:"]
  9185. }, function ($methodClass){ return function (aString){
  9186. var self=this,$self=this;
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. return $core.withContext(function($ctx1) {
  9189. //>>excludeEnd("ctx");
  9190. return $self._fromString_flag_(aString,"");
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9193. //>>excludeEnd("ctx");
  9194. }; }),
  9195. $globals.RegularExpression.a$cls);
  9196. $core.addMethod(
  9197. $core.method({
  9198. selector: "fromString:flag:",
  9199. protocol: "instance creation",
  9200. //>>excludeStart("ide", pragmas.excludeIdeData);
  9201. args: ["aString", "anotherString"],
  9202. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9203. referencedClasses: [],
  9204. //>>excludeEnd("ide");
  9205. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9206. messageSends: []
  9207. }, function ($methodClass){ return function (aString,anotherString){
  9208. var self=this,$self=this;
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. return $core.withContext(function($ctx1) {
  9211. //>>excludeEnd("ctx");
  9212. return new RegExp(aString, anotherString);
  9213. return self;
  9214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9215. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9216. //>>excludeEnd("ctx");
  9217. }; }),
  9218. $globals.RegularExpression.a$cls);
  9219. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9220. $core.addMethod(
  9221. $core.method({
  9222. selector: "at:",
  9223. protocol: "accessing",
  9224. //>>excludeStart("ide", pragmas.excludeIdeData);
  9225. args: ["anIndex"],
  9226. 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 ]",
  9227. referencedClasses: [],
  9228. //>>excludeEnd("ide");
  9229. pragmas: [],
  9230. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9231. }, function ($methodClass){ return function (anIndex){
  9232. var self=this,$self=this;
  9233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9234. return $core.withContext(function($ctx1) {
  9235. //>>excludeEnd("ctx");
  9236. return $self._at_ifAbsent_(anIndex,(function(){
  9237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9238. return $core.withContext(function($ctx2) {
  9239. //>>excludeEnd("ctx");
  9240. return $self._errorNotFound();
  9241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9242. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9243. //>>excludeEnd("ctx");
  9244. }));
  9245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9246. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9247. //>>excludeEnd("ctx");
  9248. }; }),
  9249. $globals.TKeyValueCollection);
  9250. $core.addMethod(
  9251. $core.method({
  9252. selector: "at:ifAbsent:",
  9253. protocol: "accessing",
  9254. //>>excludeStart("ide", pragmas.excludeIdeData);
  9255. args: ["anIndex", "aBlock"],
  9256. 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",
  9257. referencedClasses: [],
  9258. //>>excludeEnd("ide");
  9259. pragmas: [],
  9260. messageSends: ["subclassResponsibility"]
  9261. }, function ($methodClass){ return function (anIndex,aBlock){
  9262. var self=this,$self=this;
  9263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9264. return $core.withContext(function($ctx1) {
  9265. //>>excludeEnd("ctx");
  9266. $self._subclassResponsibility();
  9267. return self;
  9268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9269. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9270. //>>excludeEnd("ctx");
  9271. }; }),
  9272. $globals.TKeyValueCollection);
  9273. $core.addMethod(
  9274. $core.method({
  9275. selector: "at:ifAbsentPut:",
  9276. protocol: "accessing",
  9277. //>>excludeStart("ide", pragmas.excludeIdeData);
  9278. args: ["aKey", "aBlock"],
  9279. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9280. referencedClasses: [],
  9281. //>>excludeEnd("ide");
  9282. pragmas: [],
  9283. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9284. }, function ($methodClass){ return function (aKey,aBlock){
  9285. var self=this,$self=this;
  9286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9287. return $core.withContext(function($ctx1) {
  9288. //>>excludeEnd("ctx");
  9289. return $self._at_ifAbsent_(aKey,(function(){
  9290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9291. return $core.withContext(function($ctx2) {
  9292. //>>excludeEnd("ctx");
  9293. return $self._at_put_(aKey,$recv(aBlock)._value());
  9294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9296. //>>excludeEnd("ctx");
  9297. }));
  9298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9299. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9300. //>>excludeEnd("ctx");
  9301. }; }),
  9302. $globals.TKeyValueCollection);
  9303. $core.addMethod(
  9304. $core.method({
  9305. selector: "at:ifPresent:",
  9306. protocol: "accessing",
  9307. //>>excludeStart("ide", pragmas.excludeIdeData);
  9308. args: ["anIndex", "aBlock"],
  9309. 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 ]",
  9310. referencedClasses: [],
  9311. //>>excludeEnd("ide");
  9312. pragmas: [],
  9313. messageSends: ["at:ifPresent:ifAbsent:"]
  9314. }, function ($methodClass){ return function (anIndex,aBlock){
  9315. var self=this,$self=this;
  9316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9317. return $core.withContext(function($ctx1) {
  9318. //>>excludeEnd("ctx");
  9319. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9320. return nil;
  9321. }));
  9322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9323. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9324. //>>excludeEnd("ctx");
  9325. }; }),
  9326. $globals.TKeyValueCollection);
  9327. $core.addMethod(
  9328. $core.method({
  9329. selector: "at:ifPresent:ifAbsent:",
  9330. protocol: "accessing",
  9331. //>>excludeStart("ide", pragmas.excludeIdeData);
  9332. args: ["anIndex", "aBlock", "anotherBlock"],
  9333. 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",
  9334. referencedClasses: [],
  9335. //>>excludeEnd("ide");
  9336. pragmas: [],
  9337. messageSends: ["subclassResponsibility"]
  9338. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9339. var self=this,$self=this;
  9340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9341. return $core.withContext(function($ctx1) {
  9342. //>>excludeEnd("ctx");
  9343. $self._subclassResponsibility();
  9344. return self;
  9345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9346. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9347. //>>excludeEnd("ctx");
  9348. }; }),
  9349. $globals.TKeyValueCollection);
  9350. $core.addMethod(
  9351. $core.method({
  9352. selector: "at:put:",
  9353. protocol: "accessing",
  9354. //>>excludeStart("ide", pragmas.excludeIdeData);
  9355. args: ["anIndex", "anObject"],
  9356. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9357. referencedClasses: [],
  9358. //>>excludeEnd("ide");
  9359. pragmas: [],
  9360. messageSends: ["subclassResponsibility"]
  9361. }, function ($methodClass){ return function (anIndex,anObject){
  9362. var self=this,$self=this;
  9363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9364. return $core.withContext(function($ctx1) {
  9365. //>>excludeEnd("ctx");
  9366. $self._subclassResponsibility();
  9367. return self;
  9368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9369. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9370. //>>excludeEnd("ctx");
  9371. }; }),
  9372. $globals.TKeyValueCollection);
  9373. $core.addMethod(
  9374. $core.method({
  9375. selector: "indexOf:",
  9376. protocol: "accessing",
  9377. //>>excludeStart("ide", pragmas.excludeIdeData);
  9378. args: ["anObject"],
  9379. 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 ]",
  9380. referencedClasses: [],
  9381. //>>excludeEnd("ide");
  9382. pragmas: [],
  9383. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9384. }, function ($methodClass){ return function (anObject){
  9385. var self=this,$self=this;
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. return $core.withContext(function($ctx1) {
  9388. //>>excludeEnd("ctx");
  9389. return $self._indexOf_ifAbsent_(anObject,(function(){
  9390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9391. return $core.withContext(function($ctx2) {
  9392. //>>excludeEnd("ctx");
  9393. return $self._errorNotFound();
  9394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9395. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9396. //>>excludeEnd("ctx");
  9397. }));
  9398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9399. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9400. //>>excludeEnd("ctx");
  9401. }; }),
  9402. $globals.TKeyValueCollection);
  9403. $core.addMethod(
  9404. $core.method({
  9405. selector: "indexOf:ifAbsent:",
  9406. protocol: "accessing",
  9407. //>>excludeStart("ide", pragmas.excludeIdeData);
  9408. args: ["anObject", "aBlock"],
  9409. 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",
  9410. referencedClasses: [],
  9411. //>>excludeEnd("ide");
  9412. pragmas: [],
  9413. messageSends: ["subclassResponsibility"]
  9414. }, function ($methodClass){ return function (anObject,aBlock){
  9415. var self=this,$self=this;
  9416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9417. return $core.withContext(function($ctx1) {
  9418. //>>excludeEnd("ctx");
  9419. $self._subclassResponsibility();
  9420. return self;
  9421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9422. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9423. //>>excludeEnd("ctx");
  9424. }; }),
  9425. $globals.TKeyValueCollection);
  9426. $core.addMethod(
  9427. $core.method({
  9428. selector: "with:do:",
  9429. protocol: "enumerating",
  9430. //>>excludeStart("ide", pragmas.excludeIdeData);
  9431. args: ["anotherCollection", "aBlock"],
  9432. 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) ]",
  9433. referencedClasses: [],
  9434. //>>excludeEnd("ide");
  9435. pragmas: [],
  9436. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9437. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9438. var self=this,$self=this;
  9439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9440. return $core.withContext(function($ctx1) {
  9441. //>>excludeEnd("ctx");
  9442. $self._withIndexDo_((function(each,index){
  9443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9444. return $core.withContext(function($ctx2) {
  9445. //>>excludeEnd("ctx");
  9446. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9448. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9449. //>>excludeEnd("ctx");
  9450. }));
  9451. return self;
  9452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9453. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9454. //>>excludeEnd("ctx");
  9455. }; }),
  9456. $globals.TKeyValueCollection);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "withIndexDo:",
  9460. protocol: "enumerating",
  9461. //>>excludeStart("ide", pragmas.excludeIdeData);
  9462. args: ["aBlock"],
  9463. 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",
  9464. referencedClasses: [],
  9465. //>>excludeEnd("ide");
  9466. pragmas: [],
  9467. messageSends: ["subclassResponsibility"]
  9468. }, function ($methodClass){ return function (aBlock){
  9469. var self=this,$self=this;
  9470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9471. return $core.withContext(function($ctx1) {
  9472. //>>excludeEnd("ctx");
  9473. $self._subclassResponsibility();
  9474. return self;
  9475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9476. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9477. //>>excludeEnd("ctx");
  9478. }; }),
  9479. $globals.TKeyValueCollection);
  9480. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9481. $core.addMethod(
  9482. $core.method({
  9483. selector: "at:ifAbsent:",
  9484. protocol: "accessing",
  9485. //>>excludeStart("ide", pragmas.excludeIdeData);
  9486. args: ["anIndex", "aBlock"],
  9487. 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'>",
  9488. referencedClasses: [],
  9489. //>>excludeEnd("ide");
  9490. 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"]]],
  9491. messageSends: []
  9492. }, function ($methodClass){ return function (anIndex,aBlock){
  9493. var self=this,$self=this;
  9494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9495. return $core.withContext(function($ctx1) {
  9496. //>>excludeEnd("ctx");
  9497. return anIndex >= 1 && anIndex <= self.length
  9498. ? self[anIndex - 1]
  9499. : aBlock._value()
  9500. ;
  9501. return self;
  9502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9503. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9504. //>>excludeEnd("ctx");
  9505. }; }),
  9506. $globals.TNativeZeroBasedCollection);
  9507. $core.addMethod(
  9508. $core.method({
  9509. selector: "at:ifPresent:ifAbsent:",
  9510. protocol: "accessing",
  9511. //>>excludeStart("ide", pragmas.excludeIdeData);
  9512. args: ["anIndex", "aBlock", "anotherBlock"],
  9513. 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'>",
  9514. referencedClasses: [],
  9515. //>>excludeEnd("ide");
  9516. 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"]]],
  9517. messageSends: []
  9518. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9519. var self=this,$self=this;
  9520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9521. return $core.withContext(function($ctx1) {
  9522. //>>excludeEnd("ctx");
  9523. return anIndex >= 1 && anIndex <= self.length
  9524. ? aBlock._value_(self[anIndex - 1])
  9525. : anotherBlock._value()
  9526. ;
  9527. return self;
  9528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9529. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9530. //>>excludeEnd("ctx");
  9531. }; }),
  9532. $globals.TNativeZeroBasedCollection);
  9533. $core.addMethod(
  9534. $core.method({
  9535. selector: "detect:ifNone:",
  9536. protocol: "enumerating",
  9537. //>>excludeStart("ide", pragmas.excludeIdeData);
  9538. args: ["aBlock", "anotherBlock"],
  9539. 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'>",
  9540. referencedClasses: [],
  9541. //>>excludeEnd("ide");
  9542. 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"]]],
  9543. messageSends: []
  9544. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9545. var self=this,$self=this;
  9546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9547. return $core.withContext(function($ctx1) {
  9548. //>>excludeEnd("ctx");
  9549. for(var i = 0; i < self.length; i++)
  9550. if(aBlock._value_(self[i]))
  9551. return self[i];
  9552. return anotherBlock._value();
  9553. ;
  9554. return self;
  9555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9556. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9557. //>>excludeEnd("ctx");
  9558. }; }),
  9559. $globals.TNativeZeroBasedCollection);
  9560. $core.addMethod(
  9561. $core.method({
  9562. selector: "do:",
  9563. protocol: "enumerating",
  9564. //>>excludeStart("ide", pragmas.excludeIdeData);
  9565. args: ["aBlock"],
  9566. 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'>",
  9567. referencedClasses: [],
  9568. //>>excludeEnd("ide");
  9569. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9570. messageSends: []
  9571. }, function ($methodClass){ return function (aBlock){
  9572. var self=this,$self=this;
  9573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9574. return $core.withContext(function($ctx1) {
  9575. //>>excludeEnd("ctx");
  9576. for(var i=0; i < self.length; i++) {
  9577. aBlock._value_(self[i]);
  9578. }
  9579. ;
  9580. return self;
  9581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9582. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9583. //>>excludeEnd("ctx");
  9584. }; }),
  9585. $globals.TNativeZeroBasedCollection);
  9586. $core.addMethod(
  9587. $core.method({
  9588. selector: "indexOf:ifAbsent:",
  9589. protocol: "accessing",
  9590. //>>excludeStart("ide", pragmas.excludeIdeData);
  9591. args: ["anObject", "aBlock"],
  9592. 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'>",
  9593. referencedClasses: [],
  9594. //>>excludeEnd("ide");
  9595. 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"]]],
  9596. messageSends: []
  9597. }, function ($methodClass){ return function (anObject,aBlock){
  9598. var self=this,$self=this;
  9599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9600. return $core.withContext(function($ctx1) {
  9601. //>>excludeEnd("ctx");
  9602. for(var i=0; i < self.length; i++) {
  9603. if($recv(self[i]).__eq(anObject)) {return i+1}
  9604. };
  9605. return aBlock._value();
  9606. ;
  9607. return self;
  9608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9609. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9610. //>>excludeEnd("ctx");
  9611. }; }),
  9612. $globals.TNativeZeroBasedCollection);
  9613. $core.addMethod(
  9614. $core.method({
  9615. selector: "indexOf:startingAt:ifAbsent:",
  9616. protocol: "accessing",
  9617. //>>excludeStart("ide", pragmas.excludeIdeData);
  9618. args: ["anObject", "start", "aBlock"],
  9619. 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'>",
  9620. referencedClasses: [],
  9621. //>>excludeEnd("ide");
  9622. 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"]]],
  9623. messageSends: []
  9624. }, function ($methodClass){ return function (anObject,start,aBlock){
  9625. var self=this,$self=this;
  9626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9627. return $core.withContext(function($ctx1) {
  9628. //>>excludeEnd("ctx");
  9629. for(var i=start - 1; i < self.length; i++){
  9630. if($recv(self[i]).__eq(anObject)) {return i+1}
  9631. }
  9632. return aBlock._value();
  9633. ;
  9634. return self;
  9635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9636. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9637. //>>excludeEnd("ctx");
  9638. }; }),
  9639. $globals.TNativeZeroBasedCollection);
  9640. $core.addMethod(
  9641. $core.method({
  9642. selector: "single",
  9643. protocol: "accessing",
  9644. //>>excludeStart("ide", pragmas.excludeIdeData);
  9645. args: [],
  9646. 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'>",
  9647. referencedClasses: [],
  9648. //>>excludeEnd("ide");
  9649. 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];"]]],
  9650. messageSends: []
  9651. }, function ($methodClass){ return function (){
  9652. var self=this,$self=this;
  9653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9654. return $core.withContext(function($ctx1) {
  9655. //>>excludeEnd("ctx");
  9656. if (self.length == 0) throw new Error("Collection is empty");
  9657. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9658. return self[0];;
  9659. return self;
  9660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9661. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9662. //>>excludeEnd("ctx");
  9663. }; }),
  9664. $globals.TNativeZeroBasedCollection);
  9665. $core.addMethod(
  9666. $core.method({
  9667. selector: "size",
  9668. protocol: "accessing",
  9669. //>>excludeStart("ide", pragmas.excludeIdeData);
  9670. args: [],
  9671. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9672. referencedClasses: [],
  9673. //>>excludeEnd("ide");
  9674. pragmas: [["inlineJS:", ["return self.length"]]],
  9675. messageSends: []
  9676. }, function ($methodClass){ return function (){
  9677. var self=this,$self=this;
  9678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9679. return $core.withContext(function($ctx1) {
  9680. //>>excludeEnd("ctx");
  9681. return self.length;
  9682. return self;
  9683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9684. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9685. //>>excludeEnd("ctx");
  9686. }; }),
  9687. $globals.TNativeZeroBasedCollection);
  9688. $core.addMethod(
  9689. $core.method({
  9690. selector: "with:do:",
  9691. protocol: "enumerating",
  9692. //>>excludeStart("ide", pragmas.excludeIdeData);
  9693. args: ["anotherCollection", "aBlock"],
  9694. 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'>",
  9695. referencedClasses: [],
  9696. //>>excludeEnd("ide");
  9697. 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"]]],
  9698. messageSends: []
  9699. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9700. var self=this,$self=this;
  9701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9702. return $core.withContext(function($ctx1) {
  9703. //>>excludeEnd("ctx");
  9704. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9705. for(var i=0; i<self.length; i++) {
  9706. aBlock._value_value_(self[i], anotherCollection[i]);
  9707. }
  9708. ;
  9709. return self;
  9710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9711. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9712. //>>excludeEnd("ctx");
  9713. }; }),
  9714. $globals.TNativeZeroBasedCollection);
  9715. $core.addMethod(
  9716. $core.method({
  9717. selector: "withIndexDo:",
  9718. protocol: "enumerating",
  9719. //>>excludeStart("ide", pragmas.excludeIdeData);
  9720. args: ["aBlock"],
  9721. 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'>",
  9722. referencedClasses: [],
  9723. //>>excludeEnd("ide");
  9724. 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"]]],
  9725. messageSends: []
  9726. }, function ($methodClass){ return function (aBlock){
  9727. var self=this,$self=this;
  9728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9729. return $core.withContext(function($ctx1) {
  9730. //>>excludeEnd("ctx");
  9731. for(var i=0; i < self.length; i++) {
  9732. aBlock._value_value_(self[i], i+1);
  9733. }
  9734. ;
  9735. return self;
  9736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9737. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9738. //>>excludeEnd("ctx");
  9739. }; }),
  9740. $globals.TNativeZeroBasedCollection);
  9741. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9742. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9743. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9744. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9745. });