Kernel-Collections.js 351 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232
  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. var $3,$2,$5,$4,$6,$1;
  27. $3=$self._class();
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. $ctx1.sendIdx["class"]=1;
  30. //>>excludeEnd("ctx");
  31. $2=$recv($3).__eq($recv(anAssociation)._class());
  32. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33. $ctx1.sendIdx["="]=1;
  34. //>>excludeEnd("ctx");
  35. $1=$recv($2)._and_((function(){
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. return $core.withContext(function($ctx2) {
  38. //>>excludeEnd("ctx");
  39. $5=$self._key();
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. $ctx2.sendIdx["key"]=1;
  42. //>>excludeEnd("ctx");
  43. $4=$recv($5).__eq($recv(anAssociation)._key());
  44. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45. $ctx2.sendIdx["="]=2;
  46. //>>excludeEnd("ctx");
  47. return $recv($4)._and_((function(){
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. return $core.withContext(function($ctx3) {
  50. //>>excludeEnd("ctx");
  51. $6=$self._value();
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. $ctx3.sendIdx["value"]=1;
  54. //>>excludeEnd("ctx");
  55. return $recv($6).__eq($recv(anAssociation)._value());
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58. //>>excludeEnd("ctx");
  59. }));
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62. //>>excludeEnd("ctx");
  63. }));
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. $ctx1.sendIdx["and:"]=1;
  66. //>>excludeEnd("ctx");
  67. return $1;
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  70. //>>excludeEnd("ctx");
  71. }; }),
  72. $globals.Association);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "key",
  76. protocol: "accessing",
  77. //>>excludeStart("ide", pragmas.excludeIdeData);
  78. args: [],
  79. source: "key\x0a\x09^ key",
  80. referencedClasses: [],
  81. //>>excludeEnd("ide");
  82. pragmas: [],
  83. messageSends: []
  84. }, function ($methodClass){ return function (){
  85. var self=this,$self=this;
  86. return $self.key;
  87. }; }),
  88. $globals.Association);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "key:",
  92. protocol: "accessing",
  93. //>>excludeStart("ide", pragmas.excludeIdeData);
  94. args: ["aKey"],
  95. source: "key: aKey\x0a\x09key := aKey",
  96. referencedClasses: [],
  97. //>>excludeEnd("ide");
  98. pragmas: [],
  99. messageSends: []
  100. }, function ($methodClass){ return function (aKey){
  101. var self=this,$self=this;
  102. $self.key=aKey;
  103. return self;
  104. }; }),
  105. $globals.Association);
  106. $core.addMethod(
  107. $core.method({
  108. selector: "printOn:",
  109. protocol: "printing",
  110. //>>excludeStart("ide", pragmas.excludeIdeData);
  111. args: ["aStream"],
  112. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  113. referencedClasses: [],
  114. //>>excludeEnd("ide");
  115. pragmas: [],
  116. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  117. }, function ($methodClass){ return function (aStream){
  118. var self=this,$self=this;
  119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  120. return $core.withContext(function($ctx1) {
  121. //>>excludeEnd("ctx");
  122. $recv($self._key())._printOn_(aStream);
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. $ctx1.sendIdx["printOn:"]=1;
  125. //>>excludeEnd("ctx");
  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. $self._removeAll();
  294. return self;
  295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  296. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  297. //>>excludeEnd("ctx");
  298. }; }),
  299. $globals.BucketStore);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "newBucket",
  303. protocol: "private",
  304. //>>excludeStart("ide", pragmas.excludeIdeData);
  305. args: [],
  306. source: "newBucket\x0a\x09self subclassResponsibility",
  307. referencedClasses: [],
  308. //>>excludeEnd("ide");
  309. pragmas: [],
  310. messageSends: ["subclassResponsibility"]
  311. }, function ($methodClass){ return function (){
  312. var self=this,$self=this;
  313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  314. return $core.withContext(function($ctx1) {
  315. //>>excludeEnd("ctx");
  316. $self._subclassResponsibility();
  317. return self;
  318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  319. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  320. //>>excludeEnd("ctx");
  321. }; }),
  322. $globals.BucketStore);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "removeAll",
  326. protocol: "adding/removing",
  327. //>>excludeStart("ide", pragmas.excludeIdeData);
  328. args: [],
  329. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  330. referencedClasses: [],
  331. //>>excludeEnd("ide");
  332. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  333. messageSends: []
  334. }, function ($methodClass){ return function (){
  335. var self=this,$self=this;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. return $core.withContext(function($ctx1) {
  338. //>>excludeEnd("ctx");
  339. $self.buckets = Object.create(null);;
  340. return self;
  341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  342. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  343. //>>excludeEnd("ctx");
  344. }; }),
  345. $globals.BucketStore);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "hashBlock:",
  349. protocol: "instance creation",
  350. //>>excludeStart("ide", pragmas.excludeIdeData);
  351. args: ["aBlock"],
  352. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  353. referencedClasses: [],
  354. //>>excludeEnd("ide");
  355. pragmas: [],
  356. messageSends: ["hashBlock:", "new", "yourself"]
  357. }, function ($methodClass){ return function (aBlock){
  358. var self=this,$self=this;
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. return $core.withContext(function($ctx1) {
  361. //>>excludeEnd("ctx");
  362. var $1;
  363. $1=$self._new();
  364. $recv($1)._hashBlock_(aBlock);
  365. return $recv($1)._yourself();
  366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  367. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  368. //>>excludeEnd("ctx");
  369. }; }),
  370. $globals.BucketStore.a$cls);
  371. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  372. //>>excludeStart("ide", pragmas.excludeIdeData);
  373. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  374. //>>excludeEnd("ide");
  375. $core.addMethod(
  376. $core.method({
  377. selector: "newBucket",
  378. protocol: "private",
  379. //>>excludeStart("ide", pragmas.excludeIdeData);
  380. args: [],
  381. source: "newBucket\x0a\x09^ #()",
  382. referencedClasses: [],
  383. //>>excludeEnd("ide");
  384. pragmas: [],
  385. messageSends: []
  386. }, function ($methodClass){ return function (){
  387. var self=this,$self=this;
  388. return [];
  389. }; }),
  390. $globals.ArrayBucketStore);
  391. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  394. //>>excludeEnd("ide");
  395. $core.addMethod(
  396. $core.method({
  397. selector: ",",
  398. protocol: "copying",
  399. //>>excludeStart("ide", pragmas.excludeIdeData);
  400. args: ["aCollection"],
  401. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  402. referencedClasses: [],
  403. //>>excludeEnd("ide");
  404. pragmas: [],
  405. messageSends: ["addAll:", "copy", "yourself"]
  406. }, function ($methodClass){ return function (aCollection){
  407. var self=this,$self=this;
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. return $core.withContext(function($ctx1) {
  410. //>>excludeEnd("ctx");
  411. var $1;
  412. $1=$self._copy();
  413. $recv($1)._addAll_(aCollection);
  414. return $recv($1)._yourself();
  415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  416. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  417. //>>excludeEnd("ctx");
  418. }; }),
  419. $globals.Collection);
  420. $core.addMethod(
  421. $core.method({
  422. selector: "add:",
  423. protocol: "adding/removing",
  424. //>>excludeStart("ide", pragmas.excludeIdeData);
  425. args: ["anObject"],
  426. source: "add: anObject\x0a\x09self subclassResponsibility",
  427. referencedClasses: [],
  428. //>>excludeEnd("ide");
  429. pragmas: [],
  430. messageSends: ["subclassResponsibility"]
  431. }, function ($methodClass){ return function (anObject){
  432. var self=this,$self=this;
  433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  434. return $core.withContext(function($ctx1) {
  435. //>>excludeEnd("ctx");
  436. $self._subclassResponsibility();
  437. return self;
  438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  439. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  440. //>>excludeEnd("ctx");
  441. }; }),
  442. $globals.Collection);
  443. $core.addMethod(
  444. $core.method({
  445. selector: "addAll:",
  446. protocol: "adding/removing",
  447. //>>excludeStart("ide", pragmas.excludeIdeData);
  448. args: ["aCollection"],
  449. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  450. referencedClasses: [],
  451. //>>excludeEnd("ide");
  452. pragmas: [],
  453. messageSends: ["do:", "add:"]
  454. }, function ($methodClass){ return function (aCollection){
  455. var self=this,$self=this;
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. return $core.withContext(function($ctx1) {
  458. //>>excludeEnd("ctx");
  459. $recv(aCollection)._do_((function(each){
  460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  461. return $core.withContext(function($ctx2) {
  462. //>>excludeEnd("ctx");
  463. return $self._add_(each);
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  466. //>>excludeEnd("ctx");
  467. }));
  468. return aCollection;
  469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  470. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  471. //>>excludeEnd("ctx");
  472. }; }),
  473. $globals.Collection);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "allSatisfy:",
  477. protocol: "enumerating",
  478. //>>excludeStart("ide", pragmas.excludeIdeData);
  479. args: ["aBlock"],
  480. 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",
  481. referencedClasses: [],
  482. //>>excludeEnd("ide");
  483. pragmas: [],
  484. messageSends: ["do:", "ifFalse:", "value:"]
  485. }, function ($methodClass){ return function (aBlock){
  486. var self=this,$self=this;
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx1) {
  489. //>>excludeEnd("ctx");
  490. var $1;
  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. $1=$recv(aBlock)._value_(each);
  498. if(!$core.assert($1)){
  499. throw $early=[false];
  500. }
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  503. //>>excludeEnd("ctx");
  504. }));
  505. return true;
  506. }
  507. catch(e) {if(e===$early)return e[0]; throw e}
  508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  509. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  510. //>>excludeEnd("ctx");
  511. }; }),
  512. $globals.Collection);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "anyOne",
  516. protocol: "accessing",
  517. //>>excludeStart("ide", pragmas.excludeIdeData);
  518. args: [],
  519. 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 ]",
  520. referencedClasses: [],
  521. //>>excludeEnd("ide");
  522. pragmas: [],
  523. messageSends: ["ifEmpty:", "error:", "do:"]
  524. }, function ($methodClass){ return function (){
  525. var self=this,$self=this;
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx1) {
  528. //>>excludeEnd("ctx");
  529. var $early={};
  530. try {
  531. $self._ifEmpty_((function(){
  532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  533. return $core.withContext(function($ctx2) {
  534. //>>excludeEnd("ctx");
  535. return $self._error_("Collection is empty");
  536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  538. //>>excludeEnd("ctx");
  539. }));
  540. $self._do_((function(each){
  541. throw $early=[each];
  542. }));
  543. return self;
  544. }
  545. catch(e) {if(e===$early)return e[0]; throw e}
  546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  547. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  548. //>>excludeEnd("ctx");
  549. }; }),
  550. $globals.Collection);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "anySatisfy:",
  554. protocol: "enumerating",
  555. //>>excludeStart("ide", pragmas.excludeIdeData);
  556. args: ["aBlock"],
  557. 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",
  558. referencedClasses: [],
  559. //>>excludeEnd("ide");
  560. pragmas: [],
  561. messageSends: ["do:", "ifTrue:", "value:"]
  562. }, function ($methodClass){ return function (aBlock){
  563. var self=this,$self=this;
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. return $core.withContext(function($ctx1) {
  566. //>>excludeEnd("ctx");
  567. var $1;
  568. var $early={};
  569. try {
  570. $self._do_((function(each){
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. return $core.withContext(function($ctx2) {
  573. //>>excludeEnd("ctx");
  574. $1=$recv(aBlock)._value_(each);
  575. if($core.assert($1)){
  576. throw $early=[true];
  577. }
  578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  580. //>>excludeEnd("ctx");
  581. }));
  582. return false;
  583. }
  584. catch(e) {if(e===$early)return e[0]; throw e}
  585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  586. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  587. //>>excludeEnd("ctx");
  588. }; }),
  589. $globals.Collection);
  590. $core.addMethod(
  591. $core.method({
  592. selector: "asArray",
  593. protocol: "converting",
  594. //>>excludeStart("ide", pragmas.excludeIdeData);
  595. args: [],
  596. source: "asArray\x0a\x09^ Array withAll: self",
  597. referencedClasses: ["Array"],
  598. //>>excludeEnd("ide");
  599. pragmas: [],
  600. messageSends: ["withAll:"]
  601. }, function ($methodClass){ return function (){
  602. var self=this,$self=this;
  603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  604. return $core.withContext(function($ctx1) {
  605. //>>excludeEnd("ctx");
  606. return $recv($globals.Array)._withAll_(self);
  607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  608. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  609. //>>excludeEnd("ctx");
  610. }; }),
  611. $globals.Collection);
  612. $core.addMethod(
  613. $core.method({
  614. selector: "asJavaScriptObject",
  615. protocol: "converting",
  616. //>>excludeStart("ide", pragmas.excludeIdeData);
  617. args: [],
  618. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  619. referencedClasses: [],
  620. //>>excludeEnd("ide");
  621. pragmas: [],
  622. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  623. }, function ($methodClass){ return function (){
  624. var self=this,$self=this;
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. return $core.withContext(function($ctx1) {
  627. //>>excludeEnd("ctx");
  628. return $recv($self._asArray())._collect_((function(each){
  629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  630. return $core.withContext(function($ctx2) {
  631. //>>excludeEnd("ctx");
  632. return $recv(each)._asJavaScriptObject();
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  635. //>>excludeEnd("ctx");
  636. }));
  637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  638. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  639. //>>excludeEnd("ctx");
  640. }; }),
  641. $globals.Collection);
  642. $core.addMethod(
  643. $core.method({
  644. selector: "asOrderedCollection",
  645. protocol: "converting",
  646. //>>excludeStart("ide", pragmas.excludeIdeData);
  647. args: [],
  648. source: "asOrderedCollection\x0a\x09^ self asArray",
  649. referencedClasses: [],
  650. //>>excludeEnd("ide");
  651. pragmas: [],
  652. messageSends: ["asArray"]
  653. }, function ($methodClass){ return function (){
  654. var self=this,$self=this;
  655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  656. return $core.withContext(function($ctx1) {
  657. //>>excludeEnd("ctx");
  658. return $self._asArray();
  659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  660. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  661. //>>excludeEnd("ctx");
  662. }; }),
  663. $globals.Collection);
  664. $core.addMethod(
  665. $core.method({
  666. selector: "asSet",
  667. protocol: "converting",
  668. //>>excludeStart("ide", pragmas.excludeIdeData);
  669. args: [],
  670. source: "asSet\x0a\x09^ Set withAll: self",
  671. referencedClasses: ["Set"],
  672. //>>excludeEnd("ide");
  673. pragmas: [],
  674. messageSends: ["withAll:"]
  675. }, function ($methodClass){ return function (){
  676. var self=this,$self=this;
  677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  678. return $core.withContext(function($ctx1) {
  679. //>>excludeEnd("ctx");
  680. return $recv($globals.Set)._withAll_(self);
  681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  682. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  683. //>>excludeEnd("ctx");
  684. }; }),
  685. $globals.Collection);
  686. $core.addMethod(
  687. $core.method({
  688. selector: "collect:",
  689. protocol: "enumerating",
  690. //>>excludeStart("ide", pragmas.excludeIdeData);
  691. args: ["aBlock"],
  692. 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",
  693. referencedClasses: [],
  694. //>>excludeEnd("ide");
  695. pragmas: [],
  696. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  697. }, function ($methodClass){ return function (aBlock){
  698. var self=this,$self=this;
  699. var stream;
  700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  701. return $core.withContext(function($ctx1) {
  702. //>>excludeEnd("ctx");
  703. stream=$recv($recv($self._class())._new())._writeStream();
  704. $self._do_((function(each){
  705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  706. return $core.withContext(function($ctx2) {
  707. //>>excludeEnd("ctx");
  708. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  711. //>>excludeEnd("ctx");
  712. }));
  713. return $recv(stream)._contents();
  714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  715. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  716. //>>excludeEnd("ctx");
  717. }; }),
  718. $globals.Collection);
  719. $core.addMethod(
  720. $core.method({
  721. selector: "copyWith:",
  722. protocol: "copying",
  723. //>>excludeStart("ide", pragmas.excludeIdeData);
  724. args: ["anObject"],
  725. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  726. referencedClasses: [],
  727. //>>excludeEnd("ide");
  728. pragmas: [],
  729. messageSends: ["add:", "copy", "yourself"]
  730. }, function ($methodClass){ return function (anObject){
  731. var self=this,$self=this;
  732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  733. return $core.withContext(function($ctx1) {
  734. //>>excludeEnd("ctx");
  735. var $1;
  736. $1=$self._copy();
  737. $recv($1)._add_(anObject);
  738. return $recv($1)._yourself();
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  741. //>>excludeEnd("ctx");
  742. }; }),
  743. $globals.Collection);
  744. $core.addMethod(
  745. $core.method({
  746. selector: "copyWithAll:",
  747. protocol: "copying",
  748. //>>excludeStart("ide", pragmas.excludeIdeData);
  749. args: ["aCollection"],
  750. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  751. referencedClasses: [],
  752. //>>excludeEnd("ide");
  753. pragmas: [],
  754. messageSends: ["deprecatedAPI:", ","]
  755. }, function ($methodClass){ return function (aCollection){
  756. var self=this,$self=this;
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. return $core.withContext(function($ctx1) {
  759. //>>excludeEnd("ctx");
  760. $self._deprecatedAPI_("Use #, instead.");
  761. return $self.__comma(aCollection);
  762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  763. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  764. //>>excludeEnd("ctx");
  765. }; }),
  766. $globals.Collection);
  767. $core.addMethod(
  768. $core.method({
  769. selector: "copyWithout:",
  770. protocol: "copying",
  771. //>>excludeStart("ide", pragmas.excludeIdeData);
  772. args: ["anObject"],
  773. 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 ]",
  774. referencedClasses: [],
  775. //>>excludeEnd("ide");
  776. pragmas: [],
  777. messageSends: ["reject:", "="]
  778. }, function ($methodClass){ return function (anObject){
  779. var self=this,$self=this;
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx1) {
  782. //>>excludeEnd("ctx");
  783. return $self._reject_((function(each){
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. return $core.withContext(function($ctx2) {
  786. //>>excludeEnd("ctx");
  787. return $recv(each).__eq(anObject);
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  790. //>>excludeEnd("ctx");
  791. }));
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  794. //>>excludeEnd("ctx");
  795. }; }),
  796. $globals.Collection);
  797. $core.addMethod(
  798. $core.method({
  799. selector: "copyWithoutAll:",
  800. protocol: "copying",
  801. //>>excludeStart("ide", pragmas.excludeIdeData);
  802. args: ["aCollection"],
  803. 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 ]",
  804. referencedClasses: [],
  805. //>>excludeEnd("ide");
  806. pragmas: [],
  807. messageSends: ["reject:", "includes:"]
  808. }, function ($methodClass){ return function (aCollection){
  809. var self=this,$self=this;
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx1) {
  812. //>>excludeEnd("ctx");
  813. return $self._reject_((function(each){
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. return $core.withContext(function($ctx2) {
  816. //>>excludeEnd("ctx");
  817. return $recv(aCollection)._includes_(each);
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  820. //>>excludeEnd("ctx");
  821. }));
  822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  823. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  824. //>>excludeEnd("ctx");
  825. }; }),
  826. $globals.Collection);
  827. $core.addMethod(
  828. $core.method({
  829. selector: "deepCopy",
  830. protocol: "copying",
  831. //>>excludeStart("ide", pragmas.excludeIdeData);
  832. args: [],
  833. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  834. referencedClasses: [],
  835. //>>excludeEnd("ide");
  836. pragmas: [],
  837. messageSends: ["collect:", "deepCopy"]
  838. }, function ($methodClass){ return function (){
  839. var self=this,$self=this;
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx1) {
  842. //>>excludeEnd("ctx");
  843. return $self._collect_((function(each){
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. return $core.withContext(function($ctx2) {
  846. //>>excludeEnd("ctx");
  847. return $recv(each)._deepCopy();
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  850. //>>excludeEnd("ctx");
  851. }));
  852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  853. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  854. //>>excludeEnd("ctx");
  855. }; }),
  856. $globals.Collection);
  857. $core.addMethod(
  858. $core.method({
  859. selector: "detect:",
  860. protocol: "enumerating",
  861. //>>excludeStart("ide", pragmas.excludeIdeData);
  862. args: ["aBlock"],
  863. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  864. referencedClasses: [],
  865. //>>excludeEnd("ide");
  866. pragmas: [],
  867. messageSends: ["detect:ifNone:", "errorNotFound"]
  868. }, function ($methodClass){ return function (aBlock){
  869. var self=this,$self=this;
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx1) {
  872. //>>excludeEnd("ctx");
  873. return $self._detect_ifNone_(aBlock,(function(){
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. return $core.withContext(function($ctx2) {
  876. //>>excludeEnd("ctx");
  877. return $self._errorNotFound();
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  880. //>>excludeEnd("ctx");
  881. }));
  882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  883. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  884. //>>excludeEnd("ctx");
  885. }; }),
  886. $globals.Collection);
  887. $core.addMethod(
  888. $core.method({
  889. selector: "detect:ifNone:",
  890. protocol: "enumerating",
  891. //>>excludeStart("ide", pragmas.excludeIdeData);
  892. args: ["aBlock", "anotherBlock"],
  893. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  894. referencedClasses: [],
  895. //>>excludeEnd("ide");
  896. pragmas: [],
  897. messageSends: ["do:", "ifTrue:", "value:", "value"]
  898. }, function ($methodClass){ return function (aBlock,anotherBlock){
  899. var self=this,$self=this;
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. return $core.withContext(function($ctx1) {
  902. //>>excludeEnd("ctx");
  903. var $1;
  904. var $early={};
  905. try {
  906. $self._do_((function(each){
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. return $core.withContext(function($ctx2) {
  909. //>>excludeEnd("ctx");
  910. $1=$recv(aBlock)._value_(each);
  911. if($core.assert($1)){
  912. throw $early=[each];
  913. }
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  916. //>>excludeEnd("ctx");
  917. }));
  918. return $recv(anotherBlock)._value();
  919. }
  920. catch(e) {if(e===$early)return e[0]; throw e}
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  923. //>>excludeEnd("ctx");
  924. }; }),
  925. $globals.Collection);
  926. $core.addMethod(
  927. $core.method({
  928. selector: "do:",
  929. protocol: "enumerating",
  930. //>>excludeStart("ide", pragmas.excludeIdeData);
  931. args: ["aBlock"],
  932. source: "do: aBlock\x0a\x09self subclassResponsibility",
  933. referencedClasses: [],
  934. //>>excludeEnd("ide");
  935. pragmas: [],
  936. messageSends: ["subclassResponsibility"]
  937. }, function ($methodClass){ return function (aBlock){
  938. var self=this,$self=this;
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. return $core.withContext(function($ctx1) {
  941. //>>excludeEnd("ctx");
  942. $self._subclassResponsibility();
  943. return self;
  944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  945. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  946. //>>excludeEnd("ctx");
  947. }; }),
  948. $globals.Collection);
  949. $core.addMethod(
  950. $core.method({
  951. selector: "do:separatedBy:",
  952. protocol: "enumerating",
  953. //>>excludeStart("ide", pragmas.excludeIdeData);
  954. args: ["aBlock", "anotherBlock"],
  955. 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 ]",
  956. referencedClasses: [],
  957. //>>excludeEnd("ide");
  958. pragmas: [],
  959. messageSends: ["do:", "value", "value:"]
  960. }, function ($methodClass){ return function (aBlock,anotherBlock){
  961. var self=this,$self=this;
  962. var actionBeforeElement;
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. return $core.withContext(function($ctx1) {
  965. //>>excludeEnd("ctx");
  966. actionBeforeElement=(function(){
  967. actionBeforeElement=anotherBlock;
  968. return actionBeforeElement;
  969. });
  970. $self._do_((function(each){
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. return $core.withContext(function($ctx2) {
  973. //>>excludeEnd("ctx");
  974. $recv(actionBeforeElement)._value();
  975. return $recv(aBlock)._value_(each);
  976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  978. //>>excludeEnd("ctx");
  979. }));
  980. return self;
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  983. //>>excludeEnd("ctx");
  984. }; }),
  985. $globals.Collection);
  986. $core.addMethod(
  987. $core.method({
  988. selector: "errorNotFound",
  989. protocol: "error handling",
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. args: [],
  992. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  993. referencedClasses: [],
  994. //>>excludeEnd("ide");
  995. pragmas: [],
  996. messageSends: ["error:"]
  997. }, function ($methodClass){ return function (){
  998. var self=this,$self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. $self._error_("Object is not in the collection");
  1003. return self;
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1006. //>>excludeEnd("ctx");
  1007. }; }),
  1008. $globals.Collection);
  1009. $core.addMethod(
  1010. $core.method({
  1011. selector: "ifEmpty:",
  1012. protocol: "testing",
  1013. //>>excludeStart("ide", pragmas.excludeIdeData);
  1014. args: ["aBlock"],
  1015. 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 ]",
  1016. referencedClasses: [],
  1017. //>>excludeEnd("ide");
  1018. pragmas: [],
  1019. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1020. }, function ($methodClass){ return function (aBlock){
  1021. var self=this,$self=this;
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. return $core.withContext(function($ctx1) {
  1024. //>>excludeEnd("ctx");
  1025. var $1;
  1026. $1=$self._isEmpty();
  1027. if($core.assert($1)){
  1028. return $recv(aBlock)._value();
  1029. } else {
  1030. return self;
  1031. }
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1034. //>>excludeEnd("ctx");
  1035. }; }),
  1036. $globals.Collection);
  1037. $core.addMethod(
  1038. $core.method({
  1039. selector: "ifEmpty:ifNotEmpty:",
  1040. protocol: "testing",
  1041. //>>excludeStart("ide", pragmas.excludeIdeData);
  1042. args: ["aBlock", "anotherBlock"],
  1043. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1044. referencedClasses: [],
  1045. //>>excludeEnd("ide");
  1046. pragmas: [],
  1047. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1048. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1049. var self=this,$self=this;
  1050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1051. return $core.withContext(function($ctx1) {
  1052. //>>excludeEnd("ctx");
  1053. var $1;
  1054. $1=$self._isEmpty();
  1055. if($core.assert($1)){
  1056. return $recv(aBlock)._value();
  1057. } else {
  1058. return $recv(anotherBlock)._value_(self);
  1059. }
  1060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1061. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1062. //>>excludeEnd("ctx");
  1063. }; }),
  1064. $globals.Collection);
  1065. $core.addMethod(
  1066. $core.method({
  1067. selector: "ifNotEmpty:",
  1068. protocol: "testing",
  1069. //>>excludeStart("ide", pragmas.excludeIdeData);
  1070. args: ["aBlock"],
  1071. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1072. referencedClasses: [],
  1073. //>>excludeEnd("ide");
  1074. pragmas: [],
  1075. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1076. }, function ($methodClass){ return function (aBlock){
  1077. var self=this,$self=this;
  1078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1079. return $core.withContext(function($ctx1) {
  1080. //>>excludeEnd("ctx");
  1081. var $1;
  1082. $1=$self._notEmpty();
  1083. if($core.assert($1)){
  1084. return $recv(aBlock)._value_(self);
  1085. } else {
  1086. return self;
  1087. }
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1090. //>>excludeEnd("ctx");
  1091. }; }),
  1092. $globals.Collection);
  1093. $core.addMethod(
  1094. $core.method({
  1095. selector: "ifNotEmpty:ifEmpty:",
  1096. protocol: "testing",
  1097. //>>excludeStart("ide", pragmas.excludeIdeData);
  1098. args: ["aBlock", "anotherBlock"],
  1099. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1100. referencedClasses: [],
  1101. //>>excludeEnd("ide");
  1102. pragmas: [],
  1103. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1104. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1105. var self=this,$self=this;
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. return $core.withContext(function($ctx1) {
  1108. //>>excludeEnd("ctx");
  1109. var $1;
  1110. $1=$self._notEmpty();
  1111. if($core.assert($1)){
  1112. return $recv(aBlock)._value_(self);
  1113. } else {
  1114. return $recv(anotherBlock)._value();
  1115. }
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1118. //>>excludeEnd("ctx");
  1119. }; }),
  1120. $globals.Collection);
  1121. $core.addMethod(
  1122. $core.method({
  1123. selector: "includes:",
  1124. protocol: "testing",
  1125. //>>excludeStart("ide", pragmas.excludeIdeData);
  1126. args: ["anObject"],
  1127. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1128. referencedClasses: [],
  1129. //>>excludeEnd("ide");
  1130. pragmas: [],
  1131. messageSends: ["anySatisfy:", "="]
  1132. }, function ($methodClass){ return function (anObject){
  1133. var self=this,$self=this;
  1134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1135. return $core.withContext(function($ctx1) {
  1136. //>>excludeEnd("ctx");
  1137. return $self._anySatisfy_((function(each){
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. return $core.withContext(function($ctx2) {
  1140. //>>excludeEnd("ctx");
  1141. return $recv(each).__eq(anObject);
  1142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1144. //>>excludeEnd("ctx");
  1145. }));
  1146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1147. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1148. //>>excludeEnd("ctx");
  1149. }; }),
  1150. $globals.Collection);
  1151. $core.addMethod(
  1152. $core.method({
  1153. selector: "inject:into:",
  1154. protocol: "enumerating",
  1155. //>>excludeStart("ide", pragmas.excludeIdeData);
  1156. args: ["anObject", "aBlock"],
  1157. 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",
  1158. referencedClasses: [],
  1159. //>>excludeEnd("ide");
  1160. pragmas: [],
  1161. messageSends: ["do:", "value:value:"]
  1162. }, function ($methodClass){ return function (anObject,aBlock){
  1163. var self=this,$self=this;
  1164. var result;
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. return $core.withContext(function($ctx1) {
  1167. //>>excludeEnd("ctx");
  1168. result=anObject;
  1169. $self._do_((function(each){
  1170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1171. return $core.withContext(function($ctx2) {
  1172. //>>excludeEnd("ctx");
  1173. result=$recv(aBlock)._value_value_(result,each);
  1174. return result;
  1175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1177. //>>excludeEnd("ctx");
  1178. }));
  1179. return result;
  1180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1181. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1182. //>>excludeEnd("ctx");
  1183. }; }),
  1184. $globals.Collection);
  1185. $core.addMethod(
  1186. $core.method({
  1187. selector: "intersection:",
  1188. protocol: "enumerating",
  1189. //>>excludeStart("ide", pragmas.excludeIdeData);
  1190. args: ["aCollection"],
  1191. 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",
  1192. referencedClasses: ["Set"],
  1193. //>>excludeEnd("ide");
  1194. pragmas: [],
  1195. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1196. }, function ($methodClass){ return function (aCollection){
  1197. var self=this,$self=this;
  1198. var set,outputSet;
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. return $core.withContext(function($ctx1) {
  1201. //>>excludeEnd("ctx");
  1202. var $2,$1;
  1203. set=$self._asSet();
  1204. outputSet=$recv($globals.Set)._new();
  1205. $recv(aCollection)._do_((function(each){
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. return $core.withContext(function($ctx2) {
  1208. //>>excludeEnd("ctx");
  1209. $2=$recv(set)._includes_(each);
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. $ctx2.sendIdx["includes:"]=1;
  1212. //>>excludeEnd("ctx");
  1213. $1=$recv($2)._and_((function(){
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. return $core.withContext(function($ctx3) {
  1216. //>>excludeEnd("ctx");
  1217. return $recv($recv(outputSet)._includes_(each))._not();
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1220. //>>excludeEnd("ctx");
  1221. }));
  1222. if($core.assert($1)){
  1223. return $recv(outputSet)._add_(each);
  1224. }
  1225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1227. //>>excludeEnd("ctx");
  1228. }));
  1229. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1232. //>>excludeEnd("ctx");
  1233. }; }),
  1234. $globals.Collection);
  1235. $core.addMethod(
  1236. $core.method({
  1237. selector: "isEmpty",
  1238. protocol: "testing",
  1239. //>>excludeStart("ide", pragmas.excludeIdeData);
  1240. args: [],
  1241. source: "isEmpty\x0a\x09^ self size = 0",
  1242. referencedClasses: [],
  1243. //>>excludeEnd("ide");
  1244. pragmas: [],
  1245. messageSends: ["=", "size"]
  1246. }, function ($methodClass){ return function (){
  1247. var self=this,$self=this;
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return $core.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. return $recv($self._size()).__eq((0));
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1254. //>>excludeEnd("ctx");
  1255. }; }),
  1256. $globals.Collection);
  1257. $core.addMethod(
  1258. $core.method({
  1259. selector: "noneSatisfy:",
  1260. protocol: "enumerating",
  1261. //>>excludeStart("ide", pragmas.excludeIdeData);
  1262. args: ["aBlock"],
  1263. 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",
  1264. referencedClasses: [],
  1265. //>>excludeEnd("ide");
  1266. pragmas: [],
  1267. messageSends: ["do:", "ifTrue:", "value:"]
  1268. }, function ($methodClass){ return function (aBlock){
  1269. var self=this,$self=this;
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx1) {
  1272. //>>excludeEnd("ctx");
  1273. var $1;
  1274. var $early={};
  1275. try {
  1276. $self._do_((function(item){
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. return $core.withContext(function($ctx2) {
  1279. //>>excludeEnd("ctx");
  1280. $1=$recv(aBlock)._value_(item);
  1281. if($core.assert($1)){
  1282. throw $early=[false];
  1283. }
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1286. //>>excludeEnd("ctx");
  1287. }));
  1288. return true;
  1289. }
  1290. catch(e) {if(e===$early)return e[0]; throw e}
  1291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1292. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1293. //>>excludeEnd("ctx");
  1294. }; }),
  1295. $globals.Collection);
  1296. $core.addMethod(
  1297. $core.method({
  1298. selector: "notEmpty",
  1299. protocol: "testing",
  1300. //>>excludeStart("ide", pragmas.excludeIdeData);
  1301. args: [],
  1302. source: "notEmpty\x0a\x09^ self isEmpty not",
  1303. referencedClasses: [],
  1304. //>>excludeEnd("ide");
  1305. pragmas: [],
  1306. messageSends: ["not", "isEmpty"]
  1307. }, function ($methodClass){ return function (){
  1308. var self=this,$self=this;
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. return $core.withContext(function($ctx1) {
  1311. //>>excludeEnd("ctx");
  1312. return $recv($self._isEmpty())._not();
  1313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1314. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1315. //>>excludeEnd("ctx");
  1316. }; }),
  1317. $globals.Collection);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "occurrencesOf:",
  1321. protocol: "accessing",
  1322. //>>excludeStart("ide", pragmas.excludeIdeData);
  1323. args: ["anObject"],
  1324. 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",
  1325. referencedClasses: [],
  1326. //>>excludeEnd("ide");
  1327. pragmas: [],
  1328. messageSends: ["do:", "ifTrue:", "=", "+"]
  1329. }, function ($methodClass){ return function (anObject){
  1330. var self=this,$self=this;
  1331. var tally;
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. return $core.withContext(function($ctx1) {
  1334. //>>excludeEnd("ctx");
  1335. var $1;
  1336. tally=(0);
  1337. $self._do_((function(each){
  1338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1339. return $core.withContext(function($ctx2) {
  1340. //>>excludeEnd("ctx");
  1341. $1=$recv(anObject).__eq(each);
  1342. if($core.assert($1)){
  1343. tally=$recv(tally).__plus((1));
  1344. return tally;
  1345. }
  1346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1348. //>>excludeEnd("ctx");
  1349. }));
  1350. return tally;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1353. //>>excludeEnd("ctx");
  1354. }; }),
  1355. $globals.Collection);
  1356. $core.addMethod(
  1357. $core.method({
  1358. selector: "putOn:",
  1359. protocol: "streaming",
  1360. //>>excludeStart("ide", pragmas.excludeIdeData);
  1361. args: ["aStream"],
  1362. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1363. referencedClasses: [],
  1364. //>>excludeEnd("ide");
  1365. pragmas: [],
  1366. messageSends: ["do:", "putOn:"]
  1367. }, function ($methodClass){ return function (aStream){
  1368. var self=this,$self=this;
  1369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1370. return $core.withContext(function($ctx1) {
  1371. //>>excludeEnd("ctx");
  1372. $self._do_((function(each){
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. return $core.withContext(function($ctx2) {
  1375. //>>excludeEnd("ctx");
  1376. return $recv(each)._putOn_(aStream);
  1377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1379. //>>excludeEnd("ctx");
  1380. }));
  1381. return self;
  1382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1383. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1384. //>>excludeEnd("ctx");
  1385. }; }),
  1386. $globals.Collection);
  1387. $core.addMethod(
  1388. $core.method({
  1389. selector: "reject:",
  1390. protocol: "enumerating",
  1391. //>>excludeStart("ide", pragmas.excludeIdeData);
  1392. args: ["aBlock"],
  1393. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1394. referencedClasses: [],
  1395. //>>excludeEnd("ide");
  1396. pragmas: [],
  1397. messageSends: ["select:", "=", "value:"]
  1398. }, function ($methodClass){ return function (aBlock){
  1399. var self=this,$self=this;
  1400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1401. return $core.withContext(function($ctx1) {
  1402. //>>excludeEnd("ctx");
  1403. return $self._select_((function(each){
  1404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1405. return $core.withContext(function($ctx2) {
  1406. //>>excludeEnd("ctx");
  1407. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1410. //>>excludeEnd("ctx");
  1411. }));
  1412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1413. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1414. //>>excludeEnd("ctx");
  1415. }; }),
  1416. $globals.Collection);
  1417. $core.addMethod(
  1418. $core.method({
  1419. selector: "remove:",
  1420. protocol: "adding/removing",
  1421. //>>excludeStart("ide", pragmas.excludeIdeData);
  1422. args: ["anObject"],
  1423. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1424. referencedClasses: [],
  1425. //>>excludeEnd("ide");
  1426. pragmas: [],
  1427. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1428. }, function ($methodClass){ return function (anObject){
  1429. var self=this,$self=this;
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. return $core.withContext(function($ctx1) {
  1432. //>>excludeEnd("ctx");
  1433. return $self._remove_ifAbsent_(anObject,(function(){
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. return $core.withContext(function($ctx2) {
  1436. //>>excludeEnd("ctx");
  1437. return $self._errorNotFound();
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1440. //>>excludeEnd("ctx");
  1441. }));
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1444. //>>excludeEnd("ctx");
  1445. }; }),
  1446. $globals.Collection);
  1447. $core.addMethod(
  1448. $core.method({
  1449. selector: "remove:ifAbsent:",
  1450. protocol: "adding/removing",
  1451. //>>excludeStart("ide", pragmas.excludeIdeData);
  1452. args: ["anObject", "aBlock"],
  1453. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1454. referencedClasses: [],
  1455. //>>excludeEnd("ide");
  1456. pragmas: [],
  1457. messageSends: ["subclassResponsibility"]
  1458. }, function ($methodClass){ return function (anObject,aBlock){
  1459. var self=this,$self=this;
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return $core.withContext(function($ctx1) {
  1462. //>>excludeEnd("ctx");
  1463. $self._subclassResponsibility();
  1464. return self;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1467. //>>excludeEnd("ctx");
  1468. }; }),
  1469. $globals.Collection);
  1470. $core.addMethod(
  1471. $core.method({
  1472. selector: "removeAll",
  1473. protocol: "adding/removing",
  1474. //>>excludeStart("ide", pragmas.excludeIdeData);
  1475. args: [],
  1476. source: "removeAll\x0a\x09self subclassResponsibility",
  1477. referencedClasses: [],
  1478. //>>excludeEnd("ide");
  1479. pragmas: [],
  1480. messageSends: ["subclassResponsibility"]
  1481. }, function ($methodClass){ return function (){
  1482. var self=this,$self=this;
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. return $core.withContext(function($ctx1) {
  1485. //>>excludeEnd("ctx");
  1486. $self._subclassResponsibility();
  1487. return self;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1490. //>>excludeEnd("ctx");
  1491. }; }),
  1492. $globals.Collection);
  1493. $core.addMethod(
  1494. $core.method({
  1495. selector: "select:",
  1496. protocol: "enumerating",
  1497. //>>excludeStart("ide", pragmas.excludeIdeData);
  1498. args: ["aBlock"],
  1499. 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",
  1500. referencedClasses: [],
  1501. //>>excludeEnd("ide");
  1502. pragmas: [],
  1503. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1504. }, function ($methodClass){ return function (aBlock){
  1505. var self=this,$self=this;
  1506. var stream;
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx1) {
  1509. //>>excludeEnd("ctx");
  1510. var $1;
  1511. stream=$recv($recv($self._class())._new())._writeStream();
  1512. $self._do_((function(each){
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. return $core.withContext(function($ctx2) {
  1515. //>>excludeEnd("ctx");
  1516. $1=$recv(aBlock)._value_(each);
  1517. if($core.assert($1)){
  1518. return $recv(stream)._nextPut_(each);
  1519. }
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1522. //>>excludeEnd("ctx");
  1523. }));
  1524. return $recv(stream)._contents();
  1525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1526. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1527. //>>excludeEnd("ctx");
  1528. }; }),
  1529. $globals.Collection);
  1530. $core.addMethod(
  1531. $core.method({
  1532. selector: "select:thenCollect:",
  1533. protocol: "enumerating",
  1534. //>>excludeStart("ide", pragmas.excludeIdeData);
  1535. args: ["selectBlock", "collectBlock"],
  1536. 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",
  1537. referencedClasses: [],
  1538. //>>excludeEnd("ide");
  1539. pragmas: [],
  1540. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1541. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1542. var self=this,$self=this;
  1543. var stream;
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. return $core.withContext(function($ctx1) {
  1546. //>>excludeEnd("ctx");
  1547. var $1;
  1548. stream=$recv($recv($self._class())._new())._writeStream();
  1549. $self._do_((function(each){
  1550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1551. return $core.withContext(function($ctx2) {
  1552. //>>excludeEnd("ctx");
  1553. $1=$recv(selectBlock)._value_(each);
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. $ctx2.sendIdx["value:"]=1;
  1556. //>>excludeEnd("ctx");
  1557. if($core.assert($1)){
  1558. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1559. }
  1560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1562. //>>excludeEnd("ctx");
  1563. }));
  1564. return $recv(stream)._contents();
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1567. //>>excludeEnd("ctx");
  1568. }; }),
  1569. $globals.Collection);
  1570. $core.addMethod(
  1571. $core.method({
  1572. selector: "shallowCopy",
  1573. protocol: "copying",
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: [],
  1576. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. pragmas: [],
  1580. messageSends: ["collect:"]
  1581. }, function ($methodClass){ return function (){
  1582. var self=this,$self=this;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. return $core.withContext(function($ctx1) {
  1585. //>>excludeEnd("ctx");
  1586. return $self._collect_((function(each){
  1587. return each;
  1588. }));
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1591. //>>excludeEnd("ctx");
  1592. }; }),
  1593. $globals.Collection);
  1594. $core.addMethod(
  1595. $core.method({
  1596. selector: "single",
  1597. protocol: "accessing",
  1598. //>>excludeStart("ide", pragmas.excludeIdeData);
  1599. args: [],
  1600. 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",
  1601. referencedClasses: [],
  1602. //>>excludeEnd("ide");
  1603. pragmas: [],
  1604. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1605. }, function ($methodClass){ return function (){
  1606. var self=this,$self=this;
  1607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1608. return $core.withContext(function($ctx1) {
  1609. //>>excludeEnd("ctx");
  1610. var $1;
  1611. $self._ifEmpty_((function(){
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. return $core.withContext(function($ctx2) {
  1614. //>>excludeEnd("ctx");
  1615. return $self._error_("Collection is empty");
  1616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1617. $ctx2.sendIdx["error:"]=1;
  1618. //>>excludeEnd("ctx");
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1621. //>>excludeEnd("ctx");
  1622. }));
  1623. $1=$recv($self._size()).__gt((1));
  1624. if($core.assert($1)){
  1625. $self._error_("Collection holds more than one element");
  1626. }
  1627. return $self._anyOne();
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1630. //>>excludeEnd("ctx");
  1631. }; }),
  1632. $globals.Collection);
  1633. $core.addMethod(
  1634. $core.method({
  1635. selector: "size",
  1636. protocol: "accessing",
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: [],
  1639. source: "size\x0a\x09self subclassResponsibility",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. pragmas: [],
  1643. messageSends: ["subclassResponsibility"]
  1644. }, function ($methodClass){ return function (){
  1645. var self=this,$self=this;
  1646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1647. return $core.withContext(function($ctx1) {
  1648. //>>excludeEnd("ctx");
  1649. $self._subclassResponsibility();
  1650. return self;
  1651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1652. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1653. //>>excludeEnd("ctx");
  1654. }; }),
  1655. $globals.Collection);
  1656. $core.addMethod(
  1657. $core.method({
  1658. selector: "classTag",
  1659. protocol: "accessing",
  1660. //>>excludeStart("ide", pragmas.excludeIdeData);
  1661. args: [],
  1662. 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'",
  1663. referencedClasses: [],
  1664. //>>excludeEnd("ide");
  1665. pragmas: [],
  1666. messageSends: []
  1667. }, function ($methodClass){ return function (){
  1668. var self=this,$self=this;
  1669. return "collection";
  1670. }; }),
  1671. $globals.Collection.a$cls);
  1672. $core.addMethod(
  1673. $core.method({
  1674. selector: "new:",
  1675. protocol: "instance creation",
  1676. //>>excludeStart("ide", pragmas.excludeIdeData);
  1677. args: ["anInteger"],
  1678. source: "new: anInteger\x0a\x09^ self new",
  1679. referencedClasses: [],
  1680. //>>excludeEnd("ide");
  1681. pragmas: [],
  1682. messageSends: ["new"]
  1683. }, function ($methodClass){ return function (anInteger){
  1684. var self=this,$self=this;
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. return $core.withContext(function($ctx1) {
  1687. //>>excludeEnd("ctx");
  1688. return $self._new();
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1691. //>>excludeEnd("ctx");
  1692. }; }),
  1693. $globals.Collection.a$cls);
  1694. $core.addMethod(
  1695. $core.method({
  1696. selector: "with:",
  1697. protocol: "instance creation",
  1698. //>>excludeStart("ide", pragmas.excludeIdeData);
  1699. args: ["anObject"],
  1700. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1701. referencedClasses: [],
  1702. //>>excludeEnd("ide");
  1703. pragmas: [],
  1704. messageSends: ["add:", "new", "yourself"]
  1705. }, function ($methodClass){ return function (anObject){
  1706. var self=this,$self=this;
  1707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1708. return $core.withContext(function($ctx1) {
  1709. //>>excludeEnd("ctx");
  1710. var $1;
  1711. $1=$self._new();
  1712. $recv($1)._add_(anObject);
  1713. return $recv($1)._yourself();
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1716. //>>excludeEnd("ctx");
  1717. }; }),
  1718. $globals.Collection.a$cls);
  1719. $core.addMethod(
  1720. $core.method({
  1721. selector: "with:with:",
  1722. protocol: "instance creation",
  1723. //>>excludeStart("ide", pragmas.excludeIdeData);
  1724. args: ["anObject", "anotherObject"],
  1725. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1726. referencedClasses: [],
  1727. //>>excludeEnd("ide");
  1728. pragmas: [],
  1729. messageSends: ["add:", "new", "yourself"]
  1730. }, function ($methodClass){ return function (anObject,anotherObject){
  1731. var self=this,$self=this;
  1732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1733. return $core.withContext(function($ctx1) {
  1734. //>>excludeEnd("ctx");
  1735. var $1;
  1736. $1=$self._new();
  1737. $recv($1)._add_(anObject);
  1738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1739. $ctx1.sendIdx["add:"]=1;
  1740. //>>excludeEnd("ctx");
  1741. $recv($1)._add_(anotherObject);
  1742. return $recv($1)._yourself();
  1743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1744. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1745. //>>excludeEnd("ctx");
  1746. }; }),
  1747. $globals.Collection.a$cls);
  1748. $core.addMethod(
  1749. $core.method({
  1750. selector: "with:with:with:",
  1751. protocol: "instance creation",
  1752. //>>excludeStart("ide", pragmas.excludeIdeData);
  1753. args: ["firstObject", "secondObject", "thirdObject"],
  1754. 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",
  1755. referencedClasses: [],
  1756. //>>excludeEnd("ide");
  1757. pragmas: [],
  1758. messageSends: ["add:", "new", "yourself"]
  1759. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1760. var self=this,$self=this;
  1761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1762. return $core.withContext(function($ctx1) {
  1763. //>>excludeEnd("ctx");
  1764. var $1;
  1765. $1=$self._new();
  1766. $recv($1)._add_(firstObject);
  1767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1768. $ctx1.sendIdx["add:"]=1;
  1769. //>>excludeEnd("ctx");
  1770. $recv($1)._add_(secondObject);
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. $ctx1.sendIdx["add:"]=2;
  1773. //>>excludeEnd("ctx");
  1774. $recv($1)._add_(thirdObject);
  1775. return $recv($1)._yourself();
  1776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1777. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1778. //>>excludeEnd("ctx");
  1779. }; }),
  1780. $globals.Collection.a$cls);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "withAll:",
  1784. protocol: "instance creation",
  1785. //>>excludeStart("ide", pragmas.excludeIdeData);
  1786. args: ["aCollection"],
  1787. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1788. referencedClasses: [],
  1789. //>>excludeEnd("ide");
  1790. pragmas: [],
  1791. messageSends: ["addAll:", "new", "yourself"]
  1792. }, function ($methodClass){ return function (aCollection){
  1793. var self=this,$self=this;
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. return $core.withContext(function($ctx1) {
  1796. //>>excludeEnd("ctx");
  1797. var $1;
  1798. $1=$self._new();
  1799. $recv($1)._addAll_(aCollection);
  1800. return $recv($1)._yourself();
  1801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1802. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1803. //>>excludeEnd("ctx");
  1804. }; }),
  1805. $globals.Collection.a$cls);
  1806. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1807. //>>excludeStart("ide", pragmas.excludeIdeData);
  1808. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1809. //>>excludeEnd("ide");
  1810. $core.addMethod(
  1811. $core.method({
  1812. selector: "=",
  1813. protocol: "comparing",
  1814. //>>excludeStart("ide", pragmas.excludeIdeData);
  1815. args: ["anAssocitativeCollection"],
  1816. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1817. referencedClasses: [],
  1818. //>>excludeEnd("ide");
  1819. pragmas: [],
  1820. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1821. }, function ($methodClass){ return function (anAssocitativeCollection){
  1822. var self=this,$self=this;
  1823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1824. return $core.withContext(function($ctx1) {
  1825. //>>excludeEnd("ctx");
  1826. var $2,$1,$4,$3,$5;
  1827. $2=$self._class();
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. $ctx1.sendIdx["class"]=1;
  1830. //>>excludeEnd("ctx");
  1831. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. $ctx1.sendIdx["="]=1;
  1834. //>>excludeEnd("ctx");
  1835. if(!$core.assert($1)){
  1836. return false;
  1837. }
  1838. $4=$self._size();
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. $ctx1.sendIdx["size"]=1;
  1841. //>>excludeEnd("ctx");
  1842. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. $ctx1.sendIdx["="]=2;
  1845. //>>excludeEnd("ctx");
  1846. if(!$core.assert($3)){
  1847. return false;
  1848. }
  1849. $5=$self._associations();
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. $ctx1.sendIdx["associations"]=1;
  1852. //>>excludeEnd("ctx");
  1853. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1856. //>>excludeEnd("ctx");
  1857. }; }),
  1858. $globals.AssociativeCollection);
  1859. $core.addMethod(
  1860. $core.method({
  1861. selector: "add:",
  1862. protocol: "adding/removing",
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: ["anAssociation"],
  1865. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. pragmas: [],
  1869. messageSends: ["at:put:", "key", "value"]
  1870. }, function ($methodClass){ return function (anAssociation){
  1871. var self=this,$self=this;
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. return $core.withContext(function($ctx1) {
  1874. //>>excludeEnd("ctx");
  1875. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1876. return self;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1879. //>>excludeEnd("ctx");
  1880. }; }),
  1881. $globals.AssociativeCollection);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "addAll:",
  1885. protocol: "adding/removing",
  1886. //>>excludeStart("ide", pragmas.excludeIdeData);
  1887. args: ["anAssociativeCollection"],
  1888. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1889. referencedClasses: [],
  1890. //>>excludeEnd("ide");
  1891. pragmas: [],
  1892. messageSends: ["addAll:", "associations"]
  1893. }, function ($methodClass){ return function (anAssociativeCollection){
  1894. var self=this,$self=this;
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx1) {
  1897. //>>excludeEnd("ctx");
  1898. (
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. $ctx1.supercall = true,
  1901. //>>excludeEnd("ctx");
  1902. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()));
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. $ctx1.supercall = false;
  1905. //>>excludeEnd("ctx");;
  1906. return anAssociativeCollection;
  1907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1908. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1909. //>>excludeEnd("ctx");
  1910. }; }),
  1911. $globals.AssociativeCollection);
  1912. $core.addMethod(
  1913. $core.method({
  1914. selector: "asDictionary",
  1915. protocol: "converting",
  1916. //>>excludeStart("ide", pragmas.excludeIdeData);
  1917. args: [],
  1918. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1919. referencedClasses: ["Dictionary"],
  1920. //>>excludeEnd("ide");
  1921. pragmas: [],
  1922. messageSends: ["from:", "associations"]
  1923. }, function ($methodClass){ return function (){
  1924. var self=this,$self=this;
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. return $core.withContext(function($ctx1) {
  1927. //>>excludeEnd("ctx");
  1928. return $recv($globals.Dictionary)._from_($self._associations());
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1931. //>>excludeEnd("ctx");
  1932. }; }),
  1933. $globals.AssociativeCollection);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "asHashedCollection",
  1937. protocol: "converting",
  1938. //>>excludeStart("ide", pragmas.excludeIdeData);
  1939. args: [],
  1940. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1941. referencedClasses: ["HashedCollection"],
  1942. //>>excludeEnd("ide");
  1943. pragmas: [],
  1944. messageSends: ["from:", "associations"]
  1945. }, function ($methodClass){ return function (){
  1946. var self=this,$self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return $core.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. return $recv($globals.HashedCollection)._from_($self._associations());
  1951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1952. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1953. //>>excludeEnd("ctx");
  1954. }; }),
  1955. $globals.AssociativeCollection);
  1956. $core.addMethod(
  1957. $core.method({
  1958. selector: "asJavaScriptObject",
  1959. protocol: "converting",
  1960. //>>excludeStart("ide", pragmas.excludeIdeData);
  1961. args: [],
  1962. 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",
  1963. referencedClasses: ["HashedCollection"],
  1964. //>>excludeEnd("ide");
  1965. pragmas: [],
  1966. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1967. }, function ($methodClass){ return function (){
  1968. var self=this,$self=this;
  1969. var hash;
  1970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1971. return $core.withContext(function($ctx1) {
  1972. //>>excludeEnd("ctx");
  1973. hash=$recv($globals.HashedCollection)._new();
  1974. $self._keysAndValuesDo_((function(key,value){
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. return $core.withContext(function($ctx2) {
  1977. //>>excludeEnd("ctx");
  1978. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1980. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1981. //>>excludeEnd("ctx");
  1982. }));
  1983. return hash;
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1986. //>>excludeEnd("ctx");
  1987. }; }),
  1988. $globals.AssociativeCollection);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "associations",
  1992. protocol: "accessing",
  1993. //>>excludeStart("ide", pragmas.excludeIdeData);
  1994. args: [],
  1995. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1996. referencedClasses: [],
  1997. //>>excludeEnd("ide");
  1998. pragmas: [],
  1999. messageSends: ["associationsDo:", "add:"]
  2000. }, function ($methodClass){ return function (){
  2001. var self=this,$self=this;
  2002. var associations;
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. return $core.withContext(function($ctx1) {
  2005. //>>excludeEnd("ctx");
  2006. associations=[];
  2007. $self._associationsDo_((function(each){
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. return $core.withContext(function($ctx2) {
  2010. //>>excludeEnd("ctx");
  2011. return $recv(associations)._add_(each);
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2014. //>>excludeEnd("ctx");
  2015. }));
  2016. return associations;
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2019. //>>excludeEnd("ctx");
  2020. }; }),
  2021. $globals.AssociativeCollection);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "associationsDo:",
  2025. protocol: "enumerating",
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["aBlock"],
  2028. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2029. referencedClasses: ["Association"],
  2030. //>>excludeEnd("ide");
  2031. pragmas: [],
  2032. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2033. }, function ($methodClass){ return function (aBlock){
  2034. var self=this,$self=this;
  2035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2036. return $core.withContext(function($ctx1) {
  2037. //>>excludeEnd("ctx");
  2038. $self._keysAndValuesDo_((function(key,value){
  2039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2040. return $core.withContext(function($ctx2) {
  2041. //>>excludeEnd("ctx");
  2042. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2044. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2045. //>>excludeEnd("ctx");
  2046. }));
  2047. return self;
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2050. //>>excludeEnd("ctx");
  2051. }; }),
  2052. $globals.AssociativeCollection);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "at:ifPresent:ifAbsent:",
  2056. protocol: "accessing",
  2057. //>>excludeStart("ide", pragmas.excludeIdeData);
  2058. args: ["aKey", "aBlock", "anotherBlock"],
  2059. 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 ]",
  2060. referencedClasses: [],
  2061. //>>excludeEnd("ide");
  2062. pragmas: [],
  2063. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2064. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2065. var self=this,$self=this;
  2066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2067. return $core.withContext(function($ctx1) {
  2068. //>>excludeEnd("ctx");
  2069. var $1;
  2070. $1=$self._includesKey_(aKey);
  2071. if($core.assert($1)){
  2072. return $recv(aBlock)._value_($self._at_(aKey));
  2073. } else {
  2074. return $recv(anotherBlock)._value();
  2075. }
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2078. //>>excludeEnd("ctx");
  2079. }; }),
  2080. $globals.AssociativeCollection);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "collect:",
  2084. protocol: "enumerating",
  2085. //>>excludeStart("ide", pragmas.excludeIdeData);
  2086. args: ["aBlock"],
  2087. 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",
  2088. referencedClasses: [],
  2089. //>>excludeEnd("ide");
  2090. pragmas: [],
  2091. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2092. }, function ($methodClass){ return function (aBlock){
  2093. var self=this,$self=this;
  2094. var newDict;
  2095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2096. return $core.withContext(function($ctx1) {
  2097. //>>excludeEnd("ctx");
  2098. newDict=$recv($self._class())._new();
  2099. $self._keysAndValuesDo_((function(key,value){
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. return $core.withContext(function($ctx2) {
  2102. //>>excludeEnd("ctx");
  2103. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2105. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2106. //>>excludeEnd("ctx");
  2107. }));
  2108. return newDict;
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2111. //>>excludeEnd("ctx");
  2112. }; }),
  2113. $globals.AssociativeCollection);
  2114. $core.addMethod(
  2115. $core.method({
  2116. selector: "deepCopy",
  2117. protocol: "copying",
  2118. //>>excludeStart("ide", pragmas.excludeIdeData);
  2119. args: [],
  2120. 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",
  2121. referencedClasses: [],
  2122. //>>excludeEnd("ide");
  2123. pragmas: [],
  2124. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2125. }, function ($methodClass){ return function (){
  2126. var self=this,$self=this;
  2127. var copy;
  2128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2129. return $core.withContext(function($ctx1) {
  2130. //>>excludeEnd("ctx");
  2131. copy=$recv($self._class())._new();
  2132. $self._keysAndValuesDo_((function(key,value){
  2133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2134. return $core.withContext(function($ctx2) {
  2135. //>>excludeEnd("ctx");
  2136. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2139. //>>excludeEnd("ctx");
  2140. }));
  2141. return copy;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2144. //>>excludeEnd("ctx");
  2145. }; }),
  2146. $globals.AssociativeCollection);
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: "detect:ifNone:",
  2150. protocol: "enumerating",
  2151. //>>excludeStart("ide", pragmas.excludeIdeData);
  2152. args: ["aBlock", "anotherBlock"],
  2153. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2154. referencedClasses: [],
  2155. //>>excludeEnd("ide");
  2156. pragmas: [],
  2157. messageSends: ["detect:ifNone:", "values"]
  2158. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2159. var self=this,$self=this;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2166. //>>excludeEnd("ctx");
  2167. }; }),
  2168. $globals.AssociativeCollection);
  2169. $core.addMethod(
  2170. $core.method({
  2171. selector: "do:",
  2172. protocol: "enumerating",
  2173. //>>excludeStart("ide", pragmas.excludeIdeData);
  2174. args: ["aBlock"],
  2175. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2176. referencedClasses: [],
  2177. //>>excludeEnd("ide");
  2178. pragmas: [],
  2179. messageSends: ["valuesDo:"]
  2180. }, function ($methodClass){ return function (aBlock){
  2181. var self=this,$self=this;
  2182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2183. return $core.withContext(function($ctx1) {
  2184. //>>excludeEnd("ctx");
  2185. $self._valuesDo_(aBlock);
  2186. return self;
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2189. //>>excludeEnd("ctx");
  2190. }; }),
  2191. $globals.AssociativeCollection);
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "includes:",
  2195. protocol: "enumerating",
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["anObject"],
  2198. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. pragmas: [],
  2202. messageSends: ["includes:", "values"]
  2203. }, function ($methodClass){ return function (anObject){
  2204. var self=this,$self=this;
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return $core.withContext(function($ctx1) {
  2207. //>>excludeEnd("ctx");
  2208. return $recv($self._values())._includes_(anObject);
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2211. //>>excludeEnd("ctx");
  2212. }; }),
  2213. $globals.AssociativeCollection);
  2214. $core.addMethod(
  2215. $core.method({
  2216. selector: "includesKey:",
  2217. protocol: "testing",
  2218. //>>excludeStart("ide", pragmas.excludeIdeData);
  2219. args: ["aKey"],
  2220. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2221. referencedClasses: [],
  2222. //>>excludeEnd("ide");
  2223. pragmas: [],
  2224. messageSends: ["subclassResponsibility"]
  2225. }, function ($methodClass){ return function (aKey){
  2226. var self=this,$self=this;
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. return $core.withContext(function($ctx1) {
  2229. //>>excludeEnd("ctx");
  2230. $self._subclassResponsibility();
  2231. return self;
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2234. //>>excludeEnd("ctx");
  2235. }; }),
  2236. $globals.AssociativeCollection);
  2237. $core.addMethod(
  2238. $core.method({
  2239. selector: "indexOf:ifAbsent:",
  2240. protocol: "accessing",
  2241. //>>excludeStart("ide", pragmas.excludeIdeData);
  2242. args: ["anObject", "aBlock"],
  2243. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2244. referencedClasses: [],
  2245. //>>excludeEnd("ide");
  2246. pragmas: [],
  2247. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2248. }, function ($methodClass){ return function (anObject,aBlock){
  2249. var self=this,$self=this;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. return $recv($self._keys())._detect_ifNone_((function(each){
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. return $core.withContext(function($ctx2) {
  2256. //>>excludeEnd("ctx");
  2257. return $recv($self._at_(each)).__eq(anObject);
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2260. //>>excludeEnd("ctx");
  2261. }),aBlock);
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2264. //>>excludeEnd("ctx");
  2265. }; }),
  2266. $globals.AssociativeCollection);
  2267. $core.addMethod(
  2268. $core.method({
  2269. selector: "keyAtValue:",
  2270. protocol: "accessing",
  2271. //>>excludeStart("ide", pragmas.excludeIdeData);
  2272. args: ["anObject"],
  2273. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2274. referencedClasses: [],
  2275. //>>excludeEnd("ide");
  2276. pragmas: [],
  2277. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2278. }, function ($methodClass){ return function (anObject){
  2279. var self=this,$self=this;
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx1) {
  2282. //>>excludeEnd("ctx");
  2283. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return $core.withContext(function($ctx2) {
  2286. //>>excludeEnd("ctx");
  2287. return $self._errorNotFound();
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2290. //>>excludeEnd("ctx");
  2291. }));
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2294. //>>excludeEnd("ctx");
  2295. }; }),
  2296. $globals.AssociativeCollection);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "keyAtValue:ifAbsent:",
  2300. protocol: "accessing",
  2301. //>>excludeStart("ide", pragmas.excludeIdeData);
  2302. args: ["anObject", "aBlock"],
  2303. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2304. referencedClasses: [],
  2305. //>>excludeEnd("ide");
  2306. pragmas: [],
  2307. messageSends: ["indexOf:ifAbsent:"]
  2308. }, function ($methodClass){ return function (anObject,aBlock){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2315. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2316. //>>excludeEnd("ctx");
  2317. }; }),
  2318. $globals.AssociativeCollection);
  2319. $core.addMethod(
  2320. $core.method({
  2321. selector: "keys",
  2322. protocol: "accessing",
  2323. //>>excludeStart("ide", pragmas.excludeIdeData);
  2324. args: [],
  2325. source: "keys\x0a\x09self subclassResponsibility",
  2326. referencedClasses: [],
  2327. //>>excludeEnd("ide");
  2328. pragmas: [],
  2329. messageSends: ["subclassResponsibility"]
  2330. }, function ($methodClass){ return function (){
  2331. var self=this,$self=this;
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. return $core.withContext(function($ctx1) {
  2334. //>>excludeEnd("ctx");
  2335. $self._subclassResponsibility();
  2336. return self;
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2339. //>>excludeEnd("ctx");
  2340. }; }),
  2341. $globals.AssociativeCollection);
  2342. $core.addMethod(
  2343. $core.method({
  2344. selector: "keysAndValuesDo:",
  2345. protocol: "enumerating",
  2346. //>>excludeStart("ide", pragmas.excludeIdeData);
  2347. args: ["aBlock"],
  2348. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2349. referencedClasses: [],
  2350. //>>excludeEnd("ide");
  2351. pragmas: [],
  2352. messageSends: ["keysDo:", "value:value:", "at:"]
  2353. }, function ($methodClass){ return function (aBlock){
  2354. var self=this,$self=this;
  2355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2356. return $core.withContext(function($ctx1) {
  2357. //>>excludeEnd("ctx");
  2358. $self._keysDo_((function(each){
  2359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2360. return $core.withContext(function($ctx2) {
  2361. //>>excludeEnd("ctx");
  2362. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2365. //>>excludeEnd("ctx");
  2366. }));
  2367. return self;
  2368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2369. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2370. //>>excludeEnd("ctx");
  2371. }; }),
  2372. $globals.AssociativeCollection);
  2373. $core.addMethod(
  2374. $core.method({
  2375. selector: "keysDo:",
  2376. protocol: "enumerating",
  2377. //>>excludeStart("ide", pragmas.excludeIdeData);
  2378. args: ["aBlock"],
  2379. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2380. referencedClasses: [],
  2381. //>>excludeEnd("ide");
  2382. pragmas: [],
  2383. messageSends: ["subclassResponsibility"]
  2384. }, function ($methodClass){ return function (aBlock){
  2385. var self=this,$self=this;
  2386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2387. return $core.withContext(function($ctx1) {
  2388. //>>excludeEnd("ctx");
  2389. $self._subclassResponsibility();
  2390. return self;
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2393. //>>excludeEnd("ctx");
  2394. }; }),
  2395. $globals.AssociativeCollection);
  2396. $core.addMethod(
  2397. $core.method({
  2398. selector: "printOn:",
  2399. protocol: "printing",
  2400. //>>excludeStart("ide", pragmas.excludeIdeData);
  2401. args: ["aStream"],
  2402. 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: ')'",
  2403. referencedClasses: [],
  2404. //>>excludeEnd("ide");
  2405. pragmas: [],
  2406. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2407. }, function ($methodClass){ return function (aStream){
  2408. var self=this,$self=this;
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. return $core.withContext(function($ctx1) {
  2411. //>>excludeEnd("ctx");
  2412. (
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. $ctx1.supercall = true,
  2415. //>>excludeEnd("ctx");
  2416. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream));
  2417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2418. $ctx1.supercall = false;
  2419. //>>excludeEnd("ctx");;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. $ctx1.sendIdx["printOn:"]=1;
  2422. //>>excludeEnd("ctx");
  2423. $recv(aStream)._nextPutAll_(" (");
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. $ctx1.sendIdx["nextPutAll:"]=1;
  2426. //>>excludeEnd("ctx");
  2427. $recv($self._associations())._do_separatedBy_((function(each){
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. return $core.withContext(function($ctx2) {
  2430. //>>excludeEnd("ctx");
  2431. return $recv(each)._printOn_(aStream);
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2434. //>>excludeEnd("ctx");
  2435. }),(function(){
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. return $core.withContext(function($ctx2) {
  2438. //>>excludeEnd("ctx");
  2439. return $recv(aStream)._nextPutAll_(" , ");
  2440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2441. $ctx2.sendIdx["nextPutAll:"]=2;
  2442. //>>excludeEnd("ctx");
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2445. //>>excludeEnd("ctx");
  2446. }));
  2447. $recv(aStream)._nextPutAll_(")");
  2448. return self;
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2451. //>>excludeEnd("ctx");
  2452. }; }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "remove:ifAbsent:",
  2457. protocol: "adding/removing",
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: ["aKey", "aBlock"],
  2460. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2461. referencedClasses: [],
  2462. //>>excludeEnd("ide");
  2463. pragmas: [],
  2464. messageSends: ["removeKey:ifAbsent:"]
  2465. }, function ($methodClass){ return function (aKey,aBlock){
  2466. var self=this,$self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2473. //>>excludeEnd("ctx");
  2474. }; }),
  2475. $globals.AssociativeCollection);
  2476. $core.addMethod(
  2477. $core.method({
  2478. selector: "removeAll",
  2479. protocol: "adding/removing",
  2480. //>>excludeStart("ide", pragmas.excludeIdeData);
  2481. args: [],
  2482. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2483. referencedClasses: [],
  2484. //>>excludeEnd("ide");
  2485. pragmas: [],
  2486. messageSends: ["do:", "keys", "removeKey:"]
  2487. }, function ($methodClass){ return function (){
  2488. var self=this,$self=this;
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. return $core.withContext(function($ctx1) {
  2491. //>>excludeEnd("ctx");
  2492. return $recv($self._keys())._do_((function(each){
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. return $core.withContext(function($ctx2) {
  2495. //>>excludeEnd("ctx");
  2496. return $self._removeKey_(each);
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2499. //>>excludeEnd("ctx");
  2500. }));
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2503. //>>excludeEnd("ctx");
  2504. }; }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "removeKey:",
  2509. protocol: "adding/removing",
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["aKey"],
  2512. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. pragmas: [],
  2516. messageSends: ["remove:"]
  2517. }, function ($methodClass){ return function (aKey){
  2518. var self=this,$self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. return $self._remove_(aKey);
  2523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2524. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2525. //>>excludeEnd("ctx");
  2526. }; }),
  2527. $globals.AssociativeCollection);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "removeKey:ifAbsent:",
  2531. protocol: "adding/removing",
  2532. //>>excludeStart("ide", pragmas.excludeIdeData);
  2533. args: ["aKey", "aBlock"],
  2534. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2535. referencedClasses: [],
  2536. //>>excludeEnd("ide");
  2537. pragmas: [],
  2538. messageSends: ["subclassResponsibility"]
  2539. }, function ($methodClass){ return function (aKey,aBlock){
  2540. var self=this,$self=this;
  2541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2542. return $core.withContext(function($ctx1) {
  2543. //>>excludeEnd("ctx");
  2544. $self._subclassResponsibility();
  2545. return self;
  2546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2547. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2548. //>>excludeEnd("ctx");
  2549. }; }),
  2550. $globals.AssociativeCollection);
  2551. $core.addMethod(
  2552. $core.method({
  2553. selector: "select:",
  2554. protocol: "enumerating",
  2555. //>>excludeStart("ide", pragmas.excludeIdeData);
  2556. args: ["aBlock"],
  2557. 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",
  2558. referencedClasses: [],
  2559. //>>excludeEnd("ide");
  2560. pragmas: [],
  2561. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2562. }, function ($methodClass){ return function (aBlock){
  2563. var self=this,$self=this;
  2564. var newDict;
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. return $core.withContext(function($ctx1) {
  2567. //>>excludeEnd("ctx");
  2568. var $1;
  2569. newDict=$recv($self._class())._new();
  2570. $self._keysAndValuesDo_((function(key,value){
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. return $core.withContext(function($ctx2) {
  2573. //>>excludeEnd("ctx");
  2574. $1=$recv(aBlock)._value_(value);
  2575. if($core.assert($1)){
  2576. return $recv(newDict)._at_put_(key,value);
  2577. }
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2580. //>>excludeEnd("ctx");
  2581. }));
  2582. return newDict;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2585. //>>excludeEnd("ctx");
  2586. }; }),
  2587. $globals.AssociativeCollection);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "select:thenCollect:",
  2591. protocol: "enumerating",
  2592. //>>excludeStart("ide", pragmas.excludeIdeData);
  2593. args: ["selectBlock", "collectBlock"],
  2594. 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",
  2595. referencedClasses: [],
  2596. //>>excludeEnd("ide");
  2597. pragmas: [],
  2598. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2599. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2600. var self=this,$self=this;
  2601. var newDict;
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return $core.withContext(function($ctx1) {
  2604. //>>excludeEnd("ctx");
  2605. var $1;
  2606. newDict=$recv($self._class())._new();
  2607. $self._keysAndValuesDo_((function(key,value){
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. return $core.withContext(function($ctx2) {
  2610. //>>excludeEnd("ctx");
  2611. $1=$recv(selectBlock)._value_(value);
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. $ctx2.sendIdx["value:"]=1;
  2614. //>>excludeEnd("ctx");
  2615. if($core.assert($1)){
  2616. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2617. }
  2618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2619. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2620. //>>excludeEnd("ctx");
  2621. }));
  2622. return newDict;
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2625. //>>excludeEnd("ctx");
  2626. }; }),
  2627. $globals.AssociativeCollection);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "shallowCopy",
  2631. protocol: "copying",
  2632. //>>excludeStart("ide", pragmas.excludeIdeData);
  2633. args: [],
  2634. 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",
  2635. referencedClasses: [],
  2636. //>>excludeEnd("ide");
  2637. pragmas: [],
  2638. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2639. }, function ($methodClass){ return function (){
  2640. var self=this,$self=this;
  2641. var copy;
  2642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2643. return $core.withContext(function($ctx1) {
  2644. //>>excludeEnd("ctx");
  2645. copy=$recv($self._class())._new();
  2646. $self._keysAndValuesDo_((function(key,value){
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx2) {
  2649. //>>excludeEnd("ctx");
  2650. return $recv(copy)._at_put_(key,value);
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2653. //>>excludeEnd("ctx");
  2654. }));
  2655. return copy;
  2656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2657. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2658. //>>excludeEnd("ctx");
  2659. }; }),
  2660. $globals.AssociativeCollection);
  2661. $core.addMethod(
  2662. $core.method({
  2663. selector: "size",
  2664. protocol: "accessing",
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: [],
  2667. source: "size\x0a\x09^ self keys size",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. pragmas: [],
  2671. messageSends: ["size", "keys"]
  2672. }, function ($methodClass){ return function (){
  2673. var self=this,$self=this;
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. return $core.withContext(function($ctx1) {
  2676. //>>excludeEnd("ctx");
  2677. return $recv($self._keys())._size();
  2678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2679. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2680. //>>excludeEnd("ctx");
  2681. }; }),
  2682. $globals.AssociativeCollection);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "values",
  2686. protocol: "accessing",
  2687. //>>excludeStart("ide", pragmas.excludeIdeData);
  2688. args: [],
  2689. source: "values\x0a\x09self subclassResponsibility",
  2690. referencedClasses: [],
  2691. //>>excludeEnd("ide");
  2692. pragmas: [],
  2693. messageSends: ["subclassResponsibility"]
  2694. }, function ($methodClass){ return function (){
  2695. var self=this,$self=this;
  2696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2697. return $core.withContext(function($ctx1) {
  2698. //>>excludeEnd("ctx");
  2699. $self._subclassResponsibility();
  2700. return self;
  2701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2702. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2703. //>>excludeEnd("ctx");
  2704. }; }),
  2705. $globals.AssociativeCollection);
  2706. $core.addMethod(
  2707. $core.method({
  2708. selector: "valuesDo:",
  2709. protocol: "enumerating",
  2710. //>>excludeStart("ide", pragmas.excludeIdeData);
  2711. args: ["aBlock"],
  2712. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2713. referencedClasses: [],
  2714. //>>excludeEnd("ide");
  2715. pragmas: [],
  2716. messageSends: ["subclassResponsibility"]
  2717. }, function ($methodClass){ return function (aBlock){
  2718. var self=this,$self=this;
  2719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2720. return $core.withContext(function($ctx1) {
  2721. //>>excludeEnd("ctx");
  2722. $self._subclassResponsibility();
  2723. return self;
  2724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2725. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2726. //>>excludeEnd("ctx");
  2727. }; }),
  2728. $globals.AssociativeCollection);
  2729. $core.addMethod(
  2730. $core.method({
  2731. selector: "withIndexDo:",
  2732. protocol: "enumerating",
  2733. //>>excludeStart("ide", pragmas.excludeIdeData);
  2734. args: ["aBlock"],
  2735. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2736. referencedClasses: [],
  2737. //>>excludeEnd("ide");
  2738. pragmas: [],
  2739. messageSends: ["keysAndValuesDo:", "value:value:"]
  2740. }, function ($methodClass){ return function (aBlock){
  2741. var self=this,$self=this;
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. return $core.withContext(function($ctx1) {
  2744. //>>excludeEnd("ctx");
  2745. $self._keysAndValuesDo_((function(key,value){
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. return $core.withContext(function($ctx2) {
  2748. //>>excludeEnd("ctx");
  2749. return $recv(aBlock)._value_value_(value,key);
  2750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2751. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2752. //>>excludeEnd("ctx");
  2753. }));
  2754. return self;
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2757. //>>excludeEnd("ctx");
  2758. }; }),
  2759. $globals.AssociativeCollection);
  2760. $core.addMethod(
  2761. $core.method({
  2762. selector: "from:",
  2763. protocol: "instance creation",
  2764. //>>excludeStart("ide", pragmas.excludeIdeData);
  2765. args: ["aCollection"],
  2766. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2767. referencedClasses: [],
  2768. //>>excludeEnd("ide");
  2769. pragmas: [],
  2770. messageSends: ["new", "do:", "add:"]
  2771. }, function ($methodClass){ return function (aCollection){
  2772. var self=this,$self=this;
  2773. var newCollection;
  2774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2775. return $core.withContext(function($ctx1) {
  2776. //>>excludeEnd("ctx");
  2777. newCollection=$self._new();
  2778. $recv(aCollection)._do_((function(each){
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx2) {
  2781. //>>excludeEnd("ctx");
  2782. return $recv(newCollection)._add_(each);
  2783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2785. //>>excludeEnd("ctx");
  2786. }));
  2787. return newCollection;
  2788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2789. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2790. //>>excludeEnd("ctx");
  2791. }; }),
  2792. $globals.AssociativeCollection.a$cls);
  2793. $core.addMethod(
  2794. $core.method({
  2795. selector: "fromPairs:",
  2796. protocol: "instance creation",
  2797. //>>excludeStart("ide", pragmas.excludeIdeData);
  2798. args: ["aCollection"],
  2799. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2800. referencedClasses: [],
  2801. //>>excludeEnd("ide");
  2802. pragmas: [],
  2803. messageSends: ["from:"]
  2804. }, function ($methodClass){ return function (aCollection){
  2805. var self=this,$self=this;
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. return $core.withContext(function($ctx1) {
  2808. //>>excludeEnd("ctx");
  2809. return $self._from_(aCollection);
  2810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2811. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2812. //>>excludeEnd("ctx");
  2813. }; }),
  2814. $globals.AssociativeCollection.a$cls);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "newFromPairs:",
  2818. protocol: "instance creation",
  2819. //>>excludeStart("ide", pragmas.excludeIdeData);
  2820. args: ["aCollection"],
  2821. 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",
  2822. referencedClasses: [],
  2823. //>>excludeEnd("ide");
  2824. pragmas: [],
  2825. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2826. }, function ($methodClass){ return function (aCollection){
  2827. var self=this,$self=this;
  2828. var newCollection;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. return $core.withContext(function($ctx1) {
  2831. //>>excludeEnd("ctx");
  2832. var $2,$1,$3,$4;
  2833. $2=$recv(aCollection)._size();
  2834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2835. $ctx1.sendIdx["size"]=1;
  2836. //>>excludeEnd("ctx");
  2837. $1=$recv($2)._even();
  2838. if(!$core.assert($1)){
  2839. $self._error_("#newFromPairs only accepts arrays of an even length");
  2840. }
  2841. newCollection=$self._new();
  2842. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. return $core.withContext(function($ctx2) {
  2845. //>>excludeEnd("ctx");
  2846. $3=newCollection;
  2847. $4=$recv(aCollection)._at_(each);
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. $ctx2.sendIdx["at:"]=1;
  2850. //>>excludeEnd("ctx");
  2851. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2854. //>>excludeEnd("ctx");
  2855. }));
  2856. return newCollection;
  2857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2858. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2859. //>>excludeEnd("ctx");
  2860. }; }),
  2861. $globals.AssociativeCollection.a$cls);
  2862. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2863. //>>excludeStart("ide", pragmas.excludeIdeData);
  2864. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  2865. //>>excludeEnd("ide");
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "at:ifAbsent:",
  2869. protocol: "accessing",
  2870. //>>excludeStart("ide", pragmas.excludeIdeData);
  2871. args: ["aKey", "aBlock"],
  2872. 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'>",
  2873. referencedClasses: [],
  2874. //>>excludeEnd("ide");
  2875. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2876. messageSends: []
  2877. }, function ($methodClass){ return function (aKey,aBlock){
  2878. var self=this,$self=this;
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. return $core.withContext(function($ctx1) {
  2881. //>>excludeEnd("ctx");
  2882. var index = $self._positionOfKey_(aKey);
  2883. return index >=0 ? $self.values[index] : aBlock._value();
  2884. ;
  2885. return self;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2888. //>>excludeEnd("ctx");
  2889. }; }),
  2890. $globals.Dictionary);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "at:put:",
  2894. protocol: "accessing",
  2895. //>>excludeStart("ide", pragmas.excludeIdeData);
  2896. args: ["aKey", "aValue"],
  2897. 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'>",
  2898. referencedClasses: [],
  2899. //>>excludeEnd("ide");
  2900. 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"]]],
  2901. messageSends: []
  2902. }, function ($methodClass){ return function (aKey,aValue){
  2903. var self=this,$self=this;
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. return $core.withContext(function($ctx1) {
  2906. //>>excludeEnd("ctx");
  2907. var index = $self._positionOfKey_(aKey);
  2908. if(index === -1) {
  2909. var keys = $self.keys;
  2910. index = keys.length;
  2911. keys.push(aKey);
  2912. }
  2913. return $self.values[index] = aValue;
  2914. ;
  2915. return self;
  2916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2917. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2918. //>>excludeEnd("ctx");
  2919. }; }),
  2920. $globals.Dictionary);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "includesKey:",
  2924. protocol: "testing",
  2925. //>>excludeStart("ide", pragmas.excludeIdeData);
  2926. args: ["aKey"],
  2927. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2928. referencedClasses: [],
  2929. //>>excludeEnd("ide");
  2930. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2931. messageSends: []
  2932. }, function ($methodClass){ return function (aKey){
  2933. var self=this,$self=this;
  2934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2935. return $core.withContext(function($ctx1) {
  2936. //>>excludeEnd("ctx");
  2937. return $self._positionOfKey_(aKey) >= 0;;
  2938. return self;
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2941. //>>excludeEnd("ctx");
  2942. }; }),
  2943. $globals.Dictionary);
  2944. $core.addMethod(
  2945. $core.method({
  2946. selector: "indexOf:ifAbsent:",
  2947. protocol: "accessing",
  2948. //>>excludeStart("ide", pragmas.excludeIdeData);
  2949. args: ["anObject", "aBlock"],
  2950. 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 ]",
  2951. referencedClasses: [],
  2952. //>>excludeEnd("ide");
  2953. pragmas: [],
  2954. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2955. }, function ($methodClass){ return function (anObject,aBlock){
  2956. var self=this,$self=this;
  2957. var index;
  2958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2959. return $core.withContext(function($ctx1) {
  2960. //>>excludeEnd("ctx");
  2961. var $1;
  2962. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2963. return (0);
  2964. }));
  2965. $1=$recv(index).__eq((0));
  2966. if($core.assert($1)){
  2967. return $recv(aBlock)._value();
  2968. } else {
  2969. return $recv($self.keys)._at_(index);
  2970. }
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2973. //>>excludeEnd("ctx");
  2974. }; }),
  2975. $globals.Dictionary);
  2976. $core.addMethod(
  2977. $core.method({
  2978. selector: "initialize",
  2979. protocol: "initialization",
  2980. //>>excludeStart("ide", pragmas.excludeIdeData);
  2981. args: [],
  2982. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2983. referencedClasses: [],
  2984. //>>excludeEnd("ide");
  2985. pragmas: [],
  2986. messageSends: ["initialize"]
  2987. }, function ($methodClass){ return function (){
  2988. var self=this,$self=this;
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. return $core.withContext(function($ctx1) {
  2991. //>>excludeEnd("ctx");
  2992. (
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. $ctx1.supercall = true,
  2995. //>>excludeEnd("ctx");
  2996. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. $ctx1.supercall = false;
  2999. //>>excludeEnd("ctx");;
  3000. $self.keys=[];
  3001. $self.values=[];
  3002. return self;
  3003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3004. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3005. //>>excludeEnd("ctx");
  3006. }; }),
  3007. $globals.Dictionary);
  3008. $core.addMethod(
  3009. $core.method({
  3010. selector: "keys",
  3011. protocol: "accessing",
  3012. //>>excludeStart("ide", pragmas.excludeIdeData);
  3013. args: [],
  3014. source: "keys\x0a\x09^ keys copy",
  3015. referencedClasses: [],
  3016. //>>excludeEnd("ide");
  3017. pragmas: [],
  3018. messageSends: ["copy"]
  3019. }, function ($methodClass){ return function (){
  3020. var self=this,$self=this;
  3021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3022. return $core.withContext(function($ctx1) {
  3023. //>>excludeEnd("ctx");
  3024. return $recv($self.keys)._copy();
  3025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3026. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3027. //>>excludeEnd("ctx");
  3028. }; }),
  3029. $globals.Dictionary);
  3030. $core.addMethod(
  3031. $core.method({
  3032. selector: "keysAndValuesDo:",
  3033. protocol: "enumerating",
  3034. //>>excludeStart("ide", pragmas.excludeIdeData);
  3035. args: ["aBlock"],
  3036. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3037. referencedClasses: [],
  3038. //>>excludeEnd("ide");
  3039. pragmas: [],
  3040. messageSends: ["with:do:"]
  3041. }, function ($methodClass){ return function (aBlock){
  3042. var self=this,$self=this;
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. return $core.withContext(function($ctx1) {
  3045. //>>excludeEnd("ctx");
  3046. return $recv($self.keys)._with_do_($self.values,aBlock);
  3047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3048. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3049. //>>excludeEnd("ctx");
  3050. }; }),
  3051. $globals.Dictionary);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "keysDo:",
  3055. protocol: "enumerating",
  3056. //>>excludeStart("ide", pragmas.excludeIdeData);
  3057. args: ["aBlock"],
  3058. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3059. referencedClasses: [],
  3060. //>>excludeEnd("ide");
  3061. pragmas: [],
  3062. messageSends: ["do:"]
  3063. }, function ($methodClass){ return function (aBlock){
  3064. var self=this,$self=this;
  3065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3066. return $core.withContext(function($ctx1) {
  3067. //>>excludeEnd("ctx");
  3068. return $recv($self.keys)._do_(aBlock);
  3069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3070. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3071. //>>excludeEnd("ctx");
  3072. }; }),
  3073. $globals.Dictionary);
  3074. $core.addMethod(
  3075. $core.method({
  3076. selector: "positionOfKey:",
  3077. protocol: "private",
  3078. //>>excludeStart("ide", pragmas.excludeIdeData);
  3079. args: ["anObject"],
  3080. 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'>",
  3081. referencedClasses: [],
  3082. //>>excludeEnd("ide");
  3083. 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"]]],
  3084. messageSends: []
  3085. }, function ($methodClass){ return function (anObject){
  3086. var self=this,$self=this;
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. return $core.withContext(function($ctx1) {
  3089. //>>excludeEnd("ctx");
  3090. var keys = $self.keys;
  3091. for(var i=0;i<keys.length;i++){
  3092. if(keys[i].__eq(anObject)) { return i;}
  3093. }
  3094. return -1;
  3095. ;
  3096. return self;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3099. //>>excludeEnd("ctx");
  3100. }; }),
  3101. $globals.Dictionary);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "removeAll",
  3105. protocol: "adding/removing",
  3106. //>>excludeStart("ide", pragmas.excludeIdeData);
  3107. args: [],
  3108. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3109. referencedClasses: [],
  3110. //>>excludeEnd("ide");
  3111. pragmas: [],
  3112. messageSends: ["removeAll"]
  3113. }, function ($methodClass){ return function (){
  3114. var self=this,$self=this;
  3115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3116. return $core.withContext(function($ctx1) {
  3117. //>>excludeEnd("ctx");
  3118. $recv($self.keys)._removeAll();
  3119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3120. $ctx1.sendIdx["removeAll"]=1;
  3121. //>>excludeEnd("ctx");
  3122. $recv($self.values)._removeAll();
  3123. return self;
  3124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3125. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3126. //>>excludeEnd("ctx");
  3127. }; }),
  3128. $globals.Dictionary);
  3129. $core.addMethod(
  3130. $core.method({
  3131. selector: "removeKey:ifAbsent:",
  3132. protocol: "adding/removing",
  3133. //>>excludeStart("ide", pragmas.excludeIdeData);
  3134. args: ["aKey", "aBlock"],
  3135. 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'>",
  3136. referencedClasses: [],
  3137. //>>excludeEnd("ide");
  3138. 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"]]],
  3139. messageSends: []
  3140. }, function ($methodClass){ return function (aKey,aBlock){
  3141. var self=this,$self=this;
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. return $core.withContext(function($ctx1) {
  3144. //>>excludeEnd("ctx");
  3145. var index = $self._positionOfKey_(aKey);
  3146. if(index === -1) {
  3147. return aBlock._value()
  3148. } else {
  3149. var keys = $self.keys, values = $self.values;
  3150. var value = values[index], l = keys.length;
  3151. keys[index] = keys[l-1];
  3152. keys.pop();
  3153. values[index] = values[l-1];
  3154. values.pop();
  3155. return value;
  3156. }
  3157. ;
  3158. return self;
  3159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3160. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3161. //>>excludeEnd("ctx");
  3162. }; }),
  3163. $globals.Dictionary);
  3164. $core.addMethod(
  3165. $core.method({
  3166. selector: "values",
  3167. protocol: "accessing",
  3168. //>>excludeStart("ide", pragmas.excludeIdeData);
  3169. args: [],
  3170. source: "values\x0a\x09^ values",
  3171. referencedClasses: [],
  3172. //>>excludeEnd("ide");
  3173. pragmas: [],
  3174. messageSends: []
  3175. }, function ($methodClass){ return function (){
  3176. var self=this,$self=this;
  3177. return $self.values;
  3178. }; }),
  3179. $globals.Dictionary);
  3180. $core.addMethod(
  3181. $core.method({
  3182. selector: "valuesDo:",
  3183. protocol: "enumerating",
  3184. //>>excludeStart("ide", pragmas.excludeIdeData);
  3185. args: ["aBlock"],
  3186. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3187. referencedClasses: [],
  3188. //>>excludeEnd("ide");
  3189. pragmas: [],
  3190. messageSends: ["do:"]
  3191. }, function ($methodClass){ return function (aBlock){
  3192. var self=this,$self=this;
  3193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3194. return $core.withContext(function($ctx1) {
  3195. //>>excludeEnd("ctx");
  3196. return $recv($self.values)._do_(aBlock);
  3197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3198. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3199. //>>excludeEnd("ctx");
  3200. }; }),
  3201. $globals.Dictionary);
  3202. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3203. //>>excludeStart("ide", pragmas.excludeIdeData);
  3204. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3205. //>>excludeEnd("ide");
  3206. $core.addMethod(
  3207. $core.method({
  3208. selector: "asJavaScriptSource",
  3209. protocol: "accessing",
  3210. //>>excludeStart("ide", pragmas.excludeIdeData);
  3211. args: [],
  3212. 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: '}' ]",
  3213. referencedClasses: ["String"],
  3214. //>>excludeEnd("ide");
  3215. pragmas: [],
  3216. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3217. }, function ($methodClass){ return function (){
  3218. var self=this,$self=this;
  3219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3220. return $core.withContext(function($ctx1) {
  3221. //>>excludeEnd("ctx");
  3222. var $1;
  3223. return $recv($globals.String)._streamContents_((function(str){
  3224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3225. return $core.withContext(function($ctx2) {
  3226. //>>excludeEnd("ctx");
  3227. $recv(str)._nextPut_("{");
  3228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3229. $ctx2.sendIdx["nextPut:"]=1;
  3230. //>>excludeEnd("ctx");
  3231. $self._keysAndValuesDo_((function(key,value){
  3232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3233. return $core.withContext(function($ctx3) {
  3234. //>>excludeEnd("ctx");
  3235. $1=$recv(key)._asJavaScriptSource();
  3236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3237. $ctx3.sendIdx["asJavaScriptSource"]=1;
  3238. //>>excludeEnd("ctx");
  3239. $recv(str)._nextPutAll_($1);
  3240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3241. $ctx3.sendIdx["nextPutAll:"]=1;
  3242. //>>excludeEnd("ctx");
  3243. $recv(str)._nextPut_(":");
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. $ctx3.sendIdx["nextPut:"]=2;
  3246. //>>excludeEnd("ctx");
  3247. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3248. return $recv(str)._nextPut_(",");
  3249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3250. $ctx3.sendIdx["nextPut:"]=3;
  3251. //>>excludeEnd("ctx");
  3252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3253. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3254. //>>excludeEnd("ctx");
  3255. }));
  3256. $recv(str)._skip_((-1));
  3257. return $recv(str)._nextPut_("}");
  3258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3259. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3260. //>>excludeEnd("ctx");
  3261. }));
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3264. //>>excludeEnd("ctx");
  3265. }; }),
  3266. $globals.HashedCollection);
  3267. $core.addMethod(
  3268. $core.method({
  3269. selector: "at:ifAbsent:",
  3270. protocol: "accessing",
  3271. //>>excludeStart("ide", pragmas.excludeIdeData);
  3272. args: ["aKey", "aBlock"],
  3273. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3274. referencedClasses: [],
  3275. //>>excludeEnd("ide");
  3276. pragmas: [],
  3277. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3278. }, function ($methodClass){ return function (aKey,aBlock){
  3279. var self=this,$self=this;
  3280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3281. return $core.withContext(function($ctx1) {
  3282. //>>excludeEnd("ctx");
  3283. var $1;
  3284. $1=$self._includesKey_(aKey);
  3285. if($core.assert($1)){
  3286. return $self._basicAt_(aKey);
  3287. } else {
  3288. return $recv(aBlock)._value();
  3289. }
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3292. //>>excludeEnd("ctx");
  3293. }; }),
  3294. $globals.HashedCollection);
  3295. $core.addMethod(
  3296. $core.method({
  3297. selector: "at:put:",
  3298. protocol: "accessing",
  3299. //>>excludeStart("ide", pragmas.excludeIdeData);
  3300. args: ["aKey", "aValue"],
  3301. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3302. referencedClasses: [],
  3303. //>>excludeEnd("ide");
  3304. pragmas: [],
  3305. messageSends: ["basicAt:put:"]
  3306. }, function ($methodClass){ return function (aKey,aValue){
  3307. var self=this,$self=this;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. return $core.withContext(function($ctx1) {
  3310. //>>excludeEnd("ctx");
  3311. return $self._basicAt_put_(aKey,aValue);
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3314. //>>excludeEnd("ctx");
  3315. }; }),
  3316. $globals.HashedCollection);
  3317. $core.addMethod(
  3318. $core.method({
  3319. selector: "includesKey:",
  3320. protocol: "testing",
  3321. //>>excludeStart("ide", pragmas.excludeIdeData);
  3322. args: ["aKey"],
  3323. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3324. referencedClasses: [],
  3325. //>>excludeEnd("ide");
  3326. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3327. messageSends: []
  3328. }, function ($methodClass){ return function (aKey){
  3329. var self=this,$self=this;
  3330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3331. return $core.withContext(function($ctx1) {
  3332. //>>excludeEnd("ctx");
  3333. return self.hasOwnProperty(aKey);
  3334. return self;
  3335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3336. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3337. //>>excludeEnd("ctx");
  3338. }; }),
  3339. $globals.HashedCollection);
  3340. $core.addMethod(
  3341. $core.method({
  3342. selector: "keys",
  3343. protocol: "accessing",
  3344. //>>excludeStart("ide", pragmas.excludeIdeData);
  3345. args: [],
  3346. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3347. referencedClasses: [],
  3348. //>>excludeEnd("ide");
  3349. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3350. messageSends: []
  3351. }, function ($methodClass){ return function (){
  3352. var self=this,$self=this;
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. return $core.withContext(function($ctx1) {
  3355. //>>excludeEnd("ctx");
  3356. return Object.keys(self);
  3357. return self;
  3358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3359. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3360. //>>excludeEnd("ctx");
  3361. }; }),
  3362. $globals.HashedCollection);
  3363. $core.addMethod(
  3364. $core.method({
  3365. selector: "keysDo:",
  3366. protocol: "enumerating",
  3367. //>>excludeStart("ide", pragmas.excludeIdeData);
  3368. args: ["aBlock"],
  3369. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3370. referencedClasses: [],
  3371. //>>excludeEnd("ide");
  3372. pragmas: [],
  3373. messageSends: ["do:", "keys"]
  3374. }, function ($methodClass){ return function (aBlock){
  3375. var self=this,$self=this;
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return $core.withContext(function($ctx1) {
  3378. //>>excludeEnd("ctx");
  3379. $recv($self._keys())._do_(aBlock);
  3380. return self;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3383. //>>excludeEnd("ctx");
  3384. }; }),
  3385. $globals.HashedCollection);
  3386. $core.addMethod(
  3387. $core.method({
  3388. selector: "removeKey:ifAbsent:",
  3389. protocol: "adding/removing",
  3390. //>>excludeStart("ide", pragmas.excludeIdeData);
  3391. args: ["aKey", "aBlock"],
  3392. 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 ]",
  3393. referencedClasses: [],
  3394. //>>excludeEnd("ide");
  3395. pragmas: [],
  3396. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3397. }, function ($methodClass){ return function (aKey,aBlock){
  3398. var self=this,$self=this;
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. return $core.withContext(function($ctx1) {
  3401. //>>excludeEnd("ctx");
  3402. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3404. return $core.withContext(function($ctx2) {
  3405. //>>excludeEnd("ctx");
  3406. $self._basicDelete_(aKey);
  3407. return removed;
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3410. //>>excludeEnd("ctx");
  3411. }),(function(){
  3412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3413. return $core.withContext(function($ctx2) {
  3414. //>>excludeEnd("ctx");
  3415. return $recv(aBlock)._value();
  3416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3418. //>>excludeEnd("ctx");
  3419. }));
  3420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3421. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3422. //>>excludeEnd("ctx");
  3423. }; }),
  3424. $globals.HashedCollection);
  3425. $core.addMethod(
  3426. $core.method({
  3427. selector: "values",
  3428. protocol: "accessing",
  3429. //>>excludeStart("ide", pragmas.excludeIdeData);
  3430. args: [],
  3431. 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'>",
  3432. referencedClasses: [],
  3433. //>>excludeEnd("ide");
  3434. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3435. messageSends: []
  3436. }, function ($methodClass){ return function (){
  3437. var self=this,$self=this;
  3438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3439. return $core.withContext(function($ctx1) {
  3440. //>>excludeEnd("ctx");
  3441. return $self._keys().map(function(key){
  3442. return $self._at_(key);
  3443. });
  3444. ;
  3445. return self;
  3446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3447. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3448. //>>excludeEnd("ctx");
  3449. }; }),
  3450. $globals.HashedCollection);
  3451. $core.addMethod(
  3452. $core.method({
  3453. selector: "valuesDo:",
  3454. protocol: "enumerating",
  3455. //>>excludeStart("ide", pragmas.excludeIdeData);
  3456. args: ["aBlock"],
  3457. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3458. referencedClasses: [],
  3459. //>>excludeEnd("ide");
  3460. pragmas: [],
  3461. messageSends: ["do:", "values"]
  3462. }, function ($methodClass){ return function (aBlock){
  3463. var self=this,$self=this;
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. return $core.withContext(function($ctx1) {
  3466. //>>excludeEnd("ctx");
  3467. $recv($self._values())._do_(aBlock);
  3468. return self;
  3469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3470. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3471. //>>excludeEnd("ctx");
  3472. }; }),
  3473. $globals.HashedCollection);
  3474. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3475. //>>excludeStart("ide", pragmas.excludeIdeData);
  3476. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3477. //>>excludeEnd("ide");
  3478. $core.addMethod(
  3479. $core.method({
  3480. selector: "=",
  3481. protocol: "comparing",
  3482. //>>excludeStart("ide", pragmas.excludeIdeData);
  3483. args: ["aCollection"],
  3484. 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",
  3485. referencedClasses: [],
  3486. //>>excludeEnd("ide");
  3487. pragmas: [],
  3488. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3489. }, function ($methodClass){ return function (aCollection){
  3490. var self=this,$self=this;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return $core.withContext(function($ctx1) {
  3493. //>>excludeEnd("ctx");
  3494. var $3,$2,$4,$1,$5;
  3495. var $early={};
  3496. try {
  3497. $3=$self._class();
  3498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3499. $ctx1.sendIdx["class"]=1;
  3500. //>>excludeEnd("ctx");
  3501. $2=$recv($3).__eq($recv(aCollection)._class());
  3502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3503. $ctx1.sendIdx["="]=1;
  3504. //>>excludeEnd("ctx");
  3505. $1=$recv($2)._and_((function(){
  3506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3507. return $core.withContext(function($ctx2) {
  3508. //>>excludeEnd("ctx");
  3509. $4=$self._size();
  3510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3511. $ctx2.sendIdx["size"]=1;
  3512. //>>excludeEnd("ctx");
  3513. return $recv($4).__eq($recv(aCollection)._size());
  3514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3515. $ctx2.sendIdx["="]=2;
  3516. //>>excludeEnd("ctx");
  3517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3519. //>>excludeEnd("ctx");
  3520. }));
  3521. if(!$core.assert($1)){
  3522. return false;
  3523. }
  3524. $self._withIndexDo_((function(each,i){
  3525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3526. return $core.withContext(function($ctx2) {
  3527. //>>excludeEnd("ctx");
  3528. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3529. if(!$core.assert($5)){
  3530. throw $early=[false];
  3531. }
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3534. //>>excludeEnd("ctx");
  3535. }));
  3536. return true;
  3537. }
  3538. catch(e) {if(e===$early)return e[0]; throw e}
  3539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3540. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3541. //>>excludeEnd("ctx");
  3542. }; }),
  3543. $globals.SequenceableCollection);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "addLast:",
  3547. protocol: "adding/removing",
  3548. //>>excludeStart("ide", pragmas.excludeIdeData);
  3549. args: ["anObject"],
  3550. source: "addLast: anObject\x0a\x09self add: anObject",
  3551. referencedClasses: [],
  3552. //>>excludeEnd("ide");
  3553. pragmas: [],
  3554. messageSends: ["add:"]
  3555. }, function ($methodClass){ return function (anObject){
  3556. var self=this,$self=this;
  3557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3558. return $core.withContext(function($ctx1) {
  3559. //>>excludeEnd("ctx");
  3560. $self._add_(anObject);
  3561. return self;
  3562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3563. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3564. //>>excludeEnd("ctx");
  3565. }; }),
  3566. $globals.SequenceableCollection);
  3567. $core.addMethod(
  3568. $core.method({
  3569. selector: "allButFirst",
  3570. protocol: "accessing",
  3571. //>>excludeStart("ide", pragmas.excludeIdeData);
  3572. args: [],
  3573. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3574. referencedClasses: [],
  3575. //>>excludeEnd("ide");
  3576. pragmas: [],
  3577. messageSends: ["copyFrom:to:", "size"]
  3578. }, function ($methodClass){ return function (){
  3579. var self=this,$self=this;
  3580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3581. return $core.withContext(function($ctx1) {
  3582. //>>excludeEnd("ctx");
  3583. return $self._copyFrom_to_((2),$self._size());
  3584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3585. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3586. //>>excludeEnd("ctx");
  3587. }; }),
  3588. $globals.SequenceableCollection);
  3589. $core.addMethod(
  3590. $core.method({
  3591. selector: "allButLast",
  3592. protocol: "accessing",
  3593. //>>excludeStart("ide", pragmas.excludeIdeData);
  3594. args: [],
  3595. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3596. referencedClasses: [],
  3597. //>>excludeEnd("ide");
  3598. pragmas: [],
  3599. messageSends: ["copyFrom:to:", "-", "size"]
  3600. }, function ($methodClass){ return function (){
  3601. var self=this,$self=this;
  3602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3603. return $core.withContext(function($ctx1) {
  3604. //>>excludeEnd("ctx");
  3605. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3607. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3608. //>>excludeEnd("ctx");
  3609. }; }),
  3610. $globals.SequenceableCollection);
  3611. $core.addMethod(
  3612. $core.method({
  3613. selector: "anyOne",
  3614. protocol: "accessing",
  3615. //>>excludeStart("ide", pragmas.excludeIdeData);
  3616. args: [],
  3617. source: "anyOne\x0a\x09^ self at: 1",
  3618. referencedClasses: [],
  3619. //>>excludeEnd("ide");
  3620. pragmas: [],
  3621. messageSends: ["at:"]
  3622. }, function ($methodClass){ return function (){
  3623. var self=this,$self=this;
  3624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3625. return $core.withContext(function($ctx1) {
  3626. //>>excludeEnd("ctx");
  3627. return $self._at_((1));
  3628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3629. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3630. //>>excludeEnd("ctx");
  3631. }; }),
  3632. $globals.SequenceableCollection);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "atRandom",
  3636. protocol: "accessing",
  3637. //>>excludeStart("ide", pragmas.excludeIdeData);
  3638. args: [],
  3639. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3640. referencedClasses: [],
  3641. //>>excludeEnd("ide");
  3642. pragmas: [],
  3643. messageSends: ["at:", "atRandom", "size"]
  3644. }, function ($methodClass){ return function (){
  3645. var self=this,$self=this;
  3646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3647. return $core.withContext(function($ctx1) {
  3648. //>>excludeEnd("ctx");
  3649. return $self._at_($recv($self._size())._atRandom());
  3650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3651. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3652. //>>excludeEnd("ctx");
  3653. }; }),
  3654. $globals.SequenceableCollection);
  3655. $core.addMethod(
  3656. $core.method({
  3657. selector: "beginsWith:",
  3658. protocol: "testing",
  3659. //>>excludeStart("ide", pragmas.excludeIdeData);
  3660. args: ["prefix"],
  3661. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3662. referencedClasses: [],
  3663. //>>excludeEnd("ide");
  3664. pragmas: [],
  3665. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3666. }, function ($methodClass){ return function (prefix){
  3667. var self=this,$self=this;
  3668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3669. return $core.withContext(function($ctx1) {
  3670. //>>excludeEnd("ctx");
  3671. var $2,$3,$1;
  3672. $2=$self._size();
  3673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3674. $ctx1.sendIdx["size"]=1;
  3675. //>>excludeEnd("ctx");
  3676. $3=$recv(prefix)._size();
  3677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3678. $ctx1.sendIdx["size"]=2;
  3679. //>>excludeEnd("ctx");
  3680. $1=$recv($2).__lt($3);
  3681. if($core.assert($1)){
  3682. return false;
  3683. }
  3684. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3686. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3687. //>>excludeEnd("ctx");
  3688. }; }),
  3689. $globals.SequenceableCollection);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "copyFrom:to:",
  3693. protocol: "copying",
  3694. //>>excludeStart("ide", pragmas.excludeIdeData);
  3695. args: ["anIndex", "anotherIndex"],
  3696. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3697. referencedClasses: [],
  3698. //>>excludeEnd("ide");
  3699. pragmas: [],
  3700. messageSends: ["subclassResponsibility"]
  3701. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3702. var self=this,$self=this;
  3703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3704. return $core.withContext(function($ctx1) {
  3705. //>>excludeEnd("ctx");
  3706. $self._subclassResponsibility();
  3707. return self;
  3708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3709. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3710. //>>excludeEnd("ctx");
  3711. }; }),
  3712. $globals.SequenceableCollection);
  3713. $core.addMethod(
  3714. $core.method({
  3715. selector: "copyWithFirst:",
  3716. protocol: "copying",
  3717. //>>excludeStart("ide", pragmas.excludeIdeData);
  3718. args: ["anObject"],
  3719. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3720. referencedClasses: [],
  3721. //>>excludeEnd("ide");
  3722. pragmas: [],
  3723. messageSends: ["addAll:", "with:", "class", "yourself"]
  3724. }, function ($methodClass){ return function (anObject){
  3725. var self=this,$self=this;
  3726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3727. return $core.withContext(function($ctx1) {
  3728. //>>excludeEnd("ctx");
  3729. var $1;
  3730. $1=$recv($self._class())._with_(anObject);
  3731. $recv($1)._addAll_(self);
  3732. return $recv($1)._yourself();
  3733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3734. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3735. //>>excludeEnd("ctx");
  3736. }; }),
  3737. $globals.SequenceableCollection);
  3738. $core.addMethod(
  3739. $core.method({
  3740. selector: "endsWith:",
  3741. protocol: "testing",
  3742. //>>excludeStart("ide", pragmas.excludeIdeData);
  3743. args: ["suffix"],
  3744. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3745. referencedClasses: [],
  3746. //>>excludeEnd("ide");
  3747. pragmas: [],
  3748. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3749. }, function ($methodClass){ return function (suffix){
  3750. var self=this,$self=this;
  3751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3752. return $core.withContext(function($ctx1) {
  3753. //>>excludeEnd("ctx");
  3754. var $2,$3,$1;
  3755. $2=$self._size();
  3756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3757. $ctx1.sendIdx["size"]=1;
  3758. //>>excludeEnd("ctx");
  3759. $3=$recv(suffix)._size();
  3760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3761. $ctx1.sendIdx["size"]=2;
  3762. //>>excludeEnd("ctx");
  3763. $1=$recv($2).__lt($3);
  3764. if($core.assert($1)){
  3765. return false;
  3766. }
  3767. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3769. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3770. //>>excludeEnd("ctx");
  3771. }; }),
  3772. $globals.SequenceableCollection);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "first",
  3776. protocol: "accessing",
  3777. //>>excludeStart("ide", pragmas.excludeIdeData);
  3778. args: [],
  3779. source: "first\x0a\x09^ self at: 1",
  3780. referencedClasses: [],
  3781. //>>excludeEnd("ide");
  3782. pragmas: [],
  3783. messageSends: ["at:"]
  3784. }, function ($methodClass){ return function (){
  3785. var self=this,$self=this;
  3786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3787. return $core.withContext(function($ctx1) {
  3788. //>>excludeEnd("ctx");
  3789. return $self._at_((1));
  3790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3791. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3792. //>>excludeEnd("ctx");
  3793. }; }),
  3794. $globals.SequenceableCollection);
  3795. $core.addMethod(
  3796. $core.method({
  3797. selector: "first:",
  3798. protocol: "accessing",
  3799. //>>excludeStart("ide", pragmas.excludeIdeData);
  3800. args: ["aNumber"],
  3801. 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",
  3802. referencedClasses: [],
  3803. //>>excludeEnd("ide");
  3804. pragmas: [],
  3805. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3806. }, function ($methodClass){ return function (aNumber){
  3807. var self=this,$self=this;
  3808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3809. return $core.withContext(function($ctx1) {
  3810. //>>excludeEnd("ctx");
  3811. var $1;
  3812. $1=$recv($self._size()).__lt(aNumber);
  3813. if($core.assert($1)){
  3814. $self._error_("Invalid number of elements");
  3815. }
  3816. return $self._copyFrom_to_((1),aNumber);
  3817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3818. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3819. //>>excludeEnd("ctx");
  3820. }; }),
  3821. $globals.SequenceableCollection);
  3822. $core.addMethod(
  3823. $core.method({
  3824. selector: "fourth",
  3825. protocol: "accessing",
  3826. //>>excludeStart("ide", pragmas.excludeIdeData);
  3827. args: [],
  3828. source: "fourth\x0a\x09^ self at: 4",
  3829. referencedClasses: [],
  3830. //>>excludeEnd("ide");
  3831. pragmas: [],
  3832. messageSends: ["at:"]
  3833. }, function ($methodClass){ return function (){
  3834. var self=this,$self=this;
  3835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3836. return $core.withContext(function($ctx1) {
  3837. //>>excludeEnd("ctx");
  3838. return $self._at_((4));
  3839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3840. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3841. //>>excludeEnd("ctx");
  3842. }; }),
  3843. $globals.SequenceableCollection);
  3844. $core.addMethod(
  3845. $core.method({
  3846. selector: "includes:",
  3847. protocol: "testing",
  3848. //>>excludeStart("ide", pragmas.excludeIdeData);
  3849. args: ["anObject"],
  3850. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3851. referencedClasses: [],
  3852. //>>excludeEnd("ide");
  3853. pragmas: [],
  3854. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3855. }, function ($methodClass){ return function (anObject){
  3856. var self=this,$self=this;
  3857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3858. return $core.withContext(function($ctx1) {
  3859. //>>excludeEnd("ctx");
  3860. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3861. return nil;
  3862. })))._notNil();
  3863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3864. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3865. //>>excludeEnd("ctx");
  3866. }; }),
  3867. $globals.SequenceableCollection);
  3868. $core.addMethod(
  3869. $core.method({
  3870. selector: "indexOf:startingAt:",
  3871. protocol: "accessing",
  3872. //>>excludeStart("ide", pragmas.excludeIdeData);
  3873. args: ["anObject", "start"],
  3874. 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 ]",
  3875. referencedClasses: [],
  3876. //>>excludeEnd("ide");
  3877. pragmas: [],
  3878. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3879. }, function ($methodClass){ return function (anObject,start){
  3880. var self=this,$self=this;
  3881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3882. return $core.withContext(function($ctx1) {
  3883. //>>excludeEnd("ctx");
  3884. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3885. return (0);
  3886. }));
  3887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3888. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3889. //>>excludeEnd("ctx");
  3890. }; }),
  3891. $globals.SequenceableCollection);
  3892. $core.addMethod(
  3893. $core.method({
  3894. selector: "indexOf:startingAt:ifAbsent:",
  3895. protocol: "accessing",
  3896. //>>excludeStart("ide", pragmas.excludeIdeData);
  3897. args: ["anObject", "start", "aBlock"],
  3898. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3899. referencedClasses: [],
  3900. //>>excludeEnd("ide");
  3901. pragmas: [],
  3902. messageSends: ["subclassResponsibility"]
  3903. }, function ($methodClass){ return function (anObject,start,aBlock){
  3904. var self=this,$self=this;
  3905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3906. return $core.withContext(function($ctx1) {
  3907. //>>excludeEnd("ctx");
  3908. $self._subclassResponsibility();
  3909. return self;
  3910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3911. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3912. //>>excludeEnd("ctx");
  3913. }; }),
  3914. $globals.SequenceableCollection);
  3915. $core.addMethod(
  3916. $core.method({
  3917. selector: "last",
  3918. protocol: "accessing",
  3919. //>>excludeStart("ide", pragmas.excludeIdeData);
  3920. args: [],
  3921. source: "last\x0a\x09^ self at: self size",
  3922. referencedClasses: [],
  3923. //>>excludeEnd("ide");
  3924. pragmas: [],
  3925. messageSends: ["at:", "size"]
  3926. }, function ($methodClass){ return function (){
  3927. var self=this,$self=this;
  3928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3929. return $core.withContext(function($ctx1) {
  3930. //>>excludeEnd("ctx");
  3931. return $self._at_($self._size());
  3932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3933. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3934. //>>excludeEnd("ctx");
  3935. }; }),
  3936. $globals.SequenceableCollection);
  3937. $core.addMethod(
  3938. $core.method({
  3939. selector: "last:",
  3940. protocol: "accessing",
  3941. //>>excludeStart("ide", pragmas.excludeIdeData);
  3942. args: ["aNumber"],
  3943. 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",
  3944. referencedClasses: [],
  3945. //>>excludeEnd("ide");
  3946. pragmas: [],
  3947. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3948. }, function ($methodClass){ return function (aNumber){
  3949. var self=this,$self=this;
  3950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3951. return $core.withContext(function($ctx1) {
  3952. //>>excludeEnd("ctx");
  3953. var $2,$1,$5,$4,$3;
  3954. $2=$self._size();
  3955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3956. $ctx1.sendIdx["size"]=1;
  3957. //>>excludeEnd("ctx");
  3958. $1=$recv($2).__lt(aNumber);
  3959. if($core.assert($1)){
  3960. $self._error_("Invalid number of elements");
  3961. }
  3962. $5=$self._size();
  3963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3964. $ctx1.sendIdx["size"]=2;
  3965. //>>excludeEnd("ctx");
  3966. $4=$recv($5).__minus(aNumber);
  3967. $3=$recv($4).__plus((1));
  3968. return $self._copyFrom_to_($3,$self._size());
  3969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3970. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3971. //>>excludeEnd("ctx");
  3972. }; }),
  3973. $globals.SequenceableCollection);
  3974. $core.addMethod(
  3975. $core.method({
  3976. selector: "newStream",
  3977. protocol: "streaming",
  3978. //>>excludeStart("ide", pragmas.excludeIdeData);
  3979. args: [],
  3980. source: "newStream\x0a\x09^ self streamClass on: self",
  3981. referencedClasses: [],
  3982. //>>excludeEnd("ide");
  3983. pragmas: [],
  3984. messageSends: ["on:", "streamClass"]
  3985. }, function ($methodClass){ return function (){
  3986. var self=this,$self=this;
  3987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3988. return $core.withContext(function($ctx1) {
  3989. //>>excludeEnd("ctx");
  3990. return $recv($self._streamClass())._on_(self);
  3991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3992. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  3993. //>>excludeEnd("ctx");
  3994. }; }),
  3995. $globals.SequenceableCollection);
  3996. $core.addMethod(
  3997. $core.method({
  3998. selector: "readStream",
  3999. protocol: "streaming",
  4000. //>>excludeStart("ide", pragmas.excludeIdeData);
  4001. args: [],
  4002. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4003. referencedClasses: [],
  4004. //>>excludeEnd("ide");
  4005. pragmas: [],
  4006. messageSends: ["stream"]
  4007. }, function ($methodClass){ return function (){
  4008. var self=this,$self=this;
  4009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4010. return $core.withContext(function($ctx1) {
  4011. //>>excludeEnd("ctx");
  4012. return $self._stream();
  4013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4014. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  4015. //>>excludeEnd("ctx");
  4016. }; }),
  4017. $globals.SequenceableCollection);
  4018. $core.addMethod(
  4019. $core.method({
  4020. selector: "removeLast",
  4021. protocol: "adding/removing",
  4022. //>>excludeStart("ide", pragmas.excludeIdeData);
  4023. args: [],
  4024. source: "removeLast\x0a\x09^ self remove: self last",
  4025. referencedClasses: [],
  4026. //>>excludeEnd("ide");
  4027. pragmas: [],
  4028. messageSends: ["remove:", "last"]
  4029. }, function ($methodClass){ return function (){
  4030. var self=this,$self=this;
  4031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4032. return $core.withContext(function($ctx1) {
  4033. //>>excludeEnd("ctx");
  4034. return $self._remove_($self._last());
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4037. //>>excludeEnd("ctx");
  4038. }; }),
  4039. $globals.SequenceableCollection);
  4040. $core.addMethod(
  4041. $core.method({
  4042. selector: "reverseDo:",
  4043. protocol: "enumerating",
  4044. //>>excludeStart("ide", pragmas.excludeIdeData);
  4045. args: ["aBlock"],
  4046. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4047. referencedClasses: [],
  4048. //>>excludeEnd("ide");
  4049. pragmas: [],
  4050. messageSends: ["do:", "reversed"]
  4051. }, function ($methodClass){ return function (aBlock){
  4052. var self=this,$self=this;
  4053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4054. return $core.withContext(function($ctx1) {
  4055. //>>excludeEnd("ctx");
  4056. $recv($self._reversed())._do_(aBlock);
  4057. return self;
  4058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4059. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4060. //>>excludeEnd("ctx");
  4061. }; }),
  4062. $globals.SequenceableCollection);
  4063. $core.addMethod(
  4064. $core.method({
  4065. selector: "reversed",
  4066. protocol: "converting",
  4067. //>>excludeStart("ide", pragmas.excludeIdeData);
  4068. args: [],
  4069. source: "reversed\x0a\x09self subclassResponsibility",
  4070. referencedClasses: [],
  4071. //>>excludeEnd("ide");
  4072. pragmas: [],
  4073. messageSends: ["subclassResponsibility"]
  4074. }, function ($methodClass){ return function (){
  4075. var self=this,$self=this;
  4076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4077. return $core.withContext(function($ctx1) {
  4078. //>>excludeEnd("ctx");
  4079. $self._subclassResponsibility();
  4080. return self;
  4081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4082. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4083. //>>excludeEnd("ctx");
  4084. }; }),
  4085. $globals.SequenceableCollection);
  4086. $core.addMethod(
  4087. $core.method({
  4088. selector: "second",
  4089. protocol: "accessing",
  4090. //>>excludeStart("ide", pragmas.excludeIdeData);
  4091. args: [],
  4092. source: "second\x0a\x09^ self at: 2",
  4093. referencedClasses: [],
  4094. //>>excludeEnd("ide");
  4095. pragmas: [],
  4096. messageSends: ["at:"]
  4097. }, function ($methodClass){ return function (){
  4098. var self=this,$self=this;
  4099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4100. return $core.withContext(function($ctx1) {
  4101. //>>excludeEnd("ctx");
  4102. return $self._at_((2));
  4103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4104. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4105. //>>excludeEnd("ctx");
  4106. }; }),
  4107. $globals.SequenceableCollection);
  4108. $core.addMethod(
  4109. $core.method({
  4110. selector: "stream",
  4111. protocol: "streaming",
  4112. //>>excludeStart("ide", pragmas.excludeIdeData);
  4113. args: [],
  4114. source: "stream\x0a\x09^ self newStream",
  4115. referencedClasses: [],
  4116. //>>excludeEnd("ide");
  4117. pragmas: [],
  4118. messageSends: ["newStream"]
  4119. }, function ($methodClass){ return function (){
  4120. var self=this,$self=this;
  4121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4122. return $core.withContext(function($ctx1) {
  4123. //>>excludeEnd("ctx");
  4124. return $self._newStream();
  4125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4126. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4127. //>>excludeEnd("ctx");
  4128. }; }),
  4129. $globals.SequenceableCollection);
  4130. $core.addMethod(
  4131. $core.method({
  4132. selector: "streamClass",
  4133. protocol: "streaming",
  4134. //>>excludeStart("ide", pragmas.excludeIdeData);
  4135. args: [],
  4136. source: "streamClass\x0a\x09^ self class streamClass",
  4137. referencedClasses: [],
  4138. //>>excludeEnd("ide");
  4139. pragmas: [],
  4140. messageSends: ["streamClass", "class"]
  4141. }, function ($methodClass){ return function (){
  4142. var self=this,$self=this;
  4143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4144. return $core.withContext(function($ctx1) {
  4145. //>>excludeEnd("ctx");
  4146. return $recv($self._class())._streamClass();
  4147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4148. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4149. //>>excludeEnd("ctx");
  4150. }; }),
  4151. $globals.SequenceableCollection);
  4152. $core.addMethod(
  4153. $core.method({
  4154. selector: "third",
  4155. protocol: "accessing",
  4156. //>>excludeStart("ide", pragmas.excludeIdeData);
  4157. args: [],
  4158. source: "third\x0a\x09^ self at: 3",
  4159. referencedClasses: [],
  4160. //>>excludeEnd("ide");
  4161. pragmas: [],
  4162. messageSends: ["at:"]
  4163. }, function ($methodClass){ return function (){
  4164. var self=this,$self=this;
  4165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4166. return $core.withContext(function($ctx1) {
  4167. //>>excludeEnd("ctx");
  4168. return $self._at_((3));
  4169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4170. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4171. //>>excludeEnd("ctx");
  4172. }; }),
  4173. $globals.SequenceableCollection);
  4174. $core.addMethod(
  4175. $core.method({
  4176. selector: "writeStream",
  4177. protocol: "streaming",
  4178. //>>excludeStart("ide", pragmas.excludeIdeData);
  4179. args: [],
  4180. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4181. referencedClasses: [],
  4182. //>>excludeEnd("ide");
  4183. pragmas: [],
  4184. messageSends: ["stream"]
  4185. }, function ($methodClass){ return function (){
  4186. var self=this,$self=this;
  4187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4188. return $core.withContext(function($ctx1) {
  4189. //>>excludeEnd("ctx");
  4190. return $self._stream();
  4191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4192. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4193. //>>excludeEnd("ctx");
  4194. }; }),
  4195. $globals.SequenceableCollection);
  4196. $core.addMethod(
  4197. $core.method({
  4198. selector: "streamClass",
  4199. protocol: "accessing",
  4200. //>>excludeStart("ide", pragmas.excludeIdeData);
  4201. args: [],
  4202. source: "streamClass\x0a\x09\x09^ Stream",
  4203. referencedClasses: ["Stream"],
  4204. //>>excludeEnd("ide");
  4205. pragmas: [],
  4206. messageSends: []
  4207. }, function ($methodClass){ return function (){
  4208. var self=this,$self=this;
  4209. return $globals.Stream;
  4210. }; }),
  4211. $globals.SequenceableCollection.a$cls);
  4212. $core.addMethod(
  4213. $core.method({
  4214. selector: "streamContents:",
  4215. protocol: "streaming",
  4216. //>>excludeStart("ide", pragmas.excludeIdeData);
  4217. args: ["aBlock"],
  4218. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4219. referencedClasses: [],
  4220. //>>excludeEnd("ide");
  4221. pragmas: [],
  4222. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4223. }, function ($methodClass){ return function (aBlock){
  4224. var self=this,$self=this;
  4225. var stream;
  4226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4227. return $core.withContext(function($ctx1) {
  4228. //>>excludeEnd("ctx");
  4229. stream=$recv($self._streamClass())._on_($self._new());
  4230. $recv(aBlock)._value_(stream);
  4231. return $recv(stream)._contents();
  4232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4233. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4234. //>>excludeEnd("ctx");
  4235. }; }),
  4236. $globals.SequenceableCollection.a$cls);
  4237. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4238. //>>excludeStart("ide", pragmas.excludeIdeData);
  4239. $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`.";
  4240. //>>excludeEnd("ide");
  4241. $core.addMethod(
  4242. $core.method({
  4243. selector: "add:",
  4244. protocol: "adding/removing",
  4245. //>>excludeStart("ide", pragmas.excludeIdeData);
  4246. args: ["anObject"],
  4247. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4248. referencedClasses: [],
  4249. //>>excludeEnd("ide");
  4250. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4251. messageSends: []
  4252. }, function ($methodClass){ return function (anObject){
  4253. var self=this,$self=this;
  4254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4255. return $core.withContext(function($ctx1) {
  4256. //>>excludeEnd("ctx");
  4257. self.push(anObject); return anObject;;
  4258. return self;
  4259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4260. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4261. //>>excludeEnd("ctx");
  4262. }; }),
  4263. $globals.Array);
  4264. $core.addMethod(
  4265. $core.method({
  4266. selector: "addAll:",
  4267. protocol: "adding/removing",
  4268. //>>excludeStart("ide", pragmas.excludeIdeData);
  4269. args: ["aCollection"],
  4270. 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'>",
  4271. referencedClasses: [],
  4272. //>>excludeEnd("ide");
  4273. 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;"]]],
  4274. messageSends: []
  4275. }, function ($methodClass){ return function (aCollection){
  4276. var self=this,$self=this;
  4277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4278. return $core.withContext(function($ctx1) {
  4279. //>>excludeEnd("ctx");
  4280. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4281. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4282. return aCollection;;
  4283. return self;
  4284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4285. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4286. //>>excludeEnd("ctx");
  4287. }; }),
  4288. $globals.Array);
  4289. $core.addMethod(
  4290. $core.method({
  4291. selector: "addFirst:",
  4292. protocol: "adding/removing",
  4293. //>>excludeStart("ide", pragmas.excludeIdeData);
  4294. args: ["anObject"],
  4295. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4296. referencedClasses: [],
  4297. //>>excludeEnd("ide");
  4298. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4299. messageSends: []
  4300. }, function ($methodClass){ return function (anObject){
  4301. var self=this,$self=this;
  4302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4303. return $core.withContext(function($ctx1) {
  4304. //>>excludeEnd("ctx");
  4305. self.unshift(anObject); return anObject;;
  4306. return self;
  4307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4308. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4309. //>>excludeEnd("ctx");
  4310. }; }),
  4311. $globals.Array);
  4312. $core.addMethod(
  4313. $core.method({
  4314. selector: "asJavaScriptSource",
  4315. protocol: "converting",
  4316. //>>excludeStart("ide", pragmas.excludeIdeData);
  4317. args: [],
  4318. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4319. referencedClasses: [],
  4320. //>>excludeEnd("ide");
  4321. pragmas: [],
  4322. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4323. }, function ($methodClass){ return function (){
  4324. var self=this,$self=this;
  4325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4326. return $core.withContext(function($ctx1) {
  4327. //>>excludeEnd("ctx");
  4328. var $1;
  4329. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4331. return $core.withContext(function($ctx2) {
  4332. //>>excludeEnd("ctx");
  4333. return $recv(each)._asJavaScriptSource();
  4334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4335. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4336. //>>excludeEnd("ctx");
  4337. })))._join_(", "))).__comma("]");
  4338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4339. $ctx1.sendIdx[","]=1;
  4340. //>>excludeEnd("ctx");
  4341. return $1;
  4342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4343. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4344. //>>excludeEnd("ctx");
  4345. }; }),
  4346. $globals.Array);
  4347. $core.addMethod(
  4348. $core.method({
  4349. selector: "at:put:",
  4350. protocol: "accessing",
  4351. //>>excludeStart("ide", pragmas.excludeIdeData);
  4352. args: ["anIndex", "anObject"],
  4353. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4354. referencedClasses: [],
  4355. //>>excludeEnd("ide");
  4356. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4357. messageSends: []
  4358. }, function ($methodClass){ return function (anIndex,anObject){
  4359. var self=this,$self=this;
  4360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4361. return $core.withContext(function($ctx1) {
  4362. //>>excludeEnd("ctx");
  4363. return self[anIndex - 1] = anObject;
  4364. return self;
  4365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4366. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4367. //>>excludeEnd("ctx");
  4368. }; }),
  4369. $globals.Array);
  4370. $core.addMethod(
  4371. $core.method({
  4372. selector: "collect:",
  4373. protocol: "enumerating",
  4374. //>>excludeStart("ide", pragmas.excludeIdeData);
  4375. args: ["aBlock"],
  4376. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4377. referencedClasses: [],
  4378. //>>excludeEnd("ide");
  4379. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4380. messageSends: []
  4381. }, function ($methodClass){ return function (aBlock){
  4382. var self=this,$self=this;
  4383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4384. return $core.withContext(function($ctx1) {
  4385. //>>excludeEnd("ctx");
  4386. return self.map(function(each) {return aBlock._value_(each)});
  4387. return self;
  4388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4389. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4390. //>>excludeEnd("ctx");
  4391. }; }),
  4392. $globals.Array);
  4393. $core.addMethod(
  4394. $core.method({
  4395. selector: "copyFrom:to:",
  4396. protocol: "copying",
  4397. //>>excludeStart("ide", pragmas.excludeIdeData);
  4398. args: ["anIndex", "anotherIndex"],
  4399. 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'>",
  4400. referencedClasses: [],
  4401. //>>excludeEnd("ide");
  4402. 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}"]]],
  4403. messageSends: []
  4404. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4405. var self=this,$self=this;
  4406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4407. return $core.withContext(function($ctx1) {
  4408. //>>excludeEnd("ctx");
  4409. if (anIndex >= 1 && anotherIndex <= self.length) {
  4410. return self.slice(anIndex - 1, anotherIndex);
  4411. } else {
  4412. self._at_(anIndex);
  4413. self._at_(self.length + 1);
  4414. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4415. };
  4416. return self;
  4417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4418. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4419. //>>excludeEnd("ctx");
  4420. }; }),
  4421. $globals.Array);
  4422. $core.addMethod(
  4423. $core.method({
  4424. selector: "join:",
  4425. protocol: "enumerating",
  4426. //>>excludeStart("ide", pragmas.excludeIdeData);
  4427. args: ["aString"],
  4428. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4429. referencedClasses: [],
  4430. //>>excludeEnd("ide");
  4431. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4432. messageSends: []
  4433. }, function ($methodClass){ return function (aString){
  4434. var self=this,$self=this;
  4435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4436. return $core.withContext(function($ctx1) {
  4437. //>>excludeEnd("ctx");
  4438. return self.join(aString);
  4439. return self;
  4440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4441. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4442. //>>excludeEnd("ctx");
  4443. }; }),
  4444. $globals.Array);
  4445. $core.addMethod(
  4446. $core.method({
  4447. selector: "printOn:",
  4448. protocol: "printing",
  4449. //>>excludeStart("ide", pragmas.excludeIdeData);
  4450. args: ["aStream"],
  4451. 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: ')'",
  4452. referencedClasses: [],
  4453. //>>excludeEnd("ide");
  4454. pragmas: [],
  4455. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4456. }, function ($methodClass){ return function (aStream){
  4457. var self=this,$self=this;
  4458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4459. return $core.withContext(function($ctx1) {
  4460. //>>excludeEnd("ctx");
  4461. (
  4462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4463. $ctx1.supercall = true,
  4464. //>>excludeEnd("ctx");
  4465. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream));
  4466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4467. $ctx1.supercall = false;
  4468. //>>excludeEnd("ctx");;
  4469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4470. $ctx1.sendIdx["printOn:"]=1;
  4471. //>>excludeEnd("ctx");
  4472. $recv(aStream)._nextPutAll_(" (");
  4473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4474. $ctx1.sendIdx["nextPutAll:"]=1;
  4475. //>>excludeEnd("ctx");
  4476. $self._do_separatedBy_((function(each){
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. return $core.withContext(function($ctx2) {
  4479. //>>excludeEnd("ctx");
  4480. return $recv(each)._printOn_(aStream);
  4481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4483. //>>excludeEnd("ctx");
  4484. }),(function(){
  4485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4486. return $core.withContext(function($ctx2) {
  4487. //>>excludeEnd("ctx");
  4488. return $recv(aStream)._nextPutAll_(" ");
  4489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4490. $ctx2.sendIdx["nextPutAll:"]=2;
  4491. //>>excludeEnd("ctx");
  4492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4493. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4494. //>>excludeEnd("ctx");
  4495. }));
  4496. $recv(aStream)._nextPutAll_(")");
  4497. return self;
  4498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4499. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4500. //>>excludeEnd("ctx");
  4501. }; }),
  4502. $globals.Array);
  4503. $core.addMethod(
  4504. $core.method({
  4505. selector: "remove:ifAbsent:",
  4506. protocol: "adding/removing",
  4507. //>>excludeStart("ide", pragmas.excludeIdeData);
  4508. args: ["anObject", "aBlock"],
  4509. 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 ]",
  4510. referencedClasses: [],
  4511. //>>excludeEnd("ide");
  4512. pragmas: [],
  4513. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4514. }, function ($methodClass){ return function (anObject,aBlock){
  4515. var self=this,$self=this;
  4516. var index;
  4517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4518. return $core.withContext(function($ctx1) {
  4519. //>>excludeEnd("ctx");
  4520. var $1;
  4521. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4522. return (0);
  4523. }));
  4524. $1=$recv(index).__eq((0));
  4525. if($core.assert($1)){
  4526. return $recv(aBlock)._value();
  4527. } else {
  4528. $self._removeIndex_(index);
  4529. return anObject;
  4530. }
  4531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4532. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4533. //>>excludeEnd("ctx");
  4534. }; }),
  4535. $globals.Array);
  4536. $core.addMethod(
  4537. $core.method({
  4538. selector: "removeAll",
  4539. protocol: "adding/removing",
  4540. //>>excludeStart("ide", pragmas.excludeIdeData);
  4541. args: [],
  4542. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4543. referencedClasses: [],
  4544. //>>excludeEnd("ide");
  4545. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4546. messageSends: []
  4547. }, function ($methodClass){ return function (){
  4548. var self=this,$self=this;
  4549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4550. return $core.withContext(function($ctx1) {
  4551. //>>excludeEnd("ctx");
  4552. self.length = 0;
  4553. return self;
  4554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4555. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4556. //>>excludeEnd("ctx");
  4557. }; }),
  4558. $globals.Array);
  4559. $core.addMethod(
  4560. $core.method({
  4561. selector: "removeFrom:to:",
  4562. protocol: "adding/removing",
  4563. //>>excludeStart("ide", pragmas.excludeIdeData);
  4564. args: ["aNumber", "anotherNumber"],
  4565. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4566. referencedClasses: [],
  4567. //>>excludeEnd("ide");
  4568. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4569. messageSends: []
  4570. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4571. var self=this,$self=this;
  4572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4573. return $core.withContext(function($ctx1) {
  4574. //>>excludeEnd("ctx");
  4575. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4576. return self;
  4577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4578. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4579. //>>excludeEnd("ctx");
  4580. }; }),
  4581. $globals.Array);
  4582. $core.addMethod(
  4583. $core.method({
  4584. selector: "removeIndex:",
  4585. protocol: "adding/removing",
  4586. //>>excludeStart("ide", pragmas.excludeIdeData);
  4587. args: ["anInteger"],
  4588. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4589. referencedClasses: [],
  4590. //>>excludeEnd("ide");
  4591. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4592. messageSends: []
  4593. }, function ($methodClass){ return function (anInteger){
  4594. var self=this,$self=this;
  4595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4596. return $core.withContext(function($ctx1) {
  4597. //>>excludeEnd("ctx");
  4598. self.splice(anInteger - 1, 1);
  4599. return self;
  4600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4601. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4602. //>>excludeEnd("ctx");
  4603. }; }),
  4604. $globals.Array);
  4605. $core.addMethod(
  4606. $core.method({
  4607. selector: "removeLast",
  4608. protocol: "adding/removing",
  4609. //>>excludeStart("ide", pragmas.excludeIdeData);
  4610. args: [],
  4611. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4612. referencedClasses: [],
  4613. //>>excludeEnd("ide");
  4614. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4615. messageSends: []
  4616. }, function ($methodClass){ return function (){
  4617. var self=this,$self=this;
  4618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4619. return $core.withContext(function($ctx1) {
  4620. //>>excludeEnd("ctx");
  4621. return self.pop();;
  4622. return self;
  4623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4624. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4625. //>>excludeEnd("ctx");
  4626. }; }),
  4627. $globals.Array);
  4628. $core.addMethod(
  4629. $core.method({
  4630. selector: "reversed",
  4631. protocol: "converting",
  4632. //>>excludeStart("ide", pragmas.excludeIdeData);
  4633. args: [],
  4634. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4635. referencedClasses: [],
  4636. //>>excludeEnd("ide");
  4637. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4638. messageSends: []
  4639. }, function ($methodClass){ return function (){
  4640. var self=this,$self=this;
  4641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4642. return $core.withContext(function($ctx1) {
  4643. //>>excludeEnd("ctx");
  4644. return self.slice().reverse();
  4645. return self;
  4646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4647. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4648. //>>excludeEnd("ctx");
  4649. }; }),
  4650. $globals.Array);
  4651. $core.addMethod(
  4652. $core.method({
  4653. selector: "select:",
  4654. protocol: "enumerating",
  4655. //>>excludeStart("ide", pragmas.excludeIdeData);
  4656. args: ["aBlock"],
  4657. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4658. referencedClasses: [],
  4659. //>>excludeEnd("ide");
  4660. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4661. messageSends: []
  4662. }, function ($methodClass){ return function (aBlock){
  4663. var self=this,$self=this;
  4664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4665. return $core.withContext(function($ctx1) {
  4666. //>>excludeEnd("ctx");
  4667. return self.filter(function(each) {return aBlock._value_(each)});
  4668. return self;
  4669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4670. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4671. //>>excludeEnd("ctx");
  4672. }; }),
  4673. $globals.Array);
  4674. $core.addMethod(
  4675. $core.method({
  4676. selector: "shallowCopy",
  4677. protocol: "copying",
  4678. //>>excludeStart("ide", pragmas.excludeIdeData);
  4679. args: [],
  4680. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4681. referencedClasses: [],
  4682. //>>excludeEnd("ide");
  4683. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4684. messageSends: []
  4685. }, function ($methodClass){ return function (){
  4686. var self=this,$self=this;
  4687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4688. return $core.withContext(function($ctx1) {
  4689. //>>excludeEnd("ctx");
  4690. return self.slice();
  4691. return self;
  4692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4693. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4694. //>>excludeEnd("ctx");
  4695. }; }),
  4696. $globals.Array);
  4697. $core.addMethod(
  4698. $core.method({
  4699. selector: "sort",
  4700. protocol: "enumerating",
  4701. //>>excludeStart("ide", pragmas.excludeIdeData);
  4702. args: [],
  4703. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4704. referencedClasses: [],
  4705. //>>excludeEnd("ide");
  4706. pragmas: [],
  4707. messageSends: ["sort:", "<"]
  4708. }, function ($methodClass){ return function (){
  4709. var self=this,$self=this;
  4710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4711. return $core.withContext(function($ctx1) {
  4712. //>>excludeEnd("ctx");
  4713. return $self._sort_((function(a,b){
  4714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4715. return $core.withContext(function($ctx2) {
  4716. //>>excludeEnd("ctx");
  4717. return $recv(a).__lt(b);
  4718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4719. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4720. //>>excludeEnd("ctx");
  4721. }));
  4722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4723. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4724. //>>excludeEnd("ctx");
  4725. }; }),
  4726. $globals.Array);
  4727. $core.addMethod(
  4728. $core.method({
  4729. selector: "sort:",
  4730. protocol: "enumerating",
  4731. //>>excludeStart("ide", pragmas.excludeIdeData);
  4732. args: ["aBlock"],
  4733. 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'>",
  4734. referencedClasses: [],
  4735. //>>excludeEnd("ide");
  4736. 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"]]],
  4737. messageSends: []
  4738. }, function ($methodClass){ return function (aBlock){
  4739. var self=this,$self=this;
  4740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4741. return $core.withContext(function($ctx1) {
  4742. //>>excludeEnd("ctx");
  4743. return self.sort(function(a, b) {
  4744. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4745. })
  4746. ;
  4747. return self;
  4748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4749. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4750. //>>excludeEnd("ctx");
  4751. }; }),
  4752. $globals.Array);
  4753. $core.addMethod(
  4754. $core.method({
  4755. selector: "sorted",
  4756. protocol: "enumerating",
  4757. //>>excludeStart("ide", pragmas.excludeIdeData);
  4758. args: [],
  4759. source: "sorted\x0a\x09^ self copy sort",
  4760. referencedClasses: [],
  4761. //>>excludeEnd("ide");
  4762. pragmas: [],
  4763. messageSends: ["sort", "copy"]
  4764. }, function ($methodClass){ return function (){
  4765. var self=this,$self=this;
  4766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4767. return $core.withContext(function($ctx1) {
  4768. //>>excludeEnd("ctx");
  4769. return $recv($self._copy())._sort();
  4770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4771. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4772. //>>excludeEnd("ctx");
  4773. }; }),
  4774. $globals.Array);
  4775. $core.addMethod(
  4776. $core.method({
  4777. selector: "sorted:",
  4778. protocol: "enumerating",
  4779. //>>excludeStart("ide", pragmas.excludeIdeData);
  4780. args: ["aBlock"],
  4781. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4782. referencedClasses: [],
  4783. //>>excludeEnd("ide");
  4784. pragmas: [],
  4785. messageSends: ["sort:", "copy"]
  4786. }, function ($methodClass){ return function (aBlock){
  4787. var self=this,$self=this;
  4788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4789. return $core.withContext(function($ctx1) {
  4790. //>>excludeEnd("ctx");
  4791. return $recv($self._copy())._sort_(aBlock);
  4792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4793. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4794. //>>excludeEnd("ctx");
  4795. }; }),
  4796. $globals.Array);
  4797. $core.addMethod(
  4798. $core.method({
  4799. selector: "new:",
  4800. protocol: "instance creation",
  4801. //>>excludeStart("ide", pragmas.excludeIdeData);
  4802. args: ["anInteger"],
  4803. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4804. referencedClasses: [],
  4805. //>>excludeEnd("ide");
  4806. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4807. messageSends: []
  4808. }, function ($methodClass){ return function (anInteger){
  4809. var self=this,$self=this;
  4810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4811. return $core.withContext(function($ctx1) {
  4812. //>>excludeEnd("ctx");
  4813. return new Array(anInteger);
  4814. return self;
  4815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4816. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4817. //>>excludeEnd("ctx");
  4818. }; }),
  4819. $globals.Array.a$cls);
  4820. $core.addMethod(
  4821. $core.method({
  4822. selector: "with:",
  4823. protocol: "instance creation",
  4824. //>>excludeStart("ide", pragmas.excludeIdeData);
  4825. args: ["anObject"],
  4826. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4827. referencedClasses: [],
  4828. //>>excludeEnd("ide");
  4829. pragmas: [],
  4830. messageSends: ["at:put:", "new:", "yourself"]
  4831. }, function ($methodClass){ return function (anObject){
  4832. var self=this,$self=this;
  4833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4834. return $core.withContext(function($ctx1) {
  4835. //>>excludeEnd("ctx");
  4836. var $1;
  4837. $1=$self._new_((1));
  4838. $recv($1)._at_put_((1),anObject);
  4839. return $recv($1)._yourself();
  4840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4841. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4842. //>>excludeEnd("ctx");
  4843. }; }),
  4844. $globals.Array.a$cls);
  4845. $core.addMethod(
  4846. $core.method({
  4847. selector: "with:with:",
  4848. protocol: "instance creation",
  4849. //>>excludeStart("ide", pragmas.excludeIdeData);
  4850. args: ["anObject", "anObject2"],
  4851. 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",
  4852. referencedClasses: [],
  4853. //>>excludeEnd("ide");
  4854. pragmas: [],
  4855. messageSends: ["at:put:", "new:", "yourself"]
  4856. }, function ($methodClass){ return function (anObject,anObject2){
  4857. var self=this,$self=this;
  4858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4859. return $core.withContext(function($ctx1) {
  4860. //>>excludeEnd("ctx");
  4861. var $1;
  4862. $1=$self._new_((2));
  4863. $recv($1)._at_put_((1),anObject);
  4864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4865. $ctx1.sendIdx["at:put:"]=1;
  4866. //>>excludeEnd("ctx");
  4867. $recv($1)._at_put_((2),anObject2);
  4868. return $recv($1)._yourself();
  4869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4870. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4871. //>>excludeEnd("ctx");
  4872. }; }),
  4873. $globals.Array.a$cls);
  4874. $core.addMethod(
  4875. $core.method({
  4876. selector: "with:with:with:",
  4877. protocol: "instance creation",
  4878. //>>excludeStart("ide", pragmas.excludeIdeData);
  4879. args: ["anObject", "anObject2", "anObject3"],
  4880. 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",
  4881. referencedClasses: [],
  4882. //>>excludeEnd("ide");
  4883. pragmas: [],
  4884. messageSends: ["at:put:", "new:", "yourself"]
  4885. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4886. var self=this,$self=this;
  4887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4888. return $core.withContext(function($ctx1) {
  4889. //>>excludeEnd("ctx");
  4890. var $1;
  4891. $1=$self._new_((3));
  4892. $recv($1)._at_put_((1),anObject);
  4893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4894. $ctx1.sendIdx["at:put:"]=1;
  4895. //>>excludeEnd("ctx");
  4896. $recv($1)._at_put_((2),anObject2);
  4897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4898. $ctx1.sendIdx["at:put:"]=2;
  4899. //>>excludeEnd("ctx");
  4900. $recv($1)._at_put_((3),anObject3);
  4901. return $recv($1)._yourself();
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4904. //>>excludeEnd("ctx");
  4905. }; }),
  4906. $globals.Array.a$cls);
  4907. $core.addMethod(
  4908. $core.method({
  4909. selector: "withAll:",
  4910. protocol: "instance creation",
  4911. //>>excludeStart("ide", pragmas.excludeIdeData);
  4912. args: ["aCollection"],
  4913. 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",
  4914. referencedClasses: [],
  4915. //>>excludeEnd("ide");
  4916. pragmas: [],
  4917. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4918. }, function ($methodClass){ return function (aCollection){
  4919. var self=this,$self=this;
  4920. var instance,index;
  4921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4922. return $core.withContext(function($ctx1) {
  4923. //>>excludeEnd("ctx");
  4924. index=(1);
  4925. instance=$self._new_($recv(aCollection)._size());
  4926. $recv(aCollection)._do_((function(each){
  4927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4928. return $core.withContext(function($ctx2) {
  4929. //>>excludeEnd("ctx");
  4930. $recv(instance)._at_put_(index,each);
  4931. index=$recv(index).__plus((1));
  4932. return index;
  4933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4934. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4935. //>>excludeEnd("ctx");
  4936. }));
  4937. return instance;
  4938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4939. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4940. //>>excludeEnd("ctx");
  4941. }; }),
  4942. $globals.Array.a$cls);
  4943. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4944. //>>excludeStart("ide", pragmas.excludeIdeData);
  4945. $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 >> #,`";
  4946. //>>excludeEnd("ide");
  4947. $core.addMethod(
  4948. $core.method({
  4949. selector: ",",
  4950. protocol: "copying",
  4951. //>>excludeStart("ide", pragmas.excludeIdeData);
  4952. args: ["aString"],
  4953. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4954. referencedClasses: [],
  4955. //>>excludeEnd("ide");
  4956. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4957. messageSends: []
  4958. }, function ($methodClass){ return function (aString){
  4959. var self=this,$self=this;
  4960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4961. return $core.withContext(function($ctx1) {
  4962. //>>excludeEnd("ctx");
  4963. return String(self) + aString;
  4964. return self;
  4965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4966. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4967. //>>excludeEnd("ctx");
  4968. }; }),
  4969. $globals.String);
  4970. $core.addMethod(
  4971. $core.method({
  4972. selector: "<",
  4973. protocol: "comparing",
  4974. //>>excludeStart("ide", pragmas.excludeIdeData);
  4975. args: ["aString"],
  4976. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4977. referencedClasses: [],
  4978. //>>excludeEnd("ide");
  4979. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4980. messageSends: []
  4981. }, function ($methodClass){ return function (aString){
  4982. var self=this,$self=this;
  4983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4984. return $core.withContext(function($ctx1) {
  4985. //>>excludeEnd("ctx");
  4986. return String(self) < aString._asString();
  4987. return self;
  4988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4989. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  4990. //>>excludeEnd("ctx");
  4991. }; }),
  4992. $globals.String);
  4993. $core.addMethod(
  4994. $core.method({
  4995. selector: "<=",
  4996. protocol: "comparing",
  4997. //>>excludeStart("ide", pragmas.excludeIdeData);
  4998. args: ["aString"],
  4999. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5000. referencedClasses: [],
  5001. //>>excludeEnd("ide");
  5002. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5003. messageSends: []
  5004. }, function ($methodClass){ return function (aString){
  5005. var self=this,$self=this;
  5006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5007. return $core.withContext(function($ctx1) {
  5008. //>>excludeEnd("ctx");
  5009. return String(self) <= aString._asString();
  5010. return self;
  5011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5012. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5013. //>>excludeEnd("ctx");
  5014. }; }),
  5015. $globals.String);
  5016. $core.addMethod(
  5017. $core.method({
  5018. selector: "=",
  5019. protocol: "comparing",
  5020. //>>excludeStart("ide", pragmas.excludeIdeData);
  5021. args: ["aString"],
  5022. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5023. referencedClasses: [],
  5024. //>>excludeEnd("ide");
  5025. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5026. messageSends: []
  5027. }, function ($methodClass){ return function (aString){
  5028. var self=this,$self=this;
  5029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5030. return $core.withContext(function($ctx1) {
  5031. //>>excludeEnd("ctx");
  5032. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5033. return self;
  5034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5035. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5036. //>>excludeEnd("ctx");
  5037. }; }),
  5038. $globals.String);
  5039. $core.addMethod(
  5040. $core.method({
  5041. selector: "==",
  5042. protocol: "comparing",
  5043. //>>excludeStart("ide", pragmas.excludeIdeData);
  5044. args: ["aString"],
  5045. 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'>",
  5046. referencedClasses: [],
  5047. //>>excludeEnd("ide");
  5048. 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;"]]],
  5049. messageSends: []
  5050. }, function ($methodClass){ return function (aString){
  5051. var self=this,$self=this;
  5052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5053. return $core.withContext(function($ctx1) {
  5054. //>>excludeEnd("ctx");
  5055. if (typeof aString === "string") return String(self) === aString;
  5056. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5057. else return false;;
  5058. return self;
  5059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5060. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5061. //>>excludeEnd("ctx");
  5062. }; }),
  5063. $globals.String);
  5064. $core.addMethod(
  5065. $core.method({
  5066. selector: ">",
  5067. protocol: "comparing",
  5068. //>>excludeStart("ide", pragmas.excludeIdeData);
  5069. args: ["aString"],
  5070. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5071. referencedClasses: [],
  5072. //>>excludeEnd("ide");
  5073. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5074. messageSends: []
  5075. }, function ($methodClass){ return function (aString){
  5076. var self=this,$self=this;
  5077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5078. return $core.withContext(function($ctx1) {
  5079. //>>excludeEnd("ctx");
  5080. return String(self) > aString._asString();
  5081. return self;
  5082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5083. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5084. //>>excludeEnd("ctx");
  5085. }; }),
  5086. $globals.String);
  5087. $core.addMethod(
  5088. $core.method({
  5089. selector: ">=",
  5090. protocol: "comparing",
  5091. //>>excludeStart("ide", pragmas.excludeIdeData);
  5092. args: ["aString"],
  5093. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5094. referencedClasses: [],
  5095. //>>excludeEnd("ide");
  5096. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5097. messageSends: []
  5098. }, function ($methodClass){ return function (aString){
  5099. var self=this,$self=this;
  5100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5101. return $core.withContext(function($ctx1) {
  5102. //>>excludeEnd("ctx");
  5103. return String(self) >= aString._asString();
  5104. return self;
  5105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5106. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5107. //>>excludeEnd("ctx");
  5108. }; }),
  5109. $globals.String);
  5110. $core.addMethod(
  5111. $core.method({
  5112. selector: "add:",
  5113. protocol: "adding/removing",
  5114. //>>excludeStart("ide", pragmas.excludeIdeData);
  5115. args: ["anObject"],
  5116. source: "add: anObject\x0a\x09self errorReadOnly",
  5117. referencedClasses: [],
  5118. //>>excludeEnd("ide");
  5119. pragmas: [],
  5120. messageSends: ["errorReadOnly"]
  5121. }, function ($methodClass){ return function (anObject){
  5122. var self=this,$self=this;
  5123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5124. return $core.withContext(function($ctx1) {
  5125. //>>excludeEnd("ctx");
  5126. $self._errorReadOnly();
  5127. return self;
  5128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5129. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5130. //>>excludeEnd("ctx");
  5131. }; }),
  5132. $globals.String);
  5133. $core.addMethod(
  5134. $core.method({
  5135. selector: "asJavaScriptMethodName",
  5136. protocol: "converting",
  5137. //>>excludeStart("ide", pragmas.excludeIdeData);
  5138. args: [],
  5139. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5140. referencedClasses: [],
  5141. //>>excludeEnd("ide");
  5142. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5143. messageSends: []
  5144. }, function ($methodClass){ return function (){
  5145. var self=this,$self=this;
  5146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5147. return $core.withContext(function($ctx1) {
  5148. //>>excludeEnd("ctx");
  5149. return $core.st2js(self);
  5150. return self;
  5151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5152. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5153. //>>excludeEnd("ctx");
  5154. }; }),
  5155. $globals.String);
  5156. $core.addMethod(
  5157. $core.method({
  5158. selector: "asJavaScriptObject",
  5159. protocol: "converting",
  5160. //>>excludeStart("ide", pragmas.excludeIdeData);
  5161. args: [],
  5162. source: "asJavaScriptObject\x0a\x09^ self",
  5163. referencedClasses: [],
  5164. //>>excludeEnd("ide");
  5165. pragmas: [],
  5166. messageSends: []
  5167. }, function ($methodClass){ return function (){
  5168. var self=this,$self=this;
  5169. return self;
  5170. }; }),
  5171. $globals.String);
  5172. $core.addMethod(
  5173. $core.method({
  5174. selector: "asJavaScriptSource",
  5175. protocol: "converting",
  5176. //>>excludeStart("ide", pragmas.excludeIdeData);
  5177. args: [],
  5178. 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'>",
  5179. referencedClasses: [],
  5180. //>>excludeEnd("ide");
  5181. 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"]]],
  5182. messageSends: []
  5183. }, function ($methodClass){ return function (){
  5184. var self=this,$self=this;
  5185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5186. return $core.withContext(function($ctx1) {
  5187. //>>excludeEnd("ctx");
  5188. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5189. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5190. else
  5191. return "\"" + self + "\"";
  5192. ;
  5193. return self;
  5194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5195. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5196. //>>excludeEnd("ctx");
  5197. }; }),
  5198. $globals.String);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "asLowercase",
  5202. protocol: "converting",
  5203. //>>excludeStart("ide", pragmas.excludeIdeData);
  5204. args: [],
  5205. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5206. referencedClasses: [],
  5207. //>>excludeEnd("ide");
  5208. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5209. messageSends: []
  5210. }, function ($methodClass){ return function (){
  5211. var self=this,$self=this;
  5212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5213. return $core.withContext(function($ctx1) {
  5214. //>>excludeEnd("ctx");
  5215. return self.toLowerCase();
  5216. return self;
  5217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5218. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5219. //>>excludeEnd("ctx");
  5220. }; }),
  5221. $globals.String);
  5222. $core.addMethod(
  5223. $core.method({
  5224. selector: "asMutator",
  5225. protocol: "converting",
  5226. //>>excludeStart("ide", pragmas.excludeIdeData);
  5227. args: [],
  5228. 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",
  5229. referencedClasses: [],
  5230. //>>excludeEnd("ide");
  5231. pragmas: [],
  5232. messageSends: ["ifFalse:", "=", "last", ","]
  5233. }, function ($methodClass){ return function (){
  5234. var self=this,$self=this;
  5235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5236. return $core.withContext(function($ctx1) {
  5237. //>>excludeEnd("ctx");
  5238. var $1;
  5239. $1=$recv($self._last()).__eq(":");
  5240. if(!$core.assert($1)){
  5241. return $self.__comma(":");
  5242. }
  5243. return self;
  5244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5245. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5246. //>>excludeEnd("ctx");
  5247. }; }),
  5248. $globals.String);
  5249. $core.addMethod(
  5250. $core.method({
  5251. selector: "asNumber",
  5252. protocol: "converting",
  5253. //>>excludeStart("ide", pragmas.excludeIdeData);
  5254. args: [],
  5255. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5256. referencedClasses: [],
  5257. //>>excludeEnd("ide");
  5258. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5259. messageSends: []
  5260. }, function ($methodClass){ return function (){
  5261. var self=this,$self=this;
  5262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5263. return $core.withContext(function($ctx1) {
  5264. //>>excludeEnd("ctx");
  5265. return Number(self);
  5266. return self;
  5267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5268. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5269. //>>excludeEnd("ctx");
  5270. }; }),
  5271. $globals.String);
  5272. $core.addMethod(
  5273. $core.method({
  5274. selector: "asRegexp",
  5275. protocol: "converting",
  5276. //>>excludeStart("ide", pragmas.excludeIdeData);
  5277. args: [],
  5278. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5279. referencedClasses: ["RegularExpression"],
  5280. //>>excludeEnd("ide");
  5281. pragmas: [],
  5282. messageSends: ["fromString:"]
  5283. }, function ($methodClass){ return function (){
  5284. var self=this,$self=this;
  5285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5286. return $core.withContext(function($ctx1) {
  5287. //>>excludeEnd("ctx");
  5288. return $recv($globals.RegularExpression)._fromString_(self);
  5289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5290. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5291. //>>excludeEnd("ctx");
  5292. }; }),
  5293. $globals.String);
  5294. $core.addMethod(
  5295. $core.method({
  5296. selector: "asString",
  5297. protocol: "converting",
  5298. //>>excludeStart("ide", pragmas.excludeIdeData);
  5299. args: [],
  5300. source: "asString\x0a\x09^ self",
  5301. referencedClasses: [],
  5302. //>>excludeEnd("ide");
  5303. pragmas: [],
  5304. messageSends: []
  5305. }, function ($methodClass){ return function (){
  5306. var self=this,$self=this;
  5307. return self;
  5308. }; }),
  5309. $globals.String);
  5310. $core.addMethod(
  5311. $core.method({
  5312. selector: "asSymbol",
  5313. protocol: "converting",
  5314. //>>excludeStart("ide", pragmas.excludeIdeData);
  5315. args: [],
  5316. source: "asSymbol\x0a\x09^ self",
  5317. referencedClasses: [],
  5318. //>>excludeEnd("ide");
  5319. pragmas: [],
  5320. messageSends: []
  5321. }, function ($methodClass){ return function (){
  5322. var self=this,$self=this;
  5323. return self;
  5324. }; }),
  5325. $globals.String);
  5326. $core.addMethod(
  5327. $core.method({
  5328. selector: "asSymbolPrintOn:",
  5329. protocol: "printing",
  5330. //>>excludeStart("ide", pragmas.excludeIdeData);
  5331. args: ["aStream"],
  5332. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5333. referencedClasses: [],
  5334. //>>excludeEnd("ide");
  5335. pragmas: [],
  5336. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5337. }, function ($methodClass){ return function (aStream){
  5338. var self=this,$self=this;
  5339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5340. return $core.withContext(function($ctx1) {
  5341. //>>excludeEnd("ctx");
  5342. var $1;
  5343. $recv(aStream)._nextPutAll_("#");
  5344. $1=$recv($self._asString())._isSelector();
  5345. if($core.assert($1)){
  5346. $recv(aStream)._nextPut_(self);
  5347. } else {
  5348. $self._printOn_(aStream);
  5349. }
  5350. return self;
  5351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5352. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5353. //>>excludeEnd("ctx");
  5354. }; }),
  5355. $globals.String);
  5356. $core.addMethod(
  5357. $core.method({
  5358. selector: "asUppercase",
  5359. protocol: "converting",
  5360. //>>excludeStart("ide", pragmas.excludeIdeData);
  5361. args: [],
  5362. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5363. referencedClasses: [],
  5364. //>>excludeEnd("ide");
  5365. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5366. messageSends: []
  5367. }, function ($methodClass){ return function (){
  5368. var self=this,$self=this;
  5369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5370. return $core.withContext(function($ctx1) {
  5371. //>>excludeEnd("ctx");
  5372. return self.toUpperCase();
  5373. return self;
  5374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5375. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5376. //>>excludeEnd("ctx");
  5377. }; }),
  5378. $globals.String);
  5379. $core.addMethod(
  5380. $core.method({
  5381. selector: "asciiValue",
  5382. protocol: "accessing",
  5383. //>>excludeStart("ide", pragmas.excludeIdeData);
  5384. args: [],
  5385. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5386. referencedClasses: [],
  5387. //>>excludeEnd("ide");
  5388. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5389. messageSends: []
  5390. }, function ($methodClass){ return function (){
  5391. var self=this,$self=this;
  5392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5393. return $core.withContext(function($ctx1) {
  5394. //>>excludeEnd("ctx");
  5395. return self.charCodeAt(0);;
  5396. return self;
  5397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5398. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5399. //>>excludeEnd("ctx");
  5400. }; }),
  5401. $globals.String);
  5402. $core.addMethod(
  5403. $core.method({
  5404. selector: "at:ifAbsent:",
  5405. protocol: "accessing",
  5406. //>>excludeStart("ide", pragmas.excludeIdeData);
  5407. args: ["anIndex", "aBlock"],
  5408. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5409. referencedClasses: [],
  5410. //>>excludeEnd("ide");
  5411. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5412. messageSends: []
  5413. }, function ($methodClass){ return function (anIndex,aBlock){
  5414. var self=this,$self=this;
  5415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5416. return $core.withContext(function($ctx1) {
  5417. //>>excludeEnd("ctx");
  5418. return String(self)[anIndex - 1] || aBlock._value();
  5419. return self;
  5420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5421. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5422. //>>excludeEnd("ctx");
  5423. }; }),
  5424. $globals.String);
  5425. $core.addMethod(
  5426. $core.method({
  5427. selector: "at:ifPresent:ifAbsent:",
  5428. protocol: "accessing",
  5429. //>>excludeStart("ide", pragmas.excludeIdeData);
  5430. args: ["anIndex", "aBlock", "anotherBlock"],
  5431. 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'>",
  5432. referencedClasses: [],
  5433. //>>excludeEnd("ide");
  5434. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5435. messageSends: []
  5436. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5437. var self=this,$self=this;
  5438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5439. return $core.withContext(function($ctx1) {
  5440. //>>excludeEnd("ctx");
  5441. var result = String(self)[anIndex - 1];
  5442. return result ? aBlock._value_(result) : anotherBlock._value();
  5443. ;
  5444. return self;
  5445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5446. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5447. //>>excludeEnd("ctx");
  5448. }; }),
  5449. $globals.String);
  5450. $core.addMethod(
  5451. $core.method({
  5452. selector: "at:put:",
  5453. protocol: "accessing",
  5454. //>>excludeStart("ide", pragmas.excludeIdeData);
  5455. args: ["anIndex", "anObject"],
  5456. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5457. referencedClasses: [],
  5458. //>>excludeEnd("ide");
  5459. pragmas: [],
  5460. messageSends: ["errorReadOnly"]
  5461. }, function ($methodClass){ return function (anIndex,anObject){
  5462. var self=this,$self=this;
  5463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5464. return $core.withContext(function($ctx1) {
  5465. //>>excludeEnd("ctx");
  5466. $self._errorReadOnly();
  5467. return self;
  5468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5469. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5470. //>>excludeEnd("ctx");
  5471. }; }),
  5472. $globals.String);
  5473. $core.addMethod(
  5474. $core.method({
  5475. selector: "capitalized",
  5476. protocol: "converting",
  5477. //>>excludeStart("ide", pragmas.excludeIdeData);
  5478. args: [],
  5479. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5480. referencedClasses: [],
  5481. //>>excludeEnd("ide");
  5482. pragmas: [],
  5483. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5484. }, function ($methodClass){ return function (){
  5485. var self=this,$self=this;
  5486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5487. return $core.withContext(function($ctx1) {
  5488. //>>excludeEnd("ctx");
  5489. return $self._ifNotEmpty_((function(){
  5490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5491. return $core.withContext(function($ctx2) {
  5492. //>>excludeEnd("ctx");
  5493. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5496. //>>excludeEnd("ctx");
  5497. }));
  5498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5499. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5500. //>>excludeEnd("ctx");
  5501. }; }),
  5502. $globals.String);
  5503. $core.addMethod(
  5504. $core.method({
  5505. selector: "charCodeAt:",
  5506. protocol: "accessing",
  5507. //>>excludeStart("ide", pragmas.excludeIdeData);
  5508. args: ["anInteger"],
  5509. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5510. referencedClasses: [],
  5511. //>>excludeEnd("ide");
  5512. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5513. messageSends: []
  5514. }, function ($methodClass){ return function (anInteger){
  5515. var self=this,$self=this;
  5516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5517. return $core.withContext(function($ctx1) {
  5518. //>>excludeEnd("ctx");
  5519. return self.charCodeAt(anInteger - 1);
  5520. return self;
  5521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5522. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5523. //>>excludeEnd("ctx");
  5524. }; }),
  5525. $globals.String);
  5526. $core.addMethod(
  5527. $core.method({
  5528. selector: "copyFrom:to:",
  5529. protocol: "copying",
  5530. //>>excludeStart("ide", pragmas.excludeIdeData);
  5531. args: ["anIndex", "anotherIndex"],
  5532. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5533. referencedClasses: [],
  5534. //>>excludeEnd("ide");
  5535. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5536. messageSends: []
  5537. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5538. var self=this,$self=this;
  5539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5540. return $core.withContext(function($ctx1) {
  5541. //>>excludeEnd("ctx");
  5542. return self.substring(anIndex - 1, anotherIndex);
  5543. return self;
  5544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5545. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5546. //>>excludeEnd("ctx");
  5547. }; }),
  5548. $globals.String);
  5549. $core.addMethod(
  5550. $core.method({
  5551. selector: "copyWithFirst:",
  5552. protocol: "copying",
  5553. //>>excludeStart("ide", pragmas.excludeIdeData);
  5554. args: ["anObject"],
  5555. 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",
  5556. referencedClasses: [],
  5557. //>>excludeEnd("ide");
  5558. pragmas: [],
  5559. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5560. }, function ($methodClass){ return function (anObject){
  5561. var self=this,$self=this;
  5562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5563. return $core.withContext(function($ctx1) {
  5564. //>>excludeEnd("ctx");
  5565. var $1,$3,$2;
  5566. $1=$recv($recv(anObject)._isString())._and_((function(){
  5567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5568. return $core.withContext(function($ctx2) {
  5569. //>>excludeEnd("ctx");
  5570. return $recv($recv(anObject)._size()).__eq((1));
  5571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5572. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5573. //>>excludeEnd("ctx");
  5574. }));
  5575. if(!$core.assert($1)){
  5576. $3="Cannot put ".__comma($recv($recv(anObject)._class())._name());
  5577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5578. $ctx1.sendIdx[","]=2;
  5579. //>>excludeEnd("ctx");
  5580. $2=$recv($3).__comma(" in a String");
  5581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5582. $ctx1.sendIdx[","]=1;
  5583. //>>excludeEnd("ctx");
  5584. $self._error_($2);
  5585. }
  5586. return $recv(anObject).__comma(self);
  5587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5588. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5589. //>>excludeEnd("ctx");
  5590. }; }),
  5591. $globals.String);
  5592. $core.addMethod(
  5593. $core.method({
  5594. selector: "crlfSanitized",
  5595. protocol: "converting",
  5596. //>>excludeStart("ide", pragmas.excludeIdeData);
  5597. args: [],
  5598. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5599. referencedClasses: ["String"],
  5600. //>>excludeEnd("ide");
  5601. pragmas: [],
  5602. messageSends: ["join:", "lines", "lf"]
  5603. }, function ($methodClass){ return function (){
  5604. var self=this,$self=this;
  5605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5606. return $core.withContext(function($ctx1) {
  5607. //>>excludeEnd("ctx");
  5608. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5610. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5611. //>>excludeEnd("ctx");
  5612. }; }),
  5613. $globals.String);
  5614. $core.addMethod(
  5615. $core.method({
  5616. selector: "deepCopy",
  5617. protocol: "copying",
  5618. //>>excludeStart("ide", pragmas.excludeIdeData);
  5619. args: [],
  5620. source: "deepCopy\x0a\x09^ self shallowCopy",
  5621. referencedClasses: [],
  5622. //>>excludeEnd("ide");
  5623. pragmas: [],
  5624. messageSends: ["shallowCopy"]
  5625. }, function ($methodClass){ return function (){
  5626. var self=this,$self=this;
  5627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5628. return $core.withContext(function($ctx1) {
  5629. //>>excludeEnd("ctx");
  5630. return $self._shallowCopy();
  5631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5632. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5633. //>>excludeEnd("ctx");
  5634. }; }),
  5635. $globals.String);
  5636. $core.addMethod(
  5637. $core.method({
  5638. selector: "errorReadOnly",
  5639. protocol: "error handling",
  5640. //>>excludeStart("ide", pragmas.excludeIdeData);
  5641. args: [],
  5642. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5643. referencedClasses: [],
  5644. //>>excludeEnd("ide");
  5645. pragmas: [],
  5646. messageSends: ["error:"]
  5647. }, function ($methodClass){ return function (){
  5648. var self=this,$self=this;
  5649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5650. return $core.withContext(function($ctx1) {
  5651. //>>excludeEnd("ctx");
  5652. $self._error_("Object is read-only");
  5653. return self;
  5654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5655. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5656. //>>excludeEnd("ctx");
  5657. }; }),
  5658. $globals.String);
  5659. $core.addMethod(
  5660. $core.method({
  5661. selector: "escaped",
  5662. protocol: "converting",
  5663. //>>excludeStart("ide", pragmas.excludeIdeData);
  5664. args: [],
  5665. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5666. referencedClasses: [],
  5667. //>>excludeEnd("ide");
  5668. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5669. messageSends: []
  5670. }, function ($methodClass){ return function (){
  5671. var self=this,$self=this;
  5672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5673. return $core.withContext(function($ctx1) {
  5674. //>>excludeEnd("ctx");
  5675. return escape(self);
  5676. return self;
  5677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5678. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5679. //>>excludeEnd("ctx");
  5680. }; }),
  5681. $globals.String);
  5682. $core.addMethod(
  5683. $core.method({
  5684. selector: "includesSubString:",
  5685. protocol: "testing",
  5686. //>>excludeStart("ide", pragmas.excludeIdeData);
  5687. args: ["subString"],
  5688. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5689. referencedClasses: [],
  5690. //>>excludeEnd("ide");
  5691. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5692. messageSends: []
  5693. }, function ($methodClass){ return function (subString){
  5694. var self=this,$self=this;
  5695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5696. return $core.withContext(function($ctx1) {
  5697. //>>excludeEnd("ctx");
  5698. return self.indexOf(subString) != -1;
  5699. return self;
  5700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5701. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5702. //>>excludeEnd("ctx");
  5703. }; }),
  5704. $globals.String);
  5705. $core.addMethod(
  5706. $core.method({
  5707. selector: "isCapitalized",
  5708. protocol: "testing",
  5709. //>>excludeStart("ide", pragmas.excludeIdeData);
  5710. args: [],
  5711. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5712. referencedClasses: [],
  5713. //>>excludeEnd("ide");
  5714. pragmas: [],
  5715. messageSends: ["==", "asUppercase", "first"]
  5716. }, function ($methodClass){ return function (){
  5717. var self=this,$self=this;
  5718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5719. return $core.withContext(function($ctx1) {
  5720. //>>excludeEnd("ctx");
  5721. var $2,$1;
  5722. $2=$self._first();
  5723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5724. $ctx1.sendIdx["first"]=1;
  5725. //>>excludeEnd("ctx");
  5726. $1=$recv($2)._asUppercase();
  5727. return $recv($1).__eq_eq($self._first());
  5728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5729. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5730. //>>excludeEnd("ctx");
  5731. }; }),
  5732. $globals.String);
  5733. $core.addMethod(
  5734. $core.method({
  5735. selector: "isImmutable",
  5736. protocol: "testing",
  5737. //>>excludeStart("ide", pragmas.excludeIdeData);
  5738. args: [],
  5739. source: "isImmutable\x0a\x09^ true",
  5740. referencedClasses: [],
  5741. //>>excludeEnd("ide");
  5742. pragmas: [],
  5743. messageSends: []
  5744. }, function ($methodClass){ return function (){
  5745. var self=this,$self=this;
  5746. return true;
  5747. }; }),
  5748. $globals.String);
  5749. $core.addMethod(
  5750. $core.method({
  5751. selector: "isSelector",
  5752. protocol: "testing",
  5753. //>>excludeStart("ide", pragmas.excludeIdeData);
  5754. args: [],
  5755. 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>",
  5756. referencedClasses: [],
  5757. //>>excludeEnd("ide");
  5758. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5759. messageSends: []
  5760. }, function ($methodClass){ return function (){
  5761. var self=this,$self=this;
  5762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5763. return $core.withContext(function($ctx1) {
  5764. //>>excludeEnd("ctx");
  5765. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5766. return self;
  5767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5768. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5769. //>>excludeEnd("ctx");
  5770. }; }),
  5771. $globals.String);
  5772. $core.addMethod(
  5773. $core.method({
  5774. selector: "isString",
  5775. protocol: "testing",
  5776. //>>excludeStart("ide", pragmas.excludeIdeData);
  5777. args: [],
  5778. source: "isString\x0a\x09^ true",
  5779. referencedClasses: [],
  5780. //>>excludeEnd("ide");
  5781. pragmas: [],
  5782. messageSends: []
  5783. }, function ($methodClass){ return function (){
  5784. var self=this,$self=this;
  5785. return true;
  5786. }; }),
  5787. $globals.String);
  5788. $core.addMethod(
  5789. $core.method({
  5790. selector: "isVowel",
  5791. protocol: "testing",
  5792. //>>excludeStart("ide", pragmas.excludeIdeData);
  5793. args: [],
  5794. 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 ]",
  5795. referencedClasses: [],
  5796. //>>excludeEnd("ide");
  5797. pragmas: [],
  5798. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5799. }, function ($methodClass){ return function (){
  5800. var self=this,$self=this;
  5801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5802. return $core.withContext(function($ctx1) {
  5803. //>>excludeEnd("ctx");
  5804. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5806. return $core.withContext(function($ctx2) {
  5807. //>>excludeEnd("ctx");
  5808. return "aeiou"._includes_($self._asLowercase());
  5809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5810. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5811. //>>excludeEnd("ctx");
  5812. }));
  5813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5814. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5815. //>>excludeEnd("ctx");
  5816. }; }),
  5817. $globals.String);
  5818. $core.addMethod(
  5819. $core.method({
  5820. selector: "join:",
  5821. protocol: "split join",
  5822. //>>excludeStart("ide", pragmas.excludeIdeData);
  5823. args: ["aCollection"],
  5824. 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 ]]",
  5825. referencedClasses: ["String"],
  5826. //>>excludeEnd("ide");
  5827. pragmas: [],
  5828. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5829. }, function ($methodClass){ return function (aCollection){
  5830. var self=this,$self=this;
  5831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5832. return $core.withContext(function($ctx1) {
  5833. //>>excludeEnd("ctx");
  5834. return $recv($globals.String)._streamContents_((function(stream){
  5835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5836. return $core.withContext(function($ctx2) {
  5837. //>>excludeEnd("ctx");
  5838. return $recv(aCollection)._do_separatedBy_((function(each){
  5839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5840. return $core.withContext(function($ctx3) {
  5841. //>>excludeEnd("ctx");
  5842. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5844. $ctx3.sendIdx["nextPutAll:"]=1;
  5845. //>>excludeEnd("ctx");
  5846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5847. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5848. //>>excludeEnd("ctx");
  5849. }),(function(){
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. return $core.withContext(function($ctx3) {
  5852. //>>excludeEnd("ctx");
  5853. return $recv(stream)._nextPutAll_(self);
  5854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5855. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5856. //>>excludeEnd("ctx");
  5857. }));
  5858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5859. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5860. //>>excludeEnd("ctx");
  5861. }));
  5862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5863. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5864. //>>excludeEnd("ctx");
  5865. }; }),
  5866. $globals.String);
  5867. $core.addMethod(
  5868. $core.method({
  5869. selector: "lineIndicesDo:",
  5870. protocol: "split join",
  5871. //>>excludeStart("ide", pragmas.excludeIdeData);
  5872. args: ["aBlock"],
  5873. 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 ] ]]",
  5874. referencedClasses: ["String"],
  5875. //>>excludeEnd("ide");
  5876. pragmas: [],
  5877. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5878. }, function ($methodClass){ return function (aBlock){
  5879. var self=this,$self=this;
  5880. var cr,lf,start,sz,nextLF,nextCR;
  5881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5882. return $core.withContext(function($ctx1) {
  5883. //>>excludeEnd("ctx");
  5884. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5885. var $early={};
  5886. try {
  5887. start=(1);
  5888. sz=$self._size();
  5889. cr=$recv($globals.String)._cr();
  5890. nextCR=$self._indexOf_startingAt_(cr,(1));
  5891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5892. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5893. //>>excludeEnd("ctx");
  5894. lf=$recv($globals.String)._lf();
  5895. nextLF=$self._indexOf_startingAt_(lf,(1));
  5896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5897. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5898. //>>excludeEnd("ctx");
  5899. $recv((function(){
  5900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5901. return $core.withContext(function($ctx2) {
  5902. //>>excludeEnd("ctx");
  5903. return $recv(start).__lt_eq(sz);
  5904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5906. //>>excludeEnd("ctx");
  5907. }))._whileTrue_((function(){
  5908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5909. return $core.withContext(function($ctx2) {
  5910. //>>excludeEnd("ctx");
  5911. $2=$recv(nextLF).__eq((0));
  5912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5913. $ctx2.sendIdx["="]=1;
  5914. //>>excludeEnd("ctx");
  5915. $1=$recv($2)._and_((function(){
  5916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5917. return $core.withContext(function($ctx3) {
  5918. //>>excludeEnd("ctx");
  5919. return $recv(nextCR).__eq((0));
  5920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5921. $ctx3.sendIdx["="]=2;
  5922. //>>excludeEnd("ctx");
  5923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5924. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5925. //>>excludeEnd("ctx");
  5926. }));
  5927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5928. $ctx2.sendIdx["and:"]=1;
  5929. //>>excludeEnd("ctx");
  5930. if($core.assert($1)){
  5931. $recv(aBlock)._value_value_value_(start,sz,sz);
  5932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5933. $ctx2.sendIdx["value:value:value:"]=1;
  5934. //>>excludeEnd("ctx");
  5935. throw $early=[self];
  5936. }
  5937. $4=$recv(nextCR).__eq((0));
  5938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5939. $ctx2.sendIdx["="]=3;
  5940. //>>excludeEnd("ctx");
  5941. $3=$recv($4)._or_((function(){
  5942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5943. return $core.withContext(function($ctx3) {
  5944. //>>excludeEnd("ctx");
  5945. $5=(0).__lt(nextLF);
  5946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5947. $ctx3.sendIdx["<"]=1;
  5948. //>>excludeEnd("ctx");
  5949. return $recv($5)._and_((function(){
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. return $core.withContext(function($ctx4) {
  5952. //>>excludeEnd("ctx");
  5953. return $recv(nextLF).__lt(nextCR);
  5954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5955. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5956. //>>excludeEnd("ctx");
  5957. }));
  5958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5959. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5960. //>>excludeEnd("ctx");
  5961. }));
  5962. if($core.assert($3)){
  5963. $6=start;
  5964. $7=$recv(nextLF).__minus((1));
  5965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5966. $ctx2.sendIdx["-"]=1;
  5967. //>>excludeEnd("ctx");
  5968. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5970. $ctx2.sendIdx["value:value:value:"]=2;
  5971. //>>excludeEnd("ctx");
  5972. start=(1).__plus(nextLF);
  5973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5974. $ctx2.sendIdx["+"]=1;
  5975. //>>excludeEnd("ctx");
  5976. nextLF=$self._indexOf_startingAt_(lf,start);
  5977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5978. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5979. //>>excludeEnd("ctx");
  5980. return nextLF;
  5981. } else {
  5982. $9=(1).__plus(nextCR);
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. $ctx2.sendIdx["+"]=2;
  5985. //>>excludeEnd("ctx");
  5986. $8=$recv($9).__eq(nextLF);
  5987. if($core.assert($8)){
  5988. $10=start;
  5989. $11=$recv(nextCR).__minus((1));
  5990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5991. $ctx2.sendIdx["-"]=2;
  5992. //>>excludeEnd("ctx");
  5993. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5995. $ctx2.sendIdx["value:value:value:"]=3;
  5996. //>>excludeEnd("ctx");
  5997. start=(1).__plus(nextLF);
  5998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5999. $ctx2.sendIdx["+"]=3;
  6000. //>>excludeEnd("ctx");
  6001. nextCR=$self._indexOf_startingAt_(cr,start);
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6004. //>>excludeEnd("ctx");
  6005. nextLF=$self._indexOf_startingAt_(lf,start);
  6006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6007. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6008. //>>excludeEnd("ctx");
  6009. return nextLF;
  6010. } else {
  6011. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6012. start=(1).__plus(nextCR);
  6013. nextCR=$self._indexOf_startingAt_(cr,start);
  6014. return nextCR;
  6015. }
  6016. }
  6017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6018. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6019. //>>excludeEnd("ctx");
  6020. }));
  6021. return self;
  6022. }
  6023. catch(e) {if(e===$early)return e[0]; throw e}
  6024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6025. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6026. //>>excludeEnd("ctx");
  6027. }; }),
  6028. $globals.String);
  6029. $core.addMethod(
  6030. $core.method({
  6031. selector: "lineNumber:",
  6032. protocol: "split join",
  6033. //>>excludeStart("ide", pragmas.excludeIdeData);
  6034. args: ["anIndex"],
  6035. 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",
  6036. referencedClasses: [],
  6037. //>>excludeEnd("ide");
  6038. pragmas: [],
  6039. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6040. }, function ($methodClass){ return function (anIndex){
  6041. var self=this,$self=this;
  6042. var lineCount;
  6043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6044. return $core.withContext(function($ctx1) {
  6045. //>>excludeEnd("ctx");
  6046. var $2,$1;
  6047. var $early={};
  6048. try {
  6049. lineCount=(0);
  6050. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6052. return $core.withContext(function($ctx2) {
  6053. //>>excludeEnd("ctx");
  6054. lineCount=$recv(lineCount).__plus((1));
  6055. $2=lineCount;
  6056. $1=$recv($2).__eq(anIndex);
  6057. if($core.assert($1)){
  6058. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6059. }
  6060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6061. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6062. //>>excludeEnd("ctx");
  6063. }));
  6064. return nil;
  6065. }
  6066. catch(e) {if(e===$early)return e[0]; throw e}
  6067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6068. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6069. //>>excludeEnd("ctx");
  6070. }; }),
  6071. $globals.String);
  6072. $core.addMethod(
  6073. $core.method({
  6074. selector: "lines",
  6075. protocol: "split join",
  6076. //>>excludeStart("ide", pragmas.excludeIdeData);
  6077. args: [],
  6078. 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'>",
  6079. referencedClasses: [],
  6080. //>>excludeEnd("ide");
  6081. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6082. messageSends: []
  6083. }, function ($methodClass){ return function (){
  6084. var self=this,$self=this;
  6085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6086. return $core.withContext(function($ctx1) {
  6087. //>>excludeEnd("ctx");
  6088. var result = self.split(/\r\n|\r|\n/);
  6089. if (!result[result.length-1]) result.pop();
  6090. return result;;
  6091. return self;
  6092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6093. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6094. //>>excludeEnd("ctx");
  6095. }; }),
  6096. $globals.String);
  6097. $core.addMethod(
  6098. $core.method({
  6099. selector: "linesDo:",
  6100. protocol: "split join",
  6101. //>>excludeStart("ide", pragmas.excludeIdeData);
  6102. args: ["aBlock"],
  6103. 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",
  6104. referencedClasses: [],
  6105. //>>excludeEnd("ide");
  6106. pragmas: [],
  6107. messageSends: ["do:", "lines"]
  6108. }, function ($methodClass){ return function (aBlock){
  6109. var self=this,$self=this;
  6110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6111. return $core.withContext(function($ctx1) {
  6112. //>>excludeEnd("ctx");
  6113. $recv($self._lines())._do_(aBlock);
  6114. return self;
  6115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6116. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6117. //>>excludeEnd("ctx");
  6118. }; }),
  6119. $globals.String);
  6120. $core.addMethod(
  6121. $core.method({
  6122. selector: "match:",
  6123. protocol: "regular expressions",
  6124. //>>excludeStart("ide", pragmas.excludeIdeData);
  6125. args: ["aRegexp"],
  6126. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6127. referencedClasses: [],
  6128. //>>excludeEnd("ide");
  6129. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6130. messageSends: []
  6131. }, function ($methodClass){ return function (aRegexp){
  6132. var self=this,$self=this;
  6133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6134. return $core.withContext(function($ctx1) {
  6135. //>>excludeEnd("ctx");
  6136. return self.search(aRegexp) != -1;
  6137. return self;
  6138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6139. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6140. //>>excludeEnd("ctx");
  6141. }; }),
  6142. $globals.String);
  6143. $core.addMethod(
  6144. $core.method({
  6145. selector: "matchesOf:",
  6146. protocol: "regular expressions",
  6147. //>>excludeStart("ide", pragmas.excludeIdeData);
  6148. args: ["aRegularExpression"],
  6149. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6150. referencedClasses: [],
  6151. //>>excludeEnd("ide");
  6152. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6153. messageSends: []
  6154. }, function ($methodClass){ return function (aRegularExpression){
  6155. var self=this,$self=this;
  6156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6157. return $core.withContext(function($ctx1) {
  6158. //>>excludeEnd("ctx");
  6159. return self.match(aRegularExpression);
  6160. return self;
  6161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6162. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6163. //>>excludeEnd("ctx");
  6164. }; }),
  6165. $globals.String);
  6166. $core.addMethod(
  6167. $core.method({
  6168. selector: "printNl",
  6169. protocol: "printing",
  6170. //>>excludeStart("ide", pragmas.excludeIdeData);
  6171. args: [],
  6172. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6173. referencedClasses: [],
  6174. //>>excludeEnd("ide");
  6175. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6176. messageSends: []
  6177. }, function ($methodClass){ return function (){
  6178. var self=this,$self=this;
  6179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6180. return $core.withContext(function($ctx1) {
  6181. //>>excludeEnd("ctx");
  6182. console.log(self);
  6183. return self;
  6184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6185. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6186. //>>excludeEnd("ctx");
  6187. }; }),
  6188. $globals.String);
  6189. $core.addMethod(
  6190. $core.method({
  6191. selector: "printOn:",
  6192. protocol: "printing",
  6193. //>>excludeStart("ide", pragmas.excludeIdeData);
  6194. args: ["aStream"],
  6195. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6196. referencedClasses: [],
  6197. //>>excludeEnd("ide");
  6198. pragmas: [],
  6199. messageSends: ["nextPutAll:", "replace:with:"]
  6200. }, function ($methodClass){ return function (aStream){
  6201. var self=this,$self=this;
  6202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6203. return $core.withContext(function($ctx1) {
  6204. //>>excludeEnd("ctx");
  6205. $recv(aStream)._nextPutAll_("'");
  6206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6207. $ctx1.sendIdx["nextPutAll:"]=1;
  6208. //>>excludeEnd("ctx");
  6209. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6211. $ctx1.sendIdx["nextPutAll:"]=2;
  6212. //>>excludeEnd("ctx");
  6213. $recv(aStream)._nextPutAll_("'");
  6214. return self;
  6215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6216. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6217. //>>excludeEnd("ctx");
  6218. }; }),
  6219. $globals.String);
  6220. $core.addMethod(
  6221. $core.method({
  6222. selector: "putOn:",
  6223. protocol: "streaming",
  6224. //>>excludeStart("ide", pragmas.excludeIdeData);
  6225. args: ["aStream"],
  6226. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6227. referencedClasses: [],
  6228. //>>excludeEnd("ide");
  6229. pragmas: [],
  6230. messageSends: ["nextPutString:"]
  6231. }, function ($methodClass){ return function (aStream){
  6232. var self=this,$self=this;
  6233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6234. return $core.withContext(function($ctx1) {
  6235. //>>excludeEnd("ctx");
  6236. $recv(aStream)._nextPutString_(self);
  6237. return self;
  6238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6239. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6240. //>>excludeEnd("ctx");
  6241. }; }),
  6242. $globals.String);
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "remove:",
  6246. protocol: "adding/removing",
  6247. //>>excludeStart("ide", pragmas.excludeIdeData);
  6248. args: ["anObject"],
  6249. source: "remove: anObject\x0a\x09self errorReadOnly",
  6250. referencedClasses: [],
  6251. //>>excludeEnd("ide");
  6252. pragmas: [],
  6253. messageSends: ["errorReadOnly"]
  6254. }, function ($methodClass){ return function (anObject){
  6255. var self=this,$self=this;
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. return $core.withContext(function($ctx1) {
  6258. //>>excludeEnd("ctx");
  6259. $self._errorReadOnly();
  6260. return self;
  6261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6262. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6263. //>>excludeEnd("ctx");
  6264. }; }),
  6265. $globals.String);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "remove:ifAbsent:",
  6269. protocol: "adding/removing",
  6270. //>>excludeStart("ide", pragmas.excludeIdeData);
  6271. args: ["anObject", "aBlock"],
  6272. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6273. referencedClasses: [],
  6274. //>>excludeEnd("ide");
  6275. pragmas: [],
  6276. messageSends: ["errorReadOnly"]
  6277. }, function ($methodClass){ return function (anObject,aBlock){
  6278. var self=this,$self=this;
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. return $core.withContext(function($ctx1) {
  6281. //>>excludeEnd("ctx");
  6282. $self._errorReadOnly();
  6283. return self;
  6284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6285. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6286. //>>excludeEnd("ctx");
  6287. }; }),
  6288. $globals.String);
  6289. $core.addMethod(
  6290. $core.method({
  6291. selector: "replace:with:",
  6292. protocol: "regular expressions",
  6293. //>>excludeStart("ide", pragmas.excludeIdeData);
  6294. args: ["aString", "anotherString"],
  6295. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6296. referencedClasses: ["RegularExpression"],
  6297. //>>excludeEnd("ide");
  6298. pragmas: [],
  6299. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6300. }, function ($methodClass){ return function (aString,anotherString){
  6301. var self=this,$self=this;
  6302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6303. return $core.withContext(function($ctx1) {
  6304. //>>excludeEnd("ctx");
  6305. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6307. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6308. //>>excludeEnd("ctx");
  6309. }; }),
  6310. $globals.String);
  6311. $core.addMethod(
  6312. $core.method({
  6313. selector: "replaceRegexp:with:",
  6314. protocol: "regular expressions",
  6315. //>>excludeStart("ide", pragmas.excludeIdeData);
  6316. args: ["aRegexp", "aString"],
  6317. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6318. referencedClasses: [],
  6319. //>>excludeEnd("ide");
  6320. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6321. messageSends: []
  6322. }, function ($methodClass){ return function (aRegexp,aString){
  6323. var self=this,$self=this;
  6324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6325. return $core.withContext(function($ctx1) {
  6326. //>>excludeEnd("ctx");
  6327. return self.replace(aRegexp, aString);
  6328. return self;
  6329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6330. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6331. //>>excludeEnd("ctx");
  6332. }; }),
  6333. $globals.String);
  6334. $core.addMethod(
  6335. $core.method({
  6336. selector: "reversed",
  6337. protocol: "converting",
  6338. //>>excludeStart("ide", pragmas.excludeIdeData);
  6339. args: [],
  6340. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6341. referencedClasses: [],
  6342. //>>excludeEnd("ide");
  6343. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6344. messageSends: []
  6345. }, function ($methodClass){ return function (){
  6346. var self=this,$self=this;
  6347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6348. return $core.withContext(function($ctx1) {
  6349. //>>excludeEnd("ctx");
  6350. return self.split("").reverse().join("");
  6351. return self;
  6352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6353. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6354. //>>excludeEnd("ctx");
  6355. }; }),
  6356. $globals.String);
  6357. $core.addMethod(
  6358. $core.method({
  6359. selector: "shallowCopy",
  6360. protocol: "copying",
  6361. //>>excludeStart("ide", pragmas.excludeIdeData);
  6362. args: [],
  6363. source: "shallowCopy\x0a\x09^ self",
  6364. referencedClasses: [],
  6365. //>>excludeEnd("ide");
  6366. pragmas: [],
  6367. messageSends: []
  6368. }, function ($methodClass){ return function (){
  6369. var self=this,$self=this;
  6370. return self;
  6371. }; }),
  6372. $globals.String);
  6373. $core.addMethod(
  6374. $core.method({
  6375. selector: "subStrings:",
  6376. protocol: "split join",
  6377. //>>excludeStart("ide", pragmas.excludeIdeData);
  6378. args: ["aString"],
  6379. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6380. referencedClasses: [],
  6381. //>>excludeEnd("ide");
  6382. pragmas: [],
  6383. messageSends: ["tokenize:"]
  6384. }, function ($methodClass){ return function (aString){
  6385. var self=this,$self=this;
  6386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6387. return $core.withContext(function($ctx1) {
  6388. //>>excludeEnd("ctx");
  6389. return $self._tokenize_(aString);
  6390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6391. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6392. //>>excludeEnd("ctx");
  6393. }; }),
  6394. $globals.String);
  6395. $core.addMethod(
  6396. $core.method({
  6397. selector: "symbolPrintString",
  6398. protocol: "printing",
  6399. //>>excludeStart("ide", pragmas.excludeIdeData);
  6400. args: [],
  6401. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6402. referencedClasses: ["String"],
  6403. //>>excludeEnd("ide");
  6404. pragmas: [],
  6405. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6406. }, function ($methodClass){ return function (){
  6407. var self=this,$self=this;
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. return $core.withContext(function($ctx1) {
  6410. //>>excludeEnd("ctx");
  6411. return $recv($globals.String)._streamContents_((function(str){
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. return $core.withContext(function($ctx2) {
  6414. //>>excludeEnd("ctx");
  6415. return $self._asSymbolPrintOn_(str);
  6416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6417. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6418. //>>excludeEnd("ctx");
  6419. }));
  6420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6421. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6422. //>>excludeEnd("ctx");
  6423. }; }),
  6424. $globals.String);
  6425. $core.addMethod(
  6426. $core.method({
  6427. selector: "tokenize:",
  6428. protocol: "split join",
  6429. //>>excludeStart("ide", pragmas.excludeIdeData);
  6430. args: ["aString"],
  6431. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6432. referencedClasses: [],
  6433. //>>excludeEnd("ide");
  6434. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6435. messageSends: []
  6436. }, function ($methodClass){ return function (aString){
  6437. var self=this,$self=this;
  6438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6439. return $core.withContext(function($ctx1) {
  6440. //>>excludeEnd("ctx");
  6441. return self.split(aString);
  6442. return self;
  6443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6444. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6445. //>>excludeEnd("ctx");
  6446. }; }),
  6447. $globals.String);
  6448. $core.addMethod(
  6449. $core.method({
  6450. selector: "trimBoth",
  6451. protocol: "regular expressions",
  6452. //>>excludeStart("ide", pragmas.excludeIdeData);
  6453. args: [],
  6454. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6455. referencedClasses: [],
  6456. //>>excludeEnd("ide");
  6457. pragmas: [],
  6458. messageSends: ["trimBoth:"]
  6459. }, function ($methodClass){ return function (){
  6460. var self=this,$self=this;
  6461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6462. return $core.withContext(function($ctx1) {
  6463. //>>excludeEnd("ctx");
  6464. return $self._trimBoth_("\x5cs");
  6465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6466. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6467. //>>excludeEnd("ctx");
  6468. }; }),
  6469. $globals.String);
  6470. $core.addMethod(
  6471. $core.method({
  6472. selector: "trimBoth:",
  6473. protocol: "regular expressions",
  6474. //>>excludeStart("ide", pragmas.excludeIdeData);
  6475. args: ["separators"],
  6476. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6477. referencedClasses: [],
  6478. //>>excludeEnd("ide");
  6479. pragmas: [],
  6480. messageSends: ["trimRight:", "trimLeft:"]
  6481. }, function ($methodClass){ return function (separators){
  6482. var self=this,$self=this;
  6483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6484. return $core.withContext(function($ctx1) {
  6485. //>>excludeEnd("ctx");
  6486. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6488. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6489. //>>excludeEnd("ctx");
  6490. }; }),
  6491. $globals.String);
  6492. $core.addMethod(
  6493. $core.method({
  6494. selector: "trimLeft",
  6495. protocol: "regular expressions",
  6496. //>>excludeStart("ide", pragmas.excludeIdeData);
  6497. args: [],
  6498. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6499. referencedClasses: [],
  6500. //>>excludeEnd("ide");
  6501. pragmas: [],
  6502. messageSends: ["trimLeft:"]
  6503. }, function ($methodClass){ return function (){
  6504. var self=this,$self=this;
  6505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6506. return $core.withContext(function($ctx1) {
  6507. //>>excludeEnd("ctx");
  6508. return $self._trimLeft_("\x5cs");
  6509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6510. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6511. //>>excludeEnd("ctx");
  6512. }; }),
  6513. $globals.String);
  6514. $core.addMethod(
  6515. $core.method({
  6516. selector: "trimLeft:",
  6517. protocol: "regular expressions",
  6518. //>>excludeStart("ide", pragmas.excludeIdeData);
  6519. args: ["separators"],
  6520. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6521. referencedClasses: ["RegularExpression"],
  6522. //>>excludeEnd("ide");
  6523. pragmas: [],
  6524. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6525. }, function ($methodClass){ return function (separators){
  6526. var self=this,$self=this;
  6527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6528. return $core.withContext(function($ctx1) {
  6529. //>>excludeEnd("ctx");
  6530. var $2,$1;
  6531. $2=$recv("^[".__comma(separators)).__comma("]+");
  6532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6533. $ctx1.sendIdx[","]=1;
  6534. //>>excludeEnd("ctx");
  6535. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6536. return $self._replaceRegexp_with_($1,"");
  6537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6538. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6539. //>>excludeEnd("ctx");
  6540. }; }),
  6541. $globals.String);
  6542. $core.addMethod(
  6543. $core.method({
  6544. selector: "trimRight",
  6545. protocol: "regular expressions",
  6546. //>>excludeStart("ide", pragmas.excludeIdeData);
  6547. args: [],
  6548. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6549. referencedClasses: [],
  6550. //>>excludeEnd("ide");
  6551. pragmas: [],
  6552. messageSends: ["trimRight:"]
  6553. }, function ($methodClass){ return function (){
  6554. var self=this,$self=this;
  6555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6556. return $core.withContext(function($ctx1) {
  6557. //>>excludeEnd("ctx");
  6558. return $self._trimRight_("\x5cs");
  6559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6560. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6561. //>>excludeEnd("ctx");
  6562. }; }),
  6563. $globals.String);
  6564. $core.addMethod(
  6565. $core.method({
  6566. selector: "trimRight:",
  6567. protocol: "regular expressions",
  6568. //>>excludeStart("ide", pragmas.excludeIdeData);
  6569. args: ["separators"],
  6570. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6571. referencedClasses: ["RegularExpression"],
  6572. //>>excludeEnd("ide");
  6573. pragmas: [],
  6574. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6575. }, function ($methodClass){ return function (separators){
  6576. var self=this,$self=this;
  6577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6578. return $core.withContext(function($ctx1) {
  6579. //>>excludeEnd("ctx");
  6580. var $2,$1;
  6581. $2=$recv("[".__comma(separators)).__comma("]+$");
  6582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6583. $ctx1.sendIdx[","]=1;
  6584. //>>excludeEnd("ctx");
  6585. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6586. return $self._replaceRegexp_with_($1,"");
  6587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6588. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6589. //>>excludeEnd("ctx");
  6590. }; }),
  6591. $globals.String);
  6592. $core.addMethod(
  6593. $core.method({
  6594. selector: "unescaped",
  6595. protocol: "converting",
  6596. //>>excludeStart("ide", pragmas.excludeIdeData);
  6597. args: [],
  6598. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6599. referencedClasses: [],
  6600. //>>excludeEnd("ide");
  6601. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6602. messageSends: []
  6603. }, function ($methodClass){ return function (){
  6604. var self=this,$self=this;
  6605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6606. return $core.withContext(function($ctx1) {
  6607. //>>excludeEnd("ctx");
  6608. return unescape(self);
  6609. return self;
  6610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6611. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6612. //>>excludeEnd("ctx");
  6613. }; }),
  6614. $globals.String);
  6615. $core.addMethod(
  6616. $core.method({
  6617. selector: "uriComponentDecoded",
  6618. protocol: "converting",
  6619. //>>excludeStart("ide", pragmas.excludeIdeData);
  6620. args: [],
  6621. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6622. referencedClasses: [],
  6623. //>>excludeEnd("ide");
  6624. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6625. messageSends: []
  6626. }, function ($methodClass){ return function (){
  6627. var self=this,$self=this;
  6628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6629. return $core.withContext(function($ctx1) {
  6630. //>>excludeEnd("ctx");
  6631. return decodeURIComponent(self);
  6632. return self;
  6633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6634. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6635. //>>excludeEnd("ctx");
  6636. }; }),
  6637. $globals.String);
  6638. $core.addMethod(
  6639. $core.method({
  6640. selector: "uriComponentEncoded",
  6641. protocol: "converting",
  6642. //>>excludeStart("ide", pragmas.excludeIdeData);
  6643. args: [],
  6644. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6645. referencedClasses: [],
  6646. //>>excludeEnd("ide");
  6647. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6648. messageSends: []
  6649. }, function ($methodClass){ return function (){
  6650. var self=this,$self=this;
  6651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6652. return $core.withContext(function($ctx1) {
  6653. //>>excludeEnd("ctx");
  6654. return encodeURIComponent(self);
  6655. return self;
  6656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6657. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6658. //>>excludeEnd("ctx");
  6659. }; }),
  6660. $globals.String);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "uriDecoded",
  6664. protocol: "converting",
  6665. //>>excludeStart("ide", pragmas.excludeIdeData);
  6666. args: [],
  6667. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6668. referencedClasses: [],
  6669. //>>excludeEnd("ide");
  6670. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6671. messageSends: []
  6672. }, function ($methodClass){ return function (){
  6673. var self=this,$self=this;
  6674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6675. return $core.withContext(function($ctx1) {
  6676. //>>excludeEnd("ctx");
  6677. return decodeURI(self);
  6678. return self;
  6679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6680. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6681. //>>excludeEnd("ctx");
  6682. }; }),
  6683. $globals.String);
  6684. $core.addMethod(
  6685. $core.method({
  6686. selector: "uriEncoded",
  6687. protocol: "converting",
  6688. //>>excludeStart("ide", pragmas.excludeIdeData);
  6689. args: [],
  6690. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6691. referencedClasses: [],
  6692. //>>excludeEnd("ide");
  6693. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6694. messageSends: []
  6695. }, function ($methodClass){ return function (){
  6696. var self=this,$self=this;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. return $core.withContext(function($ctx1) {
  6699. //>>excludeEnd("ctx");
  6700. return encodeURI(self);
  6701. return self;
  6702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6703. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6704. //>>excludeEnd("ctx");
  6705. }; }),
  6706. $globals.String);
  6707. $core.addMethod(
  6708. $core.method({
  6709. selector: "value:",
  6710. protocol: "evaluating",
  6711. //>>excludeStart("ide", pragmas.excludeIdeData);
  6712. args: ["anObject"],
  6713. source: "value: anObject \x0a\x09^ anObject perform: self",
  6714. referencedClasses: [],
  6715. //>>excludeEnd("ide");
  6716. pragmas: [],
  6717. messageSends: ["perform:"]
  6718. }, function ($methodClass){ return function (anObject){
  6719. var self=this,$self=this;
  6720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6721. return $core.withContext(function($ctx1) {
  6722. //>>excludeEnd("ctx");
  6723. return $recv(anObject)._perform_(self);
  6724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6725. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6726. //>>excludeEnd("ctx");
  6727. }; }),
  6728. $globals.String);
  6729. $core.addMethod(
  6730. $core.method({
  6731. selector: "cr",
  6732. protocol: "accessing",
  6733. //>>excludeStart("ide", pragmas.excludeIdeData);
  6734. args: [],
  6735. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6736. referencedClasses: [],
  6737. //>>excludeEnd("ide");
  6738. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6739. messageSends: []
  6740. }, function ($methodClass){ return function (){
  6741. var self=this,$self=this;
  6742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6743. return $core.withContext(function($ctx1) {
  6744. //>>excludeEnd("ctx");
  6745. return "\r";
  6746. return self;
  6747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6748. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6749. //>>excludeEnd("ctx");
  6750. }; }),
  6751. $globals.String.a$cls);
  6752. $core.addMethod(
  6753. $core.method({
  6754. selector: "crlf",
  6755. protocol: "accessing",
  6756. //>>excludeStart("ide", pragmas.excludeIdeData);
  6757. args: [],
  6758. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6759. referencedClasses: [],
  6760. //>>excludeEnd("ide");
  6761. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6762. messageSends: []
  6763. }, function ($methodClass){ return function (){
  6764. var self=this,$self=this;
  6765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6766. return $core.withContext(function($ctx1) {
  6767. //>>excludeEnd("ctx");
  6768. return "\r\n";
  6769. return self;
  6770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6771. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6772. //>>excludeEnd("ctx");
  6773. }; }),
  6774. $globals.String.a$cls);
  6775. $core.addMethod(
  6776. $core.method({
  6777. selector: "esc",
  6778. protocol: "accessing",
  6779. //>>excludeStart("ide", pragmas.excludeIdeData);
  6780. args: [],
  6781. source: "esc\x0a\x09^ self fromCharCode: 27",
  6782. referencedClasses: [],
  6783. //>>excludeEnd("ide");
  6784. pragmas: [],
  6785. messageSends: ["fromCharCode:"]
  6786. }, function ($methodClass){ return function (){
  6787. var self=this,$self=this;
  6788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6789. return $core.withContext(function($ctx1) {
  6790. //>>excludeEnd("ctx");
  6791. return $self._fromCharCode_((27));
  6792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6793. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6794. //>>excludeEnd("ctx");
  6795. }; }),
  6796. $globals.String.a$cls);
  6797. $core.addMethod(
  6798. $core.method({
  6799. selector: "fromCharCode:",
  6800. protocol: "instance creation",
  6801. //>>excludeStart("ide", pragmas.excludeIdeData);
  6802. args: ["anInteger"],
  6803. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6804. referencedClasses: [],
  6805. //>>excludeEnd("ide");
  6806. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6807. messageSends: []
  6808. }, function ($methodClass){ return function (anInteger){
  6809. var self=this,$self=this;
  6810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6811. return $core.withContext(function($ctx1) {
  6812. //>>excludeEnd("ctx");
  6813. return String.fromCharCode(anInteger);
  6814. return self;
  6815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6816. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6817. //>>excludeEnd("ctx");
  6818. }; }),
  6819. $globals.String.a$cls);
  6820. $core.addMethod(
  6821. $core.method({
  6822. selector: "fromString:",
  6823. protocol: "instance creation",
  6824. //>>excludeStart("ide", pragmas.excludeIdeData);
  6825. args: ["aString"],
  6826. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6827. referencedClasses: [],
  6828. //>>excludeEnd("ide");
  6829. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6830. messageSends: []
  6831. }, function ($methodClass){ return function (aString){
  6832. var self=this,$self=this;
  6833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6834. return $core.withContext(function($ctx1) {
  6835. //>>excludeEnd("ctx");
  6836. return String(aString);
  6837. return self;
  6838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6839. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6840. //>>excludeEnd("ctx");
  6841. }; }),
  6842. $globals.String.a$cls);
  6843. $core.addMethod(
  6844. $core.method({
  6845. selector: "lf",
  6846. protocol: "accessing",
  6847. //>>excludeStart("ide", pragmas.excludeIdeData);
  6848. args: [],
  6849. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6850. referencedClasses: [],
  6851. //>>excludeEnd("ide");
  6852. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6853. messageSends: []
  6854. }, function ($methodClass){ return function (){
  6855. var self=this,$self=this;
  6856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6857. return $core.withContext(function($ctx1) {
  6858. //>>excludeEnd("ctx");
  6859. return "\n";
  6860. return self;
  6861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6862. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6863. //>>excludeEnd("ctx");
  6864. }; }),
  6865. $globals.String.a$cls);
  6866. $core.addMethod(
  6867. $core.method({
  6868. selector: "random",
  6869. protocol: "random",
  6870. //>>excludeStart("ide", pragmas.excludeIdeData);
  6871. args: [],
  6872. 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);'>",
  6873. referencedClasses: [],
  6874. //>>excludeEnd("ide");
  6875. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6876. messageSends: []
  6877. }, function ($methodClass){ return function (){
  6878. var self=this,$self=this;
  6879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6880. return $core.withContext(function($ctx1) {
  6881. //>>excludeEnd("ctx");
  6882. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6883. return self;
  6884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6885. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6886. //>>excludeEnd("ctx");
  6887. }; }),
  6888. $globals.String.a$cls);
  6889. $core.addMethod(
  6890. $core.method({
  6891. selector: "randomNotIn:",
  6892. protocol: "random",
  6893. //>>excludeStart("ide", pragmas.excludeIdeData);
  6894. args: ["aString"],
  6895. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6896. referencedClasses: [],
  6897. //>>excludeEnd("ide");
  6898. pragmas: [],
  6899. messageSends: ["whileTrue", "random", "includesSubString:"]
  6900. }, function ($methodClass){ return function (aString){
  6901. var self=this,$self=this;
  6902. var result;
  6903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6904. return $core.withContext(function($ctx1) {
  6905. //>>excludeEnd("ctx");
  6906. $recv((function(){
  6907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6908. return $core.withContext(function($ctx2) {
  6909. //>>excludeEnd("ctx");
  6910. result=$self._random();
  6911. return $recv(aString)._includesSubString_(result);
  6912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6914. //>>excludeEnd("ctx");
  6915. }))._whileTrue();
  6916. return result;
  6917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6918. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6919. //>>excludeEnd("ctx");
  6920. }; }),
  6921. $globals.String.a$cls);
  6922. $core.addMethod(
  6923. $core.method({
  6924. selector: "space",
  6925. protocol: "accessing",
  6926. //>>excludeStart("ide", pragmas.excludeIdeData);
  6927. args: [],
  6928. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6929. referencedClasses: [],
  6930. //>>excludeEnd("ide");
  6931. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6932. messageSends: []
  6933. }, function ($methodClass){ return function (){
  6934. var self=this,$self=this;
  6935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6936. return $core.withContext(function($ctx1) {
  6937. //>>excludeEnd("ctx");
  6938. return " ";
  6939. return self;
  6940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6941. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6942. //>>excludeEnd("ctx");
  6943. }; }),
  6944. $globals.String.a$cls);
  6945. $core.addMethod(
  6946. $core.method({
  6947. selector: "streamClass",
  6948. protocol: "accessing",
  6949. //>>excludeStart("ide", pragmas.excludeIdeData);
  6950. args: [],
  6951. source: "streamClass\x0a\x09\x09^ StringStream",
  6952. referencedClasses: ["StringStream"],
  6953. //>>excludeEnd("ide");
  6954. pragmas: [],
  6955. messageSends: []
  6956. }, function ($methodClass){ return function (){
  6957. var self=this,$self=this;
  6958. return $globals.StringStream;
  6959. }; }),
  6960. $globals.String.a$cls);
  6961. $core.addMethod(
  6962. $core.method({
  6963. selector: "tab",
  6964. protocol: "accessing",
  6965. //>>excludeStart("ide", pragmas.excludeIdeData);
  6966. args: [],
  6967. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6968. referencedClasses: [],
  6969. //>>excludeEnd("ide");
  6970. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6971. messageSends: []
  6972. }, function ($methodClass){ return function (){
  6973. var self=this,$self=this;
  6974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6975. return $core.withContext(function($ctx1) {
  6976. //>>excludeEnd("ctx");
  6977. return "\t";
  6978. return self;
  6979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6980. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  6981. //>>excludeEnd("ctx");
  6982. }; }),
  6983. $globals.String.a$cls);
  6984. $core.addMethod(
  6985. $core.method({
  6986. selector: "value:",
  6987. protocol: "instance creation",
  6988. //>>excludeStart("ide", pragmas.excludeIdeData);
  6989. args: ["aUTFCharCode"],
  6990. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6991. referencedClasses: [],
  6992. //>>excludeEnd("ide");
  6993. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  6994. messageSends: []
  6995. }, function ($methodClass){ return function (aUTFCharCode){
  6996. var self=this,$self=this;
  6997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6998. return $core.withContext(function($ctx1) {
  6999. //>>excludeEnd("ctx");
  7000. return String.fromCharCode(aUTFCharCode);;
  7001. return self;
  7002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7003. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7004. //>>excludeEnd("ctx");
  7005. }; }),
  7006. $globals.String.a$cls);
  7007. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7008. //>>excludeStart("ide", pragmas.excludeIdeData);
  7009. $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`.";
  7010. //>>excludeEnd("ide");
  7011. $core.addMethod(
  7012. $core.method({
  7013. selector: "=",
  7014. protocol: "comparing",
  7015. //>>excludeStart("ide", pragmas.excludeIdeData);
  7016. args: ["aCollection"],
  7017. 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",
  7018. referencedClasses: [],
  7019. //>>excludeEnd("ide");
  7020. pragmas: [],
  7021. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7022. }, function ($methodClass){ return function (aCollection){
  7023. var self=this,$self=this;
  7024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7025. return $core.withContext(function($ctx1) {
  7026. //>>excludeEnd("ctx");
  7027. var $2,$1,$4,$3,$5;
  7028. var $early={};
  7029. try {
  7030. $2=$self._class();
  7031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7032. $ctx1.sendIdx["class"]=1;
  7033. //>>excludeEnd("ctx");
  7034. $1=$recv($2).__eq($recv(aCollection)._class());
  7035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7036. $ctx1.sendIdx["="]=1;
  7037. //>>excludeEnd("ctx");
  7038. if(!$core.assert($1)){
  7039. return false;
  7040. }
  7041. $4=$self._size();
  7042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7043. $ctx1.sendIdx["size"]=1;
  7044. //>>excludeEnd("ctx");
  7045. $3=$recv($4).__eq($recv(aCollection)._size());
  7046. if(!$core.assert($3)){
  7047. return false;
  7048. }
  7049. $self._do_((function(each){
  7050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7051. return $core.withContext(function($ctx2) {
  7052. //>>excludeEnd("ctx");
  7053. $5=$recv(aCollection)._includes_(each);
  7054. if(!$core.assert($5)){
  7055. throw $early=[false];
  7056. }
  7057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7059. //>>excludeEnd("ctx");
  7060. }));
  7061. return true;
  7062. }
  7063. catch(e) {if(e===$early)return e[0]; throw e}
  7064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7065. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7066. //>>excludeEnd("ctx");
  7067. }; }),
  7068. $globals.Set);
  7069. $core.addMethod(
  7070. $core.method({
  7071. selector: "add:",
  7072. protocol: "adding/removing",
  7073. //>>excludeStart("ide", pragmas.excludeIdeData);
  7074. args: ["anObject"],
  7075. 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 ]",
  7076. referencedClasses: [],
  7077. //>>excludeEnd("ide");
  7078. pragmas: [],
  7079. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7080. }, function ($methodClass){ return function (anObject){
  7081. var self=this,$self=this;
  7082. var bucket;
  7083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7084. return $core.withContext(function($ctx1) {
  7085. //>>excludeEnd("ctx");
  7086. var $1,$receiver;
  7087. bucket=$self._bucketsOfElement_(anObject);
  7088. $1=$recv(bucket)._second();
  7089. if(($receiver = $1) == null || $receiver.a$nil){
  7090. var object,slowBucket;
  7091. object=$recv(bucket)._first();
  7092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7093. $ctx1.sendIdx["first"]=1;
  7094. //>>excludeEnd("ctx");
  7095. slowBucket=$recv(bucket)._third();
  7096. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7098. return $core.withContext(function($ctx2) {
  7099. //>>excludeEnd("ctx");
  7100. $recv(slowBucket)._add_(object);
  7101. $self.size=$recv($self.size).__plus((1));
  7102. return $self.size;
  7103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7105. //>>excludeEnd("ctx");
  7106. }));
  7107. return object;
  7108. } else {
  7109. var primitiveBucket;
  7110. primitiveBucket=$receiver;
  7111. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7112. }
  7113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7114. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7115. //>>excludeEnd("ctx");
  7116. }; }),
  7117. $globals.Set);
  7118. $core.addMethod(
  7119. $core.method({
  7120. selector: "add:in:",
  7121. protocol: "private",
  7122. //>>excludeStart("ide", pragmas.excludeIdeData);
  7123. args: ["anObject", "anotherObject"],
  7124. 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'>",
  7125. referencedClasses: [],
  7126. //>>excludeEnd("ide");
  7127. 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"]]],
  7128. messageSends: []
  7129. }, function ($methodClass){ return function (anObject,anotherObject){
  7130. var self=this,$self=this;
  7131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7132. return $core.withContext(function($ctx1) {
  7133. //>>excludeEnd("ctx");
  7134. if (anObject in anotherObject.store) { return anObject; }
  7135. $self.size++;
  7136. anotherObject.store[anObject] = true;
  7137. return anObject;
  7138. ;
  7139. return self;
  7140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7141. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7142. //>>excludeEnd("ctx");
  7143. }; }),
  7144. $globals.Set);
  7145. $core.addMethod(
  7146. $core.method({
  7147. selector: "bucketsOfElement:",
  7148. protocol: "private",
  7149. //>>excludeStart("ide", pragmas.excludeIdeData);
  7150. args: ["anObject"],
  7151. 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'>",
  7152. referencedClasses: [],
  7153. //>>excludeEnd("ide");
  7154. 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"]]],
  7155. messageSends: []
  7156. }, function ($methodClass){ return function (anObject){
  7157. var self=this,$self=this;
  7158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7159. return $core.withContext(function($ctx1) {
  7160. //>>excludeEnd("ctx");
  7161. // include nil to well-known objects under "boolean" fastBucket
  7162. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7163. var prim = anObject.valueOf();
  7164. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7165. var bucket = null;
  7166. $self.slowBucketStores.some(function (store) {
  7167. return bucket = store._bucketOfElement_(anObject);
  7168. });
  7169. return [ anObject, null, bucket || $self.defaultBucket ];
  7170. }
  7171. return [ prim, $self.fastBuckets[typeof prim] ];
  7172. ;
  7173. return self;
  7174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7175. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7176. //>>excludeEnd("ctx");
  7177. }; }),
  7178. $globals.Set);
  7179. $core.addMethod(
  7180. $core.method({
  7181. selector: "classNameOf:",
  7182. protocol: "private",
  7183. //>>excludeStart("ide", pragmas.excludeIdeData);
  7184. args: ["anObject"],
  7185. 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'>",
  7186. referencedClasses: [],
  7187. //>>excludeEnd("ide");
  7188. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7189. messageSends: []
  7190. }, function ($methodClass){ return function (anObject){
  7191. var self=this,$self=this;
  7192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7193. return $core.withContext(function($ctx1) {
  7194. //>>excludeEnd("ctx");
  7195. return anObject.a$cls != null && anObject.a$cls.name;
  7196. return self;
  7197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7198. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7199. //>>excludeEnd("ctx");
  7200. }; }),
  7201. $globals.Set);
  7202. $core.addMethod(
  7203. $core.method({
  7204. selector: "collect:",
  7205. protocol: "enumerating",
  7206. //>>excludeStart("ide", pragmas.excludeIdeData);
  7207. args: ["aBlock"],
  7208. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7209. referencedClasses: [],
  7210. //>>excludeEnd("ide");
  7211. pragmas: [],
  7212. messageSends: ["new", "class", "do:", "add:", "value:"]
  7213. }, function ($methodClass){ return function (aBlock){
  7214. var self=this,$self=this;
  7215. var collection;
  7216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7217. return $core.withContext(function($ctx1) {
  7218. //>>excludeEnd("ctx");
  7219. collection=$recv($self._class())._new();
  7220. $self._do_((function(each){
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. return $core.withContext(function($ctx2) {
  7223. //>>excludeEnd("ctx");
  7224. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7227. //>>excludeEnd("ctx");
  7228. }));
  7229. return collection;
  7230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7231. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7232. //>>excludeEnd("ctx");
  7233. }; }),
  7234. $globals.Set);
  7235. $core.addMethod(
  7236. $core.method({
  7237. selector: "do:",
  7238. protocol: "enumerating",
  7239. //>>excludeStart("ide", pragmas.excludeIdeData);
  7240. args: ["aBlock"],
  7241. 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'>",
  7242. referencedClasses: [],
  7243. //>>excludeEnd("ide");
  7244. 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"]]],
  7245. messageSends: []
  7246. }, function ($methodClass){ return function (aBlock){
  7247. var self=this,$self=this;
  7248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7249. return $core.withContext(function($ctx1) {
  7250. //>>excludeEnd("ctx");
  7251. var el, keys, i;
  7252. el = $self.fastBuckets;
  7253. keys = Object.keys(el);
  7254. for (i = 0; i < keys.length; ++i) {
  7255. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7256. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7257. else { store._do_(aBlock); }
  7258. }
  7259. el = $self.slowBucketStores;
  7260. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7261. $self.defaultBucket._do_(aBlock);
  7262. ;
  7263. return self;
  7264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7265. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7266. //>>excludeEnd("ctx");
  7267. }; }),
  7268. $globals.Set);
  7269. $core.addMethod(
  7270. $core.method({
  7271. selector: "includes:",
  7272. protocol: "testing",
  7273. //>>excludeStart("ide", pragmas.excludeIdeData);
  7274. args: ["anObject"],
  7275. 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 ]",
  7276. referencedClasses: [],
  7277. //>>excludeEnd("ide");
  7278. pragmas: [],
  7279. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7280. }, function ($methodClass){ return function (anObject){
  7281. var self=this,$self=this;
  7282. var bucket;
  7283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7284. return $core.withContext(function($ctx1) {
  7285. //>>excludeEnd("ctx");
  7286. var $1,$2,$3,$receiver;
  7287. bucket=$self._bucketsOfElement_(anObject);
  7288. $1=$recv(bucket)._second();
  7289. if(($receiver = $1) == null || $receiver.a$nil){
  7290. $2=$recv(bucket)._third();
  7291. $3=$recv(bucket)._first();
  7292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7293. $ctx1.sendIdx["first"]=1;
  7294. //>>excludeEnd("ctx");
  7295. return $recv($2)._includes_($3);
  7296. } else {
  7297. var primitiveBucket;
  7298. primitiveBucket=$receiver;
  7299. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7300. }
  7301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7302. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7303. //>>excludeEnd("ctx");
  7304. }; }),
  7305. $globals.Set);
  7306. $core.addMethod(
  7307. $core.method({
  7308. selector: "includes:in:",
  7309. protocol: "private",
  7310. //>>excludeStart("ide", pragmas.excludeIdeData);
  7311. args: ["anObject", "anotherObject"],
  7312. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7313. referencedClasses: [],
  7314. //>>excludeEnd("ide");
  7315. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7316. messageSends: []
  7317. }, function ($methodClass){ return function (anObject,anotherObject){
  7318. var self=this,$self=this;
  7319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7320. return $core.withContext(function($ctx1) {
  7321. //>>excludeEnd("ctx");
  7322. return anObject in anotherObject.store;
  7323. return self;
  7324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7325. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7326. //>>excludeEnd("ctx");
  7327. }; }),
  7328. $globals.Set);
  7329. $core.addMethod(
  7330. $core.method({
  7331. selector: "initialize",
  7332. protocol: "initialization",
  7333. //>>excludeStart("ide", pragmas.excludeIdeData);
  7334. args: [],
  7335. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7336. referencedClasses: [],
  7337. //>>excludeEnd("ide");
  7338. pragmas: [],
  7339. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7340. }, function ($methodClass){ return function (){
  7341. var self=this,$self=this;
  7342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7343. return $core.withContext(function($ctx1) {
  7344. //>>excludeEnd("ctx");
  7345. (
  7346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7347. $ctx1.supercall = true,
  7348. //>>excludeEnd("ctx");
  7349. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  7350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7351. $ctx1.supercall = false;
  7352. //>>excludeEnd("ctx");;
  7353. $self.defaultBucket=[];
  7354. $self._initializeSlowBucketStores();
  7355. $self._removeAll();
  7356. return self;
  7357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7358. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7359. //>>excludeEnd("ctx");
  7360. }; }),
  7361. $globals.Set);
  7362. $core.addMethod(
  7363. $core.method({
  7364. selector: "initializeSlowBucketStores",
  7365. protocol: "initialization",
  7366. //>>excludeStart("ide", pragmas.excludeIdeData);
  7367. args: [],
  7368. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7369. referencedClasses: ["ArrayBucketStore"],
  7370. //>>excludeEnd("ide");
  7371. pragmas: [],
  7372. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7373. }, function ($methodClass){ return function (){
  7374. var self=this,$self=this;
  7375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7376. return $core.withContext(function($ctx1) {
  7377. //>>excludeEnd("ctx");
  7378. var $1;
  7379. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7381. return $core.withContext(function($ctx2) {
  7382. //>>excludeEnd("ctx");
  7383. return $self._classNameOf_(x);
  7384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7385. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7386. //>>excludeEnd("ctx");
  7387. }));
  7388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7389. $ctx1.sendIdx["hashBlock:"]=1;
  7390. //>>excludeEnd("ctx");
  7391. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7393. return $core.withContext(function($ctx2) {
  7394. //>>excludeEnd("ctx");
  7395. return $self._jsConstructorNameOf_(x);
  7396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7397. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7398. //>>excludeEnd("ctx");
  7399. }))];
  7400. return self;
  7401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7402. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7403. //>>excludeEnd("ctx");
  7404. }; }),
  7405. $globals.Set);
  7406. $core.addMethod(
  7407. $core.method({
  7408. selector: "jsConstructorNameOf:",
  7409. protocol: "private",
  7410. //>>excludeStart("ide", pragmas.excludeIdeData);
  7411. args: ["anObject"],
  7412. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7413. referencedClasses: [],
  7414. //>>excludeEnd("ide");
  7415. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7416. messageSends: []
  7417. }, function ($methodClass){ return function (anObject){
  7418. var self=this,$self=this;
  7419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7420. return $core.withContext(function($ctx1) {
  7421. //>>excludeEnd("ctx");
  7422. return anObject.constructor && anObject.constructor.name;
  7423. return self;
  7424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7425. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7426. //>>excludeEnd("ctx");
  7427. }; }),
  7428. $globals.Set);
  7429. $core.addMethod(
  7430. $core.method({
  7431. selector: "printOn:",
  7432. protocol: "printing",
  7433. //>>excludeStart("ide", pragmas.excludeIdeData);
  7434. args: ["aStream"],
  7435. 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: ')'",
  7436. referencedClasses: [],
  7437. //>>excludeEnd("ide");
  7438. pragmas: [],
  7439. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7440. }, function ($methodClass){ return function (aStream){
  7441. var self=this,$self=this;
  7442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7443. return $core.withContext(function($ctx1) {
  7444. //>>excludeEnd("ctx");
  7445. (
  7446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7447. $ctx1.supercall = true,
  7448. //>>excludeEnd("ctx");
  7449. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream));
  7450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7451. $ctx1.supercall = false;
  7452. //>>excludeEnd("ctx");;
  7453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7454. $ctx1.sendIdx["printOn:"]=1;
  7455. //>>excludeEnd("ctx");
  7456. $recv(aStream)._nextPutAll_(" (");
  7457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7458. $ctx1.sendIdx["nextPutAll:"]=1;
  7459. //>>excludeEnd("ctx");
  7460. $self._do_separatedBy_((function(each){
  7461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7462. return $core.withContext(function($ctx2) {
  7463. //>>excludeEnd("ctx");
  7464. return $recv(each)._printOn_(aStream);
  7465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7467. //>>excludeEnd("ctx");
  7468. }),(function(){
  7469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7470. return $core.withContext(function($ctx2) {
  7471. //>>excludeEnd("ctx");
  7472. return $recv(aStream)._nextPutAll_(" ");
  7473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7474. $ctx2.sendIdx["nextPutAll:"]=2;
  7475. //>>excludeEnd("ctx");
  7476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7477. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7478. //>>excludeEnd("ctx");
  7479. }));
  7480. $recv(aStream)._nextPutAll_(")");
  7481. return self;
  7482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7483. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7484. //>>excludeEnd("ctx");
  7485. }; }),
  7486. $globals.Set);
  7487. $core.addMethod(
  7488. $core.method({
  7489. selector: "remove:ifAbsent:",
  7490. protocol: "adding/removing",
  7491. //>>excludeStart("ide", pragmas.excludeIdeData);
  7492. args: ["anObject", "aBlock"],
  7493. 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 ]",
  7494. referencedClasses: [],
  7495. //>>excludeEnd("ide");
  7496. pragmas: [],
  7497. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7498. }, function ($methodClass){ return function (anObject,aBlock){
  7499. var self=this,$self=this;
  7500. var bucket;
  7501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7502. return $core.withContext(function($ctx1) {
  7503. //>>excludeEnd("ctx");
  7504. var $1,$receiver;
  7505. var $early={};
  7506. try {
  7507. bucket=$self._bucketsOfElement_(anObject);
  7508. $1=$recv(bucket)._second();
  7509. if(($receiver = $1) == null || $receiver.a$nil){
  7510. var obj;
  7511. obj=$recv(bucket)._first();
  7512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7513. $ctx1.sendIdx["first"]=1;
  7514. //>>excludeEnd("ctx");
  7515. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7517. return $core.withContext(function($ctx2) {
  7518. //>>excludeEnd("ctx");
  7519. throw $early=[$recv(aBlock)._value()];
  7520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7522. //>>excludeEnd("ctx");
  7523. }));
  7524. $self.size=$recv($self.size).__minus((1));
  7525. return obj;
  7526. } else {
  7527. var primitiveBucket;
  7528. primitiveBucket=$receiver;
  7529. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7530. }
  7531. }
  7532. catch(e) {if(e===$early)return e[0]; throw e}
  7533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7534. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7535. //>>excludeEnd("ctx");
  7536. }; }),
  7537. $globals.Set);
  7538. $core.addMethod(
  7539. $core.method({
  7540. selector: "remove:in:ifAbsent:",
  7541. protocol: "private",
  7542. //>>excludeStart("ide", pragmas.excludeIdeData);
  7543. args: ["anObject", "anotherObject", "aBlock"],
  7544. 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}'>",
  7545. referencedClasses: [],
  7546. //>>excludeEnd("ide");
  7547. 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}"]]],
  7548. messageSends: []
  7549. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7550. var self=this,$self=this;
  7551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7552. return $core.withContext(function($ctx1) {
  7553. //>>excludeEnd("ctx");
  7554. if (anObject in anotherObject.store) {
  7555. delete anotherObject.store[anObject];
  7556. $self.size--;
  7557. return anObject;
  7558. } else {
  7559. return aBlock._value();
  7560. };
  7561. return self;
  7562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7563. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7564. //>>excludeEnd("ctx");
  7565. }; }),
  7566. $globals.Set);
  7567. $core.addMethod(
  7568. $core.method({
  7569. selector: "removeAll",
  7570. protocol: "adding/removing",
  7571. //>>excludeStart("ide", pragmas.excludeIdeData);
  7572. args: [],
  7573. 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'>",
  7574. referencedClasses: [],
  7575. //>>excludeEnd("ide");
  7576. 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"]]],
  7577. messageSends: []
  7578. }, function ($methodClass){ return function (){
  7579. var self=this,$self=this;
  7580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7581. return $core.withContext(function($ctx1) {
  7582. //>>excludeEnd("ctx");
  7583. $self.fastBuckets = {
  7584. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7585. "number": { store: Object.create(null), fn: Number },
  7586. "string": { store: Object.create(null) }
  7587. };
  7588. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7589. $self.defaultBucket._removeAll();
  7590. $self.size = 0;
  7591. ;
  7592. return self;
  7593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7594. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7595. //>>excludeEnd("ctx");
  7596. }; }),
  7597. $globals.Set);
  7598. $core.addMethod(
  7599. $core.method({
  7600. selector: "select:",
  7601. protocol: "enumerating",
  7602. //>>excludeStart("ide", pragmas.excludeIdeData);
  7603. args: ["aBlock"],
  7604. 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",
  7605. referencedClasses: [],
  7606. //>>excludeEnd("ide");
  7607. pragmas: [],
  7608. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7609. }, function ($methodClass){ return function (aBlock){
  7610. var self=this,$self=this;
  7611. var collection;
  7612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7613. return $core.withContext(function($ctx1) {
  7614. //>>excludeEnd("ctx");
  7615. var $1;
  7616. collection=$recv($self._class())._new();
  7617. $self._do_((function(each){
  7618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7619. return $core.withContext(function($ctx2) {
  7620. //>>excludeEnd("ctx");
  7621. $1=$recv(aBlock)._value_(each);
  7622. if($core.assert($1)){
  7623. return $recv(collection)._add_(each);
  7624. }
  7625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7627. //>>excludeEnd("ctx");
  7628. }));
  7629. return collection;
  7630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7631. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7632. //>>excludeEnd("ctx");
  7633. }; }),
  7634. $globals.Set);
  7635. $core.addMethod(
  7636. $core.method({
  7637. selector: "select:thenCollect:",
  7638. protocol: "enumerating",
  7639. //>>excludeStart("ide", pragmas.excludeIdeData);
  7640. args: ["selectBlock", "collectBlock"],
  7641. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09\x09collection add: (collectBlock value: each) ] ].\x0a\x09^ collection",
  7642. referencedClasses: [],
  7643. //>>excludeEnd("ide");
  7644. pragmas: [],
  7645. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7646. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7647. var self=this,$self=this;
  7648. var collection;
  7649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7650. return $core.withContext(function($ctx1) {
  7651. //>>excludeEnd("ctx");
  7652. var $1;
  7653. collection=$recv($self._class())._new();
  7654. $self._do_((function(each){
  7655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7656. return $core.withContext(function($ctx2) {
  7657. //>>excludeEnd("ctx");
  7658. $1=$recv(selectBlock)._value_(each);
  7659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7660. $ctx2.sendIdx["value:"]=1;
  7661. //>>excludeEnd("ctx");
  7662. if($core.assert($1)){
  7663. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7664. }
  7665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7667. //>>excludeEnd("ctx");
  7668. }));
  7669. return collection;
  7670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7671. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7672. //>>excludeEnd("ctx");
  7673. }; }),
  7674. $globals.Set);
  7675. $core.addMethod(
  7676. $core.method({
  7677. selector: "size",
  7678. protocol: "accessing",
  7679. //>>excludeStart("ide", pragmas.excludeIdeData);
  7680. args: [],
  7681. source: "size\x0a\x09^ size",
  7682. referencedClasses: [],
  7683. //>>excludeEnd("ide");
  7684. pragmas: [],
  7685. messageSends: []
  7686. }, function ($methodClass){ return function (){
  7687. var self=this,$self=this;
  7688. return $self.size;
  7689. }; }),
  7690. $globals.Set);
  7691. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7692. //>>excludeStart("ide", pragmas.excludeIdeData);
  7693. $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.";
  7694. //>>excludeEnd("ide");
  7695. $core.addMethod(
  7696. $core.method({
  7697. selector: "<<",
  7698. protocol: "writing",
  7699. //>>excludeStart("ide", pragmas.excludeIdeData);
  7700. args: ["anObject"],
  7701. source: "<< anObject\x0a\x09self write: anObject",
  7702. referencedClasses: [],
  7703. //>>excludeEnd("ide");
  7704. pragmas: [],
  7705. messageSends: ["write:"]
  7706. }, function ($methodClass){ return function (anObject){
  7707. var self=this,$self=this;
  7708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7709. return $core.withContext(function($ctx1) {
  7710. //>>excludeEnd("ctx");
  7711. $self._write_(anObject);
  7712. return self;
  7713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7714. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7715. //>>excludeEnd("ctx");
  7716. }; }),
  7717. $globals.ProtoStream);
  7718. $core.addMethod(
  7719. $core.method({
  7720. selector: "atEnd",
  7721. protocol: "testing",
  7722. //>>excludeStart("ide", pragmas.excludeIdeData);
  7723. args: [],
  7724. source: "atEnd\x0a\x09self subclassResponsibility",
  7725. referencedClasses: [],
  7726. //>>excludeEnd("ide");
  7727. pragmas: [],
  7728. messageSends: ["subclassResponsibility"]
  7729. }, function ($methodClass){ return function (){
  7730. var self=this,$self=this;
  7731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7732. return $core.withContext(function($ctx1) {
  7733. //>>excludeEnd("ctx");
  7734. $self._subclassResponsibility();
  7735. return self;
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7738. //>>excludeEnd("ctx");
  7739. }; }),
  7740. $globals.ProtoStream);
  7741. $core.addMethod(
  7742. $core.method({
  7743. selector: "atStart",
  7744. protocol: "testing",
  7745. //>>excludeStart("ide", pragmas.excludeIdeData);
  7746. args: [],
  7747. source: "atStart\x0a\x09self subclassResponsibility",
  7748. referencedClasses: [],
  7749. //>>excludeEnd("ide");
  7750. pragmas: [],
  7751. messageSends: ["subclassResponsibility"]
  7752. }, function ($methodClass){ return function (){
  7753. var self=this,$self=this;
  7754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7755. return $core.withContext(function($ctx1) {
  7756. //>>excludeEnd("ctx");
  7757. $self._subclassResponsibility();
  7758. return self;
  7759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7760. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7761. //>>excludeEnd("ctx");
  7762. }; }),
  7763. $globals.ProtoStream);
  7764. $core.addMethod(
  7765. $core.method({
  7766. selector: "contents",
  7767. protocol: "accessing",
  7768. //>>excludeStart("ide", pragmas.excludeIdeData);
  7769. args: [],
  7770. source: "contents\x0a\x09self subclassResponsibility",
  7771. referencedClasses: [],
  7772. //>>excludeEnd("ide");
  7773. pragmas: [],
  7774. messageSends: ["subclassResponsibility"]
  7775. }, function ($methodClass){ return function (){
  7776. var self=this,$self=this;
  7777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7778. return $core.withContext(function($ctx1) {
  7779. //>>excludeEnd("ctx");
  7780. $self._subclassResponsibility();
  7781. return self;
  7782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7783. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7784. //>>excludeEnd("ctx");
  7785. }; }),
  7786. $globals.ProtoStream);
  7787. $core.addMethod(
  7788. $core.method({
  7789. selector: "do:",
  7790. protocol: "enumerating",
  7791. //>>excludeStart("ide", pragmas.excludeIdeData);
  7792. args: ["aBlock"],
  7793. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7794. referencedClasses: [],
  7795. //>>excludeEnd("ide");
  7796. pragmas: [],
  7797. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7798. }, function ($methodClass){ return function (aBlock){
  7799. var self=this,$self=this;
  7800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7801. return $core.withContext(function($ctx1) {
  7802. //>>excludeEnd("ctx");
  7803. $recv((function(){
  7804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7805. return $core.withContext(function($ctx2) {
  7806. //>>excludeEnd("ctx");
  7807. return $self._atEnd();
  7808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7810. //>>excludeEnd("ctx");
  7811. }))._whileFalse_((function(){
  7812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7813. return $core.withContext(function($ctx2) {
  7814. //>>excludeEnd("ctx");
  7815. return $recv(aBlock)._value_($self._next());
  7816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7818. //>>excludeEnd("ctx");
  7819. }));
  7820. return self;
  7821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7822. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7823. //>>excludeEnd("ctx");
  7824. }; }),
  7825. $globals.ProtoStream);
  7826. $core.addMethod(
  7827. $core.method({
  7828. selector: "isEmpty",
  7829. protocol: "testing",
  7830. //>>excludeStart("ide", pragmas.excludeIdeData);
  7831. args: [],
  7832. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7833. referencedClasses: [],
  7834. //>>excludeEnd("ide");
  7835. pragmas: [],
  7836. messageSends: ["and:", "atStart", "atEnd"]
  7837. }, function ($methodClass){ return function (){
  7838. var self=this,$self=this;
  7839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7840. return $core.withContext(function($ctx1) {
  7841. //>>excludeEnd("ctx");
  7842. return $recv($self._atStart())._and_((function(){
  7843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7844. return $core.withContext(function($ctx2) {
  7845. //>>excludeEnd("ctx");
  7846. return $self._atEnd();
  7847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7849. //>>excludeEnd("ctx");
  7850. }));
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7853. //>>excludeEnd("ctx");
  7854. }; }),
  7855. $globals.ProtoStream);
  7856. $core.addMethod(
  7857. $core.method({
  7858. selector: "next",
  7859. protocol: "reading",
  7860. //>>excludeStart("ide", pragmas.excludeIdeData);
  7861. args: [],
  7862. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7863. referencedClasses: [],
  7864. //>>excludeEnd("ide");
  7865. pragmas: [],
  7866. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7867. }, function ($methodClass){ return function (){
  7868. var self=this,$self=this;
  7869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7870. return $core.withContext(function($ctx1) {
  7871. //>>excludeEnd("ctx");
  7872. var $1;
  7873. $1=$self._atEnd();
  7874. if($core.assert($1)){
  7875. return nil;
  7876. } else {
  7877. return $self._subclassResponsibility();
  7878. }
  7879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7880. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7881. //>>excludeEnd("ctx");
  7882. }; }),
  7883. $globals.ProtoStream);
  7884. $core.addMethod(
  7885. $core.method({
  7886. selector: "nextPut:",
  7887. protocol: "writing",
  7888. //>>excludeStart("ide", pragmas.excludeIdeData);
  7889. args: ["anObject"],
  7890. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7891. referencedClasses: [],
  7892. //>>excludeEnd("ide");
  7893. pragmas: [],
  7894. messageSends: ["subclassResponsibility"]
  7895. }, function ($methodClass){ return function (anObject){
  7896. var self=this,$self=this;
  7897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7898. return $core.withContext(function($ctx1) {
  7899. //>>excludeEnd("ctx");
  7900. $self._subclassResponsibility();
  7901. return self;
  7902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7903. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7904. //>>excludeEnd("ctx");
  7905. }; }),
  7906. $globals.ProtoStream);
  7907. $core.addMethod(
  7908. $core.method({
  7909. selector: "nextPutAll:",
  7910. protocol: "writing",
  7911. //>>excludeStart("ide", pragmas.excludeIdeData);
  7912. args: ["aCollection"],
  7913. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7914. referencedClasses: [],
  7915. //>>excludeEnd("ide");
  7916. pragmas: [],
  7917. messageSends: ["do:", "nextPut:"]
  7918. }, function ($methodClass){ return function (aCollection){
  7919. var self=this,$self=this;
  7920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7921. return $core.withContext(function($ctx1) {
  7922. //>>excludeEnd("ctx");
  7923. $recv(aCollection)._do_((function(each){
  7924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7925. return $core.withContext(function($ctx2) {
  7926. //>>excludeEnd("ctx");
  7927. return $self._nextPut_(each);
  7928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7930. //>>excludeEnd("ctx");
  7931. }));
  7932. return self;
  7933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7934. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7935. //>>excludeEnd("ctx");
  7936. }; }),
  7937. $globals.ProtoStream);
  7938. $core.addMethod(
  7939. $core.method({
  7940. selector: "nextPutString:",
  7941. protocol: "writing",
  7942. //>>excludeStart("ide", pragmas.excludeIdeData);
  7943. args: ["aString"],
  7944. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7945. referencedClasses: [],
  7946. //>>excludeEnd("ide");
  7947. pragmas: [],
  7948. messageSends: ["nextPut:"]
  7949. }, function ($methodClass){ return function (aString){
  7950. var self=this,$self=this;
  7951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7952. return $core.withContext(function($ctx1) {
  7953. //>>excludeEnd("ctx");
  7954. $self._nextPut_(aString);
  7955. return self;
  7956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7957. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7958. //>>excludeEnd("ctx");
  7959. }; }),
  7960. $globals.ProtoStream);
  7961. $core.addMethod(
  7962. $core.method({
  7963. selector: "peek",
  7964. protocol: "reading",
  7965. //>>excludeStart("ide", pragmas.excludeIdeData);
  7966. args: [],
  7967. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7968. referencedClasses: [],
  7969. //>>excludeEnd("ide");
  7970. pragmas: [],
  7971. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7972. }, function ($methodClass){ return function (){
  7973. var self=this,$self=this;
  7974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7975. return $core.withContext(function($ctx1) {
  7976. //>>excludeEnd("ctx");
  7977. var $1;
  7978. $1=$self._atEnd();
  7979. if($core.assert($1)){
  7980. return nil;
  7981. } else {
  7982. return $self._subclassResponsibility();
  7983. }
  7984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7985. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  7986. //>>excludeEnd("ctx");
  7987. }; }),
  7988. $globals.ProtoStream);
  7989. $core.addMethod(
  7990. $core.method({
  7991. selector: "reset",
  7992. protocol: "actions",
  7993. //>>excludeStart("ide", pragmas.excludeIdeData);
  7994. args: [],
  7995. source: "reset\x0a\x09self subclassResponsibility",
  7996. referencedClasses: [],
  7997. //>>excludeEnd("ide");
  7998. pragmas: [],
  7999. messageSends: ["subclassResponsibility"]
  8000. }, function ($methodClass){ return function (){
  8001. var self=this,$self=this;
  8002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8003. return $core.withContext(function($ctx1) {
  8004. //>>excludeEnd("ctx");
  8005. $self._subclassResponsibility();
  8006. return self;
  8007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8008. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8009. //>>excludeEnd("ctx");
  8010. }; }),
  8011. $globals.ProtoStream);
  8012. $core.addMethod(
  8013. $core.method({
  8014. selector: "resetContents",
  8015. protocol: "actions",
  8016. //>>excludeStart("ide", pragmas.excludeIdeData);
  8017. args: [],
  8018. source: "resetContents\x0a\x09self subclassResponsibility",
  8019. referencedClasses: [],
  8020. //>>excludeEnd("ide");
  8021. pragmas: [],
  8022. messageSends: ["subclassResponsibility"]
  8023. }, function ($methodClass){ return function (){
  8024. var self=this,$self=this;
  8025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8026. return $core.withContext(function($ctx1) {
  8027. //>>excludeEnd("ctx");
  8028. $self._subclassResponsibility();
  8029. return self;
  8030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8031. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8032. //>>excludeEnd("ctx");
  8033. }; }),
  8034. $globals.ProtoStream);
  8035. $core.addMethod(
  8036. $core.method({
  8037. selector: "setToEnd",
  8038. protocol: "positioning",
  8039. //>>excludeStart("ide", pragmas.excludeIdeData);
  8040. args: [],
  8041. source: "setToEnd\x0a\x09self subclassResponsibility",
  8042. referencedClasses: [],
  8043. //>>excludeEnd("ide");
  8044. pragmas: [],
  8045. messageSends: ["subclassResponsibility"]
  8046. }, function ($methodClass){ return function (){
  8047. var self=this,$self=this;
  8048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8049. return $core.withContext(function($ctx1) {
  8050. //>>excludeEnd("ctx");
  8051. $self._subclassResponsibility();
  8052. return self;
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8055. //>>excludeEnd("ctx");
  8056. }; }),
  8057. $globals.ProtoStream);
  8058. $core.addMethod(
  8059. $core.method({
  8060. selector: "setToStart",
  8061. protocol: "positioning",
  8062. //>>excludeStart("ide", pragmas.excludeIdeData);
  8063. args: [],
  8064. source: "setToStart\x0a\x09self reset",
  8065. referencedClasses: [],
  8066. //>>excludeEnd("ide");
  8067. pragmas: [],
  8068. messageSends: ["reset"]
  8069. }, function ($methodClass){ return function (){
  8070. var self=this,$self=this;
  8071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8072. return $core.withContext(function($ctx1) {
  8073. //>>excludeEnd("ctx");
  8074. $self._reset();
  8075. return self;
  8076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8077. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8078. //>>excludeEnd("ctx");
  8079. }; }),
  8080. $globals.ProtoStream);
  8081. $core.addMethod(
  8082. $core.method({
  8083. selector: "write:",
  8084. protocol: "writing",
  8085. //>>excludeStart("ide", pragmas.excludeIdeData);
  8086. args: ["anObject"],
  8087. source: "write: anObject\x0a\x09anObject putOn: self",
  8088. referencedClasses: [],
  8089. //>>excludeEnd("ide");
  8090. pragmas: [],
  8091. messageSends: ["putOn:"]
  8092. }, function ($methodClass){ return function (anObject){
  8093. var self=this,$self=this;
  8094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8095. return $core.withContext(function($ctx1) {
  8096. //>>excludeEnd("ctx");
  8097. $recv(anObject)._putOn_(self);
  8098. return self;
  8099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8100. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8101. //>>excludeEnd("ctx");
  8102. }; }),
  8103. $globals.ProtoStream);
  8104. $core.addMethod(
  8105. $core.method({
  8106. selector: "on:",
  8107. protocol: "instance creation",
  8108. //>>excludeStart("ide", pragmas.excludeIdeData);
  8109. args: ["aCollection"],
  8110. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8111. referencedClasses: [],
  8112. //>>excludeEnd("ide");
  8113. pragmas: [],
  8114. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8115. }, function ($methodClass){ return function (aCollection){
  8116. var self=this,$self=this;
  8117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8118. return $core.withContext(function($ctx1) {
  8119. //>>excludeEnd("ctx");
  8120. var $1;
  8121. $1=$self._new();
  8122. $recv($1)._setCollection_(aCollection);
  8123. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8124. return $recv($1)._yourself();
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8127. //>>excludeEnd("ctx");
  8128. }; }),
  8129. $globals.ProtoStream.a$cls);
  8130. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8131. //>>excludeStart("ide", pragmas.excludeIdeData);
  8132. $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.";
  8133. //>>excludeEnd("ide");
  8134. $core.addMethod(
  8135. $core.method({
  8136. selector: "atEnd",
  8137. protocol: "testing",
  8138. //>>excludeStart("ide", pragmas.excludeIdeData);
  8139. args: [],
  8140. source: "atEnd\x0a\x09^ self position = self size",
  8141. referencedClasses: [],
  8142. //>>excludeEnd("ide");
  8143. pragmas: [],
  8144. messageSends: ["=", "position", "size"]
  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($self._size());
  8151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8152. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8153. //>>excludeEnd("ctx");
  8154. }; }),
  8155. $globals.Stream);
  8156. $core.addMethod(
  8157. $core.method({
  8158. selector: "atStart",
  8159. protocol: "testing",
  8160. //>>excludeStart("ide", pragmas.excludeIdeData);
  8161. args: [],
  8162. source: "atStart\x0a\x09^ self position = 0",
  8163. referencedClasses: [],
  8164. //>>excludeEnd("ide");
  8165. pragmas: [],
  8166. messageSends: ["=", "position"]
  8167. }, function ($methodClass){ return function (){
  8168. var self=this,$self=this;
  8169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8170. return $core.withContext(function($ctx1) {
  8171. //>>excludeEnd("ctx");
  8172. return $recv($self._position()).__eq((0));
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8175. //>>excludeEnd("ctx");
  8176. }; }),
  8177. $globals.Stream);
  8178. $core.addMethod(
  8179. $core.method({
  8180. selector: "close",
  8181. protocol: "actions",
  8182. //>>excludeStart("ide", pragmas.excludeIdeData);
  8183. args: [],
  8184. source: "close",
  8185. referencedClasses: [],
  8186. //>>excludeEnd("ide");
  8187. pragmas: [],
  8188. messageSends: []
  8189. }, function ($methodClass){ return function (){
  8190. var self=this,$self=this;
  8191. return self;
  8192. }; }),
  8193. $globals.Stream);
  8194. $core.addMethod(
  8195. $core.method({
  8196. selector: "collection",
  8197. protocol: "accessing",
  8198. //>>excludeStart("ide", pragmas.excludeIdeData);
  8199. args: [],
  8200. source: "collection\x0a\x09^ collection",
  8201. referencedClasses: [],
  8202. //>>excludeEnd("ide");
  8203. pragmas: [],
  8204. messageSends: []
  8205. }, function ($methodClass){ return function (){
  8206. var self=this,$self=this;
  8207. return $self.collection;
  8208. }; }),
  8209. $globals.Stream);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "contents",
  8213. protocol: "accessing",
  8214. //>>excludeStart("ide", pragmas.excludeIdeData);
  8215. args: [],
  8216. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8217. referencedClasses: [],
  8218. //>>excludeEnd("ide");
  8219. pragmas: [],
  8220. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8221. }, function ($methodClass){ return function (){
  8222. var self=this,$self=this;
  8223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8224. return $core.withContext(function($ctx1) {
  8225. //>>excludeEnd("ctx");
  8226. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8228. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8229. //>>excludeEnd("ctx");
  8230. }; }),
  8231. $globals.Stream);
  8232. $core.addMethod(
  8233. $core.method({
  8234. selector: "flush",
  8235. protocol: "actions",
  8236. //>>excludeStart("ide", pragmas.excludeIdeData);
  8237. args: [],
  8238. source: "flush",
  8239. referencedClasses: [],
  8240. //>>excludeEnd("ide");
  8241. pragmas: [],
  8242. messageSends: []
  8243. }, function ($methodClass){ return function (){
  8244. var self=this,$self=this;
  8245. return self;
  8246. }; }),
  8247. $globals.Stream);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "isEmpty",
  8251. protocol: "testing",
  8252. //>>excludeStart("ide", pragmas.excludeIdeData);
  8253. args: [],
  8254. source: "isEmpty\x0a\x09^ self size = 0",
  8255. referencedClasses: [],
  8256. //>>excludeEnd("ide");
  8257. pragmas: [],
  8258. messageSends: ["=", "size"]
  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. return $recv($self._size()).__eq((0));
  8265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8266. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8267. //>>excludeEnd("ctx");
  8268. }; }),
  8269. $globals.Stream);
  8270. $core.addMethod(
  8271. $core.method({
  8272. selector: "next",
  8273. protocol: "reading",
  8274. //>>excludeStart("ide", pragmas.excludeIdeData);
  8275. args: [],
  8276. 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 ]",
  8277. referencedClasses: [],
  8278. //>>excludeEnd("ide");
  8279. pragmas: [],
  8280. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8281. }, function ($methodClass){ return function (){
  8282. var self=this,$self=this;
  8283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8284. return $core.withContext(function($ctx1) {
  8285. //>>excludeEnd("ctx");
  8286. var $1,$3,$2;
  8287. $1=$self._atEnd();
  8288. if($core.assert($1)){
  8289. return nil;
  8290. } else {
  8291. $3=$self._position();
  8292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8293. $ctx1.sendIdx["position"]=1;
  8294. //>>excludeEnd("ctx");
  8295. $2=$recv($3).__plus((1));
  8296. $self._position_($2);
  8297. return $recv($self.collection)._at_($self._position());
  8298. }
  8299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8300. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8301. //>>excludeEnd("ctx");
  8302. }; }),
  8303. $globals.Stream);
  8304. $core.addMethod(
  8305. $core.method({
  8306. selector: "next:",
  8307. protocol: "reading",
  8308. //>>excludeStart("ide", pragmas.excludeIdeData);
  8309. args: ["anInteger"],
  8310. 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",
  8311. referencedClasses: [],
  8312. //>>excludeEnd("ide");
  8313. pragmas: [],
  8314. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8315. }, function ($methodClass){ return function (anInteger){
  8316. var self=this,$self=this;
  8317. var tempCollection;
  8318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8319. return $core.withContext(function($ctx1) {
  8320. //>>excludeEnd("ctx");
  8321. var $1;
  8322. tempCollection=$recv($recv($self._collection())._class())._new();
  8323. $recv(anInteger)._timesRepeat_((function(){
  8324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8325. return $core.withContext(function($ctx2) {
  8326. //>>excludeEnd("ctx");
  8327. $1=$self._atEnd();
  8328. if(!$core.assert($1)){
  8329. return $recv(tempCollection)._add_($self._next());
  8330. }
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8333. //>>excludeEnd("ctx");
  8334. }));
  8335. return tempCollection;
  8336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8337. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8338. //>>excludeEnd("ctx");
  8339. }; }),
  8340. $globals.Stream);
  8341. $core.addMethod(
  8342. $core.method({
  8343. selector: "nextPut:",
  8344. protocol: "writing",
  8345. //>>excludeStart("ide", pragmas.excludeIdeData);
  8346. args: ["anObject"],
  8347. 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)",
  8348. referencedClasses: [],
  8349. //>>excludeEnd("ide");
  8350. pragmas: [],
  8351. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8352. }, function ($methodClass){ return function (anObject){
  8353. var self=this,$self=this;
  8354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8355. return $core.withContext(function($ctx1) {
  8356. //>>excludeEnd("ctx");
  8357. var $2,$1,$3,$4;
  8358. $2=$self._position();
  8359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8360. $ctx1.sendIdx["position"]=1;
  8361. //>>excludeEnd("ctx");
  8362. $1=$recv($2).__plus((1));
  8363. $self._position_($1);
  8364. $3=$self._collection();
  8365. $4=$self._position();
  8366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8367. $ctx1.sendIdx["position"]=2;
  8368. //>>excludeEnd("ctx");
  8369. $recv($3)._at_put_($4,anObject);
  8370. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8371. return self;
  8372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8373. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8374. //>>excludeEnd("ctx");
  8375. }; }),
  8376. $globals.Stream);
  8377. $core.addMethod(
  8378. $core.method({
  8379. selector: "peek",
  8380. protocol: "reading",
  8381. //>>excludeStart("ide", pragmas.excludeIdeData);
  8382. args: [],
  8383. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8384. referencedClasses: [],
  8385. //>>excludeEnd("ide");
  8386. pragmas: [],
  8387. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8388. }, function ($methodClass){ return function (){
  8389. var self=this,$self=this;
  8390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8391. return $core.withContext(function($ctx1) {
  8392. //>>excludeEnd("ctx");
  8393. var $1;
  8394. $1=$self._atEnd();
  8395. if(!$core.assert($1)){
  8396. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8397. }
  8398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8399. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8400. //>>excludeEnd("ctx");
  8401. }; }),
  8402. $globals.Stream);
  8403. $core.addMethod(
  8404. $core.method({
  8405. selector: "position",
  8406. protocol: "accessing",
  8407. //>>excludeStart("ide", pragmas.excludeIdeData);
  8408. args: [],
  8409. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8410. referencedClasses: [],
  8411. //>>excludeEnd("ide");
  8412. pragmas: [],
  8413. messageSends: ["ifNil:"]
  8414. }, function ($methodClass){ return function (){
  8415. var self=this,$self=this;
  8416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8417. return $core.withContext(function($ctx1) {
  8418. //>>excludeEnd("ctx");
  8419. var $1,$receiver;
  8420. $1=$self.position;
  8421. if(($receiver = $1) == null || $receiver.a$nil){
  8422. $self.position=(0);
  8423. return $self.position;
  8424. } else {
  8425. return $1;
  8426. }
  8427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8428. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8429. //>>excludeEnd("ctx");
  8430. }; }),
  8431. $globals.Stream);
  8432. $core.addMethod(
  8433. $core.method({
  8434. selector: "position:",
  8435. protocol: "accessing",
  8436. //>>excludeStart("ide", pragmas.excludeIdeData);
  8437. args: ["anInteger"],
  8438. source: "position: anInteger\x0a\x09position := anInteger",
  8439. referencedClasses: [],
  8440. //>>excludeEnd("ide");
  8441. pragmas: [],
  8442. messageSends: []
  8443. }, function ($methodClass){ return function (anInteger){
  8444. var self=this,$self=this;
  8445. $self.position=anInteger;
  8446. return self;
  8447. }; }),
  8448. $globals.Stream);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "reset",
  8452. protocol: "actions",
  8453. //>>excludeStart("ide", pragmas.excludeIdeData);
  8454. args: [],
  8455. source: "reset\x0a\x09self position: 0",
  8456. referencedClasses: [],
  8457. //>>excludeEnd("ide");
  8458. pragmas: [],
  8459. messageSends: ["position:"]
  8460. }, function ($methodClass){ return function (){
  8461. var self=this,$self=this;
  8462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8463. return $core.withContext(function($ctx1) {
  8464. //>>excludeEnd("ctx");
  8465. $self._position_((0));
  8466. return self;
  8467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8468. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8469. //>>excludeEnd("ctx");
  8470. }; }),
  8471. $globals.Stream);
  8472. $core.addMethod(
  8473. $core.method({
  8474. selector: "resetContents",
  8475. protocol: "actions",
  8476. //>>excludeStart("ide", pragmas.excludeIdeData);
  8477. args: [],
  8478. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8479. referencedClasses: [],
  8480. //>>excludeEnd("ide");
  8481. pragmas: [],
  8482. messageSends: ["reset", "setStreamSize:"]
  8483. }, function ($methodClass){ return function (){
  8484. var self=this,$self=this;
  8485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8486. return $core.withContext(function($ctx1) {
  8487. //>>excludeEnd("ctx");
  8488. $self._reset();
  8489. $self._setStreamSize_((0));
  8490. return self;
  8491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8492. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8493. //>>excludeEnd("ctx");
  8494. }; }),
  8495. $globals.Stream);
  8496. $core.addMethod(
  8497. $core.method({
  8498. selector: "setCollection:",
  8499. protocol: "accessing",
  8500. //>>excludeStart("ide", pragmas.excludeIdeData);
  8501. args: ["aCollection"],
  8502. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8503. referencedClasses: [],
  8504. //>>excludeEnd("ide");
  8505. pragmas: [],
  8506. messageSends: []
  8507. }, function ($methodClass){ return function (aCollection){
  8508. var self=this,$self=this;
  8509. $self.collection=aCollection;
  8510. return self;
  8511. }; }),
  8512. $globals.Stream);
  8513. $core.addMethod(
  8514. $core.method({
  8515. selector: "setStreamSize:",
  8516. protocol: "accessing",
  8517. //>>excludeStart("ide", pragmas.excludeIdeData);
  8518. args: ["anInteger"],
  8519. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8520. referencedClasses: [],
  8521. //>>excludeEnd("ide");
  8522. pragmas: [],
  8523. messageSends: []
  8524. }, function ($methodClass){ return function (anInteger){
  8525. var self=this,$self=this;
  8526. $self.streamSize=anInteger;
  8527. return self;
  8528. }; }),
  8529. $globals.Stream);
  8530. $core.addMethod(
  8531. $core.method({
  8532. selector: "setToEnd",
  8533. protocol: "positioning",
  8534. //>>excludeStart("ide", pragmas.excludeIdeData);
  8535. args: [],
  8536. source: "setToEnd\x0a\x09self position: self size",
  8537. referencedClasses: [],
  8538. //>>excludeEnd("ide");
  8539. pragmas: [],
  8540. messageSends: ["position:", "size"]
  8541. }, function ($methodClass){ return function (){
  8542. var self=this,$self=this;
  8543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8544. return $core.withContext(function($ctx1) {
  8545. //>>excludeEnd("ctx");
  8546. $self._position_($self._size());
  8547. return self;
  8548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8549. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8550. //>>excludeEnd("ctx");
  8551. }; }),
  8552. $globals.Stream);
  8553. $core.addMethod(
  8554. $core.method({
  8555. selector: "size",
  8556. protocol: "accessing",
  8557. //>>excludeStart("ide", pragmas.excludeIdeData);
  8558. args: [],
  8559. source: "size\x0a\x09^ self streamSize",
  8560. referencedClasses: [],
  8561. //>>excludeEnd("ide");
  8562. pragmas: [],
  8563. messageSends: ["streamSize"]
  8564. }, function ($methodClass){ return function (){
  8565. var self=this,$self=this;
  8566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8567. return $core.withContext(function($ctx1) {
  8568. //>>excludeEnd("ctx");
  8569. return $self._streamSize();
  8570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8571. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8572. //>>excludeEnd("ctx");
  8573. }; }),
  8574. $globals.Stream);
  8575. $core.addMethod(
  8576. $core.method({
  8577. selector: "skip:",
  8578. protocol: "positioning",
  8579. //>>excludeStart("ide", pragmas.excludeIdeData);
  8580. args: ["anInteger"],
  8581. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8582. referencedClasses: [],
  8583. //>>excludeEnd("ide");
  8584. pragmas: [],
  8585. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8586. }, function ($methodClass){ return function (anInteger){
  8587. var self=this,$self=this;
  8588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8589. return $core.withContext(function($ctx1) {
  8590. //>>excludeEnd("ctx");
  8591. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8592. return self;
  8593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8594. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8595. //>>excludeEnd("ctx");
  8596. }; }),
  8597. $globals.Stream);
  8598. $core.addMethod(
  8599. $core.method({
  8600. selector: "streamSize",
  8601. protocol: "accessing",
  8602. //>>excludeStart("ide", pragmas.excludeIdeData);
  8603. args: [],
  8604. source: "streamSize\x0a\x09^ streamSize",
  8605. referencedClasses: [],
  8606. //>>excludeEnd("ide");
  8607. pragmas: [],
  8608. messageSends: []
  8609. }, function ($methodClass){ return function (){
  8610. var self=this,$self=this;
  8611. return $self.streamSize;
  8612. }; }),
  8613. $globals.Stream);
  8614. $core.addMethod(
  8615. $core.method({
  8616. selector: "on:",
  8617. protocol: "instance creation",
  8618. //>>excludeStart("ide", pragmas.excludeIdeData);
  8619. args: ["aCollection"],
  8620. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8621. referencedClasses: [],
  8622. //>>excludeEnd("ide");
  8623. pragmas: [],
  8624. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8625. }, function ($methodClass){ return function (aCollection){
  8626. var self=this,$self=this;
  8627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8628. return $core.withContext(function($ctx1) {
  8629. //>>excludeEnd("ctx");
  8630. var $1;
  8631. $1=$self._new();
  8632. $recv($1)._setCollection_(aCollection);
  8633. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8634. return $recv($1)._yourself();
  8635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8636. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8637. //>>excludeEnd("ctx");
  8638. }; }),
  8639. $globals.Stream.a$cls);
  8640. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8641. //>>excludeStart("ide", pragmas.excludeIdeData);
  8642. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8643. //>>excludeEnd("ide");
  8644. $core.addMethod(
  8645. $core.method({
  8646. selector: "cr",
  8647. protocol: "writing",
  8648. //>>excludeStart("ide", pragmas.excludeIdeData);
  8649. args: [],
  8650. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8651. referencedClasses: ["String"],
  8652. //>>excludeEnd("ide");
  8653. pragmas: [],
  8654. messageSends: ["nextPutAll:", "cr"]
  8655. }, function ($methodClass){ return function (){
  8656. var self=this,$self=this;
  8657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8658. return $core.withContext(function($ctx1) {
  8659. //>>excludeEnd("ctx");
  8660. return $self._nextPutAll_($recv($globals.String)._cr());
  8661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8662. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8663. //>>excludeEnd("ctx");
  8664. }; }),
  8665. $globals.StringStream);
  8666. $core.addMethod(
  8667. $core.method({
  8668. selector: "crlf",
  8669. protocol: "writing",
  8670. //>>excludeStart("ide", pragmas.excludeIdeData);
  8671. args: [],
  8672. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8673. referencedClasses: ["String"],
  8674. //>>excludeEnd("ide");
  8675. pragmas: [],
  8676. messageSends: ["nextPutAll:", "crlf"]
  8677. }, function ($methodClass){ return function (){
  8678. var self=this,$self=this;
  8679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8680. return $core.withContext(function($ctx1) {
  8681. //>>excludeEnd("ctx");
  8682. return $self._nextPutAll_($recv($globals.String)._crlf());
  8683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8684. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8685. //>>excludeEnd("ctx");
  8686. }; }),
  8687. $globals.StringStream);
  8688. $core.addMethod(
  8689. $core.method({
  8690. selector: "lf",
  8691. protocol: "writing",
  8692. //>>excludeStart("ide", pragmas.excludeIdeData);
  8693. args: [],
  8694. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8695. referencedClasses: ["String"],
  8696. //>>excludeEnd("ide");
  8697. pragmas: [],
  8698. messageSends: ["nextPutAll:", "lf"]
  8699. }, function ($methodClass){ return function (){
  8700. var self=this,$self=this;
  8701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8702. return $core.withContext(function($ctx1) {
  8703. //>>excludeEnd("ctx");
  8704. return $self._nextPutAll_($recv($globals.String)._lf());
  8705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8706. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8707. //>>excludeEnd("ctx");
  8708. }; }),
  8709. $globals.StringStream);
  8710. $core.addMethod(
  8711. $core.method({
  8712. selector: "next:",
  8713. protocol: "reading",
  8714. //>>excludeStart("ide", pragmas.excludeIdeData);
  8715. args: ["anInteger"],
  8716. 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",
  8717. referencedClasses: [],
  8718. //>>excludeEnd("ide");
  8719. pragmas: [],
  8720. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8721. }, function ($methodClass){ return function (anInteger){
  8722. var self=this,$self=this;
  8723. var tempCollection;
  8724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8725. return $core.withContext(function($ctx1) {
  8726. //>>excludeEnd("ctx");
  8727. var $1;
  8728. tempCollection=$recv($recv($self._collection())._class())._new();
  8729. $recv(anInteger)._timesRepeat_((function(){
  8730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8731. return $core.withContext(function($ctx2) {
  8732. //>>excludeEnd("ctx");
  8733. $1=$self._atEnd();
  8734. if(!$core.assert($1)){
  8735. tempCollection=$recv(tempCollection).__comma($self._next());
  8736. return tempCollection;
  8737. }
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8740. //>>excludeEnd("ctx");
  8741. }));
  8742. return tempCollection;
  8743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8744. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8745. //>>excludeEnd("ctx");
  8746. }; }),
  8747. $globals.StringStream);
  8748. $core.addMethod(
  8749. $core.method({
  8750. selector: "nextPut:",
  8751. protocol: "writing",
  8752. //>>excludeStart("ide", pragmas.excludeIdeData);
  8753. args: ["aString"],
  8754. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8755. referencedClasses: [],
  8756. //>>excludeEnd("ide");
  8757. pragmas: [],
  8758. messageSends: ["nextPutAll:"]
  8759. }, function ($methodClass){ return function (aString){
  8760. var self=this,$self=this;
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. return $core.withContext(function($ctx1) {
  8763. //>>excludeEnd("ctx");
  8764. $self._nextPutAll_(aString);
  8765. return self;
  8766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8767. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8768. //>>excludeEnd("ctx");
  8769. }; }),
  8770. $globals.StringStream);
  8771. $core.addMethod(
  8772. $core.method({
  8773. selector: "nextPutAll:",
  8774. protocol: "writing",
  8775. //>>excludeStart("ide", pragmas.excludeIdeData);
  8776. args: ["aString"],
  8777. 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)",
  8778. referencedClasses: [],
  8779. //>>excludeEnd("ide");
  8780. pragmas: [],
  8781. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8782. }, function ($methodClass){ return function (aString){
  8783. var self=this,$self=this;
  8784. var pre,post;
  8785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8786. return $core.withContext(function($ctx1) {
  8787. //>>excludeEnd("ctx");
  8788. var $2,$4,$3,$1,$6,$5,$7,$8,$9,$12,$11,$13,$10,$14,$15,$17,$16;
  8789. $2=$self._position();
  8790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8791. $ctx1.sendIdx["position"]=1;
  8792. //>>excludeEnd("ctx");
  8793. $4=$self._collection();
  8794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8795. $ctx1.sendIdx["collection"]=1;
  8796. //>>excludeEnd("ctx");
  8797. $3=$recv($4)._size();
  8798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8799. $ctx1.sendIdx["size"]=1;
  8800. //>>excludeEnd("ctx");
  8801. $1=$recv($2).__eq($3);
  8802. if($core.assert($1)){
  8803. $6=$self._collection();
  8804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8805. $ctx1.sendIdx["collection"]=2;
  8806. //>>excludeEnd("ctx");
  8807. $5=$recv($6).__comma(aString);
  8808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8809. $ctx1.sendIdx[","]=1;
  8810. //>>excludeEnd("ctx");
  8811. $self._setCollection_($5);
  8812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8813. $ctx1.sendIdx["setCollection:"]=1;
  8814. //>>excludeEnd("ctx");
  8815. } else {
  8816. $7=$self._collection();
  8817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8818. $ctx1.sendIdx["collection"]=3;
  8819. //>>excludeEnd("ctx");
  8820. $8=$self._position();
  8821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8822. $ctx1.sendIdx["position"]=2;
  8823. //>>excludeEnd("ctx");
  8824. pre=$recv($7)._copyFrom_to_((1),$8);
  8825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8826. $ctx1.sendIdx["copyFrom:to:"]=1;
  8827. //>>excludeEnd("ctx");
  8828. $9=$self._collection();
  8829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8830. $ctx1.sendIdx["collection"]=4;
  8831. //>>excludeEnd("ctx");
  8832. $12=$self._position();
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. $ctx1.sendIdx["position"]=3;
  8835. //>>excludeEnd("ctx");
  8836. $11=$recv($12).__plus((1));
  8837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8838. $ctx1.sendIdx["+"]=2;
  8839. //>>excludeEnd("ctx");
  8840. $13=$recv(aString)._size();
  8841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8842. $ctx1.sendIdx["size"]=2;
  8843. //>>excludeEnd("ctx");
  8844. $10=$recv($11).__plus($13);
  8845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8846. $ctx1.sendIdx["+"]=1;
  8847. //>>excludeEnd("ctx");
  8848. $14=$recv($self._collection())._size();
  8849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8850. $ctx1.sendIdx["size"]=3;
  8851. //>>excludeEnd("ctx");
  8852. post=$recv($9)._copyFrom_to_($10,$14);
  8853. $15=$recv($recv(pre).__comma(aString)).__comma(post);
  8854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8855. $ctx1.sendIdx[","]=2;
  8856. //>>excludeEnd("ctx");
  8857. $self._setCollection_($15);
  8858. }
  8859. $17=$self._position();
  8860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8861. $ctx1.sendIdx["position"]=4;
  8862. //>>excludeEnd("ctx");
  8863. $16=$recv($17).__plus($recv(aString)._size());
  8864. $self._position_($16);
  8865. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8866. return self;
  8867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8868. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8869. //>>excludeEnd("ctx");
  8870. }; }),
  8871. $globals.StringStream);
  8872. $core.addMethod(
  8873. $core.method({
  8874. selector: "nextPutString:",
  8875. protocol: "writing",
  8876. //>>excludeStart("ide", pragmas.excludeIdeData);
  8877. args: ["aString"],
  8878. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8879. referencedClasses: [],
  8880. //>>excludeEnd("ide");
  8881. pragmas: [],
  8882. messageSends: ["nextPutAll:"]
  8883. }, function ($methodClass){ return function (aString){
  8884. var self=this,$self=this;
  8885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8886. return $core.withContext(function($ctx1) {
  8887. //>>excludeEnd("ctx");
  8888. $self._nextPutAll_(aString);
  8889. return self;
  8890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8891. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8892. //>>excludeEnd("ctx");
  8893. }; }),
  8894. $globals.StringStream);
  8895. $core.addMethod(
  8896. $core.method({
  8897. selector: "print:",
  8898. protocol: "writing",
  8899. //>>excludeStart("ide", pragmas.excludeIdeData);
  8900. args: ["anObject"],
  8901. source: "print: anObject\x0a\x09anObject printOn: self",
  8902. referencedClasses: [],
  8903. //>>excludeEnd("ide");
  8904. pragmas: [],
  8905. messageSends: ["printOn:"]
  8906. }, function ($methodClass){ return function (anObject){
  8907. var self=this,$self=this;
  8908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8909. return $core.withContext(function($ctx1) {
  8910. //>>excludeEnd("ctx");
  8911. $recv(anObject)._printOn_(self);
  8912. return self;
  8913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8914. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8915. //>>excludeEnd("ctx");
  8916. }; }),
  8917. $globals.StringStream);
  8918. $core.addMethod(
  8919. $core.method({
  8920. selector: "printSymbol:",
  8921. protocol: "writing",
  8922. //>>excludeStart("ide", pragmas.excludeIdeData);
  8923. args: ["anObject"],
  8924. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8925. referencedClasses: [],
  8926. //>>excludeEnd("ide");
  8927. pragmas: [],
  8928. messageSends: ["asSymbolPrintOn:"]
  8929. }, function ($methodClass){ return function (anObject){
  8930. var self=this,$self=this;
  8931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8932. return $core.withContext(function($ctx1) {
  8933. //>>excludeEnd("ctx");
  8934. $recv(anObject)._asSymbolPrintOn_(self);
  8935. return self;
  8936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8937. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8938. //>>excludeEnd("ctx");
  8939. }; }),
  8940. $globals.StringStream);
  8941. $core.addMethod(
  8942. $core.method({
  8943. selector: "space",
  8944. protocol: "writing",
  8945. //>>excludeStart("ide", pragmas.excludeIdeData);
  8946. args: [],
  8947. source: "space\x0a\x09self nextPut: ' '",
  8948. referencedClasses: [],
  8949. //>>excludeEnd("ide");
  8950. pragmas: [],
  8951. messageSends: ["nextPut:"]
  8952. }, function ($methodClass){ return function (){
  8953. var self=this,$self=this;
  8954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8955. return $core.withContext(function($ctx1) {
  8956. //>>excludeEnd("ctx");
  8957. $self._nextPut_(" ");
  8958. return self;
  8959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8960. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8961. //>>excludeEnd("ctx");
  8962. }; }),
  8963. $globals.StringStream);
  8964. $core.addMethod(
  8965. $core.method({
  8966. selector: "tab",
  8967. protocol: "writing",
  8968. //>>excludeStart("ide", pragmas.excludeIdeData);
  8969. args: [],
  8970. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8971. referencedClasses: ["String"],
  8972. //>>excludeEnd("ide");
  8973. pragmas: [],
  8974. messageSends: ["nextPutAll:", "tab"]
  8975. }, function ($methodClass){ return function (){
  8976. var self=this,$self=this;
  8977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8978. return $core.withContext(function($ctx1) {
  8979. //>>excludeEnd("ctx");
  8980. return $self._nextPutAll_($recv($globals.String)._tab());
  8981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8982. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  8983. //>>excludeEnd("ctx");
  8984. }; }),
  8985. $globals.StringStream);
  8986. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8987. //>>excludeStart("ide", pragmas.excludeIdeData);
  8988. $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.";
  8989. //>>excludeEnd("ide");
  8990. $core.addMethod(
  8991. $core.method({
  8992. selector: "initialize",
  8993. protocol: "initialization",
  8994. //>>excludeStart("ide", pragmas.excludeIdeData);
  8995. args: [],
  8996. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8997. referencedClasses: ["OrderedCollection"],
  8998. //>>excludeEnd("ide");
  8999. pragmas: [],
  9000. messageSends: ["initialize", "new"]
  9001. }, function ($methodClass){ return function (){
  9002. var self=this,$self=this;
  9003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9004. return $core.withContext(function($ctx1) {
  9005. //>>excludeEnd("ctx");
  9006. (
  9007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9008. $ctx1.supercall = true,
  9009. //>>excludeEnd("ctx");
  9010. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  9011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9012. $ctx1.supercall = false;
  9013. //>>excludeEnd("ctx");;
  9014. $self.read=$recv($globals.OrderedCollection)._new();
  9015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9016. $ctx1.sendIdx["new"]=1;
  9017. //>>excludeEnd("ctx");
  9018. $self.write=$recv($globals.OrderedCollection)._new();
  9019. $self.readIndex=(1);
  9020. return self;
  9021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9022. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9023. //>>excludeEnd("ctx");
  9024. }; }),
  9025. $globals.Queue);
  9026. $core.addMethod(
  9027. $core.method({
  9028. selector: "next",
  9029. protocol: "accessing",
  9030. //>>excludeStart("ide", pragmas.excludeIdeData);
  9031. args: [],
  9032. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9033. referencedClasses: [],
  9034. //>>excludeEnd("ide");
  9035. pragmas: [],
  9036. messageSends: ["nextIfAbsent:", "error:"]
  9037. }, function ($methodClass){ return function (){
  9038. var self=this,$self=this;
  9039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9040. return $core.withContext(function($ctx1) {
  9041. //>>excludeEnd("ctx");
  9042. return $self._nextIfAbsent_((function(){
  9043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9044. return $core.withContext(function($ctx2) {
  9045. //>>excludeEnd("ctx");
  9046. return $self._error_("Cannot read from empty Queue.");
  9047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9048. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9049. //>>excludeEnd("ctx");
  9050. }));
  9051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9052. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9053. //>>excludeEnd("ctx");
  9054. }; }),
  9055. $globals.Queue);
  9056. $core.addMethod(
  9057. $core.method({
  9058. selector: "nextIfAbsent:",
  9059. protocol: "accessing",
  9060. //>>excludeStart("ide", pragmas.excludeIdeData);
  9061. args: ["aBlock"],
  9062. 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",
  9063. referencedClasses: ["OrderedCollection"],
  9064. //>>excludeEnd("ide");
  9065. pragmas: [],
  9066. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9067. }, function ($methodClass){ return function (aBlock){
  9068. var self=this,$self=this;
  9069. var result;
  9070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9071. return $core.withContext(function($ctx1) {
  9072. //>>excludeEnd("ctx");
  9073. var $1;
  9074. var $early={};
  9075. try {
  9076. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9078. return $core.withContext(function($ctx2) {
  9079. //>>excludeEnd("ctx");
  9080. $recv($self.write)._ifEmpty_((function(){
  9081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9082. return $core.withContext(function($ctx3) {
  9083. //>>excludeEnd("ctx");
  9084. $1=$recv($self.readIndex).__gt((1));
  9085. if($core.assert($1)){
  9086. $self.read=[];
  9087. $self.readIndex=(1);
  9088. $self.readIndex;
  9089. }
  9090. throw $early=[$recv(aBlock)._value()];
  9091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9092. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9093. //>>excludeEnd("ctx");
  9094. }));
  9095. $self.read=$self.write;
  9096. $self.readIndex=(1);
  9097. $self.write=$recv($globals.OrderedCollection)._new();
  9098. return $recv($self.read)._first();
  9099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9101. //>>excludeEnd("ctx");
  9102. }));
  9103. $recv($self.read)._at_put_($self.readIndex,nil);
  9104. $self.readIndex=$recv($self.readIndex).__plus((1));
  9105. return result;
  9106. }
  9107. catch(e) {if(e===$early)return e[0]; throw e}
  9108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9109. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9110. //>>excludeEnd("ctx");
  9111. }; }),
  9112. $globals.Queue);
  9113. $core.addMethod(
  9114. $core.method({
  9115. selector: "nextPut:",
  9116. protocol: "accessing",
  9117. //>>excludeStart("ide", pragmas.excludeIdeData);
  9118. args: ["anObject"],
  9119. source: "nextPut: anObject\x0a\x09write add: anObject",
  9120. referencedClasses: [],
  9121. //>>excludeEnd("ide");
  9122. pragmas: [],
  9123. messageSends: ["add:"]
  9124. }, function ($methodClass){ return function (anObject){
  9125. var self=this,$self=this;
  9126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9127. return $core.withContext(function($ctx1) {
  9128. //>>excludeEnd("ctx");
  9129. $recv($self.write)._add_(anObject);
  9130. return self;
  9131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9132. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9133. //>>excludeEnd("ctx");
  9134. }; }),
  9135. $globals.Queue);
  9136. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9137. //>>excludeStart("ide", pragmas.excludeIdeData);
  9138. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9139. //>>excludeEnd("ide");
  9140. $core.addMethod(
  9141. $core.method({
  9142. selector: "compile:",
  9143. protocol: "evaluating",
  9144. //>>excludeStart("ide", pragmas.excludeIdeData);
  9145. args: ["aString"],
  9146. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9147. referencedClasses: [],
  9148. //>>excludeEnd("ide");
  9149. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9150. messageSends: []
  9151. }, function ($methodClass){ return function (aString){
  9152. var self=this,$self=this;
  9153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9154. return $core.withContext(function($ctx1) {
  9155. //>>excludeEnd("ctx");
  9156. return self.compile(aString);
  9157. return self;
  9158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9159. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9160. //>>excludeEnd("ctx");
  9161. }; }),
  9162. $globals.RegularExpression);
  9163. $core.addMethod(
  9164. $core.method({
  9165. selector: "exec:",
  9166. protocol: "evaluating",
  9167. //>>excludeStart("ide", pragmas.excludeIdeData);
  9168. args: ["aString"],
  9169. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9170. referencedClasses: [],
  9171. //>>excludeEnd("ide");
  9172. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9173. messageSends: []
  9174. }, function ($methodClass){ return function (aString){
  9175. var self=this,$self=this;
  9176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9177. return $core.withContext(function($ctx1) {
  9178. //>>excludeEnd("ctx");
  9179. return self.exec(aString) || nil;
  9180. return self;
  9181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9182. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9183. //>>excludeEnd("ctx");
  9184. }; }),
  9185. $globals.RegularExpression);
  9186. $core.addMethod(
  9187. $core.method({
  9188. selector: "test:",
  9189. protocol: "evaluating",
  9190. //>>excludeStart("ide", pragmas.excludeIdeData);
  9191. args: ["aString"],
  9192. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9193. referencedClasses: [],
  9194. //>>excludeEnd("ide");
  9195. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9196. messageSends: []
  9197. }, function ($methodClass){ return function (aString){
  9198. var self=this,$self=this;
  9199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9200. return $core.withContext(function($ctx1) {
  9201. //>>excludeEnd("ctx");
  9202. return self.test(aString);
  9203. return self;
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9206. //>>excludeEnd("ctx");
  9207. }; }),
  9208. $globals.RegularExpression);
  9209. $core.addMethod(
  9210. $core.method({
  9211. selector: "fromString:",
  9212. protocol: "instance creation",
  9213. //>>excludeStart("ide", pragmas.excludeIdeData);
  9214. args: ["aString"],
  9215. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9216. referencedClasses: [],
  9217. //>>excludeEnd("ide");
  9218. pragmas: [],
  9219. messageSends: ["fromString:flag:"]
  9220. }, function ($methodClass){ return function (aString){
  9221. var self=this,$self=this;
  9222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9223. return $core.withContext(function($ctx1) {
  9224. //>>excludeEnd("ctx");
  9225. return $self._fromString_flag_(aString,"");
  9226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9227. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9228. //>>excludeEnd("ctx");
  9229. }; }),
  9230. $globals.RegularExpression.a$cls);
  9231. $core.addMethod(
  9232. $core.method({
  9233. selector: "fromString:flag:",
  9234. protocol: "instance creation",
  9235. //>>excludeStart("ide", pragmas.excludeIdeData);
  9236. args: ["aString", "anotherString"],
  9237. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9238. referencedClasses: [],
  9239. //>>excludeEnd("ide");
  9240. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9241. messageSends: []
  9242. }, function ($methodClass){ return function (aString,anotherString){
  9243. var self=this,$self=this;
  9244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9245. return $core.withContext(function($ctx1) {
  9246. //>>excludeEnd("ctx");
  9247. return new RegExp(aString, anotherString);
  9248. return self;
  9249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9250. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9251. //>>excludeEnd("ctx");
  9252. }; }),
  9253. $globals.RegularExpression.a$cls);
  9254. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9255. $core.addMethod(
  9256. $core.method({
  9257. selector: "at:",
  9258. protocol: "accessing",
  9259. //>>excludeStart("ide", pragmas.excludeIdeData);
  9260. args: ["anIndex"],
  9261. 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 ]",
  9262. referencedClasses: [],
  9263. //>>excludeEnd("ide");
  9264. pragmas: [],
  9265. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9266. }, function ($methodClass){ return function (anIndex){
  9267. var self=this,$self=this;
  9268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9269. return $core.withContext(function($ctx1) {
  9270. //>>excludeEnd("ctx");
  9271. return $self._at_ifAbsent_(anIndex,(function(){
  9272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9273. return $core.withContext(function($ctx2) {
  9274. //>>excludeEnd("ctx");
  9275. return $self._errorNotFound();
  9276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9278. //>>excludeEnd("ctx");
  9279. }));
  9280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9281. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9282. //>>excludeEnd("ctx");
  9283. }; }),
  9284. $globals.TKeyValueCollection);
  9285. $core.addMethod(
  9286. $core.method({
  9287. selector: "at:ifAbsent:",
  9288. protocol: "accessing",
  9289. //>>excludeStart("ide", pragmas.excludeIdeData);
  9290. args: ["anIndex", "aBlock"],
  9291. 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",
  9292. referencedClasses: [],
  9293. //>>excludeEnd("ide");
  9294. pragmas: [],
  9295. messageSends: ["subclassResponsibility"]
  9296. }, function ($methodClass){ return function (anIndex,aBlock){
  9297. var self=this,$self=this;
  9298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9299. return $core.withContext(function($ctx1) {
  9300. //>>excludeEnd("ctx");
  9301. $self._subclassResponsibility();
  9302. return self;
  9303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9304. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9305. //>>excludeEnd("ctx");
  9306. }; }),
  9307. $globals.TKeyValueCollection);
  9308. $core.addMethod(
  9309. $core.method({
  9310. selector: "at:ifAbsentPut:",
  9311. protocol: "accessing",
  9312. //>>excludeStart("ide", pragmas.excludeIdeData);
  9313. args: ["aKey", "aBlock"],
  9314. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9315. referencedClasses: [],
  9316. //>>excludeEnd("ide");
  9317. pragmas: [],
  9318. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9319. }, function ($methodClass){ return function (aKey,aBlock){
  9320. var self=this,$self=this;
  9321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9322. return $core.withContext(function($ctx1) {
  9323. //>>excludeEnd("ctx");
  9324. return $self._at_ifAbsent_(aKey,(function(){
  9325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9326. return $core.withContext(function($ctx2) {
  9327. //>>excludeEnd("ctx");
  9328. return $self._at_put_(aKey,$recv(aBlock)._value());
  9329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9330. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9331. //>>excludeEnd("ctx");
  9332. }));
  9333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9334. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9335. //>>excludeEnd("ctx");
  9336. }; }),
  9337. $globals.TKeyValueCollection);
  9338. $core.addMethod(
  9339. $core.method({
  9340. selector: "at:ifPresent:",
  9341. protocol: "accessing",
  9342. //>>excludeStart("ide", pragmas.excludeIdeData);
  9343. args: ["anIndex", "aBlock"],
  9344. 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 ]",
  9345. referencedClasses: [],
  9346. //>>excludeEnd("ide");
  9347. pragmas: [],
  9348. messageSends: ["at:ifPresent:ifAbsent:"]
  9349. }, function ($methodClass){ return function (anIndex,aBlock){
  9350. var self=this,$self=this;
  9351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9352. return $core.withContext(function($ctx1) {
  9353. //>>excludeEnd("ctx");
  9354. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9355. return nil;
  9356. }));
  9357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9358. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9359. //>>excludeEnd("ctx");
  9360. }; }),
  9361. $globals.TKeyValueCollection);
  9362. $core.addMethod(
  9363. $core.method({
  9364. selector: "at:ifPresent:ifAbsent:",
  9365. protocol: "accessing",
  9366. //>>excludeStart("ide", pragmas.excludeIdeData);
  9367. args: ["anIndex", "aBlock", "anotherBlock"],
  9368. 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",
  9369. referencedClasses: [],
  9370. //>>excludeEnd("ide");
  9371. pragmas: [],
  9372. messageSends: ["subclassResponsibility"]
  9373. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9374. var self=this,$self=this;
  9375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9376. return $core.withContext(function($ctx1) {
  9377. //>>excludeEnd("ctx");
  9378. $self._subclassResponsibility();
  9379. return self;
  9380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9381. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9382. //>>excludeEnd("ctx");
  9383. }; }),
  9384. $globals.TKeyValueCollection);
  9385. $core.addMethod(
  9386. $core.method({
  9387. selector: "at:put:",
  9388. protocol: "accessing",
  9389. //>>excludeStart("ide", pragmas.excludeIdeData);
  9390. args: ["anIndex", "anObject"],
  9391. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9392. referencedClasses: [],
  9393. //>>excludeEnd("ide");
  9394. pragmas: [],
  9395. messageSends: ["subclassResponsibility"]
  9396. }, function ($methodClass){ return function (anIndex,anObject){
  9397. var self=this,$self=this;
  9398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9399. return $core.withContext(function($ctx1) {
  9400. //>>excludeEnd("ctx");
  9401. $self._subclassResponsibility();
  9402. return self;
  9403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9404. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9405. //>>excludeEnd("ctx");
  9406. }; }),
  9407. $globals.TKeyValueCollection);
  9408. $core.addMethod(
  9409. $core.method({
  9410. selector: "indexOf:",
  9411. protocol: "accessing",
  9412. //>>excludeStart("ide", pragmas.excludeIdeData);
  9413. args: ["anObject"],
  9414. 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 ]",
  9415. referencedClasses: [],
  9416. //>>excludeEnd("ide");
  9417. pragmas: [],
  9418. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9419. }, function ($methodClass){ return function (anObject){
  9420. var self=this,$self=this;
  9421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9422. return $core.withContext(function($ctx1) {
  9423. //>>excludeEnd("ctx");
  9424. return $self._indexOf_ifAbsent_(anObject,(function(){
  9425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9426. return $core.withContext(function($ctx2) {
  9427. //>>excludeEnd("ctx");
  9428. return $self._errorNotFound();
  9429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9430. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9431. //>>excludeEnd("ctx");
  9432. }));
  9433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9434. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9435. //>>excludeEnd("ctx");
  9436. }; }),
  9437. $globals.TKeyValueCollection);
  9438. $core.addMethod(
  9439. $core.method({
  9440. selector: "indexOf:ifAbsent:",
  9441. protocol: "accessing",
  9442. //>>excludeStart("ide", pragmas.excludeIdeData);
  9443. args: ["anObject", "aBlock"],
  9444. 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",
  9445. referencedClasses: [],
  9446. //>>excludeEnd("ide");
  9447. pragmas: [],
  9448. messageSends: ["subclassResponsibility"]
  9449. }, function ($methodClass){ return function (anObject,aBlock){
  9450. var self=this,$self=this;
  9451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9452. return $core.withContext(function($ctx1) {
  9453. //>>excludeEnd("ctx");
  9454. $self._subclassResponsibility();
  9455. return self;
  9456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9457. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9458. //>>excludeEnd("ctx");
  9459. }; }),
  9460. $globals.TKeyValueCollection);
  9461. $core.addMethod(
  9462. $core.method({
  9463. selector: "with:do:",
  9464. protocol: "enumerating",
  9465. //>>excludeStart("ide", pragmas.excludeIdeData);
  9466. args: ["anotherCollection", "aBlock"],
  9467. 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) ]",
  9468. referencedClasses: [],
  9469. //>>excludeEnd("ide");
  9470. pragmas: [],
  9471. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9472. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9473. var self=this,$self=this;
  9474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9475. return $core.withContext(function($ctx1) {
  9476. //>>excludeEnd("ctx");
  9477. $self._withIndexDo_((function(each,index){
  9478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9479. return $core.withContext(function($ctx2) {
  9480. //>>excludeEnd("ctx");
  9481. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9483. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9484. //>>excludeEnd("ctx");
  9485. }));
  9486. return self;
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9489. //>>excludeEnd("ctx");
  9490. }; }),
  9491. $globals.TKeyValueCollection);
  9492. $core.addMethod(
  9493. $core.method({
  9494. selector: "withIndexDo:",
  9495. protocol: "enumerating",
  9496. //>>excludeStart("ide", pragmas.excludeIdeData);
  9497. args: ["aBlock"],
  9498. 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",
  9499. referencedClasses: [],
  9500. //>>excludeEnd("ide");
  9501. pragmas: [],
  9502. messageSends: ["subclassResponsibility"]
  9503. }, function ($methodClass){ return function (aBlock){
  9504. var self=this,$self=this;
  9505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9506. return $core.withContext(function($ctx1) {
  9507. //>>excludeEnd("ctx");
  9508. $self._subclassResponsibility();
  9509. return self;
  9510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9511. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9512. //>>excludeEnd("ctx");
  9513. }; }),
  9514. $globals.TKeyValueCollection);
  9515. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9516. $core.addMethod(
  9517. $core.method({
  9518. selector: "at:ifAbsent:",
  9519. protocol: "accessing",
  9520. //>>excludeStart("ide", pragmas.excludeIdeData);
  9521. args: ["anIndex", "aBlock"],
  9522. 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'>",
  9523. referencedClasses: [],
  9524. //>>excludeEnd("ide");
  9525. 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"]]],
  9526. messageSends: []
  9527. }, function ($methodClass){ return function (anIndex,aBlock){
  9528. var self=this,$self=this;
  9529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9530. return $core.withContext(function($ctx1) {
  9531. //>>excludeEnd("ctx");
  9532. return anIndex >= 1 && anIndex <= self.length
  9533. ? self[anIndex - 1]
  9534. : aBlock._value()
  9535. ;
  9536. return self;
  9537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9538. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9539. //>>excludeEnd("ctx");
  9540. }; }),
  9541. $globals.TNativeZeroBasedCollection);
  9542. $core.addMethod(
  9543. $core.method({
  9544. selector: "at:ifPresent:ifAbsent:",
  9545. protocol: "accessing",
  9546. //>>excludeStart("ide", pragmas.excludeIdeData);
  9547. args: ["anIndex", "aBlock", "anotherBlock"],
  9548. 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'>",
  9549. referencedClasses: [],
  9550. //>>excludeEnd("ide");
  9551. 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"]]],
  9552. messageSends: []
  9553. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9554. var self=this,$self=this;
  9555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9556. return $core.withContext(function($ctx1) {
  9557. //>>excludeEnd("ctx");
  9558. return anIndex >= 1 && anIndex <= self.length
  9559. ? aBlock._value_(self[anIndex - 1])
  9560. : anotherBlock._value()
  9561. ;
  9562. return self;
  9563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9564. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9565. //>>excludeEnd("ctx");
  9566. }; }),
  9567. $globals.TNativeZeroBasedCollection);
  9568. $core.addMethod(
  9569. $core.method({
  9570. selector: "detect:ifNone:",
  9571. protocol: "enumerating",
  9572. //>>excludeStart("ide", pragmas.excludeIdeData);
  9573. args: ["aBlock", "anotherBlock"],
  9574. 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'>",
  9575. referencedClasses: [],
  9576. //>>excludeEnd("ide");
  9577. 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"]]],
  9578. messageSends: []
  9579. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9580. var self=this,$self=this;
  9581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9582. return $core.withContext(function($ctx1) {
  9583. //>>excludeEnd("ctx");
  9584. for(var i = 0; i < self.length; i++)
  9585. if(aBlock._value_(self[i]))
  9586. return self[i];
  9587. return anotherBlock._value();
  9588. ;
  9589. return self;
  9590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9591. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9592. //>>excludeEnd("ctx");
  9593. }; }),
  9594. $globals.TNativeZeroBasedCollection);
  9595. $core.addMethod(
  9596. $core.method({
  9597. selector: "do:",
  9598. protocol: "enumerating",
  9599. //>>excludeStart("ide", pragmas.excludeIdeData);
  9600. args: ["aBlock"],
  9601. 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'>",
  9602. referencedClasses: [],
  9603. //>>excludeEnd("ide");
  9604. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9605. messageSends: []
  9606. }, function ($methodClass){ return function (aBlock){
  9607. var self=this,$self=this;
  9608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9609. return $core.withContext(function($ctx1) {
  9610. //>>excludeEnd("ctx");
  9611. for(var i=0; i < self.length; i++) {
  9612. aBlock._value_(self[i]);
  9613. }
  9614. ;
  9615. return self;
  9616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9617. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9618. //>>excludeEnd("ctx");
  9619. }; }),
  9620. $globals.TNativeZeroBasedCollection);
  9621. $core.addMethod(
  9622. $core.method({
  9623. selector: "indexOf:ifAbsent:",
  9624. protocol: "accessing",
  9625. //>>excludeStart("ide", pragmas.excludeIdeData);
  9626. args: ["anObject", "aBlock"],
  9627. 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'>",
  9628. referencedClasses: [],
  9629. //>>excludeEnd("ide");
  9630. 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"]]],
  9631. messageSends: []
  9632. }, function ($methodClass){ return function (anObject,aBlock){
  9633. var self=this,$self=this;
  9634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9635. return $core.withContext(function($ctx1) {
  9636. //>>excludeEnd("ctx");
  9637. for(var i=0; i < self.length; i++) {
  9638. if($recv(self[i]).__eq(anObject)) {return i+1}
  9639. };
  9640. return aBlock._value();
  9641. ;
  9642. return self;
  9643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9644. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9645. //>>excludeEnd("ctx");
  9646. }; }),
  9647. $globals.TNativeZeroBasedCollection);
  9648. $core.addMethod(
  9649. $core.method({
  9650. selector: "indexOf:startingAt:ifAbsent:",
  9651. protocol: "accessing",
  9652. //>>excludeStart("ide", pragmas.excludeIdeData);
  9653. args: ["anObject", "start", "aBlock"],
  9654. 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'>",
  9655. referencedClasses: [],
  9656. //>>excludeEnd("ide");
  9657. 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"]]],
  9658. messageSends: []
  9659. }, function ($methodClass){ return function (anObject,start,aBlock){
  9660. var self=this,$self=this;
  9661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9662. return $core.withContext(function($ctx1) {
  9663. //>>excludeEnd("ctx");
  9664. for(var i=start - 1; i < self.length; i++){
  9665. if($recv(self[i]).__eq(anObject)) {return i+1}
  9666. }
  9667. return aBlock._value();
  9668. ;
  9669. return self;
  9670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9671. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9672. //>>excludeEnd("ctx");
  9673. }; }),
  9674. $globals.TNativeZeroBasedCollection);
  9675. $core.addMethod(
  9676. $core.method({
  9677. selector: "single",
  9678. protocol: "accessing",
  9679. //>>excludeStart("ide", pragmas.excludeIdeData);
  9680. args: [],
  9681. 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'>",
  9682. referencedClasses: [],
  9683. //>>excludeEnd("ide");
  9684. 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];"]]],
  9685. messageSends: []
  9686. }, function ($methodClass){ return function (){
  9687. var self=this,$self=this;
  9688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9689. return $core.withContext(function($ctx1) {
  9690. //>>excludeEnd("ctx");
  9691. if (self.length == 0) throw new Error("Collection is empty");
  9692. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9693. return self[0];;
  9694. return self;
  9695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9696. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9697. //>>excludeEnd("ctx");
  9698. }; }),
  9699. $globals.TNativeZeroBasedCollection);
  9700. $core.addMethod(
  9701. $core.method({
  9702. selector: "size",
  9703. protocol: "accessing",
  9704. //>>excludeStart("ide", pragmas.excludeIdeData);
  9705. args: [],
  9706. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9707. referencedClasses: [],
  9708. //>>excludeEnd("ide");
  9709. pragmas: [["inlineJS:", ["return self.length"]]],
  9710. messageSends: []
  9711. }, function ($methodClass){ return function (){
  9712. var self=this,$self=this;
  9713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9714. return $core.withContext(function($ctx1) {
  9715. //>>excludeEnd("ctx");
  9716. return self.length;
  9717. return self;
  9718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9719. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9720. //>>excludeEnd("ctx");
  9721. }; }),
  9722. $globals.TNativeZeroBasedCollection);
  9723. $core.addMethod(
  9724. $core.method({
  9725. selector: "with:do:",
  9726. protocol: "enumerating",
  9727. //>>excludeStart("ide", pragmas.excludeIdeData);
  9728. args: ["anotherCollection", "aBlock"],
  9729. 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'>",
  9730. referencedClasses: [],
  9731. //>>excludeEnd("ide");
  9732. 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"]]],
  9733. messageSends: []
  9734. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9735. var self=this,$self=this;
  9736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9737. return $core.withContext(function($ctx1) {
  9738. //>>excludeEnd("ctx");
  9739. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9740. for(var i=0; i<self.length; i++) {
  9741. aBlock._value_value_(self[i], anotherCollection[i]);
  9742. }
  9743. ;
  9744. return self;
  9745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9746. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9747. //>>excludeEnd("ctx");
  9748. }; }),
  9749. $globals.TNativeZeroBasedCollection);
  9750. $core.addMethod(
  9751. $core.method({
  9752. selector: "withIndexDo:",
  9753. protocol: "enumerating",
  9754. //>>excludeStart("ide", pragmas.excludeIdeData);
  9755. args: ["aBlock"],
  9756. 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'>",
  9757. referencedClasses: [],
  9758. //>>excludeEnd("ide");
  9759. 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"]]],
  9760. messageSends: []
  9761. }, function ($methodClass){ return function (aBlock){
  9762. var self=this,$self=this;
  9763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9764. return $core.withContext(function($ctx1) {
  9765. //>>excludeEnd("ctx");
  9766. for(var i=0; i < self.length; i++) {
  9767. aBlock._value_value_(self[i], i+1);
  9768. }
  9769. ;
  9770. return self;
  9771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9772. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9773. //>>excludeEnd("ctx");
  9774. }; }),
  9775. $globals.TNativeZeroBasedCollection);
  9776. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9777. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9778. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9779. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9780. });