Kernel-Collections.js 328 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  3. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. $core.addPackage("Kernel-Collections");
  5. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  6. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  8. //>>excludeStart("ide", pragmas.excludeIdeData);
  9. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  10. //>>excludeEnd("ide");
  11. $core.addMethod(
  12. $core.method({
  13. selector: "=",
  14. protocol: "comparing",
  15. fn: function (anAssociation){
  16. var self=this,$self=this;
  17. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  18. return $core.withContext(function($ctx1) {
  19. //>>excludeEnd("ctx");
  20. var $3,$2,$5,$4,$6,$1;
  21. $3=$self._class();
  22. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  23. $ctx1.sendIdx["class"]=1;
  24. //>>excludeEnd("ctx");
  25. $2=$recv($3).__eq($recv(anAssociation)._class());
  26. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  27. $ctx1.sendIdx["="]=1;
  28. //>>excludeEnd("ctx");
  29. $1=$recv($2)._and_((function(){
  30. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  31. return $core.withContext(function($ctx2) {
  32. //>>excludeEnd("ctx");
  33. $5=$self._key();
  34. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  35. $ctx2.sendIdx["key"]=1;
  36. //>>excludeEnd("ctx");
  37. $4=$recv($5).__eq($recv(anAssociation)._key());
  38. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  39. $ctx2.sendIdx["="]=2;
  40. //>>excludeEnd("ctx");
  41. return $recv($4)._and_((function(){
  42. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  43. return $core.withContext(function($ctx3) {
  44. //>>excludeEnd("ctx");
  45. $6=$self._value();
  46. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  47. $ctx3.sendIdx["value"]=1;
  48. //>>excludeEnd("ctx");
  49. return $recv($6).__eq($recv(anAssociation)._value());
  50. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  51. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  52. //>>excludeEnd("ctx");
  53. }));
  54. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  55. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56. //>>excludeEnd("ctx");
  57. }));
  58. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  59. $ctx1.sendIdx["and:"]=1;
  60. //>>excludeEnd("ctx");
  61. return $1;
  62. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  63. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  64. //>>excludeEnd("ctx");
  65. },
  66. //>>excludeStart("ide", pragmas.excludeIdeData);
  67. args: ["anAssociation"],
  68. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  69. referencedClasses: [],
  70. //>>excludeEnd("ide");
  71. messageSends: ["and:", "=", "class", "key", "value"]
  72. }),
  73. $globals.Association);
  74. $core.addMethod(
  75. $core.method({
  76. selector: "key",
  77. protocol: "accessing",
  78. fn: function (){
  79. var self=this,$self=this;
  80. return $self["@key"];
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: [],
  84. source: "key\x0a\x09^ key",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. messageSends: []
  88. }),
  89. $globals.Association);
  90. $core.addMethod(
  91. $core.method({
  92. selector: "key:",
  93. protocol: "accessing",
  94. fn: function (aKey){
  95. var self=this,$self=this;
  96. $self["@key"]=aKey;
  97. return self;
  98. },
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: ["aKey"],
  101. source: "key: aKey\x0a\x09key := aKey",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. messageSends: []
  105. }),
  106. $globals.Association);
  107. $core.addMethod(
  108. $core.method({
  109. selector: "printOn:",
  110. protocol: "printing",
  111. fn: function (aStream){
  112. var self=this,$self=this;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. return $core.withContext(function($ctx1) {
  115. //>>excludeEnd("ctx");
  116. $recv($self._key())._printOn_(aStream);
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. $ctx1.sendIdx["printOn:"]=1;
  119. //>>excludeEnd("ctx");
  120. $recv(aStream)._nextPutAll_(" -> ");
  121. $recv($self._value())._printOn_(aStream);
  122. return self;
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  125. //>>excludeEnd("ctx");
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: ["aStream"],
  129. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  133. }),
  134. $globals.Association);
  135. $core.addMethod(
  136. $core.method({
  137. selector: "value",
  138. protocol: "accessing",
  139. fn: function (){
  140. var self=this,$self=this;
  141. return $self["@value"];
  142. },
  143. //>>excludeStart("ide", pragmas.excludeIdeData);
  144. args: [],
  145. source: "value\x0a\x09^ value",
  146. referencedClasses: [],
  147. //>>excludeEnd("ide");
  148. messageSends: []
  149. }),
  150. $globals.Association);
  151. $core.addMethod(
  152. $core.method({
  153. selector: "value:",
  154. protocol: "accessing",
  155. fn: function (aValue){
  156. var self=this,$self=this;
  157. $self["@value"]=aValue;
  158. return self;
  159. },
  160. //>>excludeStart("ide", pragmas.excludeIdeData);
  161. args: ["aValue"],
  162. source: "value: aValue\x0a\x09value := aValue",
  163. referencedClasses: [],
  164. //>>excludeEnd("ide");
  165. messageSends: []
  166. }),
  167. $globals.Association);
  168. $core.addMethod(
  169. $core.method({
  170. selector: "key:value:",
  171. protocol: "instance creation",
  172. fn: function (aKey,aValue){
  173. var self=this,$self=this;
  174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  175. return $core.withContext(function($ctx1) {
  176. //>>excludeEnd("ctx");
  177. var $1;
  178. $1=$self._new();
  179. $recv($1)._key_(aKey);
  180. $recv($1)._value_(aValue);
  181. return $recv($1)._yourself();
  182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  183. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  184. //>>excludeEnd("ctx");
  185. },
  186. //>>excludeStart("ide", pragmas.excludeIdeData);
  187. args: ["aKey", "aValue"],
  188. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  189. referencedClasses: [],
  190. //>>excludeEnd("ide");
  191. messageSends: ["key:", "new", "value:", "yourself"]
  192. }),
  193. $globals.Association.a$cls);
  194. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  195. //>>excludeStart("ide", pragmas.excludeIdeData);
  196. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  197. //>>excludeEnd("ide");
  198. $core.addMethod(
  199. $core.method({
  200. selector: "bucketOfElement:",
  201. protocol: "accessing",
  202. fn: function (anObject){
  203. var self=this,$self=this;
  204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  205. return $core.withContext(function($ctx1) {
  206. //>>excludeEnd("ctx");
  207. var hash = $self['@hashBlock'](anObject);
  208. if (!hash) return null;
  209. var buckets = $self['@buckets'],
  210. bucket = buckets[hash];
  211. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  212. return bucket;
  213. ;
  214. return self;
  215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  216. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  217. //>>excludeEnd("ctx");
  218. },
  219. //>>excludeStart("ide", pragmas.excludeIdeData);
  220. args: ["anObject"],
  221. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self[''@hashBlock''](anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self[''@buckets''],\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  222. referencedClasses: [],
  223. //>>excludeEnd("ide");
  224. messageSends: []
  225. }),
  226. $globals.BucketStore);
  227. $core.addMethod(
  228. $core.method({
  229. selector: "do:",
  230. protocol: "enumerating",
  231. fn: function (aBlock){
  232. var self=this,$self=this;
  233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  234. return $core.withContext(function($ctx1) {
  235. //>>excludeEnd("ctx");
  236. var buckets = $self['@buckets'];
  237. var keys = Object.keys(buckets);
  238. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  239. ;
  240. return self;
  241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  242. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  243. //>>excludeEnd("ctx");
  244. },
  245. //>>excludeStart("ide", pragmas.excludeIdeData);
  246. args: ["aBlock"],
  247. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self[''@buckets''];\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  248. referencedClasses: [],
  249. //>>excludeEnd("ide");
  250. messageSends: []
  251. }),
  252. $globals.BucketStore);
  253. $core.addMethod(
  254. $core.method({
  255. selector: "hashBlock:",
  256. protocol: "accessing",
  257. fn: function (aBlock){
  258. var self=this,$self=this;
  259. $self["@hashBlock"]=aBlock;
  260. return self;
  261. },
  262. //>>excludeStart("ide", pragmas.excludeIdeData);
  263. args: ["aBlock"],
  264. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  265. referencedClasses: [],
  266. //>>excludeEnd("ide");
  267. messageSends: []
  268. }),
  269. $globals.BucketStore);
  270. $core.addMethod(
  271. $core.method({
  272. selector: "initialize",
  273. protocol: "initialization",
  274. fn: function (){
  275. var self=this,$self=this;
  276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  277. return $core.withContext(function($ctx1) {
  278. //>>excludeEnd("ctx");
  279. (
  280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  281. $ctx1.supercall = true,
  282. //>>excludeEnd("ctx");
  283. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  285. $ctx1.supercall = false;
  286. //>>excludeEnd("ctx");;
  287. $self._removeAll();
  288. return self;
  289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  290. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  291. //>>excludeEnd("ctx");
  292. },
  293. //>>excludeStart("ide", pragmas.excludeIdeData);
  294. args: [],
  295. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  296. referencedClasses: [],
  297. //>>excludeEnd("ide");
  298. messageSends: ["initialize", "removeAll"]
  299. }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. fn: function (){
  306. var self=this,$self=this;
  307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  308. return $core.withContext(function($ctx1) {
  309. //>>excludeEnd("ctx");
  310. $self._subclassResponsibility();
  311. return self;
  312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  313. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  314. //>>excludeEnd("ctx");
  315. },
  316. //>>excludeStart("ide", pragmas.excludeIdeData);
  317. args: [],
  318. source: "newBucket\x0a\x09self subclassResponsibility",
  319. referencedClasses: [],
  320. //>>excludeEnd("ide");
  321. messageSends: ["subclassResponsibility"]
  322. }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. fn: function (){
  329. var self=this,$self=this;
  330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  331. return $core.withContext(function($ctx1) {
  332. //>>excludeEnd("ctx");
  333. $self['@buckets'] = Object.create(null);;
  334. return self;
  335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  336. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  337. //>>excludeEnd("ctx");
  338. },
  339. //>>excludeStart("ide", pragmas.excludeIdeData);
  340. args: [],
  341. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  342. referencedClasses: [],
  343. //>>excludeEnd("ide");
  344. messageSends: []
  345. }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. fn: function (aBlock){
  352. var self=this,$self=this;
  353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  354. return $core.withContext(function($ctx1) {
  355. //>>excludeEnd("ctx");
  356. var $1;
  357. $1=$self._new();
  358. $recv($1)._hashBlock_(aBlock);
  359. return $recv($1)._yourself();
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  362. //>>excludeEnd("ctx");
  363. },
  364. //>>excludeStart("ide", pragmas.excludeIdeData);
  365. args: ["aBlock"],
  366. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  367. referencedClasses: [],
  368. //>>excludeEnd("ide");
  369. messageSends: ["hashBlock:", "new", "yourself"]
  370. }),
  371. $globals.BucketStore.a$cls);
  372. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  375. //>>excludeEnd("ide");
  376. $core.addMethod(
  377. $core.method({
  378. selector: "newBucket",
  379. protocol: "private",
  380. fn: function (){
  381. var self=this,$self=this;
  382. return [];
  383. },
  384. //>>excludeStart("ide", pragmas.excludeIdeData);
  385. args: [],
  386. source: "newBucket\x0a\x09^ #()",
  387. referencedClasses: [],
  388. //>>excludeEnd("ide");
  389. messageSends: []
  390. }),
  391. $globals.ArrayBucketStore);
  392. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  395. //>>excludeEnd("ide");
  396. $core.addMethod(
  397. $core.method({
  398. selector: ",",
  399. protocol: "copying",
  400. fn: function (aCollection){
  401. var self=this,$self=this;
  402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  403. return $core.withContext(function($ctx1) {
  404. //>>excludeEnd("ctx");
  405. var $1;
  406. $1=$self._copy();
  407. $recv($1)._addAll_(aCollection);
  408. return $recv($1)._yourself();
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  411. //>>excludeEnd("ctx");
  412. },
  413. //>>excludeStart("ide", pragmas.excludeIdeData);
  414. args: ["aCollection"],
  415. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  416. referencedClasses: [],
  417. //>>excludeEnd("ide");
  418. messageSends: ["addAll:", "copy", "yourself"]
  419. }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. fn: function (anObject){
  426. var self=this,$self=this;
  427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  428. return $core.withContext(function($ctx1) {
  429. //>>excludeEnd("ctx");
  430. $self._subclassResponsibility();
  431. return self;
  432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  433. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  434. //>>excludeEnd("ctx");
  435. },
  436. //>>excludeStart("ide", pragmas.excludeIdeData);
  437. args: ["anObject"],
  438. source: "add: anObject\x0a\x09self subclassResponsibility",
  439. referencedClasses: [],
  440. //>>excludeEnd("ide");
  441. messageSends: ["subclassResponsibility"]
  442. }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. fn: function (aCollection){
  449. var self=this,$self=this;
  450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  451. return $core.withContext(function($ctx1) {
  452. //>>excludeEnd("ctx");
  453. $recv(aCollection)._do_((function(each){
  454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  455. return $core.withContext(function($ctx2) {
  456. //>>excludeEnd("ctx");
  457. return $self._add_(each);
  458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  459. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  460. //>>excludeEnd("ctx");
  461. }));
  462. return aCollection;
  463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  464. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  465. //>>excludeEnd("ctx");
  466. },
  467. //>>excludeStart("ide", pragmas.excludeIdeData);
  468. args: ["aCollection"],
  469. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  470. referencedClasses: [],
  471. //>>excludeEnd("ide");
  472. messageSends: ["do:", "add:"]
  473. }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. fn: function (aBlock){
  480. var self=this,$self=this;
  481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  482. return $core.withContext(function($ctx1) {
  483. //>>excludeEnd("ctx");
  484. var $1;
  485. var $early={};
  486. try {
  487. $self._do_((function(each){
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx2) {
  490. //>>excludeEnd("ctx");
  491. $1=$recv(aBlock)._value_(each);
  492. if(!$core.assert($1)){
  493. throw $early=[false];
  494. }
  495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  496. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  497. //>>excludeEnd("ctx");
  498. }));
  499. return true;
  500. }
  501. catch(e) {if(e===$early)return e[0]; throw e}
  502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  503. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  504. //>>excludeEnd("ctx");
  505. },
  506. //>>excludeStart("ide", pragmas.excludeIdeData);
  507. args: ["aBlock"],
  508. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  509. referencedClasses: [],
  510. //>>excludeEnd("ide");
  511. messageSends: ["do:", "ifFalse:", "value:"]
  512. }),
  513. $globals.Collection);
  514. $core.addMethod(
  515. $core.method({
  516. selector: "anyOne",
  517. protocol: "accessing",
  518. fn: function (){
  519. var self=this,$self=this;
  520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  521. return $core.withContext(function($ctx1) {
  522. //>>excludeEnd("ctx");
  523. var $early={};
  524. try {
  525. $self._ifEmpty_((function(){
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx2) {
  528. //>>excludeEnd("ctx");
  529. return $self._error_("Collection is empty");
  530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  532. //>>excludeEnd("ctx");
  533. }));
  534. $self._do_((function(each){
  535. throw $early=[each];
  536. }));
  537. return self;
  538. }
  539. catch(e) {if(e===$early)return e[0]; throw e}
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  542. //>>excludeEnd("ctx");
  543. },
  544. //>>excludeStart("ide", pragmas.excludeIdeData);
  545. args: [],
  546. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  547. referencedClasses: [],
  548. //>>excludeEnd("ide");
  549. messageSends: ["ifEmpty:", "error:", "do:"]
  550. }),
  551. $globals.Collection);
  552. $core.addMethod(
  553. $core.method({
  554. selector: "anySatisfy:",
  555. protocol: "enumerating",
  556. fn: function (aBlock){
  557. var self=this,$self=this;
  558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  559. return $core.withContext(function($ctx1) {
  560. //>>excludeEnd("ctx");
  561. var $1;
  562. var $early={};
  563. try {
  564. $self._do_((function(each){
  565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  566. return $core.withContext(function($ctx2) {
  567. //>>excludeEnd("ctx");
  568. $1=$recv(aBlock)._value_(each);
  569. if($core.assert($1)){
  570. throw $early=[true];
  571. }
  572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  573. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  574. //>>excludeEnd("ctx");
  575. }));
  576. return false;
  577. }
  578. catch(e) {if(e===$early)return e[0]; throw e}
  579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  580. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  581. //>>excludeEnd("ctx");
  582. },
  583. //>>excludeStart("ide", pragmas.excludeIdeData);
  584. args: ["aBlock"],
  585. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  586. referencedClasses: [],
  587. //>>excludeEnd("ide");
  588. messageSends: ["do:", "ifTrue:", "value:"]
  589. }),
  590. $globals.Collection);
  591. $core.addMethod(
  592. $core.method({
  593. selector: "asArray",
  594. protocol: "converting",
  595. fn: function (){
  596. var self=this,$self=this;
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. return $core.withContext(function($ctx1) {
  599. //>>excludeEnd("ctx");
  600. return $recv($globals.Array)._withAll_(self);
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "asArray\x0a\x09^ Array withAll: self",
  608. referencedClasses: ["Array"],
  609. //>>excludeEnd("ide");
  610. messageSends: ["withAll:"]
  611. }),
  612. $globals.Collection);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "asJavaScriptObject",
  616. protocol: "converting",
  617. fn: function (){
  618. var self=this,$self=this;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. return $core.withContext(function($ctx1) {
  621. //>>excludeEnd("ctx");
  622. return $recv($self._asArray())._collect_((function(each){
  623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  624. return $core.withContext(function($ctx2) {
  625. //>>excludeEnd("ctx");
  626. return $recv(each)._asJavaScriptObject();
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  629. //>>excludeEnd("ctx");
  630. }));
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  641. }),
  642. $globals.Collection);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "asOrderedCollection",
  646. protocol: "converting",
  647. fn: function (){
  648. var self=this,$self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. return $self._asArray();
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  655. //>>excludeEnd("ctx");
  656. },
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. args: [],
  659. source: "asOrderedCollection\x0a\x09^ self asArray",
  660. referencedClasses: [],
  661. //>>excludeEnd("ide");
  662. messageSends: ["asArray"]
  663. }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asSet",
  668. protocol: "converting",
  669. fn: function (){
  670. var self=this,$self=this;
  671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  672. return $core.withContext(function($ctx1) {
  673. //>>excludeEnd("ctx");
  674. return $recv($globals.Set)._withAll_(self);
  675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  676. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  677. //>>excludeEnd("ctx");
  678. },
  679. //>>excludeStart("ide", pragmas.excludeIdeData);
  680. args: [],
  681. source: "asSet\x0a\x09^ Set withAll: self",
  682. referencedClasses: ["Set"],
  683. //>>excludeEnd("ide");
  684. messageSends: ["withAll:"]
  685. }),
  686. $globals.Collection);
  687. $core.addMethod(
  688. $core.method({
  689. selector: "collect:",
  690. protocol: "enumerating",
  691. fn: function (aBlock){
  692. var self=this,$self=this;
  693. var stream;
  694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  695. return $core.withContext(function($ctx1) {
  696. //>>excludeEnd("ctx");
  697. stream=$recv($recv($self._class())._new())._writeStream();
  698. $self._do_((function(each){
  699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  700. return $core.withContext(function($ctx2) {
  701. //>>excludeEnd("ctx");
  702. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  704. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  705. //>>excludeEnd("ctx");
  706. }));
  707. return $recv(stream)._contents();
  708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  709. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  710. //>>excludeEnd("ctx");
  711. },
  712. //>>excludeStart("ide", pragmas.excludeIdeData);
  713. args: ["aBlock"],
  714. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  715. referencedClasses: [],
  716. //>>excludeEnd("ide");
  717. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  718. }),
  719. $globals.Collection);
  720. $core.addMethod(
  721. $core.method({
  722. selector: "copyWith:",
  723. protocol: "copying",
  724. fn: function (anObject){
  725. var self=this,$self=this;
  726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  727. return $core.withContext(function($ctx1) {
  728. //>>excludeEnd("ctx");
  729. var $1;
  730. $1=$self._copy();
  731. $recv($1)._add_(anObject);
  732. return $recv($1)._yourself();
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  735. //>>excludeEnd("ctx");
  736. },
  737. //>>excludeStart("ide", pragmas.excludeIdeData);
  738. args: ["anObject"],
  739. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  740. referencedClasses: [],
  741. //>>excludeEnd("ide");
  742. messageSends: ["add:", "copy", "yourself"]
  743. }),
  744. $globals.Collection);
  745. $core.addMethod(
  746. $core.method({
  747. selector: "copyWithAll:",
  748. protocol: "copying",
  749. fn: function (aCollection){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._addAll_(aCollection);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  760. //>>excludeEnd("ctx");
  761. },
  762. //>>excludeStart("ide", pragmas.excludeIdeData);
  763. args: ["aCollection"],
  764. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  765. referencedClasses: [],
  766. //>>excludeEnd("ide");
  767. messageSends: ["addAll:", "copy", "yourself"]
  768. }),
  769. $globals.Collection);
  770. $core.addMethod(
  771. $core.method({
  772. selector: "copyWithout:",
  773. protocol: "copying",
  774. fn: function (anObject){
  775. var self=this,$self=this;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. return $core.withContext(function($ctx1) {
  778. //>>excludeEnd("ctx");
  779. return $self._reject_((function(each){
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx2) {
  782. //>>excludeEnd("ctx");
  783. return $recv(each).__eq(anObject);
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  786. //>>excludeEnd("ctx");
  787. }));
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  790. //>>excludeEnd("ctx");
  791. },
  792. //>>excludeStart("ide", pragmas.excludeIdeData);
  793. args: ["anObject"],
  794. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  795. referencedClasses: [],
  796. //>>excludeEnd("ide");
  797. messageSends: ["reject:", "="]
  798. }),
  799. $globals.Collection);
  800. $core.addMethod(
  801. $core.method({
  802. selector: "copyWithoutAll:",
  803. protocol: "copying",
  804. fn: function (aCollection){
  805. var self=this,$self=this;
  806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  807. return $core.withContext(function($ctx1) {
  808. //>>excludeEnd("ctx");
  809. return $self._reject_((function(each){
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx2) {
  812. //>>excludeEnd("ctx");
  813. return $recv(aCollection)._includes_(each);
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  816. //>>excludeEnd("ctx");
  817. }));
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  820. //>>excludeEnd("ctx");
  821. },
  822. //>>excludeStart("ide", pragmas.excludeIdeData);
  823. args: ["aCollection"],
  824. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  825. referencedClasses: [],
  826. //>>excludeEnd("ide");
  827. messageSends: ["reject:", "includes:"]
  828. }),
  829. $globals.Collection);
  830. $core.addMethod(
  831. $core.method({
  832. selector: "deepCopy",
  833. protocol: "copying",
  834. fn: function (){
  835. var self=this,$self=this;
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. return $core.withContext(function($ctx1) {
  838. //>>excludeEnd("ctx");
  839. return $self._collect_((function(each){
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx2) {
  842. //>>excludeEnd("ctx");
  843. return $recv(each)._deepCopy();
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  846. //>>excludeEnd("ctx");
  847. }));
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  850. //>>excludeEnd("ctx");
  851. },
  852. //>>excludeStart("ide", pragmas.excludeIdeData);
  853. args: [],
  854. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  855. referencedClasses: [],
  856. //>>excludeEnd("ide");
  857. messageSends: ["collect:", "deepCopy"]
  858. }),
  859. $globals.Collection);
  860. $core.addMethod(
  861. $core.method({
  862. selector: "detect:",
  863. protocol: "enumerating",
  864. fn: function (aBlock){
  865. var self=this,$self=this;
  866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  867. return $core.withContext(function($ctx1) {
  868. //>>excludeEnd("ctx");
  869. return $self._detect_ifNone_(aBlock,(function(){
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx2) {
  872. //>>excludeEnd("ctx");
  873. return $self._errorNotFound();
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  876. //>>excludeEnd("ctx");
  877. }));
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  880. //>>excludeEnd("ctx");
  881. },
  882. //>>excludeStart("ide", pragmas.excludeIdeData);
  883. args: ["aBlock"],
  884. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  885. referencedClasses: [],
  886. //>>excludeEnd("ide");
  887. messageSends: ["detect:ifNone:", "errorNotFound"]
  888. }),
  889. $globals.Collection);
  890. $core.addMethod(
  891. $core.method({
  892. selector: "detect:ifNone:",
  893. protocol: "enumerating",
  894. fn: function (aBlock,anotherBlock){
  895. var self=this,$self=this;
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. return $core.withContext(function($ctx1) {
  898. //>>excludeEnd("ctx");
  899. var $1;
  900. var $early={};
  901. try {
  902. $self._do_((function(each){
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. return $core.withContext(function($ctx2) {
  905. //>>excludeEnd("ctx");
  906. $1=$recv(aBlock)._value_(each);
  907. if($core.assert($1)){
  908. throw $early=[each];
  909. }
  910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  911. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  912. //>>excludeEnd("ctx");
  913. }));
  914. return $recv(anotherBlock)._value();
  915. }
  916. catch(e) {if(e===$early)return e[0]; throw e}
  917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  918. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  919. //>>excludeEnd("ctx");
  920. },
  921. //>>excludeStart("ide", pragmas.excludeIdeData);
  922. args: ["aBlock", "anotherBlock"],
  923. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  924. referencedClasses: [],
  925. //>>excludeEnd("ide");
  926. messageSends: ["do:", "ifTrue:", "value:", "value"]
  927. }),
  928. $globals.Collection);
  929. $core.addMethod(
  930. $core.method({
  931. selector: "do:",
  932. protocol: "enumerating",
  933. fn: function (aBlock){
  934. var self=this,$self=this;
  935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  936. return $core.withContext(function($ctx1) {
  937. //>>excludeEnd("ctx");
  938. $self._subclassResponsibility();
  939. return self;
  940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  941. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  942. //>>excludeEnd("ctx");
  943. },
  944. //>>excludeStart("ide", pragmas.excludeIdeData);
  945. args: ["aBlock"],
  946. source: "do: aBlock\x0a\x09self subclassResponsibility",
  947. referencedClasses: [],
  948. //>>excludeEnd("ide");
  949. messageSends: ["subclassResponsibility"]
  950. }),
  951. $globals.Collection);
  952. $core.addMethod(
  953. $core.method({
  954. selector: "do:separatedBy:",
  955. protocol: "enumerating",
  956. fn: function (aBlock,anotherBlock){
  957. var self=this,$self=this;
  958. var actionBeforeElement;
  959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  960. return $core.withContext(function($ctx1) {
  961. //>>excludeEnd("ctx");
  962. actionBeforeElement=(function(){
  963. actionBeforeElement=anotherBlock;
  964. return actionBeforeElement;
  965. });
  966. $self._do_((function(each){
  967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  968. return $core.withContext(function($ctx2) {
  969. //>>excludeEnd("ctx");
  970. $recv(actionBeforeElement)._value();
  971. return $recv(aBlock)._value_(each);
  972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  974. //>>excludeEnd("ctx");
  975. }));
  976. return self;
  977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  978. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  979. //>>excludeEnd("ctx");
  980. },
  981. //>>excludeStart("ide", pragmas.excludeIdeData);
  982. args: ["aBlock", "anotherBlock"],
  983. 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 ]",
  984. referencedClasses: [],
  985. //>>excludeEnd("ide");
  986. messageSends: ["do:", "value", "value:"]
  987. }),
  988. $globals.Collection);
  989. $core.addMethod(
  990. $core.method({
  991. selector: "errorNotFound",
  992. protocol: "error handling",
  993. fn: function (){
  994. var self=this,$self=this;
  995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  996. return $core.withContext(function($ctx1) {
  997. //>>excludeEnd("ctx");
  998. $self._error_("Object is not in the collection");
  999. return self;
  1000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1001. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  1002. //>>excludeEnd("ctx");
  1003. },
  1004. //>>excludeStart("ide", pragmas.excludeIdeData);
  1005. args: [],
  1006. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1007. referencedClasses: [],
  1008. //>>excludeEnd("ide");
  1009. messageSends: ["error:"]
  1010. }),
  1011. $globals.Collection);
  1012. $core.addMethod(
  1013. $core.method({
  1014. selector: "ifEmpty:",
  1015. protocol: "testing",
  1016. fn: function (aBlock){
  1017. var self=this,$self=this;
  1018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1019. return $core.withContext(function($ctx1) {
  1020. //>>excludeEnd("ctx");
  1021. var $1;
  1022. $1=$self._isEmpty();
  1023. if($core.assert($1)){
  1024. return $recv(aBlock)._value();
  1025. } else {
  1026. return self;
  1027. }
  1028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1029. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1030. //>>excludeEnd("ctx");
  1031. },
  1032. //>>excludeStart("ide", pragmas.excludeIdeData);
  1033. args: ["aBlock"],
  1034. 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 ]",
  1035. referencedClasses: [],
  1036. //>>excludeEnd("ide");
  1037. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1038. }),
  1039. $globals.Collection);
  1040. $core.addMethod(
  1041. $core.method({
  1042. selector: "ifEmpty:ifNotEmpty:",
  1043. protocol: "testing",
  1044. fn: function (aBlock,anotherBlock){
  1045. var self=this,$self=this;
  1046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1047. return $core.withContext(function($ctx1) {
  1048. //>>excludeEnd("ctx");
  1049. var $1;
  1050. $1=$self._isEmpty();
  1051. if($core.assert($1)){
  1052. return $recv(aBlock)._value();
  1053. } else {
  1054. return $recv(anotherBlock)._value_(self);
  1055. }
  1056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1057. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1058. //>>excludeEnd("ctx");
  1059. },
  1060. //>>excludeStart("ide", pragmas.excludeIdeData);
  1061. args: ["aBlock", "anotherBlock"],
  1062. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1063. referencedClasses: [],
  1064. //>>excludeEnd("ide");
  1065. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1066. }),
  1067. $globals.Collection);
  1068. $core.addMethod(
  1069. $core.method({
  1070. selector: "ifNotEmpty:",
  1071. protocol: "testing",
  1072. fn: function (aBlock){
  1073. var self=this,$self=this;
  1074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1075. return $core.withContext(function($ctx1) {
  1076. //>>excludeEnd("ctx");
  1077. var $1;
  1078. $1=$self._notEmpty();
  1079. if($core.assert($1)){
  1080. return $recv(aBlock)._value_(self);
  1081. } else {
  1082. return self;
  1083. }
  1084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1085. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1086. //>>excludeEnd("ctx");
  1087. },
  1088. //>>excludeStart("ide", pragmas.excludeIdeData);
  1089. args: ["aBlock"],
  1090. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1091. referencedClasses: [],
  1092. //>>excludeEnd("ide");
  1093. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1094. }),
  1095. $globals.Collection);
  1096. $core.addMethod(
  1097. $core.method({
  1098. selector: "ifNotEmpty:ifEmpty:",
  1099. protocol: "testing",
  1100. fn: function (aBlock,anotherBlock){
  1101. var self=this,$self=this;
  1102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1103. return $core.withContext(function($ctx1) {
  1104. //>>excludeEnd("ctx");
  1105. var $1;
  1106. $1=$self._notEmpty();
  1107. if($core.assert($1)){
  1108. return $recv(aBlock)._value_(self);
  1109. } else {
  1110. return $recv(anotherBlock)._value();
  1111. }
  1112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1113. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1114. //>>excludeEnd("ctx");
  1115. },
  1116. //>>excludeStart("ide", pragmas.excludeIdeData);
  1117. args: ["aBlock", "anotherBlock"],
  1118. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1119. referencedClasses: [],
  1120. //>>excludeEnd("ide");
  1121. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1122. }),
  1123. $globals.Collection);
  1124. $core.addMethod(
  1125. $core.method({
  1126. selector: "includes:",
  1127. protocol: "testing",
  1128. fn: function (anObject){
  1129. var self=this,$self=this;
  1130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1131. return $core.withContext(function($ctx1) {
  1132. //>>excludeEnd("ctx");
  1133. return $self._anySatisfy_((function(each){
  1134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1135. return $core.withContext(function($ctx2) {
  1136. //>>excludeEnd("ctx");
  1137. return $recv(each).__eq(anObject);
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1140. //>>excludeEnd("ctx");
  1141. }));
  1142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1143. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1144. //>>excludeEnd("ctx");
  1145. },
  1146. //>>excludeStart("ide", pragmas.excludeIdeData);
  1147. args: ["anObject"],
  1148. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1149. referencedClasses: [],
  1150. //>>excludeEnd("ide");
  1151. messageSends: ["anySatisfy:", "="]
  1152. }),
  1153. $globals.Collection);
  1154. $core.addMethod(
  1155. $core.method({
  1156. selector: "inject:into:",
  1157. protocol: "enumerating",
  1158. fn: function (anObject,aBlock){
  1159. var self=this,$self=this;
  1160. var result;
  1161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1162. return $core.withContext(function($ctx1) {
  1163. //>>excludeEnd("ctx");
  1164. result=anObject;
  1165. $self._do_((function(each){
  1166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1167. return $core.withContext(function($ctx2) {
  1168. //>>excludeEnd("ctx");
  1169. result=$recv(aBlock)._value_value_(result,each);
  1170. return result;
  1171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1173. //>>excludeEnd("ctx");
  1174. }));
  1175. return result;
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1178. //>>excludeEnd("ctx");
  1179. },
  1180. //>>excludeStart("ide", pragmas.excludeIdeData);
  1181. args: ["anObject", "aBlock"],
  1182. 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",
  1183. referencedClasses: [],
  1184. //>>excludeEnd("ide");
  1185. messageSends: ["do:", "value:value:"]
  1186. }),
  1187. $globals.Collection);
  1188. $core.addMethod(
  1189. $core.method({
  1190. selector: "intersection:",
  1191. protocol: "enumerating",
  1192. fn: function (aCollection){
  1193. var self=this,$self=this;
  1194. var set,outputSet;
  1195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1196. return $core.withContext(function($ctx1) {
  1197. //>>excludeEnd("ctx");
  1198. var $2,$1;
  1199. set=$self._asSet();
  1200. outputSet=$recv($globals.Set)._new();
  1201. $recv(aCollection)._do_((function(each){
  1202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1203. return $core.withContext(function($ctx2) {
  1204. //>>excludeEnd("ctx");
  1205. $2=$recv(set)._includes_(each);
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. $ctx2.sendIdx["includes:"]=1;
  1208. //>>excludeEnd("ctx");
  1209. $1=$recv($2)._and_((function(){
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. return $core.withContext(function($ctx3) {
  1212. //>>excludeEnd("ctx");
  1213. return $recv($recv(outputSet)._includes_(each))._not();
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1216. //>>excludeEnd("ctx");
  1217. }));
  1218. if($core.assert($1)){
  1219. return $recv(outputSet)._add_(each);
  1220. }
  1221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1222. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1223. //>>excludeEnd("ctx");
  1224. }));
  1225. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1227. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1228. //>>excludeEnd("ctx");
  1229. },
  1230. //>>excludeStart("ide", pragmas.excludeIdeData);
  1231. args: ["aCollection"],
  1232. 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",
  1233. referencedClasses: ["Set"],
  1234. //>>excludeEnd("ide");
  1235. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1236. }),
  1237. $globals.Collection);
  1238. $core.addMethod(
  1239. $core.method({
  1240. selector: "isEmpty",
  1241. protocol: "testing",
  1242. fn: function (){
  1243. var self=this,$self=this;
  1244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1245. return $core.withContext(function($ctx1) {
  1246. //>>excludeEnd("ctx");
  1247. return $recv($self._size()).__eq((0));
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1250. //>>excludeEnd("ctx");
  1251. },
  1252. //>>excludeStart("ide", pragmas.excludeIdeData);
  1253. args: [],
  1254. source: "isEmpty\x0a\x09^ self size = 0",
  1255. referencedClasses: [],
  1256. //>>excludeEnd("ide");
  1257. messageSends: ["=", "size"]
  1258. }),
  1259. $globals.Collection);
  1260. $core.addMethod(
  1261. $core.method({
  1262. selector: "noneSatisfy:",
  1263. protocol: "enumerating",
  1264. fn: function (aBlock){
  1265. var self=this,$self=this;
  1266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1267. return $core.withContext(function($ctx1) {
  1268. //>>excludeEnd("ctx");
  1269. var $1;
  1270. var $early={};
  1271. try {
  1272. $self._do_((function(item){
  1273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1274. return $core.withContext(function($ctx2) {
  1275. //>>excludeEnd("ctx");
  1276. $1=$recv(aBlock)._value_(item);
  1277. if($core.assert($1)){
  1278. throw $early=[false];
  1279. }
  1280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1281. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1282. //>>excludeEnd("ctx");
  1283. }));
  1284. return true;
  1285. }
  1286. catch(e) {if(e===$early)return e[0]; throw e}
  1287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1288. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1289. //>>excludeEnd("ctx");
  1290. },
  1291. //>>excludeStart("ide", pragmas.excludeIdeData);
  1292. args: ["aBlock"],
  1293. 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",
  1294. referencedClasses: [],
  1295. //>>excludeEnd("ide");
  1296. messageSends: ["do:", "ifTrue:", "value:"]
  1297. }),
  1298. $globals.Collection);
  1299. $core.addMethod(
  1300. $core.method({
  1301. selector: "notEmpty",
  1302. protocol: "testing",
  1303. fn: function (){
  1304. var self=this,$self=this;
  1305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1306. return $core.withContext(function($ctx1) {
  1307. //>>excludeEnd("ctx");
  1308. return $recv($self._isEmpty())._not();
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1311. //>>excludeEnd("ctx");
  1312. },
  1313. //>>excludeStart("ide", pragmas.excludeIdeData);
  1314. args: [],
  1315. source: "notEmpty\x0a\x09^ self isEmpty not",
  1316. referencedClasses: [],
  1317. //>>excludeEnd("ide");
  1318. messageSends: ["not", "isEmpty"]
  1319. }),
  1320. $globals.Collection);
  1321. $core.addMethod(
  1322. $core.method({
  1323. selector: "occurrencesOf:",
  1324. protocol: "accessing",
  1325. fn: function (anObject){
  1326. var self=this,$self=this;
  1327. var tally;
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. return $core.withContext(function($ctx1) {
  1330. //>>excludeEnd("ctx");
  1331. var $1;
  1332. tally=(0);
  1333. $self._do_((function(each){
  1334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1335. return $core.withContext(function($ctx2) {
  1336. //>>excludeEnd("ctx");
  1337. $1=$recv(anObject).__eq(each);
  1338. if($core.assert($1)){
  1339. tally=$recv(tally).__plus((1));
  1340. return tally;
  1341. }
  1342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1344. //>>excludeEnd("ctx");
  1345. }));
  1346. return tally;
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1349. //>>excludeEnd("ctx");
  1350. },
  1351. //>>excludeStart("ide", pragmas.excludeIdeData);
  1352. args: ["anObject"],
  1353. 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",
  1354. referencedClasses: [],
  1355. //>>excludeEnd("ide");
  1356. messageSends: ["do:", "ifTrue:", "=", "+"]
  1357. }),
  1358. $globals.Collection);
  1359. $core.addMethod(
  1360. $core.method({
  1361. selector: "putOn:",
  1362. protocol: "streaming",
  1363. fn: function (aStream){
  1364. var self=this,$self=this;
  1365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1366. return $core.withContext(function($ctx1) {
  1367. //>>excludeEnd("ctx");
  1368. $self._do_((function(each){
  1369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1370. return $core.withContext(function($ctx2) {
  1371. //>>excludeEnd("ctx");
  1372. return $recv(each)._putOn_(aStream);
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1375. //>>excludeEnd("ctx");
  1376. }));
  1377. return self;
  1378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1379. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1380. //>>excludeEnd("ctx");
  1381. },
  1382. //>>excludeStart("ide", pragmas.excludeIdeData);
  1383. args: ["aStream"],
  1384. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1385. referencedClasses: [],
  1386. //>>excludeEnd("ide");
  1387. messageSends: ["do:", "putOn:"]
  1388. }),
  1389. $globals.Collection);
  1390. $core.addMethod(
  1391. $core.method({
  1392. selector: "reject:",
  1393. protocol: "enumerating",
  1394. fn: function (aBlock){
  1395. var self=this,$self=this;
  1396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1397. return $core.withContext(function($ctx1) {
  1398. //>>excludeEnd("ctx");
  1399. return $self._select_((function(each){
  1400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1401. return $core.withContext(function($ctx2) {
  1402. //>>excludeEnd("ctx");
  1403. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1405. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1406. //>>excludeEnd("ctx");
  1407. }));
  1408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1409. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1410. //>>excludeEnd("ctx");
  1411. },
  1412. //>>excludeStart("ide", pragmas.excludeIdeData);
  1413. args: ["aBlock"],
  1414. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1415. referencedClasses: [],
  1416. //>>excludeEnd("ide");
  1417. messageSends: ["select:", "=", "value:"]
  1418. }),
  1419. $globals.Collection);
  1420. $core.addMethod(
  1421. $core.method({
  1422. selector: "remove:",
  1423. protocol: "adding/removing",
  1424. fn: function (anObject){
  1425. var self=this,$self=this;
  1426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1427. return $core.withContext(function($ctx1) {
  1428. //>>excludeEnd("ctx");
  1429. return $self._remove_ifAbsent_(anObject,(function(){
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. return $core.withContext(function($ctx2) {
  1432. //>>excludeEnd("ctx");
  1433. return $self._errorNotFound();
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1436. //>>excludeEnd("ctx");
  1437. }));
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1440. //>>excludeEnd("ctx");
  1441. },
  1442. //>>excludeStart("ide", pragmas.excludeIdeData);
  1443. args: ["anObject"],
  1444. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1445. referencedClasses: [],
  1446. //>>excludeEnd("ide");
  1447. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1448. }),
  1449. $globals.Collection);
  1450. $core.addMethod(
  1451. $core.method({
  1452. selector: "remove:ifAbsent:",
  1453. protocol: "adding/removing",
  1454. fn: function (anObject,aBlock){
  1455. var self=this,$self=this;
  1456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1457. return $core.withContext(function($ctx1) {
  1458. //>>excludeEnd("ctx");
  1459. $self._subclassResponsibility();
  1460. return self;
  1461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1462. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1463. //>>excludeEnd("ctx");
  1464. },
  1465. //>>excludeStart("ide", pragmas.excludeIdeData);
  1466. args: ["anObject", "aBlock"],
  1467. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1468. referencedClasses: [],
  1469. //>>excludeEnd("ide");
  1470. messageSends: ["subclassResponsibility"]
  1471. }),
  1472. $globals.Collection);
  1473. $core.addMethod(
  1474. $core.method({
  1475. selector: "removeAll",
  1476. protocol: "adding/removing",
  1477. fn: function (){
  1478. var self=this,$self=this;
  1479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1480. return $core.withContext(function($ctx1) {
  1481. //>>excludeEnd("ctx");
  1482. $self._subclassResponsibility();
  1483. return self;
  1484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1485. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1486. //>>excludeEnd("ctx");
  1487. },
  1488. //>>excludeStart("ide", pragmas.excludeIdeData);
  1489. args: [],
  1490. source: "removeAll\x0a\x09self subclassResponsibility",
  1491. referencedClasses: [],
  1492. //>>excludeEnd("ide");
  1493. messageSends: ["subclassResponsibility"]
  1494. }),
  1495. $globals.Collection);
  1496. $core.addMethod(
  1497. $core.method({
  1498. selector: "select:",
  1499. protocol: "enumerating",
  1500. fn: function (aBlock){
  1501. var self=this,$self=this;
  1502. var stream;
  1503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1504. return $core.withContext(function($ctx1) {
  1505. //>>excludeEnd("ctx");
  1506. var $1;
  1507. stream=$recv($recv($self._class())._new())._writeStream();
  1508. $self._do_((function(each){
  1509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1510. return $core.withContext(function($ctx2) {
  1511. //>>excludeEnd("ctx");
  1512. $1=$recv(aBlock)._value_(each);
  1513. if($core.assert($1)){
  1514. return $recv(stream)._nextPut_(each);
  1515. }
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1518. //>>excludeEnd("ctx");
  1519. }));
  1520. return $recv(stream)._contents();
  1521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1522. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1523. //>>excludeEnd("ctx");
  1524. },
  1525. //>>excludeStart("ide", pragmas.excludeIdeData);
  1526. args: ["aBlock"],
  1527. 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",
  1528. referencedClasses: [],
  1529. //>>excludeEnd("ide");
  1530. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1531. }),
  1532. $globals.Collection);
  1533. $core.addMethod(
  1534. $core.method({
  1535. selector: "select:thenCollect:",
  1536. protocol: "enumerating",
  1537. fn: function (selectBlock,collectBlock){
  1538. var self=this,$self=this;
  1539. var stream;
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. return $core.withContext(function($ctx1) {
  1542. //>>excludeEnd("ctx");
  1543. var $1;
  1544. stream=$recv($recv($self._class())._new())._writeStream();
  1545. $self._do_((function(each){
  1546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1547. return $core.withContext(function($ctx2) {
  1548. //>>excludeEnd("ctx");
  1549. $1=$recv(selectBlock)._value_(each);
  1550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1551. $ctx2.sendIdx["value:"]=1;
  1552. //>>excludeEnd("ctx");
  1553. if($core.assert($1)){
  1554. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1555. }
  1556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1557. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1558. //>>excludeEnd("ctx");
  1559. }));
  1560. return $recv(stream)._contents();
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1563. //>>excludeEnd("ctx");
  1564. },
  1565. //>>excludeStart("ide", pragmas.excludeIdeData);
  1566. args: ["selectBlock", "collectBlock"],
  1567. 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",
  1568. referencedClasses: [],
  1569. //>>excludeEnd("ide");
  1570. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1571. }),
  1572. $globals.Collection);
  1573. $core.addMethod(
  1574. $core.method({
  1575. selector: "shallowCopy",
  1576. protocol: "copying",
  1577. fn: function (){
  1578. var self=this,$self=this;
  1579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1580. return $core.withContext(function($ctx1) {
  1581. //>>excludeEnd("ctx");
  1582. return $self._collect_((function(each){
  1583. return each;
  1584. }));
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1587. //>>excludeEnd("ctx");
  1588. },
  1589. //>>excludeStart("ide", pragmas.excludeIdeData);
  1590. args: [],
  1591. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1592. referencedClasses: [],
  1593. //>>excludeEnd("ide");
  1594. messageSends: ["collect:"]
  1595. }),
  1596. $globals.Collection);
  1597. $core.addMethod(
  1598. $core.method({
  1599. selector: "single",
  1600. protocol: "accessing",
  1601. fn: function (){
  1602. var self=this,$self=this;
  1603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1604. return $core.withContext(function($ctx1) {
  1605. //>>excludeEnd("ctx");
  1606. var $1;
  1607. $self._ifEmpty_((function(){
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. return $core.withContext(function($ctx2) {
  1610. //>>excludeEnd("ctx");
  1611. return $self._error_("Collection is empty");
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. $ctx2.sendIdx["error:"]=1;
  1614. //>>excludeEnd("ctx");
  1615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1617. //>>excludeEnd("ctx");
  1618. }));
  1619. $1=$recv($self._size()).__gt((1));
  1620. if($core.assert($1)){
  1621. $self._error_("Collection holds more than one element");
  1622. }
  1623. return $self._anyOne();
  1624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1625. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1626. //>>excludeEnd("ctx");
  1627. },
  1628. //>>excludeStart("ide", pragmas.excludeIdeData);
  1629. args: [],
  1630. 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",
  1631. referencedClasses: [],
  1632. //>>excludeEnd("ide");
  1633. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1634. }),
  1635. $globals.Collection);
  1636. $core.addMethod(
  1637. $core.method({
  1638. selector: "size",
  1639. protocol: "accessing",
  1640. fn: function (){
  1641. var self=this,$self=this;
  1642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1643. return $core.withContext(function($ctx1) {
  1644. //>>excludeEnd("ctx");
  1645. $self._subclassResponsibility();
  1646. return self;
  1647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1648. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1649. //>>excludeEnd("ctx");
  1650. },
  1651. //>>excludeStart("ide", pragmas.excludeIdeData);
  1652. args: [],
  1653. source: "size\x0a\x09self subclassResponsibility",
  1654. referencedClasses: [],
  1655. //>>excludeEnd("ide");
  1656. messageSends: ["subclassResponsibility"]
  1657. }),
  1658. $globals.Collection);
  1659. $core.addMethod(
  1660. $core.method({
  1661. selector: "classTag",
  1662. protocol: "accessing",
  1663. fn: function (){
  1664. var self=this,$self=this;
  1665. return "collection";
  1666. },
  1667. //>>excludeStart("ide", pragmas.excludeIdeData);
  1668. args: [],
  1669. 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'",
  1670. referencedClasses: [],
  1671. //>>excludeEnd("ide");
  1672. messageSends: []
  1673. }),
  1674. $globals.Collection.a$cls);
  1675. $core.addMethod(
  1676. $core.method({
  1677. selector: "new:",
  1678. protocol: "instance creation",
  1679. fn: function (anInteger){
  1680. var self=this,$self=this;
  1681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1682. return $core.withContext(function($ctx1) {
  1683. //>>excludeEnd("ctx");
  1684. return $self._new();
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  1687. //>>excludeEnd("ctx");
  1688. },
  1689. //>>excludeStart("ide", pragmas.excludeIdeData);
  1690. args: ["anInteger"],
  1691. source: "new: anInteger\x0a\x09^ self new",
  1692. referencedClasses: [],
  1693. //>>excludeEnd("ide");
  1694. messageSends: ["new"]
  1695. }),
  1696. $globals.Collection.a$cls);
  1697. $core.addMethod(
  1698. $core.method({
  1699. selector: "with:",
  1700. protocol: "instance creation",
  1701. fn: function (anObject){
  1702. var self=this,$self=this;
  1703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1704. return $core.withContext(function($ctx1) {
  1705. //>>excludeEnd("ctx");
  1706. var $1;
  1707. $1=$self._new();
  1708. $recv($1)._add_(anObject);
  1709. return $recv($1)._yourself();
  1710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1711. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  1712. //>>excludeEnd("ctx");
  1713. },
  1714. //>>excludeStart("ide", pragmas.excludeIdeData);
  1715. args: ["anObject"],
  1716. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1717. referencedClasses: [],
  1718. //>>excludeEnd("ide");
  1719. messageSends: ["add:", "new", "yourself"]
  1720. }),
  1721. $globals.Collection.a$cls);
  1722. $core.addMethod(
  1723. $core.method({
  1724. selector: "with:with:",
  1725. protocol: "instance creation",
  1726. fn: function (anObject,anotherObject){
  1727. var self=this,$self=this;
  1728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1729. return $core.withContext(function($ctx1) {
  1730. //>>excludeEnd("ctx");
  1731. var $1;
  1732. $1=$self._new();
  1733. $recv($1)._add_(anObject);
  1734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1735. $ctx1.sendIdx["add:"]=1;
  1736. //>>excludeEnd("ctx");
  1737. $recv($1)._add_(anotherObject);
  1738. return $recv($1)._yourself();
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  1741. //>>excludeEnd("ctx");
  1742. },
  1743. //>>excludeStart("ide", pragmas.excludeIdeData);
  1744. args: ["anObject", "anotherObject"],
  1745. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1746. referencedClasses: [],
  1747. //>>excludeEnd("ide");
  1748. messageSends: ["add:", "new", "yourself"]
  1749. }),
  1750. $globals.Collection.a$cls);
  1751. $core.addMethod(
  1752. $core.method({
  1753. selector: "with:with:with:",
  1754. protocol: "instance creation",
  1755. fn: function (firstObject,secondObject,thirdObject){
  1756. var self=this,$self=this;
  1757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1758. return $core.withContext(function($ctx1) {
  1759. //>>excludeEnd("ctx");
  1760. var $1;
  1761. $1=$self._new();
  1762. $recv($1)._add_(firstObject);
  1763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1764. $ctx1.sendIdx["add:"]=1;
  1765. //>>excludeEnd("ctx");
  1766. $recv($1)._add_(secondObject);
  1767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1768. $ctx1.sendIdx["add:"]=2;
  1769. //>>excludeEnd("ctx");
  1770. $recv($1)._add_(thirdObject);
  1771. return $recv($1)._yourself();
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  1774. //>>excludeEnd("ctx");
  1775. },
  1776. //>>excludeStart("ide", pragmas.excludeIdeData);
  1777. args: ["firstObject", "secondObject", "thirdObject"],
  1778. 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",
  1779. referencedClasses: [],
  1780. //>>excludeEnd("ide");
  1781. messageSends: ["add:", "new", "yourself"]
  1782. }),
  1783. $globals.Collection.a$cls);
  1784. $core.addMethod(
  1785. $core.method({
  1786. selector: "withAll:",
  1787. protocol: "instance creation",
  1788. fn: function (aCollection){
  1789. var self=this,$self=this;
  1790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1791. return $core.withContext(function($ctx1) {
  1792. //>>excludeEnd("ctx");
  1793. var $1;
  1794. $1=$self._new();
  1795. $recv($1)._addAll_(aCollection);
  1796. return $recv($1)._yourself();
  1797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1798. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  1799. //>>excludeEnd("ctx");
  1800. },
  1801. //>>excludeStart("ide", pragmas.excludeIdeData);
  1802. args: ["aCollection"],
  1803. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1804. referencedClasses: [],
  1805. //>>excludeEnd("ide");
  1806. messageSends: ["addAll:", "new", "yourself"]
  1807. }),
  1808. $globals.Collection.a$cls);
  1809. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  1810. //>>excludeStart("ide", pragmas.excludeIdeData);
  1811. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  1812. //>>excludeEnd("ide");
  1813. $core.addMethod(
  1814. $core.method({
  1815. selector: "at:",
  1816. protocol: "accessing",
  1817. fn: function (anIndex){
  1818. var self=this,$self=this;
  1819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1820. return $core.withContext(function($ctx1) {
  1821. //>>excludeEnd("ctx");
  1822. return $self._at_ifAbsent_(anIndex,(function(){
  1823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1824. return $core.withContext(function($ctx2) {
  1825. //>>excludeEnd("ctx");
  1826. return $self._errorNotFound();
  1827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1829. //>>excludeEnd("ctx");
  1830. }));
  1831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1832. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1833. //>>excludeEnd("ctx");
  1834. },
  1835. //>>excludeStart("ide", pragmas.excludeIdeData);
  1836. args: ["anIndex"],
  1837. 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 ]",
  1838. referencedClasses: [],
  1839. //>>excludeEnd("ide");
  1840. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1841. }),
  1842. $globals.IndexableCollection);
  1843. $core.addMethod(
  1844. $core.method({
  1845. selector: "at:ifAbsent:",
  1846. protocol: "accessing",
  1847. fn: function (anIndex,aBlock){
  1848. var self=this,$self=this;
  1849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1850. return $core.withContext(function($ctx1) {
  1851. //>>excludeEnd("ctx");
  1852. $self._subclassResponsibility();
  1853. return self;
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1856. //>>excludeEnd("ctx");
  1857. },
  1858. //>>excludeStart("ide", pragmas.excludeIdeData);
  1859. args: ["anIndex", "aBlock"],
  1860. 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",
  1861. referencedClasses: [],
  1862. //>>excludeEnd("ide");
  1863. messageSends: ["subclassResponsibility"]
  1864. }),
  1865. $globals.IndexableCollection);
  1866. $core.addMethod(
  1867. $core.method({
  1868. selector: "at:ifAbsentPut:",
  1869. protocol: "accessing",
  1870. fn: function (aKey,aBlock){
  1871. var self=this,$self=this;
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. return $core.withContext(function($ctx1) {
  1874. //>>excludeEnd("ctx");
  1875. return $self._at_ifAbsent_(aKey,(function(){
  1876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1877. return $core.withContext(function($ctx2) {
  1878. //>>excludeEnd("ctx");
  1879. return $self._at_put_(aKey,$recv(aBlock)._value());
  1880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1882. //>>excludeEnd("ctx");
  1883. }));
  1884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1885. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1886. //>>excludeEnd("ctx");
  1887. },
  1888. //>>excludeStart("ide", pragmas.excludeIdeData);
  1889. args: ["aKey", "aBlock"],
  1890. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1891. referencedClasses: [],
  1892. //>>excludeEnd("ide");
  1893. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1894. }),
  1895. $globals.IndexableCollection);
  1896. $core.addMethod(
  1897. $core.method({
  1898. selector: "at:ifPresent:",
  1899. protocol: "accessing",
  1900. fn: function (anIndex,aBlock){
  1901. var self=this,$self=this;
  1902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1903. return $core.withContext(function($ctx1) {
  1904. //>>excludeEnd("ctx");
  1905. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1906. return nil;
  1907. }));
  1908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1909. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1910. //>>excludeEnd("ctx");
  1911. },
  1912. //>>excludeStart("ide", pragmas.excludeIdeData);
  1913. args: ["anIndex", "aBlock"],
  1914. 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 ]",
  1915. referencedClasses: [],
  1916. //>>excludeEnd("ide");
  1917. messageSends: ["at:ifPresent:ifAbsent:"]
  1918. }),
  1919. $globals.IndexableCollection);
  1920. $core.addMethod(
  1921. $core.method({
  1922. selector: "at:ifPresent:ifAbsent:",
  1923. protocol: "accessing",
  1924. fn: function (anIndex,aBlock,anotherBlock){
  1925. var self=this,$self=this;
  1926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1927. return $core.withContext(function($ctx1) {
  1928. //>>excludeEnd("ctx");
  1929. $self._subclassResponsibility();
  1930. return self;
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1933. //>>excludeEnd("ctx");
  1934. },
  1935. //>>excludeStart("ide", pragmas.excludeIdeData);
  1936. args: ["anIndex", "aBlock", "anotherBlock"],
  1937. 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",
  1938. referencedClasses: [],
  1939. //>>excludeEnd("ide");
  1940. messageSends: ["subclassResponsibility"]
  1941. }),
  1942. $globals.IndexableCollection);
  1943. $core.addMethod(
  1944. $core.method({
  1945. selector: "at:put:",
  1946. protocol: "accessing",
  1947. fn: function (anIndex,anObject){
  1948. var self=this,$self=this;
  1949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1950. return $core.withContext(function($ctx1) {
  1951. //>>excludeEnd("ctx");
  1952. $self._subclassResponsibility();
  1953. return self;
  1954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1955. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1956. //>>excludeEnd("ctx");
  1957. },
  1958. //>>excludeStart("ide", pragmas.excludeIdeData);
  1959. args: ["anIndex", "anObject"],
  1960. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1961. referencedClasses: [],
  1962. //>>excludeEnd("ide");
  1963. messageSends: ["subclassResponsibility"]
  1964. }),
  1965. $globals.IndexableCollection);
  1966. $core.addMethod(
  1967. $core.method({
  1968. selector: "indexOf:",
  1969. protocol: "accessing",
  1970. fn: function (anObject){
  1971. var self=this,$self=this;
  1972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1973. return $core.withContext(function($ctx1) {
  1974. //>>excludeEnd("ctx");
  1975. return $self._indexOf_ifAbsent_(anObject,(function(){
  1976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1977. return $core.withContext(function($ctx2) {
  1978. //>>excludeEnd("ctx");
  1979. return $self._errorNotFound();
  1980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1981. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1982. //>>excludeEnd("ctx");
  1983. }));
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1986. //>>excludeEnd("ctx");
  1987. },
  1988. //>>excludeStart("ide", pragmas.excludeIdeData);
  1989. args: ["anObject"],
  1990. 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 ]",
  1991. referencedClasses: [],
  1992. //>>excludeEnd("ide");
  1993. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1994. }),
  1995. $globals.IndexableCollection);
  1996. $core.addMethod(
  1997. $core.method({
  1998. selector: "indexOf:ifAbsent:",
  1999. protocol: "accessing",
  2000. fn: function (anObject,aBlock){
  2001. var self=this,$self=this;
  2002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2003. return $core.withContext(function($ctx1) {
  2004. //>>excludeEnd("ctx");
  2005. $self._subclassResponsibility();
  2006. return self;
  2007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2008. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  2009. //>>excludeEnd("ctx");
  2010. },
  2011. //>>excludeStart("ide", pragmas.excludeIdeData);
  2012. args: ["anObject", "aBlock"],
  2013. 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",
  2014. referencedClasses: [],
  2015. //>>excludeEnd("ide");
  2016. messageSends: ["subclassResponsibility"]
  2017. }),
  2018. $globals.IndexableCollection);
  2019. $core.addMethod(
  2020. $core.method({
  2021. selector: "with:do:",
  2022. protocol: "enumerating",
  2023. fn: function (anotherCollection,aBlock){
  2024. var self=this,$self=this;
  2025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2026. return $core.withContext(function($ctx1) {
  2027. //>>excludeEnd("ctx");
  2028. $self._withIndexDo_((function(each,index){
  2029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2030. return $core.withContext(function($ctx2) {
  2031. //>>excludeEnd("ctx");
  2032. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  2035. //>>excludeEnd("ctx");
  2036. }));
  2037. return self;
  2038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2039. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  2040. //>>excludeEnd("ctx");
  2041. },
  2042. //>>excludeStart("ide", pragmas.excludeIdeData);
  2043. args: ["anotherCollection", "aBlock"],
  2044. 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) ]",
  2045. referencedClasses: [],
  2046. //>>excludeEnd("ide");
  2047. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2048. }),
  2049. $globals.IndexableCollection);
  2050. $core.addMethod(
  2051. $core.method({
  2052. selector: "withIndexDo:",
  2053. protocol: "enumerating",
  2054. fn: function (aBlock){
  2055. var self=this,$self=this;
  2056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2057. return $core.withContext(function($ctx1) {
  2058. //>>excludeEnd("ctx");
  2059. $self._subclassResponsibility();
  2060. return self;
  2061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2062. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  2063. //>>excludeEnd("ctx");
  2064. },
  2065. //>>excludeStart("ide", pragmas.excludeIdeData);
  2066. args: ["aBlock"],
  2067. 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",
  2068. referencedClasses: [],
  2069. //>>excludeEnd("ide");
  2070. messageSends: ["subclassResponsibility"]
  2071. }),
  2072. $globals.IndexableCollection);
  2073. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  2074. //>>excludeStart("ide", pragmas.excludeIdeData);
  2075. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2076. //>>excludeEnd("ide");
  2077. $core.addMethod(
  2078. $core.method({
  2079. selector: "=",
  2080. protocol: "comparing",
  2081. fn: function (anAssocitativeCollection){
  2082. var self=this,$self=this;
  2083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2084. return $core.withContext(function($ctx1) {
  2085. //>>excludeEnd("ctx");
  2086. var $2,$1,$4,$3,$5;
  2087. $2=$self._class();
  2088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2089. $ctx1.sendIdx["class"]=1;
  2090. //>>excludeEnd("ctx");
  2091. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2093. $ctx1.sendIdx["="]=1;
  2094. //>>excludeEnd("ctx");
  2095. if(!$core.assert($1)){
  2096. return false;
  2097. }
  2098. $4=$self._size();
  2099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2100. $ctx1.sendIdx["size"]=1;
  2101. //>>excludeEnd("ctx");
  2102. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2104. $ctx1.sendIdx["="]=2;
  2105. //>>excludeEnd("ctx");
  2106. if(!$core.assert($3)){
  2107. return false;
  2108. }
  2109. $5=$self._associations();
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. $ctx1.sendIdx["associations"]=1;
  2112. //>>excludeEnd("ctx");
  2113. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2115. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2116. //>>excludeEnd("ctx");
  2117. },
  2118. //>>excludeStart("ide", pragmas.excludeIdeData);
  2119. args: ["anAssocitativeCollection"],
  2120. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2121. referencedClasses: [],
  2122. //>>excludeEnd("ide");
  2123. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2124. }),
  2125. $globals.AssociativeCollection);
  2126. $core.addMethod(
  2127. $core.method({
  2128. selector: "add:",
  2129. protocol: "adding/removing",
  2130. fn: function (anAssociation){
  2131. var self=this,$self=this;
  2132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2133. return $core.withContext(function($ctx1) {
  2134. //>>excludeEnd("ctx");
  2135. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2136. return self;
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2139. //>>excludeEnd("ctx");
  2140. },
  2141. //>>excludeStart("ide", pragmas.excludeIdeData);
  2142. args: ["anAssociation"],
  2143. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2144. referencedClasses: [],
  2145. //>>excludeEnd("ide");
  2146. messageSends: ["at:put:", "key", "value"]
  2147. }),
  2148. $globals.AssociativeCollection);
  2149. $core.addMethod(
  2150. $core.method({
  2151. selector: "addAll:",
  2152. protocol: "adding/removing",
  2153. fn: function (anAssociativeCollection){
  2154. var self=this,$self=this;
  2155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2156. return $core.withContext(function($ctx1) {
  2157. //>>excludeEnd("ctx");
  2158. (
  2159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2160. $ctx1.supercall = true,
  2161. //>>excludeEnd("ctx");
  2162. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  2163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2164. $ctx1.supercall = false;
  2165. //>>excludeEnd("ctx");;
  2166. return anAssociativeCollection;
  2167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2168. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2169. //>>excludeEnd("ctx");
  2170. },
  2171. //>>excludeStart("ide", pragmas.excludeIdeData);
  2172. args: ["anAssociativeCollection"],
  2173. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2174. referencedClasses: [],
  2175. //>>excludeEnd("ide");
  2176. messageSends: ["addAll:", "associations"]
  2177. }),
  2178. $globals.AssociativeCollection);
  2179. $core.addMethod(
  2180. $core.method({
  2181. selector: "asDictionary",
  2182. protocol: "converting",
  2183. fn: function (){
  2184. var self=this,$self=this;
  2185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2186. return $core.withContext(function($ctx1) {
  2187. //>>excludeEnd("ctx");
  2188. return $recv($globals.Dictionary)._from_($self._associations());
  2189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2190. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2191. //>>excludeEnd("ctx");
  2192. },
  2193. //>>excludeStart("ide", pragmas.excludeIdeData);
  2194. args: [],
  2195. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2196. referencedClasses: ["Dictionary"],
  2197. //>>excludeEnd("ide");
  2198. messageSends: ["from:", "associations"]
  2199. }),
  2200. $globals.AssociativeCollection);
  2201. $core.addMethod(
  2202. $core.method({
  2203. selector: "asHashedCollection",
  2204. protocol: "converting",
  2205. fn: function (){
  2206. var self=this,$self=this;
  2207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2208. return $core.withContext(function($ctx1) {
  2209. //>>excludeEnd("ctx");
  2210. return $recv($globals.HashedCollection)._from_($self._associations());
  2211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2212. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2213. //>>excludeEnd("ctx");
  2214. },
  2215. //>>excludeStart("ide", pragmas.excludeIdeData);
  2216. args: [],
  2217. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2218. referencedClasses: ["HashedCollection"],
  2219. //>>excludeEnd("ide");
  2220. messageSends: ["from:", "associations"]
  2221. }),
  2222. $globals.AssociativeCollection);
  2223. $core.addMethod(
  2224. $core.method({
  2225. selector: "asJavaScriptObject",
  2226. protocol: "converting",
  2227. fn: function (){
  2228. var self=this,$self=this;
  2229. var hash;
  2230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2231. return $core.withContext(function($ctx1) {
  2232. //>>excludeEnd("ctx");
  2233. hash=$recv($globals.HashedCollection)._new();
  2234. $self._keysAndValuesDo_((function(key,value){
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. return $core.withContext(function($ctx2) {
  2237. //>>excludeEnd("ctx");
  2238. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  2239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2240. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2241. //>>excludeEnd("ctx");
  2242. }));
  2243. return hash;
  2244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2245. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  2246. //>>excludeEnd("ctx");
  2247. },
  2248. //>>excludeStart("ide", pragmas.excludeIdeData);
  2249. args: [],
  2250. 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",
  2251. referencedClasses: ["HashedCollection"],
  2252. //>>excludeEnd("ide");
  2253. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  2254. }),
  2255. $globals.AssociativeCollection);
  2256. $core.addMethod(
  2257. $core.method({
  2258. selector: "associations",
  2259. protocol: "accessing",
  2260. fn: function (){
  2261. var self=this,$self=this;
  2262. var associations;
  2263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2264. return $core.withContext(function($ctx1) {
  2265. //>>excludeEnd("ctx");
  2266. associations=[];
  2267. $self._associationsDo_((function(each){
  2268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2269. return $core.withContext(function($ctx2) {
  2270. //>>excludeEnd("ctx");
  2271. return $recv(associations)._add_(each);
  2272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2273. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2274. //>>excludeEnd("ctx");
  2275. }));
  2276. return associations;
  2277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2278. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2279. //>>excludeEnd("ctx");
  2280. },
  2281. //>>excludeStart("ide", pragmas.excludeIdeData);
  2282. args: [],
  2283. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2284. referencedClasses: [],
  2285. //>>excludeEnd("ide");
  2286. messageSends: ["associationsDo:", "add:"]
  2287. }),
  2288. $globals.AssociativeCollection);
  2289. $core.addMethod(
  2290. $core.method({
  2291. selector: "associationsDo:",
  2292. protocol: "enumerating",
  2293. fn: function (aBlock){
  2294. var self=this,$self=this;
  2295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2296. return $core.withContext(function($ctx1) {
  2297. //>>excludeEnd("ctx");
  2298. $self._keysAndValuesDo_((function(key,value){
  2299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2300. return $core.withContext(function($ctx2) {
  2301. //>>excludeEnd("ctx");
  2302. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2304. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2305. //>>excludeEnd("ctx");
  2306. }));
  2307. return self;
  2308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2309. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2310. //>>excludeEnd("ctx");
  2311. },
  2312. //>>excludeStart("ide", pragmas.excludeIdeData);
  2313. args: ["aBlock"],
  2314. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2315. referencedClasses: ["Association"],
  2316. //>>excludeEnd("ide");
  2317. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2318. }),
  2319. $globals.AssociativeCollection);
  2320. $core.addMethod(
  2321. $core.method({
  2322. selector: "at:ifPresent:ifAbsent:",
  2323. protocol: "accessing",
  2324. fn: function (aKey,aBlock,anotherBlock){
  2325. var self=this,$self=this;
  2326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2327. return $core.withContext(function($ctx1) {
  2328. //>>excludeEnd("ctx");
  2329. var $1;
  2330. $1=$self._includesKey_(aKey);
  2331. if($core.assert($1)){
  2332. return $recv(aBlock)._value_($self._at_(aKey));
  2333. } else {
  2334. return $recv(anotherBlock)._value();
  2335. }
  2336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2337. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2338. //>>excludeEnd("ctx");
  2339. },
  2340. //>>excludeStart("ide", pragmas.excludeIdeData);
  2341. args: ["aKey", "aBlock", "anotherBlock"],
  2342. 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 ]",
  2343. referencedClasses: [],
  2344. //>>excludeEnd("ide");
  2345. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2346. }),
  2347. $globals.AssociativeCollection);
  2348. $core.addMethod(
  2349. $core.method({
  2350. selector: "collect:",
  2351. protocol: "enumerating",
  2352. fn: function (aBlock){
  2353. var self=this,$self=this;
  2354. var newDict;
  2355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2356. return $core.withContext(function($ctx1) {
  2357. //>>excludeEnd("ctx");
  2358. newDict=$recv($self._class())._new();
  2359. $self._keysAndValuesDo_((function(key,value){
  2360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2361. return $core.withContext(function($ctx2) {
  2362. //>>excludeEnd("ctx");
  2363. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2366. //>>excludeEnd("ctx");
  2367. }));
  2368. return newDict;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2371. //>>excludeEnd("ctx");
  2372. },
  2373. //>>excludeStart("ide", pragmas.excludeIdeData);
  2374. args: ["aBlock"],
  2375. 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",
  2376. referencedClasses: [],
  2377. //>>excludeEnd("ide");
  2378. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2379. }),
  2380. $globals.AssociativeCollection);
  2381. $core.addMethod(
  2382. $core.method({
  2383. selector: "deepCopy",
  2384. protocol: "copying",
  2385. fn: function (){
  2386. var self=this,$self=this;
  2387. var copy;
  2388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2389. return $core.withContext(function($ctx1) {
  2390. //>>excludeEnd("ctx");
  2391. copy=$recv($self._class())._new();
  2392. $self._keysAndValuesDo_((function(key,value){
  2393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2394. return $core.withContext(function($ctx2) {
  2395. //>>excludeEnd("ctx");
  2396. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2398. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2399. //>>excludeEnd("ctx");
  2400. }));
  2401. return copy;
  2402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2403. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2404. //>>excludeEnd("ctx");
  2405. },
  2406. //>>excludeStart("ide", pragmas.excludeIdeData);
  2407. args: [],
  2408. 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",
  2409. referencedClasses: [],
  2410. //>>excludeEnd("ide");
  2411. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2412. }),
  2413. $globals.AssociativeCollection);
  2414. $core.addMethod(
  2415. $core.method({
  2416. selector: "detect:ifNone:",
  2417. protocol: "enumerating",
  2418. fn: function (aBlock,anotherBlock){
  2419. var self=this,$self=this;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. return $core.withContext(function($ctx1) {
  2422. //>>excludeEnd("ctx");
  2423. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2426. //>>excludeEnd("ctx");
  2427. },
  2428. //>>excludeStart("ide", pragmas.excludeIdeData);
  2429. args: ["aBlock", "anotherBlock"],
  2430. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2431. referencedClasses: [],
  2432. //>>excludeEnd("ide");
  2433. messageSends: ["detect:ifNone:", "values"]
  2434. }),
  2435. $globals.AssociativeCollection);
  2436. $core.addMethod(
  2437. $core.method({
  2438. selector: "do:",
  2439. protocol: "enumerating",
  2440. fn: function (aBlock){
  2441. var self=this,$self=this;
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. return $core.withContext(function($ctx1) {
  2444. //>>excludeEnd("ctx");
  2445. $self._valuesDo_(aBlock);
  2446. return self;
  2447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2448. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2449. //>>excludeEnd("ctx");
  2450. },
  2451. //>>excludeStart("ide", pragmas.excludeIdeData);
  2452. args: ["aBlock"],
  2453. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2454. referencedClasses: [],
  2455. //>>excludeEnd("ide");
  2456. messageSends: ["valuesDo:"]
  2457. }),
  2458. $globals.AssociativeCollection);
  2459. $core.addMethod(
  2460. $core.method({
  2461. selector: "includes:",
  2462. protocol: "enumerating",
  2463. fn: function (anObject){
  2464. var self=this,$self=this;
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. return $core.withContext(function($ctx1) {
  2467. //>>excludeEnd("ctx");
  2468. return $recv($self._values())._includes_(anObject);
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2471. //>>excludeEnd("ctx");
  2472. },
  2473. //>>excludeStart("ide", pragmas.excludeIdeData);
  2474. args: ["anObject"],
  2475. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2476. referencedClasses: [],
  2477. //>>excludeEnd("ide");
  2478. messageSends: ["includes:", "values"]
  2479. }),
  2480. $globals.AssociativeCollection);
  2481. $core.addMethod(
  2482. $core.method({
  2483. selector: "includesKey:",
  2484. protocol: "testing",
  2485. fn: function (aKey){
  2486. var self=this,$self=this;
  2487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2488. return $core.withContext(function($ctx1) {
  2489. //>>excludeEnd("ctx");
  2490. $self._subclassResponsibility();
  2491. return self;
  2492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2493. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2494. //>>excludeEnd("ctx");
  2495. },
  2496. //>>excludeStart("ide", pragmas.excludeIdeData);
  2497. args: ["aKey"],
  2498. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2499. referencedClasses: [],
  2500. //>>excludeEnd("ide");
  2501. messageSends: ["subclassResponsibility"]
  2502. }),
  2503. $globals.AssociativeCollection);
  2504. $core.addMethod(
  2505. $core.method({
  2506. selector: "indexOf:ifAbsent:",
  2507. protocol: "accessing",
  2508. fn: function (anObject,aBlock){
  2509. var self=this,$self=this;
  2510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2511. return $core.withContext(function($ctx1) {
  2512. //>>excludeEnd("ctx");
  2513. return $recv($self._keys())._detect_ifNone_((function(each){
  2514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2515. return $core.withContext(function($ctx2) {
  2516. //>>excludeEnd("ctx");
  2517. return $recv($self._at_(each)).__eq(anObject);
  2518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2520. //>>excludeEnd("ctx");
  2521. }),aBlock);
  2522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2523. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2524. //>>excludeEnd("ctx");
  2525. },
  2526. //>>excludeStart("ide", pragmas.excludeIdeData);
  2527. args: ["anObject", "aBlock"],
  2528. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2529. referencedClasses: [],
  2530. //>>excludeEnd("ide");
  2531. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2532. }),
  2533. $globals.AssociativeCollection);
  2534. $core.addMethod(
  2535. $core.method({
  2536. selector: "keyAtValue:",
  2537. protocol: "accessing",
  2538. fn: function (anObject){
  2539. var self=this,$self=this;
  2540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2541. return $core.withContext(function($ctx1) {
  2542. //>>excludeEnd("ctx");
  2543. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2545. return $core.withContext(function($ctx2) {
  2546. //>>excludeEnd("ctx");
  2547. return $self._errorNotFound();
  2548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2549. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2550. //>>excludeEnd("ctx");
  2551. }));
  2552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2553. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2554. //>>excludeEnd("ctx");
  2555. },
  2556. //>>excludeStart("ide", pragmas.excludeIdeData);
  2557. args: ["anObject"],
  2558. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2559. referencedClasses: [],
  2560. //>>excludeEnd("ide");
  2561. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2562. }),
  2563. $globals.AssociativeCollection);
  2564. $core.addMethod(
  2565. $core.method({
  2566. selector: "keyAtValue:ifAbsent:",
  2567. protocol: "accessing",
  2568. fn: function (anObject,aBlock){
  2569. var self=this,$self=this;
  2570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2571. return $core.withContext(function($ctx1) {
  2572. //>>excludeEnd("ctx");
  2573. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2575. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2576. //>>excludeEnd("ctx");
  2577. },
  2578. //>>excludeStart("ide", pragmas.excludeIdeData);
  2579. args: ["anObject", "aBlock"],
  2580. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2581. referencedClasses: [],
  2582. //>>excludeEnd("ide");
  2583. messageSends: ["indexOf:ifAbsent:"]
  2584. }),
  2585. $globals.AssociativeCollection);
  2586. $core.addMethod(
  2587. $core.method({
  2588. selector: "keys",
  2589. protocol: "accessing",
  2590. fn: function (){
  2591. var self=this,$self=this;
  2592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2593. return $core.withContext(function($ctx1) {
  2594. //>>excludeEnd("ctx");
  2595. $self._subclassResponsibility();
  2596. return self;
  2597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2598. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2599. //>>excludeEnd("ctx");
  2600. },
  2601. //>>excludeStart("ide", pragmas.excludeIdeData);
  2602. args: [],
  2603. source: "keys\x0a\x09self subclassResponsibility",
  2604. referencedClasses: [],
  2605. //>>excludeEnd("ide");
  2606. messageSends: ["subclassResponsibility"]
  2607. }),
  2608. $globals.AssociativeCollection);
  2609. $core.addMethod(
  2610. $core.method({
  2611. selector: "keysAndValuesDo:",
  2612. protocol: "enumerating",
  2613. fn: function (aBlock){
  2614. var self=this,$self=this;
  2615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2616. return $core.withContext(function($ctx1) {
  2617. //>>excludeEnd("ctx");
  2618. $self._keysDo_((function(each){
  2619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2620. return $core.withContext(function($ctx2) {
  2621. //>>excludeEnd("ctx");
  2622. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2625. //>>excludeEnd("ctx");
  2626. }));
  2627. return self;
  2628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2629. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2630. //>>excludeEnd("ctx");
  2631. },
  2632. //>>excludeStart("ide", pragmas.excludeIdeData);
  2633. args: ["aBlock"],
  2634. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2635. referencedClasses: [],
  2636. //>>excludeEnd("ide");
  2637. messageSends: ["keysDo:", "value:value:", "at:"]
  2638. }),
  2639. $globals.AssociativeCollection);
  2640. $core.addMethod(
  2641. $core.method({
  2642. selector: "keysDo:",
  2643. protocol: "enumerating",
  2644. fn: function (aBlock){
  2645. var self=this,$self=this;
  2646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2647. return $core.withContext(function($ctx1) {
  2648. //>>excludeEnd("ctx");
  2649. $self._subclassResponsibility();
  2650. return self;
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2653. //>>excludeEnd("ctx");
  2654. },
  2655. //>>excludeStart("ide", pragmas.excludeIdeData);
  2656. args: ["aBlock"],
  2657. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2658. referencedClasses: [],
  2659. //>>excludeEnd("ide");
  2660. messageSends: ["subclassResponsibility"]
  2661. }),
  2662. $globals.AssociativeCollection);
  2663. $core.addMethod(
  2664. $core.method({
  2665. selector: "printOn:",
  2666. protocol: "printing",
  2667. fn: function (aStream){
  2668. var self=this,$self=this;
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. return $core.withContext(function($ctx1) {
  2671. //>>excludeEnd("ctx");
  2672. (
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. $ctx1.supercall = true,
  2675. //>>excludeEnd("ctx");
  2676. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. $ctx1.supercall = false;
  2679. //>>excludeEnd("ctx");;
  2680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2681. $ctx1.sendIdx["printOn:"]=1;
  2682. //>>excludeEnd("ctx");
  2683. $recv(aStream)._nextPutAll_(" (");
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. $ctx1.sendIdx["nextPutAll:"]=1;
  2686. //>>excludeEnd("ctx");
  2687. $recv($self._associations())._do_separatedBy_((function(each){
  2688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2689. return $core.withContext(function($ctx2) {
  2690. //>>excludeEnd("ctx");
  2691. return $recv(each)._printOn_(aStream);
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2694. //>>excludeEnd("ctx");
  2695. }),(function(){
  2696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2697. return $core.withContext(function($ctx2) {
  2698. //>>excludeEnd("ctx");
  2699. return $recv(aStream)._nextPutAll_(" , ");
  2700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2701. $ctx2.sendIdx["nextPutAll:"]=2;
  2702. //>>excludeEnd("ctx");
  2703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2705. //>>excludeEnd("ctx");
  2706. }));
  2707. $recv(aStream)._nextPutAll_(")");
  2708. return self;
  2709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2710. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2711. //>>excludeEnd("ctx");
  2712. },
  2713. //>>excludeStart("ide", pragmas.excludeIdeData);
  2714. args: ["aStream"],
  2715. 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: ')'",
  2716. referencedClasses: [],
  2717. //>>excludeEnd("ide");
  2718. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2719. }),
  2720. $globals.AssociativeCollection);
  2721. $core.addMethod(
  2722. $core.method({
  2723. selector: "remove:ifAbsent:",
  2724. protocol: "adding/removing",
  2725. fn: function (aKey,aBlock){
  2726. var self=this,$self=this;
  2727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2728. return $core.withContext(function($ctx1) {
  2729. //>>excludeEnd("ctx");
  2730. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2732. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2733. //>>excludeEnd("ctx");
  2734. },
  2735. //>>excludeStart("ide", pragmas.excludeIdeData);
  2736. args: ["aKey", "aBlock"],
  2737. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2738. referencedClasses: [],
  2739. //>>excludeEnd("ide");
  2740. messageSends: ["removeKey:ifAbsent:"]
  2741. }),
  2742. $globals.AssociativeCollection);
  2743. $core.addMethod(
  2744. $core.method({
  2745. selector: "removeAll",
  2746. protocol: "adding/removing",
  2747. fn: function (){
  2748. var self=this,$self=this;
  2749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2750. return $core.withContext(function($ctx1) {
  2751. //>>excludeEnd("ctx");
  2752. return $recv($self._keys())._do_((function(each){
  2753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2754. return $core.withContext(function($ctx2) {
  2755. //>>excludeEnd("ctx");
  2756. return $self._removeKey_(each);
  2757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2759. //>>excludeEnd("ctx");
  2760. }));
  2761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2762. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2763. //>>excludeEnd("ctx");
  2764. },
  2765. //>>excludeStart("ide", pragmas.excludeIdeData);
  2766. args: [],
  2767. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2768. referencedClasses: [],
  2769. //>>excludeEnd("ide");
  2770. messageSends: ["do:", "keys", "removeKey:"]
  2771. }),
  2772. $globals.AssociativeCollection);
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "removeKey:",
  2776. protocol: "adding/removing",
  2777. fn: function (aKey){
  2778. var self=this,$self=this;
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx1) {
  2781. //>>excludeEnd("ctx");
  2782. return $self._remove_(aKey);
  2783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2784. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2785. //>>excludeEnd("ctx");
  2786. },
  2787. //>>excludeStart("ide", pragmas.excludeIdeData);
  2788. args: ["aKey"],
  2789. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2790. referencedClasses: [],
  2791. //>>excludeEnd("ide");
  2792. messageSends: ["remove:"]
  2793. }),
  2794. $globals.AssociativeCollection);
  2795. $core.addMethod(
  2796. $core.method({
  2797. selector: "removeKey:ifAbsent:",
  2798. protocol: "adding/removing",
  2799. fn: function (aKey,aBlock){
  2800. var self=this,$self=this;
  2801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2802. return $core.withContext(function($ctx1) {
  2803. //>>excludeEnd("ctx");
  2804. $self._subclassResponsibility();
  2805. return self;
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2808. //>>excludeEnd("ctx");
  2809. },
  2810. //>>excludeStart("ide", pragmas.excludeIdeData);
  2811. args: ["aKey", "aBlock"],
  2812. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2813. referencedClasses: [],
  2814. //>>excludeEnd("ide");
  2815. messageSends: ["subclassResponsibility"]
  2816. }),
  2817. $globals.AssociativeCollection);
  2818. $core.addMethod(
  2819. $core.method({
  2820. selector: "select:",
  2821. protocol: "enumerating",
  2822. fn: function (aBlock){
  2823. var self=this,$self=this;
  2824. var newDict;
  2825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2826. return $core.withContext(function($ctx1) {
  2827. //>>excludeEnd("ctx");
  2828. var $1;
  2829. newDict=$recv($self._class())._new();
  2830. $self._keysAndValuesDo_((function(key,value){
  2831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2832. return $core.withContext(function($ctx2) {
  2833. //>>excludeEnd("ctx");
  2834. $1=$recv(aBlock)._value_(value);
  2835. if($core.assert($1)){
  2836. return $recv(newDict)._at_put_(key,value);
  2837. }
  2838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2839. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2840. //>>excludeEnd("ctx");
  2841. }));
  2842. return newDict;
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2845. //>>excludeEnd("ctx");
  2846. },
  2847. //>>excludeStart("ide", pragmas.excludeIdeData);
  2848. args: ["aBlock"],
  2849. 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",
  2850. referencedClasses: [],
  2851. //>>excludeEnd("ide");
  2852. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2853. }),
  2854. $globals.AssociativeCollection);
  2855. $core.addMethod(
  2856. $core.method({
  2857. selector: "select:thenCollect:",
  2858. protocol: "enumerating",
  2859. fn: function (selectBlock,collectBlock){
  2860. var self=this,$self=this;
  2861. var newDict;
  2862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2863. return $core.withContext(function($ctx1) {
  2864. //>>excludeEnd("ctx");
  2865. var $1;
  2866. newDict=$recv($self._class())._new();
  2867. $self._keysAndValuesDo_((function(key,value){
  2868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2869. return $core.withContext(function($ctx2) {
  2870. //>>excludeEnd("ctx");
  2871. $1=$recv(selectBlock)._value_(value);
  2872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2873. $ctx2.sendIdx["value:"]=1;
  2874. //>>excludeEnd("ctx");
  2875. if($core.assert($1)){
  2876. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2877. }
  2878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2879. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2880. //>>excludeEnd("ctx");
  2881. }));
  2882. return newDict;
  2883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2884. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  2885. //>>excludeEnd("ctx");
  2886. },
  2887. //>>excludeStart("ide", pragmas.excludeIdeData);
  2888. args: ["selectBlock", "collectBlock"],
  2889. 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",
  2890. referencedClasses: [],
  2891. //>>excludeEnd("ide");
  2892. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2893. }),
  2894. $globals.AssociativeCollection);
  2895. $core.addMethod(
  2896. $core.method({
  2897. selector: "shallowCopy",
  2898. protocol: "copying",
  2899. fn: function (){
  2900. var self=this,$self=this;
  2901. var copy;
  2902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2903. return $core.withContext(function($ctx1) {
  2904. //>>excludeEnd("ctx");
  2905. copy=$recv($self._class())._new();
  2906. $self._keysAndValuesDo_((function(key,value){
  2907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2908. return $core.withContext(function($ctx2) {
  2909. //>>excludeEnd("ctx");
  2910. return $recv(copy)._at_put_(key,value);
  2911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2912. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2913. //>>excludeEnd("ctx");
  2914. }));
  2915. return copy;
  2916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2917. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2918. //>>excludeEnd("ctx");
  2919. },
  2920. //>>excludeStart("ide", pragmas.excludeIdeData);
  2921. args: [],
  2922. 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",
  2923. referencedClasses: [],
  2924. //>>excludeEnd("ide");
  2925. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2926. }),
  2927. $globals.AssociativeCollection);
  2928. $core.addMethod(
  2929. $core.method({
  2930. selector: "size",
  2931. protocol: "accessing",
  2932. fn: function (){
  2933. var self=this,$self=this;
  2934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2935. return $core.withContext(function($ctx1) {
  2936. //>>excludeEnd("ctx");
  2937. return $recv($self._keys())._size();
  2938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2939. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2940. //>>excludeEnd("ctx");
  2941. },
  2942. //>>excludeStart("ide", pragmas.excludeIdeData);
  2943. args: [],
  2944. source: "size\x0a\x09^ self keys size",
  2945. referencedClasses: [],
  2946. //>>excludeEnd("ide");
  2947. messageSends: ["size", "keys"]
  2948. }),
  2949. $globals.AssociativeCollection);
  2950. $core.addMethod(
  2951. $core.method({
  2952. selector: "values",
  2953. protocol: "accessing",
  2954. fn: function (){
  2955. var self=this,$self=this;
  2956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2957. return $core.withContext(function($ctx1) {
  2958. //>>excludeEnd("ctx");
  2959. $self._subclassResponsibility();
  2960. return self;
  2961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2962. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2963. //>>excludeEnd("ctx");
  2964. },
  2965. //>>excludeStart("ide", pragmas.excludeIdeData);
  2966. args: [],
  2967. source: "values\x0a\x09self subclassResponsibility",
  2968. referencedClasses: [],
  2969. //>>excludeEnd("ide");
  2970. messageSends: ["subclassResponsibility"]
  2971. }),
  2972. $globals.AssociativeCollection);
  2973. $core.addMethod(
  2974. $core.method({
  2975. selector: "valuesDo:",
  2976. protocol: "enumerating",
  2977. fn: function (aBlock){
  2978. var self=this,$self=this;
  2979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2980. return $core.withContext(function($ctx1) {
  2981. //>>excludeEnd("ctx");
  2982. $self._subclassResponsibility();
  2983. return self;
  2984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2985. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2986. //>>excludeEnd("ctx");
  2987. },
  2988. //>>excludeStart("ide", pragmas.excludeIdeData);
  2989. args: ["aBlock"],
  2990. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2991. referencedClasses: [],
  2992. //>>excludeEnd("ide");
  2993. messageSends: ["subclassResponsibility"]
  2994. }),
  2995. $globals.AssociativeCollection);
  2996. $core.addMethod(
  2997. $core.method({
  2998. selector: "withIndexDo:",
  2999. protocol: "enumerating",
  3000. fn: function (aBlock){
  3001. var self=this,$self=this;
  3002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3003. return $core.withContext(function($ctx1) {
  3004. //>>excludeEnd("ctx");
  3005. $self._keysAndValuesDo_((function(key,value){
  3006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3007. return $core.withContext(function($ctx2) {
  3008. //>>excludeEnd("ctx");
  3009. return $recv(aBlock)._value_value_(value,key);
  3010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3011. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  3012. //>>excludeEnd("ctx");
  3013. }));
  3014. return self;
  3015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3016. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  3017. //>>excludeEnd("ctx");
  3018. },
  3019. //>>excludeStart("ide", pragmas.excludeIdeData);
  3020. args: ["aBlock"],
  3021. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  3022. referencedClasses: [],
  3023. //>>excludeEnd("ide");
  3024. messageSends: ["keysAndValuesDo:", "value:value:"]
  3025. }),
  3026. $globals.AssociativeCollection);
  3027. $core.addMethod(
  3028. $core.method({
  3029. selector: "from:",
  3030. protocol: "instance creation",
  3031. fn: function (aCollection){
  3032. var self=this,$self=this;
  3033. var newCollection;
  3034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3035. return $core.withContext(function($ctx1) {
  3036. //>>excludeEnd("ctx");
  3037. newCollection=$self._new();
  3038. $recv(aCollection)._do_((function(each){
  3039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3040. return $core.withContext(function($ctx2) {
  3041. //>>excludeEnd("ctx");
  3042. return $recv(newCollection)._add_(each);
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3045. //>>excludeEnd("ctx");
  3046. }));
  3047. return newCollection;
  3048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3049. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3050. //>>excludeEnd("ctx");
  3051. },
  3052. //>>excludeStart("ide", pragmas.excludeIdeData);
  3053. args: ["aCollection"],
  3054. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  3055. referencedClasses: [],
  3056. //>>excludeEnd("ide");
  3057. messageSends: ["new", "do:", "add:"]
  3058. }),
  3059. $globals.AssociativeCollection.a$cls);
  3060. $core.addMethod(
  3061. $core.method({
  3062. selector: "fromPairs:",
  3063. protocol: "instance creation",
  3064. fn: function (aCollection){
  3065. var self=this,$self=this;
  3066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3067. return $core.withContext(function($ctx1) {
  3068. //>>excludeEnd("ctx");
  3069. return $self._from_(aCollection);
  3070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3071. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  3072. //>>excludeEnd("ctx");
  3073. },
  3074. //>>excludeStart("ide", pragmas.excludeIdeData);
  3075. args: ["aCollection"],
  3076. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  3077. referencedClasses: [],
  3078. //>>excludeEnd("ide");
  3079. messageSends: ["from:"]
  3080. }),
  3081. $globals.AssociativeCollection.a$cls);
  3082. $core.addMethod(
  3083. $core.method({
  3084. selector: "newFromPairs:",
  3085. protocol: "instance creation",
  3086. fn: function (aCollection){
  3087. var self=this,$self=this;
  3088. var newCollection;
  3089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3090. return $core.withContext(function($ctx1) {
  3091. //>>excludeEnd("ctx");
  3092. var $2,$1,$3,$4;
  3093. $2=$recv(aCollection)._size();
  3094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3095. $ctx1.sendIdx["size"]=1;
  3096. //>>excludeEnd("ctx");
  3097. $1=$recv($2)._even();
  3098. if(!$core.assert($1)){
  3099. $self._error_("#newFromPairs only accepts arrays of an even length");
  3100. }
  3101. newCollection=$self._new();
  3102. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  3103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3104. return $core.withContext(function($ctx2) {
  3105. //>>excludeEnd("ctx");
  3106. $3=newCollection;
  3107. $4=$recv(aCollection)._at_(each);
  3108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3109. $ctx2.sendIdx["at:"]=1;
  3110. //>>excludeEnd("ctx");
  3111. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  3112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3113. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3114. //>>excludeEnd("ctx");
  3115. }));
  3116. return newCollection;
  3117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3118. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  3119. //>>excludeEnd("ctx");
  3120. },
  3121. //>>excludeStart("ide", pragmas.excludeIdeData);
  3122. args: ["aCollection"],
  3123. 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",
  3124. referencedClasses: [],
  3125. //>>excludeEnd("ide");
  3126. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3127. }),
  3128. $globals.AssociativeCollection.a$cls);
  3129. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  3130. //>>excludeStart("ide", pragmas.excludeIdeData);
  3131. $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.";
  3132. //>>excludeEnd("ide");
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "at:ifAbsent:",
  3136. protocol: "accessing",
  3137. fn: function (aKey,aBlock){
  3138. var self=this,$self=this;
  3139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3140. return $core.withContext(function($ctx1) {
  3141. //>>excludeEnd("ctx");
  3142. var index = $self._positionOfKey_(aKey);
  3143. return index >=0 ? $self['@values'][index] : aBlock._value();
  3144. ;
  3145. return self;
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3148. //>>excludeEnd("ctx");
  3149. },
  3150. //>>excludeStart("ide", pragmas.excludeIdeData);
  3151. args: ["aKey", "aBlock"],
  3152. 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'>",
  3153. referencedClasses: [],
  3154. //>>excludeEnd("ide");
  3155. messageSends: []
  3156. }),
  3157. $globals.Dictionary);
  3158. $core.addMethod(
  3159. $core.method({
  3160. selector: "at:put:",
  3161. protocol: "accessing",
  3162. fn: function (aKey,aValue){
  3163. var self=this,$self=this;
  3164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3165. return $core.withContext(function($ctx1) {
  3166. //>>excludeEnd("ctx");
  3167. var index = $self._positionOfKey_(aKey);
  3168. if(index === -1) {
  3169. var keys = $self['@keys'];
  3170. index = keys.length;
  3171. keys.push(aKey);
  3172. }
  3173. return $self['@values'][index] = aValue;
  3174. ;
  3175. return self;
  3176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3177. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3178. //>>excludeEnd("ctx");
  3179. },
  3180. //>>excludeStart("ide", pragmas.excludeIdeData);
  3181. args: ["aKey", "aValue"],
  3182. 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'>",
  3183. referencedClasses: [],
  3184. //>>excludeEnd("ide");
  3185. messageSends: []
  3186. }),
  3187. $globals.Dictionary);
  3188. $core.addMethod(
  3189. $core.method({
  3190. selector: "includesKey:",
  3191. protocol: "testing",
  3192. fn: function (aKey){
  3193. var self=this,$self=this;
  3194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3195. return $core.withContext(function($ctx1) {
  3196. //>>excludeEnd("ctx");
  3197. return $self._positionOfKey_(aKey) >= 0;;
  3198. return self;
  3199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3200. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3201. //>>excludeEnd("ctx");
  3202. },
  3203. //>>excludeStart("ide", pragmas.excludeIdeData);
  3204. args: ["aKey"],
  3205. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  3206. referencedClasses: [],
  3207. //>>excludeEnd("ide");
  3208. messageSends: []
  3209. }),
  3210. $globals.Dictionary);
  3211. $core.addMethod(
  3212. $core.method({
  3213. selector: "indexOf:ifAbsent:",
  3214. protocol: "accessing",
  3215. fn: function (anObject,aBlock){
  3216. var self=this,$self=this;
  3217. var index;
  3218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3219. return $core.withContext(function($ctx1) {
  3220. //>>excludeEnd("ctx");
  3221. var $1;
  3222. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3223. return (0);
  3224. }));
  3225. $1=$recv(index).__eq((0));
  3226. if($core.assert($1)){
  3227. return $recv(aBlock)._value();
  3228. } else {
  3229. return $recv($self["@keys"])._at_(index);
  3230. }
  3231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3232. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3233. //>>excludeEnd("ctx");
  3234. },
  3235. //>>excludeStart("ide", pragmas.excludeIdeData);
  3236. args: ["anObject", "aBlock"],
  3237. 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 ]",
  3238. referencedClasses: [],
  3239. //>>excludeEnd("ide");
  3240. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3241. }),
  3242. $globals.Dictionary);
  3243. $core.addMethod(
  3244. $core.method({
  3245. selector: "initialize",
  3246. protocol: "initialization",
  3247. fn: function (){
  3248. var self=this,$self=this;
  3249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3250. return $core.withContext(function($ctx1) {
  3251. //>>excludeEnd("ctx");
  3252. (
  3253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3254. $ctx1.supercall = true,
  3255. //>>excludeEnd("ctx");
  3256. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  3257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3258. $ctx1.supercall = false;
  3259. //>>excludeEnd("ctx");;
  3260. $self["@keys"]=[];
  3261. $self["@values"]=[];
  3262. return self;
  3263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3264. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3265. //>>excludeEnd("ctx");
  3266. },
  3267. //>>excludeStart("ide", pragmas.excludeIdeData);
  3268. args: [],
  3269. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3270. referencedClasses: [],
  3271. //>>excludeEnd("ide");
  3272. messageSends: ["initialize"]
  3273. }),
  3274. $globals.Dictionary);
  3275. $core.addMethod(
  3276. $core.method({
  3277. selector: "keys",
  3278. protocol: "accessing",
  3279. fn: function (){
  3280. var self=this,$self=this;
  3281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3282. return $core.withContext(function($ctx1) {
  3283. //>>excludeEnd("ctx");
  3284. return $recv($self["@keys"])._copy();
  3285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3286. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3287. //>>excludeEnd("ctx");
  3288. },
  3289. //>>excludeStart("ide", pragmas.excludeIdeData);
  3290. args: [],
  3291. source: "keys\x0a\x09^ keys copy",
  3292. referencedClasses: [],
  3293. //>>excludeEnd("ide");
  3294. messageSends: ["copy"]
  3295. }),
  3296. $globals.Dictionary);
  3297. $core.addMethod(
  3298. $core.method({
  3299. selector: "keysAndValuesDo:",
  3300. protocol: "enumerating",
  3301. fn: function (aBlock){
  3302. var self=this,$self=this;
  3303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3304. return $core.withContext(function($ctx1) {
  3305. //>>excludeEnd("ctx");
  3306. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  3307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3308. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3309. //>>excludeEnd("ctx");
  3310. },
  3311. //>>excludeStart("ide", pragmas.excludeIdeData);
  3312. args: ["aBlock"],
  3313. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3314. referencedClasses: [],
  3315. //>>excludeEnd("ide");
  3316. messageSends: ["with:do:"]
  3317. }),
  3318. $globals.Dictionary);
  3319. $core.addMethod(
  3320. $core.method({
  3321. selector: "keysDo:",
  3322. protocol: "enumerating",
  3323. fn: function (aBlock){
  3324. var self=this,$self=this;
  3325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3326. return $core.withContext(function($ctx1) {
  3327. //>>excludeEnd("ctx");
  3328. return $recv($self["@keys"])._do_(aBlock);
  3329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3330. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3331. //>>excludeEnd("ctx");
  3332. },
  3333. //>>excludeStart("ide", pragmas.excludeIdeData);
  3334. args: ["aBlock"],
  3335. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3336. referencedClasses: [],
  3337. //>>excludeEnd("ide");
  3338. messageSends: ["do:"]
  3339. }),
  3340. $globals.Dictionary);
  3341. $core.addMethod(
  3342. $core.method({
  3343. selector: "positionOfKey:",
  3344. protocol: "private",
  3345. fn: function (anObject){
  3346. var self=this,$self=this;
  3347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3348. return $core.withContext(function($ctx1) {
  3349. //>>excludeEnd("ctx");
  3350. var keys = $self['@keys'];
  3351. for(var i=0;i<keys.length;i++){
  3352. if(keys[i].__eq(anObject)) { return i;}
  3353. }
  3354. return -1;
  3355. ;
  3356. return self;
  3357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3358. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3359. //>>excludeEnd("ctx");
  3360. },
  3361. //>>excludeStart("ide", pragmas.excludeIdeData);
  3362. args: ["anObject"],
  3363. 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'>",
  3364. referencedClasses: [],
  3365. //>>excludeEnd("ide");
  3366. messageSends: []
  3367. }),
  3368. $globals.Dictionary);
  3369. $core.addMethod(
  3370. $core.method({
  3371. selector: "removeAll",
  3372. protocol: "adding/removing",
  3373. fn: function (){
  3374. var self=this,$self=this;
  3375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3376. return $core.withContext(function($ctx1) {
  3377. //>>excludeEnd("ctx");
  3378. $recv($self["@keys"])._removeAll();
  3379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3380. $ctx1.sendIdx["removeAll"]=1;
  3381. //>>excludeEnd("ctx");
  3382. $recv($self["@values"])._removeAll();
  3383. return self;
  3384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3385. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3386. //>>excludeEnd("ctx");
  3387. },
  3388. //>>excludeStart("ide", pragmas.excludeIdeData);
  3389. args: [],
  3390. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3391. referencedClasses: [],
  3392. //>>excludeEnd("ide");
  3393. messageSends: ["removeAll"]
  3394. }),
  3395. $globals.Dictionary);
  3396. $core.addMethod(
  3397. $core.method({
  3398. selector: "removeKey:ifAbsent:",
  3399. protocol: "adding/removing",
  3400. fn: function (aKey,aBlock){
  3401. var self=this,$self=this;
  3402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3403. return $core.withContext(function($ctx1) {
  3404. //>>excludeEnd("ctx");
  3405. var index = $self._positionOfKey_(aKey);
  3406. if(index === -1) {
  3407. return aBlock._value()
  3408. } else {
  3409. var keys = $self['@keys'], values = $self['@values'];
  3410. var value = values[index], l = keys.length;
  3411. keys[index] = keys[l-1];
  3412. keys.pop();
  3413. values[index] = values[l-1];
  3414. values.pop();
  3415. return value;
  3416. }
  3417. ;
  3418. return self;
  3419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3420. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3421. //>>excludeEnd("ctx");
  3422. },
  3423. //>>excludeStart("ide", pragmas.excludeIdeData);
  3424. args: ["aKey", "aBlock"],
  3425. 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'>",
  3426. referencedClasses: [],
  3427. //>>excludeEnd("ide");
  3428. messageSends: []
  3429. }),
  3430. $globals.Dictionary);
  3431. $core.addMethod(
  3432. $core.method({
  3433. selector: "values",
  3434. protocol: "accessing",
  3435. fn: function (){
  3436. var self=this,$self=this;
  3437. return $self["@values"];
  3438. },
  3439. //>>excludeStart("ide", pragmas.excludeIdeData);
  3440. args: [],
  3441. source: "values\x0a\x09^ values",
  3442. referencedClasses: [],
  3443. //>>excludeEnd("ide");
  3444. messageSends: []
  3445. }),
  3446. $globals.Dictionary);
  3447. $core.addMethod(
  3448. $core.method({
  3449. selector: "valuesDo:",
  3450. protocol: "enumerating",
  3451. fn: function (aBlock){
  3452. var self=this,$self=this;
  3453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3454. return $core.withContext(function($ctx1) {
  3455. //>>excludeEnd("ctx");
  3456. return $recv($self["@values"])._do_(aBlock);
  3457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3458. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3459. //>>excludeEnd("ctx");
  3460. },
  3461. //>>excludeStart("ide", pragmas.excludeIdeData);
  3462. args: ["aBlock"],
  3463. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3464. referencedClasses: [],
  3465. //>>excludeEnd("ide");
  3466. messageSends: ["do:"]
  3467. }),
  3468. $globals.Dictionary);
  3469. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3470. //>>excludeStart("ide", pragmas.excludeIdeData);
  3471. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3472. //>>excludeEnd("ide");
  3473. $core.addMethod(
  3474. $core.method({
  3475. selector: "at:ifAbsent:",
  3476. protocol: "accessing",
  3477. fn: function (aKey,aBlock){
  3478. var self=this,$self=this;
  3479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3480. return $core.withContext(function($ctx1) {
  3481. //>>excludeEnd("ctx");
  3482. var $1;
  3483. $1=$self._includesKey_(aKey);
  3484. if($core.assert($1)){
  3485. return $self._basicAt_(aKey);
  3486. } else {
  3487. return $recv(aBlock)._value();
  3488. }
  3489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3490. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3491. //>>excludeEnd("ctx");
  3492. },
  3493. //>>excludeStart("ide", pragmas.excludeIdeData);
  3494. args: ["aKey", "aBlock"],
  3495. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3496. referencedClasses: [],
  3497. //>>excludeEnd("ide");
  3498. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3499. }),
  3500. $globals.HashedCollection);
  3501. $core.addMethod(
  3502. $core.method({
  3503. selector: "at:put:",
  3504. protocol: "accessing",
  3505. fn: function (aKey,aValue){
  3506. var self=this,$self=this;
  3507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3508. return $core.withContext(function($ctx1) {
  3509. //>>excludeEnd("ctx");
  3510. return $self._basicAt_put_(aKey,aValue);
  3511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3512. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3513. //>>excludeEnd("ctx");
  3514. },
  3515. //>>excludeStart("ide", pragmas.excludeIdeData);
  3516. args: ["aKey", "aValue"],
  3517. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3518. referencedClasses: [],
  3519. //>>excludeEnd("ide");
  3520. messageSends: ["basicAt:put:"]
  3521. }),
  3522. $globals.HashedCollection);
  3523. $core.addMethod(
  3524. $core.method({
  3525. selector: "includesKey:",
  3526. protocol: "testing",
  3527. fn: function (aKey){
  3528. var self=this,$self=this;
  3529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3530. return $core.withContext(function($ctx1) {
  3531. //>>excludeEnd("ctx");
  3532. return self.hasOwnProperty(aKey);
  3533. return self;
  3534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3535. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3536. //>>excludeEnd("ctx");
  3537. },
  3538. //>>excludeStart("ide", pragmas.excludeIdeData);
  3539. args: ["aKey"],
  3540. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3541. referencedClasses: [],
  3542. //>>excludeEnd("ide");
  3543. messageSends: []
  3544. }),
  3545. $globals.HashedCollection);
  3546. $core.addMethod(
  3547. $core.method({
  3548. selector: "keys",
  3549. protocol: "accessing",
  3550. fn: function (){
  3551. var self=this,$self=this;
  3552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3553. return $core.withContext(function($ctx1) {
  3554. //>>excludeEnd("ctx");
  3555. return Object.keys(self);
  3556. return self;
  3557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3558. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3559. //>>excludeEnd("ctx");
  3560. },
  3561. //>>excludeStart("ide", pragmas.excludeIdeData);
  3562. args: [],
  3563. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3564. referencedClasses: [],
  3565. //>>excludeEnd("ide");
  3566. messageSends: []
  3567. }),
  3568. $globals.HashedCollection);
  3569. $core.addMethod(
  3570. $core.method({
  3571. selector: "keysDo:",
  3572. protocol: "enumerating",
  3573. fn: function (aBlock){
  3574. var self=this,$self=this;
  3575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3576. return $core.withContext(function($ctx1) {
  3577. //>>excludeEnd("ctx");
  3578. $recv($self._keys())._do_(aBlock);
  3579. return self;
  3580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3581. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3582. //>>excludeEnd("ctx");
  3583. },
  3584. //>>excludeStart("ide", pragmas.excludeIdeData);
  3585. args: ["aBlock"],
  3586. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3587. referencedClasses: [],
  3588. //>>excludeEnd("ide");
  3589. messageSends: ["do:", "keys"]
  3590. }),
  3591. $globals.HashedCollection);
  3592. $core.addMethod(
  3593. $core.method({
  3594. selector: "removeKey:ifAbsent:",
  3595. protocol: "adding/removing",
  3596. fn: function (aKey,aBlock){
  3597. var self=this,$self=this;
  3598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3599. return $core.withContext(function($ctx1) {
  3600. //>>excludeEnd("ctx");
  3601. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3603. return $core.withContext(function($ctx2) {
  3604. //>>excludeEnd("ctx");
  3605. $self._basicDelete_(aKey);
  3606. return removed;
  3607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3608. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3609. //>>excludeEnd("ctx");
  3610. }),(function(){
  3611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3612. return $core.withContext(function($ctx2) {
  3613. //>>excludeEnd("ctx");
  3614. return $recv(aBlock)._value();
  3615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3616. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3617. //>>excludeEnd("ctx");
  3618. }));
  3619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3620. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3621. //>>excludeEnd("ctx");
  3622. },
  3623. //>>excludeStart("ide", pragmas.excludeIdeData);
  3624. args: ["aKey", "aBlock"],
  3625. 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 ]",
  3626. referencedClasses: [],
  3627. //>>excludeEnd("ide");
  3628. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3629. }),
  3630. $globals.HashedCollection);
  3631. $core.addMethod(
  3632. $core.method({
  3633. selector: "values",
  3634. protocol: "accessing",
  3635. fn: function (){
  3636. var self=this,$self=this;
  3637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3638. return $core.withContext(function($ctx1) {
  3639. //>>excludeEnd("ctx");
  3640. return $self._keys().map(function(key){
  3641. return $self._at_(key);
  3642. });
  3643. ;
  3644. return self;
  3645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3646. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3647. //>>excludeEnd("ctx");
  3648. },
  3649. //>>excludeStart("ide", pragmas.excludeIdeData);
  3650. args: [],
  3651. 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'>",
  3652. referencedClasses: [],
  3653. //>>excludeEnd("ide");
  3654. messageSends: []
  3655. }),
  3656. $globals.HashedCollection);
  3657. $core.addMethod(
  3658. $core.method({
  3659. selector: "valuesDo:",
  3660. protocol: "enumerating",
  3661. fn: function (aBlock){
  3662. var self=this,$self=this;
  3663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3664. return $core.withContext(function($ctx1) {
  3665. //>>excludeEnd("ctx");
  3666. $recv($self._values())._do_(aBlock);
  3667. return self;
  3668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3669. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3670. //>>excludeEnd("ctx");
  3671. },
  3672. //>>excludeStart("ide", pragmas.excludeIdeData);
  3673. args: ["aBlock"],
  3674. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3675. referencedClasses: [],
  3676. //>>excludeEnd("ide");
  3677. messageSends: ["do:", "values"]
  3678. }),
  3679. $globals.HashedCollection);
  3680. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  3681. //>>excludeStart("ide", pragmas.excludeIdeData);
  3682. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3683. //>>excludeEnd("ide");
  3684. $core.addMethod(
  3685. $core.method({
  3686. selector: "=",
  3687. protocol: "comparing",
  3688. fn: function (aCollection){
  3689. var self=this,$self=this;
  3690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3691. return $core.withContext(function($ctx1) {
  3692. //>>excludeEnd("ctx");
  3693. var $3,$2,$4,$1,$5;
  3694. var $early={};
  3695. try {
  3696. $3=$self._class();
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. $ctx1.sendIdx["class"]=1;
  3699. //>>excludeEnd("ctx");
  3700. $2=$recv($3).__eq($recv(aCollection)._class());
  3701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3702. $ctx1.sendIdx["="]=1;
  3703. //>>excludeEnd("ctx");
  3704. $1=$recv($2)._and_((function(){
  3705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3706. return $core.withContext(function($ctx2) {
  3707. //>>excludeEnd("ctx");
  3708. $4=$self._size();
  3709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3710. $ctx2.sendIdx["size"]=1;
  3711. //>>excludeEnd("ctx");
  3712. return $recv($4).__eq($recv(aCollection)._size());
  3713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3714. $ctx2.sendIdx["="]=2;
  3715. //>>excludeEnd("ctx");
  3716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3717. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3718. //>>excludeEnd("ctx");
  3719. }));
  3720. if(!$core.assert($1)){
  3721. return false;
  3722. }
  3723. $self._withIndexDo_((function(each,i){
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. return $core.withContext(function($ctx2) {
  3726. //>>excludeEnd("ctx");
  3727. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3728. if(!$core.assert($5)){
  3729. throw $early=[false];
  3730. }
  3731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3732. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3733. //>>excludeEnd("ctx");
  3734. }));
  3735. return true;
  3736. }
  3737. catch(e) {if(e===$early)return e[0]; throw e}
  3738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3739. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3740. //>>excludeEnd("ctx");
  3741. },
  3742. //>>excludeStart("ide", pragmas.excludeIdeData);
  3743. args: ["aCollection"],
  3744. 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",
  3745. referencedClasses: [],
  3746. //>>excludeEnd("ide");
  3747. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3748. }),
  3749. $globals.SequenceableCollection);
  3750. $core.addMethod(
  3751. $core.method({
  3752. selector: "addLast:",
  3753. protocol: "adding/removing",
  3754. fn: function (anObject){
  3755. var self=this,$self=this;
  3756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3757. return $core.withContext(function($ctx1) {
  3758. //>>excludeEnd("ctx");
  3759. $self._add_(anObject);
  3760. return self;
  3761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3762. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3763. //>>excludeEnd("ctx");
  3764. },
  3765. //>>excludeStart("ide", pragmas.excludeIdeData);
  3766. args: ["anObject"],
  3767. source: "addLast: anObject\x0a\x09self add: anObject",
  3768. referencedClasses: [],
  3769. //>>excludeEnd("ide");
  3770. messageSends: ["add:"]
  3771. }),
  3772. $globals.SequenceableCollection);
  3773. $core.addMethod(
  3774. $core.method({
  3775. selector: "allButFirst",
  3776. protocol: "accessing",
  3777. fn: function (){
  3778. var self=this,$self=this;
  3779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3780. return $core.withContext(function($ctx1) {
  3781. //>>excludeEnd("ctx");
  3782. return $self._copyFrom_to_((2),$self._size());
  3783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3784. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3785. //>>excludeEnd("ctx");
  3786. },
  3787. //>>excludeStart("ide", pragmas.excludeIdeData);
  3788. args: [],
  3789. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3790. referencedClasses: [],
  3791. //>>excludeEnd("ide");
  3792. messageSends: ["copyFrom:to:", "size"]
  3793. }),
  3794. $globals.SequenceableCollection);
  3795. $core.addMethod(
  3796. $core.method({
  3797. selector: "allButLast",
  3798. protocol: "accessing",
  3799. fn: function (){
  3800. var self=this,$self=this;
  3801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3802. return $core.withContext(function($ctx1) {
  3803. //>>excludeEnd("ctx");
  3804. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3806. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3807. //>>excludeEnd("ctx");
  3808. },
  3809. //>>excludeStart("ide", pragmas.excludeIdeData);
  3810. args: [],
  3811. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3812. referencedClasses: [],
  3813. //>>excludeEnd("ide");
  3814. messageSends: ["copyFrom:to:", "-", "size"]
  3815. }),
  3816. $globals.SequenceableCollection);
  3817. $core.addMethod(
  3818. $core.method({
  3819. selector: "anyOne",
  3820. protocol: "accessing",
  3821. fn: function (){
  3822. var self=this,$self=this;
  3823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3824. return $core.withContext(function($ctx1) {
  3825. //>>excludeEnd("ctx");
  3826. return $self._at_((1));
  3827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3828. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3829. //>>excludeEnd("ctx");
  3830. },
  3831. //>>excludeStart("ide", pragmas.excludeIdeData);
  3832. args: [],
  3833. source: "anyOne\x0a\x09^ self at: 1",
  3834. referencedClasses: [],
  3835. //>>excludeEnd("ide");
  3836. messageSends: ["at:"]
  3837. }),
  3838. $globals.SequenceableCollection);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "atRandom",
  3842. protocol: "accessing",
  3843. fn: function (){
  3844. var self=this,$self=this;
  3845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3846. return $core.withContext(function($ctx1) {
  3847. //>>excludeEnd("ctx");
  3848. return $self._at_($recv($self._size())._atRandom());
  3849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3850. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3851. //>>excludeEnd("ctx");
  3852. },
  3853. //>>excludeStart("ide", pragmas.excludeIdeData);
  3854. args: [],
  3855. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3856. referencedClasses: [],
  3857. //>>excludeEnd("ide");
  3858. messageSends: ["at:", "atRandom", "size"]
  3859. }),
  3860. $globals.SequenceableCollection);
  3861. $core.addMethod(
  3862. $core.method({
  3863. selector: "beginsWith:",
  3864. protocol: "testing",
  3865. fn: function (prefix){
  3866. var self=this,$self=this;
  3867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3868. return $core.withContext(function($ctx1) {
  3869. //>>excludeEnd("ctx");
  3870. var $2,$3,$1;
  3871. $2=$self._size();
  3872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3873. $ctx1.sendIdx["size"]=1;
  3874. //>>excludeEnd("ctx");
  3875. $3=$recv(prefix)._size();
  3876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3877. $ctx1.sendIdx["size"]=2;
  3878. //>>excludeEnd("ctx");
  3879. $1=$recv($2).__lt($3);
  3880. if($core.assert($1)){
  3881. return false;
  3882. }
  3883. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3885. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3886. //>>excludeEnd("ctx");
  3887. },
  3888. //>>excludeStart("ide", pragmas.excludeIdeData);
  3889. args: ["prefix"],
  3890. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3891. referencedClasses: [],
  3892. //>>excludeEnd("ide");
  3893. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3894. }),
  3895. $globals.SequenceableCollection);
  3896. $core.addMethod(
  3897. $core.method({
  3898. selector: "copyFrom:to:",
  3899. protocol: "copying",
  3900. fn: function (anIndex,anotherIndex){
  3901. var self=this,$self=this;
  3902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3903. return $core.withContext(function($ctx1) {
  3904. //>>excludeEnd("ctx");
  3905. $self._subclassResponsibility();
  3906. return self;
  3907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3908. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3909. //>>excludeEnd("ctx");
  3910. },
  3911. //>>excludeStart("ide", pragmas.excludeIdeData);
  3912. args: ["anIndex", "anotherIndex"],
  3913. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3914. referencedClasses: [],
  3915. //>>excludeEnd("ide");
  3916. messageSends: ["subclassResponsibility"]
  3917. }),
  3918. $globals.SequenceableCollection);
  3919. $core.addMethod(
  3920. $core.method({
  3921. selector: "detect:ifNone:",
  3922. protocol: "enumerating",
  3923. fn: function (aBlock,anotherBlock){
  3924. var self=this,$self=this;
  3925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3926. return $core.withContext(function($ctx1) {
  3927. //>>excludeEnd("ctx");
  3928. for(var i = 0; i < self.length; i++)
  3929. if(aBlock._value_(self[i]))
  3930. return self[i];
  3931. return anotherBlock._value();
  3932. ;
  3933. return self;
  3934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3935. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3936. //>>excludeEnd("ctx");
  3937. },
  3938. //>>excludeStart("ide", pragmas.excludeIdeData);
  3939. args: ["aBlock", "anotherBlock"],
  3940. 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'>",
  3941. referencedClasses: [],
  3942. //>>excludeEnd("ide");
  3943. messageSends: []
  3944. }),
  3945. $globals.SequenceableCollection);
  3946. $core.addMethod(
  3947. $core.method({
  3948. selector: "do:",
  3949. protocol: "enumerating",
  3950. fn: function (aBlock){
  3951. var self=this,$self=this;
  3952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3953. return $core.withContext(function($ctx1) {
  3954. //>>excludeEnd("ctx");
  3955. for(var i=0; i < self.length; i++) {
  3956. aBlock._value_(self[i]);
  3957. }
  3958. ;
  3959. return self;
  3960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3961. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3962. //>>excludeEnd("ctx");
  3963. },
  3964. //>>excludeStart("ide", pragmas.excludeIdeData);
  3965. args: ["aBlock"],
  3966. 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'>",
  3967. referencedClasses: [],
  3968. //>>excludeEnd("ide");
  3969. messageSends: []
  3970. }),
  3971. $globals.SequenceableCollection);
  3972. $core.addMethod(
  3973. $core.method({
  3974. selector: "endsWith:",
  3975. protocol: "testing",
  3976. fn: function (suffix){
  3977. var self=this,$self=this;
  3978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3979. return $core.withContext(function($ctx1) {
  3980. //>>excludeEnd("ctx");
  3981. var $2,$3,$1;
  3982. $2=$self._size();
  3983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3984. $ctx1.sendIdx["size"]=1;
  3985. //>>excludeEnd("ctx");
  3986. $3=$recv(suffix)._size();
  3987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3988. $ctx1.sendIdx["size"]=2;
  3989. //>>excludeEnd("ctx");
  3990. $1=$recv($2).__lt($3);
  3991. if($core.assert($1)){
  3992. return false;
  3993. }
  3994. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3996. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3997. //>>excludeEnd("ctx");
  3998. },
  3999. //>>excludeStart("ide", pragmas.excludeIdeData);
  4000. args: ["suffix"],
  4001. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  4002. referencedClasses: [],
  4003. //>>excludeEnd("ide");
  4004. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  4005. }),
  4006. $globals.SequenceableCollection);
  4007. $core.addMethod(
  4008. $core.method({
  4009. selector: "first",
  4010. protocol: "accessing",
  4011. fn: function (){
  4012. var self=this,$self=this;
  4013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4014. return $core.withContext(function($ctx1) {
  4015. //>>excludeEnd("ctx");
  4016. return $self._at_((1));
  4017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4018. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  4019. //>>excludeEnd("ctx");
  4020. },
  4021. //>>excludeStart("ide", pragmas.excludeIdeData);
  4022. args: [],
  4023. source: "first\x0a\x09^ self at: 1",
  4024. referencedClasses: [],
  4025. //>>excludeEnd("ide");
  4026. messageSends: ["at:"]
  4027. }),
  4028. $globals.SequenceableCollection);
  4029. $core.addMethod(
  4030. $core.method({
  4031. selector: "first:",
  4032. protocol: "accessing",
  4033. fn: function (aNumber){
  4034. var self=this,$self=this;
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. return $core.withContext(function($ctx1) {
  4037. //>>excludeEnd("ctx");
  4038. var $1;
  4039. $1=$recv($self._size()).__lt(aNumber);
  4040. if($core.assert($1)){
  4041. $self._error_("Invalid number of elements");
  4042. }
  4043. return $self._copyFrom_to_((1),aNumber);
  4044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4045. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4046. //>>excludeEnd("ctx");
  4047. },
  4048. //>>excludeStart("ide", pragmas.excludeIdeData);
  4049. args: ["aNumber"],
  4050. 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",
  4051. referencedClasses: [],
  4052. //>>excludeEnd("ide");
  4053. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  4054. }),
  4055. $globals.SequenceableCollection);
  4056. $core.addMethod(
  4057. $core.method({
  4058. selector: "fourth",
  4059. protocol: "accessing",
  4060. fn: function (){
  4061. var self=this,$self=this;
  4062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4063. return $core.withContext(function($ctx1) {
  4064. //>>excludeEnd("ctx");
  4065. return $self._at_((4));
  4066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4067. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  4068. //>>excludeEnd("ctx");
  4069. },
  4070. //>>excludeStart("ide", pragmas.excludeIdeData);
  4071. args: [],
  4072. source: "fourth\x0a\x09^ self at: 4",
  4073. referencedClasses: [],
  4074. //>>excludeEnd("ide");
  4075. messageSends: ["at:"]
  4076. }),
  4077. $globals.SequenceableCollection);
  4078. $core.addMethod(
  4079. $core.method({
  4080. selector: "includes:",
  4081. protocol: "testing",
  4082. fn: function (anObject){
  4083. var self=this,$self=this;
  4084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4085. return $core.withContext(function($ctx1) {
  4086. //>>excludeEnd("ctx");
  4087. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  4088. return nil;
  4089. })))._notNil();
  4090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4091. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  4092. //>>excludeEnd("ctx");
  4093. },
  4094. //>>excludeStart("ide", pragmas.excludeIdeData);
  4095. args: ["anObject"],
  4096. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4097. referencedClasses: [],
  4098. //>>excludeEnd("ide");
  4099. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4100. }),
  4101. $globals.SequenceableCollection);
  4102. $core.addMethod(
  4103. $core.method({
  4104. selector: "indexOf:ifAbsent:",
  4105. protocol: "accessing",
  4106. fn: function (anObject,aBlock){
  4107. var self=this,$self=this;
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. return $core.withContext(function($ctx1) {
  4110. //>>excludeEnd("ctx");
  4111. for(var i=0; i < self.length; i++) {
  4112. if($recv(self[i]).__eq(anObject)) {return i+1}
  4113. };
  4114. return aBlock._value();
  4115. ;
  4116. return self;
  4117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4118. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  4119. //>>excludeEnd("ctx");
  4120. },
  4121. //>>excludeStart("ide", pragmas.excludeIdeData);
  4122. args: ["anObject", "aBlock"],
  4123. 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'>",
  4124. referencedClasses: [],
  4125. //>>excludeEnd("ide");
  4126. messageSends: []
  4127. }),
  4128. $globals.SequenceableCollection);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: "indexOf:startingAt:",
  4132. protocol: "accessing",
  4133. fn: function (anObject,start){
  4134. var self=this,$self=this;
  4135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4136. return $core.withContext(function($ctx1) {
  4137. //>>excludeEnd("ctx");
  4138. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4139. return (0);
  4140. }));
  4141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4142. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4143. //>>excludeEnd("ctx");
  4144. },
  4145. //>>excludeStart("ide", pragmas.excludeIdeData);
  4146. args: ["anObject", "start"],
  4147. 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 ]",
  4148. referencedClasses: [],
  4149. //>>excludeEnd("ide");
  4150. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4151. }),
  4152. $globals.SequenceableCollection);
  4153. $core.addMethod(
  4154. $core.method({
  4155. selector: "indexOf:startingAt:ifAbsent:",
  4156. protocol: "accessing",
  4157. fn: function (anObject,start,aBlock){
  4158. var self=this,$self=this;
  4159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4160. return $core.withContext(function($ctx1) {
  4161. //>>excludeEnd("ctx");
  4162. for(var i=start - 1; i < self.length; i++){
  4163. if($recv(self[i]).__eq(anObject)) {return i+1}
  4164. }
  4165. return aBlock._value();
  4166. ;
  4167. return self;
  4168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4169. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4170. //>>excludeEnd("ctx");
  4171. },
  4172. //>>excludeStart("ide", pragmas.excludeIdeData);
  4173. args: ["anObject", "start", "aBlock"],
  4174. 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'>",
  4175. referencedClasses: [],
  4176. //>>excludeEnd("ide");
  4177. messageSends: []
  4178. }),
  4179. $globals.SequenceableCollection);
  4180. $core.addMethod(
  4181. $core.method({
  4182. selector: "last",
  4183. protocol: "accessing",
  4184. fn: function (){
  4185. var self=this,$self=this;
  4186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4187. return $core.withContext(function($ctx1) {
  4188. //>>excludeEnd("ctx");
  4189. return $self._at_($self._size());
  4190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4191. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4192. //>>excludeEnd("ctx");
  4193. },
  4194. //>>excludeStart("ide", pragmas.excludeIdeData);
  4195. args: [],
  4196. source: "last\x0a\x09^ self at: self size",
  4197. referencedClasses: [],
  4198. //>>excludeEnd("ide");
  4199. messageSends: ["at:", "size"]
  4200. }),
  4201. $globals.SequenceableCollection);
  4202. $core.addMethod(
  4203. $core.method({
  4204. selector: "last:",
  4205. protocol: "accessing",
  4206. fn: function (aNumber){
  4207. var self=this,$self=this;
  4208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4209. return $core.withContext(function($ctx1) {
  4210. //>>excludeEnd("ctx");
  4211. var $2,$1,$5,$4,$3;
  4212. $2=$self._size();
  4213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4214. $ctx1.sendIdx["size"]=1;
  4215. //>>excludeEnd("ctx");
  4216. $1=$recv($2).__lt(aNumber);
  4217. if($core.assert($1)){
  4218. $self._error_("Invalid number of elements");
  4219. }
  4220. $5=$self._size();
  4221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4222. $ctx1.sendIdx["size"]=2;
  4223. //>>excludeEnd("ctx");
  4224. $4=$recv($5).__minus(aNumber);
  4225. $3=$recv($4).__plus((1));
  4226. return $self._copyFrom_to_($3,$self._size());
  4227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4228. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4229. //>>excludeEnd("ctx");
  4230. },
  4231. //>>excludeStart("ide", pragmas.excludeIdeData);
  4232. args: ["aNumber"],
  4233. 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",
  4234. referencedClasses: [],
  4235. //>>excludeEnd("ide");
  4236. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4237. }),
  4238. $globals.SequenceableCollection);
  4239. $core.addMethod(
  4240. $core.method({
  4241. selector: "newStream",
  4242. protocol: "streaming",
  4243. fn: function (){
  4244. var self=this,$self=this;
  4245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4246. return $core.withContext(function($ctx1) {
  4247. //>>excludeEnd("ctx");
  4248. return $recv($self._streamClass())._on_(self);
  4249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4250. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4251. //>>excludeEnd("ctx");
  4252. },
  4253. //>>excludeStart("ide", pragmas.excludeIdeData);
  4254. args: [],
  4255. source: "newStream\x0a\x09^ self streamClass on: self",
  4256. referencedClasses: [],
  4257. //>>excludeEnd("ide");
  4258. messageSends: ["on:", "streamClass"]
  4259. }),
  4260. $globals.SequenceableCollection);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "readStream",
  4264. protocol: "streaming",
  4265. fn: function (){
  4266. var self=this,$self=this;
  4267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4268. return $core.withContext(function($ctx1) {
  4269. //>>excludeEnd("ctx");
  4270. return $self._stream();
  4271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4272. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4273. //>>excludeEnd("ctx");
  4274. },
  4275. //>>excludeStart("ide", pragmas.excludeIdeData);
  4276. args: [],
  4277. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4278. referencedClasses: [],
  4279. //>>excludeEnd("ide");
  4280. messageSends: ["stream"]
  4281. }),
  4282. $globals.SequenceableCollection);
  4283. $core.addMethod(
  4284. $core.method({
  4285. selector: "removeLast",
  4286. protocol: "adding/removing",
  4287. fn: function (){
  4288. var self=this,$self=this;
  4289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4290. return $core.withContext(function($ctx1) {
  4291. //>>excludeEnd("ctx");
  4292. return $self._remove_($self._last());
  4293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4294. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4295. //>>excludeEnd("ctx");
  4296. },
  4297. //>>excludeStart("ide", pragmas.excludeIdeData);
  4298. args: [],
  4299. source: "removeLast\x0a\x09^ self remove: self last",
  4300. referencedClasses: [],
  4301. //>>excludeEnd("ide");
  4302. messageSends: ["remove:", "last"]
  4303. }),
  4304. $globals.SequenceableCollection);
  4305. $core.addMethod(
  4306. $core.method({
  4307. selector: "reverseDo:",
  4308. protocol: "enumerating",
  4309. fn: function (aBlock){
  4310. var self=this,$self=this;
  4311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4312. return $core.withContext(function($ctx1) {
  4313. //>>excludeEnd("ctx");
  4314. $recv($self._reversed())._do_(aBlock);
  4315. return self;
  4316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4317. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4318. //>>excludeEnd("ctx");
  4319. },
  4320. //>>excludeStart("ide", pragmas.excludeIdeData);
  4321. args: ["aBlock"],
  4322. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4323. referencedClasses: [],
  4324. //>>excludeEnd("ide");
  4325. messageSends: ["do:", "reversed"]
  4326. }),
  4327. $globals.SequenceableCollection);
  4328. $core.addMethod(
  4329. $core.method({
  4330. selector: "reversed",
  4331. protocol: "converting",
  4332. fn: function (){
  4333. var self=this,$self=this;
  4334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4335. return $core.withContext(function($ctx1) {
  4336. //>>excludeEnd("ctx");
  4337. $self._subclassResponsibility();
  4338. return self;
  4339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4340. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4341. //>>excludeEnd("ctx");
  4342. },
  4343. //>>excludeStart("ide", pragmas.excludeIdeData);
  4344. args: [],
  4345. source: "reversed\x0a\x09self subclassResponsibility",
  4346. referencedClasses: [],
  4347. //>>excludeEnd("ide");
  4348. messageSends: ["subclassResponsibility"]
  4349. }),
  4350. $globals.SequenceableCollection);
  4351. $core.addMethod(
  4352. $core.method({
  4353. selector: "second",
  4354. protocol: "accessing",
  4355. fn: function (){
  4356. var self=this,$self=this;
  4357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4358. return $core.withContext(function($ctx1) {
  4359. //>>excludeEnd("ctx");
  4360. return $self._at_((2));
  4361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4362. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4363. //>>excludeEnd("ctx");
  4364. },
  4365. //>>excludeStart("ide", pragmas.excludeIdeData);
  4366. args: [],
  4367. source: "second\x0a\x09^ self at: 2",
  4368. referencedClasses: [],
  4369. //>>excludeEnd("ide");
  4370. messageSends: ["at:"]
  4371. }),
  4372. $globals.SequenceableCollection);
  4373. $core.addMethod(
  4374. $core.method({
  4375. selector: "single",
  4376. protocol: "accessing",
  4377. fn: function (){
  4378. var self=this,$self=this;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. return $core.withContext(function($ctx1) {
  4381. //>>excludeEnd("ctx");
  4382. if (self.length == 0) throw new Error("Collection is empty");
  4383. if (self.length > 1) throw new Error("Collection holds more than one element.");
  4384. return self[0];;
  4385. return self;
  4386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4387. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  4388. //>>excludeEnd("ctx");
  4389. },
  4390. //>>excludeStart("ide", pragmas.excludeIdeData);
  4391. args: [],
  4392. 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'>",
  4393. referencedClasses: [],
  4394. //>>excludeEnd("ide");
  4395. messageSends: []
  4396. }),
  4397. $globals.SequenceableCollection);
  4398. $core.addMethod(
  4399. $core.method({
  4400. selector: "stream",
  4401. protocol: "streaming",
  4402. fn: function (){
  4403. var self=this,$self=this;
  4404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4405. return $core.withContext(function($ctx1) {
  4406. //>>excludeEnd("ctx");
  4407. return $self._newStream();
  4408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4409. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4410. //>>excludeEnd("ctx");
  4411. },
  4412. //>>excludeStart("ide", pragmas.excludeIdeData);
  4413. args: [],
  4414. source: "stream\x0a\x09^ self newStream",
  4415. referencedClasses: [],
  4416. //>>excludeEnd("ide");
  4417. messageSends: ["newStream"]
  4418. }),
  4419. $globals.SequenceableCollection);
  4420. $core.addMethod(
  4421. $core.method({
  4422. selector: "streamClass",
  4423. protocol: "streaming",
  4424. fn: function (){
  4425. var self=this,$self=this;
  4426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4427. return $core.withContext(function($ctx1) {
  4428. //>>excludeEnd("ctx");
  4429. return $recv($self._class())._streamClass();
  4430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4431. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4432. //>>excludeEnd("ctx");
  4433. },
  4434. //>>excludeStart("ide", pragmas.excludeIdeData);
  4435. args: [],
  4436. source: "streamClass\x0a\x09^ self class streamClass",
  4437. referencedClasses: [],
  4438. //>>excludeEnd("ide");
  4439. messageSends: ["streamClass", "class"]
  4440. }),
  4441. $globals.SequenceableCollection);
  4442. $core.addMethod(
  4443. $core.method({
  4444. selector: "third",
  4445. protocol: "accessing",
  4446. fn: function (){
  4447. var self=this,$self=this;
  4448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4449. return $core.withContext(function($ctx1) {
  4450. //>>excludeEnd("ctx");
  4451. return $self._at_((3));
  4452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4453. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4454. //>>excludeEnd("ctx");
  4455. },
  4456. //>>excludeStart("ide", pragmas.excludeIdeData);
  4457. args: [],
  4458. source: "third\x0a\x09^ self at: 3",
  4459. referencedClasses: [],
  4460. //>>excludeEnd("ide");
  4461. messageSends: ["at:"]
  4462. }),
  4463. $globals.SequenceableCollection);
  4464. $core.addMethod(
  4465. $core.method({
  4466. selector: "with:do:",
  4467. protocol: "enumerating",
  4468. fn: function (anotherCollection,aBlock){
  4469. var self=this,$self=this;
  4470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4471. return $core.withContext(function($ctx1) {
  4472. //>>excludeEnd("ctx");
  4473. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  4474. for(var i=0; i<self.length; i++) {
  4475. aBlock._value_value_(self[i], anotherCollection[i]);
  4476. }
  4477. ;
  4478. return self;
  4479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4480. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4481. //>>excludeEnd("ctx");
  4482. },
  4483. //>>excludeStart("ide", pragmas.excludeIdeData);
  4484. args: ["anotherCollection", "aBlock"],
  4485. 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'>",
  4486. referencedClasses: [],
  4487. //>>excludeEnd("ide");
  4488. messageSends: []
  4489. }),
  4490. $globals.SequenceableCollection);
  4491. $core.addMethod(
  4492. $core.method({
  4493. selector: "withIndexDo:",
  4494. protocol: "enumerating",
  4495. fn: function (aBlock){
  4496. var self=this,$self=this;
  4497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4498. return $core.withContext(function($ctx1) {
  4499. //>>excludeEnd("ctx");
  4500. for(var i=0; i < self.length; i++) {
  4501. aBlock._value_value_(self[i], i+1);
  4502. }
  4503. ;
  4504. return self;
  4505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4506. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4507. //>>excludeEnd("ctx");
  4508. },
  4509. //>>excludeStart("ide", pragmas.excludeIdeData);
  4510. args: ["aBlock"],
  4511. 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'>",
  4512. referencedClasses: [],
  4513. //>>excludeEnd("ide");
  4514. messageSends: []
  4515. }),
  4516. $globals.SequenceableCollection);
  4517. $core.addMethod(
  4518. $core.method({
  4519. selector: "writeStream",
  4520. protocol: "streaming",
  4521. fn: function (){
  4522. var self=this,$self=this;
  4523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4524. return $core.withContext(function($ctx1) {
  4525. //>>excludeEnd("ctx");
  4526. return $self._stream();
  4527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4528. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4529. //>>excludeEnd("ctx");
  4530. },
  4531. //>>excludeStart("ide", pragmas.excludeIdeData);
  4532. args: [],
  4533. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4534. referencedClasses: [],
  4535. //>>excludeEnd("ide");
  4536. messageSends: ["stream"]
  4537. }),
  4538. $globals.SequenceableCollection);
  4539. $core.addMethod(
  4540. $core.method({
  4541. selector: "streamClass",
  4542. protocol: "accessing",
  4543. fn: function (){
  4544. var self=this,$self=this;
  4545. return $globals.Stream;
  4546. },
  4547. //>>excludeStart("ide", pragmas.excludeIdeData);
  4548. args: [],
  4549. source: "streamClass\x0a\x09\x09^ Stream",
  4550. referencedClasses: ["Stream"],
  4551. //>>excludeEnd("ide");
  4552. messageSends: []
  4553. }),
  4554. $globals.SequenceableCollection.a$cls);
  4555. $core.addMethod(
  4556. $core.method({
  4557. selector: "streamContents:",
  4558. protocol: "streaming",
  4559. fn: function (aBlock){
  4560. var self=this,$self=this;
  4561. var stream;
  4562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4563. return $core.withContext(function($ctx1) {
  4564. //>>excludeEnd("ctx");
  4565. stream=$recv($self._streamClass())._on_($self._new());
  4566. $recv(aBlock)._value_(stream);
  4567. return $recv(stream)._contents();
  4568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4569. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  4570. //>>excludeEnd("ctx");
  4571. },
  4572. //>>excludeStart("ide", pragmas.excludeIdeData);
  4573. args: ["aBlock"],
  4574. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4575. referencedClasses: [],
  4576. //>>excludeEnd("ide");
  4577. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4578. }),
  4579. $globals.SequenceableCollection.a$cls);
  4580. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4581. //>>excludeStart("ide", pragmas.excludeIdeData);
  4582. $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`.";
  4583. //>>excludeEnd("ide");
  4584. $core.addMethod(
  4585. $core.method({
  4586. selector: "add:",
  4587. protocol: "adding/removing",
  4588. fn: function (anObject){
  4589. var self=this,$self=this;
  4590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4591. return $core.withContext(function($ctx1) {
  4592. //>>excludeEnd("ctx");
  4593. self.push(anObject); return anObject;;
  4594. return self;
  4595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4596. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4597. //>>excludeEnd("ctx");
  4598. },
  4599. //>>excludeStart("ide", pragmas.excludeIdeData);
  4600. args: ["anObject"],
  4601. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4602. referencedClasses: [],
  4603. //>>excludeEnd("ide");
  4604. messageSends: []
  4605. }),
  4606. $globals.Array);
  4607. $core.addMethod(
  4608. $core.method({
  4609. selector: "addAll:",
  4610. protocol: "adding/removing",
  4611. fn: function (aCollection){
  4612. var self=this,$self=this;
  4613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4614. return $core.withContext(function($ctx1) {
  4615. //>>excludeEnd("ctx");
  4616. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4617. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4618. return aCollection;;
  4619. return self;
  4620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4621. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4622. //>>excludeEnd("ctx");
  4623. },
  4624. //>>excludeStart("ide", pragmas.excludeIdeData);
  4625. args: ["aCollection"],
  4626. 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'>",
  4627. referencedClasses: [],
  4628. //>>excludeEnd("ide");
  4629. messageSends: []
  4630. }),
  4631. $globals.Array);
  4632. $core.addMethod(
  4633. $core.method({
  4634. selector: "addFirst:",
  4635. protocol: "adding/removing",
  4636. fn: function (anObject){
  4637. var self=this,$self=this;
  4638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4639. return $core.withContext(function($ctx1) {
  4640. //>>excludeEnd("ctx");
  4641. self.unshift(anObject); return anObject;;
  4642. return self;
  4643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4644. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4645. //>>excludeEnd("ctx");
  4646. },
  4647. //>>excludeStart("ide", pragmas.excludeIdeData);
  4648. args: ["anObject"],
  4649. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4650. referencedClasses: [],
  4651. //>>excludeEnd("ide");
  4652. messageSends: []
  4653. }),
  4654. $globals.Array);
  4655. $core.addMethod(
  4656. $core.method({
  4657. selector: "asJavaScriptSource",
  4658. protocol: "converting",
  4659. fn: function (){
  4660. var self=this,$self=this;
  4661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4662. return $core.withContext(function($ctx1) {
  4663. //>>excludeEnd("ctx");
  4664. var $1;
  4665. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4667. return $core.withContext(function($ctx2) {
  4668. //>>excludeEnd("ctx");
  4669. return $recv(each)._asJavaScriptSource();
  4670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4672. //>>excludeEnd("ctx");
  4673. })))._join_(", "))).__comma("]");
  4674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4675. $ctx1.sendIdx[","]=1;
  4676. //>>excludeEnd("ctx");
  4677. return $1;
  4678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4679. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  4680. //>>excludeEnd("ctx");
  4681. },
  4682. //>>excludeStart("ide", pragmas.excludeIdeData);
  4683. args: [],
  4684. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4685. referencedClasses: [],
  4686. //>>excludeEnd("ide");
  4687. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4688. }),
  4689. $globals.Array);
  4690. $core.addMethod(
  4691. $core.method({
  4692. selector: "at:ifAbsent:",
  4693. protocol: "accessing",
  4694. fn: function (anIndex,aBlock){
  4695. var self=this,$self=this;
  4696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4697. return $core.withContext(function($ctx1) {
  4698. //>>excludeEnd("ctx");
  4699. return anIndex >= 1 && anIndex <= self.length
  4700. ? self[anIndex - 1]
  4701. : aBlock._value()
  4702. ;
  4703. return self;
  4704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4705. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4706. //>>excludeEnd("ctx");
  4707. },
  4708. //>>excludeStart("ide", pragmas.excludeIdeData);
  4709. args: ["anIndex", "aBlock"],
  4710. 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'>",
  4711. referencedClasses: [],
  4712. //>>excludeEnd("ide");
  4713. messageSends: []
  4714. }),
  4715. $globals.Array);
  4716. $core.addMethod(
  4717. $core.method({
  4718. selector: "at:ifPresent:ifAbsent:",
  4719. protocol: "accessing",
  4720. fn: function (anIndex,aBlock,anotherBlock){
  4721. var self=this,$self=this;
  4722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4723. return $core.withContext(function($ctx1) {
  4724. //>>excludeEnd("ctx");
  4725. return anIndex >= 1 && anIndex <= self.length
  4726. ? aBlock._value_(self[anIndex - 1])
  4727. : anotherBlock._value()
  4728. ;
  4729. return self;
  4730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4731. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4732. //>>excludeEnd("ctx");
  4733. },
  4734. //>>excludeStart("ide", pragmas.excludeIdeData);
  4735. args: ["anIndex", "aBlock", "anotherBlock"],
  4736. 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'>",
  4737. referencedClasses: [],
  4738. //>>excludeEnd("ide");
  4739. messageSends: []
  4740. }),
  4741. $globals.Array);
  4742. $core.addMethod(
  4743. $core.method({
  4744. selector: "at:put:",
  4745. protocol: "accessing",
  4746. fn: function (anIndex,anObject){
  4747. var self=this,$self=this;
  4748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4749. return $core.withContext(function($ctx1) {
  4750. //>>excludeEnd("ctx");
  4751. return self[anIndex - 1] = anObject;
  4752. return self;
  4753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4754. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4755. //>>excludeEnd("ctx");
  4756. },
  4757. //>>excludeStart("ide", pragmas.excludeIdeData);
  4758. args: ["anIndex", "anObject"],
  4759. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4760. referencedClasses: [],
  4761. //>>excludeEnd("ide");
  4762. messageSends: []
  4763. }),
  4764. $globals.Array);
  4765. $core.addMethod(
  4766. $core.method({
  4767. selector: "collect:",
  4768. protocol: "enumerating",
  4769. fn: function (aBlock){
  4770. var self=this,$self=this;
  4771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4772. return $core.withContext(function($ctx1) {
  4773. //>>excludeEnd("ctx");
  4774. return self.map(function(each) {return aBlock._value_(each)});
  4775. return self;
  4776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4777. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4778. //>>excludeEnd("ctx");
  4779. },
  4780. //>>excludeStart("ide", pragmas.excludeIdeData);
  4781. args: ["aBlock"],
  4782. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4783. referencedClasses: [],
  4784. //>>excludeEnd("ide");
  4785. messageSends: []
  4786. }),
  4787. $globals.Array);
  4788. $core.addMethod(
  4789. $core.method({
  4790. selector: "copyFrom:to:",
  4791. protocol: "copying",
  4792. fn: function (anIndex,anotherIndex){
  4793. var self=this,$self=this;
  4794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4795. return $core.withContext(function($ctx1) {
  4796. //>>excludeEnd("ctx");
  4797. if (anIndex >= 1 && anotherIndex <= self.length) {
  4798. return self.slice(anIndex - 1, anotherIndex);
  4799. } else {
  4800. self._at_(anIndex);
  4801. self._at_(self.length + 1);
  4802. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4803. };
  4804. return self;
  4805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4806. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4807. //>>excludeEnd("ctx");
  4808. },
  4809. //>>excludeStart("ide", pragmas.excludeIdeData);
  4810. args: ["anIndex", "anotherIndex"],
  4811. 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'>",
  4812. referencedClasses: [],
  4813. //>>excludeEnd("ide");
  4814. messageSends: []
  4815. }),
  4816. $globals.Array);
  4817. $core.addMethod(
  4818. $core.method({
  4819. selector: "join:",
  4820. protocol: "enumerating",
  4821. fn: function (aString){
  4822. var self=this,$self=this;
  4823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4824. return $core.withContext(function($ctx1) {
  4825. //>>excludeEnd("ctx");
  4826. return self.join(aString);
  4827. return self;
  4828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4829. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4830. //>>excludeEnd("ctx");
  4831. },
  4832. //>>excludeStart("ide", pragmas.excludeIdeData);
  4833. args: ["aString"],
  4834. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4835. referencedClasses: [],
  4836. //>>excludeEnd("ide");
  4837. messageSends: []
  4838. }),
  4839. $globals.Array);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "printOn:",
  4843. protocol: "printing",
  4844. fn: function (aStream){
  4845. var self=this,$self=this;
  4846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4847. return $core.withContext(function($ctx1) {
  4848. //>>excludeEnd("ctx");
  4849. (
  4850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4851. $ctx1.supercall = true,
  4852. //>>excludeEnd("ctx");
  4853. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4855. $ctx1.supercall = false;
  4856. //>>excludeEnd("ctx");;
  4857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4858. $ctx1.sendIdx["printOn:"]=1;
  4859. //>>excludeEnd("ctx");
  4860. $recv(aStream)._nextPutAll_(" (");
  4861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4862. $ctx1.sendIdx["nextPutAll:"]=1;
  4863. //>>excludeEnd("ctx");
  4864. $self._do_separatedBy_((function(each){
  4865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4866. return $core.withContext(function($ctx2) {
  4867. //>>excludeEnd("ctx");
  4868. return $recv(each)._printOn_(aStream);
  4869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4871. //>>excludeEnd("ctx");
  4872. }),(function(){
  4873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4874. return $core.withContext(function($ctx2) {
  4875. //>>excludeEnd("ctx");
  4876. return $recv(aStream)._nextPutAll_(" ");
  4877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4878. $ctx2.sendIdx["nextPutAll:"]=2;
  4879. //>>excludeEnd("ctx");
  4880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4882. //>>excludeEnd("ctx");
  4883. }));
  4884. $recv(aStream)._nextPutAll_(")");
  4885. return self;
  4886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4887. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4888. //>>excludeEnd("ctx");
  4889. },
  4890. //>>excludeStart("ide", pragmas.excludeIdeData);
  4891. args: ["aStream"],
  4892. 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: ')'",
  4893. referencedClasses: [],
  4894. //>>excludeEnd("ide");
  4895. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4896. }),
  4897. $globals.Array);
  4898. $core.addMethod(
  4899. $core.method({
  4900. selector: "remove:ifAbsent:",
  4901. protocol: "adding/removing",
  4902. fn: function (anObject,aBlock){
  4903. var self=this,$self=this;
  4904. var index;
  4905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4906. return $core.withContext(function($ctx1) {
  4907. //>>excludeEnd("ctx");
  4908. var $1;
  4909. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4910. return (0);
  4911. }));
  4912. $1=$recv(index).__eq((0));
  4913. if($core.assert($1)){
  4914. return $recv(aBlock)._value();
  4915. } else {
  4916. $self._removeIndex_(index);
  4917. return anObject;
  4918. }
  4919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4920. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4921. //>>excludeEnd("ctx");
  4922. },
  4923. //>>excludeStart("ide", pragmas.excludeIdeData);
  4924. args: ["anObject", "aBlock"],
  4925. 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 ]",
  4926. referencedClasses: [],
  4927. //>>excludeEnd("ide");
  4928. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4929. }),
  4930. $globals.Array);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "removeAll",
  4934. protocol: "adding/removing",
  4935. fn: function (){
  4936. var self=this,$self=this;
  4937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4938. return $core.withContext(function($ctx1) {
  4939. //>>excludeEnd("ctx");
  4940. self.length = 0;
  4941. return self;
  4942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4943. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4944. //>>excludeEnd("ctx");
  4945. },
  4946. //>>excludeStart("ide", pragmas.excludeIdeData);
  4947. args: [],
  4948. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4949. referencedClasses: [],
  4950. //>>excludeEnd("ide");
  4951. messageSends: []
  4952. }),
  4953. $globals.Array);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "removeFrom:to:",
  4957. protocol: "adding/removing",
  4958. fn: function (aNumber,anotherNumber){
  4959. var self=this,$self=this;
  4960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4961. return $core.withContext(function($ctx1) {
  4962. //>>excludeEnd("ctx");
  4963. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4964. return self;
  4965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4966. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4967. //>>excludeEnd("ctx");
  4968. },
  4969. //>>excludeStart("ide", pragmas.excludeIdeData);
  4970. args: ["aNumber", "anotherNumber"],
  4971. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4972. referencedClasses: [],
  4973. //>>excludeEnd("ide");
  4974. messageSends: []
  4975. }),
  4976. $globals.Array);
  4977. $core.addMethod(
  4978. $core.method({
  4979. selector: "removeIndex:",
  4980. protocol: "adding/removing",
  4981. fn: function (anInteger){
  4982. var self=this,$self=this;
  4983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4984. return $core.withContext(function($ctx1) {
  4985. //>>excludeEnd("ctx");
  4986. self.splice(anInteger - 1, 1);
  4987. return self;
  4988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4989. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4990. //>>excludeEnd("ctx");
  4991. },
  4992. //>>excludeStart("ide", pragmas.excludeIdeData);
  4993. args: ["anInteger"],
  4994. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4995. referencedClasses: [],
  4996. //>>excludeEnd("ide");
  4997. messageSends: []
  4998. }),
  4999. $globals.Array);
  5000. $core.addMethod(
  5001. $core.method({
  5002. selector: "removeLast",
  5003. protocol: "adding/removing",
  5004. fn: function (){
  5005. var self=this,$self=this;
  5006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5007. return $core.withContext(function($ctx1) {
  5008. //>>excludeEnd("ctx");
  5009. return self.pop();;
  5010. return self;
  5011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5012. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  5013. //>>excludeEnd("ctx");
  5014. },
  5015. //>>excludeStart("ide", pragmas.excludeIdeData);
  5016. args: [],
  5017. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  5018. referencedClasses: [],
  5019. //>>excludeEnd("ide");
  5020. messageSends: []
  5021. }),
  5022. $globals.Array);
  5023. $core.addMethod(
  5024. $core.method({
  5025. selector: "reversed",
  5026. protocol: "converting",
  5027. fn: function (){
  5028. var self=this,$self=this;
  5029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5030. return $core.withContext(function($ctx1) {
  5031. //>>excludeEnd("ctx");
  5032. return self.slice().reverse();
  5033. return self;
  5034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5035. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  5036. //>>excludeEnd("ctx");
  5037. },
  5038. //>>excludeStart("ide", pragmas.excludeIdeData);
  5039. args: [],
  5040. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  5041. referencedClasses: [],
  5042. //>>excludeEnd("ide");
  5043. messageSends: []
  5044. }),
  5045. $globals.Array);
  5046. $core.addMethod(
  5047. $core.method({
  5048. selector: "select:",
  5049. protocol: "enumerating",
  5050. fn: function (aBlock){
  5051. var self=this,$self=this;
  5052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5053. return $core.withContext(function($ctx1) {
  5054. //>>excludeEnd("ctx");
  5055. return self.filter(function(each) {return aBlock._value_(each)});
  5056. return self;
  5057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5058. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  5059. //>>excludeEnd("ctx");
  5060. },
  5061. //>>excludeStart("ide", pragmas.excludeIdeData);
  5062. args: ["aBlock"],
  5063. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  5064. referencedClasses: [],
  5065. //>>excludeEnd("ide");
  5066. messageSends: []
  5067. }),
  5068. $globals.Array);
  5069. $core.addMethod(
  5070. $core.method({
  5071. selector: "shallowCopy",
  5072. protocol: "copying",
  5073. fn: function (){
  5074. var self=this,$self=this;
  5075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5076. return $core.withContext(function($ctx1) {
  5077. //>>excludeEnd("ctx");
  5078. return self.slice();
  5079. return self;
  5080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5081. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  5082. //>>excludeEnd("ctx");
  5083. },
  5084. //>>excludeStart("ide", pragmas.excludeIdeData);
  5085. args: [],
  5086. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  5087. referencedClasses: [],
  5088. //>>excludeEnd("ide");
  5089. messageSends: []
  5090. }),
  5091. $globals.Array);
  5092. $core.addMethod(
  5093. $core.method({
  5094. selector: "size",
  5095. protocol: "accessing",
  5096. fn: function (){
  5097. var self=this,$self=this;
  5098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5099. return $core.withContext(function($ctx1) {
  5100. //>>excludeEnd("ctx");
  5101. return self.length;
  5102. return self;
  5103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5104. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  5105. //>>excludeEnd("ctx");
  5106. },
  5107. //>>excludeStart("ide", pragmas.excludeIdeData);
  5108. args: [],
  5109. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  5110. referencedClasses: [],
  5111. //>>excludeEnd("ide");
  5112. messageSends: []
  5113. }),
  5114. $globals.Array);
  5115. $core.addMethod(
  5116. $core.method({
  5117. selector: "sort",
  5118. protocol: "enumerating",
  5119. fn: function (){
  5120. var self=this,$self=this;
  5121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5122. return $core.withContext(function($ctx1) {
  5123. //>>excludeEnd("ctx");
  5124. return $self._sort_((function(a,b){
  5125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5126. return $core.withContext(function($ctx2) {
  5127. //>>excludeEnd("ctx");
  5128. return $recv(a).__lt(b);
  5129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5130. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5131. //>>excludeEnd("ctx");
  5132. }));
  5133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5134. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  5135. //>>excludeEnd("ctx");
  5136. },
  5137. //>>excludeStart("ide", pragmas.excludeIdeData);
  5138. args: [],
  5139. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5140. referencedClasses: [],
  5141. //>>excludeEnd("ide");
  5142. messageSends: ["sort:", "<"]
  5143. }),
  5144. $globals.Array);
  5145. $core.addMethod(
  5146. $core.method({
  5147. selector: "sort:",
  5148. protocol: "enumerating",
  5149. fn: function (aBlock){
  5150. var self=this,$self=this;
  5151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5152. return $core.withContext(function($ctx1) {
  5153. //>>excludeEnd("ctx");
  5154. return self.sort(function(a, b) {
  5155. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5156. })
  5157. ;
  5158. return self;
  5159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5160. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5161. //>>excludeEnd("ctx");
  5162. },
  5163. //>>excludeStart("ide", pragmas.excludeIdeData);
  5164. args: ["aBlock"],
  5165. 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'>",
  5166. referencedClasses: [],
  5167. //>>excludeEnd("ide");
  5168. messageSends: []
  5169. }),
  5170. $globals.Array);
  5171. $core.addMethod(
  5172. $core.method({
  5173. selector: "sorted",
  5174. protocol: "enumerating",
  5175. fn: function (){
  5176. var self=this,$self=this;
  5177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5178. return $core.withContext(function($ctx1) {
  5179. //>>excludeEnd("ctx");
  5180. return $recv($self._copy())._sort();
  5181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5182. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5183. //>>excludeEnd("ctx");
  5184. },
  5185. //>>excludeStart("ide", pragmas.excludeIdeData);
  5186. args: [],
  5187. source: "sorted\x0a\x09^ self copy sort",
  5188. referencedClasses: [],
  5189. //>>excludeEnd("ide");
  5190. messageSends: ["sort", "copy"]
  5191. }),
  5192. $globals.Array);
  5193. $core.addMethod(
  5194. $core.method({
  5195. selector: "sorted:",
  5196. protocol: "enumerating",
  5197. fn: function (aBlock){
  5198. var self=this,$self=this;
  5199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5200. return $core.withContext(function($ctx1) {
  5201. //>>excludeEnd("ctx");
  5202. return $recv($self._copy())._sort_(aBlock);
  5203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5204. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5205. //>>excludeEnd("ctx");
  5206. },
  5207. //>>excludeStart("ide", pragmas.excludeIdeData);
  5208. args: ["aBlock"],
  5209. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5210. referencedClasses: [],
  5211. //>>excludeEnd("ide");
  5212. messageSends: ["sort:", "copy"]
  5213. }),
  5214. $globals.Array);
  5215. $core.addMethod(
  5216. $core.method({
  5217. selector: "new:",
  5218. protocol: "instance creation",
  5219. fn: function (anInteger){
  5220. var self=this,$self=this;
  5221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5222. return $core.withContext(function($ctx1) {
  5223. //>>excludeEnd("ctx");
  5224. return new Array(anInteger);
  5225. return self;
  5226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5227. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  5228. //>>excludeEnd("ctx");
  5229. },
  5230. //>>excludeStart("ide", pragmas.excludeIdeData);
  5231. args: ["anInteger"],
  5232. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5233. referencedClasses: [],
  5234. //>>excludeEnd("ide");
  5235. messageSends: []
  5236. }),
  5237. $globals.Array.a$cls);
  5238. $core.addMethod(
  5239. $core.method({
  5240. selector: "with:",
  5241. protocol: "instance creation",
  5242. fn: function (anObject){
  5243. var self=this,$self=this;
  5244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5245. return $core.withContext(function($ctx1) {
  5246. //>>excludeEnd("ctx");
  5247. var $1;
  5248. $1=$self._new_((1));
  5249. $recv($1)._at_put_((1),anObject);
  5250. return $recv($1)._yourself();
  5251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5252. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  5253. //>>excludeEnd("ctx");
  5254. },
  5255. //>>excludeStart("ide", pragmas.excludeIdeData);
  5256. args: ["anObject"],
  5257. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5258. referencedClasses: [],
  5259. //>>excludeEnd("ide");
  5260. messageSends: ["at:put:", "new:", "yourself"]
  5261. }),
  5262. $globals.Array.a$cls);
  5263. $core.addMethod(
  5264. $core.method({
  5265. selector: "with:with:",
  5266. protocol: "instance creation",
  5267. fn: function (anObject,anObject2){
  5268. var self=this,$self=this;
  5269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5270. return $core.withContext(function($ctx1) {
  5271. //>>excludeEnd("ctx");
  5272. var $1;
  5273. $1=$self._new_((2));
  5274. $recv($1)._at_put_((1),anObject);
  5275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5276. $ctx1.sendIdx["at:put:"]=1;
  5277. //>>excludeEnd("ctx");
  5278. $recv($1)._at_put_((2),anObject2);
  5279. return $recv($1)._yourself();
  5280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5281. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  5282. //>>excludeEnd("ctx");
  5283. },
  5284. //>>excludeStart("ide", pragmas.excludeIdeData);
  5285. args: ["anObject", "anObject2"],
  5286. 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",
  5287. referencedClasses: [],
  5288. //>>excludeEnd("ide");
  5289. messageSends: ["at:put:", "new:", "yourself"]
  5290. }),
  5291. $globals.Array.a$cls);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "with:with:with:",
  5295. protocol: "instance creation",
  5296. fn: function (anObject,anObject2,anObject3){
  5297. var self=this,$self=this;
  5298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5299. return $core.withContext(function($ctx1) {
  5300. //>>excludeEnd("ctx");
  5301. var $1;
  5302. $1=$self._new_((3));
  5303. $recv($1)._at_put_((1),anObject);
  5304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5305. $ctx1.sendIdx["at:put:"]=1;
  5306. //>>excludeEnd("ctx");
  5307. $recv($1)._at_put_((2),anObject2);
  5308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5309. $ctx1.sendIdx["at:put:"]=2;
  5310. //>>excludeEnd("ctx");
  5311. $recv($1)._at_put_((3),anObject3);
  5312. return $recv($1)._yourself();
  5313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5314. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  5315. //>>excludeEnd("ctx");
  5316. },
  5317. //>>excludeStart("ide", pragmas.excludeIdeData);
  5318. args: ["anObject", "anObject2", "anObject3"],
  5319. 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",
  5320. referencedClasses: [],
  5321. //>>excludeEnd("ide");
  5322. messageSends: ["at:put:", "new:", "yourself"]
  5323. }),
  5324. $globals.Array.a$cls);
  5325. $core.addMethod(
  5326. $core.method({
  5327. selector: "withAll:",
  5328. protocol: "instance creation",
  5329. fn: function (aCollection){
  5330. var self=this,$self=this;
  5331. var instance,index;
  5332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5333. return $core.withContext(function($ctx1) {
  5334. //>>excludeEnd("ctx");
  5335. index=(1);
  5336. instance=$self._new_($recv(aCollection)._size());
  5337. $recv(aCollection)._do_((function(each){
  5338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5339. return $core.withContext(function($ctx2) {
  5340. //>>excludeEnd("ctx");
  5341. $recv(instance)._at_put_(index,each);
  5342. index=$recv(index).__plus((1));
  5343. return index;
  5344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5345. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5346. //>>excludeEnd("ctx");
  5347. }));
  5348. return instance;
  5349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5350. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  5351. //>>excludeEnd("ctx");
  5352. },
  5353. //>>excludeStart("ide", pragmas.excludeIdeData);
  5354. args: ["aCollection"],
  5355. 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",
  5356. referencedClasses: [],
  5357. //>>excludeEnd("ide");
  5358. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5359. }),
  5360. $globals.Array.a$cls);
  5361. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  5362. //>>excludeStart("ide", pragmas.excludeIdeData);
  5363. $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 >> #,`";
  5364. //>>excludeEnd("ide");
  5365. $core.addMethod(
  5366. $core.method({
  5367. selector: ",",
  5368. protocol: "copying",
  5369. fn: function (aString){
  5370. var self=this,$self=this;
  5371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5372. return $core.withContext(function($ctx1) {
  5373. //>>excludeEnd("ctx");
  5374. return String(self) + aString;
  5375. return self;
  5376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5377. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5378. //>>excludeEnd("ctx");
  5379. },
  5380. //>>excludeStart("ide", pragmas.excludeIdeData);
  5381. args: ["aString"],
  5382. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5383. referencedClasses: [],
  5384. //>>excludeEnd("ide");
  5385. messageSends: []
  5386. }),
  5387. $globals.String);
  5388. $core.addMethod(
  5389. $core.method({
  5390. selector: "<",
  5391. protocol: "comparing",
  5392. fn: function (aString){
  5393. var self=this,$self=this;
  5394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5395. return $core.withContext(function($ctx1) {
  5396. //>>excludeEnd("ctx");
  5397. return String(self) < aString._asString();
  5398. return self;
  5399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5400. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5401. //>>excludeEnd("ctx");
  5402. },
  5403. //>>excludeStart("ide", pragmas.excludeIdeData);
  5404. args: ["aString"],
  5405. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5406. referencedClasses: [],
  5407. //>>excludeEnd("ide");
  5408. messageSends: []
  5409. }),
  5410. $globals.String);
  5411. $core.addMethod(
  5412. $core.method({
  5413. selector: "<=",
  5414. protocol: "comparing",
  5415. fn: function (aString){
  5416. var self=this,$self=this;
  5417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5418. return $core.withContext(function($ctx1) {
  5419. //>>excludeEnd("ctx");
  5420. return String(self) <= aString._asString();
  5421. return self;
  5422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5423. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5424. //>>excludeEnd("ctx");
  5425. },
  5426. //>>excludeStart("ide", pragmas.excludeIdeData);
  5427. args: ["aString"],
  5428. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5429. referencedClasses: [],
  5430. //>>excludeEnd("ide");
  5431. messageSends: []
  5432. }),
  5433. $globals.String);
  5434. $core.addMethod(
  5435. $core.method({
  5436. selector: "=",
  5437. protocol: "comparing",
  5438. fn: function (aString){
  5439. var self=this,$self=this;
  5440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5441. return $core.withContext(function($ctx1) {
  5442. //>>excludeEnd("ctx");
  5443. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5444. return self;
  5445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5446. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5447. //>>excludeEnd("ctx");
  5448. },
  5449. //>>excludeStart("ide", pragmas.excludeIdeData);
  5450. args: ["aString"],
  5451. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5452. referencedClasses: [],
  5453. //>>excludeEnd("ide");
  5454. messageSends: []
  5455. }),
  5456. $globals.String);
  5457. $core.addMethod(
  5458. $core.method({
  5459. selector: "==",
  5460. protocol: "comparing",
  5461. fn: function (aString){
  5462. var self=this,$self=this;
  5463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5464. return $core.withContext(function($ctx1) {
  5465. //>>excludeEnd("ctx");
  5466. if (typeof aString === "string") return String(self) === aString;
  5467. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5468. else return false;;
  5469. return self;
  5470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5471. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5472. //>>excludeEnd("ctx");
  5473. },
  5474. //>>excludeStart("ide", pragmas.excludeIdeData);
  5475. args: ["aString"],
  5476. 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'>",
  5477. referencedClasses: [],
  5478. //>>excludeEnd("ide");
  5479. messageSends: []
  5480. }),
  5481. $globals.String);
  5482. $core.addMethod(
  5483. $core.method({
  5484. selector: ">",
  5485. protocol: "comparing",
  5486. fn: function (aString){
  5487. var self=this,$self=this;
  5488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5489. return $core.withContext(function($ctx1) {
  5490. //>>excludeEnd("ctx");
  5491. return String(self) > aString._asString();
  5492. return self;
  5493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5494. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5495. //>>excludeEnd("ctx");
  5496. },
  5497. //>>excludeStart("ide", pragmas.excludeIdeData);
  5498. args: ["aString"],
  5499. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5500. referencedClasses: [],
  5501. //>>excludeEnd("ide");
  5502. messageSends: []
  5503. }),
  5504. $globals.String);
  5505. $core.addMethod(
  5506. $core.method({
  5507. selector: ">=",
  5508. protocol: "comparing",
  5509. fn: function (aString){
  5510. var self=this,$self=this;
  5511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5512. return $core.withContext(function($ctx1) {
  5513. //>>excludeEnd("ctx");
  5514. return String(self) >= aString._asString();
  5515. return self;
  5516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5517. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5518. //>>excludeEnd("ctx");
  5519. },
  5520. //>>excludeStart("ide", pragmas.excludeIdeData);
  5521. args: ["aString"],
  5522. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5523. referencedClasses: [],
  5524. //>>excludeEnd("ide");
  5525. messageSends: []
  5526. }),
  5527. $globals.String);
  5528. $core.addMethod(
  5529. $core.method({
  5530. selector: "add:",
  5531. protocol: "adding/removing",
  5532. fn: function (anObject){
  5533. var self=this,$self=this;
  5534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5535. return $core.withContext(function($ctx1) {
  5536. //>>excludeEnd("ctx");
  5537. $self._errorReadOnly();
  5538. return self;
  5539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5540. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.String)});
  5541. //>>excludeEnd("ctx");
  5542. },
  5543. //>>excludeStart("ide", pragmas.excludeIdeData);
  5544. args: ["anObject"],
  5545. source: "add: anObject\x0a\x09self errorReadOnly",
  5546. referencedClasses: [],
  5547. //>>excludeEnd("ide");
  5548. messageSends: ["errorReadOnly"]
  5549. }),
  5550. $globals.String);
  5551. $core.addMethod(
  5552. $core.method({
  5553. selector: "asJavaScriptMethodName",
  5554. protocol: "converting",
  5555. fn: function (){
  5556. var self=this,$self=this;
  5557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5558. return $core.withContext(function($ctx1) {
  5559. //>>excludeEnd("ctx");
  5560. return $core.st2js(self);
  5561. return self;
  5562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5563. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5564. //>>excludeEnd("ctx");
  5565. },
  5566. //>>excludeStart("ide", pragmas.excludeIdeData);
  5567. args: [],
  5568. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5569. referencedClasses: [],
  5570. //>>excludeEnd("ide");
  5571. messageSends: []
  5572. }),
  5573. $globals.String);
  5574. $core.addMethod(
  5575. $core.method({
  5576. selector: "asJavaScriptObject",
  5577. protocol: "converting",
  5578. fn: function (){
  5579. var self=this,$self=this;
  5580. return self;
  5581. },
  5582. //>>excludeStart("ide", pragmas.excludeIdeData);
  5583. args: [],
  5584. source: "asJavaScriptObject\x0a\x09^ self",
  5585. referencedClasses: [],
  5586. //>>excludeEnd("ide");
  5587. messageSends: []
  5588. }),
  5589. $globals.String);
  5590. $core.addMethod(
  5591. $core.method({
  5592. selector: "asJavaScriptSource",
  5593. protocol: "converting",
  5594. fn: function (){
  5595. var self=this,$self=this;
  5596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5597. return $core.withContext(function($ctx1) {
  5598. //>>excludeEnd("ctx");
  5599. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5600. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5601. else
  5602. return "\"" + self + "\"";
  5603. ;
  5604. return self;
  5605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5606. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  5607. //>>excludeEnd("ctx");
  5608. },
  5609. //>>excludeStart("ide", pragmas.excludeIdeData);
  5610. args: [],
  5611. 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'>",
  5612. referencedClasses: [],
  5613. //>>excludeEnd("ide");
  5614. messageSends: []
  5615. }),
  5616. $globals.String);
  5617. $core.addMethod(
  5618. $core.method({
  5619. selector: "asLowercase",
  5620. protocol: "converting",
  5621. fn: function (){
  5622. var self=this,$self=this;
  5623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5624. return $core.withContext(function($ctx1) {
  5625. //>>excludeEnd("ctx");
  5626. return self.toLowerCase();
  5627. return self;
  5628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5629. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5630. //>>excludeEnd("ctx");
  5631. },
  5632. //>>excludeStart("ide", pragmas.excludeIdeData);
  5633. args: [],
  5634. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5635. referencedClasses: [],
  5636. //>>excludeEnd("ide");
  5637. messageSends: []
  5638. }),
  5639. $globals.String);
  5640. $core.addMethod(
  5641. $core.method({
  5642. selector: "asMutator",
  5643. protocol: "converting",
  5644. fn: function (){
  5645. var self=this,$self=this;
  5646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5647. return $core.withContext(function($ctx1) {
  5648. //>>excludeEnd("ctx");
  5649. var $1;
  5650. $1=$recv($self._last()).__eq(":");
  5651. if(!$core.assert($1)){
  5652. return $self.__comma(":");
  5653. }
  5654. return self;
  5655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5656. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5657. //>>excludeEnd("ctx");
  5658. },
  5659. //>>excludeStart("ide", pragmas.excludeIdeData);
  5660. args: [],
  5661. 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",
  5662. referencedClasses: [],
  5663. //>>excludeEnd("ide");
  5664. messageSends: ["ifFalse:", "=", "last", ","]
  5665. }),
  5666. $globals.String);
  5667. $core.addMethod(
  5668. $core.method({
  5669. selector: "asNumber",
  5670. protocol: "converting",
  5671. fn: function (){
  5672. var self=this,$self=this;
  5673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5674. return $core.withContext(function($ctx1) {
  5675. //>>excludeEnd("ctx");
  5676. return Number(self);
  5677. return self;
  5678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5679. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5680. //>>excludeEnd("ctx");
  5681. },
  5682. //>>excludeStart("ide", pragmas.excludeIdeData);
  5683. args: [],
  5684. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5685. referencedClasses: [],
  5686. //>>excludeEnd("ide");
  5687. messageSends: []
  5688. }),
  5689. $globals.String);
  5690. $core.addMethod(
  5691. $core.method({
  5692. selector: "asRegexp",
  5693. protocol: "converting",
  5694. fn: function (){
  5695. var self=this,$self=this;
  5696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5697. return $core.withContext(function($ctx1) {
  5698. //>>excludeEnd("ctx");
  5699. return $recv($globals.RegularExpression)._fromString_(self);
  5700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5701. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5702. //>>excludeEnd("ctx");
  5703. },
  5704. //>>excludeStart("ide", pragmas.excludeIdeData);
  5705. args: [],
  5706. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5707. referencedClasses: ["RegularExpression"],
  5708. //>>excludeEnd("ide");
  5709. messageSends: ["fromString:"]
  5710. }),
  5711. $globals.String);
  5712. $core.addMethod(
  5713. $core.method({
  5714. selector: "asString",
  5715. protocol: "converting",
  5716. fn: function (){
  5717. var self=this,$self=this;
  5718. return self;
  5719. },
  5720. //>>excludeStart("ide", pragmas.excludeIdeData);
  5721. args: [],
  5722. source: "asString\x0a\x09^ self",
  5723. referencedClasses: [],
  5724. //>>excludeEnd("ide");
  5725. messageSends: []
  5726. }),
  5727. $globals.String);
  5728. $core.addMethod(
  5729. $core.method({
  5730. selector: "asSymbol",
  5731. protocol: "converting",
  5732. fn: function (){
  5733. var self=this,$self=this;
  5734. return self;
  5735. },
  5736. //>>excludeStart("ide", pragmas.excludeIdeData);
  5737. args: [],
  5738. source: "asSymbol\x0a\x09^ self",
  5739. referencedClasses: [],
  5740. //>>excludeEnd("ide");
  5741. messageSends: []
  5742. }),
  5743. $globals.String);
  5744. $core.addMethod(
  5745. $core.method({
  5746. selector: "asSymbolPrintOn:",
  5747. protocol: "printing",
  5748. fn: function (aStream){
  5749. var self=this,$self=this;
  5750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5751. return $core.withContext(function($ctx1) {
  5752. //>>excludeEnd("ctx");
  5753. var $1;
  5754. $recv(aStream)._nextPutAll_("#");
  5755. $1=$recv($self._asString())._isSelector();
  5756. if($core.assert($1)){
  5757. $recv(aStream)._nextPut_(self);
  5758. } else {
  5759. $self._printOn_(aStream);
  5760. }
  5761. return self;
  5762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5763. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.String)});
  5764. //>>excludeEnd("ctx");
  5765. },
  5766. //>>excludeStart("ide", pragmas.excludeIdeData);
  5767. args: ["aStream"],
  5768. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5769. referencedClasses: [],
  5770. //>>excludeEnd("ide");
  5771. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5772. }),
  5773. $globals.String);
  5774. $core.addMethod(
  5775. $core.method({
  5776. selector: "asUppercase",
  5777. protocol: "converting",
  5778. fn: function (){
  5779. var self=this,$self=this;
  5780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5781. return $core.withContext(function($ctx1) {
  5782. //>>excludeEnd("ctx");
  5783. return self.toUpperCase();
  5784. return self;
  5785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5786. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5787. //>>excludeEnd("ctx");
  5788. },
  5789. //>>excludeStart("ide", pragmas.excludeIdeData);
  5790. args: [],
  5791. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5792. referencedClasses: [],
  5793. //>>excludeEnd("ide");
  5794. messageSends: []
  5795. }),
  5796. $globals.String);
  5797. $core.addMethod(
  5798. $core.method({
  5799. selector: "asciiValue",
  5800. protocol: "accessing",
  5801. fn: function (){
  5802. var self=this,$self=this;
  5803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5804. return $core.withContext(function($ctx1) {
  5805. //>>excludeEnd("ctx");
  5806. return self.charCodeAt(0);;
  5807. return self;
  5808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5809. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5810. //>>excludeEnd("ctx");
  5811. },
  5812. //>>excludeStart("ide", pragmas.excludeIdeData);
  5813. args: [],
  5814. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5815. referencedClasses: [],
  5816. //>>excludeEnd("ide");
  5817. messageSends: []
  5818. }),
  5819. $globals.String);
  5820. $core.addMethod(
  5821. $core.method({
  5822. selector: "at:ifAbsent:",
  5823. protocol: "accessing",
  5824. fn: function (anIndex,aBlock){
  5825. var self=this,$self=this;
  5826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5827. return $core.withContext(function($ctx1) {
  5828. //>>excludeEnd("ctx");
  5829. return String(self)[anIndex - 1] || aBlock._value();
  5830. return self;
  5831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5832. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5833. //>>excludeEnd("ctx");
  5834. },
  5835. //>>excludeStart("ide", pragmas.excludeIdeData);
  5836. args: ["anIndex", "aBlock"],
  5837. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5838. referencedClasses: [],
  5839. //>>excludeEnd("ide");
  5840. messageSends: []
  5841. }),
  5842. $globals.String);
  5843. $core.addMethod(
  5844. $core.method({
  5845. selector: "at:ifPresent:ifAbsent:",
  5846. protocol: "accessing",
  5847. fn: function (anIndex,aBlock,anotherBlock){
  5848. var self=this,$self=this;
  5849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5850. return $core.withContext(function($ctx1) {
  5851. //>>excludeEnd("ctx");
  5852. var result = String(self)[anIndex - 1];
  5853. return result ? aBlock._value_(result) : anotherBlock._value();
  5854. ;
  5855. return self;
  5856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5857. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5858. //>>excludeEnd("ctx");
  5859. },
  5860. //>>excludeStart("ide", pragmas.excludeIdeData);
  5861. args: ["anIndex", "aBlock", "anotherBlock"],
  5862. 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'>",
  5863. referencedClasses: [],
  5864. //>>excludeEnd("ide");
  5865. messageSends: []
  5866. }),
  5867. $globals.String);
  5868. $core.addMethod(
  5869. $core.method({
  5870. selector: "at:put:",
  5871. protocol: "accessing",
  5872. fn: function (anIndex,anObject){
  5873. var self=this,$self=this;
  5874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5875. return $core.withContext(function($ctx1) {
  5876. //>>excludeEnd("ctx");
  5877. $self._errorReadOnly();
  5878. return self;
  5879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5880. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.String)});
  5881. //>>excludeEnd("ctx");
  5882. },
  5883. //>>excludeStart("ide", pragmas.excludeIdeData);
  5884. args: ["anIndex", "anObject"],
  5885. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5886. referencedClasses: [],
  5887. //>>excludeEnd("ide");
  5888. messageSends: ["errorReadOnly"]
  5889. }),
  5890. $globals.String);
  5891. $core.addMethod(
  5892. $core.method({
  5893. selector: "capitalized",
  5894. protocol: "converting",
  5895. fn: function (){
  5896. var self=this,$self=this;
  5897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5898. return $core.withContext(function($ctx1) {
  5899. //>>excludeEnd("ctx");
  5900. return $self._ifNotEmpty_((function(){
  5901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5902. return $core.withContext(function($ctx2) {
  5903. //>>excludeEnd("ctx");
  5904. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5907. //>>excludeEnd("ctx");
  5908. }));
  5909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5910. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5911. //>>excludeEnd("ctx");
  5912. },
  5913. //>>excludeStart("ide", pragmas.excludeIdeData);
  5914. args: [],
  5915. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5916. referencedClasses: [],
  5917. //>>excludeEnd("ide");
  5918. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5919. }),
  5920. $globals.String);
  5921. $core.addMethod(
  5922. $core.method({
  5923. selector: "charCodeAt:",
  5924. protocol: "accessing",
  5925. fn: function (anInteger){
  5926. var self=this,$self=this;
  5927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5928. return $core.withContext(function($ctx1) {
  5929. //>>excludeEnd("ctx");
  5930. return self.charCodeAt(anInteger - 1);
  5931. return self;
  5932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5933. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  5934. //>>excludeEnd("ctx");
  5935. },
  5936. //>>excludeStart("ide", pragmas.excludeIdeData);
  5937. args: ["anInteger"],
  5938. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5939. referencedClasses: [],
  5940. //>>excludeEnd("ide");
  5941. messageSends: []
  5942. }),
  5943. $globals.String);
  5944. $core.addMethod(
  5945. $core.method({
  5946. selector: "copyFrom:to:",
  5947. protocol: "copying",
  5948. fn: function (anIndex,anotherIndex){
  5949. var self=this,$self=this;
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. return $core.withContext(function($ctx1) {
  5952. //>>excludeEnd("ctx");
  5953. return self.substring(anIndex - 1, anotherIndex);
  5954. return self;
  5955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5956. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  5957. //>>excludeEnd("ctx");
  5958. },
  5959. //>>excludeStart("ide", pragmas.excludeIdeData);
  5960. args: ["anIndex", "anotherIndex"],
  5961. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5962. referencedClasses: [],
  5963. //>>excludeEnd("ide");
  5964. messageSends: []
  5965. }),
  5966. $globals.String);
  5967. $core.addMethod(
  5968. $core.method({
  5969. selector: "crlfSanitized",
  5970. protocol: "converting",
  5971. fn: function (){
  5972. var self=this,$self=this;
  5973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5974. return $core.withContext(function($ctx1) {
  5975. //>>excludeEnd("ctx");
  5976. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5978. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  5979. //>>excludeEnd("ctx");
  5980. },
  5981. //>>excludeStart("ide", pragmas.excludeIdeData);
  5982. args: [],
  5983. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5984. referencedClasses: ["String"],
  5985. //>>excludeEnd("ide");
  5986. messageSends: ["join:", "lines", "lf"]
  5987. }),
  5988. $globals.String);
  5989. $core.addMethod(
  5990. $core.method({
  5991. selector: "deepCopy",
  5992. protocol: "copying",
  5993. fn: function (){
  5994. var self=this,$self=this;
  5995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5996. return $core.withContext(function($ctx1) {
  5997. //>>excludeEnd("ctx");
  5998. return $self._shallowCopy();
  5999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6000. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6001. //>>excludeEnd("ctx");
  6002. },
  6003. //>>excludeStart("ide", pragmas.excludeIdeData);
  6004. args: [],
  6005. source: "deepCopy\x0a\x09^ self shallowCopy",
  6006. referencedClasses: [],
  6007. //>>excludeEnd("ide");
  6008. messageSends: ["shallowCopy"]
  6009. }),
  6010. $globals.String);
  6011. $core.addMethod(
  6012. $core.method({
  6013. selector: "errorReadOnly",
  6014. protocol: "error handling",
  6015. fn: function (){
  6016. var self=this,$self=this;
  6017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6018. return $core.withContext(function($ctx1) {
  6019. //>>excludeEnd("ctx");
  6020. $self._error_("Object is read-only");
  6021. return self;
  6022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6023. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.String)});
  6024. //>>excludeEnd("ctx");
  6025. },
  6026. //>>excludeStart("ide", pragmas.excludeIdeData);
  6027. args: [],
  6028. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  6029. referencedClasses: [],
  6030. //>>excludeEnd("ide");
  6031. messageSends: ["error:"]
  6032. }),
  6033. $globals.String);
  6034. $core.addMethod(
  6035. $core.method({
  6036. selector: "escaped",
  6037. protocol: "converting",
  6038. fn: function (){
  6039. var self=this,$self=this;
  6040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6041. return $core.withContext(function($ctx1) {
  6042. //>>excludeEnd("ctx");
  6043. return escape(self);
  6044. return self;
  6045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6046. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6047. //>>excludeEnd("ctx");
  6048. },
  6049. //>>excludeStart("ide", pragmas.excludeIdeData);
  6050. args: [],
  6051. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  6052. referencedClasses: [],
  6053. //>>excludeEnd("ide");
  6054. messageSends: []
  6055. }),
  6056. $globals.String);
  6057. $core.addMethod(
  6058. $core.method({
  6059. selector: "includesSubString:",
  6060. protocol: "testing",
  6061. fn: function (subString){
  6062. var self=this,$self=this;
  6063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6064. return $core.withContext(function($ctx1) {
  6065. //>>excludeEnd("ctx");
  6066. return self.indexOf(subString) != -1;
  6067. return self;
  6068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6069. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6070. //>>excludeEnd("ctx");
  6071. },
  6072. //>>excludeStart("ide", pragmas.excludeIdeData);
  6073. args: ["subString"],
  6074. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  6075. referencedClasses: [],
  6076. //>>excludeEnd("ide");
  6077. messageSends: []
  6078. }),
  6079. $globals.String);
  6080. $core.addMethod(
  6081. $core.method({
  6082. selector: "isCapitalized",
  6083. protocol: "testing",
  6084. fn: function (){
  6085. var self=this,$self=this;
  6086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6087. return $core.withContext(function($ctx1) {
  6088. //>>excludeEnd("ctx");
  6089. var $2,$1;
  6090. $2=$self._first();
  6091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6092. $ctx1.sendIdx["first"]=1;
  6093. //>>excludeEnd("ctx");
  6094. $1=$recv($2)._asUppercase();
  6095. return $recv($1).__eq_eq($self._first());
  6096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6097. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6098. //>>excludeEnd("ctx");
  6099. },
  6100. //>>excludeStart("ide", pragmas.excludeIdeData);
  6101. args: [],
  6102. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6103. referencedClasses: [],
  6104. //>>excludeEnd("ide");
  6105. messageSends: ["==", "asUppercase", "first"]
  6106. }),
  6107. $globals.String);
  6108. $core.addMethod(
  6109. $core.method({
  6110. selector: "isImmutable",
  6111. protocol: "testing",
  6112. fn: function (){
  6113. var self=this,$self=this;
  6114. return true;
  6115. },
  6116. //>>excludeStart("ide", pragmas.excludeIdeData);
  6117. args: [],
  6118. source: "isImmutable\x0a\x09^ true",
  6119. referencedClasses: [],
  6120. //>>excludeEnd("ide");
  6121. messageSends: []
  6122. }),
  6123. $globals.String);
  6124. $core.addMethod(
  6125. $core.method({
  6126. selector: "isSelector",
  6127. protocol: "testing",
  6128. fn: function (){
  6129. var self=this,$self=this;
  6130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6131. return $core.withContext(function($ctx1) {
  6132. //>>excludeEnd("ctx");
  6133. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  6134. return self;
  6135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6136. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  6137. //>>excludeEnd("ctx");
  6138. },
  6139. //>>excludeStart("ide", pragmas.excludeIdeData);
  6140. args: [],
  6141. 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>",
  6142. referencedClasses: [],
  6143. //>>excludeEnd("ide");
  6144. messageSends: []
  6145. }),
  6146. $globals.String);
  6147. $core.addMethod(
  6148. $core.method({
  6149. selector: "isString",
  6150. protocol: "testing",
  6151. fn: function (){
  6152. var self=this,$self=this;
  6153. return true;
  6154. },
  6155. //>>excludeStart("ide", pragmas.excludeIdeData);
  6156. args: [],
  6157. source: "isString\x0a\x09^ true",
  6158. referencedClasses: [],
  6159. //>>excludeEnd("ide");
  6160. messageSends: []
  6161. }),
  6162. $globals.String);
  6163. $core.addMethod(
  6164. $core.method({
  6165. selector: "isVowel",
  6166. protocol: "testing",
  6167. fn: function (){
  6168. var self=this,$self=this;
  6169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6170. return $core.withContext(function($ctx1) {
  6171. //>>excludeEnd("ctx");
  6172. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  6173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6174. return $core.withContext(function($ctx2) {
  6175. //>>excludeEnd("ctx");
  6176. return "aeiou"._includes_($self._asLowercase());
  6177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6179. //>>excludeEnd("ctx");
  6180. }));
  6181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6182. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6183. //>>excludeEnd("ctx");
  6184. },
  6185. //>>excludeStart("ide", pragmas.excludeIdeData);
  6186. args: [],
  6187. 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 ]",
  6188. referencedClasses: [],
  6189. //>>excludeEnd("ide");
  6190. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6191. }),
  6192. $globals.String);
  6193. $core.addMethod(
  6194. $core.method({
  6195. selector: "join:",
  6196. protocol: "split join",
  6197. fn: function (aCollection){
  6198. var self=this,$self=this;
  6199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6200. return $core.withContext(function($ctx1) {
  6201. //>>excludeEnd("ctx");
  6202. return $recv($globals.String)._streamContents_((function(stream){
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. return $core.withContext(function($ctx2) {
  6205. //>>excludeEnd("ctx");
  6206. return $recv(aCollection)._do_separatedBy_((function(each){
  6207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6208. return $core.withContext(function($ctx3) {
  6209. //>>excludeEnd("ctx");
  6210. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6212. $ctx3.sendIdx["nextPutAll:"]=1;
  6213. //>>excludeEnd("ctx");
  6214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6215. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6216. //>>excludeEnd("ctx");
  6217. }),(function(){
  6218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6219. return $core.withContext(function($ctx3) {
  6220. //>>excludeEnd("ctx");
  6221. return $recv(stream)._nextPutAll_(self);
  6222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6223. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6224. //>>excludeEnd("ctx");
  6225. }));
  6226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6227. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6228. //>>excludeEnd("ctx");
  6229. }));
  6230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6231. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6232. //>>excludeEnd("ctx");
  6233. },
  6234. //>>excludeStart("ide", pragmas.excludeIdeData);
  6235. args: ["aCollection"],
  6236. 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 ]]",
  6237. referencedClasses: ["String"],
  6238. //>>excludeEnd("ide");
  6239. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6240. }),
  6241. $globals.String);
  6242. $core.addMethod(
  6243. $core.method({
  6244. selector: "lineIndicesDo:",
  6245. protocol: "split join",
  6246. fn: function (aBlock){
  6247. var self=this,$self=this;
  6248. var cr,lf,start,sz,nextLF,nextCR;
  6249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6250. return $core.withContext(function($ctx1) {
  6251. //>>excludeEnd("ctx");
  6252. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6253. var $early={};
  6254. try {
  6255. start=(1);
  6256. sz=$self._size();
  6257. cr=$recv($globals.String)._cr();
  6258. nextCR=$self._indexOf_startingAt_(cr,(1));
  6259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6260. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6261. //>>excludeEnd("ctx");
  6262. lf=$recv($globals.String)._lf();
  6263. nextLF=$self._indexOf_startingAt_(lf,(1));
  6264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6265. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6266. //>>excludeEnd("ctx");
  6267. $recv((function(){
  6268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6269. return $core.withContext(function($ctx2) {
  6270. //>>excludeEnd("ctx");
  6271. return $recv(start).__lt_eq(sz);
  6272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6274. //>>excludeEnd("ctx");
  6275. }))._whileTrue_((function(){
  6276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6277. return $core.withContext(function($ctx2) {
  6278. //>>excludeEnd("ctx");
  6279. $2=$recv(nextLF).__eq((0));
  6280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6281. $ctx2.sendIdx["="]=1;
  6282. //>>excludeEnd("ctx");
  6283. $1=$recv($2)._and_((function(){
  6284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6285. return $core.withContext(function($ctx3) {
  6286. //>>excludeEnd("ctx");
  6287. return $recv(nextCR).__eq((0));
  6288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6289. $ctx3.sendIdx["="]=2;
  6290. //>>excludeEnd("ctx");
  6291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6292. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6293. //>>excludeEnd("ctx");
  6294. }));
  6295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6296. $ctx2.sendIdx["and:"]=1;
  6297. //>>excludeEnd("ctx");
  6298. if($core.assert($1)){
  6299. $recv(aBlock)._value_value_value_(start,sz,sz);
  6300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6301. $ctx2.sendIdx["value:value:value:"]=1;
  6302. //>>excludeEnd("ctx");
  6303. throw $early=[self];
  6304. }
  6305. $4=$recv(nextCR).__eq((0));
  6306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6307. $ctx2.sendIdx["="]=3;
  6308. //>>excludeEnd("ctx");
  6309. $3=$recv($4)._or_((function(){
  6310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6311. return $core.withContext(function($ctx3) {
  6312. //>>excludeEnd("ctx");
  6313. $5=(0).__lt(nextLF);
  6314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6315. $ctx3.sendIdx["<"]=1;
  6316. //>>excludeEnd("ctx");
  6317. return $recv($5)._and_((function(){
  6318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6319. return $core.withContext(function($ctx4) {
  6320. //>>excludeEnd("ctx");
  6321. return $recv(nextLF).__lt(nextCR);
  6322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6323. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6324. //>>excludeEnd("ctx");
  6325. }));
  6326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6327. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6328. //>>excludeEnd("ctx");
  6329. }));
  6330. if($core.assert($3)){
  6331. $6=start;
  6332. $7=$recv(nextLF).__minus((1));
  6333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6334. $ctx2.sendIdx["-"]=1;
  6335. //>>excludeEnd("ctx");
  6336. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6338. $ctx2.sendIdx["value:value:value:"]=2;
  6339. //>>excludeEnd("ctx");
  6340. start=(1).__plus(nextLF);
  6341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6342. $ctx2.sendIdx["+"]=1;
  6343. //>>excludeEnd("ctx");
  6344. nextLF=$self._indexOf_startingAt_(lf,start);
  6345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6346. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6347. //>>excludeEnd("ctx");
  6348. return nextLF;
  6349. } else {
  6350. $9=(1).__plus(nextCR);
  6351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6352. $ctx2.sendIdx["+"]=2;
  6353. //>>excludeEnd("ctx");
  6354. $8=$recv($9).__eq(nextLF);
  6355. if($core.assert($8)){
  6356. $10=start;
  6357. $11=$recv(nextCR).__minus((1));
  6358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6359. $ctx2.sendIdx["-"]=2;
  6360. //>>excludeEnd("ctx");
  6361. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6363. $ctx2.sendIdx["value:value:value:"]=3;
  6364. //>>excludeEnd("ctx");
  6365. start=(1).__plus(nextLF);
  6366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6367. $ctx2.sendIdx["+"]=3;
  6368. //>>excludeEnd("ctx");
  6369. nextCR=$self._indexOf_startingAt_(cr,start);
  6370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6371. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6372. //>>excludeEnd("ctx");
  6373. nextLF=$self._indexOf_startingAt_(lf,start);
  6374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6375. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6376. //>>excludeEnd("ctx");
  6377. return nextLF;
  6378. } else {
  6379. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6380. start=(1).__plus(nextCR);
  6381. nextCR=$self._indexOf_startingAt_(cr,start);
  6382. return nextCR;
  6383. }
  6384. }
  6385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6387. //>>excludeEnd("ctx");
  6388. }));
  6389. return self;
  6390. }
  6391. catch(e) {if(e===$early)return e[0]; throw e}
  6392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6393. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6394. //>>excludeEnd("ctx");
  6395. },
  6396. //>>excludeStart("ide", pragmas.excludeIdeData);
  6397. args: ["aBlock"],
  6398. 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 ] ]]",
  6399. referencedClasses: ["String"],
  6400. //>>excludeEnd("ide");
  6401. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6402. }),
  6403. $globals.String);
  6404. $core.addMethod(
  6405. $core.method({
  6406. selector: "lineNumber:",
  6407. protocol: "split join",
  6408. fn: function (anIndex){
  6409. var self=this,$self=this;
  6410. var lineCount;
  6411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6412. return $core.withContext(function($ctx1) {
  6413. //>>excludeEnd("ctx");
  6414. var $2,$1;
  6415. var $early={};
  6416. try {
  6417. lineCount=(0);
  6418. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6420. return $core.withContext(function($ctx2) {
  6421. //>>excludeEnd("ctx");
  6422. lineCount=$recv(lineCount).__plus((1));
  6423. $2=lineCount;
  6424. $1=$recv($2).__eq(anIndex);
  6425. if($core.assert($1)){
  6426. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6427. }
  6428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6429. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6430. //>>excludeEnd("ctx");
  6431. }));
  6432. return nil;
  6433. }
  6434. catch(e) {if(e===$early)return e[0]; throw e}
  6435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6436. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6437. //>>excludeEnd("ctx");
  6438. },
  6439. //>>excludeStart("ide", pragmas.excludeIdeData);
  6440. args: ["anIndex"],
  6441. 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",
  6442. referencedClasses: [],
  6443. //>>excludeEnd("ide");
  6444. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6445. }),
  6446. $globals.String);
  6447. $core.addMethod(
  6448. $core.method({
  6449. selector: "lines",
  6450. protocol: "split join",
  6451. fn: function (){
  6452. var self=this,$self=this;
  6453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6454. return $core.withContext(function($ctx1) {
  6455. //>>excludeEnd("ctx");
  6456. var result = self.split(/\r\n|\r|\n/);
  6457. if (!result[result.length-1]) result.pop();
  6458. return result;;
  6459. return self;
  6460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6461. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6462. //>>excludeEnd("ctx");
  6463. },
  6464. //>>excludeStart("ide", pragmas.excludeIdeData);
  6465. args: [],
  6466. 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'>",
  6467. referencedClasses: [],
  6468. //>>excludeEnd("ide");
  6469. messageSends: []
  6470. }),
  6471. $globals.String);
  6472. $core.addMethod(
  6473. $core.method({
  6474. selector: "linesDo:",
  6475. protocol: "split join",
  6476. fn: function (aBlock){
  6477. var self=this,$self=this;
  6478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6479. return $core.withContext(function($ctx1) {
  6480. //>>excludeEnd("ctx");
  6481. $recv($self._lines())._do_(aBlock);
  6482. return self;
  6483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6484. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6485. //>>excludeEnd("ctx");
  6486. },
  6487. //>>excludeStart("ide", pragmas.excludeIdeData);
  6488. args: ["aBlock"],
  6489. 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",
  6490. referencedClasses: [],
  6491. //>>excludeEnd("ide");
  6492. messageSends: ["do:", "lines"]
  6493. }),
  6494. $globals.String);
  6495. $core.addMethod(
  6496. $core.method({
  6497. selector: "match:",
  6498. protocol: "regular expressions",
  6499. fn: function (aRegexp){
  6500. var self=this,$self=this;
  6501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6502. return $core.withContext(function($ctx1) {
  6503. //>>excludeEnd("ctx");
  6504. return self.search(aRegexp) != -1;
  6505. return self;
  6506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6507. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6508. //>>excludeEnd("ctx");
  6509. },
  6510. //>>excludeStart("ide", pragmas.excludeIdeData);
  6511. args: ["aRegexp"],
  6512. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6513. referencedClasses: [],
  6514. //>>excludeEnd("ide");
  6515. messageSends: []
  6516. }),
  6517. $globals.String);
  6518. $core.addMethod(
  6519. $core.method({
  6520. selector: "matchesOf:",
  6521. protocol: "regular expressions",
  6522. fn: function (aRegularExpression){
  6523. var self=this,$self=this;
  6524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6525. return $core.withContext(function($ctx1) {
  6526. //>>excludeEnd("ctx");
  6527. return self.match(aRegularExpression);
  6528. return self;
  6529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6530. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6531. //>>excludeEnd("ctx");
  6532. },
  6533. //>>excludeStart("ide", pragmas.excludeIdeData);
  6534. args: ["aRegularExpression"],
  6535. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6536. referencedClasses: [],
  6537. //>>excludeEnd("ide");
  6538. messageSends: []
  6539. }),
  6540. $globals.String);
  6541. $core.addMethod(
  6542. $core.method({
  6543. selector: "printNl",
  6544. protocol: "printing",
  6545. fn: function (){
  6546. var self=this,$self=this;
  6547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6548. return $core.withContext(function($ctx1) {
  6549. //>>excludeEnd("ctx");
  6550. console.log(self);
  6551. return self;
  6552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6553. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6554. //>>excludeEnd("ctx");
  6555. },
  6556. //>>excludeStart("ide", pragmas.excludeIdeData);
  6557. args: [],
  6558. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6559. referencedClasses: [],
  6560. //>>excludeEnd("ide");
  6561. messageSends: []
  6562. }),
  6563. $globals.String);
  6564. $core.addMethod(
  6565. $core.method({
  6566. selector: "printOn:",
  6567. protocol: "printing",
  6568. fn: function (aStream){
  6569. var self=this,$self=this;
  6570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6571. return $core.withContext(function($ctx1) {
  6572. //>>excludeEnd("ctx");
  6573. $recv(aStream)._nextPutAll_("'");
  6574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6575. $ctx1.sendIdx["nextPutAll:"]=1;
  6576. //>>excludeEnd("ctx");
  6577. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6579. $ctx1.sendIdx["nextPutAll:"]=2;
  6580. //>>excludeEnd("ctx");
  6581. $recv(aStream)._nextPutAll_("'");
  6582. return self;
  6583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6584. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6585. //>>excludeEnd("ctx");
  6586. },
  6587. //>>excludeStart("ide", pragmas.excludeIdeData);
  6588. args: ["aStream"],
  6589. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6590. referencedClasses: [],
  6591. //>>excludeEnd("ide");
  6592. messageSends: ["nextPutAll:", "replace:with:"]
  6593. }),
  6594. $globals.String);
  6595. $core.addMethod(
  6596. $core.method({
  6597. selector: "putOn:",
  6598. protocol: "streaming",
  6599. fn: function (aStream){
  6600. var self=this,$self=this;
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. return $core.withContext(function($ctx1) {
  6603. //>>excludeEnd("ctx");
  6604. $recv(aStream)._nextPutString_(self);
  6605. return self;
  6606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6607. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.String)});
  6608. //>>excludeEnd("ctx");
  6609. },
  6610. //>>excludeStart("ide", pragmas.excludeIdeData);
  6611. args: ["aStream"],
  6612. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6613. referencedClasses: [],
  6614. //>>excludeEnd("ide");
  6615. messageSends: ["nextPutString:"]
  6616. }),
  6617. $globals.String);
  6618. $core.addMethod(
  6619. $core.method({
  6620. selector: "remove:",
  6621. protocol: "adding/removing",
  6622. fn: function (anObject){
  6623. var self=this,$self=this;
  6624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6625. return $core.withContext(function($ctx1) {
  6626. //>>excludeEnd("ctx");
  6627. $self._errorReadOnly();
  6628. return self;
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.String)});
  6631. //>>excludeEnd("ctx");
  6632. },
  6633. //>>excludeStart("ide", pragmas.excludeIdeData);
  6634. args: ["anObject"],
  6635. source: "remove: anObject\x0a\x09self errorReadOnly",
  6636. referencedClasses: [],
  6637. //>>excludeEnd("ide");
  6638. messageSends: ["errorReadOnly"]
  6639. }),
  6640. $globals.String);
  6641. $core.addMethod(
  6642. $core.method({
  6643. selector: "remove:ifAbsent:",
  6644. protocol: "adding/removing",
  6645. fn: function (anObject,aBlock){
  6646. var self=this,$self=this;
  6647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6648. return $core.withContext(function($ctx1) {
  6649. //>>excludeEnd("ctx");
  6650. $self._errorReadOnly();
  6651. return self;
  6652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6653. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.String)});
  6654. //>>excludeEnd("ctx");
  6655. },
  6656. //>>excludeStart("ide", pragmas.excludeIdeData);
  6657. args: ["anObject", "aBlock"],
  6658. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6659. referencedClasses: [],
  6660. //>>excludeEnd("ide");
  6661. messageSends: ["errorReadOnly"]
  6662. }),
  6663. $globals.String);
  6664. $core.addMethod(
  6665. $core.method({
  6666. selector: "replace:with:",
  6667. protocol: "regular expressions",
  6668. fn: function (aString,anotherString){
  6669. var self=this,$self=this;
  6670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6671. return $core.withContext(function($ctx1) {
  6672. //>>excludeEnd("ctx");
  6673. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6675. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6676. //>>excludeEnd("ctx");
  6677. },
  6678. //>>excludeStart("ide", pragmas.excludeIdeData);
  6679. args: ["aString", "anotherString"],
  6680. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6681. referencedClasses: ["RegularExpression"],
  6682. //>>excludeEnd("ide");
  6683. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6684. }),
  6685. $globals.String);
  6686. $core.addMethod(
  6687. $core.method({
  6688. selector: "replaceRegexp:with:",
  6689. protocol: "regular expressions",
  6690. fn: function (aRegexp,aString){
  6691. var self=this,$self=this;
  6692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6693. return $core.withContext(function($ctx1) {
  6694. //>>excludeEnd("ctx");
  6695. return self.replace(aRegexp, aString);
  6696. return self;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6699. //>>excludeEnd("ctx");
  6700. },
  6701. //>>excludeStart("ide", pragmas.excludeIdeData);
  6702. args: ["aRegexp", "aString"],
  6703. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6704. referencedClasses: [],
  6705. //>>excludeEnd("ide");
  6706. messageSends: []
  6707. }),
  6708. $globals.String);
  6709. $core.addMethod(
  6710. $core.method({
  6711. selector: "reversed",
  6712. protocol: "converting",
  6713. fn: function (){
  6714. var self=this,$self=this;
  6715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6716. return $core.withContext(function($ctx1) {
  6717. //>>excludeEnd("ctx");
  6718. return self.split("").reverse().join("");
  6719. return self;
  6720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6721. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6722. //>>excludeEnd("ctx");
  6723. },
  6724. //>>excludeStart("ide", pragmas.excludeIdeData);
  6725. args: [],
  6726. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6727. referencedClasses: [],
  6728. //>>excludeEnd("ide");
  6729. messageSends: []
  6730. }),
  6731. $globals.String);
  6732. $core.addMethod(
  6733. $core.method({
  6734. selector: "shallowCopy",
  6735. protocol: "copying",
  6736. fn: function (){
  6737. var self=this,$self=this;
  6738. return self;
  6739. },
  6740. //>>excludeStart("ide", pragmas.excludeIdeData);
  6741. args: [],
  6742. source: "shallowCopy\x0a\x09^ self",
  6743. referencedClasses: [],
  6744. //>>excludeEnd("ide");
  6745. messageSends: []
  6746. }),
  6747. $globals.String);
  6748. $core.addMethod(
  6749. $core.method({
  6750. selector: "size",
  6751. protocol: "accessing",
  6752. fn: function (){
  6753. var self=this,$self=this;
  6754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6755. return $core.withContext(function($ctx1) {
  6756. //>>excludeEnd("ctx");
  6757. return self.length;
  6758. return self;
  6759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6760. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6761. //>>excludeEnd("ctx");
  6762. },
  6763. //>>excludeStart("ide", pragmas.excludeIdeData);
  6764. args: [],
  6765. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  6766. referencedClasses: [],
  6767. //>>excludeEnd("ide");
  6768. messageSends: []
  6769. }),
  6770. $globals.String);
  6771. $core.addMethod(
  6772. $core.method({
  6773. selector: "subStrings:",
  6774. protocol: "split join",
  6775. fn: function (aString){
  6776. var self=this,$self=this;
  6777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6778. return $core.withContext(function($ctx1) {
  6779. //>>excludeEnd("ctx");
  6780. return $self._tokenize_(aString);
  6781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6782. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6783. //>>excludeEnd("ctx");
  6784. },
  6785. //>>excludeStart("ide", pragmas.excludeIdeData);
  6786. args: ["aString"],
  6787. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6788. referencedClasses: [],
  6789. //>>excludeEnd("ide");
  6790. messageSends: ["tokenize:"]
  6791. }),
  6792. $globals.String);
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "symbolPrintString",
  6796. protocol: "printing",
  6797. fn: function (){
  6798. var self=this,$self=this;
  6799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6800. return $core.withContext(function($ctx1) {
  6801. //>>excludeEnd("ctx");
  6802. return $recv($globals.String)._streamContents_((function(str){
  6803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6804. return $core.withContext(function($ctx2) {
  6805. //>>excludeEnd("ctx");
  6806. return $self._asSymbolPrintOn_(str);
  6807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6808. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6809. //>>excludeEnd("ctx");
  6810. }));
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.String)});
  6813. //>>excludeEnd("ctx");
  6814. },
  6815. //>>excludeStart("ide", pragmas.excludeIdeData);
  6816. args: [],
  6817. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6818. referencedClasses: ["String"],
  6819. //>>excludeEnd("ide");
  6820. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6821. }),
  6822. $globals.String);
  6823. $core.addMethod(
  6824. $core.method({
  6825. selector: "tokenize:",
  6826. protocol: "split join",
  6827. fn: function (aString){
  6828. var self=this,$self=this;
  6829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6830. return $core.withContext(function($ctx1) {
  6831. //>>excludeEnd("ctx");
  6832. return self.split(aString);
  6833. return self;
  6834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6835. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6836. //>>excludeEnd("ctx");
  6837. },
  6838. //>>excludeStart("ide", pragmas.excludeIdeData);
  6839. args: ["aString"],
  6840. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6841. referencedClasses: [],
  6842. //>>excludeEnd("ide");
  6843. messageSends: []
  6844. }),
  6845. $globals.String);
  6846. $core.addMethod(
  6847. $core.method({
  6848. selector: "trimBoth",
  6849. protocol: "regular expressions",
  6850. fn: function (){
  6851. var self=this,$self=this;
  6852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6853. return $core.withContext(function($ctx1) {
  6854. //>>excludeEnd("ctx");
  6855. return $self._trimBoth_("\x5cs");
  6856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6857. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6858. //>>excludeEnd("ctx");
  6859. },
  6860. //>>excludeStart("ide", pragmas.excludeIdeData);
  6861. args: [],
  6862. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6863. referencedClasses: [],
  6864. //>>excludeEnd("ide");
  6865. messageSends: ["trimBoth:"]
  6866. }),
  6867. $globals.String);
  6868. $core.addMethod(
  6869. $core.method({
  6870. selector: "trimBoth:",
  6871. protocol: "regular expressions",
  6872. fn: function (separators){
  6873. var self=this,$self=this;
  6874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6875. return $core.withContext(function($ctx1) {
  6876. //>>excludeEnd("ctx");
  6877. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6879. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6880. //>>excludeEnd("ctx");
  6881. },
  6882. //>>excludeStart("ide", pragmas.excludeIdeData);
  6883. args: ["separators"],
  6884. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6885. referencedClasses: [],
  6886. //>>excludeEnd("ide");
  6887. messageSends: ["trimRight:", "trimLeft:"]
  6888. }),
  6889. $globals.String);
  6890. $core.addMethod(
  6891. $core.method({
  6892. selector: "trimLeft",
  6893. protocol: "regular expressions",
  6894. fn: function (){
  6895. var self=this,$self=this;
  6896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6897. return $core.withContext(function($ctx1) {
  6898. //>>excludeEnd("ctx");
  6899. return $self._trimLeft_("\x5cs");
  6900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6901. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6902. //>>excludeEnd("ctx");
  6903. },
  6904. //>>excludeStart("ide", pragmas.excludeIdeData);
  6905. args: [],
  6906. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6907. referencedClasses: [],
  6908. //>>excludeEnd("ide");
  6909. messageSends: ["trimLeft:"]
  6910. }),
  6911. $globals.String);
  6912. $core.addMethod(
  6913. $core.method({
  6914. selector: "trimLeft:",
  6915. protocol: "regular expressions",
  6916. fn: function (separators){
  6917. var self=this,$self=this;
  6918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6919. return $core.withContext(function($ctx1) {
  6920. //>>excludeEnd("ctx");
  6921. var $2,$1;
  6922. $2=$recv("^[".__comma(separators)).__comma("]+");
  6923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6924. $ctx1.sendIdx[","]=1;
  6925. //>>excludeEnd("ctx");
  6926. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6927. return $self._replaceRegexp_with_($1,"");
  6928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6929. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6930. //>>excludeEnd("ctx");
  6931. },
  6932. //>>excludeStart("ide", pragmas.excludeIdeData);
  6933. args: ["separators"],
  6934. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6935. referencedClasses: ["RegularExpression"],
  6936. //>>excludeEnd("ide");
  6937. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6938. }),
  6939. $globals.String);
  6940. $core.addMethod(
  6941. $core.method({
  6942. selector: "trimRight",
  6943. protocol: "regular expressions",
  6944. fn: function (){
  6945. var self=this,$self=this;
  6946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6947. return $core.withContext(function($ctx1) {
  6948. //>>excludeEnd("ctx");
  6949. return $self._trimRight_("\x5cs");
  6950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6951. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6952. //>>excludeEnd("ctx");
  6953. },
  6954. //>>excludeStart("ide", pragmas.excludeIdeData);
  6955. args: [],
  6956. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6957. referencedClasses: [],
  6958. //>>excludeEnd("ide");
  6959. messageSends: ["trimRight:"]
  6960. }),
  6961. $globals.String);
  6962. $core.addMethod(
  6963. $core.method({
  6964. selector: "trimRight:",
  6965. protocol: "regular expressions",
  6966. fn: function (separators){
  6967. var self=this,$self=this;
  6968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6969. return $core.withContext(function($ctx1) {
  6970. //>>excludeEnd("ctx");
  6971. var $2,$1;
  6972. $2=$recv("[".__comma(separators)).__comma("]+$");
  6973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6974. $ctx1.sendIdx[","]=1;
  6975. //>>excludeEnd("ctx");
  6976. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6977. return $self._replaceRegexp_with_($1,"");
  6978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6979. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6980. //>>excludeEnd("ctx");
  6981. },
  6982. //>>excludeStart("ide", pragmas.excludeIdeData);
  6983. args: ["separators"],
  6984. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6985. referencedClasses: ["RegularExpression"],
  6986. //>>excludeEnd("ide");
  6987. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6988. }),
  6989. $globals.String);
  6990. $core.addMethod(
  6991. $core.method({
  6992. selector: "unescaped",
  6993. protocol: "converting",
  6994. fn: function (){
  6995. var self=this,$self=this;
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. return $core.withContext(function($ctx1) {
  6998. //>>excludeEnd("ctx");
  6999. return unescape(self);
  7000. return self;
  7001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7002. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  7003. //>>excludeEnd("ctx");
  7004. },
  7005. //>>excludeStart("ide", pragmas.excludeIdeData);
  7006. args: [],
  7007. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  7008. referencedClasses: [],
  7009. //>>excludeEnd("ide");
  7010. messageSends: []
  7011. }),
  7012. $globals.String);
  7013. $core.addMethod(
  7014. $core.method({
  7015. selector: "uriComponentDecoded",
  7016. protocol: "converting",
  7017. fn: function (){
  7018. var self=this,$self=this;
  7019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7020. return $core.withContext(function($ctx1) {
  7021. //>>excludeEnd("ctx");
  7022. return decodeURIComponent(self);
  7023. return self;
  7024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7025. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7026. //>>excludeEnd("ctx");
  7027. },
  7028. //>>excludeStart("ide", pragmas.excludeIdeData);
  7029. args: [],
  7030. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7031. referencedClasses: [],
  7032. //>>excludeEnd("ide");
  7033. messageSends: []
  7034. }),
  7035. $globals.String);
  7036. $core.addMethod(
  7037. $core.method({
  7038. selector: "uriComponentEncoded",
  7039. protocol: "converting",
  7040. fn: function (){
  7041. var self=this,$self=this;
  7042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7043. return $core.withContext(function($ctx1) {
  7044. //>>excludeEnd("ctx");
  7045. return encodeURIComponent(self);
  7046. return self;
  7047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7048. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7049. //>>excludeEnd("ctx");
  7050. },
  7051. //>>excludeStart("ide", pragmas.excludeIdeData);
  7052. args: [],
  7053. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7054. referencedClasses: [],
  7055. //>>excludeEnd("ide");
  7056. messageSends: []
  7057. }),
  7058. $globals.String);
  7059. $core.addMethod(
  7060. $core.method({
  7061. selector: "uriDecoded",
  7062. protocol: "converting",
  7063. fn: function (){
  7064. var self=this,$self=this;
  7065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7066. return $core.withContext(function($ctx1) {
  7067. //>>excludeEnd("ctx");
  7068. return decodeURI(self);
  7069. return self;
  7070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7071. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7072. //>>excludeEnd("ctx");
  7073. },
  7074. //>>excludeStart("ide", pragmas.excludeIdeData);
  7075. args: [],
  7076. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7077. referencedClasses: [],
  7078. //>>excludeEnd("ide");
  7079. messageSends: []
  7080. }),
  7081. $globals.String);
  7082. $core.addMethod(
  7083. $core.method({
  7084. selector: "uriEncoded",
  7085. protocol: "converting",
  7086. fn: function (){
  7087. var self=this,$self=this;
  7088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7089. return $core.withContext(function($ctx1) {
  7090. //>>excludeEnd("ctx");
  7091. return encodeURI(self);
  7092. return self;
  7093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7094. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7095. //>>excludeEnd("ctx");
  7096. },
  7097. //>>excludeStart("ide", pragmas.excludeIdeData);
  7098. args: [],
  7099. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7100. referencedClasses: [],
  7101. //>>excludeEnd("ide");
  7102. messageSends: []
  7103. }),
  7104. $globals.String);
  7105. $core.addMethod(
  7106. $core.method({
  7107. selector: "value:",
  7108. protocol: "evaluating",
  7109. fn: function (anObject){
  7110. var self=this,$self=this;
  7111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7112. return $core.withContext(function($ctx1) {
  7113. //>>excludeEnd("ctx");
  7114. return $recv(anObject)._perform_(self);
  7115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7116. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7117. //>>excludeEnd("ctx");
  7118. },
  7119. //>>excludeStart("ide", pragmas.excludeIdeData);
  7120. args: ["anObject"],
  7121. source: "value: anObject \x0a\x09^ anObject perform: self",
  7122. referencedClasses: [],
  7123. //>>excludeEnd("ide");
  7124. messageSends: ["perform:"]
  7125. }),
  7126. $globals.String);
  7127. $core.addMethod(
  7128. $core.method({
  7129. selector: "cr",
  7130. protocol: "accessing",
  7131. fn: function (){
  7132. var self=this,$self=this;
  7133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7134. return $core.withContext(function($ctx1) {
  7135. //>>excludeEnd("ctx");
  7136. return "\r";
  7137. return self;
  7138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7139. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  7140. //>>excludeEnd("ctx");
  7141. },
  7142. //>>excludeStart("ide", pragmas.excludeIdeData);
  7143. args: [],
  7144. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7145. referencedClasses: [],
  7146. //>>excludeEnd("ide");
  7147. messageSends: []
  7148. }),
  7149. $globals.String.a$cls);
  7150. $core.addMethod(
  7151. $core.method({
  7152. selector: "crlf",
  7153. protocol: "accessing",
  7154. fn: function (){
  7155. var self=this,$self=this;
  7156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7157. return $core.withContext(function($ctx1) {
  7158. //>>excludeEnd("ctx");
  7159. return "\r\n";
  7160. return self;
  7161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7162. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  7163. //>>excludeEnd("ctx");
  7164. },
  7165. //>>excludeStart("ide", pragmas.excludeIdeData);
  7166. args: [],
  7167. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7168. referencedClasses: [],
  7169. //>>excludeEnd("ide");
  7170. messageSends: []
  7171. }),
  7172. $globals.String.a$cls);
  7173. $core.addMethod(
  7174. $core.method({
  7175. selector: "esc",
  7176. protocol: "accessing",
  7177. fn: function (){
  7178. var self=this,$self=this;
  7179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7180. return $core.withContext(function($ctx1) {
  7181. //>>excludeEnd("ctx");
  7182. return $self._fromCharCode_((27));
  7183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7184. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  7185. //>>excludeEnd("ctx");
  7186. },
  7187. //>>excludeStart("ide", pragmas.excludeIdeData);
  7188. args: [],
  7189. source: "esc\x0a\x09^ self fromCharCode: 27",
  7190. referencedClasses: [],
  7191. //>>excludeEnd("ide");
  7192. messageSends: ["fromCharCode:"]
  7193. }),
  7194. $globals.String.a$cls);
  7195. $core.addMethod(
  7196. $core.method({
  7197. selector: "fromCharCode:",
  7198. protocol: "instance creation",
  7199. fn: function (anInteger){
  7200. var self=this,$self=this;
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return $core.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. return String.fromCharCode(anInteger);
  7205. return self;
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  7208. //>>excludeEnd("ctx");
  7209. },
  7210. //>>excludeStart("ide", pragmas.excludeIdeData);
  7211. args: ["anInteger"],
  7212. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7213. referencedClasses: [],
  7214. //>>excludeEnd("ide");
  7215. messageSends: []
  7216. }),
  7217. $globals.String.a$cls);
  7218. $core.addMethod(
  7219. $core.method({
  7220. selector: "fromString:",
  7221. protocol: "instance creation",
  7222. fn: function (aString){
  7223. var self=this,$self=this;
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. return $core.withContext(function($ctx1) {
  7226. //>>excludeEnd("ctx");
  7227. return String(aString);
  7228. return self;
  7229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7230. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  7231. //>>excludeEnd("ctx");
  7232. },
  7233. //>>excludeStart("ide", pragmas.excludeIdeData);
  7234. args: ["aString"],
  7235. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7236. referencedClasses: [],
  7237. //>>excludeEnd("ide");
  7238. messageSends: []
  7239. }),
  7240. $globals.String.a$cls);
  7241. $core.addMethod(
  7242. $core.method({
  7243. selector: "lf",
  7244. protocol: "accessing",
  7245. fn: function (){
  7246. var self=this,$self=this;
  7247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7248. return $core.withContext(function($ctx1) {
  7249. //>>excludeEnd("ctx");
  7250. return "\n";
  7251. return self;
  7252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7253. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  7254. //>>excludeEnd("ctx");
  7255. },
  7256. //>>excludeStart("ide", pragmas.excludeIdeData);
  7257. args: [],
  7258. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7259. referencedClasses: [],
  7260. //>>excludeEnd("ide");
  7261. messageSends: []
  7262. }),
  7263. $globals.String.a$cls);
  7264. $core.addMethod(
  7265. $core.method({
  7266. selector: "random",
  7267. protocol: "random",
  7268. fn: function (){
  7269. var self=this,$self=this;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. return $core.withContext(function($ctx1) {
  7272. //>>excludeEnd("ctx");
  7273. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7274. return self;
  7275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7276. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  7277. //>>excludeEnd("ctx");
  7278. },
  7279. //>>excludeStart("ide", pragmas.excludeIdeData);
  7280. args: [],
  7281. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  7282. referencedClasses: [],
  7283. //>>excludeEnd("ide");
  7284. messageSends: []
  7285. }),
  7286. $globals.String.a$cls);
  7287. $core.addMethod(
  7288. $core.method({
  7289. selector: "randomNotIn:",
  7290. protocol: "random",
  7291. fn: function (aString){
  7292. var self=this,$self=this;
  7293. var result;
  7294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7295. return $core.withContext(function($ctx1) {
  7296. //>>excludeEnd("ctx");
  7297. $recv((function(){
  7298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7299. return $core.withContext(function($ctx2) {
  7300. //>>excludeEnd("ctx");
  7301. result=$self._random();
  7302. return $recv(aString)._includesSubString_(result);
  7303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7305. //>>excludeEnd("ctx");
  7306. }))._whileTrue();
  7307. return result;
  7308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7309. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  7310. //>>excludeEnd("ctx");
  7311. },
  7312. //>>excludeStart("ide", pragmas.excludeIdeData);
  7313. args: ["aString"],
  7314. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7315. referencedClasses: [],
  7316. //>>excludeEnd("ide");
  7317. messageSends: ["whileTrue", "random", "includesSubString:"]
  7318. }),
  7319. $globals.String.a$cls);
  7320. $core.addMethod(
  7321. $core.method({
  7322. selector: "space",
  7323. protocol: "accessing",
  7324. fn: function (){
  7325. var self=this,$self=this;
  7326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7327. return $core.withContext(function($ctx1) {
  7328. //>>excludeEnd("ctx");
  7329. return " ";
  7330. return self;
  7331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7332. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  7333. //>>excludeEnd("ctx");
  7334. },
  7335. //>>excludeStart("ide", pragmas.excludeIdeData);
  7336. args: [],
  7337. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7338. referencedClasses: [],
  7339. //>>excludeEnd("ide");
  7340. messageSends: []
  7341. }),
  7342. $globals.String.a$cls);
  7343. $core.addMethod(
  7344. $core.method({
  7345. selector: "streamClass",
  7346. protocol: "accessing",
  7347. fn: function (){
  7348. var self=this,$self=this;
  7349. return $globals.StringStream;
  7350. },
  7351. //>>excludeStart("ide", pragmas.excludeIdeData);
  7352. args: [],
  7353. source: "streamClass\x0a\x09\x09^ StringStream",
  7354. referencedClasses: ["StringStream"],
  7355. //>>excludeEnd("ide");
  7356. messageSends: []
  7357. }),
  7358. $globals.String.a$cls);
  7359. $core.addMethod(
  7360. $core.method({
  7361. selector: "tab",
  7362. protocol: "accessing",
  7363. fn: function (){
  7364. var self=this,$self=this;
  7365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7366. return $core.withContext(function($ctx1) {
  7367. //>>excludeEnd("ctx");
  7368. return "\t";
  7369. return self;
  7370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7371. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  7372. //>>excludeEnd("ctx");
  7373. },
  7374. //>>excludeStart("ide", pragmas.excludeIdeData);
  7375. args: [],
  7376. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7377. referencedClasses: [],
  7378. //>>excludeEnd("ide");
  7379. messageSends: []
  7380. }),
  7381. $globals.String.a$cls);
  7382. $core.addMethod(
  7383. $core.method({
  7384. selector: "value:",
  7385. protocol: "instance creation",
  7386. fn: function (aUTFCharCode){
  7387. var self=this,$self=this;
  7388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7389. return $core.withContext(function($ctx1) {
  7390. //>>excludeEnd("ctx");
  7391. return String.fromCharCode(aUTFCharCode);;
  7392. return self;
  7393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7394. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  7395. //>>excludeEnd("ctx");
  7396. },
  7397. //>>excludeStart("ide", pragmas.excludeIdeData);
  7398. args: ["aUTFCharCode"],
  7399. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7400. referencedClasses: [],
  7401. //>>excludeEnd("ide");
  7402. messageSends: []
  7403. }),
  7404. $globals.String.a$cls);
  7405. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7406. //>>excludeStart("ide", pragmas.excludeIdeData);
  7407. $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`.";
  7408. //>>excludeEnd("ide");
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "=",
  7412. protocol: "comparing",
  7413. fn: function (aCollection){
  7414. var self=this,$self=this;
  7415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7416. return $core.withContext(function($ctx1) {
  7417. //>>excludeEnd("ctx");
  7418. var $2,$1,$4,$3,$5;
  7419. var $early={};
  7420. try {
  7421. $2=$self._class();
  7422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7423. $ctx1.sendIdx["class"]=1;
  7424. //>>excludeEnd("ctx");
  7425. $1=$recv($2).__eq($recv(aCollection)._class());
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. $ctx1.sendIdx["="]=1;
  7428. //>>excludeEnd("ctx");
  7429. if(!$core.assert($1)){
  7430. return false;
  7431. }
  7432. $4=$self._size();
  7433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7434. $ctx1.sendIdx["size"]=1;
  7435. //>>excludeEnd("ctx");
  7436. $3=$recv($4).__eq($recv(aCollection)._size());
  7437. if(!$core.assert($3)){
  7438. return false;
  7439. }
  7440. $self._do_((function(each){
  7441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7442. return $core.withContext(function($ctx2) {
  7443. //>>excludeEnd("ctx");
  7444. $5=$recv(aCollection)._includes_(each);
  7445. if(!$core.assert($5)){
  7446. throw $early=[false];
  7447. }
  7448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7450. //>>excludeEnd("ctx");
  7451. }));
  7452. return true;
  7453. }
  7454. catch(e) {if(e===$early)return e[0]; throw e}
  7455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7456. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7457. //>>excludeEnd("ctx");
  7458. },
  7459. //>>excludeStart("ide", pragmas.excludeIdeData);
  7460. args: ["aCollection"],
  7461. 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",
  7462. referencedClasses: [],
  7463. //>>excludeEnd("ide");
  7464. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7465. }),
  7466. $globals.Set);
  7467. $core.addMethod(
  7468. $core.method({
  7469. selector: "add:",
  7470. protocol: "adding/removing",
  7471. fn: function (anObject){
  7472. var self=this,$self=this;
  7473. var bucket;
  7474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7475. return $core.withContext(function($ctx1) {
  7476. //>>excludeEnd("ctx");
  7477. var $1,$receiver;
  7478. bucket=$self._bucketsOfElement_(anObject);
  7479. $1=$recv(bucket)._second();
  7480. if(($receiver = $1) == null || $receiver.a$nil){
  7481. var object,slowBucket;
  7482. object=$recv(bucket)._first();
  7483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7484. $ctx1.sendIdx["first"]=1;
  7485. //>>excludeEnd("ctx");
  7486. slowBucket=$recv(bucket)._third();
  7487. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7489. return $core.withContext(function($ctx2) {
  7490. //>>excludeEnd("ctx");
  7491. $recv(slowBucket)._add_(object);
  7492. $self["@size"]=$recv($self["@size"]).__plus((1));
  7493. return $self["@size"];
  7494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7496. //>>excludeEnd("ctx");
  7497. }));
  7498. return object;
  7499. } else {
  7500. var primitiveBucket;
  7501. primitiveBucket=$receiver;
  7502. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7503. }
  7504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7505. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7506. //>>excludeEnd("ctx");
  7507. },
  7508. //>>excludeStart("ide", pragmas.excludeIdeData);
  7509. args: ["anObject"],
  7510. 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 ]",
  7511. referencedClasses: [],
  7512. //>>excludeEnd("ide");
  7513. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7514. }),
  7515. $globals.Set);
  7516. $core.addMethod(
  7517. $core.method({
  7518. selector: "add:in:",
  7519. protocol: "private",
  7520. fn: function (anObject,anotherObject){
  7521. var self=this,$self=this;
  7522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7523. return $core.withContext(function($ctx1) {
  7524. //>>excludeEnd("ctx");
  7525. if (anObject in anotherObject.store) { return anObject; }
  7526. $self['@size']++;
  7527. anotherObject.store[anObject] = true;
  7528. return anObject;
  7529. ;
  7530. return self;
  7531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7532. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7533. //>>excludeEnd("ctx");
  7534. },
  7535. //>>excludeStart("ide", pragmas.excludeIdeData);
  7536. args: ["anObject", "anotherObject"],
  7537. 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'>",
  7538. referencedClasses: [],
  7539. //>>excludeEnd("ide");
  7540. messageSends: []
  7541. }),
  7542. $globals.Set);
  7543. $core.addMethod(
  7544. $core.method({
  7545. selector: "bucketsOfElement:",
  7546. protocol: "private",
  7547. fn: function (anObject){
  7548. var self=this,$self=this;
  7549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7550. return $core.withContext(function($ctx1) {
  7551. //>>excludeEnd("ctx");
  7552. // include nil to well-known objects under "boolean" fastBucket
  7553. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  7554. var prim = anObject.valueOf();
  7555. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  7556. var bucket = null;
  7557. $self['@slowBucketStores'].some(function (store) {
  7558. return bucket = store._bucketOfElement_(anObject);
  7559. });
  7560. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  7561. }
  7562. return [ prim, $self['@fastBuckets'][typeof prim] ];
  7563. ;
  7564. return self;
  7565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7566. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7567. //>>excludeEnd("ctx");
  7568. },
  7569. //>>excludeStart("ide", pragmas.excludeIdeData);
  7570. args: ["anObject"],
  7571. 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'>",
  7572. referencedClasses: [],
  7573. //>>excludeEnd("ide");
  7574. messageSends: []
  7575. }),
  7576. $globals.Set);
  7577. $core.addMethod(
  7578. $core.method({
  7579. selector: "classNameOf:",
  7580. protocol: "private",
  7581. fn: function (anObject){
  7582. var self=this,$self=this;
  7583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7584. return $core.withContext(function($ctx1) {
  7585. //>>excludeEnd("ctx");
  7586. return anObject.a$cls != null && anObject.a$cls.name;
  7587. return self;
  7588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7589. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7590. //>>excludeEnd("ctx");
  7591. },
  7592. //>>excludeStart("ide", pragmas.excludeIdeData);
  7593. args: ["anObject"],
  7594. 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'>",
  7595. referencedClasses: [],
  7596. //>>excludeEnd("ide");
  7597. messageSends: []
  7598. }),
  7599. $globals.Set);
  7600. $core.addMethod(
  7601. $core.method({
  7602. selector: "collect:",
  7603. protocol: "enumerating",
  7604. fn: function (aBlock){
  7605. var self=this,$self=this;
  7606. var collection;
  7607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7608. return $core.withContext(function($ctx1) {
  7609. //>>excludeEnd("ctx");
  7610. collection=$recv($self._class())._new();
  7611. $self._do_((function(each){
  7612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7613. return $core.withContext(function($ctx2) {
  7614. //>>excludeEnd("ctx");
  7615. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7617. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7618. //>>excludeEnd("ctx");
  7619. }));
  7620. return collection;
  7621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7622. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7623. //>>excludeEnd("ctx");
  7624. },
  7625. //>>excludeStart("ide", pragmas.excludeIdeData);
  7626. args: ["aBlock"],
  7627. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7628. referencedClasses: [],
  7629. //>>excludeEnd("ide");
  7630. messageSends: ["new", "class", "do:", "add:", "value:"]
  7631. }),
  7632. $globals.Set);
  7633. $core.addMethod(
  7634. $core.method({
  7635. selector: "do:",
  7636. protocol: "enumerating",
  7637. fn: function (aBlock){
  7638. var self=this,$self=this;
  7639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7640. return $core.withContext(function($ctx1) {
  7641. //>>excludeEnd("ctx");
  7642. var el, keys, i;
  7643. el = $self['@fastBuckets'];
  7644. keys = Object.keys(el);
  7645. for (i = 0; i < keys.length; ++i) {
  7646. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7647. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7648. else { store._do_(aBlock); }
  7649. }
  7650. el = $self['@slowBucketStores'];
  7651. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7652. $self['@defaultBucket']._do_(aBlock);
  7653. ;
  7654. return self;
  7655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7656. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7657. //>>excludeEnd("ctx");
  7658. },
  7659. //>>excludeStart("ide", pragmas.excludeIdeData);
  7660. args: ["aBlock"],
  7661. 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'>",
  7662. referencedClasses: [],
  7663. //>>excludeEnd("ide");
  7664. messageSends: []
  7665. }),
  7666. $globals.Set);
  7667. $core.addMethod(
  7668. $core.method({
  7669. selector: "includes:",
  7670. protocol: "testing",
  7671. fn: function (anObject){
  7672. var self=this,$self=this;
  7673. var bucket;
  7674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7675. return $core.withContext(function($ctx1) {
  7676. //>>excludeEnd("ctx");
  7677. var $1,$2,$3,$receiver;
  7678. bucket=$self._bucketsOfElement_(anObject);
  7679. $1=$recv(bucket)._second();
  7680. if(($receiver = $1) == null || $receiver.a$nil){
  7681. $2=$recv(bucket)._third();
  7682. $3=$recv(bucket)._first();
  7683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7684. $ctx1.sendIdx["first"]=1;
  7685. //>>excludeEnd("ctx");
  7686. return $recv($2)._includes_($3);
  7687. } else {
  7688. var primitiveBucket;
  7689. primitiveBucket=$receiver;
  7690. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7691. }
  7692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7693. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7694. //>>excludeEnd("ctx");
  7695. },
  7696. //>>excludeStart("ide", pragmas.excludeIdeData);
  7697. args: ["anObject"],
  7698. 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 ]",
  7699. referencedClasses: [],
  7700. //>>excludeEnd("ide");
  7701. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7702. }),
  7703. $globals.Set);
  7704. $core.addMethod(
  7705. $core.method({
  7706. selector: "includes:in:",
  7707. protocol: "private",
  7708. fn: function (anObject,anotherObject){
  7709. var self=this,$self=this;
  7710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7711. return $core.withContext(function($ctx1) {
  7712. //>>excludeEnd("ctx");
  7713. return anObject in anotherObject.store;
  7714. return self;
  7715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7716. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7717. //>>excludeEnd("ctx");
  7718. },
  7719. //>>excludeStart("ide", pragmas.excludeIdeData);
  7720. args: ["anObject", "anotherObject"],
  7721. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7722. referencedClasses: [],
  7723. //>>excludeEnd("ide");
  7724. messageSends: []
  7725. }),
  7726. $globals.Set);
  7727. $core.addMethod(
  7728. $core.method({
  7729. selector: "initialize",
  7730. protocol: "initialization",
  7731. fn: function (){
  7732. var self=this,$self=this;
  7733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7734. return $core.withContext(function($ctx1) {
  7735. //>>excludeEnd("ctx");
  7736. (
  7737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7738. $ctx1.supercall = true,
  7739. //>>excludeEnd("ctx");
  7740. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7742. $ctx1.supercall = false;
  7743. //>>excludeEnd("ctx");;
  7744. $self["@defaultBucket"]=[];
  7745. $self._initializeSlowBucketStores();
  7746. $self._removeAll();
  7747. return self;
  7748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7749. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7750. //>>excludeEnd("ctx");
  7751. },
  7752. //>>excludeStart("ide", pragmas.excludeIdeData);
  7753. args: [],
  7754. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7755. referencedClasses: [],
  7756. //>>excludeEnd("ide");
  7757. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7758. }),
  7759. $globals.Set);
  7760. $core.addMethod(
  7761. $core.method({
  7762. selector: "initializeSlowBucketStores",
  7763. protocol: "initialization",
  7764. fn: function (){
  7765. var self=this,$self=this;
  7766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7767. return $core.withContext(function($ctx1) {
  7768. //>>excludeEnd("ctx");
  7769. var $1;
  7770. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7772. return $core.withContext(function($ctx2) {
  7773. //>>excludeEnd("ctx");
  7774. return $self._classNameOf_(x);
  7775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7776. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7777. //>>excludeEnd("ctx");
  7778. }));
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. $ctx1.sendIdx["hashBlock:"]=1;
  7781. //>>excludeEnd("ctx");
  7782. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7784. return $core.withContext(function($ctx2) {
  7785. //>>excludeEnd("ctx");
  7786. return $self._jsConstructorNameOf_(x);
  7787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7788. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7789. //>>excludeEnd("ctx");
  7790. }))];
  7791. return self;
  7792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7793. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7794. //>>excludeEnd("ctx");
  7795. },
  7796. //>>excludeStart("ide", pragmas.excludeIdeData);
  7797. args: [],
  7798. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7799. referencedClasses: ["ArrayBucketStore"],
  7800. //>>excludeEnd("ide");
  7801. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7802. }),
  7803. $globals.Set);
  7804. $core.addMethod(
  7805. $core.method({
  7806. selector: "jsConstructorNameOf:",
  7807. protocol: "private",
  7808. fn: function (anObject){
  7809. var self=this,$self=this;
  7810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7811. return $core.withContext(function($ctx1) {
  7812. //>>excludeEnd("ctx");
  7813. return anObject.constructor && anObject.constructor.name;
  7814. return self;
  7815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7816. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7817. //>>excludeEnd("ctx");
  7818. },
  7819. //>>excludeStart("ide", pragmas.excludeIdeData);
  7820. args: ["anObject"],
  7821. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7822. referencedClasses: [],
  7823. //>>excludeEnd("ide");
  7824. messageSends: []
  7825. }),
  7826. $globals.Set);
  7827. $core.addMethod(
  7828. $core.method({
  7829. selector: "printOn:",
  7830. protocol: "printing",
  7831. fn: function (aStream){
  7832. var self=this,$self=this;
  7833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7834. return $core.withContext(function($ctx1) {
  7835. //>>excludeEnd("ctx");
  7836. (
  7837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7838. $ctx1.supercall = true,
  7839. //>>excludeEnd("ctx");
  7840. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7842. $ctx1.supercall = false;
  7843. //>>excludeEnd("ctx");;
  7844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7845. $ctx1.sendIdx["printOn:"]=1;
  7846. //>>excludeEnd("ctx");
  7847. $recv(aStream)._nextPutAll_(" (");
  7848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7849. $ctx1.sendIdx["nextPutAll:"]=1;
  7850. //>>excludeEnd("ctx");
  7851. $self._do_separatedBy_((function(each){
  7852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7853. return $core.withContext(function($ctx2) {
  7854. //>>excludeEnd("ctx");
  7855. return $recv(each)._printOn_(aStream);
  7856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7858. //>>excludeEnd("ctx");
  7859. }),(function(){
  7860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7861. return $core.withContext(function($ctx2) {
  7862. //>>excludeEnd("ctx");
  7863. return $recv(aStream)._nextPutAll_(" ");
  7864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7865. $ctx2.sendIdx["nextPutAll:"]=2;
  7866. //>>excludeEnd("ctx");
  7867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7869. //>>excludeEnd("ctx");
  7870. }));
  7871. $recv(aStream)._nextPutAll_(")");
  7872. return self;
  7873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7874. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7875. //>>excludeEnd("ctx");
  7876. },
  7877. //>>excludeStart("ide", pragmas.excludeIdeData);
  7878. args: ["aStream"],
  7879. 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: ')'",
  7880. referencedClasses: [],
  7881. //>>excludeEnd("ide");
  7882. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7883. }),
  7884. $globals.Set);
  7885. $core.addMethod(
  7886. $core.method({
  7887. selector: "remove:ifAbsent:",
  7888. protocol: "adding/removing",
  7889. fn: function (anObject,aBlock){
  7890. var self=this,$self=this;
  7891. var bucket;
  7892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7893. return $core.withContext(function($ctx1) {
  7894. //>>excludeEnd("ctx");
  7895. var $1,$2,$3,$receiver;
  7896. var $early={};
  7897. try {
  7898. bucket=$self._bucketsOfElement_(anObject);
  7899. $1=$recv(bucket)._second();
  7900. if(($receiver = $1) == null || $receiver.a$nil){
  7901. $2=$recv(bucket)._third();
  7902. $3=$recv(bucket)._first();
  7903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7904. $ctx1.sendIdx["first"]=1;
  7905. //>>excludeEnd("ctx");
  7906. $recv($2)._remove_ifAbsent_($3,(function(){
  7907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7908. return $core.withContext(function($ctx2) {
  7909. //>>excludeEnd("ctx");
  7910. throw $early=[$recv(aBlock)._value()];
  7911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7912. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7913. //>>excludeEnd("ctx");
  7914. }));
  7915. $self["@size"]=$recv($self["@size"]).__minus((1));
  7916. return $self["@size"];
  7917. } else {
  7918. var primitiveBucket;
  7919. primitiveBucket=$receiver;
  7920. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7921. }
  7922. }
  7923. catch(e) {if(e===$early)return e[0]; throw e}
  7924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7925. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7926. //>>excludeEnd("ctx");
  7927. },
  7928. //>>excludeStart("ide", pragmas.excludeIdeData);
  7929. args: ["anObject", "aBlock"],
  7930. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  7931. referencedClasses: [],
  7932. //>>excludeEnd("ide");
  7933. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7934. }),
  7935. $globals.Set);
  7936. $core.addMethod(
  7937. $core.method({
  7938. selector: "remove:in:ifAbsent:",
  7939. protocol: "private",
  7940. fn: function (anObject,anotherObject,aBlock){
  7941. var self=this,$self=this;
  7942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7943. return $core.withContext(function($ctx1) {
  7944. //>>excludeEnd("ctx");
  7945. if (anObject in anotherObject.store) {
  7946. delete anotherObject.store[anObject];
  7947. $self['@size']--;
  7948. return anObject;
  7949. } else {
  7950. return aBlock._value();
  7951. };
  7952. return self;
  7953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7954. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock},$globals.Set)});
  7955. //>>excludeEnd("ctx");
  7956. },
  7957. //>>excludeStart("ide", pragmas.excludeIdeData);
  7958. args: ["anObject", "anotherObject", "aBlock"],
  7959. 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}'>",
  7960. referencedClasses: [],
  7961. //>>excludeEnd("ide");
  7962. messageSends: []
  7963. }),
  7964. $globals.Set);
  7965. $core.addMethod(
  7966. $core.method({
  7967. selector: "removeAll",
  7968. protocol: "adding/removing",
  7969. fn: function (){
  7970. var self=this,$self=this;
  7971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7972. return $core.withContext(function($ctx1) {
  7973. //>>excludeEnd("ctx");
  7974. $self['@fastBuckets'] = {
  7975. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7976. "number": { store: Object.create(null), fn: Number },
  7977. "string": { store: Object.create(null) }
  7978. };
  7979. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7980. $self['@defaultBucket']._removeAll();
  7981. $self['@size'] = 0;
  7982. ;
  7983. return self;
  7984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7985. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  7986. //>>excludeEnd("ctx");
  7987. },
  7988. //>>excludeStart("ide", pragmas.excludeIdeData);
  7989. args: [],
  7990. 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'>",
  7991. referencedClasses: [],
  7992. //>>excludeEnd("ide");
  7993. messageSends: []
  7994. }),
  7995. $globals.Set);
  7996. $core.addMethod(
  7997. $core.method({
  7998. selector: "select:",
  7999. protocol: "enumerating",
  8000. fn: function (aBlock){
  8001. var self=this,$self=this;
  8002. var collection;
  8003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8004. return $core.withContext(function($ctx1) {
  8005. //>>excludeEnd("ctx");
  8006. var $1;
  8007. collection=$recv($self._class())._new();
  8008. $self._do_((function(each){
  8009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8010. return $core.withContext(function($ctx2) {
  8011. //>>excludeEnd("ctx");
  8012. $1=$recv(aBlock)._value_(each);
  8013. if($core.assert($1)){
  8014. return $recv(collection)._add_(each);
  8015. }
  8016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8017. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8018. //>>excludeEnd("ctx");
  8019. }));
  8020. return collection;
  8021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8022. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8023. //>>excludeEnd("ctx");
  8024. },
  8025. //>>excludeStart("ide", pragmas.excludeIdeData);
  8026. args: ["aBlock"],
  8027. 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",
  8028. referencedClasses: [],
  8029. //>>excludeEnd("ide");
  8030. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8031. }),
  8032. $globals.Set);
  8033. $core.addMethod(
  8034. $core.method({
  8035. selector: "select:thenCollect:",
  8036. protocol: "enumerating",
  8037. fn: function (selectBlock,collectBlock){
  8038. var self=this,$self=this;
  8039. var collection;
  8040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8041. return $core.withContext(function($ctx1) {
  8042. //>>excludeEnd("ctx");
  8043. var $1;
  8044. collection=$recv($self._class())._new();
  8045. $self._do_((function(each){
  8046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8047. return $core.withContext(function($ctx2) {
  8048. //>>excludeEnd("ctx");
  8049. $1=$recv(selectBlock)._value_(each);
  8050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8051. $ctx2.sendIdx["value:"]=1;
  8052. //>>excludeEnd("ctx");
  8053. if($core.assert($1)){
  8054. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  8055. }
  8056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8058. //>>excludeEnd("ctx");
  8059. }));
  8060. return collection;
  8061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8062. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  8063. //>>excludeEnd("ctx");
  8064. },
  8065. //>>excludeStart("ide", pragmas.excludeIdeData);
  8066. args: ["selectBlock", "collectBlock"],
  8067. 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",
  8068. referencedClasses: [],
  8069. //>>excludeEnd("ide");
  8070. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8071. }),
  8072. $globals.Set);
  8073. $core.addMethod(
  8074. $core.method({
  8075. selector: "size",
  8076. protocol: "accessing",
  8077. fn: function (){
  8078. var self=this,$self=this;
  8079. return $self["@size"];
  8080. },
  8081. //>>excludeStart("ide", pragmas.excludeIdeData);
  8082. args: [],
  8083. source: "size\x0a\x09^ size",
  8084. referencedClasses: [],
  8085. //>>excludeEnd("ide");
  8086. messageSends: []
  8087. }),
  8088. $globals.Set);
  8089. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  8090. //>>excludeStart("ide", pragmas.excludeIdeData);
  8091. $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.";
  8092. //>>excludeEnd("ide");
  8093. $core.addMethod(
  8094. $core.method({
  8095. selector: "<<",
  8096. protocol: "writing",
  8097. fn: function (anObject){
  8098. var self=this,$self=this;
  8099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8100. return $core.withContext(function($ctx1) {
  8101. //>>excludeEnd("ctx");
  8102. $self._write_(anObject);
  8103. return self;
  8104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8105. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8106. //>>excludeEnd("ctx");
  8107. },
  8108. //>>excludeStart("ide", pragmas.excludeIdeData);
  8109. args: ["anObject"],
  8110. source: "<< anObject\x0a\x09self write: anObject",
  8111. referencedClasses: [],
  8112. //>>excludeEnd("ide");
  8113. messageSends: ["write:"]
  8114. }),
  8115. $globals.ProtoStream);
  8116. $core.addMethod(
  8117. $core.method({
  8118. selector: "atEnd",
  8119. protocol: "testing",
  8120. fn: function (){
  8121. var self=this,$self=this;
  8122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8123. return $core.withContext(function($ctx1) {
  8124. //>>excludeEnd("ctx");
  8125. $self._subclassResponsibility();
  8126. return self;
  8127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8128. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8129. //>>excludeEnd("ctx");
  8130. },
  8131. //>>excludeStart("ide", pragmas.excludeIdeData);
  8132. args: [],
  8133. source: "atEnd\x0a\x09self subclassResponsibility",
  8134. referencedClasses: [],
  8135. //>>excludeEnd("ide");
  8136. messageSends: ["subclassResponsibility"]
  8137. }),
  8138. $globals.ProtoStream);
  8139. $core.addMethod(
  8140. $core.method({
  8141. selector: "atStart",
  8142. protocol: "testing",
  8143. fn: function (){
  8144. var self=this,$self=this;
  8145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8146. return $core.withContext(function($ctx1) {
  8147. //>>excludeEnd("ctx");
  8148. $self._subclassResponsibility();
  8149. return self;
  8150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8151. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8152. //>>excludeEnd("ctx");
  8153. },
  8154. //>>excludeStart("ide", pragmas.excludeIdeData);
  8155. args: [],
  8156. source: "atStart\x0a\x09self subclassResponsibility",
  8157. referencedClasses: [],
  8158. //>>excludeEnd("ide");
  8159. messageSends: ["subclassResponsibility"]
  8160. }),
  8161. $globals.ProtoStream);
  8162. $core.addMethod(
  8163. $core.method({
  8164. selector: "contents",
  8165. protocol: "accessing",
  8166. fn: function (){
  8167. var self=this,$self=this;
  8168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8169. return $core.withContext(function($ctx1) {
  8170. //>>excludeEnd("ctx");
  8171. $self._subclassResponsibility();
  8172. return self;
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8175. //>>excludeEnd("ctx");
  8176. },
  8177. //>>excludeStart("ide", pragmas.excludeIdeData);
  8178. args: [],
  8179. source: "contents\x0a\x09self subclassResponsibility",
  8180. referencedClasses: [],
  8181. //>>excludeEnd("ide");
  8182. messageSends: ["subclassResponsibility"]
  8183. }),
  8184. $globals.ProtoStream);
  8185. $core.addMethod(
  8186. $core.method({
  8187. selector: "do:",
  8188. protocol: "enumerating",
  8189. fn: function (aBlock){
  8190. var self=this,$self=this;
  8191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8192. return $core.withContext(function($ctx1) {
  8193. //>>excludeEnd("ctx");
  8194. $recv((function(){
  8195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8196. return $core.withContext(function($ctx2) {
  8197. //>>excludeEnd("ctx");
  8198. return $self._atEnd();
  8199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8200. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8201. //>>excludeEnd("ctx");
  8202. }))._whileFalse_((function(){
  8203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8204. return $core.withContext(function($ctx2) {
  8205. //>>excludeEnd("ctx");
  8206. return $recv(aBlock)._value_($self._next());
  8207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8208. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8209. //>>excludeEnd("ctx");
  8210. }));
  8211. return self;
  8212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8213. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8214. //>>excludeEnd("ctx");
  8215. },
  8216. //>>excludeStart("ide", pragmas.excludeIdeData);
  8217. args: ["aBlock"],
  8218. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8219. referencedClasses: [],
  8220. //>>excludeEnd("ide");
  8221. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8222. }),
  8223. $globals.ProtoStream);
  8224. $core.addMethod(
  8225. $core.method({
  8226. selector: "isEmpty",
  8227. protocol: "testing",
  8228. fn: function (){
  8229. var self=this,$self=this;
  8230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8231. return $core.withContext(function($ctx1) {
  8232. //>>excludeEnd("ctx");
  8233. return $recv($self._atStart())._and_((function(){
  8234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8235. return $core.withContext(function($ctx2) {
  8236. //>>excludeEnd("ctx");
  8237. return $self._atEnd();
  8238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8239. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8240. //>>excludeEnd("ctx");
  8241. }));
  8242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8243. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8244. //>>excludeEnd("ctx");
  8245. },
  8246. //>>excludeStart("ide", pragmas.excludeIdeData);
  8247. args: [],
  8248. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8249. referencedClasses: [],
  8250. //>>excludeEnd("ide");
  8251. messageSends: ["and:", "atStart", "atEnd"]
  8252. }),
  8253. $globals.ProtoStream);
  8254. $core.addMethod(
  8255. $core.method({
  8256. selector: "next",
  8257. protocol: "reading",
  8258. fn: function (){
  8259. var self=this,$self=this;
  8260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8261. return $core.withContext(function($ctx1) {
  8262. //>>excludeEnd("ctx");
  8263. var $1;
  8264. $1=$self._atEnd();
  8265. if($core.assert($1)){
  8266. return nil;
  8267. } else {
  8268. return $self._subclassResponsibility();
  8269. }
  8270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8271. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8272. //>>excludeEnd("ctx");
  8273. },
  8274. //>>excludeStart("ide", pragmas.excludeIdeData);
  8275. args: [],
  8276. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8277. referencedClasses: [],
  8278. //>>excludeEnd("ide");
  8279. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8280. }),
  8281. $globals.ProtoStream);
  8282. $core.addMethod(
  8283. $core.method({
  8284. selector: "nextPut:",
  8285. protocol: "writing",
  8286. fn: function (anObject){
  8287. var self=this,$self=this;
  8288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8289. return $core.withContext(function($ctx1) {
  8290. //>>excludeEnd("ctx");
  8291. $self._subclassResponsibility();
  8292. return self;
  8293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8294. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8295. //>>excludeEnd("ctx");
  8296. },
  8297. //>>excludeStart("ide", pragmas.excludeIdeData);
  8298. args: ["anObject"],
  8299. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8300. referencedClasses: [],
  8301. //>>excludeEnd("ide");
  8302. messageSends: ["subclassResponsibility"]
  8303. }),
  8304. $globals.ProtoStream);
  8305. $core.addMethod(
  8306. $core.method({
  8307. selector: "nextPutAll:",
  8308. protocol: "writing",
  8309. fn: function (aCollection){
  8310. var self=this,$self=this;
  8311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8312. return $core.withContext(function($ctx1) {
  8313. //>>excludeEnd("ctx");
  8314. $recv(aCollection)._do_((function(each){
  8315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8316. return $core.withContext(function($ctx2) {
  8317. //>>excludeEnd("ctx");
  8318. return $self._nextPut_(each);
  8319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8320. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8321. //>>excludeEnd("ctx");
  8322. }));
  8323. return self;
  8324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8325. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8326. //>>excludeEnd("ctx");
  8327. },
  8328. //>>excludeStart("ide", pragmas.excludeIdeData);
  8329. args: ["aCollection"],
  8330. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8331. referencedClasses: [],
  8332. //>>excludeEnd("ide");
  8333. messageSends: ["do:", "nextPut:"]
  8334. }),
  8335. $globals.ProtoStream);
  8336. $core.addMethod(
  8337. $core.method({
  8338. selector: "nextPutString:",
  8339. protocol: "writing",
  8340. fn: function (aString){
  8341. var self=this,$self=this;
  8342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8343. return $core.withContext(function($ctx1) {
  8344. //>>excludeEnd("ctx");
  8345. $self._nextPut_(aString);
  8346. return self;
  8347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8348. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8349. //>>excludeEnd("ctx");
  8350. },
  8351. //>>excludeStart("ide", pragmas.excludeIdeData);
  8352. args: ["aString"],
  8353. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8354. referencedClasses: [],
  8355. //>>excludeEnd("ide");
  8356. messageSends: ["nextPut:"]
  8357. }),
  8358. $globals.ProtoStream);
  8359. $core.addMethod(
  8360. $core.method({
  8361. selector: "peek",
  8362. protocol: "reading",
  8363. fn: function (){
  8364. var self=this,$self=this;
  8365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8366. return $core.withContext(function($ctx1) {
  8367. //>>excludeEnd("ctx");
  8368. var $1;
  8369. $1=$self._atEnd();
  8370. if($core.assert($1)){
  8371. return nil;
  8372. } else {
  8373. return $self._subclassResponsibility();
  8374. }
  8375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8376. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8377. //>>excludeEnd("ctx");
  8378. },
  8379. //>>excludeStart("ide", pragmas.excludeIdeData);
  8380. args: [],
  8381. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8382. referencedClasses: [],
  8383. //>>excludeEnd("ide");
  8384. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8385. }),
  8386. $globals.ProtoStream);
  8387. $core.addMethod(
  8388. $core.method({
  8389. selector: "reset",
  8390. protocol: "actions",
  8391. fn: function (){
  8392. var self=this,$self=this;
  8393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8394. return $core.withContext(function($ctx1) {
  8395. //>>excludeEnd("ctx");
  8396. $self._subclassResponsibility();
  8397. return self;
  8398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8399. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8400. //>>excludeEnd("ctx");
  8401. },
  8402. //>>excludeStart("ide", pragmas.excludeIdeData);
  8403. args: [],
  8404. source: "reset\x0a\x09self subclassResponsibility",
  8405. referencedClasses: [],
  8406. //>>excludeEnd("ide");
  8407. messageSends: ["subclassResponsibility"]
  8408. }),
  8409. $globals.ProtoStream);
  8410. $core.addMethod(
  8411. $core.method({
  8412. selector: "resetContents",
  8413. protocol: "actions",
  8414. fn: function (){
  8415. var self=this,$self=this;
  8416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8417. return $core.withContext(function($ctx1) {
  8418. //>>excludeEnd("ctx");
  8419. $self._subclassResponsibility();
  8420. return self;
  8421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8422. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8423. //>>excludeEnd("ctx");
  8424. },
  8425. //>>excludeStart("ide", pragmas.excludeIdeData);
  8426. args: [],
  8427. source: "resetContents\x0a\x09self subclassResponsibility",
  8428. referencedClasses: [],
  8429. //>>excludeEnd("ide");
  8430. messageSends: ["subclassResponsibility"]
  8431. }),
  8432. $globals.ProtoStream);
  8433. $core.addMethod(
  8434. $core.method({
  8435. selector: "setToEnd",
  8436. protocol: "positioning",
  8437. fn: function (){
  8438. var self=this,$self=this;
  8439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8440. return $core.withContext(function($ctx1) {
  8441. //>>excludeEnd("ctx");
  8442. $self._subclassResponsibility();
  8443. return self;
  8444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8445. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8446. //>>excludeEnd("ctx");
  8447. },
  8448. //>>excludeStart("ide", pragmas.excludeIdeData);
  8449. args: [],
  8450. source: "setToEnd\x0a\x09self subclassResponsibility",
  8451. referencedClasses: [],
  8452. //>>excludeEnd("ide");
  8453. messageSends: ["subclassResponsibility"]
  8454. }),
  8455. $globals.ProtoStream);
  8456. $core.addMethod(
  8457. $core.method({
  8458. selector: "setToStart",
  8459. protocol: "positioning",
  8460. fn: function (){
  8461. var self=this,$self=this;
  8462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8463. return $core.withContext(function($ctx1) {
  8464. //>>excludeEnd("ctx");
  8465. $self._reset();
  8466. return self;
  8467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8468. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8469. //>>excludeEnd("ctx");
  8470. },
  8471. //>>excludeStart("ide", pragmas.excludeIdeData);
  8472. args: [],
  8473. source: "setToStart\x0a\x09self reset",
  8474. referencedClasses: [],
  8475. //>>excludeEnd("ide");
  8476. messageSends: ["reset"]
  8477. }),
  8478. $globals.ProtoStream);
  8479. $core.addMethod(
  8480. $core.method({
  8481. selector: "write:",
  8482. protocol: "writing",
  8483. fn: function (anObject){
  8484. var self=this,$self=this;
  8485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8486. return $core.withContext(function($ctx1) {
  8487. //>>excludeEnd("ctx");
  8488. $recv(anObject)._putOn_(self);
  8489. return self;
  8490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8491. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8492. //>>excludeEnd("ctx");
  8493. },
  8494. //>>excludeStart("ide", pragmas.excludeIdeData);
  8495. args: ["anObject"],
  8496. source: "write: anObject\x0a\x09anObject putOn: self",
  8497. referencedClasses: [],
  8498. //>>excludeEnd("ide");
  8499. messageSends: ["putOn:"]
  8500. }),
  8501. $globals.ProtoStream);
  8502. $core.addMethod(
  8503. $core.method({
  8504. selector: "on:",
  8505. protocol: "instance creation",
  8506. fn: function (aCollection){
  8507. var self=this,$self=this;
  8508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8509. return $core.withContext(function($ctx1) {
  8510. //>>excludeEnd("ctx");
  8511. var $1;
  8512. $1=$self._new();
  8513. $recv($1)._setCollection_(aCollection);
  8514. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8515. return $recv($1)._yourself();
  8516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8517. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  8518. //>>excludeEnd("ctx");
  8519. },
  8520. //>>excludeStart("ide", pragmas.excludeIdeData);
  8521. args: ["aCollection"],
  8522. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8523. referencedClasses: [],
  8524. //>>excludeEnd("ide");
  8525. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8526. }),
  8527. $globals.ProtoStream.a$cls);
  8528. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8529. //>>excludeStart("ide", pragmas.excludeIdeData);
  8530. $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.";
  8531. //>>excludeEnd("ide");
  8532. $core.addMethod(
  8533. $core.method({
  8534. selector: "atEnd",
  8535. protocol: "testing",
  8536. fn: function (){
  8537. var self=this,$self=this;
  8538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8539. return $core.withContext(function($ctx1) {
  8540. //>>excludeEnd("ctx");
  8541. return $recv($self._position()).__eq($self._size());
  8542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8543. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8544. //>>excludeEnd("ctx");
  8545. },
  8546. //>>excludeStart("ide", pragmas.excludeIdeData);
  8547. args: [],
  8548. source: "atEnd\x0a\x09^ self position = self size",
  8549. referencedClasses: [],
  8550. //>>excludeEnd("ide");
  8551. messageSends: ["=", "position", "size"]
  8552. }),
  8553. $globals.Stream);
  8554. $core.addMethod(
  8555. $core.method({
  8556. selector: "atStart",
  8557. protocol: "testing",
  8558. fn: function (){
  8559. var self=this,$self=this;
  8560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8561. return $core.withContext(function($ctx1) {
  8562. //>>excludeEnd("ctx");
  8563. return $recv($self._position()).__eq((0));
  8564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8565. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8566. //>>excludeEnd("ctx");
  8567. },
  8568. //>>excludeStart("ide", pragmas.excludeIdeData);
  8569. args: [],
  8570. source: "atStart\x0a\x09^ self position = 0",
  8571. referencedClasses: [],
  8572. //>>excludeEnd("ide");
  8573. messageSends: ["=", "position"]
  8574. }),
  8575. $globals.Stream);
  8576. $core.addMethod(
  8577. $core.method({
  8578. selector: "close",
  8579. protocol: "actions",
  8580. fn: function (){
  8581. var self=this,$self=this;
  8582. return self;
  8583. },
  8584. //>>excludeStart("ide", pragmas.excludeIdeData);
  8585. args: [],
  8586. source: "close",
  8587. referencedClasses: [],
  8588. //>>excludeEnd("ide");
  8589. messageSends: []
  8590. }),
  8591. $globals.Stream);
  8592. $core.addMethod(
  8593. $core.method({
  8594. selector: "collection",
  8595. protocol: "accessing",
  8596. fn: function (){
  8597. var self=this,$self=this;
  8598. return $self["@collection"];
  8599. },
  8600. //>>excludeStart("ide", pragmas.excludeIdeData);
  8601. args: [],
  8602. source: "collection\x0a\x09^ collection",
  8603. referencedClasses: [],
  8604. //>>excludeEnd("ide");
  8605. messageSends: []
  8606. }),
  8607. $globals.Stream);
  8608. $core.addMethod(
  8609. $core.method({
  8610. selector: "contents",
  8611. protocol: "accessing",
  8612. fn: function (){
  8613. var self=this,$self=this;
  8614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8615. return $core.withContext(function($ctx1) {
  8616. //>>excludeEnd("ctx");
  8617. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8619. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8620. //>>excludeEnd("ctx");
  8621. },
  8622. //>>excludeStart("ide", pragmas.excludeIdeData);
  8623. args: [],
  8624. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8625. referencedClasses: [],
  8626. //>>excludeEnd("ide");
  8627. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8628. }),
  8629. $globals.Stream);
  8630. $core.addMethod(
  8631. $core.method({
  8632. selector: "flush",
  8633. protocol: "actions",
  8634. fn: function (){
  8635. var self=this,$self=this;
  8636. return self;
  8637. },
  8638. //>>excludeStart("ide", pragmas.excludeIdeData);
  8639. args: [],
  8640. source: "flush",
  8641. referencedClasses: [],
  8642. //>>excludeEnd("ide");
  8643. messageSends: []
  8644. }),
  8645. $globals.Stream);
  8646. $core.addMethod(
  8647. $core.method({
  8648. selector: "isEmpty",
  8649. protocol: "testing",
  8650. fn: function (){
  8651. var self=this,$self=this;
  8652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8653. return $core.withContext(function($ctx1) {
  8654. //>>excludeEnd("ctx");
  8655. return $recv($self._size()).__eq((0));
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8658. //>>excludeEnd("ctx");
  8659. },
  8660. //>>excludeStart("ide", pragmas.excludeIdeData);
  8661. args: [],
  8662. source: "isEmpty\x0a\x09^ self size = 0",
  8663. referencedClasses: [],
  8664. //>>excludeEnd("ide");
  8665. messageSends: ["=", "size"]
  8666. }),
  8667. $globals.Stream);
  8668. $core.addMethod(
  8669. $core.method({
  8670. selector: "next",
  8671. protocol: "reading",
  8672. fn: function (){
  8673. var self=this,$self=this;
  8674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8675. return $core.withContext(function($ctx1) {
  8676. //>>excludeEnd("ctx");
  8677. var $1,$3,$2;
  8678. $1=$self._atEnd();
  8679. if($core.assert($1)){
  8680. return nil;
  8681. } else {
  8682. $3=$self._position();
  8683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8684. $ctx1.sendIdx["position"]=1;
  8685. //>>excludeEnd("ctx");
  8686. $2=$recv($3).__plus((1));
  8687. $self._position_($2);
  8688. return $recv($self["@collection"])._at_($self._position());
  8689. }
  8690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8691. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8692. //>>excludeEnd("ctx");
  8693. },
  8694. //>>excludeStart("ide", pragmas.excludeIdeData);
  8695. args: [],
  8696. 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 ]",
  8697. referencedClasses: [],
  8698. //>>excludeEnd("ide");
  8699. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8700. }),
  8701. $globals.Stream);
  8702. $core.addMethod(
  8703. $core.method({
  8704. selector: "next:",
  8705. protocol: "reading",
  8706. fn: function (anInteger){
  8707. var self=this,$self=this;
  8708. var tempCollection;
  8709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8710. return $core.withContext(function($ctx1) {
  8711. //>>excludeEnd("ctx");
  8712. var $1;
  8713. tempCollection=$recv($recv($self._collection())._class())._new();
  8714. $recv(anInteger)._timesRepeat_((function(){
  8715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8716. return $core.withContext(function($ctx2) {
  8717. //>>excludeEnd("ctx");
  8718. $1=$self._atEnd();
  8719. if(!$core.assert($1)){
  8720. return $recv(tempCollection)._add_($self._next());
  8721. }
  8722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8723. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8724. //>>excludeEnd("ctx");
  8725. }));
  8726. return tempCollection;
  8727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8728. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8729. //>>excludeEnd("ctx");
  8730. },
  8731. //>>excludeStart("ide", pragmas.excludeIdeData);
  8732. args: ["anInteger"],
  8733. 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",
  8734. referencedClasses: [],
  8735. //>>excludeEnd("ide");
  8736. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8737. }),
  8738. $globals.Stream);
  8739. $core.addMethod(
  8740. $core.method({
  8741. selector: "nextPut:",
  8742. protocol: "writing",
  8743. fn: function (anObject){
  8744. var self=this,$self=this;
  8745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8746. return $core.withContext(function($ctx1) {
  8747. //>>excludeEnd("ctx");
  8748. var $2,$1,$3,$4;
  8749. $2=$self._position();
  8750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8751. $ctx1.sendIdx["position"]=1;
  8752. //>>excludeEnd("ctx");
  8753. $1=$recv($2).__plus((1));
  8754. $self._position_($1);
  8755. $3=$self._collection();
  8756. $4=$self._position();
  8757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8758. $ctx1.sendIdx["position"]=2;
  8759. //>>excludeEnd("ctx");
  8760. $recv($3)._at_put_($4,anObject);
  8761. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8762. return self;
  8763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8764. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8765. //>>excludeEnd("ctx");
  8766. },
  8767. //>>excludeStart("ide", pragmas.excludeIdeData);
  8768. args: ["anObject"],
  8769. 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)",
  8770. referencedClasses: [],
  8771. //>>excludeEnd("ide");
  8772. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8773. }),
  8774. $globals.Stream);
  8775. $core.addMethod(
  8776. $core.method({
  8777. selector: "peek",
  8778. protocol: "reading",
  8779. fn: function (){
  8780. var self=this,$self=this;
  8781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8782. return $core.withContext(function($ctx1) {
  8783. //>>excludeEnd("ctx");
  8784. var $1;
  8785. $1=$self._atEnd();
  8786. if(!$core.assert($1)){
  8787. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8788. }
  8789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8790. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8791. //>>excludeEnd("ctx");
  8792. },
  8793. //>>excludeStart("ide", pragmas.excludeIdeData);
  8794. args: [],
  8795. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8796. referencedClasses: [],
  8797. //>>excludeEnd("ide");
  8798. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8799. }),
  8800. $globals.Stream);
  8801. $core.addMethod(
  8802. $core.method({
  8803. selector: "position",
  8804. protocol: "accessing",
  8805. fn: function (){
  8806. var self=this,$self=this;
  8807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8808. return $core.withContext(function($ctx1) {
  8809. //>>excludeEnd("ctx");
  8810. var $1,$receiver;
  8811. $1=$self["@position"];
  8812. if(($receiver = $1) == null || $receiver.a$nil){
  8813. $self["@position"]=(0);
  8814. return $self["@position"];
  8815. } else {
  8816. return $1;
  8817. }
  8818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8819. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8820. //>>excludeEnd("ctx");
  8821. },
  8822. //>>excludeStart("ide", pragmas.excludeIdeData);
  8823. args: [],
  8824. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8825. referencedClasses: [],
  8826. //>>excludeEnd("ide");
  8827. messageSends: ["ifNil:"]
  8828. }),
  8829. $globals.Stream);
  8830. $core.addMethod(
  8831. $core.method({
  8832. selector: "position:",
  8833. protocol: "accessing",
  8834. fn: function (anInteger){
  8835. var self=this,$self=this;
  8836. $self["@position"]=anInteger;
  8837. return self;
  8838. },
  8839. //>>excludeStart("ide", pragmas.excludeIdeData);
  8840. args: ["anInteger"],
  8841. source: "position: anInteger\x0a\x09position := anInteger",
  8842. referencedClasses: [],
  8843. //>>excludeEnd("ide");
  8844. messageSends: []
  8845. }),
  8846. $globals.Stream);
  8847. $core.addMethod(
  8848. $core.method({
  8849. selector: "reset",
  8850. protocol: "actions",
  8851. fn: function (){
  8852. var self=this,$self=this;
  8853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8854. return $core.withContext(function($ctx1) {
  8855. //>>excludeEnd("ctx");
  8856. $self._position_((0));
  8857. return self;
  8858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8859. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8860. //>>excludeEnd("ctx");
  8861. },
  8862. //>>excludeStart("ide", pragmas.excludeIdeData);
  8863. args: [],
  8864. source: "reset\x0a\x09self position: 0",
  8865. referencedClasses: [],
  8866. //>>excludeEnd("ide");
  8867. messageSends: ["position:"]
  8868. }),
  8869. $globals.Stream);
  8870. $core.addMethod(
  8871. $core.method({
  8872. selector: "resetContents",
  8873. protocol: "actions",
  8874. fn: function (){
  8875. var self=this,$self=this;
  8876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8877. return $core.withContext(function($ctx1) {
  8878. //>>excludeEnd("ctx");
  8879. $self._reset();
  8880. $self._setStreamSize_((0));
  8881. return self;
  8882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8883. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8884. //>>excludeEnd("ctx");
  8885. },
  8886. //>>excludeStart("ide", pragmas.excludeIdeData);
  8887. args: [],
  8888. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8889. referencedClasses: [],
  8890. //>>excludeEnd("ide");
  8891. messageSends: ["reset", "setStreamSize:"]
  8892. }),
  8893. $globals.Stream);
  8894. $core.addMethod(
  8895. $core.method({
  8896. selector: "setCollection:",
  8897. protocol: "accessing",
  8898. fn: function (aCollection){
  8899. var self=this,$self=this;
  8900. $self["@collection"]=aCollection;
  8901. return self;
  8902. },
  8903. //>>excludeStart("ide", pragmas.excludeIdeData);
  8904. args: ["aCollection"],
  8905. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8906. referencedClasses: [],
  8907. //>>excludeEnd("ide");
  8908. messageSends: []
  8909. }),
  8910. $globals.Stream);
  8911. $core.addMethod(
  8912. $core.method({
  8913. selector: "setStreamSize:",
  8914. protocol: "accessing",
  8915. fn: function (anInteger){
  8916. var self=this,$self=this;
  8917. $self["@streamSize"]=anInteger;
  8918. return self;
  8919. },
  8920. //>>excludeStart("ide", pragmas.excludeIdeData);
  8921. args: ["anInteger"],
  8922. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8923. referencedClasses: [],
  8924. //>>excludeEnd("ide");
  8925. messageSends: []
  8926. }),
  8927. $globals.Stream);
  8928. $core.addMethod(
  8929. $core.method({
  8930. selector: "setToEnd",
  8931. protocol: "positioning",
  8932. fn: function (){
  8933. var self=this,$self=this;
  8934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8935. return $core.withContext(function($ctx1) {
  8936. //>>excludeEnd("ctx");
  8937. $self._position_($self._size());
  8938. return self;
  8939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8940. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8941. //>>excludeEnd("ctx");
  8942. },
  8943. //>>excludeStart("ide", pragmas.excludeIdeData);
  8944. args: [],
  8945. source: "setToEnd\x0a\x09self position: self size",
  8946. referencedClasses: [],
  8947. //>>excludeEnd("ide");
  8948. messageSends: ["position:", "size"]
  8949. }),
  8950. $globals.Stream);
  8951. $core.addMethod(
  8952. $core.method({
  8953. selector: "size",
  8954. protocol: "accessing",
  8955. fn: function (){
  8956. var self=this,$self=this;
  8957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8958. return $core.withContext(function($ctx1) {
  8959. //>>excludeEnd("ctx");
  8960. return $self._streamSize();
  8961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8962. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8963. //>>excludeEnd("ctx");
  8964. },
  8965. //>>excludeStart("ide", pragmas.excludeIdeData);
  8966. args: [],
  8967. source: "size\x0a\x09^ self streamSize",
  8968. referencedClasses: [],
  8969. //>>excludeEnd("ide");
  8970. messageSends: ["streamSize"]
  8971. }),
  8972. $globals.Stream);
  8973. $core.addMethod(
  8974. $core.method({
  8975. selector: "skip:",
  8976. protocol: "positioning",
  8977. fn: function (anInteger){
  8978. var self=this,$self=this;
  8979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8980. return $core.withContext(function($ctx1) {
  8981. //>>excludeEnd("ctx");
  8982. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8983. return self;
  8984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8985. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8986. //>>excludeEnd("ctx");
  8987. },
  8988. //>>excludeStart("ide", pragmas.excludeIdeData);
  8989. args: ["anInteger"],
  8990. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8991. referencedClasses: [],
  8992. //>>excludeEnd("ide");
  8993. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8994. }),
  8995. $globals.Stream);
  8996. $core.addMethod(
  8997. $core.method({
  8998. selector: "streamSize",
  8999. protocol: "accessing",
  9000. fn: function (){
  9001. var self=this,$self=this;
  9002. return $self["@streamSize"];
  9003. },
  9004. //>>excludeStart("ide", pragmas.excludeIdeData);
  9005. args: [],
  9006. source: "streamSize\x0a\x09^ streamSize",
  9007. referencedClasses: [],
  9008. //>>excludeEnd("ide");
  9009. messageSends: []
  9010. }),
  9011. $globals.Stream);
  9012. $core.addMethod(
  9013. $core.method({
  9014. selector: "on:",
  9015. protocol: "instance creation",
  9016. fn: function (aCollection){
  9017. var self=this,$self=this;
  9018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9019. return $core.withContext(function($ctx1) {
  9020. //>>excludeEnd("ctx");
  9021. var $1;
  9022. $1=$self._new();
  9023. $recv($1)._setCollection_(aCollection);
  9024. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9025. return $recv($1)._yourself();
  9026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9027. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  9028. //>>excludeEnd("ctx");
  9029. },
  9030. //>>excludeStart("ide", pragmas.excludeIdeData);
  9031. args: ["aCollection"],
  9032. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9033. referencedClasses: [],
  9034. //>>excludeEnd("ide");
  9035. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9036. }),
  9037. $globals.Stream.a$cls);
  9038. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  9039. //>>excludeStart("ide", pragmas.excludeIdeData);
  9040. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9041. //>>excludeEnd("ide");
  9042. $core.addMethod(
  9043. $core.method({
  9044. selector: "cr",
  9045. protocol: "writing",
  9046. fn: function (){
  9047. var self=this,$self=this;
  9048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9049. return $core.withContext(function($ctx1) {
  9050. //>>excludeEnd("ctx");
  9051. return $self._nextPutAll_($recv($globals.String)._cr());
  9052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9053. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9054. //>>excludeEnd("ctx");
  9055. },
  9056. //>>excludeStart("ide", pragmas.excludeIdeData);
  9057. args: [],
  9058. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9059. referencedClasses: ["String"],
  9060. //>>excludeEnd("ide");
  9061. messageSends: ["nextPutAll:", "cr"]
  9062. }),
  9063. $globals.StringStream);
  9064. $core.addMethod(
  9065. $core.method({
  9066. selector: "crlf",
  9067. protocol: "writing",
  9068. fn: function (){
  9069. var self=this,$self=this;
  9070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9071. return $core.withContext(function($ctx1) {
  9072. //>>excludeEnd("ctx");
  9073. return $self._nextPutAll_($recv($globals.String)._crlf());
  9074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9075. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9076. //>>excludeEnd("ctx");
  9077. },
  9078. //>>excludeStart("ide", pragmas.excludeIdeData);
  9079. args: [],
  9080. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9081. referencedClasses: ["String"],
  9082. //>>excludeEnd("ide");
  9083. messageSends: ["nextPutAll:", "crlf"]
  9084. }),
  9085. $globals.StringStream);
  9086. $core.addMethod(
  9087. $core.method({
  9088. selector: "lf",
  9089. protocol: "writing",
  9090. fn: function (){
  9091. var self=this,$self=this;
  9092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9093. return $core.withContext(function($ctx1) {
  9094. //>>excludeEnd("ctx");
  9095. return $self._nextPutAll_($recv($globals.String)._lf());
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9098. //>>excludeEnd("ctx");
  9099. },
  9100. //>>excludeStart("ide", pragmas.excludeIdeData);
  9101. args: [],
  9102. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9103. referencedClasses: ["String"],
  9104. //>>excludeEnd("ide");
  9105. messageSends: ["nextPutAll:", "lf"]
  9106. }),
  9107. $globals.StringStream);
  9108. $core.addMethod(
  9109. $core.method({
  9110. selector: "next:",
  9111. protocol: "reading",
  9112. fn: function (anInteger){
  9113. var self=this,$self=this;
  9114. var tempCollection;
  9115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9116. return $core.withContext(function($ctx1) {
  9117. //>>excludeEnd("ctx");
  9118. var $1;
  9119. tempCollection=$recv($recv($self._collection())._class())._new();
  9120. $recv(anInteger)._timesRepeat_((function(){
  9121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9122. return $core.withContext(function($ctx2) {
  9123. //>>excludeEnd("ctx");
  9124. $1=$self._atEnd();
  9125. if(!$core.assert($1)){
  9126. tempCollection=$recv(tempCollection).__comma($self._next());
  9127. return tempCollection;
  9128. }
  9129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9131. //>>excludeEnd("ctx");
  9132. }));
  9133. return tempCollection;
  9134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9135. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9136. //>>excludeEnd("ctx");
  9137. },
  9138. //>>excludeStart("ide", pragmas.excludeIdeData);
  9139. args: ["anInteger"],
  9140. 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",
  9141. referencedClasses: [],
  9142. //>>excludeEnd("ide");
  9143. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9144. }),
  9145. $globals.StringStream);
  9146. $core.addMethod(
  9147. $core.method({
  9148. selector: "nextPut:",
  9149. protocol: "writing",
  9150. fn: function (aString){
  9151. var self=this,$self=this;
  9152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9153. return $core.withContext(function($ctx1) {
  9154. //>>excludeEnd("ctx");
  9155. $self._nextPutAll_(aString);
  9156. return self;
  9157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9158. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9159. //>>excludeEnd("ctx");
  9160. },
  9161. //>>excludeStart("ide", pragmas.excludeIdeData);
  9162. args: ["aString"],
  9163. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9164. referencedClasses: [],
  9165. //>>excludeEnd("ide");
  9166. messageSends: ["nextPutAll:"]
  9167. }),
  9168. $globals.StringStream);
  9169. $core.addMethod(
  9170. $core.method({
  9171. selector: "nextPutAll:",
  9172. protocol: "writing",
  9173. fn: function (aString){
  9174. var self=this,$self=this;
  9175. var pre,post;
  9176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9177. return $core.withContext(function($ctx1) {
  9178. //>>excludeEnd("ctx");
  9179. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9180. $1=$self._atEnd();
  9181. if($core.assert($1)){
  9182. $3=$self._collection();
  9183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9184. $ctx1.sendIdx["collection"]=1;
  9185. //>>excludeEnd("ctx");
  9186. $2=$recv($3).__comma(aString);
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. $ctx1.sendIdx[","]=1;
  9189. //>>excludeEnd("ctx");
  9190. $self._setCollection_($2);
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. $ctx1.sendIdx["setCollection:"]=1;
  9193. //>>excludeEnd("ctx");
  9194. } else {
  9195. $4=$self._collection();
  9196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9197. $ctx1.sendIdx["collection"]=2;
  9198. //>>excludeEnd("ctx");
  9199. $5=$self._position();
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. $ctx1.sendIdx["position"]=1;
  9202. //>>excludeEnd("ctx");
  9203. pre=$recv($4)._copyFrom_to_((1),$5);
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. $ctx1.sendIdx["copyFrom:to:"]=1;
  9206. //>>excludeEnd("ctx");
  9207. $6=$self._collection();
  9208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9209. $ctx1.sendIdx["collection"]=3;
  9210. //>>excludeEnd("ctx");
  9211. $9=$self._position();
  9212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9213. $ctx1.sendIdx["position"]=2;
  9214. //>>excludeEnd("ctx");
  9215. $8=$recv($9).__plus((1));
  9216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9217. $ctx1.sendIdx["+"]=2;
  9218. //>>excludeEnd("ctx");
  9219. $10=$recv(aString)._size();
  9220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9221. $ctx1.sendIdx["size"]=1;
  9222. //>>excludeEnd("ctx");
  9223. $7=$recv($8).__plus($10);
  9224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9225. $ctx1.sendIdx["+"]=1;
  9226. //>>excludeEnd("ctx");
  9227. $11=$recv($self._collection())._size();
  9228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9229. $ctx1.sendIdx["size"]=2;
  9230. //>>excludeEnd("ctx");
  9231. post=$recv($6)._copyFrom_to_($7,$11);
  9232. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9234. $ctx1.sendIdx[","]=2;
  9235. //>>excludeEnd("ctx");
  9236. $self._setCollection_($12);
  9237. }
  9238. $14=$self._position();
  9239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9240. $ctx1.sendIdx["position"]=3;
  9241. //>>excludeEnd("ctx");
  9242. $13=$recv($14).__plus($recv(aString)._size());
  9243. $self._position_($13);
  9244. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  9245. return self;
  9246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9247. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9248. //>>excludeEnd("ctx");
  9249. },
  9250. //>>excludeStart("ide", pragmas.excludeIdeData);
  9251. args: ["aString"],
  9252. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  9253. referencedClasses: [],
  9254. //>>excludeEnd("ide");
  9255. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9256. }),
  9257. $globals.StringStream);
  9258. $core.addMethod(
  9259. $core.method({
  9260. selector: "nextPutString:",
  9261. protocol: "writing",
  9262. fn: function (aString){
  9263. var self=this,$self=this;
  9264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9265. return $core.withContext(function($ctx1) {
  9266. //>>excludeEnd("ctx");
  9267. $self._nextPutAll_(aString);
  9268. return self;
  9269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9270. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9271. //>>excludeEnd("ctx");
  9272. },
  9273. //>>excludeStart("ide", pragmas.excludeIdeData);
  9274. args: ["aString"],
  9275. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9276. referencedClasses: [],
  9277. //>>excludeEnd("ide");
  9278. messageSends: ["nextPutAll:"]
  9279. }),
  9280. $globals.StringStream);
  9281. $core.addMethod(
  9282. $core.method({
  9283. selector: "print:",
  9284. protocol: "writing",
  9285. fn: function (anObject){
  9286. var self=this,$self=this;
  9287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9288. return $core.withContext(function($ctx1) {
  9289. //>>excludeEnd("ctx");
  9290. $recv(anObject)._printOn_(self);
  9291. return self;
  9292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9293. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  9294. //>>excludeEnd("ctx");
  9295. },
  9296. //>>excludeStart("ide", pragmas.excludeIdeData);
  9297. args: ["anObject"],
  9298. source: "print: anObject\x0a\x09anObject printOn: self",
  9299. referencedClasses: [],
  9300. //>>excludeEnd("ide");
  9301. messageSends: ["printOn:"]
  9302. }),
  9303. $globals.StringStream);
  9304. $core.addMethod(
  9305. $core.method({
  9306. selector: "printSymbol:",
  9307. protocol: "writing",
  9308. fn: function (anObject){
  9309. var self=this,$self=this;
  9310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9311. return $core.withContext(function($ctx1) {
  9312. //>>excludeEnd("ctx");
  9313. $recv(anObject)._asSymbolPrintOn_(self);
  9314. return self;
  9315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9316. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  9317. //>>excludeEnd("ctx");
  9318. },
  9319. //>>excludeStart("ide", pragmas.excludeIdeData);
  9320. args: ["anObject"],
  9321. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9322. referencedClasses: [],
  9323. //>>excludeEnd("ide");
  9324. messageSends: ["asSymbolPrintOn:"]
  9325. }),
  9326. $globals.StringStream);
  9327. $core.addMethod(
  9328. $core.method({
  9329. selector: "space",
  9330. protocol: "writing",
  9331. fn: function (){
  9332. var self=this,$self=this;
  9333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9334. return $core.withContext(function($ctx1) {
  9335. //>>excludeEnd("ctx");
  9336. $self._nextPut_(" ");
  9337. return self;
  9338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9339. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9340. //>>excludeEnd("ctx");
  9341. },
  9342. //>>excludeStart("ide", pragmas.excludeIdeData);
  9343. args: [],
  9344. source: "space\x0a\x09self nextPut: ' '",
  9345. referencedClasses: [],
  9346. //>>excludeEnd("ide");
  9347. messageSends: ["nextPut:"]
  9348. }),
  9349. $globals.StringStream);
  9350. $core.addMethod(
  9351. $core.method({
  9352. selector: "tab",
  9353. protocol: "writing",
  9354. fn: function (){
  9355. var self=this,$self=this;
  9356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9357. return $core.withContext(function($ctx1) {
  9358. //>>excludeEnd("ctx");
  9359. return $self._nextPutAll_($recv($globals.String)._tab());
  9360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9361. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9362. //>>excludeEnd("ctx");
  9363. },
  9364. //>>excludeStart("ide", pragmas.excludeIdeData);
  9365. args: [],
  9366. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9367. referencedClasses: ["String"],
  9368. //>>excludeEnd("ide");
  9369. messageSends: ["nextPutAll:", "tab"]
  9370. }),
  9371. $globals.StringStream);
  9372. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9373. //>>excludeStart("ide", pragmas.excludeIdeData);
  9374. $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.";
  9375. //>>excludeEnd("ide");
  9376. $core.addMethod(
  9377. $core.method({
  9378. selector: "initialize",
  9379. protocol: "initialization",
  9380. fn: function (){
  9381. var self=this,$self=this;
  9382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9383. return $core.withContext(function($ctx1) {
  9384. //>>excludeEnd("ctx");
  9385. (
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. $ctx1.supercall = true,
  9388. //>>excludeEnd("ctx");
  9389. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9391. $ctx1.supercall = false;
  9392. //>>excludeEnd("ctx");;
  9393. $self["@read"]=$recv($globals.OrderedCollection)._new();
  9394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9395. $ctx1.sendIdx["new"]=1;
  9396. //>>excludeEnd("ctx");
  9397. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9398. $self["@readIndex"]=(1);
  9399. return self;
  9400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9401. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9402. //>>excludeEnd("ctx");
  9403. },
  9404. //>>excludeStart("ide", pragmas.excludeIdeData);
  9405. args: [],
  9406. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9407. referencedClasses: ["OrderedCollection"],
  9408. //>>excludeEnd("ide");
  9409. messageSends: ["initialize", "new"]
  9410. }),
  9411. $globals.Queue);
  9412. $core.addMethod(
  9413. $core.method({
  9414. selector: "next",
  9415. protocol: "accessing",
  9416. fn: function (){
  9417. var self=this,$self=this;
  9418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9419. return $core.withContext(function($ctx1) {
  9420. //>>excludeEnd("ctx");
  9421. return $self._nextIfAbsent_((function(){
  9422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9423. return $core.withContext(function($ctx2) {
  9424. //>>excludeEnd("ctx");
  9425. return $self._error_("Cannot read from empty Queue.");
  9426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9427. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9428. //>>excludeEnd("ctx");
  9429. }));
  9430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9431. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9432. //>>excludeEnd("ctx");
  9433. },
  9434. //>>excludeStart("ide", pragmas.excludeIdeData);
  9435. args: [],
  9436. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9437. referencedClasses: [],
  9438. //>>excludeEnd("ide");
  9439. messageSends: ["nextIfAbsent:", "error:"]
  9440. }),
  9441. $globals.Queue);
  9442. $core.addMethod(
  9443. $core.method({
  9444. selector: "nextIfAbsent:",
  9445. protocol: "accessing",
  9446. fn: function (aBlock){
  9447. var self=this,$self=this;
  9448. var result;
  9449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9450. return $core.withContext(function($ctx1) {
  9451. //>>excludeEnd("ctx");
  9452. var $1;
  9453. var $early={};
  9454. try {
  9455. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  9456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9457. return $core.withContext(function($ctx2) {
  9458. //>>excludeEnd("ctx");
  9459. $recv($self["@write"])._ifEmpty_((function(){
  9460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9461. return $core.withContext(function($ctx3) {
  9462. //>>excludeEnd("ctx");
  9463. $1=$recv($self["@readIndex"]).__gt((1));
  9464. if($core.assert($1)){
  9465. $self["@read"]=[];
  9466. $self["@readIndex"]=(1);
  9467. $self["@readIndex"];
  9468. }
  9469. throw $early=[$recv(aBlock)._value()];
  9470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9471. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9472. //>>excludeEnd("ctx");
  9473. }));
  9474. $self["@read"]=$self["@write"];
  9475. $self["@readIndex"]=(1);
  9476. $self["@write"]=$recv($globals.OrderedCollection)._new();
  9477. return $recv($self["@read"])._first();
  9478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9479. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9480. //>>excludeEnd("ctx");
  9481. }));
  9482. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  9483. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  9484. return result;
  9485. }
  9486. catch(e) {if(e===$early)return e[0]; throw e}
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9489. //>>excludeEnd("ctx");
  9490. },
  9491. //>>excludeStart("ide", pragmas.excludeIdeData);
  9492. args: ["aBlock"],
  9493. 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",
  9494. referencedClasses: ["OrderedCollection"],
  9495. //>>excludeEnd("ide");
  9496. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9497. }),
  9498. $globals.Queue);
  9499. $core.addMethod(
  9500. $core.method({
  9501. selector: "nextPut:",
  9502. protocol: "accessing",
  9503. fn: function (anObject){
  9504. var self=this,$self=this;
  9505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9506. return $core.withContext(function($ctx1) {
  9507. //>>excludeEnd("ctx");
  9508. $recv($self["@write"])._add_(anObject);
  9509. return self;
  9510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9511. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9512. //>>excludeEnd("ctx");
  9513. },
  9514. //>>excludeStart("ide", pragmas.excludeIdeData);
  9515. args: ["anObject"],
  9516. source: "nextPut: anObject\x0a\x09write add: anObject",
  9517. referencedClasses: [],
  9518. //>>excludeEnd("ide");
  9519. messageSends: ["add:"]
  9520. }),
  9521. $globals.Queue);
  9522. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9523. //>>excludeStart("ide", pragmas.excludeIdeData);
  9524. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9525. //>>excludeEnd("ide");
  9526. $core.addMethod(
  9527. $core.method({
  9528. selector: "compile:",
  9529. protocol: "evaluating",
  9530. fn: function (aString){
  9531. var self=this,$self=this;
  9532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9533. return $core.withContext(function($ctx1) {
  9534. //>>excludeEnd("ctx");
  9535. return self.compile(aString);
  9536. return self;
  9537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9538. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9539. //>>excludeEnd("ctx");
  9540. },
  9541. //>>excludeStart("ide", pragmas.excludeIdeData);
  9542. args: ["aString"],
  9543. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9544. referencedClasses: [],
  9545. //>>excludeEnd("ide");
  9546. messageSends: []
  9547. }),
  9548. $globals.RegularExpression);
  9549. $core.addMethod(
  9550. $core.method({
  9551. selector: "exec:",
  9552. protocol: "evaluating",
  9553. fn: function (aString){
  9554. var self=this,$self=this;
  9555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9556. return $core.withContext(function($ctx1) {
  9557. //>>excludeEnd("ctx");
  9558. return self.exec(aString) || nil;
  9559. return self;
  9560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9561. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9562. //>>excludeEnd("ctx");
  9563. },
  9564. //>>excludeStart("ide", pragmas.excludeIdeData);
  9565. args: ["aString"],
  9566. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9567. referencedClasses: [],
  9568. //>>excludeEnd("ide");
  9569. messageSends: []
  9570. }),
  9571. $globals.RegularExpression);
  9572. $core.addMethod(
  9573. $core.method({
  9574. selector: "test:",
  9575. protocol: "evaluating",
  9576. fn: function (aString){
  9577. var self=this,$self=this;
  9578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9579. return $core.withContext(function($ctx1) {
  9580. //>>excludeEnd("ctx");
  9581. return self.test(aString);
  9582. return self;
  9583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9584. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9585. //>>excludeEnd("ctx");
  9586. },
  9587. //>>excludeStart("ide", pragmas.excludeIdeData);
  9588. args: ["aString"],
  9589. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9590. referencedClasses: [],
  9591. //>>excludeEnd("ide");
  9592. messageSends: []
  9593. }),
  9594. $globals.RegularExpression);
  9595. $core.addMethod(
  9596. $core.method({
  9597. selector: "fromString:",
  9598. protocol: "instance creation",
  9599. fn: function (aString){
  9600. var self=this,$self=this;
  9601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9602. return $core.withContext(function($ctx1) {
  9603. //>>excludeEnd("ctx");
  9604. return $self._fromString_flag_(aString,"");
  9605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9606. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  9607. //>>excludeEnd("ctx");
  9608. },
  9609. //>>excludeStart("ide", pragmas.excludeIdeData);
  9610. args: ["aString"],
  9611. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9612. referencedClasses: [],
  9613. //>>excludeEnd("ide");
  9614. messageSends: ["fromString:flag:"]
  9615. }),
  9616. $globals.RegularExpression.a$cls);
  9617. $core.addMethod(
  9618. $core.method({
  9619. selector: "fromString:flag:",
  9620. protocol: "instance creation",
  9621. fn: function (aString,anotherString){
  9622. var self=this,$self=this;
  9623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9624. return $core.withContext(function($ctx1) {
  9625. //>>excludeEnd("ctx");
  9626. return new RegExp(aString, anotherString);
  9627. return self;
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  9630. //>>excludeEnd("ctx");
  9631. },
  9632. //>>excludeStart("ide", pragmas.excludeIdeData);
  9633. args: ["aString", "anotherString"],
  9634. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9635. referencedClasses: [],
  9636. //>>excludeEnd("ide");
  9637. messageSends: []
  9638. }),
  9639. $globals.RegularExpression.a$cls);
  9640. });