Kernel-Collections.js 347 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anAssociation"],
  16. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["and:", "=", "class", "key", "value"]
  21. }, function ($methodClass){ return function (anAssociation){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. var $3,$2,$5,$4,$6,$1;
  27. $3=$self._class();
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. $ctx1.sendIdx["class"]=1;
  30. //>>excludeEnd("ctx");
  31. $2=$recv($3).__eq($recv(anAssociation)._class());
  32. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33. $ctx1.sendIdx["="]=1;
  34. //>>excludeEnd("ctx");
  35. $1=$recv($2)._and_((function(){
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. return $core.withContext(function($ctx2) {
  38. //>>excludeEnd("ctx");
  39. $5=$self._key();
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. $ctx2.sendIdx["key"]=1;
  42. //>>excludeEnd("ctx");
  43. $4=$recv($5).__eq($recv(anAssociation)._key());
  44. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45. $ctx2.sendIdx["="]=2;
  46. //>>excludeEnd("ctx");
  47. return $recv($4)._and_((function(){
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. return $core.withContext(function($ctx3) {
  50. //>>excludeEnd("ctx");
  51. $6=$self._value();
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. $ctx3.sendIdx["value"]=1;
  54. //>>excludeEnd("ctx");
  55. return $recv($6).__eq($recv(anAssociation)._value());
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58. //>>excludeEnd("ctx");
  59. }));
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62. //>>excludeEnd("ctx");
  63. }));
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. $ctx1.sendIdx["and:"]=1;
  66. //>>excludeEnd("ctx");
  67. return $1;
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  70. //>>excludeEnd("ctx");
  71. }; }),
  72. $globals.Association);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "key",
  76. protocol: "accessing",
  77. //>>excludeStart("ide", pragmas.excludeIdeData);
  78. args: [],
  79. source: "key\x0a\x09^ key",
  80. referencedClasses: [],
  81. //>>excludeEnd("ide");
  82. pragmas: [],
  83. messageSends: []
  84. }, function ($methodClass){ return function (){
  85. var self=this,$self=this;
  86. return $self.key;
  87. }; }),
  88. $globals.Association);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "key:",
  92. protocol: "accessing",
  93. //>>excludeStart("ide", pragmas.excludeIdeData);
  94. args: ["aKey"],
  95. source: "key: aKey\x0a\x09key := aKey",
  96. referencedClasses: [],
  97. //>>excludeEnd("ide");
  98. pragmas: [],
  99. messageSends: []
  100. }, function ($methodClass){ return function (aKey){
  101. var self=this,$self=this;
  102. $self.key=aKey;
  103. return self;
  104. }; }),
  105. $globals.Association);
  106. $core.addMethod(
  107. $core.method({
  108. selector: "printOn:",
  109. protocol: "printing",
  110. //>>excludeStart("ide", pragmas.excludeIdeData);
  111. args: ["aStream"],
  112. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  113. referencedClasses: [],
  114. //>>excludeEnd("ide");
  115. pragmas: [],
  116. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  117. }, function ($methodClass){ return function (aStream){
  118. var self=this,$self=this;
  119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  120. return $core.withContext(function($ctx1) {
  121. //>>excludeEnd("ctx");
  122. $recv($self._key())._printOn_(aStream);
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. $ctx1.sendIdx["printOn:"]=1;
  125. //>>excludeEnd("ctx");
  126. $recv(aStream)._nextPutAll_(" -> ");
  127. $recv($self._value())._printOn_(aStream);
  128. return self;
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  131. //>>excludeEnd("ctx");
  132. }; }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: "accessing",
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: [],
  140. source: "value\x0a\x09^ value",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. pragmas: [],
  144. messageSends: []
  145. }, function ($methodClass){ return function (){
  146. var self=this,$self=this;
  147. return $self.value;
  148. }; }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: "accessing",
  154. //>>excludeStart("ide", pragmas.excludeIdeData);
  155. args: ["aValue"],
  156. source: "value: aValue\x0a\x09value := aValue",
  157. referencedClasses: [],
  158. //>>excludeEnd("ide");
  159. pragmas: [],
  160. messageSends: []
  161. }, function ($methodClass){ return function (aValue){
  162. var self=this,$self=this;
  163. $self.value=aValue;
  164. return self;
  165. }; }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: "instance creation",
  171. //>>excludeStart("ide", pragmas.excludeIdeData);
  172. args: ["aKey", "aValue"],
  173. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  174. referencedClasses: [],
  175. //>>excludeEnd("ide");
  176. pragmas: [],
  177. messageSends: ["key:", "new", "value:", "yourself"]
  178. }, function ($methodClass){ return function (aKey,aValue){
  179. var self=this,$self=this;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. return $core.withContext(function($ctx1) {
  182. //>>excludeEnd("ctx");
  183. var $1;
  184. $1=$self._new();
  185. $recv($1)._key_(aKey);
  186. $recv($1)._value_(aValue);
  187. return $recv($1)._yourself();
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  190. //>>excludeEnd("ctx");
  191. }; }),
  192. $globals.Association.a$cls);
  193. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: "accessing",
  201. //>>excludeStart("ide", pragmas.excludeIdeData);
  202. args: ["anObject"],
  203. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  204. referencedClasses: [],
  205. //>>excludeEnd("ide");
  206. pragmas: [["inlineJS:", ["\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09"]]],
  207. messageSends: []
  208. }, function ($methodClass){ return function (anObject){
  209. var self=this,$self=this;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. return $core.withContext(function($ctx1) {
  212. //>>excludeEnd("ctx");
  213. var hash = $self.hashBlock(anObject);
  214. if (!hash) return null;
  215. var buckets = $self.buckets,
  216. bucket = buckets[hash];
  217. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  218. return bucket;
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  223. //>>excludeEnd("ctx");
  224. }; }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: "enumerating",
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["aBlock"],
  232. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. pragmas: [["inlineJS:", ["\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09"]]],
  236. messageSends: []
  237. }, function ($methodClass){ return function (aBlock){
  238. var self=this,$self=this;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. return $core.withContext(function($ctx1) {
  241. //>>excludeEnd("ctx");
  242. var buckets = $self.buckets;
  243. var keys = Object.keys(buckets);
  244. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  245. ;
  246. return self;
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  249. //>>excludeEnd("ctx");
  250. }; }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: "accessing",
  256. //>>excludeStart("ide", pragmas.excludeIdeData);
  257. args: ["aBlock"],
  258. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  259. referencedClasses: [],
  260. //>>excludeEnd("ide");
  261. pragmas: [],
  262. messageSends: []
  263. }, function ($methodClass){ return function (aBlock){
  264. var self=this,$self=this;
  265. $self.hashBlock=aBlock;
  266. return self;
  267. }; }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: "initialization",
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. pragmas: [],
  279. messageSends: ["initialize", "removeAll"]
  280. }, function ($methodClass){ return function (){
  281. var self=this,$self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. (
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. $ctx1.supercall = true,
  288. //>>excludeEnd("ctx");
  289. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. $ctx1.supercall = false;
  292. //>>excludeEnd("ctx");;
  293. $self._removeAll();
  294. return self;
  295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  296. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  297. //>>excludeEnd("ctx");
  298. }; }),
  299. $globals.BucketStore);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "newBucket",
  303. protocol: "private",
  304. //>>excludeStart("ide", pragmas.excludeIdeData);
  305. args: [],
  306. source: "newBucket\x0a\x09self subclassResponsibility",
  307. referencedClasses: [],
  308. //>>excludeEnd("ide");
  309. pragmas: [],
  310. messageSends: ["subclassResponsibility"]
  311. }, function ($methodClass){ return function (){
  312. var self=this,$self=this;
  313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  314. return $core.withContext(function($ctx1) {
  315. //>>excludeEnd("ctx");
  316. $self._subclassResponsibility();
  317. return self;
  318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  319. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  320. //>>excludeEnd("ctx");
  321. }; }),
  322. $globals.BucketStore);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "removeAll",
  326. protocol: "adding/removing",
  327. //>>excludeStart("ide", pragmas.excludeIdeData);
  328. args: [],
  329. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  330. referencedClasses: [],
  331. //>>excludeEnd("ide");
  332. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  333. messageSends: []
  334. }, function ($methodClass){ return function (){
  335. var self=this,$self=this;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. return $core.withContext(function($ctx1) {
  338. //>>excludeEnd("ctx");
  339. $self.buckets = Object.create(null);;
  340. return self;
  341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  342. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  343. //>>excludeEnd("ctx");
  344. }; }),
  345. $globals.BucketStore);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "hashBlock:",
  349. protocol: "instance creation",
  350. //>>excludeStart("ide", pragmas.excludeIdeData);
  351. args: ["aBlock"],
  352. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  353. referencedClasses: [],
  354. //>>excludeEnd("ide");
  355. pragmas: [],
  356. messageSends: ["hashBlock:", "new", "yourself"]
  357. }, function ($methodClass){ return function (aBlock){
  358. var self=this,$self=this;
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. return $core.withContext(function($ctx1) {
  361. //>>excludeEnd("ctx");
  362. var $1;
  363. $1=$self._new();
  364. $recv($1)._hashBlock_(aBlock);
  365. return $recv($1)._yourself();
  366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  367. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  368. //>>excludeEnd("ctx");
  369. }; }),
  370. $globals.BucketStore.a$cls);
  371. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  372. //>>excludeStart("ide", pragmas.excludeIdeData);
  373. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  374. //>>excludeEnd("ide");
  375. $core.addMethod(
  376. $core.method({
  377. selector: "newBucket",
  378. protocol: "private",
  379. //>>excludeStart("ide", pragmas.excludeIdeData);
  380. args: [],
  381. source: "newBucket\x0a\x09^ #()",
  382. referencedClasses: [],
  383. //>>excludeEnd("ide");
  384. pragmas: [],
  385. messageSends: []
  386. }, function ($methodClass){ return function (){
  387. var self=this,$self=this;
  388. return [];
  389. }; }),
  390. $globals.ArrayBucketStore);
  391. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  394. //>>excludeEnd("ide");
  395. $core.addMethod(
  396. $core.method({
  397. selector: ",",
  398. protocol: "copying",
  399. //>>excludeStart("ide", pragmas.excludeIdeData);
  400. args: ["aCollection"],
  401. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  402. referencedClasses: [],
  403. //>>excludeEnd("ide");
  404. pragmas: [],
  405. messageSends: ["addAll:", "copy", "yourself"]
  406. }, function ($methodClass){ return function (aCollection){
  407. var self=this,$self=this;
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. return $core.withContext(function($ctx1) {
  410. //>>excludeEnd("ctx");
  411. var $1;
  412. $1=$self._copy();
  413. $recv($1)._addAll_(aCollection);
  414. return $recv($1)._yourself();
  415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  416. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  417. //>>excludeEnd("ctx");
  418. }; }),
  419. $globals.Collection);
  420. $core.addMethod(
  421. $core.method({
  422. selector: "add:",
  423. protocol: "adding/removing",
  424. //>>excludeStart("ide", pragmas.excludeIdeData);
  425. args: ["anObject"],
  426. source: "add: anObject\x0a\x09self subclassResponsibility",
  427. referencedClasses: [],
  428. //>>excludeEnd("ide");
  429. pragmas: [],
  430. messageSends: ["subclassResponsibility"]
  431. }, function ($methodClass){ return function (anObject){
  432. var self=this,$self=this;
  433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  434. return $core.withContext(function($ctx1) {
  435. //>>excludeEnd("ctx");
  436. $self._subclassResponsibility();
  437. return self;
  438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  439. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  440. //>>excludeEnd("ctx");
  441. }; }),
  442. $globals.Collection);
  443. $core.addMethod(
  444. $core.method({
  445. selector: "addAll:",
  446. protocol: "adding/removing",
  447. //>>excludeStart("ide", pragmas.excludeIdeData);
  448. args: ["aCollection"],
  449. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  450. referencedClasses: [],
  451. //>>excludeEnd("ide");
  452. pragmas: [],
  453. messageSends: ["do:", "add:"]
  454. }, function ($methodClass){ return function (aCollection){
  455. var self=this,$self=this;
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. return $core.withContext(function($ctx1) {
  458. //>>excludeEnd("ctx");
  459. $recv(aCollection)._do_((function(each){
  460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  461. return $core.withContext(function($ctx2) {
  462. //>>excludeEnd("ctx");
  463. return $self._add_(each);
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  466. //>>excludeEnd("ctx");
  467. }));
  468. return aCollection;
  469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  470. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  471. //>>excludeEnd("ctx");
  472. }; }),
  473. $globals.Collection);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "allSatisfy:",
  477. protocol: "enumerating",
  478. //>>excludeStart("ide", pragmas.excludeIdeData);
  479. args: ["aBlock"],
  480. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  481. referencedClasses: [],
  482. //>>excludeEnd("ide");
  483. pragmas: [],
  484. messageSends: ["do:", "ifFalse:", "value:"]
  485. }, function ($methodClass){ return function (aBlock){
  486. var self=this,$self=this;
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx1) {
  489. //>>excludeEnd("ctx");
  490. var $1;
  491. var $early={};
  492. try {
  493. $self._do_((function(each){
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx2) {
  496. //>>excludeEnd("ctx");
  497. $1=$recv(aBlock)._value_(each);
  498. if(!$core.assert($1)){
  499. throw $early=[false];
  500. }
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  503. //>>excludeEnd("ctx");
  504. }));
  505. return true;
  506. }
  507. catch(e) {if(e===$early)return e[0]; throw e}
  508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  509. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  510. //>>excludeEnd("ctx");
  511. }; }),
  512. $globals.Collection);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "anyOne",
  516. protocol: "accessing",
  517. //>>excludeStart("ide", pragmas.excludeIdeData);
  518. args: [],
  519. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  520. referencedClasses: [],
  521. //>>excludeEnd("ide");
  522. pragmas: [],
  523. messageSends: ["ifEmpty:", "error:", "do:"]
  524. }, function ($methodClass){ return function (){
  525. var self=this,$self=this;
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx1) {
  528. //>>excludeEnd("ctx");
  529. var $early={};
  530. try {
  531. $self._ifEmpty_((function(){
  532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  533. return $core.withContext(function($ctx2) {
  534. //>>excludeEnd("ctx");
  535. return $self._error_("Collection is empty");
  536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  538. //>>excludeEnd("ctx");
  539. }));
  540. $self._do_((function(each){
  541. throw $early=[each];
  542. }));
  543. return self;
  544. }
  545. catch(e) {if(e===$early)return e[0]; throw e}
  546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  547. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  548. //>>excludeEnd("ctx");
  549. }; }),
  550. $globals.Collection);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "anySatisfy:",
  554. protocol: "enumerating",
  555. //>>excludeStart("ide", pragmas.excludeIdeData);
  556. args: ["aBlock"],
  557. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  558. referencedClasses: [],
  559. //>>excludeEnd("ide");
  560. pragmas: [],
  561. messageSends: ["do:", "ifTrue:", "value:"]
  562. }, function ($methodClass){ return function (aBlock){
  563. var self=this,$self=this;
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. return $core.withContext(function($ctx1) {
  566. //>>excludeEnd("ctx");
  567. var $1;
  568. var $early={};
  569. try {
  570. $self._do_((function(each){
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. return $core.withContext(function($ctx2) {
  573. //>>excludeEnd("ctx");
  574. $1=$recv(aBlock)._value_(each);
  575. if($core.assert($1)){
  576. throw $early=[true];
  577. }
  578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  580. //>>excludeEnd("ctx");
  581. }));
  582. return false;
  583. }
  584. catch(e) {if(e===$early)return e[0]; throw e}
  585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  586. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  587. //>>excludeEnd("ctx");
  588. }; }),
  589. $globals.Collection);
  590. $core.addMethod(
  591. $core.method({
  592. selector: "asArray",
  593. protocol: "converting",
  594. //>>excludeStart("ide", pragmas.excludeIdeData);
  595. args: [],
  596. source: "asArray\x0a\x09^ Array withAll: self",
  597. referencedClasses: ["Array"],
  598. //>>excludeEnd("ide");
  599. pragmas: [],
  600. messageSends: ["withAll:"]
  601. }, function ($methodClass){ return function (){
  602. var self=this,$self=this;
  603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  604. return $core.withContext(function($ctx1) {
  605. //>>excludeEnd("ctx");
  606. return $recv($globals.Array)._withAll_(self);
  607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  608. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  609. //>>excludeEnd("ctx");
  610. }; }),
  611. $globals.Collection);
  612. $core.addMethod(
  613. $core.method({
  614. selector: "asJavaScriptObject",
  615. protocol: "converting",
  616. //>>excludeStart("ide", pragmas.excludeIdeData);
  617. args: [],
  618. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  619. referencedClasses: [],
  620. //>>excludeEnd("ide");
  621. pragmas: [],
  622. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  623. }, function ($methodClass){ return function (){
  624. var self=this,$self=this;
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. return $core.withContext(function($ctx1) {
  627. //>>excludeEnd("ctx");
  628. return $recv($self._asArray())._collect_((function(each){
  629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  630. return $core.withContext(function($ctx2) {
  631. //>>excludeEnd("ctx");
  632. return $recv(each)._asJavaScriptObject();
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  635. //>>excludeEnd("ctx");
  636. }));
  637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  638. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  639. //>>excludeEnd("ctx");
  640. }; }),
  641. $globals.Collection);
  642. $core.addMethod(
  643. $core.method({
  644. selector: "asOrderedCollection",
  645. protocol: "converting",
  646. //>>excludeStart("ide", pragmas.excludeIdeData);
  647. args: [],
  648. source: "asOrderedCollection\x0a\x09^ self asArray",
  649. referencedClasses: [],
  650. //>>excludeEnd("ide");
  651. pragmas: [],
  652. messageSends: ["asArray"]
  653. }, function ($methodClass){ return function (){
  654. var self=this,$self=this;
  655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  656. return $core.withContext(function($ctx1) {
  657. //>>excludeEnd("ctx");
  658. return $self._asArray();
  659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  660. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  661. //>>excludeEnd("ctx");
  662. }; }),
  663. $globals.Collection);
  664. $core.addMethod(
  665. $core.method({
  666. selector: "asSet",
  667. protocol: "converting",
  668. //>>excludeStart("ide", pragmas.excludeIdeData);
  669. args: [],
  670. source: "asSet\x0a\x09^ Set withAll: self",
  671. referencedClasses: ["Set"],
  672. //>>excludeEnd("ide");
  673. pragmas: [],
  674. messageSends: ["withAll:"]
  675. }, function ($methodClass){ return function (){
  676. var self=this,$self=this;
  677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  678. return $core.withContext(function($ctx1) {
  679. //>>excludeEnd("ctx");
  680. return $recv($globals.Set)._withAll_(self);
  681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  682. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  683. //>>excludeEnd("ctx");
  684. }; }),
  685. $globals.Collection);
  686. $core.addMethod(
  687. $core.method({
  688. selector: "collect:",
  689. protocol: "enumerating",
  690. //>>excludeStart("ide", pragmas.excludeIdeData);
  691. args: ["aBlock"],
  692. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  693. referencedClasses: [],
  694. //>>excludeEnd("ide");
  695. pragmas: [],
  696. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  697. }, function ($methodClass){ return function (aBlock){
  698. var self=this,$self=this;
  699. var stream;
  700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  701. return $core.withContext(function($ctx1) {
  702. //>>excludeEnd("ctx");
  703. stream=$recv($recv($self._class())._new())._writeStream();
  704. $self._do_((function(each){
  705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  706. return $core.withContext(function($ctx2) {
  707. //>>excludeEnd("ctx");
  708. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  711. //>>excludeEnd("ctx");
  712. }));
  713. return $recv(stream)._contents();
  714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  715. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  716. //>>excludeEnd("ctx");
  717. }; }),
  718. $globals.Collection);
  719. $core.addMethod(
  720. $core.method({
  721. selector: "copyWith:",
  722. protocol: "copying",
  723. //>>excludeStart("ide", pragmas.excludeIdeData);
  724. args: ["anObject"],
  725. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  726. referencedClasses: [],
  727. //>>excludeEnd("ide");
  728. pragmas: [],
  729. messageSends: ["add:", "copy", "yourself"]
  730. }, function ($methodClass){ return function (anObject){
  731. var self=this,$self=this;
  732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  733. return $core.withContext(function($ctx1) {
  734. //>>excludeEnd("ctx");
  735. var $1;
  736. $1=$self._copy();
  737. $recv($1)._add_(anObject);
  738. return $recv($1)._yourself();
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  741. //>>excludeEnd("ctx");
  742. }; }),
  743. $globals.Collection);
  744. $core.addMethod(
  745. $core.method({
  746. selector: "copyWithAll:",
  747. protocol: "copying",
  748. //>>excludeStart("ide", pragmas.excludeIdeData);
  749. args: ["aCollection"],
  750. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  751. referencedClasses: [],
  752. //>>excludeEnd("ide");
  753. pragmas: [],
  754. messageSends: ["deprecatedAPI:", ","]
  755. }, function ($methodClass){ return function (aCollection){
  756. var self=this,$self=this;
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. return $core.withContext(function($ctx1) {
  759. //>>excludeEnd("ctx");
  760. $self._deprecatedAPI_("Use #, instead.");
  761. return $self.__comma(aCollection);
  762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  763. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  764. //>>excludeEnd("ctx");
  765. }; }),
  766. $globals.Collection);
  767. $core.addMethod(
  768. $core.method({
  769. selector: "copyWithout:",
  770. protocol: "copying",
  771. //>>excludeStart("ide", pragmas.excludeIdeData);
  772. args: ["anObject"],
  773. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  774. referencedClasses: [],
  775. //>>excludeEnd("ide");
  776. pragmas: [],
  777. messageSends: ["reject:", "="]
  778. }, function ($methodClass){ return function (anObject){
  779. var self=this,$self=this;
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx1) {
  782. //>>excludeEnd("ctx");
  783. return $self._reject_((function(each){
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. return $core.withContext(function($ctx2) {
  786. //>>excludeEnd("ctx");
  787. return $recv(each).__eq(anObject);
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  790. //>>excludeEnd("ctx");
  791. }));
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  794. //>>excludeEnd("ctx");
  795. }; }),
  796. $globals.Collection);
  797. $core.addMethod(
  798. $core.method({
  799. selector: "copyWithoutAll:",
  800. protocol: "copying",
  801. //>>excludeStart("ide", pragmas.excludeIdeData);
  802. args: ["aCollection"],
  803. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  804. referencedClasses: [],
  805. //>>excludeEnd("ide");
  806. pragmas: [],
  807. messageSends: ["reject:", "includes:"]
  808. }, function ($methodClass){ return function (aCollection){
  809. var self=this,$self=this;
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx1) {
  812. //>>excludeEnd("ctx");
  813. return $self._reject_((function(each){
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. return $core.withContext(function($ctx2) {
  816. //>>excludeEnd("ctx");
  817. return $recv(aCollection)._includes_(each);
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  820. //>>excludeEnd("ctx");
  821. }));
  822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  823. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  824. //>>excludeEnd("ctx");
  825. }; }),
  826. $globals.Collection);
  827. $core.addMethod(
  828. $core.method({
  829. selector: "deepCopy",
  830. protocol: "copying",
  831. //>>excludeStart("ide", pragmas.excludeIdeData);
  832. args: [],
  833. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  834. referencedClasses: [],
  835. //>>excludeEnd("ide");
  836. pragmas: [],
  837. messageSends: ["collect:", "deepCopy"]
  838. }, function ($methodClass){ return function (){
  839. var self=this,$self=this;
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx1) {
  842. //>>excludeEnd("ctx");
  843. return $self._collect_((function(each){
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. return $core.withContext(function($ctx2) {
  846. //>>excludeEnd("ctx");
  847. return $recv(each)._deepCopy();
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  850. //>>excludeEnd("ctx");
  851. }));
  852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  853. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  854. //>>excludeEnd("ctx");
  855. }; }),
  856. $globals.Collection);
  857. $core.addMethod(
  858. $core.method({
  859. selector: "detect:",
  860. protocol: "enumerating",
  861. //>>excludeStart("ide", pragmas.excludeIdeData);
  862. args: ["aBlock"],
  863. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  864. referencedClasses: [],
  865. //>>excludeEnd("ide");
  866. pragmas: [],
  867. messageSends: ["detect:ifNone:", "errorNotFound"]
  868. }, function ($methodClass){ return function (aBlock){
  869. var self=this,$self=this;
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx1) {
  872. //>>excludeEnd("ctx");
  873. return $self._detect_ifNone_(aBlock,(function(){
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. return $core.withContext(function($ctx2) {
  876. //>>excludeEnd("ctx");
  877. return $self._errorNotFound();
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  880. //>>excludeEnd("ctx");
  881. }));
  882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  883. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  884. //>>excludeEnd("ctx");
  885. }; }),
  886. $globals.Collection);
  887. $core.addMethod(
  888. $core.method({
  889. selector: "detect:ifNone:",
  890. protocol: "enumerating",
  891. //>>excludeStart("ide", pragmas.excludeIdeData);
  892. args: ["aBlock", "anotherBlock"],
  893. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  894. referencedClasses: [],
  895. //>>excludeEnd("ide");
  896. pragmas: [],
  897. messageSends: ["do:", "ifTrue:", "value:", "value"]
  898. }, function ($methodClass){ return function (aBlock,anotherBlock){
  899. var self=this,$self=this;
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. return $core.withContext(function($ctx1) {
  902. //>>excludeEnd("ctx");
  903. var $1;
  904. var $early={};
  905. try {
  906. $self._do_((function(each){
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. return $core.withContext(function($ctx2) {
  909. //>>excludeEnd("ctx");
  910. $1=$recv(aBlock)._value_(each);
  911. if($core.assert($1)){
  912. throw $early=[each];
  913. }
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  916. //>>excludeEnd("ctx");
  917. }));
  918. return $recv(anotherBlock)._value();
  919. }
  920. catch(e) {if(e===$early)return e[0]; throw e}
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  923. //>>excludeEnd("ctx");
  924. }; }),
  925. $globals.Collection);
  926. $core.addMethod(
  927. $core.method({
  928. selector: "do:",
  929. protocol: "enumerating",
  930. //>>excludeStart("ide", pragmas.excludeIdeData);
  931. args: ["aBlock"],
  932. source: "do: aBlock\x0a\x09self subclassResponsibility",
  933. referencedClasses: [],
  934. //>>excludeEnd("ide");
  935. pragmas: [],
  936. messageSends: ["subclassResponsibility"]
  937. }, function ($methodClass){ return function (aBlock){
  938. var self=this,$self=this;
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. return $core.withContext(function($ctx1) {
  941. //>>excludeEnd("ctx");
  942. $self._subclassResponsibility();
  943. return self;
  944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  945. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  946. //>>excludeEnd("ctx");
  947. }; }),
  948. $globals.Collection);
  949. $core.addMethod(
  950. $core.method({
  951. selector: "do:separatedBy:",
  952. protocol: "enumerating",
  953. //>>excludeStart("ide", pragmas.excludeIdeData);
  954. args: ["aBlock", "anotherBlock"],
  955. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  956. referencedClasses: [],
  957. //>>excludeEnd("ide");
  958. pragmas: [],
  959. messageSends: ["do:", "value", "value:"]
  960. }, function ($methodClass){ return function (aBlock,anotherBlock){
  961. var self=this,$self=this;
  962. var actionBeforeElement;
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. return $core.withContext(function($ctx1) {
  965. //>>excludeEnd("ctx");
  966. actionBeforeElement=(function(){
  967. actionBeforeElement=anotherBlock;
  968. return actionBeforeElement;
  969. });
  970. $self._do_((function(each){
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. return $core.withContext(function($ctx2) {
  973. //>>excludeEnd("ctx");
  974. $recv(actionBeforeElement)._value();
  975. return $recv(aBlock)._value_(each);
  976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  978. //>>excludeEnd("ctx");
  979. }));
  980. return self;
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  983. //>>excludeEnd("ctx");
  984. }; }),
  985. $globals.Collection);
  986. $core.addMethod(
  987. $core.method({
  988. selector: "errorNotFound",
  989. protocol: "error handling",
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. args: [],
  992. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  993. referencedClasses: [],
  994. //>>excludeEnd("ide");
  995. pragmas: [],
  996. messageSends: ["error:"]
  997. }, function ($methodClass){ return function (){
  998. var self=this,$self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. $self._error_("Object is not in the collection");
  1003. return self;
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1006. //>>excludeEnd("ctx");
  1007. }; }),
  1008. $globals.Collection);
  1009. $core.addMethod(
  1010. $core.method({
  1011. selector: "ifEmpty:",
  1012. protocol: "testing",
  1013. //>>excludeStart("ide", pragmas.excludeIdeData);
  1014. args: ["aBlock"],
  1015. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  1016. referencedClasses: [],
  1017. //>>excludeEnd("ide");
  1018. pragmas: [],
  1019. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1020. }, function ($methodClass){ return function (aBlock){
  1021. var self=this,$self=this;
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. return $core.withContext(function($ctx1) {
  1024. //>>excludeEnd("ctx");
  1025. var $1;
  1026. $1=$self._isEmpty();
  1027. if($core.assert($1)){
  1028. return $recv(aBlock)._value();
  1029. } else {
  1030. return self;
  1031. }
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1034. //>>excludeEnd("ctx");
  1035. }; }),
  1036. $globals.Collection);
  1037. $core.addMethod(
  1038. $core.method({
  1039. selector: "ifEmpty:ifNotEmpty:",
  1040. protocol: "testing",
  1041. //>>excludeStart("ide", pragmas.excludeIdeData);
  1042. args: ["aBlock", "anotherBlock"],
  1043. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1044. referencedClasses: [],
  1045. //>>excludeEnd("ide");
  1046. pragmas: [],
  1047. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1048. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1049. var self=this,$self=this;
  1050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1051. return $core.withContext(function($ctx1) {
  1052. //>>excludeEnd("ctx");
  1053. var $1;
  1054. $1=$self._isEmpty();
  1055. if($core.assert($1)){
  1056. return $recv(aBlock)._value();
  1057. } else {
  1058. return $recv(anotherBlock)._value_(self);
  1059. }
  1060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1061. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1062. //>>excludeEnd("ctx");
  1063. }; }),
  1064. $globals.Collection);
  1065. $core.addMethod(
  1066. $core.method({
  1067. selector: "ifNotEmpty:",
  1068. protocol: "testing",
  1069. //>>excludeStart("ide", pragmas.excludeIdeData);
  1070. args: ["aBlock"],
  1071. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1072. referencedClasses: [],
  1073. //>>excludeEnd("ide");
  1074. pragmas: [],
  1075. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1076. }, function ($methodClass){ return function (aBlock){
  1077. var self=this,$self=this;
  1078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1079. return $core.withContext(function($ctx1) {
  1080. //>>excludeEnd("ctx");
  1081. var $1;
  1082. $1=$self._notEmpty();
  1083. if($core.assert($1)){
  1084. return $recv(aBlock)._value_(self);
  1085. } else {
  1086. return self;
  1087. }
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1090. //>>excludeEnd("ctx");
  1091. }; }),
  1092. $globals.Collection);
  1093. $core.addMethod(
  1094. $core.method({
  1095. selector: "ifNotEmpty:ifEmpty:",
  1096. protocol: "testing",
  1097. //>>excludeStart("ide", pragmas.excludeIdeData);
  1098. args: ["aBlock", "anotherBlock"],
  1099. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1100. referencedClasses: [],
  1101. //>>excludeEnd("ide");
  1102. pragmas: [],
  1103. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1104. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1105. var self=this,$self=this;
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. return $core.withContext(function($ctx1) {
  1108. //>>excludeEnd("ctx");
  1109. var $1;
  1110. $1=$self._notEmpty();
  1111. if($core.assert($1)){
  1112. return $recv(aBlock)._value_(self);
  1113. } else {
  1114. return $recv(anotherBlock)._value();
  1115. }
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1118. //>>excludeEnd("ctx");
  1119. }; }),
  1120. $globals.Collection);
  1121. $core.addMethod(
  1122. $core.method({
  1123. selector: "includes:",
  1124. protocol: "testing",
  1125. //>>excludeStart("ide", pragmas.excludeIdeData);
  1126. args: ["anObject"],
  1127. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1128. referencedClasses: [],
  1129. //>>excludeEnd("ide");
  1130. pragmas: [],
  1131. messageSends: ["anySatisfy:", "="]
  1132. }, function ($methodClass){ return function (anObject){
  1133. var self=this,$self=this;
  1134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1135. return $core.withContext(function($ctx1) {
  1136. //>>excludeEnd("ctx");
  1137. return $self._anySatisfy_((function(each){
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. return $core.withContext(function($ctx2) {
  1140. //>>excludeEnd("ctx");
  1141. return $recv(each).__eq(anObject);
  1142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1144. //>>excludeEnd("ctx");
  1145. }));
  1146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1147. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1148. //>>excludeEnd("ctx");
  1149. }; }),
  1150. $globals.Collection);
  1151. $core.addMethod(
  1152. $core.method({
  1153. selector: "inject:into:",
  1154. protocol: "enumerating",
  1155. //>>excludeStart("ide", pragmas.excludeIdeData);
  1156. args: ["anObject", "aBlock"],
  1157. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  1158. referencedClasses: [],
  1159. //>>excludeEnd("ide");
  1160. pragmas: [],
  1161. messageSends: ["do:", "value:value:"]
  1162. }, function ($methodClass){ return function (anObject,aBlock){
  1163. var self=this,$self=this;
  1164. var result;
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. return $core.withContext(function($ctx1) {
  1167. //>>excludeEnd("ctx");
  1168. result=anObject;
  1169. $self._do_((function(each){
  1170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1171. return $core.withContext(function($ctx2) {
  1172. //>>excludeEnd("ctx");
  1173. result=$recv(aBlock)._value_value_(result,each);
  1174. return result;
  1175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1177. //>>excludeEnd("ctx");
  1178. }));
  1179. return result;
  1180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1181. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1182. //>>excludeEnd("ctx");
  1183. }; }),
  1184. $globals.Collection);
  1185. $core.addMethod(
  1186. $core.method({
  1187. selector: "intersection:",
  1188. protocol: "enumerating",
  1189. //>>excludeStart("ide", pragmas.excludeIdeData);
  1190. args: ["aCollection"],
  1191. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  1192. referencedClasses: ["Set"],
  1193. //>>excludeEnd("ide");
  1194. pragmas: [],
  1195. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1196. }, function ($methodClass){ return function (aCollection){
  1197. var self=this,$self=this;
  1198. var set,outputSet;
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. return $core.withContext(function($ctx1) {
  1201. //>>excludeEnd("ctx");
  1202. var $2,$1;
  1203. set=$self._asSet();
  1204. outputSet=$recv($globals.Set)._new();
  1205. $recv(aCollection)._do_((function(each){
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. return $core.withContext(function($ctx2) {
  1208. //>>excludeEnd("ctx");
  1209. $2=$recv(set)._includes_(each);
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. $ctx2.sendIdx["includes:"]=1;
  1212. //>>excludeEnd("ctx");
  1213. $1=$recv($2)._and_((function(){
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. return $core.withContext(function($ctx3) {
  1216. //>>excludeEnd("ctx");
  1217. return $recv($recv(outputSet)._includes_(each))._not();
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1220. //>>excludeEnd("ctx");
  1221. }));
  1222. if($core.assert($1)){
  1223. return $recv(outputSet)._add_(each);
  1224. }
  1225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1227. //>>excludeEnd("ctx");
  1228. }));
  1229. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1232. //>>excludeEnd("ctx");
  1233. }; }),
  1234. $globals.Collection);
  1235. $core.addMethod(
  1236. $core.method({
  1237. selector: "isEmpty",
  1238. protocol: "testing",
  1239. //>>excludeStart("ide", pragmas.excludeIdeData);
  1240. args: [],
  1241. source: "isEmpty\x0a\x09^ self size = 0",
  1242. referencedClasses: [],
  1243. //>>excludeEnd("ide");
  1244. pragmas: [],
  1245. messageSends: ["=", "size"]
  1246. }, function ($methodClass){ return function (){
  1247. var self=this,$self=this;
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return $core.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. return $recv($self._size()).__eq((0));
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1254. //>>excludeEnd("ctx");
  1255. }; }),
  1256. $globals.Collection);
  1257. $core.addMethod(
  1258. $core.method({
  1259. selector: "noneSatisfy:",
  1260. protocol: "enumerating",
  1261. //>>excludeStart("ide", pragmas.excludeIdeData);
  1262. args: ["aBlock"],
  1263. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  1264. referencedClasses: [],
  1265. //>>excludeEnd("ide");
  1266. pragmas: [],
  1267. messageSends: ["do:", "ifTrue:", "value:"]
  1268. }, function ($methodClass){ return function (aBlock){
  1269. var self=this,$self=this;
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx1) {
  1272. //>>excludeEnd("ctx");
  1273. var $1;
  1274. var $early={};
  1275. try {
  1276. $self._do_((function(item){
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. return $core.withContext(function($ctx2) {
  1279. //>>excludeEnd("ctx");
  1280. $1=$recv(aBlock)._value_(item);
  1281. if($core.assert($1)){
  1282. throw $early=[false];
  1283. }
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1286. //>>excludeEnd("ctx");
  1287. }));
  1288. return true;
  1289. }
  1290. catch(e) {if(e===$early)return e[0]; throw e}
  1291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1292. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1293. //>>excludeEnd("ctx");
  1294. }; }),
  1295. $globals.Collection);
  1296. $core.addMethod(
  1297. $core.method({
  1298. selector: "notEmpty",
  1299. protocol: "testing",
  1300. //>>excludeStart("ide", pragmas.excludeIdeData);
  1301. args: [],
  1302. source: "notEmpty\x0a\x09^ self isEmpty not",
  1303. referencedClasses: [],
  1304. //>>excludeEnd("ide");
  1305. pragmas: [],
  1306. messageSends: ["not", "isEmpty"]
  1307. }, function ($methodClass){ return function (){
  1308. var self=this,$self=this;
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. return $core.withContext(function($ctx1) {
  1311. //>>excludeEnd("ctx");
  1312. return $recv($self._isEmpty())._not();
  1313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1314. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1315. //>>excludeEnd("ctx");
  1316. }; }),
  1317. $globals.Collection);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "occurrencesOf:",
  1321. protocol: "accessing",
  1322. //>>excludeStart("ide", pragmas.excludeIdeData);
  1323. args: ["anObject"],
  1324. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  1325. referencedClasses: [],
  1326. //>>excludeEnd("ide");
  1327. pragmas: [],
  1328. messageSends: ["do:", "ifTrue:", "=", "+"]
  1329. }, function ($methodClass){ return function (anObject){
  1330. var self=this,$self=this;
  1331. var tally;
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. return $core.withContext(function($ctx1) {
  1334. //>>excludeEnd("ctx");
  1335. var $1;
  1336. tally=(0);
  1337. $self._do_((function(each){
  1338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1339. return $core.withContext(function($ctx2) {
  1340. //>>excludeEnd("ctx");
  1341. $1=$recv(anObject).__eq(each);
  1342. if($core.assert($1)){
  1343. tally=$recv(tally).__plus((1));
  1344. return tally;
  1345. }
  1346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1348. //>>excludeEnd("ctx");
  1349. }));
  1350. return tally;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1353. //>>excludeEnd("ctx");
  1354. }; }),
  1355. $globals.Collection);
  1356. $core.addMethod(
  1357. $core.method({
  1358. selector: "putOn:",
  1359. protocol: "streaming",
  1360. //>>excludeStart("ide", pragmas.excludeIdeData);
  1361. args: ["aStream"],
  1362. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1363. referencedClasses: [],
  1364. //>>excludeEnd("ide");
  1365. pragmas: [],
  1366. messageSends: ["do:", "putOn:"]
  1367. }, function ($methodClass){ return function (aStream){
  1368. var self=this,$self=this;
  1369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1370. return $core.withContext(function($ctx1) {
  1371. //>>excludeEnd("ctx");
  1372. $self._do_((function(each){
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. return $core.withContext(function($ctx2) {
  1375. //>>excludeEnd("ctx");
  1376. return $recv(each)._putOn_(aStream);
  1377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1379. //>>excludeEnd("ctx");
  1380. }));
  1381. return self;
  1382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1383. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1384. //>>excludeEnd("ctx");
  1385. }; }),
  1386. $globals.Collection);
  1387. $core.addMethod(
  1388. $core.method({
  1389. selector: "reject:",
  1390. protocol: "enumerating",
  1391. //>>excludeStart("ide", pragmas.excludeIdeData);
  1392. args: ["aBlock"],
  1393. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1394. referencedClasses: [],
  1395. //>>excludeEnd("ide");
  1396. pragmas: [],
  1397. messageSends: ["select:", "=", "value:"]
  1398. }, function ($methodClass){ return function (aBlock){
  1399. var self=this,$self=this;
  1400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1401. return $core.withContext(function($ctx1) {
  1402. //>>excludeEnd("ctx");
  1403. return $self._select_((function(each){
  1404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1405. return $core.withContext(function($ctx2) {
  1406. //>>excludeEnd("ctx");
  1407. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1410. //>>excludeEnd("ctx");
  1411. }));
  1412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1413. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1414. //>>excludeEnd("ctx");
  1415. }; }),
  1416. $globals.Collection);
  1417. $core.addMethod(
  1418. $core.method({
  1419. selector: "remove:",
  1420. protocol: "adding/removing",
  1421. //>>excludeStart("ide", pragmas.excludeIdeData);
  1422. args: ["anObject"],
  1423. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1424. referencedClasses: [],
  1425. //>>excludeEnd("ide");
  1426. pragmas: [],
  1427. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1428. }, function ($methodClass){ return function (anObject){
  1429. var self=this,$self=this;
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. return $core.withContext(function($ctx1) {
  1432. //>>excludeEnd("ctx");
  1433. return $self._remove_ifAbsent_(anObject,(function(){
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. return $core.withContext(function($ctx2) {
  1436. //>>excludeEnd("ctx");
  1437. return $self._errorNotFound();
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1440. //>>excludeEnd("ctx");
  1441. }));
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1444. //>>excludeEnd("ctx");
  1445. }; }),
  1446. $globals.Collection);
  1447. $core.addMethod(
  1448. $core.method({
  1449. selector: "remove:ifAbsent:",
  1450. protocol: "adding/removing",
  1451. //>>excludeStart("ide", pragmas.excludeIdeData);
  1452. args: ["anObject", "aBlock"],
  1453. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1454. referencedClasses: [],
  1455. //>>excludeEnd("ide");
  1456. pragmas: [],
  1457. messageSends: ["subclassResponsibility"]
  1458. }, function ($methodClass){ return function (anObject,aBlock){
  1459. var self=this,$self=this;
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return $core.withContext(function($ctx1) {
  1462. //>>excludeEnd("ctx");
  1463. $self._subclassResponsibility();
  1464. return self;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1467. //>>excludeEnd("ctx");
  1468. }; }),
  1469. $globals.Collection);
  1470. $core.addMethod(
  1471. $core.method({
  1472. selector: "removeAll",
  1473. protocol: "adding/removing",
  1474. //>>excludeStart("ide", pragmas.excludeIdeData);
  1475. args: [],
  1476. source: "removeAll\x0a\x09self subclassResponsibility",
  1477. referencedClasses: [],
  1478. //>>excludeEnd("ide");
  1479. pragmas: [],
  1480. messageSends: ["subclassResponsibility"]
  1481. }, function ($methodClass){ return function (){
  1482. var self=this,$self=this;
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. return $core.withContext(function($ctx1) {
  1485. //>>excludeEnd("ctx");
  1486. $self._subclassResponsibility();
  1487. return self;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1490. //>>excludeEnd("ctx");
  1491. }; }),
  1492. $globals.Collection);
  1493. $core.addMethod(
  1494. $core.method({
  1495. selector: "select:",
  1496. protocol: "enumerating",
  1497. //>>excludeStart("ide", pragmas.excludeIdeData);
  1498. args: ["aBlock"],
  1499. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  1500. referencedClasses: [],
  1501. //>>excludeEnd("ide");
  1502. pragmas: [],
  1503. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1504. }, function ($methodClass){ return function (aBlock){
  1505. var self=this,$self=this;
  1506. var stream;
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx1) {
  1509. //>>excludeEnd("ctx");
  1510. var $1;
  1511. stream=$recv($recv($self._class())._new())._writeStream();
  1512. $self._do_((function(each){
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. return $core.withContext(function($ctx2) {
  1515. //>>excludeEnd("ctx");
  1516. $1=$recv(aBlock)._value_(each);
  1517. if($core.assert($1)){
  1518. return $recv(stream)._nextPut_(each);
  1519. }
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1522. //>>excludeEnd("ctx");
  1523. }));
  1524. return $recv(stream)._contents();
  1525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1526. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1527. //>>excludeEnd("ctx");
  1528. }; }),
  1529. $globals.Collection);
  1530. $core.addMethod(
  1531. $core.method({
  1532. selector: "select:thenCollect:",
  1533. protocol: "enumerating",
  1534. //>>excludeStart("ide", pragmas.excludeIdeData);
  1535. args: ["selectBlock", "collectBlock"],
  1536. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  1537. referencedClasses: [],
  1538. //>>excludeEnd("ide");
  1539. pragmas: [],
  1540. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1541. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1542. var self=this,$self=this;
  1543. var stream;
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. return $core.withContext(function($ctx1) {
  1546. //>>excludeEnd("ctx");
  1547. var $1;
  1548. stream=$recv($recv($self._class())._new())._writeStream();
  1549. $self._do_((function(each){
  1550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1551. return $core.withContext(function($ctx2) {
  1552. //>>excludeEnd("ctx");
  1553. $1=$recv(selectBlock)._value_(each);
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. $ctx2.sendIdx["value:"]=1;
  1556. //>>excludeEnd("ctx");
  1557. if($core.assert($1)){
  1558. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1559. }
  1560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1562. //>>excludeEnd("ctx");
  1563. }));
  1564. return $recv(stream)._contents();
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1567. //>>excludeEnd("ctx");
  1568. }; }),
  1569. $globals.Collection);
  1570. $core.addMethod(
  1571. $core.method({
  1572. selector: "shallowCopy",
  1573. protocol: "copying",
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: [],
  1576. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. pragmas: [],
  1580. messageSends: ["collect:"]
  1581. }, function ($methodClass){ return function (){
  1582. var self=this,$self=this;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. return $core.withContext(function($ctx1) {
  1585. //>>excludeEnd("ctx");
  1586. return $self._collect_((function(each){
  1587. return each;
  1588. }));
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1591. //>>excludeEnd("ctx");
  1592. }; }),
  1593. $globals.Collection);
  1594. $core.addMethod(
  1595. $core.method({
  1596. selector: "single",
  1597. protocol: "accessing",
  1598. //>>excludeStart("ide", pragmas.excludeIdeData);
  1599. args: [],
  1600. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  1601. referencedClasses: [],
  1602. //>>excludeEnd("ide");
  1603. pragmas: [],
  1604. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1605. }, function ($methodClass){ return function (){
  1606. var self=this,$self=this;
  1607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1608. return $core.withContext(function($ctx1) {
  1609. //>>excludeEnd("ctx");
  1610. var $1;
  1611. $self._ifEmpty_((function(){
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. return $core.withContext(function($ctx2) {
  1614. //>>excludeEnd("ctx");
  1615. return $self._error_("Collection is empty");
  1616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1617. $ctx2.sendIdx["error:"]=1;
  1618. //>>excludeEnd("ctx");
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1621. //>>excludeEnd("ctx");
  1622. }));
  1623. $1=$recv($self._size()).__gt((1));
  1624. if($core.assert($1)){
  1625. $self._error_("Collection holds more than one element");
  1626. }
  1627. return $self._anyOne();
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1630. //>>excludeEnd("ctx");
  1631. }; }),
  1632. $globals.Collection);
  1633. $core.addMethod(
  1634. $core.method({
  1635. selector: "size",
  1636. protocol: "accessing",
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: [],
  1639. source: "size\x0a\x09self subclassResponsibility",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. pragmas: [],
  1643. messageSends: ["subclassResponsibility"]
  1644. }, function ($methodClass){ return function (){
  1645. var self=this,$self=this;
  1646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1647. return $core.withContext(function($ctx1) {
  1648. //>>excludeEnd("ctx");
  1649. $self._subclassResponsibility();
  1650. return self;
  1651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1652. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1653. //>>excludeEnd("ctx");
  1654. }; }),
  1655. $globals.Collection);
  1656. $core.addMethod(
  1657. $core.method({
  1658. selector: "classTag",
  1659. protocol: "accessing",
  1660. //>>excludeStart("ide", pragmas.excludeIdeData);
  1661. args: [],
  1662. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  1663. referencedClasses: [],
  1664. //>>excludeEnd("ide");
  1665. pragmas: [],
  1666. messageSends: []
  1667. }, function ($methodClass){ return function (){
  1668. var self=this,$self=this;
  1669. return "collection";
  1670. }; }),
  1671. $globals.Collection.a$cls);
  1672. $core.addMethod(
  1673. $core.method({
  1674. selector: "new:",
  1675. protocol: "instance creation",
  1676. //>>excludeStart("ide", pragmas.excludeIdeData);
  1677. args: ["anInteger"],
  1678. source: "new: anInteger\x0a\x09^ self new",
  1679. referencedClasses: [],
  1680. //>>excludeEnd("ide");
  1681. pragmas: [],
  1682. messageSends: ["new"]
  1683. }, function ($methodClass){ return function (anInteger){
  1684. var self=this,$self=this;
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. return $core.withContext(function($ctx1) {
  1687. //>>excludeEnd("ctx");
  1688. return $self._new();
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1691. //>>excludeEnd("ctx");
  1692. }; }),
  1693. $globals.Collection.a$cls);
  1694. $core.addMethod(
  1695. $core.method({
  1696. selector: "with:",
  1697. protocol: "instance creation",
  1698. //>>excludeStart("ide", pragmas.excludeIdeData);
  1699. args: ["anObject"],
  1700. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1701. referencedClasses: [],
  1702. //>>excludeEnd("ide");
  1703. pragmas: [],
  1704. messageSends: ["add:", "new", "yourself"]
  1705. }, function ($methodClass){ return function (anObject){
  1706. var self=this,$self=this;
  1707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1708. return $core.withContext(function($ctx1) {
  1709. //>>excludeEnd("ctx");
  1710. var $1;
  1711. $1=$self._new();
  1712. $recv($1)._add_(anObject);
  1713. return $recv($1)._yourself();
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1716. //>>excludeEnd("ctx");
  1717. }; }),
  1718. $globals.Collection.a$cls);
  1719. $core.addMethod(
  1720. $core.method({
  1721. selector: "with:with:",
  1722. protocol: "instance creation",
  1723. //>>excludeStart("ide", pragmas.excludeIdeData);
  1724. args: ["anObject", "anotherObject"],
  1725. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1726. referencedClasses: [],
  1727. //>>excludeEnd("ide");
  1728. pragmas: [],
  1729. messageSends: ["add:", "new", "yourself"]
  1730. }, function ($methodClass){ return function (anObject,anotherObject){
  1731. var self=this,$self=this;
  1732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1733. return $core.withContext(function($ctx1) {
  1734. //>>excludeEnd("ctx");
  1735. var $1;
  1736. $1=$self._new();
  1737. $recv($1)._add_(anObject);
  1738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1739. $ctx1.sendIdx["add:"]=1;
  1740. //>>excludeEnd("ctx");
  1741. $recv($1)._add_(anotherObject);
  1742. return $recv($1)._yourself();
  1743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1744. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1745. //>>excludeEnd("ctx");
  1746. }; }),
  1747. $globals.Collection.a$cls);
  1748. $core.addMethod(
  1749. $core.method({
  1750. selector: "with:with:with:",
  1751. protocol: "instance creation",
  1752. //>>excludeStart("ide", pragmas.excludeIdeData);
  1753. args: ["firstObject", "secondObject", "thirdObject"],
  1754. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  1755. referencedClasses: [],
  1756. //>>excludeEnd("ide");
  1757. pragmas: [],
  1758. messageSends: ["add:", "new", "yourself"]
  1759. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1760. var self=this,$self=this;
  1761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1762. return $core.withContext(function($ctx1) {
  1763. //>>excludeEnd("ctx");
  1764. var $1;
  1765. $1=$self._new();
  1766. $recv($1)._add_(firstObject);
  1767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1768. $ctx1.sendIdx["add:"]=1;
  1769. //>>excludeEnd("ctx");
  1770. $recv($1)._add_(secondObject);
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. $ctx1.sendIdx["add:"]=2;
  1773. //>>excludeEnd("ctx");
  1774. $recv($1)._add_(thirdObject);
  1775. return $recv($1)._yourself();
  1776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1777. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1778. //>>excludeEnd("ctx");
  1779. }; }),
  1780. $globals.Collection.a$cls);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "withAll:",
  1784. protocol: "instance creation",
  1785. //>>excludeStart("ide", pragmas.excludeIdeData);
  1786. args: ["aCollection"],
  1787. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1788. referencedClasses: [],
  1789. //>>excludeEnd("ide");
  1790. pragmas: [],
  1791. messageSends: ["addAll:", "new", "yourself"]
  1792. }, function ($methodClass){ return function (aCollection){
  1793. var self=this,$self=this;
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. return $core.withContext(function($ctx1) {
  1796. //>>excludeEnd("ctx");
  1797. var $1;
  1798. $1=$self._new();
  1799. $recv($1)._addAll_(aCollection);
  1800. return $recv($1)._yourself();
  1801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1802. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1803. //>>excludeEnd("ctx");
  1804. }; }),
  1805. $globals.Collection.a$cls);
  1806. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1807. //>>excludeStart("ide", pragmas.excludeIdeData);
  1808. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1809. //>>excludeEnd("ide");
  1810. $core.addMethod(
  1811. $core.method({
  1812. selector: "=",
  1813. protocol: "comparing",
  1814. //>>excludeStart("ide", pragmas.excludeIdeData);
  1815. args: ["anAssocitativeCollection"],
  1816. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1817. referencedClasses: [],
  1818. //>>excludeEnd("ide");
  1819. pragmas: [],
  1820. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1821. }, function ($methodClass){ return function (anAssocitativeCollection){
  1822. var self=this,$self=this;
  1823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1824. return $core.withContext(function($ctx1) {
  1825. //>>excludeEnd("ctx");
  1826. var $2,$1,$4,$3,$5;
  1827. $2=$self._class();
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. $ctx1.sendIdx["class"]=1;
  1830. //>>excludeEnd("ctx");
  1831. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. $ctx1.sendIdx["="]=1;
  1834. //>>excludeEnd("ctx");
  1835. if(!$core.assert($1)){
  1836. return false;
  1837. }
  1838. $4=$self._size();
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. $ctx1.sendIdx["size"]=1;
  1841. //>>excludeEnd("ctx");
  1842. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. $ctx1.sendIdx["="]=2;
  1845. //>>excludeEnd("ctx");
  1846. if(!$core.assert($3)){
  1847. return false;
  1848. }
  1849. $5=$self._associations();
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. $ctx1.sendIdx["associations"]=1;
  1852. //>>excludeEnd("ctx");
  1853. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1856. //>>excludeEnd("ctx");
  1857. }; }),
  1858. $globals.AssociativeCollection);
  1859. $core.addMethod(
  1860. $core.method({
  1861. selector: "add:",
  1862. protocol: "adding/removing",
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: ["anAssociation"],
  1865. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. pragmas: [],
  1869. messageSends: ["at:put:", "key", "value"]
  1870. }, function ($methodClass){ return function (anAssociation){
  1871. var self=this,$self=this;
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. return $core.withContext(function($ctx1) {
  1874. //>>excludeEnd("ctx");
  1875. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1876. return self;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1879. //>>excludeEnd("ctx");
  1880. }; }),
  1881. $globals.AssociativeCollection);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "addAll:",
  1885. protocol: "adding/removing",
  1886. //>>excludeStart("ide", pragmas.excludeIdeData);
  1887. args: ["anAssociativeCollection"],
  1888. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1889. referencedClasses: [],
  1890. //>>excludeEnd("ide");
  1891. pragmas: [],
  1892. messageSends: ["addAll:", "associations"]
  1893. }, function ($methodClass){ return function (anAssociativeCollection){
  1894. var self=this,$self=this;
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx1) {
  1897. //>>excludeEnd("ctx");
  1898. (
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. $ctx1.supercall = true,
  1901. //>>excludeEnd("ctx");
  1902. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. $ctx1.supercall = false;
  1905. //>>excludeEnd("ctx");;
  1906. return anAssociativeCollection;
  1907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1908. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1909. //>>excludeEnd("ctx");
  1910. }; }),
  1911. $globals.AssociativeCollection);
  1912. $core.addMethod(
  1913. $core.method({
  1914. selector: "asDictionary",
  1915. protocol: "converting",
  1916. //>>excludeStart("ide", pragmas.excludeIdeData);
  1917. args: [],
  1918. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1919. referencedClasses: ["Dictionary"],
  1920. //>>excludeEnd("ide");
  1921. pragmas: [],
  1922. messageSends: ["from:", "associations"]
  1923. }, function ($methodClass){ return function (){
  1924. var self=this,$self=this;
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. return $core.withContext(function($ctx1) {
  1927. //>>excludeEnd("ctx");
  1928. return $recv($globals.Dictionary)._from_($self._associations());
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1931. //>>excludeEnd("ctx");
  1932. }; }),
  1933. $globals.AssociativeCollection);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "asHashedCollection",
  1937. protocol: "converting",
  1938. //>>excludeStart("ide", pragmas.excludeIdeData);
  1939. args: [],
  1940. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1941. referencedClasses: ["HashedCollection"],
  1942. //>>excludeEnd("ide");
  1943. pragmas: [],
  1944. messageSends: ["from:", "associations"]
  1945. }, function ($methodClass){ return function (){
  1946. var self=this,$self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return $core.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. return $recv($globals.HashedCollection)._from_($self._associations());
  1951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1952. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1953. //>>excludeEnd("ctx");
  1954. }; }),
  1955. $globals.AssociativeCollection);
  1956. $core.addMethod(
  1957. $core.method({
  1958. selector: "asJavaScriptObject",
  1959. protocol: "converting",
  1960. //>>excludeStart("ide", pragmas.excludeIdeData);
  1961. args: [],
  1962. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  1963. referencedClasses: ["HashedCollection"],
  1964. //>>excludeEnd("ide");
  1965. pragmas: [],
  1966. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1967. }, function ($methodClass){ return function (){
  1968. var self=this,$self=this;
  1969. var hash;
  1970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1971. return $core.withContext(function($ctx1) {
  1972. //>>excludeEnd("ctx");
  1973. hash=$recv($globals.HashedCollection)._new();
  1974. $self._keysAndValuesDo_((function(key,value){
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. return $core.withContext(function($ctx2) {
  1977. //>>excludeEnd("ctx");
  1978. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1980. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1981. //>>excludeEnd("ctx");
  1982. }));
  1983. return hash;
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1986. //>>excludeEnd("ctx");
  1987. }; }),
  1988. $globals.AssociativeCollection);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "associations",
  1992. protocol: "accessing",
  1993. //>>excludeStart("ide", pragmas.excludeIdeData);
  1994. args: [],
  1995. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1996. referencedClasses: [],
  1997. //>>excludeEnd("ide");
  1998. pragmas: [],
  1999. messageSends: ["associationsDo:", "add:"]
  2000. }, function ($methodClass){ return function (){
  2001. var self=this,$self=this;
  2002. var associations;
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. return $core.withContext(function($ctx1) {
  2005. //>>excludeEnd("ctx");
  2006. associations=[];
  2007. $self._associationsDo_((function(each){
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. return $core.withContext(function($ctx2) {
  2010. //>>excludeEnd("ctx");
  2011. return $recv(associations)._add_(each);
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2014. //>>excludeEnd("ctx");
  2015. }));
  2016. return associations;
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2019. //>>excludeEnd("ctx");
  2020. }; }),
  2021. $globals.AssociativeCollection);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "associationsDo:",
  2025. protocol: "enumerating",
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["aBlock"],
  2028. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2029. referencedClasses: ["Association"],
  2030. //>>excludeEnd("ide");
  2031. pragmas: [],
  2032. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2033. }, function ($methodClass){ return function (aBlock){
  2034. var self=this,$self=this;
  2035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2036. return $core.withContext(function($ctx1) {
  2037. //>>excludeEnd("ctx");
  2038. $self._keysAndValuesDo_((function(key,value){
  2039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2040. return $core.withContext(function($ctx2) {
  2041. //>>excludeEnd("ctx");
  2042. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2044. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2045. //>>excludeEnd("ctx");
  2046. }));
  2047. return self;
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2050. //>>excludeEnd("ctx");
  2051. }; }),
  2052. $globals.AssociativeCollection);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "at:ifPresent:ifAbsent:",
  2056. protocol: "accessing",
  2057. //>>excludeStart("ide", pragmas.excludeIdeData);
  2058. args: ["aKey", "aBlock", "anotherBlock"],
  2059. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  2060. referencedClasses: [],
  2061. //>>excludeEnd("ide");
  2062. pragmas: [],
  2063. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2064. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2065. var self=this,$self=this;
  2066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2067. return $core.withContext(function($ctx1) {
  2068. //>>excludeEnd("ctx");
  2069. var $1;
  2070. $1=$self._includesKey_(aKey);
  2071. if($core.assert($1)){
  2072. return $recv(aBlock)._value_($self._at_(aKey));
  2073. } else {
  2074. return $recv(anotherBlock)._value();
  2075. }
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2078. //>>excludeEnd("ctx");
  2079. }; }),
  2080. $globals.AssociativeCollection);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "collect:",
  2084. protocol: "enumerating",
  2085. //>>excludeStart("ide", pragmas.excludeIdeData);
  2086. args: ["aBlock"],
  2087. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  2088. referencedClasses: [],
  2089. //>>excludeEnd("ide");
  2090. pragmas: [],
  2091. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2092. }, function ($methodClass){ return function (aBlock){
  2093. var self=this,$self=this;
  2094. var newDict;
  2095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2096. return $core.withContext(function($ctx1) {
  2097. //>>excludeEnd("ctx");
  2098. newDict=$recv($self._class())._new();
  2099. $self._keysAndValuesDo_((function(key,value){
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. return $core.withContext(function($ctx2) {
  2102. //>>excludeEnd("ctx");
  2103. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2105. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2106. //>>excludeEnd("ctx");
  2107. }));
  2108. return newDict;
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2111. //>>excludeEnd("ctx");
  2112. }; }),
  2113. $globals.AssociativeCollection);
  2114. $core.addMethod(
  2115. $core.method({
  2116. selector: "deepCopy",
  2117. protocol: "copying",
  2118. //>>excludeStart("ide", pragmas.excludeIdeData);
  2119. args: [],
  2120. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  2121. referencedClasses: [],
  2122. //>>excludeEnd("ide");
  2123. pragmas: [],
  2124. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2125. }, function ($methodClass){ return function (){
  2126. var self=this,$self=this;
  2127. var copy;
  2128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2129. return $core.withContext(function($ctx1) {
  2130. //>>excludeEnd("ctx");
  2131. copy=$recv($self._class())._new();
  2132. $self._keysAndValuesDo_((function(key,value){
  2133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2134. return $core.withContext(function($ctx2) {
  2135. //>>excludeEnd("ctx");
  2136. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2139. //>>excludeEnd("ctx");
  2140. }));
  2141. return copy;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2144. //>>excludeEnd("ctx");
  2145. }; }),
  2146. $globals.AssociativeCollection);
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: "detect:ifNone:",
  2150. protocol: "enumerating",
  2151. //>>excludeStart("ide", pragmas.excludeIdeData);
  2152. args: ["aBlock", "anotherBlock"],
  2153. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2154. referencedClasses: [],
  2155. //>>excludeEnd("ide");
  2156. pragmas: [],
  2157. messageSends: ["detect:ifNone:", "values"]
  2158. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2159. var self=this,$self=this;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2166. //>>excludeEnd("ctx");
  2167. }; }),
  2168. $globals.AssociativeCollection);
  2169. $core.addMethod(
  2170. $core.method({
  2171. selector: "do:",
  2172. protocol: "enumerating",
  2173. //>>excludeStart("ide", pragmas.excludeIdeData);
  2174. args: ["aBlock"],
  2175. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2176. referencedClasses: [],
  2177. //>>excludeEnd("ide");
  2178. pragmas: [],
  2179. messageSends: ["valuesDo:"]
  2180. }, function ($methodClass){ return function (aBlock){
  2181. var self=this,$self=this;
  2182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2183. return $core.withContext(function($ctx1) {
  2184. //>>excludeEnd("ctx");
  2185. $self._valuesDo_(aBlock);
  2186. return self;
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2189. //>>excludeEnd("ctx");
  2190. }; }),
  2191. $globals.AssociativeCollection);
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "includes:",
  2195. protocol: "enumerating",
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["anObject"],
  2198. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. pragmas: [],
  2202. messageSends: ["includes:", "values"]
  2203. }, function ($methodClass){ return function (anObject){
  2204. var self=this,$self=this;
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return $core.withContext(function($ctx1) {
  2207. //>>excludeEnd("ctx");
  2208. return $recv($self._values())._includes_(anObject);
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2211. //>>excludeEnd("ctx");
  2212. }; }),
  2213. $globals.AssociativeCollection);
  2214. $core.addMethod(
  2215. $core.method({
  2216. selector: "includesKey:",
  2217. protocol: "testing",
  2218. //>>excludeStart("ide", pragmas.excludeIdeData);
  2219. args: ["aKey"],
  2220. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2221. referencedClasses: [],
  2222. //>>excludeEnd("ide");
  2223. pragmas: [],
  2224. messageSends: ["subclassResponsibility"]
  2225. }, function ($methodClass){ return function (aKey){
  2226. var self=this,$self=this;
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. return $core.withContext(function($ctx1) {
  2229. //>>excludeEnd("ctx");
  2230. $self._subclassResponsibility();
  2231. return self;
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2234. //>>excludeEnd("ctx");
  2235. }; }),
  2236. $globals.AssociativeCollection);
  2237. $core.addMethod(
  2238. $core.method({
  2239. selector: "indexOf:ifAbsent:",
  2240. protocol: "accessing",
  2241. //>>excludeStart("ide", pragmas.excludeIdeData);
  2242. args: ["anObject", "aBlock"],
  2243. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2244. referencedClasses: [],
  2245. //>>excludeEnd("ide");
  2246. pragmas: [],
  2247. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2248. }, function ($methodClass){ return function (anObject,aBlock){
  2249. var self=this,$self=this;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. return $recv($self._keys())._detect_ifNone_((function(each){
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. return $core.withContext(function($ctx2) {
  2256. //>>excludeEnd("ctx");
  2257. return $recv($self._at_(each)).__eq(anObject);
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2260. //>>excludeEnd("ctx");
  2261. }),aBlock);
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2264. //>>excludeEnd("ctx");
  2265. }; }),
  2266. $globals.AssociativeCollection);
  2267. $core.addMethod(
  2268. $core.method({
  2269. selector: "keyAtValue:",
  2270. protocol: "accessing",
  2271. //>>excludeStart("ide", pragmas.excludeIdeData);
  2272. args: ["anObject"],
  2273. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2274. referencedClasses: [],
  2275. //>>excludeEnd("ide");
  2276. pragmas: [],
  2277. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2278. }, function ($methodClass){ return function (anObject){
  2279. var self=this,$self=this;
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx1) {
  2282. //>>excludeEnd("ctx");
  2283. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return $core.withContext(function($ctx2) {
  2286. //>>excludeEnd("ctx");
  2287. return $self._errorNotFound();
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2290. //>>excludeEnd("ctx");
  2291. }));
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2294. //>>excludeEnd("ctx");
  2295. }; }),
  2296. $globals.AssociativeCollection);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "keyAtValue:ifAbsent:",
  2300. protocol: "accessing",
  2301. //>>excludeStart("ide", pragmas.excludeIdeData);
  2302. args: ["anObject", "aBlock"],
  2303. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2304. referencedClasses: [],
  2305. //>>excludeEnd("ide");
  2306. pragmas: [],
  2307. messageSends: ["indexOf:ifAbsent:"]
  2308. }, function ($methodClass){ return function (anObject,aBlock){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2315. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2316. //>>excludeEnd("ctx");
  2317. }; }),
  2318. $globals.AssociativeCollection);
  2319. $core.addMethod(
  2320. $core.method({
  2321. selector: "keys",
  2322. protocol: "accessing",
  2323. //>>excludeStart("ide", pragmas.excludeIdeData);
  2324. args: [],
  2325. source: "keys\x0a\x09self subclassResponsibility",
  2326. referencedClasses: [],
  2327. //>>excludeEnd("ide");
  2328. pragmas: [],
  2329. messageSends: ["subclassResponsibility"]
  2330. }, function ($methodClass){ return function (){
  2331. var self=this,$self=this;
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. return $core.withContext(function($ctx1) {
  2334. //>>excludeEnd("ctx");
  2335. $self._subclassResponsibility();
  2336. return self;
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2339. //>>excludeEnd("ctx");
  2340. }; }),
  2341. $globals.AssociativeCollection);
  2342. $core.addMethod(
  2343. $core.method({
  2344. selector: "keysAndValuesDo:",
  2345. protocol: "enumerating",
  2346. //>>excludeStart("ide", pragmas.excludeIdeData);
  2347. args: ["aBlock"],
  2348. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2349. referencedClasses: [],
  2350. //>>excludeEnd("ide");
  2351. pragmas: [],
  2352. messageSends: ["keysDo:", "value:value:", "at:"]
  2353. }, function ($methodClass){ return function (aBlock){
  2354. var self=this,$self=this;
  2355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2356. return $core.withContext(function($ctx1) {
  2357. //>>excludeEnd("ctx");
  2358. $self._keysDo_((function(each){
  2359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2360. return $core.withContext(function($ctx2) {
  2361. //>>excludeEnd("ctx");
  2362. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2365. //>>excludeEnd("ctx");
  2366. }));
  2367. return self;
  2368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2369. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2370. //>>excludeEnd("ctx");
  2371. }; }),
  2372. $globals.AssociativeCollection);
  2373. $core.addMethod(
  2374. $core.method({
  2375. selector: "keysDo:",
  2376. protocol: "enumerating",
  2377. //>>excludeStart("ide", pragmas.excludeIdeData);
  2378. args: ["aBlock"],
  2379. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2380. referencedClasses: [],
  2381. //>>excludeEnd("ide");
  2382. pragmas: [],
  2383. messageSends: ["subclassResponsibility"]
  2384. }, function ($methodClass){ return function (aBlock){
  2385. var self=this,$self=this;
  2386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2387. return $core.withContext(function($ctx1) {
  2388. //>>excludeEnd("ctx");
  2389. $self._subclassResponsibility();
  2390. return self;
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2393. //>>excludeEnd("ctx");
  2394. }; }),
  2395. $globals.AssociativeCollection);
  2396. $core.addMethod(
  2397. $core.method({
  2398. selector: "printOn:",
  2399. protocol: "printing",
  2400. //>>excludeStart("ide", pragmas.excludeIdeData);
  2401. args: ["aStream"],
  2402. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  2403. referencedClasses: [],
  2404. //>>excludeEnd("ide");
  2405. pragmas: [],
  2406. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2407. }, function ($methodClass){ return function (aStream){
  2408. var self=this,$self=this;
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. return $core.withContext(function($ctx1) {
  2411. //>>excludeEnd("ctx");
  2412. (
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. $ctx1.supercall = true,
  2415. //>>excludeEnd("ctx");
  2416. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  2417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2418. $ctx1.supercall = false;
  2419. //>>excludeEnd("ctx");;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. $ctx1.sendIdx["printOn:"]=1;
  2422. //>>excludeEnd("ctx");
  2423. $recv(aStream)._nextPutAll_(" (");
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. $ctx1.sendIdx["nextPutAll:"]=1;
  2426. //>>excludeEnd("ctx");
  2427. $recv($self._associations())._do_separatedBy_((function(each){
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. return $core.withContext(function($ctx2) {
  2430. //>>excludeEnd("ctx");
  2431. return $recv(each)._printOn_(aStream);
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2434. //>>excludeEnd("ctx");
  2435. }),(function(){
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. return $core.withContext(function($ctx2) {
  2438. //>>excludeEnd("ctx");
  2439. return $recv(aStream)._nextPutAll_(" , ");
  2440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2441. $ctx2.sendIdx["nextPutAll:"]=2;
  2442. //>>excludeEnd("ctx");
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2445. //>>excludeEnd("ctx");
  2446. }));
  2447. $recv(aStream)._nextPutAll_(")");
  2448. return self;
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2451. //>>excludeEnd("ctx");
  2452. }; }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "remove:ifAbsent:",
  2457. protocol: "adding/removing",
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: ["aKey", "aBlock"],
  2460. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2461. referencedClasses: [],
  2462. //>>excludeEnd("ide");
  2463. pragmas: [],
  2464. messageSends: ["removeKey:ifAbsent:"]
  2465. }, function ($methodClass){ return function (aKey,aBlock){
  2466. var self=this,$self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2473. //>>excludeEnd("ctx");
  2474. }; }),
  2475. $globals.AssociativeCollection);
  2476. $core.addMethod(
  2477. $core.method({
  2478. selector: "removeAll",
  2479. protocol: "adding/removing",
  2480. //>>excludeStart("ide", pragmas.excludeIdeData);
  2481. args: [],
  2482. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2483. referencedClasses: [],
  2484. //>>excludeEnd("ide");
  2485. pragmas: [],
  2486. messageSends: ["do:", "keys", "removeKey:"]
  2487. }, function ($methodClass){ return function (){
  2488. var self=this,$self=this;
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. return $core.withContext(function($ctx1) {
  2491. //>>excludeEnd("ctx");
  2492. return $recv($self._keys())._do_((function(each){
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. return $core.withContext(function($ctx2) {
  2495. //>>excludeEnd("ctx");
  2496. return $self._removeKey_(each);
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2499. //>>excludeEnd("ctx");
  2500. }));
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2503. //>>excludeEnd("ctx");
  2504. }; }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "removeKey:",
  2509. protocol: "adding/removing",
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["aKey"],
  2512. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. pragmas: [],
  2516. messageSends: ["remove:"]
  2517. }, function ($methodClass){ return function (aKey){
  2518. var self=this,$self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. return $self._remove_(aKey);
  2523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2524. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2525. //>>excludeEnd("ctx");
  2526. }; }),
  2527. $globals.AssociativeCollection);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "removeKey:ifAbsent:",
  2531. protocol: "adding/removing",
  2532. //>>excludeStart("ide", pragmas.excludeIdeData);
  2533. args: ["aKey", "aBlock"],
  2534. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2535. referencedClasses: [],
  2536. //>>excludeEnd("ide");
  2537. pragmas: [],
  2538. messageSends: ["subclassResponsibility"]
  2539. }, function ($methodClass){ return function (aKey,aBlock){
  2540. var self=this,$self=this;
  2541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2542. return $core.withContext(function($ctx1) {
  2543. //>>excludeEnd("ctx");
  2544. $self._subclassResponsibility();
  2545. return self;
  2546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2547. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2548. //>>excludeEnd("ctx");
  2549. }; }),
  2550. $globals.AssociativeCollection);
  2551. $core.addMethod(
  2552. $core.method({
  2553. selector: "select:",
  2554. protocol: "enumerating",
  2555. //>>excludeStart("ide", pragmas.excludeIdeData);
  2556. args: ["aBlock"],
  2557. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  2558. referencedClasses: [],
  2559. //>>excludeEnd("ide");
  2560. pragmas: [],
  2561. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2562. }, function ($methodClass){ return function (aBlock){
  2563. var self=this,$self=this;
  2564. var newDict;
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. return $core.withContext(function($ctx1) {
  2567. //>>excludeEnd("ctx");
  2568. var $1;
  2569. newDict=$recv($self._class())._new();
  2570. $self._keysAndValuesDo_((function(key,value){
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. return $core.withContext(function($ctx2) {
  2573. //>>excludeEnd("ctx");
  2574. $1=$recv(aBlock)._value_(value);
  2575. if($core.assert($1)){
  2576. return $recv(newDict)._at_put_(key,value);
  2577. }
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2580. //>>excludeEnd("ctx");
  2581. }));
  2582. return newDict;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2585. //>>excludeEnd("ctx");
  2586. }; }),
  2587. $globals.AssociativeCollection);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "select:thenCollect:",
  2591. protocol: "enumerating",
  2592. //>>excludeStart("ide", pragmas.excludeIdeData);
  2593. args: ["selectBlock", "collectBlock"],
  2594. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  2595. referencedClasses: [],
  2596. //>>excludeEnd("ide");
  2597. pragmas: [],
  2598. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2599. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2600. var self=this,$self=this;
  2601. var newDict;
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return $core.withContext(function($ctx1) {
  2604. //>>excludeEnd("ctx");
  2605. var $1;
  2606. newDict=$recv($self._class())._new();
  2607. $self._keysAndValuesDo_((function(key,value){
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. return $core.withContext(function($ctx2) {
  2610. //>>excludeEnd("ctx");
  2611. $1=$recv(selectBlock)._value_(value);
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. $ctx2.sendIdx["value:"]=1;
  2614. //>>excludeEnd("ctx");
  2615. if($core.assert($1)){
  2616. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2617. }
  2618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2619. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2620. //>>excludeEnd("ctx");
  2621. }));
  2622. return newDict;
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2625. //>>excludeEnd("ctx");
  2626. }; }),
  2627. $globals.AssociativeCollection);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "shallowCopy",
  2631. protocol: "copying",
  2632. //>>excludeStart("ide", pragmas.excludeIdeData);
  2633. args: [],
  2634. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  2635. referencedClasses: [],
  2636. //>>excludeEnd("ide");
  2637. pragmas: [],
  2638. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2639. }, function ($methodClass){ return function (){
  2640. var self=this,$self=this;
  2641. var copy;
  2642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2643. return $core.withContext(function($ctx1) {
  2644. //>>excludeEnd("ctx");
  2645. copy=$recv($self._class())._new();
  2646. $self._keysAndValuesDo_((function(key,value){
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx2) {
  2649. //>>excludeEnd("ctx");
  2650. return $recv(copy)._at_put_(key,value);
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2653. //>>excludeEnd("ctx");
  2654. }));
  2655. return copy;
  2656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2657. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2658. //>>excludeEnd("ctx");
  2659. }; }),
  2660. $globals.AssociativeCollection);
  2661. $core.addMethod(
  2662. $core.method({
  2663. selector: "size",
  2664. protocol: "accessing",
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: [],
  2667. source: "size\x0a\x09^ self keys size",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. pragmas: [],
  2671. messageSends: ["size", "keys"]
  2672. }, function ($methodClass){ return function (){
  2673. var self=this,$self=this;
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. return $core.withContext(function($ctx1) {
  2676. //>>excludeEnd("ctx");
  2677. return $recv($self._keys())._size();
  2678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2679. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2680. //>>excludeEnd("ctx");
  2681. }; }),
  2682. $globals.AssociativeCollection);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "values",
  2686. protocol: "accessing",
  2687. //>>excludeStart("ide", pragmas.excludeIdeData);
  2688. args: [],
  2689. source: "values\x0a\x09self subclassResponsibility",
  2690. referencedClasses: [],
  2691. //>>excludeEnd("ide");
  2692. pragmas: [],
  2693. messageSends: ["subclassResponsibility"]
  2694. }, function ($methodClass){ return function (){
  2695. var self=this,$self=this;
  2696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2697. return $core.withContext(function($ctx1) {
  2698. //>>excludeEnd("ctx");
  2699. $self._subclassResponsibility();
  2700. return self;
  2701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2702. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2703. //>>excludeEnd("ctx");
  2704. }; }),
  2705. $globals.AssociativeCollection);
  2706. $core.addMethod(
  2707. $core.method({
  2708. selector: "valuesDo:",
  2709. protocol: "enumerating",
  2710. //>>excludeStart("ide", pragmas.excludeIdeData);
  2711. args: ["aBlock"],
  2712. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2713. referencedClasses: [],
  2714. //>>excludeEnd("ide");
  2715. pragmas: [],
  2716. messageSends: ["subclassResponsibility"]
  2717. }, function ($methodClass){ return function (aBlock){
  2718. var self=this,$self=this;
  2719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2720. return $core.withContext(function($ctx1) {
  2721. //>>excludeEnd("ctx");
  2722. $self._subclassResponsibility();
  2723. return self;
  2724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2725. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2726. //>>excludeEnd("ctx");
  2727. }; }),
  2728. $globals.AssociativeCollection);
  2729. $core.addMethod(
  2730. $core.method({
  2731. selector: "withIndexDo:",
  2732. protocol: "enumerating",
  2733. //>>excludeStart("ide", pragmas.excludeIdeData);
  2734. args: ["aBlock"],
  2735. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2736. referencedClasses: [],
  2737. //>>excludeEnd("ide");
  2738. pragmas: [],
  2739. messageSends: ["keysAndValuesDo:", "value:value:"]
  2740. }, function ($methodClass){ return function (aBlock){
  2741. var self=this,$self=this;
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. return $core.withContext(function($ctx1) {
  2744. //>>excludeEnd("ctx");
  2745. $self._keysAndValuesDo_((function(key,value){
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. return $core.withContext(function($ctx2) {
  2748. //>>excludeEnd("ctx");
  2749. return $recv(aBlock)._value_value_(value,key);
  2750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2751. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2752. //>>excludeEnd("ctx");
  2753. }));
  2754. return self;
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2757. //>>excludeEnd("ctx");
  2758. }; }),
  2759. $globals.AssociativeCollection);
  2760. $core.addMethod(
  2761. $core.method({
  2762. selector: "from:",
  2763. protocol: "instance creation",
  2764. //>>excludeStart("ide", pragmas.excludeIdeData);
  2765. args: ["aCollection"],
  2766. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2767. referencedClasses: [],
  2768. //>>excludeEnd("ide");
  2769. pragmas: [],
  2770. messageSends: ["new", "do:", "add:"]
  2771. }, function ($methodClass){ return function (aCollection){
  2772. var self=this,$self=this;
  2773. var newCollection;
  2774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2775. return $core.withContext(function($ctx1) {
  2776. //>>excludeEnd("ctx");
  2777. newCollection=$self._new();
  2778. $recv(aCollection)._do_((function(each){
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx2) {
  2781. //>>excludeEnd("ctx");
  2782. return $recv(newCollection)._add_(each);
  2783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2785. //>>excludeEnd("ctx");
  2786. }));
  2787. return newCollection;
  2788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2789. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2790. //>>excludeEnd("ctx");
  2791. }; }),
  2792. $globals.AssociativeCollection.a$cls);
  2793. $core.addMethod(
  2794. $core.method({
  2795. selector: "fromPairs:",
  2796. protocol: "instance creation",
  2797. //>>excludeStart("ide", pragmas.excludeIdeData);
  2798. args: ["aCollection"],
  2799. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2800. referencedClasses: [],
  2801. //>>excludeEnd("ide");
  2802. pragmas: [],
  2803. messageSends: ["from:"]
  2804. }, function ($methodClass){ return function (aCollection){
  2805. var self=this,$self=this;
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. return $core.withContext(function($ctx1) {
  2808. //>>excludeEnd("ctx");
  2809. return $self._from_(aCollection);
  2810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2811. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2812. //>>excludeEnd("ctx");
  2813. }; }),
  2814. $globals.AssociativeCollection.a$cls);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "newFromPairs:",
  2818. protocol: "instance creation",
  2819. //>>excludeStart("ide", pragmas.excludeIdeData);
  2820. args: ["aCollection"],
  2821. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  2822. referencedClasses: [],
  2823. //>>excludeEnd("ide");
  2824. pragmas: [],
  2825. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2826. }, function ($methodClass){ return function (aCollection){
  2827. var self=this,$self=this;
  2828. var newCollection;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. return $core.withContext(function($ctx1) {
  2831. //>>excludeEnd("ctx");
  2832. var $2,$1,$3,$4;
  2833. $2=$recv(aCollection)._size();
  2834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2835. $ctx1.sendIdx["size"]=1;
  2836. //>>excludeEnd("ctx");
  2837. $1=$recv($2)._even();
  2838. if(!$core.assert($1)){
  2839. $self._error_("#newFromPairs only accepts arrays of an even length");
  2840. }
  2841. newCollection=$self._new();
  2842. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. return $core.withContext(function($ctx2) {
  2845. //>>excludeEnd("ctx");
  2846. $3=newCollection;
  2847. $4=$recv(aCollection)._at_(each);
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. $ctx2.sendIdx["at:"]=1;
  2850. //>>excludeEnd("ctx");
  2851. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2854. //>>excludeEnd("ctx");
  2855. }));
  2856. return newCollection;
  2857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2858. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2859. //>>excludeEnd("ctx");
  2860. }; }),
  2861. $globals.AssociativeCollection.a$cls);
  2862. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2863. //>>excludeStart("ide", pragmas.excludeIdeData);
  2864. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  2865. //>>excludeEnd("ide");
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "at:ifAbsent:",
  2869. protocol: "accessing",
  2870. //>>excludeStart("ide", pragmas.excludeIdeData);
  2871. args: ["aKey", "aBlock"],
  2872. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09'>",
  2873. referencedClasses: [],
  2874. //>>excludeEnd("ide");
  2875. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2876. messageSends: []
  2877. }, function ($methodClass){ return function (aKey,aBlock){
  2878. var self=this,$self=this;
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. return $core.withContext(function($ctx1) {
  2881. //>>excludeEnd("ctx");
  2882. var index = $self._positionOfKey_(aKey);
  2883. return index >=0 ? $self.values[index] : aBlock._value();
  2884. ;
  2885. return self;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2888. //>>excludeEnd("ctx");
  2889. }; }),
  2890. $globals.Dictionary);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "at:put:",
  2894. protocol: "accessing",
  2895. //>>excludeStart("ide", pragmas.excludeIdeData);
  2896. args: ["aKey", "aValue"],
  2897. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self.keys;\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self.values[index] = aValue;\x0a\x09'>",
  2898. referencedClasses: [],
  2899. //>>excludeEnd("ide");
  2900. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self.keys;\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self.values[index] = aValue;\x0a\x09"]]],
  2901. messageSends: []
  2902. }, function ($methodClass){ return function (aKey,aValue){
  2903. var self=this,$self=this;
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. return $core.withContext(function($ctx1) {
  2906. //>>excludeEnd("ctx");
  2907. var index = $self._positionOfKey_(aKey);
  2908. if(index === -1) {
  2909. var keys = $self.keys;
  2910. index = keys.length;
  2911. keys.push(aKey);
  2912. }
  2913. return $self.values[index] = aValue;
  2914. ;
  2915. return self;
  2916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2917. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2918. //>>excludeEnd("ctx");
  2919. }; }),
  2920. $globals.Dictionary);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "includesKey:",
  2924. protocol: "testing",
  2925. //>>excludeStart("ide", pragmas.excludeIdeData);
  2926. args: ["aKey"],
  2927. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2928. referencedClasses: [],
  2929. //>>excludeEnd("ide");
  2930. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2931. messageSends: []
  2932. }, function ($methodClass){ return function (aKey){
  2933. var self=this,$self=this;
  2934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2935. return $core.withContext(function($ctx1) {
  2936. //>>excludeEnd("ctx");
  2937. return $self._positionOfKey_(aKey) >= 0;;
  2938. return self;
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2941. //>>excludeEnd("ctx");
  2942. }; }),
  2943. $globals.Dictionary);
  2944. $core.addMethod(
  2945. $core.method({
  2946. selector: "indexOf:ifAbsent:",
  2947. protocol: "accessing",
  2948. //>>excludeStart("ide", pragmas.excludeIdeData);
  2949. args: ["anObject", "aBlock"],
  2950. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  2951. referencedClasses: [],
  2952. //>>excludeEnd("ide");
  2953. pragmas: [],
  2954. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2955. }, function ($methodClass){ return function (anObject,aBlock){
  2956. var self=this,$self=this;
  2957. var index;
  2958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2959. return $core.withContext(function($ctx1) {
  2960. //>>excludeEnd("ctx");
  2961. var $1;
  2962. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2963. return (0);
  2964. }));
  2965. $1=$recv(index).__eq((0));
  2966. if($core.assert($1)){
  2967. return $recv(aBlock)._value();
  2968. } else {
  2969. return $recv($self.keys)._at_(index);
  2970. }
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2973. //>>excludeEnd("ctx");
  2974. }; }),
  2975. $globals.Dictionary);
  2976. $core.addMethod(
  2977. $core.method({
  2978. selector: "initialize",
  2979. protocol: "initialization",
  2980. //>>excludeStart("ide", pragmas.excludeIdeData);
  2981. args: [],
  2982. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2983. referencedClasses: [],
  2984. //>>excludeEnd("ide");
  2985. pragmas: [],
  2986. messageSends: ["initialize"]
  2987. }, function ($methodClass){ return function (){
  2988. var self=this,$self=this;
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. return $core.withContext(function($ctx1) {
  2991. //>>excludeEnd("ctx");
  2992. (
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. $ctx1.supercall = true,
  2995. //>>excludeEnd("ctx");
  2996. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. $ctx1.supercall = false;
  2999. //>>excludeEnd("ctx");;
  3000. $self.keys=[];
  3001. $self.values=[];
  3002. return self;
  3003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3004. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3005. //>>excludeEnd("ctx");
  3006. }; }),
  3007. $globals.Dictionary);
  3008. $core.addMethod(
  3009. $core.method({
  3010. selector: "keys",
  3011. protocol: "accessing",
  3012. //>>excludeStart("ide", pragmas.excludeIdeData);
  3013. args: [],
  3014. source: "keys\x0a\x09^ keys copy",
  3015. referencedClasses: [],
  3016. //>>excludeEnd("ide");
  3017. pragmas: [],
  3018. messageSends: ["copy"]
  3019. }, function ($methodClass){ return function (){
  3020. var self=this,$self=this;
  3021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3022. return $core.withContext(function($ctx1) {
  3023. //>>excludeEnd("ctx");
  3024. return $recv($self.keys)._copy();
  3025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3026. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3027. //>>excludeEnd("ctx");
  3028. }; }),
  3029. $globals.Dictionary);
  3030. $core.addMethod(
  3031. $core.method({
  3032. selector: "keysAndValuesDo:",
  3033. protocol: "enumerating",
  3034. //>>excludeStart("ide", pragmas.excludeIdeData);
  3035. args: ["aBlock"],
  3036. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3037. referencedClasses: [],
  3038. //>>excludeEnd("ide");
  3039. pragmas: [],
  3040. messageSends: ["with:do:"]
  3041. }, function ($methodClass){ return function (aBlock){
  3042. var self=this,$self=this;
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. return $core.withContext(function($ctx1) {
  3045. //>>excludeEnd("ctx");
  3046. return $recv($self.keys)._with_do_($self.values,aBlock);
  3047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3048. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3049. //>>excludeEnd("ctx");
  3050. }; }),
  3051. $globals.Dictionary);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "keysDo:",
  3055. protocol: "enumerating",
  3056. //>>excludeStart("ide", pragmas.excludeIdeData);
  3057. args: ["aBlock"],
  3058. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3059. referencedClasses: [],
  3060. //>>excludeEnd("ide");
  3061. pragmas: [],
  3062. messageSends: ["do:"]
  3063. }, function ($methodClass){ return function (aBlock){
  3064. var self=this,$self=this;
  3065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3066. return $core.withContext(function($ctx1) {
  3067. //>>excludeEnd("ctx");
  3068. return $recv($self.keys)._do_(aBlock);
  3069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3070. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3071. //>>excludeEnd("ctx");
  3072. }; }),
  3073. $globals.Dictionary);
  3074. $core.addMethod(
  3075. $core.method({
  3076. selector: "positionOfKey:",
  3077. protocol: "private",
  3078. //>>excludeStart("ide", pragmas.excludeIdeData);
  3079. args: ["anObject"],
  3080. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = $self.keys;\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  3081. referencedClasses: [],
  3082. //>>excludeEnd("ide");
  3083. pragmas: [["inlineJS:", ["\x0a\x09\x09var keys = $self.keys;\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09"]]],
  3084. messageSends: []
  3085. }, function ($methodClass){ return function (anObject){
  3086. var self=this,$self=this;
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. return $core.withContext(function($ctx1) {
  3089. //>>excludeEnd("ctx");
  3090. var keys = $self.keys;
  3091. for(var i=0;i<keys.length;i++){
  3092. if(keys[i].__eq(anObject)) { return i;}
  3093. }
  3094. return -1;
  3095. ;
  3096. return self;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3099. //>>excludeEnd("ctx");
  3100. }; }),
  3101. $globals.Dictionary);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "removeAll",
  3105. protocol: "adding/removing",
  3106. //>>excludeStart("ide", pragmas.excludeIdeData);
  3107. args: [],
  3108. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3109. referencedClasses: [],
  3110. //>>excludeEnd("ide");
  3111. pragmas: [],
  3112. messageSends: ["removeAll"]
  3113. }, function ($methodClass){ return function (){
  3114. var self=this,$self=this;
  3115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3116. return $core.withContext(function($ctx1) {
  3117. //>>excludeEnd("ctx");
  3118. $recv($self.keys)._removeAll();
  3119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3120. $ctx1.sendIdx["removeAll"]=1;
  3121. //>>excludeEnd("ctx");
  3122. $recv($self.values)._removeAll();
  3123. return self;
  3124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3125. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3126. //>>excludeEnd("ctx");
  3127. }; }),
  3128. $globals.Dictionary);
  3129. $core.addMethod(
  3130. $core.method({
  3131. selector: "removeKey:ifAbsent:",
  3132. protocol: "adding/removing",
  3133. //>>excludeStart("ide", pragmas.excludeIdeData);
  3134. args: ["aKey", "aBlock"],
  3135. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self.keys, values = $self.values;\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  3136. referencedClasses: [],
  3137. //>>excludeEnd("ide");
  3138. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self.keys, values = $self.values;\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09"]]],
  3139. messageSends: []
  3140. }, function ($methodClass){ return function (aKey,aBlock){
  3141. var self=this,$self=this;
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. return $core.withContext(function($ctx1) {
  3144. //>>excludeEnd("ctx");
  3145. var index = $self._positionOfKey_(aKey);
  3146. if(index === -1) {
  3147. return aBlock._value()
  3148. } else {
  3149. var keys = $self.keys, values = $self.values;
  3150. var value = values[index], l = keys.length;
  3151. keys[index] = keys[l-1];
  3152. keys.pop();
  3153. values[index] = values[l-1];
  3154. values.pop();
  3155. return value;
  3156. }
  3157. ;
  3158. return self;
  3159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3160. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3161. //>>excludeEnd("ctx");
  3162. }; }),
  3163. $globals.Dictionary);
  3164. $core.addMethod(
  3165. $core.method({
  3166. selector: "values",
  3167. protocol: "accessing",
  3168. //>>excludeStart("ide", pragmas.excludeIdeData);
  3169. args: [],
  3170. source: "values\x0a\x09^ values",
  3171. referencedClasses: [],
  3172. //>>excludeEnd("ide");
  3173. pragmas: [],
  3174. messageSends: []
  3175. }, function ($methodClass){ return function (){
  3176. var self=this,$self=this;
  3177. return $self.values;
  3178. }; }),
  3179. $globals.Dictionary);
  3180. $core.addMethod(
  3181. $core.method({
  3182. selector: "valuesDo:",
  3183. protocol: "enumerating",
  3184. //>>excludeStart("ide", pragmas.excludeIdeData);
  3185. args: ["aBlock"],
  3186. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3187. referencedClasses: [],
  3188. //>>excludeEnd("ide");
  3189. pragmas: [],
  3190. messageSends: ["do:"]
  3191. }, function ($methodClass){ return function (aBlock){
  3192. var self=this,$self=this;
  3193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3194. return $core.withContext(function($ctx1) {
  3195. //>>excludeEnd("ctx");
  3196. return $recv($self.values)._do_(aBlock);
  3197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3198. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3199. //>>excludeEnd("ctx");
  3200. }; }),
  3201. $globals.Dictionary);
  3202. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3203. //>>excludeStart("ide", pragmas.excludeIdeData);
  3204. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3205. //>>excludeEnd("ide");
  3206. $core.addMethod(
  3207. $core.method({
  3208. selector: "at:ifAbsent:",
  3209. protocol: "accessing",
  3210. //>>excludeStart("ide", pragmas.excludeIdeData);
  3211. args: ["aKey", "aBlock"],
  3212. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3213. referencedClasses: [],
  3214. //>>excludeEnd("ide");
  3215. pragmas: [],
  3216. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3217. }, function ($methodClass){ return function (aKey,aBlock){
  3218. var self=this,$self=this;
  3219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3220. return $core.withContext(function($ctx1) {
  3221. //>>excludeEnd("ctx");
  3222. var $1;
  3223. $1=$self._includesKey_(aKey);
  3224. if($core.assert($1)){
  3225. return $self._basicAt_(aKey);
  3226. } else {
  3227. return $recv(aBlock)._value();
  3228. }
  3229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3230. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3231. //>>excludeEnd("ctx");
  3232. }; }),
  3233. $globals.HashedCollection);
  3234. $core.addMethod(
  3235. $core.method({
  3236. selector: "at:put:",
  3237. protocol: "accessing",
  3238. //>>excludeStart("ide", pragmas.excludeIdeData);
  3239. args: ["aKey", "aValue"],
  3240. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3241. referencedClasses: [],
  3242. //>>excludeEnd("ide");
  3243. pragmas: [],
  3244. messageSends: ["basicAt:put:"]
  3245. }, function ($methodClass){ return function (aKey,aValue){
  3246. var self=this,$self=this;
  3247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3248. return $core.withContext(function($ctx1) {
  3249. //>>excludeEnd("ctx");
  3250. return $self._basicAt_put_(aKey,aValue);
  3251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3252. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3253. //>>excludeEnd("ctx");
  3254. }; }),
  3255. $globals.HashedCollection);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "includesKey:",
  3259. protocol: "testing",
  3260. //>>excludeStart("ide", pragmas.excludeIdeData);
  3261. args: ["aKey"],
  3262. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3263. referencedClasses: [],
  3264. //>>excludeEnd("ide");
  3265. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3266. messageSends: []
  3267. }, function ($methodClass){ return function (aKey){
  3268. var self=this,$self=this;
  3269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3270. return $core.withContext(function($ctx1) {
  3271. //>>excludeEnd("ctx");
  3272. return self.hasOwnProperty(aKey);
  3273. return self;
  3274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3275. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3276. //>>excludeEnd("ctx");
  3277. }; }),
  3278. $globals.HashedCollection);
  3279. $core.addMethod(
  3280. $core.method({
  3281. selector: "keys",
  3282. protocol: "accessing",
  3283. //>>excludeStart("ide", pragmas.excludeIdeData);
  3284. args: [],
  3285. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3286. referencedClasses: [],
  3287. //>>excludeEnd("ide");
  3288. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3289. messageSends: []
  3290. }, function ($methodClass){ return function (){
  3291. var self=this,$self=this;
  3292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3293. return $core.withContext(function($ctx1) {
  3294. //>>excludeEnd("ctx");
  3295. return Object.keys(self);
  3296. return self;
  3297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3298. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3299. //>>excludeEnd("ctx");
  3300. }; }),
  3301. $globals.HashedCollection);
  3302. $core.addMethod(
  3303. $core.method({
  3304. selector: "keysDo:",
  3305. protocol: "enumerating",
  3306. //>>excludeStart("ide", pragmas.excludeIdeData);
  3307. args: ["aBlock"],
  3308. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3309. referencedClasses: [],
  3310. //>>excludeEnd("ide");
  3311. pragmas: [],
  3312. messageSends: ["do:", "keys"]
  3313. }, function ($methodClass){ return function (aBlock){
  3314. var self=this,$self=this;
  3315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3316. return $core.withContext(function($ctx1) {
  3317. //>>excludeEnd("ctx");
  3318. $recv($self._keys())._do_(aBlock);
  3319. return self;
  3320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3321. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3322. //>>excludeEnd("ctx");
  3323. }; }),
  3324. $globals.HashedCollection);
  3325. $core.addMethod(
  3326. $core.method({
  3327. selector: "removeKey:ifAbsent:",
  3328. protocol: "adding/removing",
  3329. //>>excludeStart("ide", pragmas.excludeIdeData);
  3330. args: ["aKey", "aBlock"],
  3331. 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 ]",
  3332. referencedClasses: [],
  3333. //>>excludeEnd("ide");
  3334. pragmas: [],
  3335. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3336. }, function ($methodClass){ return function (aKey,aBlock){
  3337. var self=this,$self=this;
  3338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3339. return $core.withContext(function($ctx1) {
  3340. //>>excludeEnd("ctx");
  3341. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3343. return $core.withContext(function($ctx2) {
  3344. //>>excludeEnd("ctx");
  3345. $self._basicDelete_(aKey);
  3346. return removed;
  3347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3348. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3349. //>>excludeEnd("ctx");
  3350. }),(function(){
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. return $core.withContext(function($ctx2) {
  3353. //>>excludeEnd("ctx");
  3354. return $recv(aBlock)._value();
  3355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3357. //>>excludeEnd("ctx");
  3358. }));
  3359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3360. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3361. //>>excludeEnd("ctx");
  3362. }; }),
  3363. $globals.HashedCollection);
  3364. $core.addMethod(
  3365. $core.method({
  3366. selector: "values",
  3367. protocol: "accessing",
  3368. //>>excludeStart("ide", pragmas.excludeIdeData);
  3369. args: [],
  3370. 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'>",
  3371. referencedClasses: [],
  3372. //>>excludeEnd("ide");
  3373. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3374. messageSends: []
  3375. }, function ($methodClass){ return function (){
  3376. var self=this,$self=this;
  3377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3378. return $core.withContext(function($ctx1) {
  3379. //>>excludeEnd("ctx");
  3380. return $self._keys().map(function(key){
  3381. return $self._at_(key);
  3382. });
  3383. ;
  3384. return self;
  3385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3386. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3387. //>>excludeEnd("ctx");
  3388. }; }),
  3389. $globals.HashedCollection);
  3390. $core.addMethod(
  3391. $core.method({
  3392. selector: "valuesDo:",
  3393. protocol: "enumerating",
  3394. //>>excludeStart("ide", pragmas.excludeIdeData);
  3395. args: ["aBlock"],
  3396. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3397. referencedClasses: [],
  3398. //>>excludeEnd("ide");
  3399. pragmas: [],
  3400. messageSends: ["do:", "values"]
  3401. }, function ($methodClass){ return function (aBlock){
  3402. var self=this,$self=this;
  3403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3404. return $core.withContext(function($ctx1) {
  3405. //>>excludeEnd("ctx");
  3406. $recv($self._values())._do_(aBlock);
  3407. return self;
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3410. //>>excludeEnd("ctx");
  3411. }; }),
  3412. $globals.HashedCollection);
  3413. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3414. //>>excludeStart("ide", pragmas.excludeIdeData);
  3415. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3416. //>>excludeEnd("ide");
  3417. $core.addMethod(
  3418. $core.method({
  3419. selector: "=",
  3420. protocol: "comparing",
  3421. //>>excludeStart("ide", pragmas.excludeIdeData);
  3422. args: ["aCollection"],
  3423. 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",
  3424. referencedClasses: [],
  3425. //>>excludeEnd("ide");
  3426. pragmas: [],
  3427. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3428. }, function ($methodClass){ return function (aCollection){
  3429. var self=this,$self=this;
  3430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3431. return $core.withContext(function($ctx1) {
  3432. //>>excludeEnd("ctx");
  3433. var $3,$2,$4,$1,$5;
  3434. var $early={};
  3435. try {
  3436. $3=$self._class();
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. $ctx1.sendIdx["class"]=1;
  3439. //>>excludeEnd("ctx");
  3440. $2=$recv($3).__eq($recv(aCollection)._class());
  3441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3442. $ctx1.sendIdx["="]=1;
  3443. //>>excludeEnd("ctx");
  3444. $1=$recv($2)._and_((function(){
  3445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3446. return $core.withContext(function($ctx2) {
  3447. //>>excludeEnd("ctx");
  3448. $4=$self._size();
  3449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3450. $ctx2.sendIdx["size"]=1;
  3451. //>>excludeEnd("ctx");
  3452. return $recv($4).__eq($recv(aCollection)._size());
  3453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3454. $ctx2.sendIdx["="]=2;
  3455. //>>excludeEnd("ctx");
  3456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3458. //>>excludeEnd("ctx");
  3459. }));
  3460. if(!$core.assert($1)){
  3461. return false;
  3462. }
  3463. $self._withIndexDo_((function(each,i){
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. return $core.withContext(function($ctx2) {
  3466. //>>excludeEnd("ctx");
  3467. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3468. if(!$core.assert($5)){
  3469. throw $early=[false];
  3470. }
  3471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3472. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3473. //>>excludeEnd("ctx");
  3474. }));
  3475. return true;
  3476. }
  3477. catch(e) {if(e===$early)return e[0]; throw e}
  3478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3479. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3480. //>>excludeEnd("ctx");
  3481. }; }),
  3482. $globals.SequenceableCollection);
  3483. $core.addMethod(
  3484. $core.method({
  3485. selector: "addLast:",
  3486. protocol: "adding/removing",
  3487. //>>excludeStart("ide", pragmas.excludeIdeData);
  3488. args: ["anObject"],
  3489. source: "addLast: anObject\x0a\x09self add: anObject",
  3490. referencedClasses: [],
  3491. //>>excludeEnd("ide");
  3492. pragmas: [],
  3493. messageSends: ["add:"]
  3494. }, function ($methodClass){ return function (anObject){
  3495. var self=this,$self=this;
  3496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3497. return $core.withContext(function($ctx1) {
  3498. //>>excludeEnd("ctx");
  3499. $self._add_(anObject);
  3500. return self;
  3501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3502. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3503. //>>excludeEnd("ctx");
  3504. }; }),
  3505. $globals.SequenceableCollection);
  3506. $core.addMethod(
  3507. $core.method({
  3508. selector: "allButFirst",
  3509. protocol: "accessing",
  3510. //>>excludeStart("ide", pragmas.excludeIdeData);
  3511. args: [],
  3512. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3513. referencedClasses: [],
  3514. //>>excludeEnd("ide");
  3515. pragmas: [],
  3516. messageSends: ["copyFrom:to:", "size"]
  3517. }, function ($methodClass){ return function (){
  3518. var self=this,$self=this;
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. return $core.withContext(function($ctx1) {
  3521. //>>excludeEnd("ctx");
  3522. return $self._copyFrom_to_((2),$self._size());
  3523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3524. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3525. //>>excludeEnd("ctx");
  3526. }; }),
  3527. $globals.SequenceableCollection);
  3528. $core.addMethod(
  3529. $core.method({
  3530. selector: "allButLast",
  3531. protocol: "accessing",
  3532. //>>excludeStart("ide", pragmas.excludeIdeData);
  3533. args: [],
  3534. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3535. referencedClasses: [],
  3536. //>>excludeEnd("ide");
  3537. pragmas: [],
  3538. messageSends: ["copyFrom:to:", "-", "size"]
  3539. }, function ($methodClass){ return function (){
  3540. var self=this,$self=this;
  3541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3542. return $core.withContext(function($ctx1) {
  3543. //>>excludeEnd("ctx");
  3544. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3546. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3547. //>>excludeEnd("ctx");
  3548. }; }),
  3549. $globals.SequenceableCollection);
  3550. $core.addMethod(
  3551. $core.method({
  3552. selector: "anyOne",
  3553. protocol: "accessing",
  3554. //>>excludeStart("ide", pragmas.excludeIdeData);
  3555. args: [],
  3556. source: "anyOne\x0a\x09^ self at: 1",
  3557. referencedClasses: [],
  3558. //>>excludeEnd("ide");
  3559. pragmas: [],
  3560. messageSends: ["at:"]
  3561. }, function ($methodClass){ return function (){
  3562. var self=this,$self=this;
  3563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3564. return $core.withContext(function($ctx1) {
  3565. //>>excludeEnd("ctx");
  3566. return $self._at_((1));
  3567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3568. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3569. //>>excludeEnd("ctx");
  3570. }; }),
  3571. $globals.SequenceableCollection);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "atRandom",
  3575. protocol: "accessing",
  3576. //>>excludeStart("ide", pragmas.excludeIdeData);
  3577. args: [],
  3578. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3579. referencedClasses: [],
  3580. //>>excludeEnd("ide");
  3581. pragmas: [],
  3582. messageSends: ["at:", "atRandom", "size"]
  3583. }, function ($methodClass){ return function (){
  3584. var self=this,$self=this;
  3585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3586. return $core.withContext(function($ctx1) {
  3587. //>>excludeEnd("ctx");
  3588. return $self._at_($recv($self._size())._atRandom());
  3589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3590. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3591. //>>excludeEnd("ctx");
  3592. }; }),
  3593. $globals.SequenceableCollection);
  3594. $core.addMethod(
  3595. $core.method({
  3596. selector: "beginsWith:",
  3597. protocol: "testing",
  3598. //>>excludeStart("ide", pragmas.excludeIdeData);
  3599. args: ["prefix"],
  3600. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3601. referencedClasses: [],
  3602. //>>excludeEnd("ide");
  3603. pragmas: [],
  3604. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3605. }, function ($methodClass){ return function (prefix){
  3606. var self=this,$self=this;
  3607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3608. return $core.withContext(function($ctx1) {
  3609. //>>excludeEnd("ctx");
  3610. var $2,$3,$1;
  3611. $2=$self._size();
  3612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3613. $ctx1.sendIdx["size"]=1;
  3614. //>>excludeEnd("ctx");
  3615. $3=$recv(prefix)._size();
  3616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3617. $ctx1.sendIdx["size"]=2;
  3618. //>>excludeEnd("ctx");
  3619. $1=$recv($2).__lt($3);
  3620. if($core.assert($1)){
  3621. return false;
  3622. }
  3623. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3625. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3626. //>>excludeEnd("ctx");
  3627. }; }),
  3628. $globals.SequenceableCollection);
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "copyFrom:to:",
  3632. protocol: "copying",
  3633. //>>excludeStart("ide", pragmas.excludeIdeData);
  3634. args: ["anIndex", "anotherIndex"],
  3635. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3636. referencedClasses: [],
  3637. //>>excludeEnd("ide");
  3638. pragmas: [],
  3639. messageSends: ["subclassResponsibility"]
  3640. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3641. var self=this,$self=this;
  3642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3643. return $core.withContext(function($ctx1) {
  3644. //>>excludeEnd("ctx");
  3645. $self._subclassResponsibility();
  3646. return self;
  3647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3648. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3649. //>>excludeEnd("ctx");
  3650. }; }),
  3651. $globals.SequenceableCollection);
  3652. $core.addMethod(
  3653. $core.method({
  3654. selector: "endsWith:",
  3655. protocol: "testing",
  3656. //>>excludeStart("ide", pragmas.excludeIdeData);
  3657. args: ["suffix"],
  3658. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3659. referencedClasses: [],
  3660. //>>excludeEnd("ide");
  3661. pragmas: [],
  3662. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3663. }, function ($methodClass){ return function (suffix){
  3664. var self=this,$self=this;
  3665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3666. return $core.withContext(function($ctx1) {
  3667. //>>excludeEnd("ctx");
  3668. var $2,$3,$1;
  3669. $2=$self._size();
  3670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3671. $ctx1.sendIdx["size"]=1;
  3672. //>>excludeEnd("ctx");
  3673. $3=$recv(suffix)._size();
  3674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3675. $ctx1.sendIdx["size"]=2;
  3676. //>>excludeEnd("ctx");
  3677. $1=$recv($2).__lt($3);
  3678. if($core.assert($1)){
  3679. return false;
  3680. }
  3681. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3683. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3684. //>>excludeEnd("ctx");
  3685. }; }),
  3686. $globals.SequenceableCollection);
  3687. $core.addMethod(
  3688. $core.method({
  3689. selector: "first",
  3690. protocol: "accessing",
  3691. //>>excludeStart("ide", pragmas.excludeIdeData);
  3692. args: [],
  3693. source: "first\x0a\x09^ self at: 1",
  3694. referencedClasses: [],
  3695. //>>excludeEnd("ide");
  3696. pragmas: [],
  3697. messageSends: ["at:"]
  3698. }, function ($methodClass){ return function (){
  3699. var self=this,$self=this;
  3700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3701. return $core.withContext(function($ctx1) {
  3702. //>>excludeEnd("ctx");
  3703. return $self._at_((1));
  3704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3705. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3706. //>>excludeEnd("ctx");
  3707. }; }),
  3708. $globals.SequenceableCollection);
  3709. $core.addMethod(
  3710. $core.method({
  3711. selector: "first:",
  3712. protocol: "accessing",
  3713. //>>excludeStart("ide", pragmas.excludeIdeData);
  3714. args: ["aNumber"],
  3715. 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",
  3716. referencedClasses: [],
  3717. //>>excludeEnd("ide");
  3718. pragmas: [],
  3719. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3720. }, function ($methodClass){ return function (aNumber){
  3721. var self=this,$self=this;
  3722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3723. return $core.withContext(function($ctx1) {
  3724. //>>excludeEnd("ctx");
  3725. var $1;
  3726. $1=$recv($self._size()).__lt(aNumber);
  3727. if($core.assert($1)){
  3728. $self._error_("Invalid number of elements");
  3729. }
  3730. return $self._copyFrom_to_((1),aNumber);
  3731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3732. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3733. //>>excludeEnd("ctx");
  3734. }; }),
  3735. $globals.SequenceableCollection);
  3736. $core.addMethod(
  3737. $core.method({
  3738. selector: "fourth",
  3739. protocol: "accessing",
  3740. //>>excludeStart("ide", pragmas.excludeIdeData);
  3741. args: [],
  3742. source: "fourth\x0a\x09^ self at: 4",
  3743. referencedClasses: [],
  3744. //>>excludeEnd("ide");
  3745. pragmas: [],
  3746. messageSends: ["at:"]
  3747. }, function ($methodClass){ return function (){
  3748. var self=this,$self=this;
  3749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3750. return $core.withContext(function($ctx1) {
  3751. //>>excludeEnd("ctx");
  3752. return $self._at_((4));
  3753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3754. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3755. //>>excludeEnd("ctx");
  3756. }; }),
  3757. $globals.SequenceableCollection);
  3758. $core.addMethod(
  3759. $core.method({
  3760. selector: "includes:",
  3761. protocol: "testing",
  3762. //>>excludeStart("ide", pragmas.excludeIdeData);
  3763. args: ["anObject"],
  3764. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3765. referencedClasses: [],
  3766. //>>excludeEnd("ide");
  3767. pragmas: [],
  3768. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3769. }, function ($methodClass){ return function (anObject){
  3770. var self=this,$self=this;
  3771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3772. return $core.withContext(function($ctx1) {
  3773. //>>excludeEnd("ctx");
  3774. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3775. return nil;
  3776. })))._notNil();
  3777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3778. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3779. //>>excludeEnd("ctx");
  3780. }; }),
  3781. $globals.SequenceableCollection);
  3782. $core.addMethod(
  3783. $core.method({
  3784. selector: "indexOf:startingAt:",
  3785. protocol: "accessing",
  3786. //>>excludeStart("ide", pragmas.excludeIdeData);
  3787. args: ["anObject", "start"],
  3788. 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 ]",
  3789. referencedClasses: [],
  3790. //>>excludeEnd("ide");
  3791. pragmas: [],
  3792. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3793. }, function ($methodClass){ return function (anObject,start){
  3794. var self=this,$self=this;
  3795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3796. return $core.withContext(function($ctx1) {
  3797. //>>excludeEnd("ctx");
  3798. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3799. return (0);
  3800. }));
  3801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3802. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3803. //>>excludeEnd("ctx");
  3804. }; }),
  3805. $globals.SequenceableCollection);
  3806. $core.addMethod(
  3807. $core.method({
  3808. selector: "indexOf:startingAt:ifAbsent:",
  3809. protocol: "accessing",
  3810. //>>excludeStart("ide", pragmas.excludeIdeData);
  3811. args: ["anObject", "start", "aBlock"],
  3812. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3813. referencedClasses: [],
  3814. //>>excludeEnd("ide");
  3815. pragmas: [],
  3816. messageSends: ["subclassResponsibility"]
  3817. }, function ($methodClass){ return function (anObject,start,aBlock){
  3818. var self=this,$self=this;
  3819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3820. return $core.withContext(function($ctx1) {
  3821. //>>excludeEnd("ctx");
  3822. $self._subclassResponsibility();
  3823. return self;
  3824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3825. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3826. //>>excludeEnd("ctx");
  3827. }; }),
  3828. $globals.SequenceableCollection);
  3829. $core.addMethod(
  3830. $core.method({
  3831. selector: "last",
  3832. protocol: "accessing",
  3833. //>>excludeStart("ide", pragmas.excludeIdeData);
  3834. args: [],
  3835. source: "last\x0a\x09^ self at: self size",
  3836. referencedClasses: [],
  3837. //>>excludeEnd("ide");
  3838. pragmas: [],
  3839. messageSends: ["at:", "size"]
  3840. }, function ($methodClass){ return function (){
  3841. var self=this,$self=this;
  3842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3843. return $core.withContext(function($ctx1) {
  3844. //>>excludeEnd("ctx");
  3845. return $self._at_($self._size());
  3846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3847. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3848. //>>excludeEnd("ctx");
  3849. }; }),
  3850. $globals.SequenceableCollection);
  3851. $core.addMethod(
  3852. $core.method({
  3853. selector: "last:",
  3854. protocol: "accessing",
  3855. //>>excludeStart("ide", pragmas.excludeIdeData);
  3856. args: ["aNumber"],
  3857. 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",
  3858. referencedClasses: [],
  3859. //>>excludeEnd("ide");
  3860. pragmas: [],
  3861. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3862. }, function ($methodClass){ return function (aNumber){
  3863. var self=this,$self=this;
  3864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3865. return $core.withContext(function($ctx1) {
  3866. //>>excludeEnd("ctx");
  3867. var $2,$1,$5,$4,$3;
  3868. $2=$self._size();
  3869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3870. $ctx1.sendIdx["size"]=1;
  3871. //>>excludeEnd("ctx");
  3872. $1=$recv($2).__lt(aNumber);
  3873. if($core.assert($1)){
  3874. $self._error_("Invalid number of elements");
  3875. }
  3876. $5=$self._size();
  3877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3878. $ctx1.sendIdx["size"]=2;
  3879. //>>excludeEnd("ctx");
  3880. $4=$recv($5).__minus(aNumber);
  3881. $3=$recv($4).__plus((1));
  3882. return $self._copyFrom_to_($3,$self._size());
  3883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3884. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3885. //>>excludeEnd("ctx");
  3886. }; }),
  3887. $globals.SequenceableCollection);
  3888. $core.addMethod(
  3889. $core.method({
  3890. selector: "newStream",
  3891. protocol: "streaming",
  3892. //>>excludeStart("ide", pragmas.excludeIdeData);
  3893. args: [],
  3894. source: "newStream\x0a\x09^ self streamClass on: self",
  3895. referencedClasses: [],
  3896. //>>excludeEnd("ide");
  3897. pragmas: [],
  3898. messageSends: ["on:", "streamClass"]
  3899. }, function ($methodClass){ return function (){
  3900. var self=this,$self=this;
  3901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3902. return $core.withContext(function($ctx1) {
  3903. //>>excludeEnd("ctx");
  3904. return $recv($self._streamClass())._on_(self);
  3905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3906. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  3907. //>>excludeEnd("ctx");
  3908. }; }),
  3909. $globals.SequenceableCollection);
  3910. $core.addMethod(
  3911. $core.method({
  3912. selector: "readStream",
  3913. protocol: "streaming",
  3914. //>>excludeStart("ide", pragmas.excludeIdeData);
  3915. args: [],
  3916. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3917. referencedClasses: [],
  3918. //>>excludeEnd("ide");
  3919. pragmas: [],
  3920. messageSends: ["stream"]
  3921. }, function ($methodClass){ return function (){
  3922. var self=this,$self=this;
  3923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3924. return $core.withContext(function($ctx1) {
  3925. //>>excludeEnd("ctx");
  3926. return $self._stream();
  3927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3928. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  3929. //>>excludeEnd("ctx");
  3930. }; }),
  3931. $globals.SequenceableCollection);
  3932. $core.addMethod(
  3933. $core.method({
  3934. selector: "removeLast",
  3935. protocol: "adding/removing",
  3936. //>>excludeStart("ide", pragmas.excludeIdeData);
  3937. args: [],
  3938. source: "removeLast\x0a\x09^ self remove: self last",
  3939. referencedClasses: [],
  3940. //>>excludeEnd("ide");
  3941. pragmas: [],
  3942. messageSends: ["remove:", "last"]
  3943. }, function ($methodClass){ return function (){
  3944. var self=this,$self=this;
  3945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3946. return $core.withContext(function($ctx1) {
  3947. //>>excludeEnd("ctx");
  3948. return $self._remove_($self._last());
  3949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3950. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  3951. //>>excludeEnd("ctx");
  3952. }; }),
  3953. $globals.SequenceableCollection);
  3954. $core.addMethod(
  3955. $core.method({
  3956. selector: "reverseDo:",
  3957. protocol: "enumerating",
  3958. //>>excludeStart("ide", pragmas.excludeIdeData);
  3959. args: ["aBlock"],
  3960. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  3961. referencedClasses: [],
  3962. //>>excludeEnd("ide");
  3963. pragmas: [],
  3964. messageSends: ["do:", "reversed"]
  3965. }, function ($methodClass){ return function (aBlock){
  3966. var self=this,$self=this;
  3967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3968. return $core.withContext(function($ctx1) {
  3969. //>>excludeEnd("ctx");
  3970. $recv($self._reversed())._do_(aBlock);
  3971. return self;
  3972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3973. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  3974. //>>excludeEnd("ctx");
  3975. }; }),
  3976. $globals.SequenceableCollection);
  3977. $core.addMethod(
  3978. $core.method({
  3979. selector: "reversed",
  3980. protocol: "converting",
  3981. //>>excludeStart("ide", pragmas.excludeIdeData);
  3982. args: [],
  3983. source: "reversed\x0a\x09self subclassResponsibility",
  3984. referencedClasses: [],
  3985. //>>excludeEnd("ide");
  3986. pragmas: [],
  3987. messageSends: ["subclassResponsibility"]
  3988. }, function ($methodClass){ return function (){
  3989. var self=this,$self=this;
  3990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3991. return $core.withContext(function($ctx1) {
  3992. //>>excludeEnd("ctx");
  3993. $self._subclassResponsibility();
  3994. return self;
  3995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3996. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  3997. //>>excludeEnd("ctx");
  3998. }; }),
  3999. $globals.SequenceableCollection);
  4000. $core.addMethod(
  4001. $core.method({
  4002. selector: "second",
  4003. protocol: "accessing",
  4004. //>>excludeStart("ide", pragmas.excludeIdeData);
  4005. args: [],
  4006. source: "second\x0a\x09^ self at: 2",
  4007. referencedClasses: [],
  4008. //>>excludeEnd("ide");
  4009. pragmas: [],
  4010. messageSends: ["at:"]
  4011. }, function ($methodClass){ return 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_((2));
  4017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4018. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4019. //>>excludeEnd("ctx");
  4020. }; }),
  4021. $globals.SequenceableCollection);
  4022. $core.addMethod(
  4023. $core.method({
  4024. selector: "stream",
  4025. protocol: "streaming",
  4026. //>>excludeStart("ide", pragmas.excludeIdeData);
  4027. args: [],
  4028. source: "stream\x0a\x09^ self newStream",
  4029. referencedClasses: [],
  4030. //>>excludeEnd("ide");
  4031. pragmas: [],
  4032. messageSends: ["newStream"]
  4033. }, function ($methodClass){ return function (){
  4034. var self=this,$self=this;
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. return $core.withContext(function($ctx1) {
  4037. //>>excludeEnd("ctx");
  4038. return $self._newStream();
  4039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4040. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4041. //>>excludeEnd("ctx");
  4042. }; }),
  4043. $globals.SequenceableCollection);
  4044. $core.addMethod(
  4045. $core.method({
  4046. selector: "streamClass",
  4047. protocol: "streaming",
  4048. //>>excludeStart("ide", pragmas.excludeIdeData);
  4049. args: [],
  4050. source: "streamClass\x0a\x09^ self class streamClass",
  4051. referencedClasses: [],
  4052. //>>excludeEnd("ide");
  4053. pragmas: [],
  4054. messageSends: ["streamClass", "class"]
  4055. }, function ($methodClass){ return function (){
  4056. var self=this,$self=this;
  4057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4058. return $core.withContext(function($ctx1) {
  4059. //>>excludeEnd("ctx");
  4060. return $recv($self._class())._streamClass();
  4061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4062. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4063. //>>excludeEnd("ctx");
  4064. }; }),
  4065. $globals.SequenceableCollection);
  4066. $core.addMethod(
  4067. $core.method({
  4068. selector: "third",
  4069. protocol: "accessing",
  4070. //>>excludeStart("ide", pragmas.excludeIdeData);
  4071. args: [],
  4072. source: "third\x0a\x09^ self at: 3",
  4073. referencedClasses: [],
  4074. //>>excludeEnd("ide");
  4075. pragmas: [],
  4076. messageSends: ["at:"]
  4077. }, function ($methodClass){ return function (){
  4078. var self=this,$self=this;
  4079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4080. return $core.withContext(function($ctx1) {
  4081. //>>excludeEnd("ctx");
  4082. return $self._at_((3));
  4083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4084. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4085. //>>excludeEnd("ctx");
  4086. }; }),
  4087. $globals.SequenceableCollection);
  4088. $core.addMethod(
  4089. $core.method({
  4090. selector: "writeStream",
  4091. protocol: "streaming",
  4092. //>>excludeStart("ide", pragmas.excludeIdeData);
  4093. args: [],
  4094. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4095. referencedClasses: [],
  4096. //>>excludeEnd("ide");
  4097. pragmas: [],
  4098. messageSends: ["stream"]
  4099. }, function ($methodClass){ return function (){
  4100. var self=this,$self=this;
  4101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4102. return $core.withContext(function($ctx1) {
  4103. //>>excludeEnd("ctx");
  4104. return $self._stream();
  4105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4106. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4107. //>>excludeEnd("ctx");
  4108. }; }),
  4109. $globals.SequenceableCollection);
  4110. $core.addMethod(
  4111. $core.method({
  4112. selector: "streamClass",
  4113. protocol: "accessing",
  4114. //>>excludeStart("ide", pragmas.excludeIdeData);
  4115. args: [],
  4116. source: "streamClass\x0a\x09\x09^ Stream",
  4117. referencedClasses: ["Stream"],
  4118. //>>excludeEnd("ide");
  4119. pragmas: [],
  4120. messageSends: []
  4121. }, function ($methodClass){ return function (){
  4122. var self=this,$self=this;
  4123. return $globals.Stream;
  4124. }; }),
  4125. $globals.SequenceableCollection.a$cls);
  4126. $core.addMethod(
  4127. $core.method({
  4128. selector: "streamContents:",
  4129. protocol: "streaming",
  4130. //>>excludeStart("ide", pragmas.excludeIdeData);
  4131. args: ["aBlock"],
  4132. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4133. referencedClasses: [],
  4134. //>>excludeEnd("ide");
  4135. pragmas: [],
  4136. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4137. }, function ($methodClass){ return function (aBlock){
  4138. var self=this,$self=this;
  4139. var stream;
  4140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4141. return $core.withContext(function($ctx1) {
  4142. //>>excludeEnd("ctx");
  4143. stream=$recv($self._streamClass())._on_($self._new());
  4144. $recv(aBlock)._value_(stream);
  4145. return $recv(stream)._contents();
  4146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4147. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4148. //>>excludeEnd("ctx");
  4149. }; }),
  4150. $globals.SequenceableCollection.a$cls);
  4151. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4152. //>>excludeStart("ide", pragmas.excludeIdeData);
  4153. $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`.";
  4154. //>>excludeEnd("ide");
  4155. $core.addMethod(
  4156. $core.method({
  4157. selector: "add:",
  4158. protocol: "adding/removing",
  4159. //>>excludeStart("ide", pragmas.excludeIdeData);
  4160. args: ["anObject"],
  4161. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4162. referencedClasses: [],
  4163. //>>excludeEnd("ide");
  4164. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4165. messageSends: []
  4166. }, function ($methodClass){ return function (anObject){
  4167. var self=this,$self=this;
  4168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4169. return $core.withContext(function($ctx1) {
  4170. //>>excludeEnd("ctx");
  4171. self.push(anObject); return anObject;;
  4172. return self;
  4173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4174. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4175. //>>excludeEnd("ctx");
  4176. }; }),
  4177. $globals.Array);
  4178. $core.addMethod(
  4179. $core.method({
  4180. selector: "addAll:",
  4181. protocol: "adding/removing",
  4182. //>>excludeStart("ide", pragmas.excludeIdeData);
  4183. args: ["aCollection"],
  4184. 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'>",
  4185. referencedClasses: [],
  4186. //>>excludeEnd("ide");
  4187. pragmas: [["inlineJS:", ["\x0a\x09if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);\x0a\x09else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);\x0a\x09return aCollection;"]]],
  4188. messageSends: []
  4189. }, function ($methodClass){ return function (aCollection){
  4190. var self=this,$self=this;
  4191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4192. return $core.withContext(function($ctx1) {
  4193. //>>excludeEnd("ctx");
  4194. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4195. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4196. return aCollection;;
  4197. return self;
  4198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4199. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4200. //>>excludeEnd("ctx");
  4201. }; }),
  4202. $globals.Array);
  4203. $core.addMethod(
  4204. $core.method({
  4205. selector: "addFirst:",
  4206. protocol: "adding/removing",
  4207. //>>excludeStart("ide", pragmas.excludeIdeData);
  4208. args: ["anObject"],
  4209. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4210. referencedClasses: [],
  4211. //>>excludeEnd("ide");
  4212. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4213. messageSends: []
  4214. }, function ($methodClass){ return function (anObject){
  4215. var self=this,$self=this;
  4216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4217. return $core.withContext(function($ctx1) {
  4218. //>>excludeEnd("ctx");
  4219. self.unshift(anObject); return anObject;;
  4220. return self;
  4221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4222. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4223. //>>excludeEnd("ctx");
  4224. }; }),
  4225. $globals.Array);
  4226. $core.addMethod(
  4227. $core.method({
  4228. selector: "asJavaScriptSource",
  4229. protocol: "converting",
  4230. //>>excludeStart("ide", pragmas.excludeIdeData);
  4231. args: [],
  4232. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4233. referencedClasses: [],
  4234. //>>excludeEnd("ide");
  4235. pragmas: [],
  4236. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4237. }, function ($methodClass){ return function (){
  4238. var self=this,$self=this;
  4239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4240. return $core.withContext(function($ctx1) {
  4241. //>>excludeEnd("ctx");
  4242. var $1;
  4243. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4245. return $core.withContext(function($ctx2) {
  4246. //>>excludeEnd("ctx");
  4247. return $recv(each)._asJavaScriptSource();
  4248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4249. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4250. //>>excludeEnd("ctx");
  4251. })))._join_(", "))).__comma("]");
  4252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4253. $ctx1.sendIdx[","]=1;
  4254. //>>excludeEnd("ctx");
  4255. return $1;
  4256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4257. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4258. //>>excludeEnd("ctx");
  4259. }; }),
  4260. $globals.Array);
  4261. $core.addMethod(
  4262. $core.method({
  4263. selector: "at:put:",
  4264. protocol: "accessing",
  4265. //>>excludeStart("ide", pragmas.excludeIdeData);
  4266. args: ["anIndex", "anObject"],
  4267. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4268. referencedClasses: [],
  4269. //>>excludeEnd("ide");
  4270. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4271. messageSends: []
  4272. }, function ($methodClass){ return function (anIndex,anObject){
  4273. var self=this,$self=this;
  4274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4275. return $core.withContext(function($ctx1) {
  4276. //>>excludeEnd("ctx");
  4277. return self[anIndex - 1] = anObject;
  4278. return self;
  4279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4280. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4281. //>>excludeEnd("ctx");
  4282. }; }),
  4283. $globals.Array);
  4284. $core.addMethod(
  4285. $core.method({
  4286. selector: "collect:",
  4287. protocol: "enumerating",
  4288. //>>excludeStart("ide", pragmas.excludeIdeData);
  4289. args: ["aBlock"],
  4290. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4291. referencedClasses: [],
  4292. //>>excludeEnd("ide");
  4293. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4294. messageSends: []
  4295. }, function ($methodClass){ return function (aBlock){
  4296. var self=this,$self=this;
  4297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4298. return $core.withContext(function($ctx1) {
  4299. //>>excludeEnd("ctx");
  4300. return self.map(function(each) {return aBlock._value_(each)});
  4301. return self;
  4302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4303. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4304. //>>excludeEnd("ctx");
  4305. }; }),
  4306. $globals.Array);
  4307. $core.addMethod(
  4308. $core.method({
  4309. selector: "copyFrom:to:",
  4310. protocol: "copying",
  4311. //>>excludeStart("ide", pragmas.excludeIdeData);
  4312. args: ["anIndex", "anotherIndex"],
  4313. 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'>",
  4314. referencedClasses: [],
  4315. //>>excludeEnd("ide");
  4316. pragmas: [["inlineJS:", ["\x0a\x09if (anIndex >= 1 && anotherIndex <= self.length) {\x0a\x09\x09return self.slice(anIndex - 1, anotherIndex);\x0a\x09} else {\x0a\x09\x09self._at_(anIndex);\x0a\x09\x09self._at_(self.length + 1);\x0a\x09\x09throw new Error(\x22Incorrect indexes in #copyFrom:to: not caught by #at:\x22);\x0a\x09}"]]],
  4317. messageSends: []
  4318. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4319. var self=this,$self=this;
  4320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4321. return $core.withContext(function($ctx1) {
  4322. //>>excludeEnd("ctx");
  4323. if (anIndex >= 1 && anotherIndex <= self.length) {
  4324. return self.slice(anIndex - 1, anotherIndex);
  4325. } else {
  4326. self._at_(anIndex);
  4327. self._at_(self.length + 1);
  4328. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4329. };
  4330. return self;
  4331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4332. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4333. //>>excludeEnd("ctx");
  4334. }; }),
  4335. $globals.Array);
  4336. $core.addMethod(
  4337. $core.method({
  4338. selector: "join:",
  4339. protocol: "enumerating",
  4340. //>>excludeStart("ide", pragmas.excludeIdeData);
  4341. args: ["aString"],
  4342. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4343. referencedClasses: [],
  4344. //>>excludeEnd("ide");
  4345. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4346. messageSends: []
  4347. }, function ($methodClass){ return function (aString){
  4348. var self=this,$self=this;
  4349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4350. return $core.withContext(function($ctx1) {
  4351. //>>excludeEnd("ctx");
  4352. return self.join(aString);
  4353. return self;
  4354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4355. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4356. //>>excludeEnd("ctx");
  4357. }; }),
  4358. $globals.Array);
  4359. $core.addMethod(
  4360. $core.method({
  4361. selector: "printOn:",
  4362. protocol: "printing",
  4363. //>>excludeStart("ide", pragmas.excludeIdeData);
  4364. args: ["aStream"],
  4365. 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: ')'",
  4366. referencedClasses: [],
  4367. //>>excludeEnd("ide");
  4368. pragmas: [],
  4369. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4370. }, function ($methodClass){ return function (aStream){
  4371. var self=this,$self=this;
  4372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4373. return $core.withContext(function($ctx1) {
  4374. //>>excludeEnd("ctx");
  4375. (
  4376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4377. $ctx1.supercall = true,
  4378. //>>excludeEnd("ctx");
  4379. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  4380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4381. $ctx1.supercall = false;
  4382. //>>excludeEnd("ctx");;
  4383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4384. $ctx1.sendIdx["printOn:"]=1;
  4385. //>>excludeEnd("ctx");
  4386. $recv(aStream)._nextPutAll_(" (");
  4387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4388. $ctx1.sendIdx["nextPutAll:"]=1;
  4389. //>>excludeEnd("ctx");
  4390. $self._do_separatedBy_((function(each){
  4391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4392. return $core.withContext(function($ctx2) {
  4393. //>>excludeEnd("ctx");
  4394. return $recv(each)._printOn_(aStream);
  4395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4396. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4397. //>>excludeEnd("ctx");
  4398. }),(function(){
  4399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4400. return $core.withContext(function($ctx2) {
  4401. //>>excludeEnd("ctx");
  4402. return $recv(aStream)._nextPutAll_(" ");
  4403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4404. $ctx2.sendIdx["nextPutAll:"]=2;
  4405. //>>excludeEnd("ctx");
  4406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4408. //>>excludeEnd("ctx");
  4409. }));
  4410. $recv(aStream)._nextPutAll_(")");
  4411. return self;
  4412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4413. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4414. //>>excludeEnd("ctx");
  4415. }; }),
  4416. $globals.Array);
  4417. $core.addMethod(
  4418. $core.method({
  4419. selector: "remove:ifAbsent:",
  4420. protocol: "adding/removing",
  4421. //>>excludeStart("ide", pragmas.excludeIdeData);
  4422. args: ["anObject", "aBlock"],
  4423. 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 ]",
  4424. referencedClasses: [],
  4425. //>>excludeEnd("ide");
  4426. pragmas: [],
  4427. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4428. }, function ($methodClass){ return function (anObject,aBlock){
  4429. var self=this,$self=this;
  4430. var index;
  4431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4432. return $core.withContext(function($ctx1) {
  4433. //>>excludeEnd("ctx");
  4434. var $1;
  4435. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4436. return (0);
  4437. }));
  4438. $1=$recv(index).__eq((0));
  4439. if($core.assert($1)){
  4440. return $recv(aBlock)._value();
  4441. } else {
  4442. $self._removeIndex_(index);
  4443. return anObject;
  4444. }
  4445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4446. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4447. //>>excludeEnd("ctx");
  4448. }; }),
  4449. $globals.Array);
  4450. $core.addMethod(
  4451. $core.method({
  4452. selector: "removeAll",
  4453. protocol: "adding/removing",
  4454. //>>excludeStart("ide", pragmas.excludeIdeData);
  4455. args: [],
  4456. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4457. referencedClasses: [],
  4458. //>>excludeEnd("ide");
  4459. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4460. messageSends: []
  4461. }, function ($methodClass){ return function (){
  4462. var self=this,$self=this;
  4463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4464. return $core.withContext(function($ctx1) {
  4465. //>>excludeEnd("ctx");
  4466. self.length = 0;
  4467. return self;
  4468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4469. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4470. //>>excludeEnd("ctx");
  4471. }; }),
  4472. $globals.Array);
  4473. $core.addMethod(
  4474. $core.method({
  4475. selector: "removeFrom:to:",
  4476. protocol: "adding/removing",
  4477. //>>excludeStart("ide", pragmas.excludeIdeData);
  4478. args: ["aNumber", "anotherNumber"],
  4479. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4480. referencedClasses: [],
  4481. //>>excludeEnd("ide");
  4482. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4483. messageSends: []
  4484. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4485. var self=this,$self=this;
  4486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4487. return $core.withContext(function($ctx1) {
  4488. //>>excludeEnd("ctx");
  4489. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4490. return self;
  4491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4492. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4493. //>>excludeEnd("ctx");
  4494. }; }),
  4495. $globals.Array);
  4496. $core.addMethod(
  4497. $core.method({
  4498. selector: "removeIndex:",
  4499. protocol: "adding/removing",
  4500. //>>excludeStart("ide", pragmas.excludeIdeData);
  4501. args: ["anInteger"],
  4502. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4503. referencedClasses: [],
  4504. //>>excludeEnd("ide");
  4505. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4506. messageSends: []
  4507. }, function ($methodClass){ return function (anInteger){
  4508. var self=this,$self=this;
  4509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4510. return $core.withContext(function($ctx1) {
  4511. //>>excludeEnd("ctx");
  4512. self.splice(anInteger - 1, 1);
  4513. return self;
  4514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4515. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4516. //>>excludeEnd("ctx");
  4517. }; }),
  4518. $globals.Array);
  4519. $core.addMethod(
  4520. $core.method({
  4521. selector: "removeLast",
  4522. protocol: "adding/removing",
  4523. //>>excludeStart("ide", pragmas.excludeIdeData);
  4524. args: [],
  4525. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4526. referencedClasses: [],
  4527. //>>excludeEnd("ide");
  4528. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4529. messageSends: []
  4530. }, function ($methodClass){ return function (){
  4531. var self=this,$self=this;
  4532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4533. return $core.withContext(function($ctx1) {
  4534. //>>excludeEnd("ctx");
  4535. return self.pop();;
  4536. return self;
  4537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4538. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4539. //>>excludeEnd("ctx");
  4540. }; }),
  4541. $globals.Array);
  4542. $core.addMethod(
  4543. $core.method({
  4544. selector: "reversed",
  4545. protocol: "converting",
  4546. //>>excludeStart("ide", pragmas.excludeIdeData);
  4547. args: [],
  4548. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4549. referencedClasses: [],
  4550. //>>excludeEnd("ide");
  4551. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4552. messageSends: []
  4553. }, function ($methodClass){ return function (){
  4554. var self=this,$self=this;
  4555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4556. return $core.withContext(function($ctx1) {
  4557. //>>excludeEnd("ctx");
  4558. return self.slice().reverse();
  4559. return self;
  4560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4561. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4562. //>>excludeEnd("ctx");
  4563. }; }),
  4564. $globals.Array);
  4565. $core.addMethod(
  4566. $core.method({
  4567. selector: "select:",
  4568. protocol: "enumerating",
  4569. //>>excludeStart("ide", pragmas.excludeIdeData);
  4570. args: ["aBlock"],
  4571. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4572. referencedClasses: [],
  4573. //>>excludeEnd("ide");
  4574. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4575. messageSends: []
  4576. }, function ($methodClass){ return function (aBlock){
  4577. var self=this,$self=this;
  4578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4579. return $core.withContext(function($ctx1) {
  4580. //>>excludeEnd("ctx");
  4581. return self.filter(function(each) {return aBlock._value_(each)});
  4582. return self;
  4583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4584. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4585. //>>excludeEnd("ctx");
  4586. }; }),
  4587. $globals.Array);
  4588. $core.addMethod(
  4589. $core.method({
  4590. selector: "shallowCopy",
  4591. protocol: "copying",
  4592. //>>excludeStart("ide", pragmas.excludeIdeData);
  4593. args: [],
  4594. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4595. referencedClasses: [],
  4596. //>>excludeEnd("ide");
  4597. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4598. messageSends: []
  4599. }, function ($methodClass){ return function (){
  4600. var self=this,$self=this;
  4601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4602. return $core.withContext(function($ctx1) {
  4603. //>>excludeEnd("ctx");
  4604. return self.slice();
  4605. return self;
  4606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4607. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4608. //>>excludeEnd("ctx");
  4609. }; }),
  4610. $globals.Array);
  4611. $core.addMethod(
  4612. $core.method({
  4613. selector: "sort",
  4614. protocol: "enumerating",
  4615. //>>excludeStart("ide", pragmas.excludeIdeData);
  4616. args: [],
  4617. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4618. referencedClasses: [],
  4619. //>>excludeEnd("ide");
  4620. pragmas: [],
  4621. messageSends: ["sort:", "<"]
  4622. }, function ($methodClass){ return function (){
  4623. var self=this,$self=this;
  4624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4625. return $core.withContext(function($ctx1) {
  4626. //>>excludeEnd("ctx");
  4627. return $self._sort_((function(a,b){
  4628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4629. return $core.withContext(function($ctx2) {
  4630. //>>excludeEnd("ctx");
  4631. return $recv(a).__lt(b);
  4632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4633. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4634. //>>excludeEnd("ctx");
  4635. }));
  4636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4637. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4638. //>>excludeEnd("ctx");
  4639. }; }),
  4640. $globals.Array);
  4641. $core.addMethod(
  4642. $core.method({
  4643. selector: "sort:",
  4644. protocol: "enumerating",
  4645. //>>excludeStart("ide", pragmas.excludeIdeData);
  4646. args: ["aBlock"],
  4647. 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'>",
  4648. referencedClasses: [],
  4649. //>>excludeEnd("ide");
  4650. pragmas: [["inlineJS:", ["\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock._value_value_(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09"]]],
  4651. messageSends: []
  4652. }, function ($methodClass){ return function (aBlock){
  4653. var self=this,$self=this;
  4654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4655. return $core.withContext(function($ctx1) {
  4656. //>>excludeEnd("ctx");
  4657. return self.sort(function(a, b) {
  4658. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4659. })
  4660. ;
  4661. return self;
  4662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4663. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4664. //>>excludeEnd("ctx");
  4665. }; }),
  4666. $globals.Array);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "sorted",
  4670. protocol: "enumerating",
  4671. //>>excludeStart("ide", pragmas.excludeIdeData);
  4672. args: [],
  4673. source: "sorted\x0a\x09^ self copy sort",
  4674. referencedClasses: [],
  4675. //>>excludeEnd("ide");
  4676. pragmas: [],
  4677. messageSends: ["sort", "copy"]
  4678. }, function ($methodClass){ return function (){
  4679. var self=this,$self=this;
  4680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4681. return $core.withContext(function($ctx1) {
  4682. //>>excludeEnd("ctx");
  4683. return $recv($self._copy())._sort();
  4684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4685. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4686. //>>excludeEnd("ctx");
  4687. }; }),
  4688. $globals.Array);
  4689. $core.addMethod(
  4690. $core.method({
  4691. selector: "sorted:",
  4692. protocol: "enumerating",
  4693. //>>excludeStart("ide", pragmas.excludeIdeData);
  4694. args: ["aBlock"],
  4695. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4696. referencedClasses: [],
  4697. //>>excludeEnd("ide");
  4698. pragmas: [],
  4699. messageSends: ["sort:", "copy"]
  4700. }, function ($methodClass){ return function (aBlock){
  4701. var self=this,$self=this;
  4702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4703. return $core.withContext(function($ctx1) {
  4704. //>>excludeEnd("ctx");
  4705. return $recv($self._copy())._sort_(aBlock);
  4706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4707. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4708. //>>excludeEnd("ctx");
  4709. }; }),
  4710. $globals.Array);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "new:",
  4714. protocol: "instance creation",
  4715. //>>excludeStart("ide", pragmas.excludeIdeData);
  4716. args: ["anInteger"],
  4717. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4718. referencedClasses: [],
  4719. //>>excludeEnd("ide");
  4720. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4721. messageSends: []
  4722. }, function ($methodClass){ return function (anInteger){
  4723. var self=this,$self=this;
  4724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4725. return $core.withContext(function($ctx1) {
  4726. //>>excludeEnd("ctx");
  4727. return new Array(anInteger);
  4728. return self;
  4729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4730. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4731. //>>excludeEnd("ctx");
  4732. }; }),
  4733. $globals.Array.a$cls);
  4734. $core.addMethod(
  4735. $core.method({
  4736. selector: "with:",
  4737. protocol: "instance creation",
  4738. //>>excludeStart("ide", pragmas.excludeIdeData);
  4739. args: ["anObject"],
  4740. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4741. referencedClasses: [],
  4742. //>>excludeEnd("ide");
  4743. pragmas: [],
  4744. messageSends: ["at:put:", "new:", "yourself"]
  4745. }, function ($methodClass){ return function (anObject){
  4746. var self=this,$self=this;
  4747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4748. return $core.withContext(function($ctx1) {
  4749. //>>excludeEnd("ctx");
  4750. var $1;
  4751. $1=$self._new_((1));
  4752. $recv($1)._at_put_((1),anObject);
  4753. return $recv($1)._yourself();
  4754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4755. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4756. //>>excludeEnd("ctx");
  4757. }; }),
  4758. $globals.Array.a$cls);
  4759. $core.addMethod(
  4760. $core.method({
  4761. selector: "with:with:",
  4762. protocol: "instance creation",
  4763. //>>excludeStart("ide", pragmas.excludeIdeData);
  4764. args: ["anObject", "anObject2"],
  4765. 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",
  4766. referencedClasses: [],
  4767. //>>excludeEnd("ide");
  4768. pragmas: [],
  4769. messageSends: ["at:put:", "new:", "yourself"]
  4770. }, function ($methodClass){ return function (anObject,anObject2){
  4771. var self=this,$self=this;
  4772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4773. return $core.withContext(function($ctx1) {
  4774. //>>excludeEnd("ctx");
  4775. var $1;
  4776. $1=$self._new_((2));
  4777. $recv($1)._at_put_((1),anObject);
  4778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4779. $ctx1.sendIdx["at:put:"]=1;
  4780. //>>excludeEnd("ctx");
  4781. $recv($1)._at_put_((2),anObject2);
  4782. return $recv($1)._yourself();
  4783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4784. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4785. //>>excludeEnd("ctx");
  4786. }; }),
  4787. $globals.Array.a$cls);
  4788. $core.addMethod(
  4789. $core.method({
  4790. selector: "with:with:with:",
  4791. protocol: "instance creation",
  4792. //>>excludeStart("ide", pragmas.excludeIdeData);
  4793. args: ["anObject", "anObject2", "anObject3"],
  4794. 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",
  4795. referencedClasses: [],
  4796. //>>excludeEnd("ide");
  4797. pragmas: [],
  4798. messageSends: ["at:put:", "new:", "yourself"]
  4799. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4800. var self=this,$self=this;
  4801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4802. return $core.withContext(function($ctx1) {
  4803. //>>excludeEnd("ctx");
  4804. var $1;
  4805. $1=$self._new_((3));
  4806. $recv($1)._at_put_((1),anObject);
  4807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4808. $ctx1.sendIdx["at:put:"]=1;
  4809. //>>excludeEnd("ctx");
  4810. $recv($1)._at_put_((2),anObject2);
  4811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4812. $ctx1.sendIdx["at:put:"]=2;
  4813. //>>excludeEnd("ctx");
  4814. $recv($1)._at_put_((3),anObject3);
  4815. return $recv($1)._yourself();
  4816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4817. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4818. //>>excludeEnd("ctx");
  4819. }; }),
  4820. $globals.Array.a$cls);
  4821. $core.addMethod(
  4822. $core.method({
  4823. selector: "withAll:",
  4824. protocol: "instance creation",
  4825. //>>excludeStart("ide", pragmas.excludeIdeData);
  4826. args: ["aCollection"],
  4827. 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",
  4828. referencedClasses: [],
  4829. //>>excludeEnd("ide");
  4830. pragmas: [],
  4831. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4832. }, function ($methodClass){ return function (aCollection){
  4833. var self=this,$self=this;
  4834. var instance,index;
  4835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4836. return $core.withContext(function($ctx1) {
  4837. //>>excludeEnd("ctx");
  4838. index=(1);
  4839. instance=$self._new_($recv(aCollection)._size());
  4840. $recv(aCollection)._do_((function(each){
  4841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4842. return $core.withContext(function($ctx2) {
  4843. //>>excludeEnd("ctx");
  4844. $recv(instance)._at_put_(index,each);
  4845. index=$recv(index).__plus((1));
  4846. return index;
  4847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4848. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4849. //>>excludeEnd("ctx");
  4850. }));
  4851. return instance;
  4852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4853. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4854. //>>excludeEnd("ctx");
  4855. }; }),
  4856. $globals.Array.a$cls);
  4857. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4858. //>>excludeStart("ide", pragmas.excludeIdeData);
  4859. $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 >> #,`";
  4860. //>>excludeEnd("ide");
  4861. $core.addMethod(
  4862. $core.method({
  4863. selector: ",",
  4864. protocol: "copying",
  4865. //>>excludeStart("ide", pragmas.excludeIdeData);
  4866. args: ["aString"],
  4867. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4868. referencedClasses: [],
  4869. //>>excludeEnd("ide");
  4870. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4871. messageSends: []
  4872. }, function ($methodClass){ return function (aString){
  4873. var self=this,$self=this;
  4874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4875. return $core.withContext(function($ctx1) {
  4876. //>>excludeEnd("ctx");
  4877. return String(self) + aString;
  4878. return self;
  4879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4880. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4881. //>>excludeEnd("ctx");
  4882. }; }),
  4883. $globals.String);
  4884. $core.addMethod(
  4885. $core.method({
  4886. selector: "<",
  4887. protocol: "comparing",
  4888. //>>excludeStart("ide", pragmas.excludeIdeData);
  4889. args: ["aString"],
  4890. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4891. referencedClasses: [],
  4892. //>>excludeEnd("ide");
  4893. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4894. messageSends: []
  4895. }, function ($methodClass){ return function (aString){
  4896. var self=this,$self=this;
  4897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4898. return $core.withContext(function($ctx1) {
  4899. //>>excludeEnd("ctx");
  4900. return String(self) < aString._asString();
  4901. return self;
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  4904. //>>excludeEnd("ctx");
  4905. }; }),
  4906. $globals.String);
  4907. $core.addMethod(
  4908. $core.method({
  4909. selector: "<=",
  4910. protocol: "comparing",
  4911. //>>excludeStart("ide", pragmas.excludeIdeData);
  4912. args: ["aString"],
  4913. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4914. referencedClasses: [],
  4915. //>>excludeEnd("ide");
  4916. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  4917. messageSends: []
  4918. }, function ($methodClass){ return function (aString){
  4919. var self=this,$self=this;
  4920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4921. return $core.withContext(function($ctx1) {
  4922. //>>excludeEnd("ctx");
  4923. return String(self) <= aString._asString();
  4924. return self;
  4925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4926. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  4927. //>>excludeEnd("ctx");
  4928. }; }),
  4929. $globals.String);
  4930. $core.addMethod(
  4931. $core.method({
  4932. selector: "=",
  4933. protocol: "comparing",
  4934. //>>excludeStart("ide", pragmas.excludeIdeData);
  4935. args: ["aString"],
  4936. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  4937. referencedClasses: [],
  4938. //>>excludeEnd("ide");
  4939. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  4940. messageSends: []
  4941. }, function ($methodClass){ return function (aString){
  4942. var self=this,$self=this;
  4943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4944. return $core.withContext(function($ctx1) {
  4945. //>>excludeEnd("ctx");
  4946. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  4947. return self;
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  4950. //>>excludeEnd("ctx");
  4951. }; }),
  4952. $globals.String);
  4953. $core.addMethod(
  4954. $core.method({
  4955. selector: "==",
  4956. protocol: "comparing",
  4957. //>>excludeStart("ide", pragmas.excludeIdeData);
  4958. args: ["aString"],
  4959. 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'>",
  4960. referencedClasses: [],
  4961. //>>excludeEnd("ide");
  4962. pragmas: [["inlineJS:", ["\x0a\x09if (typeof aString === \x22string\x22) return String(self) === aString;\x0a\x09else if (aString != null && typeof aString === \x22object\x22) return String(self) === aString.valueOf();\x0a\x09else return false;"]]],
  4963. messageSends: []
  4964. }, function ($methodClass){ return function (aString){
  4965. var self=this,$self=this;
  4966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4967. return $core.withContext(function($ctx1) {
  4968. //>>excludeEnd("ctx");
  4969. if (typeof aString === "string") return String(self) === aString;
  4970. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  4971. else return false;;
  4972. return self;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  4975. //>>excludeEnd("ctx");
  4976. }; }),
  4977. $globals.String);
  4978. $core.addMethod(
  4979. $core.method({
  4980. selector: ">",
  4981. protocol: "comparing",
  4982. //>>excludeStart("ide", pragmas.excludeIdeData);
  4983. args: ["aString"],
  4984. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  4985. referencedClasses: [],
  4986. //>>excludeEnd("ide");
  4987. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  4988. messageSends: []
  4989. }, function ($methodClass){ return function (aString){
  4990. var self=this,$self=this;
  4991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4992. return $core.withContext(function($ctx1) {
  4993. //>>excludeEnd("ctx");
  4994. return String(self) > aString._asString();
  4995. return self;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  4998. //>>excludeEnd("ctx");
  4999. }; }),
  5000. $globals.String);
  5001. $core.addMethod(
  5002. $core.method({
  5003. selector: ">=",
  5004. protocol: "comparing",
  5005. //>>excludeStart("ide", pragmas.excludeIdeData);
  5006. args: ["aString"],
  5007. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5008. referencedClasses: [],
  5009. //>>excludeEnd("ide");
  5010. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5011. messageSends: []
  5012. }, function ($methodClass){ return function (aString){
  5013. var self=this,$self=this;
  5014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5015. return $core.withContext(function($ctx1) {
  5016. //>>excludeEnd("ctx");
  5017. return String(self) >= aString._asString();
  5018. return self;
  5019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5020. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5021. //>>excludeEnd("ctx");
  5022. }; }),
  5023. $globals.String);
  5024. $core.addMethod(
  5025. $core.method({
  5026. selector: "add:",
  5027. protocol: "adding/removing",
  5028. //>>excludeStart("ide", pragmas.excludeIdeData);
  5029. args: ["anObject"],
  5030. source: "add: anObject\x0a\x09self errorReadOnly",
  5031. referencedClasses: [],
  5032. //>>excludeEnd("ide");
  5033. pragmas: [],
  5034. messageSends: ["errorReadOnly"]
  5035. }, function ($methodClass){ return function (anObject){
  5036. var self=this,$self=this;
  5037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5038. return $core.withContext(function($ctx1) {
  5039. //>>excludeEnd("ctx");
  5040. $self._errorReadOnly();
  5041. return self;
  5042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5043. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5044. //>>excludeEnd("ctx");
  5045. }; }),
  5046. $globals.String);
  5047. $core.addMethod(
  5048. $core.method({
  5049. selector: "asJavaScriptMethodName",
  5050. protocol: "converting",
  5051. //>>excludeStart("ide", pragmas.excludeIdeData);
  5052. args: [],
  5053. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5054. referencedClasses: [],
  5055. //>>excludeEnd("ide");
  5056. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5057. messageSends: []
  5058. }, function ($methodClass){ return function (){
  5059. var self=this,$self=this;
  5060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5061. return $core.withContext(function($ctx1) {
  5062. //>>excludeEnd("ctx");
  5063. return $core.st2js(self);
  5064. return self;
  5065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5066. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5067. //>>excludeEnd("ctx");
  5068. }; }),
  5069. $globals.String);
  5070. $core.addMethod(
  5071. $core.method({
  5072. selector: "asJavaScriptObject",
  5073. protocol: "converting",
  5074. //>>excludeStart("ide", pragmas.excludeIdeData);
  5075. args: [],
  5076. source: "asJavaScriptObject\x0a\x09^ self",
  5077. referencedClasses: [],
  5078. //>>excludeEnd("ide");
  5079. pragmas: [],
  5080. messageSends: []
  5081. }, function ($methodClass){ return function (){
  5082. var self=this,$self=this;
  5083. return self;
  5084. }; }),
  5085. $globals.String);
  5086. $core.addMethod(
  5087. $core.method({
  5088. selector: "asJavaScriptSource",
  5089. protocol: "converting",
  5090. //>>excludeStart("ide", pragmas.excludeIdeData);
  5091. args: [],
  5092. 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'>",
  5093. referencedClasses: [],
  5094. //>>excludeEnd("ide");
  5095. pragmas: [["inlineJS:", ["\x0a\x09\x09if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self.replace(/[\x5cx00-\x5cx1f\x22\x5c\x5c\x5cx7f-\x5cx9f]/g, function(ch){var c=ch.charCodeAt(0);return \x22\x5c\x5cx\x22+(\x220\x22+c.toString(16)).slice(-2)}) + \x22\x5c\x22\x22;\x0a\x09\x09else\x0a\x09\x09\x09return \x22\x5c\x22\x22 + self + \x22\x5c\x22\x22;\x0a\x09"]]],
  5096. messageSends: []
  5097. }, function ($methodClass){ return function (){
  5098. var self=this,$self=this;
  5099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5100. return $core.withContext(function($ctx1) {
  5101. //>>excludeEnd("ctx");
  5102. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5103. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5104. else
  5105. return "\"" + self + "\"";
  5106. ;
  5107. return self;
  5108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5109. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5110. //>>excludeEnd("ctx");
  5111. }; }),
  5112. $globals.String);
  5113. $core.addMethod(
  5114. $core.method({
  5115. selector: "asLowercase",
  5116. protocol: "converting",
  5117. //>>excludeStart("ide", pragmas.excludeIdeData);
  5118. args: [],
  5119. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5120. referencedClasses: [],
  5121. //>>excludeEnd("ide");
  5122. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5123. messageSends: []
  5124. }, function ($methodClass){ return function (){
  5125. var self=this,$self=this;
  5126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5127. return $core.withContext(function($ctx1) {
  5128. //>>excludeEnd("ctx");
  5129. return self.toLowerCase();
  5130. return self;
  5131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5132. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5133. //>>excludeEnd("ctx");
  5134. }; }),
  5135. $globals.String);
  5136. $core.addMethod(
  5137. $core.method({
  5138. selector: "asMutator",
  5139. protocol: "converting",
  5140. //>>excludeStart("ide", pragmas.excludeIdeData);
  5141. args: [],
  5142. 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",
  5143. referencedClasses: [],
  5144. //>>excludeEnd("ide");
  5145. pragmas: [],
  5146. messageSends: ["ifFalse:", "=", "last", ","]
  5147. }, function ($methodClass){ return function (){
  5148. var self=this,$self=this;
  5149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5150. return $core.withContext(function($ctx1) {
  5151. //>>excludeEnd("ctx");
  5152. var $1;
  5153. $1=$recv($self._last()).__eq(":");
  5154. if(!$core.assert($1)){
  5155. return $self.__comma(":");
  5156. }
  5157. return self;
  5158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5159. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5160. //>>excludeEnd("ctx");
  5161. }; }),
  5162. $globals.String);
  5163. $core.addMethod(
  5164. $core.method({
  5165. selector: "asNumber",
  5166. protocol: "converting",
  5167. //>>excludeStart("ide", pragmas.excludeIdeData);
  5168. args: [],
  5169. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5170. referencedClasses: [],
  5171. //>>excludeEnd("ide");
  5172. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5173. messageSends: []
  5174. }, function ($methodClass){ return function (){
  5175. var self=this,$self=this;
  5176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5177. return $core.withContext(function($ctx1) {
  5178. //>>excludeEnd("ctx");
  5179. return Number(self);
  5180. return self;
  5181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5182. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5183. //>>excludeEnd("ctx");
  5184. }; }),
  5185. $globals.String);
  5186. $core.addMethod(
  5187. $core.method({
  5188. selector: "asRegexp",
  5189. protocol: "converting",
  5190. //>>excludeStart("ide", pragmas.excludeIdeData);
  5191. args: [],
  5192. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5193. referencedClasses: ["RegularExpression"],
  5194. //>>excludeEnd("ide");
  5195. pragmas: [],
  5196. messageSends: ["fromString:"]
  5197. }, function ($methodClass){ return function (){
  5198. var self=this,$self=this;
  5199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5200. return $core.withContext(function($ctx1) {
  5201. //>>excludeEnd("ctx");
  5202. return $recv($globals.RegularExpression)._fromString_(self);
  5203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5204. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5205. //>>excludeEnd("ctx");
  5206. }; }),
  5207. $globals.String);
  5208. $core.addMethod(
  5209. $core.method({
  5210. selector: "asString",
  5211. protocol: "converting",
  5212. //>>excludeStart("ide", pragmas.excludeIdeData);
  5213. args: [],
  5214. source: "asString\x0a\x09^ self",
  5215. referencedClasses: [],
  5216. //>>excludeEnd("ide");
  5217. pragmas: [],
  5218. messageSends: []
  5219. }, function ($methodClass){ return function (){
  5220. var self=this,$self=this;
  5221. return self;
  5222. }; }),
  5223. $globals.String);
  5224. $core.addMethod(
  5225. $core.method({
  5226. selector: "asSymbol",
  5227. protocol: "converting",
  5228. //>>excludeStart("ide", pragmas.excludeIdeData);
  5229. args: [],
  5230. source: "asSymbol\x0a\x09^ self",
  5231. referencedClasses: [],
  5232. //>>excludeEnd("ide");
  5233. pragmas: [],
  5234. messageSends: []
  5235. }, function ($methodClass){ return function (){
  5236. var self=this,$self=this;
  5237. return self;
  5238. }; }),
  5239. $globals.String);
  5240. $core.addMethod(
  5241. $core.method({
  5242. selector: "asSymbolPrintOn:",
  5243. protocol: "printing",
  5244. //>>excludeStart("ide", pragmas.excludeIdeData);
  5245. args: ["aStream"],
  5246. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5247. referencedClasses: [],
  5248. //>>excludeEnd("ide");
  5249. pragmas: [],
  5250. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5251. }, function ($methodClass){ return function (aStream){
  5252. var self=this,$self=this;
  5253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5254. return $core.withContext(function($ctx1) {
  5255. //>>excludeEnd("ctx");
  5256. var $1;
  5257. $recv(aStream)._nextPutAll_("#");
  5258. $1=$recv($self._asString())._isSelector();
  5259. if($core.assert($1)){
  5260. $recv(aStream)._nextPut_(self);
  5261. } else {
  5262. $self._printOn_(aStream);
  5263. }
  5264. return self;
  5265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5266. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5267. //>>excludeEnd("ctx");
  5268. }; }),
  5269. $globals.String);
  5270. $core.addMethod(
  5271. $core.method({
  5272. selector: "asUppercase",
  5273. protocol: "converting",
  5274. //>>excludeStart("ide", pragmas.excludeIdeData);
  5275. args: [],
  5276. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5277. referencedClasses: [],
  5278. //>>excludeEnd("ide");
  5279. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5280. messageSends: []
  5281. }, function ($methodClass){ return function (){
  5282. var self=this,$self=this;
  5283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5284. return $core.withContext(function($ctx1) {
  5285. //>>excludeEnd("ctx");
  5286. return self.toUpperCase();
  5287. return self;
  5288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5289. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5290. //>>excludeEnd("ctx");
  5291. }; }),
  5292. $globals.String);
  5293. $core.addMethod(
  5294. $core.method({
  5295. selector: "asciiValue",
  5296. protocol: "accessing",
  5297. //>>excludeStart("ide", pragmas.excludeIdeData);
  5298. args: [],
  5299. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5300. referencedClasses: [],
  5301. //>>excludeEnd("ide");
  5302. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5303. messageSends: []
  5304. }, function ($methodClass){ return function (){
  5305. var self=this,$self=this;
  5306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5307. return $core.withContext(function($ctx1) {
  5308. //>>excludeEnd("ctx");
  5309. return self.charCodeAt(0);;
  5310. return self;
  5311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5312. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5313. //>>excludeEnd("ctx");
  5314. }; }),
  5315. $globals.String);
  5316. $core.addMethod(
  5317. $core.method({
  5318. selector: "at:ifAbsent:",
  5319. protocol: "accessing",
  5320. //>>excludeStart("ide", pragmas.excludeIdeData);
  5321. args: ["anIndex", "aBlock"],
  5322. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5323. referencedClasses: [],
  5324. //>>excludeEnd("ide");
  5325. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5326. messageSends: []
  5327. }, function ($methodClass){ return function (anIndex,aBlock){
  5328. var self=this,$self=this;
  5329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5330. return $core.withContext(function($ctx1) {
  5331. //>>excludeEnd("ctx");
  5332. return String(self)[anIndex - 1] || aBlock._value();
  5333. return self;
  5334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5335. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5336. //>>excludeEnd("ctx");
  5337. }; }),
  5338. $globals.String);
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: "at:ifPresent:ifAbsent:",
  5342. protocol: "accessing",
  5343. //>>excludeStart("ide", pragmas.excludeIdeData);
  5344. args: ["anIndex", "aBlock", "anotherBlock"],
  5345. 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'>",
  5346. referencedClasses: [],
  5347. //>>excludeEnd("ide");
  5348. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5349. messageSends: []
  5350. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5351. var self=this,$self=this;
  5352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5353. return $core.withContext(function($ctx1) {
  5354. //>>excludeEnd("ctx");
  5355. var result = String(self)[anIndex - 1];
  5356. return result ? aBlock._value_(result) : anotherBlock._value();
  5357. ;
  5358. return self;
  5359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5360. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5361. //>>excludeEnd("ctx");
  5362. }; }),
  5363. $globals.String);
  5364. $core.addMethod(
  5365. $core.method({
  5366. selector: "at:put:",
  5367. protocol: "accessing",
  5368. //>>excludeStart("ide", pragmas.excludeIdeData);
  5369. args: ["anIndex", "anObject"],
  5370. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5371. referencedClasses: [],
  5372. //>>excludeEnd("ide");
  5373. pragmas: [],
  5374. messageSends: ["errorReadOnly"]
  5375. }, function ($methodClass){ return function (anIndex,anObject){
  5376. var self=this,$self=this;
  5377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5378. return $core.withContext(function($ctx1) {
  5379. //>>excludeEnd("ctx");
  5380. $self._errorReadOnly();
  5381. return self;
  5382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5383. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5384. //>>excludeEnd("ctx");
  5385. }; }),
  5386. $globals.String);
  5387. $core.addMethod(
  5388. $core.method({
  5389. selector: "capitalized",
  5390. protocol: "converting",
  5391. //>>excludeStart("ide", pragmas.excludeIdeData);
  5392. args: [],
  5393. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5394. referencedClasses: [],
  5395. //>>excludeEnd("ide");
  5396. pragmas: [],
  5397. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5398. }, function ($methodClass){ return function (){
  5399. var self=this,$self=this;
  5400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5401. return $core.withContext(function($ctx1) {
  5402. //>>excludeEnd("ctx");
  5403. return $self._ifNotEmpty_((function(){
  5404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5405. return $core.withContext(function($ctx2) {
  5406. //>>excludeEnd("ctx");
  5407. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5410. //>>excludeEnd("ctx");
  5411. }));
  5412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5413. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5414. //>>excludeEnd("ctx");
  5415. }; }),
  5416. $globals.String);
  5417. $core.addMethod(
  5418. $core.method({
  5419. selector: "charCodeAt:",
  5420. protocol: "accessing",
  5421. //>>excludeStart("ide", pragmas.excludeIdeData);
  5422. args: ["anInteger"],
  5423. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5424. referencedClasses: [],
  5425. //>>excludeEnd("ide");
  5426. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5427. messageSends: []
  5428. }, function ($methodClass){ return function (anInteger){
  5429. var self=this,$self=this;
  5430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5431. return $core.withContext(function($ctx1) {
  5432. //>>excludeEnd("ctx");
  5433. return self.charCodeAt(anInteger - 1);
  5434. return self;
  5435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5436. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5437. //>>excludeEnd("ctx");
  5438. }; }),
  5439. $globals.String);
  5440. $core.addMethod(
  5441. $core.method({
  5442. selector: "copyFrom:to:",
  5443. protocol: "copying",
  5444. //>>excludeStart("ide", pragmas.excludeIdeData);
  5445. args: ["anIndex", "anotherIndex"],
  5446. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5447. referencedClasses: [],
  5448. //>>excludeEnd("ide");
  5449. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5450. messageSends: []
  5451. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5452. var self=this,$self=this;
  5453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5454. return $core.withContext(function($ctx1) {
  5455. //>>excludeEnd("ctx");
  5456. return self.substring(anIndex - 1, anotherIndex);
  5457. return self;
  5458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5459. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5460. //>>excludeEnd("ctx");
  5461. }; }),
  5462. $globals.String);
  5463. $core.addMethod(
  5464. $core.method({
  5465. selector: "crlfSanitized",
  5466. protocol: "converting",
  5467. //>>excludeStart("ide", pragmas.excludeIdeData);
  5468. args: [],
  5469. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5470. referencedClasses: ["String"],
  5471. //>>excludeEnd("ide");
  5472. pragmas: [],
  5473. messageSends: ["join:", "lines", "lf"]
  5474. }, function ($methodClass){ return function (){
  5475. var self=this,$self=this;
  5476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5477. return $core.withContext(function($ctx1) {
  5478. //>>excludeEnd("ctx");
  5479. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5481. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5482. //>>excludeEnd("ctx");
  5483. }; }),
  5484. $globals.String);
  5485. $core.addMethod(
  5486. $core.method({
  5487. selector: "deepCopy",
  5488. protocol: "copying",
  5489. //>>excludeStart("ide", pragmas.excludeIdeData);
  5490. args: [],
  5491. source: "deepCopy\x0a\x09^ self shallowCopy",
  5492. referencedClasses: [],
  5493. //>>excludeEnd("ide");
  5494. pragmas: [],
  5495. messageSends: ["shallowCopy"]
  5496. }, function ($methodClass){ return function (){
  5497. var self=this,$self=this;
  5498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5499. return $core.withContext(function($ctx1) {
  5500. //>>excludeEnd("ctx");
  5501. return $self._shallowCopy();
  5502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5503. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5504. //>>excludeEnd("ctx");
  5505. }; }),
  5506. $globals.String);
  5507. $core.addMethod(
  5508. $core.method({
  5509. selector: "errorReadOnly",
  5510. protocol: "error handling",
  5511. //>>excludeStart("ide", pragmas.excludeIdeData);
  5512. args: [],
  5513. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5514. referencedClasses: [],
  5515. //>>excludeEnd("ide");
  5516. pragmas: [],
  5517. messageSends: ["error:"]
  5518. }, function ($methodClass){ return function (){
  5519. var self=this,$self=this;
  5520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5521. return $core.withContext(function($ctx1) {
  5522. //>>excludeEnd("ctx");
  5523. $self._error_("Object is read-only");
  5524. return self;
  5525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5526. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5527. //>>excludeEnd("ctx");
  5528. }; }),
  5529. $globals.String);
  5530. $core.addMethod(
  5531. $core.method({
  5532. selector: "escaped",
  5533. protocol: "converting",
  5534. //>>excludeStart("ide", pragmas.excludeIdeData);
  5535. args: [],
  5536. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5537. referencedClasses: [],
  5538. //>>excludeEnd("ide");
  5539. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5540. messageSends: []
  5541. }, function ($methodClass){ return function (){
  5542. var self=this,$self=this;
  5543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5544. return $core.withContext(function($ctx1) {
  5545. //>>excludeEnd("ctx");
  5546. return escape(self);
  5547. return self;
  5548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5549. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5550. //>>excludeEnd("ctx");
  5551. }; }),
  5552. $globals.String);
  5553. $core.addMethod(
  5554. $core.method({
  5555. selector: "includesSubString:",
  5556. protocol: "testing",
  5557. //>>excludeStart("ide", pragmas.excludeIdeData);
  5558. args: ["subString"],
  5559. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5560. referencedClasses: [],
  5561. //>>excludeEnd("ide");
  5562. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5563. messageSends: []
  5564. }, function ($methodClass){ return function (subString){
  5565. var self=this,$self=this;
  5566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5567. return $core.withContext(function($ctx1) {
  5568. //>>excludeEnd("ctx");
  5569. return self.indexOf(subString) != -1;
  5570. return self;
  5571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5572. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5573. //>>excludeEnd("ctx");
  5574. }; }),
  5575. $globals.String);
  5576. $core.addMethod(
  5577. $core.method({
  5578. selector: "isCapitalized",
  5579. protocol: "testing",
  5580. //>>excludeStart("ide", pragmas.excludeIdeData);
  5581. args: [],
  5582. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5583. referencedClasses: [],
  5584. //>>excludeEnd("ide");
  5585. pragmas: [],
  5586. messageSends: ["==", "asUppercase", "first"]
  5587. }, function ($methodClass){ return function (){
  5588. var self=this,$self=this;
  5589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5590. return $core.withContext(function($ctx1) {
  5591. //>>excludeEnd("ctx");
  5592. var $2,$1;
  5593. $2=$self._first();
  5594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5595. $ctx1.sendIdx["first"]=1;
  5596. //>>excludeEnd("ctx");
  5597. $1=$recv($2)._asUppercase();
  5598. return $recv($1).__eq_eq($self._first());
  5599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5600. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5601. //>>excludeEnd("ctx");
  5602. }; }),
  5603. $globals.String);
  5604. $core.addMethod(
  5605. $core.method({
  5606. selector: "isImmutable",
  5607. protocol: "testing",
  5608. //>>excludeStart("ide", pragmas.excludeIdeData);
  5609. args: [],
  5610. source: "isImmutable\x0a\x09^ true",
  5611. referencedClasses: [],
  5612. //>>excludeEnd("ide");
  5613. pragmas: [],
  5614. messageSends: []
  5615. }, function ($methodClass){ return function (){
  5616. var self=this,$self=this;
  5617. return true;
  5618. }; }),
  5619. $globals.String);
  5620. $core.addMethod(
  5621. $core.method({
  5622. selector: "isSelector",
  5623. protocol: "testing",
  5624. //>>excludeStart("ide", pragmas.excludeIdeData);
  5625. args: [],
  5626. 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>",
  5627. referencedClasses: [],
  5628. //>>excludeEnd("ide");
  5629. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5630. messageSends: []
  5631. }, function ($methodClass){ return function (){
  5632. var self=this,$self=this;
  5633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5634. return $core.withContext(function($ctx1) {
  5635. //>>excludeEnd("ctx");
  5636. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5637. return self;
  5638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5639. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5640. //>>excludeEnd("ctx");
  5641. }; }),
  5642. $globals.String);
  5643. $core.addMethod(
  5644. $core.method({
  5645. selector: "isString",
  5646. protocol: "testing",
  5647. //>>excludeStart("ide", pragmas.excludeIdeData);
  5648. args: [],
  5649. source: "isString\x0a\x09^ true",
  5650. referencedClasses: [],
  5651. //>>excludeEnd("ide");
  5652. pragmas: [],
  5653. messageSends: []
  5654. }, function ($methodClass){ return function (){
  5655. var self=this,$self=this;
  5656. return true;
  5657. }; }),
  5658. $globals.String);
  5659. $core.addMethod(
  5660. $core.method({
  5661. selector: "isVowel",
  5662. protocol: "testing",
  5663. //>>excludeStart("ide", pragmas.excludeIdeData);
  5664. args: [],
  5665. 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 ]",
  5666. referencedClasses: [],
  5667. //>>excludeEnd("ide");
  5668. pragmas: [],
  5669. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5670. }, function ($methodClass){ return function (){
  5671. var self=this,$self=this;
  5672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5673. return $core.withContext(function($ctx1) {
  5674. //>>excludeEnd("ctx");
  5675. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5677. return $core.withContext(function($ctx2) {
  5678. //>>excludeEnd("ctx");
  5679. return "aeiou"._includes_($self._asLowercase());
  5680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5681. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5682. //>>excludeEnd("ctx");
  5683. }));
  5684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5685. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5686. //>>excludeEnd("ctx");
  5687. }; }),
  5688. $globals.String);
  5689. $core.addMethod(
  5690. $core.method({
  5691. selector: "join:",
  5692. protocol: "split join",
  5693. //>>excludeStart("ide", pragmas.excludeIdeData);
  5694. args: ["aCollection"],
  5695. 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 ]]",
  5696. referencedClasses: ["String"],
  5697. //>>excludeEnd("ide");
  5698. pragmas: [],
  5699. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5700. }, function ($methodClass){ return function (aCollection){
  5701. var self=this,$self=this;
  5702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5703. return $core.withContext(function($ctx1) {
  5704. //>>excludeEnd("ctx");
  5705. return $recv($globals.String)._streamContents_((function(stream){
  5706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5707. return $core.withContext(function($ctx2) {
  5708. //>>excludeEnd("ctx");
  5709. return $recv(aCollection)._do_separatedBy_((function(each){
  5710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5711. return $core.withContext(function($ctx3) {
  5712. //>>excludeEnd("ctx");
  5713. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5715. $ctx3.sendIdx["nextPutAll:"]=1;
  5716. //>>excludeEnd("ctx");
  5717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5718. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5719. //>>excludeEnd("ctx");
  5720. }),(function(){
  5721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5722. return $core.withContext(function($ctx3) {
  5723. //>>excludeEnd("ctx");
  5724. return $recv(stream)._nextPutAll_(self);
  5725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5726. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5727. //>>excludeEnd("ctx");
  5728. }));
  5729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5730. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5731. //>>excludeEnd("ctx");
  5732. }));
  5733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5734. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5735. //>>excludeEnd("ctx");
  5736. }; }),
  5737. $globals.String);
  5738. $core.addMethod(
  5739. $core.method({
  5740. selector: "lineIndicesDo:",
  5741. protocol: "split join",
  5742. //>>excludeStart("ide", pragmas.excludeIdeData);
  5743. args: ["aBlock"],
  5744. 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 ] ]]",
  5745. referencedClasses: ["String"],
  5746. //>>excludeEnd("ide");
  5747. pragmas: [],
  5748. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5749. }, function ($methodClass){ return function (aBlock){
  5750. var self=this,$self=this;
  5751. var cr,lf,start,sz,nextLF,nextCR;
  5752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5753. return $core.withContext(function($ctx1) {
  5754. //>>excludeEnd("ctx");
  5755. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5756. var $early={};
  5757. try {
  5758. start=(1);
  5759. sz=$self._size();
  5760. cr=$recv($globals.String)._cr();
  5761. nextCR=$self._indexOf_startingAt_(cr,(1));
  5762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5763. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5764. //>>excludeEnd("ctx");
  5765. lf=$recv($globals.String)._lf();
  5766. nextLF=$self._indexOf_startingAt_(lf,(1));
  5767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5768. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5769. //>>excludeEnd("ctx");
  5770. $recv((function(){
  5771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5772. return $core.withContext(function($ctx2) {
  5773. //>>excludeEnd("ctx");
  5774. return $recv(start).__lt_eq(sz);
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5777. //>>excludeEnd("ctx");
  5778. }))._whileTrue_((function(){
  5779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5780. return $core.withContext(function($ctx2) {
  5781. //>>excludeEnd("ctx");
  5782. $2=$recv(nextLF).__eq((0));
  5783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5784. $ctx2.sendIdx["="]=1;
  5785. //>>excludeEnd("ctx");
  5786. $1=$recv($2)._and_((function(){
  5787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5788. return $core.withContext(function($ctx3) {
  5789. //>>excludeEnd("ctx");
  5790. return $recv(nextCR).__eq((0));
  5791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5792. $ctx3.sendIdx["="]=2;
  5793. //>>excludeEnd("ctx");
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5796. //>>excludeEnd("ctx");
  5797. }));
  5798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5799. $ctx2.sendIdx["and:"]=1;
  5800. //>>excludeEnd("ctx");
  5801. if($core.assert($1)){
  5802. $recv(aBlock)._value_value_value_(start,sz,sz);
  5803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5804. $ctx2.sendIdx["value:value:value:"]=1;
  5805. //>>excludeEnd("ctx");
  5806. throw $early=[self];
  5807. }
  5808. $4=$recv(nextCR).__eq((0));
  5809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5810. $ctx2.sendIdx["="]=3;
  5811. //>>excludeEnd("ctx");
  5812. $3=$recv($4)._or_((function(){
  5813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5814. return $core.withContext(function($ctx3) {
  5815. //>>excludeEnd("ctx");
  5816. $5=(0).__lt(nextLF);
  5817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5818. $ctx3.sendIdx["<"]=1;
  5819. //>>excludeEnd("ctx");
  5820. return $recv($5)._and_((function(){
  5821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5822. return $core.withContext(function($ctx4) {
  5823. //>>excludeEnd("ctx");
  5824. return $recv(nextLF).__lt(nextCR);
  5825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5826. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5827. //>>excludeEnd("ctx");
  5828. }));
  5829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5830. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5831. //>>excludeEnd("ctx");
  5832. }));
  5833. if($core.assert($3)){
  5834. $6=start;
  5835. $7=$recv(nextLF).__minus((1));
  5836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5837. $ctx2.sendIdx["-"]=1;
  5838. //>>excludeEnd("ctx");
  5839. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. $ctx2.sendIdx["value:value:value:"]=2;
  5842. //>>excludeEnd("ctx");
  5843. start=(1).__plus(nextLF);
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. $ctx2.sendIdx["+"]=1;
  5846. //>>excludeEnd("ctx");
  5847. nextLF=$self._indexOf_startingAt_(lf,start);
  5848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5849. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5850. //>>excludeEnd("ctx");
  5851. return nextLF;
  5852. } else {
  5853. $9=(1).__plus(nextCR);
  5854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5855. $ctx2.sendIdx["+"]=2;
  5856. //>>excludeEnd("ctx");
  5857. $8=$recv($9).__eq(nextLF);
  5858. if($core.assert($8)){
  5859. $10=start;
  5860. $11=$recv(nextCR).__minus((1));
  5861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5862. $ctx2.sendIdx["-"]=2;
  5863. //>>excludeEnd("ctx");
  5864. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5866. $ctx2.sendIdx["value:value:value:"]=3;
  5867. //>>excludeEnd("ctx");
  5868. start=(1).__plus(nextLF);
  5869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5870. $ctx2.sendIdx["+"]=3;
  5871. //>>excludeEnd("ctx");
  5872. nextCR=$self._indexOf_startingAt_(cr,start);
  5873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5874. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  5875. //>>excludeEnd("ctx");
  5876. nextLF=$self._indexOf_startingAt_(lf,start);
  5877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5878. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  5879. //>>excludeEnd("ctx");
  5880. return nextLF;
  5881. } else {
  5882. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5883. start=(1).__plus(nextCR);
  5884. nextCR=$self._indexOf_startingAt_(cr,start);
  5885. return nextCR;
  5886. }
  5887. }
  5888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5890. //>>excludeEnd("ctx");
  5891. }));
  5892. return self;
  5893. }
  5894. catch(e) {if(e===$early)return e[0]; throw e}
  5895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5896. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  5897. //>>excludeEnd("ctx");
  5898. }; }),
  5899. $globals.String);
  5900. $core.addMethod(
  5901. $core.method({
  5902. selector: "lineNumber:",
  5903. protocol: "split join",
  5904. //>>excludeStart("ide", pragmas.excludeIdeData);
  5905. args: ["anIndex"],
  5906. 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",
  5907. referencedClasses: [],
  5908. //>>excludeEnd("ide");
  5909. pragmas: [],
  5910. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  5911. }, function ($methodClass){ return function (anIndex){
  5912. var self=this,$self=this;
  5913. var lineCount;
  5914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5915. return $core.withContext(function($ctx1) {
  5916. //>>excludeEnd("ctx");
  5917. var $2,$1;
  5918. var $early={};
  5919. try {
  5920. lineCount=(0);
  5921. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  5922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5923. return $core.withContext(function($ctx2) {
  5924. //>>excludeEnd("ctx");
  5925. lineCount=$recv(lineCount).__plus((1));
  5926. $2=lineCount;
  5927. $1=$recv($2).__eq(anIndex);
  5928. if($core.assert($1)){
  5929. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  5930. }
  5931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5932. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  5933. //>>excludeEnd("ctx");
  5934. }));
  5935. return nil;
  5936. }
  5937. catch(e) {if(e===$early)return e[0]; throw e}
  5938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5939. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  5940. //>>excludeEnd("ctx");
  5941. }; }),
  5942. $globals.String);
  5943. $core.addMethod(
  5944. $core.method({
  5945. selector: "lines",
  5946. protocol: "split join",
  5947. //>>excludeStart("ide", pragmas.excludeIdeData);
  5948. args: [],
  5949. 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'>",
  5950. referencedClasses: [],
  5951. //>>excludeEnd("ide");
  5952. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  5953. messageSends: []
  5954. }, function ($methodClass){ return function (){
  5955. var self=this,$self=this;
  5956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5957. return $core.withContext(function($ctx1) {
  5958. //>>excludeEnd("ctx");
  5959. var result = self.split(/\r\n|\r|\n/);
  5960. if (!result[result.length-1]) result.pop();
  5961. return result;;
  5962. return self;
  5963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5964. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  5965. //>>excludeEnd("ctx");
  5966. }; }),
  5967. $globals.String);
  5968. $core.addMethod(
  5969. $core.method({
  5970. selector: "linesDo:",
  5971. protocol: "split join",
  5972. //>>excludeStart("ide", pragmas.excludeIdeData);
  5973. args: ["aBlock"],
  5974. 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",
  5975. referencedClasses: [],
  5976. //>>excludeEnd("ide");
  5977. pragmas: [],
  5978. messageSends: ["do:", "lines"]
  5979. }, function ($methodClass){ return function (aBlock){
  5980. var self=this,$self=this;
  5981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5982. return $core.withContext(function($ctx1) {
  5983. //>>excludeEnd("ctx");
  5984. $recv($self._lines())._do_(aBlock);
  5985. return self;
  5986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5987. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  5988. //>>excludeEnd("ctx");
  5989. }; }),
  5990. $globals.String);
  5991. $core.addMethod(
  5992. $core.method({
  5993. selector: "match:",
  5994. protocol: "regular expressions",
  5995. //>>excludeStart("ide", pragmas.excludeIdeData);
  5996. args: ["aRegexp"],
  5997. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  5998. referencedClasses: [],
  5999. //>>excludeEnd("ide");
  6000. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6001. messageSends: []
  6002. }, function ($methodClass){ return function (aRegexp){
  6003. var self=this,$self=this;
  6004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6005. return $core.withContext(function($ctx1) {
  6006. //>>excludeEnd("ctx");
  6007. return self.search(aRegexp) != -1;
  6008. return self;
  6009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6010. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6011. //>>excludeEnd("ctx");
  6012. }; }),
  6013. $globals.String);
  6014. $core.addMethod(
  6015. $core.method({
  6016. selector: "matchesOf:",
  6017. protocol: "regular expressions",
  6018. //>>excludeStart("ide", pragmas.excludeIdeData);
  6019. args: ["aRegularExpression"],
  6020. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6021. referencedClasses: [],
  6022. //>>excludeEnd("ide");
  6023. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6024. messageSends: []
  6025. }, function ($methodClass){ return function (aRegularExpression){
  6026. var self=this,$self=this;
  6027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6028. return $core.withContext(function($ctx1) {
  6029. //>>excludeEnd("ctx");
  6030. return self.match(aRegularExpression);
  6031. return self;
  6032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6033. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6034. //>>excludeEnd("ctx");
  6035. }; }),
  6036. $globals.String);
  6037. $core.addMethod(
  6038. $core.method({
  6039. selector: "printNl",
  6040. protocol: "printing",
  6041. //>>excludeStart("ide", pragmas.excludeIdeData);
  6042. args: [],
  6043. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6044. referencedClasses: [],
  6045. //>>excludeEnd("ide");
  6046. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6047. messageSends: []
  6048. }, function ($methodClass){ return function (){
  6049. var self=this,$self=this;
  6050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6051. return $core.withContext(function($ctx1) {
  6052. //>>excludeEnd("ctx");
  6053. console.log(self);
  6054. return self;
  6055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6056. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6057. //>>excludeEnd("ctx");
  6058. }; }),
  6059. $globals.String);
  6060. $core.addMethod(
  6061. $core.method({
  6062. selector: "printOn:",
  6063. protocol: "printing",
  6064. //>>excludeStart("ide", pragmas.excludeIdeData);
  6065. args: ["aStream"],
  6066. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6067. referencedClasses: [],
  6068. //>>excludeEnd("ide");
  6069. pragmas: [],
  6070. messageSends: ["nextPutAll:", "replace:with:"]
  6071. }, function ($methodClass){ return function (aStream){
  6072. var self=this,$self=this;
  6073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6074. return $core.withContext(function($ctx1) {
  6075. //>>excludeEnd("ctx");
  6076. $recv(aStream)._nextPutAll_("'");
  6077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6078. $ctx1.sendIdx["nextPutAll:"]=1;
  6079. //>>excludeEnd("ctx");
  6080. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6082. $ctx1.sendIdx["nextPutAll:"]=2;
  6083. //>>excludeEnd("ctx");
  6084. $recv(aStream)._nextPutAll_("'");
  6085. return self;
  6086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6087. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6088. //>>excludeEnd("ctx");
  6089. }; }),
  6090. $globals.String);
  6091. $core.addMethod(
  6092. $core.method({
  6093. selector: "putOn:",
  6094. protocol: "streaming",
  6095. //>>excludeStart("ide", pragmas.excludeIdeData);
  6096. args: ["aStream"],
  6097. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6098. referencedClasses: [],
  6099. //>>excludeEnd("ide");
  6100. pragmas: [],
  6101. messageSends: ["nextPutString:"]
  6102. }, function ($methodClass){ return function (aStream){
  6103. var self=this,$self=this;
  6104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6105. return $core.withContext(function($ctx1) {
  6106. //>>excludeEnd("ctx");
  6107. $recv(aStream)._nextPutString_(self);
  6108. return self;
  6109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6110. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6111. //>>excludeEnd("ctx");
  6112. }; }),
  6113. $globals.String);
  6114. $core.addMethod(
  6115. $core.method({
  6116. selector: "remove:",
  6117. protocol: "adding/removing",
  6118. //>>excludeStart("ide", pragmas.excludeIdeData);
  6119. args: ["anObject"],
  6120. source: "remove: anObject\x0a\x09self errorReadOnly",
  6121. referencedClasses: [],
  6122. //>>excludeEnd("ide");
  6123. pragmas: [],
  6124. messageSends: ["errorReadOnly"]
  6125. }, function ($methodClass){ return function (anObject){
  6126. var self=this,$self=this;
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. return $core.withContext(function($ctx1) {
  6129. //>>excludeEnd("ctx");
  6130. $self._errorReadOnly();
  6131. return self;
  6132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6133. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6134. //>>excludeEnd("ctx");
  6135. }; }),
  6136. $globals.String);
  6137. $core.addMethod(
  6138. $core.method({
  6139. selector: "remove:ifAbsent:",
  6140. protocol: "adding/removing",
  6141. //>>excludeStart("ide", pragmas.excludeIdeData);
  6142. args: ["anObject", "aBlock"],
  6143. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6144. referencedClasses: [],
  6145. //>>excludeEnd("ide");
  6146. pragmas: [],
  6147. messageSends: ["errorReadOnly"]
  6148. }, function ($methodClass){ return function (anObject,aBlock){
  6149. var self=this,$self=this;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. return $core.withContext(function($ctx1) {
  6152. //>>excludeEnd("ctx");
  6153. $self._errorReadOnly();
  6154. return self;
  6155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6156. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6157. //>>excludeEnd("ctx");
  6158. }; }),
  6159. $globals.String);
  6160. $core.addMethod(
  6161. $core.method({
  6162. selector: "replace:with:",
  6163. protocol: "regular expressions",
  6164. //>>excludeStart("ide", pragmas.excludeIdeData);
  6165. args: ["aString", "anotherString"],
  6166. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6167. referencedClasses: ["RegularExpression"],
  6168. //>>excludeEnd("ide");
  6169. pragmas: [],
  6170. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6171. }, function ($methodClass){ return function (aString,anotherString){
  6172. var self=this,$self=this;
  6173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6174. return $core.withContext(function($ctx1) {
  6175. //>>excludeEnd("ctx");
  6176. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6178. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6179. //>>excludeEnd("ctx");
  6180. }; }),
  6181. $globals.String);
  6182. $core.addMethod(
  6183. $core.method({
  6184. selector: "replaceRegexp:with:",
  6185. protocol: "regular expressions",
  6186. //>>excludeStart("ide", pragmas.excludeIdeData);
  6187. args: ["aRegexp", "aString"],
  6188. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6189. referencedClasses: [],
  6190. //>>excludeEnd("ide");
  6191. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6192. messageSends: []
  6193. }, function ($methodClass){ return function (aRegexp,aString){
  6194. var self=this,$self=this;
  6195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6196. return $core.withContext(function($ctx1) {
  6197. //>>excludeEnd("ctx");
  6198. return self.replace(aRegexp, aString);
  6199. return self;
  6200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6201. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6202. //>>excludeEnd("ctx");
  6203. }; }),
  6204. $globals.String);
  6205. $core.addMethod(
  6206. $core.method({
  6207. selector: "reversed",
  6208. protocol: "converting",
  6209. //>>excludeStart("ide", pragmas.excludeIdeData);
  6210. args: [],
  6211. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6212. referencedClasses: [],
  6213. //>>excludeEnd("ide");
  6214. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6215. messageSends: []
  6216. }, function ($methodClass){ return function (){
  6217. var self=this,$self=this;
  6218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6219. return $core.withContext(function($ctx1) {
  6220. //>>excludeEnd("ctx");
  6221. return self.split("").reverse().join("");
  6222. return self;
  6223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6224. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6225. //>>excludeEnd("ctx");
  6226. }; }),
  6227. $globals.String);
  6228. $core.addMethod(
  6229. $core.method({
  6230. selector: "shallowCopy",
  6231. protocol: "copying",
  6232. //>>excludeStart("ide", pragmas.excludeIdeData);
  6233. args: [],
  6234. source: "shallowCopy\x0a\x09^ self",
  6235. referencedClasses: [],
  6236. //>>excludeEnd("ide");
  6237. pragmas: [],
  6238. messageSends: []
  6239. }, function ($methodClass){ return function (){
  6240. var self=this,$self=this;
  6241. return self;
  6242. }; }),
  6243. $globals.String);
  6244. $core.addMethod(
  6245. $core.method({
  6246. selector: "subStrings:",
  6247. protocol: "split join",
  6248. //>>excludeStart("ide", pragmas.excludeIdeData);
  6249. args: ["aString"],
  6250. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6251. referencedClasses: [],
  6252. //>>excludeEnd("ide");
  6253. pragmas: [],
  6254. messageSends: ["tokenize:"]
  6255. }, function ($methodClass){ return function (aString){
  6256. var self=this,$self=this;
  6257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6258. return $core.withContext(function($ctx1) {
  6259. //>>excludeEnd("ctx");
  6260. return $self._tokenize_(aString);
  6261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6262. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6263. //>>excludeEnd("ctx");
  6264. }; }),
  6265. $globals.String);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "symbolPrintString",
  6269. protocol: "printing",
  6270. //>>excludeStart("ide", pragmas.excludeIdeData);
  6271. args: [],
  6272. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6273. referencedClasses: ["String"],
  6274. //>>excludeEnd("ide");
  6275. pragmas: [],
  6276. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6277. }, function ($methodClass){ return function (){
  6278. var self=this,$self=this;
  6279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6280. return $core.withContext(function($ctx1) {
  6281. //>>excludeEnd("ctx");
  6282. return $recv($globals.String)._streamContents_((function(str){
  6283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6284. return $core.withContext(function($ctx2) {
  6285. //>>excludeEnd("ctx");
  6286. return $self._asSymbolPrintOn_(str);
  6287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6288. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6289. //>>excludeEnd("ctx");
  6290. }));
  6291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6292. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6293. //>>excludeEnd("ctx");
  6294. }; }),
  6295. $globals.String);
  6296. $core.addMethod(
  6297. $core.method({
  6298. selector: "tokenize:",
  6299. protocol: "split join",
  6300. //>>excludeStart("ide", pragmas.excludeIdeData);
  6301. args: ["aString"],
  6302. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6303. referencedClasses: [],
  6304. //>>excludeEnd("ide");
  6305. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6306. messageSends: []
  6307. }, function ($methodClass){ return function (aString){
  6308. var self=this,$self=this;
  6309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6310. return $core.withContext(function($ctx1) {
  6311. //>>excludeEnd("ctx");
  6312. return self.split(aString);
  6313. return self;
  6314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6315. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6316. //>>excludeEnd("ctx");
  6317. }; }),
  6318. $globals.String);
  6319. $core.addMethod(
  6320. $core.method({
  6321. selector: "trimBoth",
  6322. protocol: "regular expressions",
  6323. //>>excludeStart("ide", pragmas.excludeIdeData);
  6324. args: [],
  6325. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6326. referencedClasses: [],
  6327. //>>excludeEnd("ide");
  6328. pragmas: [],
  6329. messageSends: ["trimBoth:"]
  6330. }, function ($methodClass){ return function (){
  6331. var self=this,$self=this;
  6332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6333. return $core.withContext(function($ctx1) {
  6334. //>>excludeEnd("ctx");
  6335. return $self._trimBoth_("\x5cs");
  6336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6337. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6338. //>>excludeEnd("ctx");
  6339. }; }),
  6340. $globals.String);
  6341. $core.addMethod(
  6342. $core.method({
  6343. selector: "trimBoth:",
  6344. protocol: "regular expressions",
  6345. //>>excludeStart("ide", pragmas.excludeIdeData);
  6346. args: ["separators"],
  6347. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6348. referencedClasses: [],
  6349. //>>excludeEnd("ide");
  6350. pragmas: [],
  6351. messageSends: ["trimRight:", "trimLeft:"]
  6352. }, function ($methodClass){ return function (separators){
  6353. var self=this,$self=this;
  6354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6355. return $core.withContext(function($ctx1) {
  6356. //>>excludeEnd("ctx");
  6357. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6359. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6360. //>>excludeEnd("ctx");
  6361. }; }),
  6362. $globals.String);
  6363. $core.addMethod(
  6364. $core.method({
  6365. selector: "trimLeft",
  6366. protocol: "regular expressions",
  6367. //>>excludeStart("ide", pragmas.excludeIdeData);
  6368. args: [],
  6369. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6370. referencedClasses: [],
  6371. //>>excludeEnd("ide");
  6372. pragmas: [],
  6373. messageSends: ["trimLeft:"]
  6374. }, function ($methodClass){ return function (){
  6375. var self=this,$self=this;
  6376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6377. return $core.withContext(function($ctx1) {
  6378. //>>excludeEnd("ctx");
  6379. return $self._trimLeft_("\x5cs");
  6380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6381. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6382. //>>excludeEnd("ctx");
  6383. }; }),
  6384. $globals.String);
  6385. $core.addMethod(
  6386. $core.method({
  6387. selector: "trimLeft:",
  6388. protocol: "regular expressions",
  6389. //>>excludeStart("ide", pragmas.excludeIdeData);
  6390. args: ["separators"],
  6391. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6392. referencedClasses: ["RegularExpression"],
  6393. //>>excludeEnd("ide");
  6394. pragmas: [],
  6395. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6396. }, function ($methodClass){ return function (separators){
  6397. var self=this,$self=this;
  6398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6399. return $core.withContext(function($ctx1) {
  6400. //>>excludeEnd("ctx");
  6401. var $2,$1;
  6402. $2=$recv("^[".__comma(separators)).__comma("]+");
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. $ctx1.sendIdx[","]=1;
  6405. //>>excludeEnd("ctx");
  6406. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6407. return $self._replaceRegexp_with_($1,"");
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6410. //>>excludeEnd("ctx");
  6411. }; }),
  6412. $globals.String);
  6413. $core.addMethod(
  6414. $core.method({
  6415. selector: "trimRight",
  6416. protocol: "regular expressions",
  6417. //>>excludeStart("ide", pragmas.excludeIdeData);
  6418. args: [],
  6419. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6420. referencedClasses: [],
  6421. //>>excludeEnd("ide");
  6422. pragmas: [],
  6423. messageSends: ["trimRight:"]
  6424. }, function ($methodClass){ return function (){
  6425. var self=this,$self=this;
  6426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6427. return $core.withContext(function($ctx1) {
  6428. //>>excludeEnd("ctx");
  6429. return $self._trimRight_("\x5cs");
  6430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6431. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6432. //>>excludeEnd("ctx");
  6433. }; }),
  6434. $globals.String);
  6435. $core.addMethod(
  6436. $core.method({
  6437. selector: "trimRight:",
  6438. protocol: "regular expressions",
  6439. //>>excludeStart("ide", pragmas.excludeIdeData);
  6440. args: ["separators"],
  6441. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6442. referencedClasses: ["RegularExpression"],
  6443. //>>excludeEnd("ide");
  6444. pragmas: [],
  6445. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6446. }, function ($methodClass){ return function (separators){
  6447. var self=this,$self=this;
  6448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6449. return $core.withContext(function($ctx1) {
  6450. //>>excludeEnd("ctx");
  6451. var $2,$1;
  6452. $2=$recv("[".__comma(separators)).__comma("]+$");
  6453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6454. $ctx1.sendIdx[","]=1;
  6455. //>>excludeEnd("ctx");
  6456. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6457. return $self._replaceRegexp_with_($1,"");
  6458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6459. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6460. //>>excludeEnd("ctx");
  6461. }; }),
  6462. $globals.String);
  6463. $core.addMethod(
  6464. $core.method({
  6465. selector: "unescaped",
  6466. protocol: "converting",
  6467. //>>excludeStart("ide", pragmas.excludeIdeData);
  6468. args: [],
  6469. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6470. referencedClasses: [],
  6471. //>>excludeEnd("ide");
  6472. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6473. messageSends: []
  6474. }, function ($methodClass){ return function (){
  6475. var self=this,$self=this;
  6476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6477. return $core.withContext(function($ctx1) {
  6478. //>>excludeEnd("ctx");
  6479. return unescape(self);
  6480. return self;
  6481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6482. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6483. //>>excludeEnd("ctx");
  6484. }; }),
  6485. $globals.String);
  6486. $core.addMethod(
  6487. $core.method({
  6488. selector: "uriComponentDecoded",
  6489. protocol: "converting",
  6490. //>>excludeStart("ide", pragmas.excludeIdeData);
  6491. args: [],
  6492. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6493. referencedClasses: [],
  6494. //>>excludeEnd("ide");
  6495. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6496. messageSends: []
  6497. }, function ($methodClass){ return function (){
  6498. var self=this,$self=this;
  6499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6500. return $core.withContext(function($ctx1) {
  6501. //>>excludeEnd("ctx");
  6502. return decodeURIComponent(self);
  6503. return self;
  6504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6505. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6506. //>>excludeEnd("ctx");
  6507. }; }),
  6508. $globals.String);
  6509. $core.addMethod(
  6510. $core.method({
  6511. selector: "uriComponentEncoded",
  6512. protocol: "converting",
  6513. //>>excludeStart("ide", pragmas.excludeIdeData);
  6514. args: [],
  6515. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6516. referencedClasses: [],
  6517. //>>excludeEnd("ide");
  6518. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6519. messageSends: []
  6520. }, function ($methodClass){ return function (){
  6521. var self=this,$self=this;
  6522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6523. return $core.withContext(function($ctx1) {
  6524. //>>excludeEnd("ctx");
  6525. return encodeURIComponent(self);
  6526. return self;
  6527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6528. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6529. //>>excludeEnd("ctx");
  6530. }; }),
  6531. $globals.String);
  6532. $core.addMethod(
  6533. $core.method({
  6534. selector: "uriDecoded",
  6535. protocol: "converting",
  6536. //>>excludeStart("ide", pragmas.excludeIdeData);
  6537. args: [],
  6538. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6539. referencedClasses: [],
  6540. //>>excludeEnd("ide");
  6541. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6542. messageSends: []
  6543. }, function ($methodClass){ return function (){
  6544. var self=this,$self=this;
  6545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6546. return $core.withContext(function($ctx1) {
  6547. //>>excludeEnd("ctx");
  6548. return decodeURI(self);
  6549. return self;
  6550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6551. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6552. //>>excludeEnd("ctx");
  6553. }; }),
  6554. $globals.String);
  6555. $core.addMethod(
  6556. $core.method({
  6557. selector: "uriEncoded",
  6558. protocol: "converting",
  6559. //>>excludeStart("ide", pragmas.excludeIdeData);
  6560. args: [],
  6561. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6562. referencedClasses: [],
  6563. //>>excludeEnd("ide");
  6564. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6565. messageSends: []
  6566. }, function ($methodClass){ return function (){
  6567. var self=this,$self=this;
  6568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6569. return $core.withContext(function($ctx1) {
  6570. //>>excludeEnd("ctx");
  6571. return encodeURI(self);
  6572. return self;
  6573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6574. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6575. //>>excludeEnd("ctx");
  6576. }; }),
  6577. $globals.String);
  6578. $core.addMethod(
  6579. $core.method({
  6580. selector: "value:",
  6581. protocol: "evaluating",
  6582. //>>excludeStart("ide", pragmas.excludeIdeData);
  6583. args: ["anObject"],
  6584. source: "value: anObject \x0a\x09^ anObject perform: self",
  6585. referencedClasses: [],
  6586. //>>excludeEnd("ide");
  6587. pragmas: [],
  6588. messageSends: ["perform:"]
  6589. }, function ($methodClass){ return function (anObject){
  6590. var self=this,$self=this;
  6591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6592. return $core.withContext(function($ctx1) {
  6593. //>>excludeEnd("ctx");
  6594. return $recv(anObject)._perform_(self);
  6595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6596. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6597. //>>excludeEnd("ctx");
  6598. }; }),
  6599. $globals.String);
  6600. $core.addMethod(
  6601. $core.method({
  6602. selector: "cr",
  6603. protocol: "accessing",
  6604. //>>excludeStart("ide", pragmas.excludeIdeData);
  6605. args: [],
  6606. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6607. referencedClasses: [],
  6608. //>>excludeEnd("ide");
  6609. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6610. messageSends: []
  6611. }, function ($methodClass){ return function (){
  6612. var self=this,$self=this;
  6613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6614. return $core.withContext(function($ctx1) {
  6615. //>>excludeEnd("ctx");
  6616. return "\r";
  6617. return self;
  6618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6619. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6620. //>>excludeEnd("ctx");
  6621. }; }),
  6622. $globals.String.a$cls);
  6623. $core.addMethod(
  6624. $core.method({
  6625. selector: "crlf",
  6626. protocol: "accessing",
  6627. //>>excludeStart("ide", pragmas.excludeIdeData);
  6628. args: [],
  6629. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6630. referencedClasses: [],
  6631. //>>excludeEnd("ide");
  6632. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6633. messageSends: []
  6634. }, function ($methodClass){ return function (){
  6635. var self=this,$self=this;
  6636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6637. return $core.withContext(function($ctx1) {
  6638. //>>excludeEnd("ctx");
  6639. return "\r\n";
  6640. return self;
  6641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6642. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6643. //>>excludeEnd("ctx");
  6644. }; }),
  6645. $globals.String.a$cls);
  6646. $core.addMethod(
  6647. $core.method({
  6648. selector: "esc",
  6649. protocol: "accessing",
  6650. //>>excludeStart("ide", pragmas.excludeIdeData);
  6651. args: [],
  6652. source: "esc\x0a\x09^ self fromCharCode: 27",
  6653. referencedClasses: [],
  6654. //>>excludeEnd("ide");
  6655. pragmas: [],
  6656. messageSends: ["fromCharCode:"]
  6657. }, function ($methodClass){ return function (){
  6658. var self=this,$self=this;
  6659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6660. return $core.withContext(function($ctx1) {
  6661. //>>excludeEnd("ctx");
  6662. return $self._fromCharCode_((27));
  6663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6664. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6665. //>>excludeEnd("ctx");
  6666. }; }),
  6667. $globals.String.a$cls);
  6668. $core.addMethod(
  6669. $core.method({
  6670. selector: "fromCharCode:",
  6671. protocol: "instance creation",
  6672. //>>excludeStart("ide", pragmas.excludeIdeData);
  6673. args: ["anInteger"],
  6674. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6675. referencedClasses: [],
  6676. //>>excludeEnd("ide");
  6677. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6678. messageSends: []
  6679. }, function ($methodClass){ return function (anInteger){
  6680. var self=this,$self=this;
  6681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6682. return $core.withContext(function($ctx1) {
  6683. //>>excludeEnd("ctx");
  6684. return String.fromCharCode(anInteger);
  6685. return self;
  6686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6687. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6688. //>>excludeEnd("ctx");
  6689. }; }),
  6690. $globals.String.a$cls);
  6691. $core.addMethod(
  6692. $core.method({
  6693. selector: "fromString:",
  6694. protocol: "instance creation",
  6695. //>>excludeStart("ide", pragmas.excludeIdeData);
  6696. args: ["aString"],
  6697. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6698. referencedClasses: [],
  6699. //>>excludeEnd("ide");
  6700. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6701. messageSends: []
  6702. }, function ($methodClass){ return function (aString){
  6703. var self=this,$self=this;
  6704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6705. return $core.withContext(function($ctx1) {
  6706. //>>excludeEnd("ctx");
  6707. return String(aString);
  6708. return self;
  6709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6710. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6711. //>>excludeEnd("ctx");
  6712. }; }),
  6713. $globals.String.a$cls);
  6714. $core.addMethod(
  6715. $core.method({
  6716. selector: "lf",
  6717. protocol: "accessing",
  6718. //>>excludeStart("ide", pragmas.excludeIdeData);
  6719. args: [],
  6720. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6721. referencedClasses: [],
  6722. //>>excludeEnd("ide");
  6723. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6724. messageSends: []
  6725. }, function ($methodClass){ return function (){
  6726. var self=this,$self=this;
  6727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6728. return $core.withContext(function($ctx1) {
  6729. //>>excludeEnd("ctx");
  6730. return "\n";
  6731. return self;
  6732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6733. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6734. //>>excludeEnd("ctx");
  6735. }; }),
  6736. $globals.String.a$cls);
  6737. $core.addMethod(
  6738. $core.method({
  6739. selector: "random",
  6740. protocol: "random",
  6741. //>>excludeStart("ide", pragmas.excludeIdeData);
  6742. args: [],
  6743. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return ((10+22*Math.random())/32).toString(32).slice(2);'>",
  6744. referencedClasses: [],
  6745. //>>excludeEnd("ide");
  6746. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6747. messageSends: []
  6748. }, function ($methodClass){ return function (){
  6749. var self=this,$self=this;
  6750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6751. return $core.withContext(function($ctx1) {
  6752. //>>excludeEnd("ctx");
  6753. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6754. return self;
  6755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6756. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6757. //>>excludeEnd("ctx");
  6758. }; }),
  6759. $globals.String.a$cls);
  6760. $core.addMethod(
  6761. $core.method({
  6762. selector: "randomNotIn:",
  6763. protocol: "random",
  6764. //>>excludeStart("ide", pragmas.excludeIdeData);
  6765. args: ["aString"],
  6766. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6767. referencedClasses: [],
  6768. //>>excludeEnd("ide");
  6769. pragmas: [],
  6770. messageSends: ["whileTrue", "random", "includesSubString:"]
  6771. }, function ($methodClass){ return function (aString){
  6772. var self=this,$self=this;
  6773. var result;
  6774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6775. return $core.withContext(function($ctx1) {
  6776. //>>excludeEnd("ctx");
  6777. $recv((function(){
  6778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6779. return $core.withContext(function($ctx2) {
  6780. //>>excludeEnd("ctx");
  6781. result=$self._random();
  6782. return $recv(aString)._includesSubString_(result);
  6783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6785. //>>excludeEnd("ctx");
  6786. }))._whileTrue();
  6787. return result;
  6788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6789. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6790. //>>excludeEnd("ctx");
  6791. }; }),
  6792. $globals.String.a$cls);
  6793. $core.addMethod(
  6794. $core.method({
  6795. selector: "space",
  6796. protocol: "accessing",
  6797. //>>excludeStart("ide", pragmas.excludeIdeData);
  6798. args: [],
  6799. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6800. referencedClasses: [],
  6801. //>>excludeEnd("ide");
  6802. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6803. messageSends: []
  6804. }, function ($methodClass){ return function (){
  6805. var self=this,$self=this;
  6806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6807. return $core.withContext(function($ctx1) {
  6808. //>>excludeEnd("ctx");
  6809. return " ";
  6810. return self;
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6813. //>>excludeEnd("ctx");
  6814. }; }),
  6815. $globals.String.a$cls);
  6816. $core.addMethod(
  6817. $core.method({
  6818. selector: "streamClass",
  6819. protocol: "accessing",
  6820. //>>excludeStart("ide", pragmas.excludeIdeData);
  6821. args: [],
  6822. source: "streamClass\x0a\x09\x09^ StringStream",
  6823. referencedClasses: ["StringStream"],
  6824. //>>excludeEnd("ide");
  6825. pragmas: [],
  6826. messageSends: []
  6827. }, function ($methodClass){ return function (){
  6828. var self=this,$self=this;
  6829. return $globals.StringStream;
  6830. }; }),
  6831. $globals.String.a$cls);
  6832. $core.addMethod(
  6833. $core.method({
  6834. selector: "tab",
  6835. protocol: "accessing",
  6836. //>>excludeStart("ide", pragmas.excludeIdeData);
  6837. args: [],
  6838. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6839. referencedClasses: [],
  6840. //>>excludeEnd("ide");
  6841. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6842. messageSends: []
  6843. }, function ($methodClass){ return function (){
  6844. var self=this,$self=this;
  6845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6846. return $core.withContext(function($ctx1) {
  6847. //>>excludeEnd("ctx");
  6848. return "\t";
  6849. return self;
  6850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6851. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  6852. //>>excludeEnd("ctx");
  6853. }; }),
  6854. $globals.String.a$cls);
  6855. $core.addMethod(
  6856. $core.method({
  6857. selector: "value:",
  6858. protocol: "instance creation",
  6859. //>>excludeStart("ide", pragmas.excludeIdeData);
  6860. args: ["aUTFCharCode"],
  6861. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6862. referencedClasses: [],
  6863. //>>excludeEnd("ide");
  6864. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  6865. messageSends: []
  6866. }, function ($methodClass){ return function (aUTFCharCode){
  6867. var self=this,$self=this;
  6868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6869. return $core.withContext(function($ctx1) {
  6870. //>>excludeEnd("ctx");
  6871. return String.fromCharCode(aUTFCharCode);;
  6872. return self;
  6873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6874. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  6875. //>>excludeEnd("ctx");
  6876. }; }),
  6877. $globals.String.a$cls);
  6878. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6879. //>>excludeStart("ide", pragmas.excludeIdeData);
  6880. $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`.";
  6881. //>>excludeEnd("ide");
  6882. $core.addMethod(
  6883. $core.method({
  6884. selector: "=",
  6885. protocol: "comparing",
  6886. //>>excludeStart("ide", pragmas.excludeIdeData);
  6887. args: ["aCollection"],
  6888. 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",
  6889. referencedClasses: [],
  6890. //>>excludeEnd("ide");
  6891. pragmas: [],
  6892. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  6893. }, function ($methodClass){ return function (aCollection){
  6894. var self=this,$self=this;
  6895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6896. return $core.withContext(function($ctx1) {
  6897. //>>excludeEnd("ctx");
  6898. var $2,$1,$4,$3,$5;
  6899. var $early={};
  6900. try {
  6901. $2=$self._class();
  6902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6903. $ctx1.sendIdx["class"]=1;
  6904. //>>excludeEnd("ctx");
  6905. $1=$recv($2).__eq($recv(aCollection)._class());
  6906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6907. $ctx1.sendIdx["="]=1;
  6908. //>>excludeEnd("ctx");
  6909. if(!$core.assert($1)){
  6910. return false;
  6911. }
  6912. $4=$self._size();
  6913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6914. $ctx1.sendIdx["size"]=1;
  6915. //>>excludeEnd("ctx");
  6916. $3=$recv($4).__eq($recv(aCollection)._size());
  6917. if(!$core.assert($3)){
  6918. return false;
  6919. }
  6920. $self._do_((function(each){
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. return $core.withContext(function($ctx2) {
  6923. //>>excludeEnd("ctx");
  6924. $5=$recv(aCollection)._includes_(each);
  6925. if(!$core.assert($5)){
  6926. throw $early=[false];
  6927. }
  6928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6929. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  6930. //>>excludeEnd("ctx");
  6931. }));
  6932. return true;
  6933. }
  6934. catch(e) {if(e===$early)return e[0]; throw e}
  6935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6936. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  6937. //>>excludeEnd("ctx");
  6938. }; }),
  6939. $globals.Set);
  6940. $core.addMethod(
  6941. $core.method({
  6942. selector: "add:",
  6943. protocol: "adding/removing",
  6944. //>>excludeStart("ide", pragmas.excludeIdeData);
  6945. args: ["anObject"],
  6946. 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 ]",
  6947. referencedClasses: [],
  6948. //>>excludeEnd("ide");
  6949. pragmas: [],
  6950. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  6951. }, function ($methodClass){ return function (anObject){
  6952. var self=this,$self=this;
  6953. var bucket;
  6954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6955. return $core.withContext(function($ctx1) {
  6956. //>>excludeEnd("ctx");
  6957. var $1,$receiver;
  6958. bucket=$self._bucketsOfElement_(anObject);
  6959. $1=$recv(bucket)._second();
  6960. if(($receiver = $1) == null || $receiver.a$nil){
  6961. var object,slowBucket;
  6962. object=$recv(bucket)._first();
  6963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6964. $ctx1.sendIdx["first"]=1;
  6965. //>>excludeEnd("ctx");
  6966. slowBucket=$recv(bucket)._third();
  6967. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  6968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6969. return $core.withContext(function($ctx2) {
  6970. //>>excludeEnd("ctx");
  6971. $recv(slowBucket)._add_(object);
  6972. $self.size=$recv($self.size).__plus((1));
  6973. return $self.size;
  6974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6976. //>>excludeEnd("ctx");
  6977. }));
  6978. return object;
  6979. } else {
  6980. var primitiveBucket;
  6981. primitiveBucket=$receiver;
  6982. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  6983. }
  6984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6985. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  6986. //>>excludeEnd("ctx");
  6987. }; }),
  6988. $globals.Set);
  6989. $core.addMethod(
  6990. $core.method({
  6991. selector: "add:in:",
  6992. protocol: "private",
  6993. //>>excludeStart("ide", pragmas.excludeIdeData);
  6994. args: ["anObject", "anotherObject"],
  6995. 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'>",
  6996. referencedClasses: [],
  6997. //>>excludeEnd("ide");
  6998. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) { return anObject; }\x0a\x09\x09$self.size++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09"]]],
  6999. messageSends: []
  7000. }, function ($methodClass){ return function (anObject,anotherObject){
  7001. var self=this,$self=this;
  7002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7003. return $core.withContext(function($ctx1) {
  7004. //>>excludeEnd("ctx");
  7005. if (anObject in anotherObject.store) { return anObject; }
  7006. $self.size++;
  7007. anotherObject.store[anObject] = true;
  7008. return anObject;
  7009. ;
  7010. return self;
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7013. //>>excludeEnd("ctx");
  7014. }; }),
  7015. $globals.Set);
  7016. $core.addMethod(
  7017. $core.method({
  7018. selector: "bucketsOfElement:",
  7019. protocol: "private",
  7020. //>>excludeStart("ide", pragmas.excludeIdeData);
  7021. args: ["anObject"],
  7022. 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'>",
  7023. referencedClasses: [],
  7024. //>>excludeEnd("ide");
  7025. pragmas: [["inlineJS:", ["\x0a\x09\x09// include nil to well-known objects under \x22boolean\x22 fastBucket\x0a\x09\x09if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];\x0a\x09\x09\x0a\x09\x09var prim = anObject.valueOf();\x0a\x09\x09if (typeof prim === \x22object\x22 || typeof prim === \x22function\x22 || !$self.fastBuckets[typeof prim]) {\x0a\x09\x09\x09var bucket = null;\x0a\x09\x09\x09$self.slowBucketStores.some(function (store) {\x0a\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09});\x0a\x09\x09\x09return [ anObject, null, bucket || $self.defaultBucket ];\x0a\x09\x09}\x0a\x09\x09return [ prim, $self.fastBuckets[typeof prim] ];\x0a\x09"]]],
  7026. messageSends: []
  7027. }, function ($methodClass){ return function (anObject){
  7028. var self=this,$self=this;
  7029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7030. return $core.withContext(function($ctx1) {
  7031. //>>excludeEnd("ctx");
  7032. // include nil to well-known objects under "boolean" fastBucket
  7033. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7034. var prim = anObject.valueOf();
  7035. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7036. var bucket = null;
  7037. $self.slowBucketStores.some(function (store) {
  7038. return bucket = store._bucketOfElement_(anObject);
  7039. });
  7040. return [ anObject, null, bucket || $self.defaultBucket ];
  7041. }
  7042. return [ prim, $self.fastBuckets[typeof prim] ];
  7043. ;
  7044. return self;
  7045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7046. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7047. //>>excludeEnd("ctx");
  7048. }; }),
  7049. $globals.Set);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "classNameOf:",
  7053. protocol: "private",
  7054. //>>excludeStart("ide", pragmas.excludeIdeData);
  7055. args: ["anObject"],
  7056. 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'>",
  7057. referencedClasses: [],
  7058. //>>excludeEnd("ide");
  7059. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7060. messageSends: []
  7061. }, function ($methodClass){ return function (anObject){
  7062. var self=this,$self=this;
  7063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7064. return $core.withContext(function($ctx1) {
  7065. //>>excludeEnd("ctx");
  7066. return anObject.a$cls != null && anObject.a$cls.name;
  7067. return self;
  7068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7069. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7070. //>>excludeEnd("ctx");
  7071. }; }),
  7072. $globals.Set);
  7073. $core.addMethod(
  7074. $core.method({
  7075. selector: "collect:",
  7076. protocol: "enumerating",
  7077. //>>excludeStart("ide", pragmas.excludeIdeData);
  7078. args: ["aBlock"],
  7079. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7080. referencedClasses: [],
  7081. //>>excludeEnd("ide");
  7082. pragmas: [],
  7083. messageSends: ["new", "class", "do:", "add:", "value:"]
  7084. }, function ($methodClass){ return function (aBlock){
  7085. var self=this,$self=this;
  7086. var collection;
  7087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7088. return $core.withContext(function($ctx1) {
  7089. //>>excludeEnd("ctx");
  7090. collection=$recv($self._class())._new();
  7091. $self._do_((function(each){
  7092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7093. return $core.withContext(function($ctx2) {
  7094. //>>excludeEnd("ctx");
  7095. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7097. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7098. //>>excludeEnd("ctx");
  7099. }));
  7100. return collection;
  7101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7102. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7103. //>>excludeEnd("ctx");
  7104. }; }),
  7105. $globals.Set);
  7106. $core.addMethod(
  7107. $core.method({
  7108. selector: "do:",
  7109. protocol: "enumerating",
  7110. //>>excludeStart("ide", pragmas.excludeIdeData);
  7111. args: ["aBlock"],
  7112. 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'>",
  7113. referencedClasses: [],
  7114. //>>excludeEnd("ide");
  7115. pragmas: [["inlineJS:", ["\x0a\x09\x09var el, keys, i;\x0a\x09\x09el = $self.fastBuckets;\x0a\x09\x09keys = Object.keys(el);\x0a\x09\x09for (i = 0; i < keys.length; ++i) {\x0a\x09\x09\x09var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);\x0a\x09\x09\x09if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }\x0a\x09\x09\x09else { store._do_(aBlock); }\x0a\x09\x09}\x0a\x09\x09el = $self.slowBucketStores;\x0a\x09\x09for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }\x0a\x09\x09$self.defaultBucket._do_(aBlock);\x0a\x09"]]],
  7116. messageSends: []
  7117. }, function ($methodClass){ return function (aBlock){
  7118. var self=this,$self=this;
  7119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7120. return $core.withContext(function($ctx1) {
  7121. //>>excludeEnd("ctx");
  7122. var el, keys, i;
  7123. el = $self.fastBuckets;
  7124. keys = Object.keys(el);
  7125. for (i = 0; i < keys.length; ++i) {
  7126. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7127. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7128. else { store._do_(aBlock); }
  7129. }
  7130. el = $self.slowBucketStores;
  7131. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7132. $self.defaultBucket._do_(aBlock);
  7133. ;
  7134. return self;
  7135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7136. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7137. //>>excludeEnd("ctx");
  7138. }; }),
  7139. $globals.Set);
  7140. $core.addMethod(
  7141. $core.method({
  7142. selector: "includes:",
  7143. protocol: "testing",
  7144. //>>excludeStart("ide", pragmas.excludeIdeData);
  7145. args: ["anObject"],
  7146. 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 ]",
  7147. referencedClasses: [],
  7148. //>>excludeEnd("ide");
  7149. pragmas: [],
  7150. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7151. }, function ($methodClass){ return function (anObject){
  7152. var self=this,$self=this;
  7153. var bucket;
  7154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7155. return $core.withContext(function($ctx1) {
  7156. //>>excludeEnd("ctx");
  7157. var $1,$2,$3,$receiver;
  7158. bucket=$self._bucketsOfElement_(anObject);
  7159. $1=$recv(bucket)._second();
  7160. if(($receiver = $1) == null || $receiver.a$nil){
  7161. $2=$recv(bucket)._third();
  7162. $3=$recv(bucket)._first();
  7163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7164. $ctx1.sendIdx["first"]=1;
  7165. //>>excludeEnd("ctx");
  7166. return $recv($2)._includes_($3);
  7167. } else {
  7168. var primitiveBucket;
  7169. primitiveBucket=$receiver;
  7170. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7171. }
  7172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7173. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7174. //>>excludeEnd("ctx");
  7175. }; }),
  7176. $globals.Set);
  7177. $core.addMethod(
  7178. $core.method({
  7179. selector: "includes:in:",
  7180. protocol: "private",
  7181. //>>excludeStart("ide", pragmas.excludeIdeData);
  7182. args: ["anObject", "anotherObject"],
  7183. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7184. referencedClasses: [],
  7185. //>>excludeEnd("ide");
  7186. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7187. messageSends: []
  7188. }, function ($methodClass){ return function (anObject,anotherObject){
  7189. var self=this,$self=this;
  7190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7191. return $core.withContext(function($ctx1) {
  7192. //>>excludeEnd("ctx");
  7193. return anObject in anotherObject.store;
  7194. return self;
  7195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7196. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7197. //>>excludeEnd("ctx");
  7198. }; }),
  7199. $globals.Set);
  7200. $core.addMethod(
  7201. $core.method({
  7202. selector: "initialize",
  7203. protocol: "initialization",
  7204. //>>excludeStart("ide", pragmas.excludeIdeData);
  7205. args: [],
  7206. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7207. referencedClasses: [],
  7208. //>>excludeEnd("ide");
  7209. pragmas: [],
  7210. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7211. }, function ($methodClass){ return function (){
  7212. var self=this,$self=this;
  7213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7214. return $core.withContext(function($ctx1) {
  7215. //>>excludeEnd("ctx");
  7216. (
  7217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7218. $ctx1.supercall = true,
  7219. //>>excludeEnd("ctx");
  7220. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. $ctx1.supercall = false;
  7223. //>>excludeEnd("ctx");;
  7224. $self.defaultBucket=[];
  7225. $self._initializeSlowBucketStores();
  7226. $self._removeAll();
  7227. return self;
  7228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7229. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7230. //>>excludeEnd("ctx");
  7231. }; }),
  7232. $globals.Set);
  7233. $core.addMethod(
  7234. $core.method({
  7235. selector: "initializeSlowBucketStores",
  7236. protocol: "initialization",
  7237. //>>excludeStart("ide", pragmas.excludeIdeData);
  7238. args: [],
  7239. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7240. referencedClasses: ["ArrayBucketStore"],
  7241. //>>excludeEnd("ide");
  7242. pragmas: [],
  7243. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7244. }, function ($methodClass){ return function (){
  7245. var self=this,$self=this;
  7246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7247. return $core.withContext(function($ctx1) {
  7248. //>>excludeEnd("ctx");
  7249. var $1;
  7250. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. return $core.withContext(function($ctx2) {
  7253. //>>excludeEnd("ctx");
  7254. return $self._classNameOf_(x);
  7255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7256. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7257. //>>excludeEnd("ctx");
  7258. }));
  7259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7260. $ctx1.sendIdx["hashBlock:"]=1;
  7261. //>>excludeEnd("ctx");
  7262. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7264. return $core.withContext(function($ctx2) {
  7265. //>>excludeEnd("ctx");
  7266. return $self._jsConstructorNameOf_(x);
  7267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7268. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7269. //>>excludeEnd("ctx");
  7270. }))];
  7271. return self;
  7272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7273. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7274. //>>excludeEnd("ctx");
  7275. }; }),
  7276. $globals.Set);
  7277. $core.addMethod(
  7278. $core.method({
  7279. selector: "jsConstructorNameOf:",
  7280. protocol: "private",
  7281. //>>excludeStart("ide", pragmas.excludeIdeData);
  7282. args: ["anObject"],
  7283. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7284. referencedClasses: [],
  7285. //>>excludeEnd("ide");
  7286. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7287. messageSends: []
  7288. }, function ($methodClass){ return function (anObject){
  7289. var self=this,$self=this;
  7290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7291. return $core.withContext(function($ctx1) {
  7292. //>>excludeEnd("ctx");
  7293. return anObject.constructor && anObject.constructor.name;
  7294. return self;
  7295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7296. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7297. //>>excludeEnd("ctx");
  7298. }; }),
  7299. $globals.Set);
  7300. $core.addMethod(
  7301. $core.method({
  7302. selector: "printOn:",
  7303. protocol: "printing",
  7304. //>>excludeStart("ide", pragmas.excludeIdeData);
  7305. args: ["aStream"],
  7306. 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: ')'",
  7307. referencedClasses: [],
  7308. //>>excludeEnd("ide");
  7309. pragmas: [],
  7310. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7311. }, function ($methodClass){ return function (aStream){
  7312. var self=this,$self=this;
  7313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7314. return $core.withContext(function($ctx1) {
  7315. //>>excludeEnd("ctx");
  7316. (
  7317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7318. $ctx1.supercall = true,
  7319. //>>excludeEnd("ctx");
  7320. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  7321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7322. $ctx1.supercall = false;
  7323. //>>excludeEnd("ctx");;
  7324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7325. $ctx1.sendIdx["printOn:"]=1;
  7326. //>>excludeEnd("ctx");
  7327. $recv(aStream)._nextPutAll_(" (");
  7328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7329. $ctx1.sendIdx["nextPutAll:"]=1;
  7330. //>>excludeEnd("ctx");
  7331. $self._do_separatedBy_((function(each){
  7332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7333. return $core.withContext(function($ctx2) {
  7334. //>>excludeEnd("ctx");
  7335. return $recv(each)._printOn_(aStream);
  7336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7337. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7338. //>>excludeEnd("ctx");
  7339. }),(function(){
  7340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7341. return $core.withContext(function($ctx2) {
  7342. //>>excludeEnd("ctx");
  7343. return $recv(aStream)._nextPutAll_(" ");
  7344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7345. $ctx2.sendIdx["nextPutAll:"]=2;
  7346. //>>excludeEnd("ctx");
  7347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7349. //>>excludeEnd("ctx");
  7350. }));
  7351. $recv(aStream)._nextPutAll_(")");
  7352. return self;
  7353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7354. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7355. //>>excludeEnd("ctx");
  7356. }; }),
  7357. $globals.Set);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "remove:ifAbsent:",
  7361. protocol: "adding/removing",
  7362. //>>excludeStart("ide", pragmas.excludeIdeData);
  7363. args: ["anObject", "aBlock"],
  7364. 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 ]",
  7365. referencedClasses: [],
  7366. //>>excludeEnd("ide");
  7367. pragmas: [],
  7368. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:ifAbsent:"]
  7369. }, function ($methodClass){ return function (anObject,aBlock){
  7370. var self=this,$self=this;
  7371. var bucket;
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. return $core.withContext(function($ctx1) {
  7374. //>>excludeEnd("ctx");
  7375. var $1,$2,$3,$receiver;
  7376. var $early={};
  7377. try {
  7378. bucket=$self._bucketsOfElement_(anObject);
  7379. $1=$recv(bucket)._second();
  7380. if(($receiver = $1) == null || $receiver.a$nil){
  7381. $2=$recv(bucket)._third();
  7382. $3=$recv(bucket)._first();
  7383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7384. $ctx1.sendIdx["first"]=1;
  7385. //>>excludeEnd("ctx");
  7386. $recv($2)._remove_ifAbsent_($3,(function(){
  7387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7388. return $core.withContext(function($ctx2) {
  7389. //>>excludeEnd("ctx");
  7390. throw $early=[$recv(aBlock)._value()];
  7391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7392. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7393. //>>excludeEnd("ctx");
  7394. }));
  7395. $self.size=$recv($self.size).__minus((1));
  7396. return $self.size;
  7397. } else {
  7398. var primitiveBucket;
  7399. primitiveBucket=$receiver;
  7400. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7401. }
  7402. }
  7403. catch(e) {if(e===$early)return e[0]; throw e}
  7404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7405. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7406. //>>excludeEnd("ctx");
  7407. }; }),
  7408. $globals.Set);
  7409. $core.addMethod(
  7410. $core.method({
  7411. selector: "remove:in:ifAbsent:",
  7412. protocol: "private",
  7413. //>>excludeStart("ide", pragmas.excludeIdeData);
  7414. args: ["anObject", "anotherObject", "aBlock"],
  7415. 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}'>",
  7416. referencedClasses: [],
  7417. //>>excludeEnd("ide");
  7418. pragmas: [["inlineJS:", ["\x0a\x09\x09if (anObject in anotherObject.store) {\x0a\x09\x09\x09delete anotherObject.store[anObject];\x0a\x09\x09\x09$self.size--;\x0a\x09\x09\x09return anObject;\x0a\x09\x09} else {\x0a\x09\x09\x09return aBlock._value();\x0a\x09\x09}"]]],
  7419. messageSends: []
  7420. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7421. var self=this,$self=this;
  7422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7423. return $core.withContext(function($ctx1) {
  7424. //>>excludeEnd("ctx");
  7425. if (anObject in anotherObject.store) {
  7426. delete anotherObject.store[anObject];
  7427. $self.size--;
  7428. return anObject;
  7429. } else {
  7430. return aBlock._value();
  7431. };
  7432. return self;
  7433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7434. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7435. //>>excludeEnd("ctx");
  7436. }; }),
  7437. $globals.Set);
  7438. $core.addMethod(
  7439. $core.method({
  7440. selector: "removeAll",
  7441. protocol: "adding/removing",
  7442. //>>excludeStart("ide", pragmas.excludeIdeData);
  7443. args: [],
  7444. 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'>",
  7445. referencedClasses: [],
  7446. //>>excludeEnd("ide");
  7447. pragmas: [["inlineJS:", ["\x0a\x09\x09$self.fastBuckets = {\x0a\x09\x09\x09\x22boolean\x22: { store: Object.create(null), fn: function (x) { return {\x22true\x22: true, \x22false\x22: false, \x22null\x22: null}[x]; } },\x0a\x09\x09\x09\x22number\x22: { store: Object.create(null), fn: Number },\x0a\x09\x09\x09\x22string\x22: { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09$self.slowBucketStores.forEach(function (x) { x._removeAll(); });\x0a\x09\x09$self.defaultBucket._removeAll();\x0a\x09\x09$self.size = 0;\x0a\x09"]]],
  7448. messageSends: []
  7449. }, function ($methodClass){ return function (){
  7450. var self=this,$self=this;
  7451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7452. return $core.withContext(function($ctx1) {
  7453. //>>excludeEnd("ctx");
  7454. $self.fastBuckets = {
  7455. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7456. "number": { store: Object.create(null), fn: Number },
  7457. "string": { store: Object.create(null) }
  7458. };
  7459. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7460. $self.defaultBucket._removeAll();
  7461. $self.size = 0;
  7462. ;
  7463. return self;
  7464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7465. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7466. //>>excludeEnd("ctx");
  7467. }; }),
  7468. $globals.Set);
  7469. $core.addMethod(
  7470. $core.method({
  7471. selector: "select:",
  7472. protocol: "enumerating",
  7473. //>>excludeStart("ide", pragmas.excludeIdeData);
  7474. args: ["aBlock"],
  7475. 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",
  7476. referencedClasses: [],
  7477. //>>excludeEnd("ide");
  7478. pragmas: [],
  7479. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7480. }, function ($methodClass){ return function (aBlock){
  7481. var self=this,$self=this;
  7482. var collection;
  7483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7484. return $core.withContext(function($ctx1) {
  7485. //>>excludeEnd("ctx");
  7486. var $1;
  7487. collection=$recv($self._class())._new();
  7488. $self._do_((function(each){
  7489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7490. return $core.withContext(function($ctx2) {
  7491. //>>excludeEnd("ctx");
  7492. $1=$recv(aBlock)._value_(each);
  7493. if($core.assert($1)){
  7494. return $recv(collection)._add_(each);
  7495. }
  7496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7498. //>>excludeEnd("ctx");
  7499. }));
  7500. return collection;
  7501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7502. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7503. //>>excludeEnd("ctx");
  7504. }; }),
  7505. $globals.Set);
  7506. $core.addMethod(
  7507. $core.method({
  7508. selector: "select:thenCollect:",
  7509. protocol: "enumerating",
  7510. //>>excludeStart("ide", pragmas.excludeIdeData);
  7511. args: ["selectBlock", "collectBlock"],
  7512. 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",
  7513. referencedClasses: [],
  7514. //>>excludeEnd("ide");
  7515. pragmas: [],
  7516. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7517. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7518. var self=this,$self=this;
  7519. var collection;
  7520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7521. return $core.withContext(function($ctx1) {
  7522. //>>excludeEnd("ctx");
  7523. var $1;
  7524. collection=$recv($self._class())._new();
  7525. $self._do_((function(each){
  7526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7527. return $core.withContext(function($ctx2) {
  7528. //>>excludeEnd("ctx");
  7529. $1=$recv(selectBlock)._value_(each);
  7530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7531. $ctx2.sendIdx["value:"]=1;
  7532. //>>excludeEnd("ctx");
  7533. if($core.assert($1)){
  7534. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7535. }
  7536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7537. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7538. //>>excludeEnd("ctx");
  7539. }));
  7540. return collection;
  7541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7542. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7543. //>>excludeEnd("ctx");
  7544. }; }),
  7545. $globals.Set);
  7546. $core.addMethod(
  7547. $core.method({
  7548. selector: "size",
  7549. protocol: "accessing",
  7550. //>>excludeStart("ide", pragmas.excludeIdeData);
  7551. args: [],
  7552. source: "size\x0a\x09^ size",
  7553. referencedClasses: [],
  7554. //>>excludeEnd("ide");
  7555. pragmas: [],
  7556. messageSends: []
  7557. }, function ($methodClass){ return function (){
  7558. var self=this,$self=this;
  7559. return $self.size;
  7560. }; }),
  7561. $globals.Set);
  7562. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7563. //>>excludeStart("ide", pragmas.excludeIdeData);
  7564. $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.";
  7565. //>>excludeEnd("ide");
  7566. $core.addMethod(
  7567. $core.method({
  7568. selector: "<<",
  7569. protocol: "writing",
  7570. //>>excludeStart("ide", pragmas.excludeIdeData);
  7571. args: ["anObject"],
  7572. source: "<< anObject\x0a\x09self write: anObject",
  7573. referencedClasses: [],
  7574. //>>excludeEnd("ide");
  7575. pragmas: [],
  7576. messageSends: ["write:"]
  7577. }, function ($methodClass){ return function (anObject){
  7578. var self=this,$self=this;
  7579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7580. return $core.withContext(function($ctx1) {
  7581. //>>excludeEnd("ctx");
  7582. $self._write_(anObject);
  7583. return self;
  7584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7585. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7586. //>>excludeEnd("ctx");
  7587. }; }),
  7588. $globals.ProtoStream);
  7589. $core.addMethod(
  7590. $core.method({
  7591. selector: "atEnd",
  7592. protocol: "testing",
  7593. //>>excludeStart("ide", pragmas.excludeIdeData);
  7594. args: [],
  7595. source: "atEnd\x0a\x09self subclassResponsibility",
  7596. referencedClasses: [],
  7597. //>>excludeEnd("ide");
  7598. pragmas: [],
  7599. messageSends: ["subclassResponsibility"]
  7600. }, function ($methodClass){ return function (){
  7601. var self=this,$self=this;
  7602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7603. return $core.withContext(function($ctx1) {
  7604. //>>excludeEnd("ctx");
  7605. $self._subclassResponsibility();
  7606. return self;
  7607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7608. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7609. //>>excludeEnd("ctx");
  7610. }; }),
  7611. $globals.ProtoStream);
  7612. $core.addMethod(
  7613. $core.method({
  7614. selector: "atStart",
  7615. protocol: "testing",
  7616. //>>excludeStart("ide", pragmas.excludeIdeData);
  7617. args: [],
  7618. source: "atStart\x0a\x09self subclassResponsibility",
  7619. referencedClasses: [],
  7620. //>>excludeEnd("ide");
  7621. pragmas: [],
  7622. messageSends: ["subclassResponsibility"]
  7623. }, function ($methodClass){ return function (){
  7624. var self=this,$self=this;
  7625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7626. return $core.withContext(function($ctx1) {
  7627. //>>excludeEnd("ctx");
  7628. $self._subclassResponsibility();
  7629. return self;
  7630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7631. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7632. //>>excludeEnd("ctx");
  7633. }; }),
  7634. $globals.ProtoStream);
  7635. $core.addMethod(
  7636. $core.method({
  7637. selector: "contents",
  7638. protocol: "accessing",
  7639. //>>excludeStart("ide", pragmas.excludeIdeData);
  7640. args: [],
  7641. source: "contents\x0a\x09self subclassResponsibility",
  7642. referencedClasses: [],
  7643. //>>excludeEnd("ide");
  7644. pragmas: [],
  7645. messageSends: ["subclassResponsibility"]
  7646. }, function ($methodClass){ return function (){
  7647. var self=this,$self=this;
  7648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7649. return $core.withContext(function($ctx1) {
  7650. //>>excludeEnd("ctx");
  7651. $self._subclassResponsibility();
  7652. return self;
  7653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7654. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7655. //>>excludeEnd("ctx");
  7656. }; }),
  7657. $globals.ProtoStream);
  7658. $core.addMethod(
  7659. $core.method({
  7660. selector: "do:",
  7661. protocol: "enumerating",
  7662. //>>excludeStart("ide", pragmas.excludeIdeData);
  7663. args: ["aBlock"],
  7664. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7665. referencedClasses: [],
  7666. //>>excludeEnd("ide");
  7667. pragmas: [],
  7668. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7669. }, function ($methodClass){ return function (aBlock){
  7670. var self=this,$self=this;
  7671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7672. return $core.withContext(function($ctx1) {
  7673. //>>excludeEnd("ctx");
  7674. $recv((function(){
  7675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7676. return $core.withContext(function($ctx2) {
  7677. //>>excludeEnd("ctx");
  7678. return $self._atEnd();
  7679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7680. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7681. //>>excludeEnd("ctx");
  7682. }))._whileFalse_((function(){
  7683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7684. return $core.withContext(function($ctx2) {
  7685. //>>excludeEnd("ctx");
  7686. return $recv(aBlock)._value_($self._next());
  7687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7689. //>>excludeEnd("ctx");
  7690. }));
  7691. return self;
  7692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7693. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7694. //>>excludeEnd("ctx");
  7695. }; }),
  7696. $globals.ProtoStream);
  7697. $core.addMethod(
  7698. $core.method({
  7699. selector: "isEmpty",
  7700. protocol: "testing",
  7701. //>>excludeStart("ide", pragmas.excludeIdeData);
  7702. args: [],
  7703. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7704. referencedClasses: [],
  7705. //>>excludeEnd("ide");
  7706. pragmas: [],
  7707. messageSends: ["and:", "atStart", "atEnd"]
  7708. }, function ($methodClass){ return function (){
  7709. var self=this,$self=this;
  7710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7711. return $core.withContext(function($ctx1) {
  7712. //>>excludeEnd("ctx");
  7713. return $recv($self._atStart())._and_((function(){
  7714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7715. return $core.withContext(function($ctx2) {
  7716. //>>excludeEnd("ctx");
  7717. return $self._atEnd();
  7718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7720. //>>excludeEnd("ctx");
  7721. }));
  7722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7723. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7724. //>>excludeEnd("ctx");
  7725. }; }),
  7726. $globals.ProtoStream);
  7727. $core.addMethod(
  7728. $core.method({
  7729. selector: "next",
  7730. protocol: "reading",
  7731. //>>excludeStart("ide", pragmas.excludeIdeData);
  7732. args: [],
  7733. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7734. referencedClasses: [],
  7735. //>>excludeEnd("ide");
  7736. pragmas: [],
  7737. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7738. }, function ($methodClass){ return function (){
  7739. var self=this,$self=this;
  7740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7741. return $core.withContext(function($ctx1) {
  7742. //>>excludeEnd("ctx");
  7743. var $1;
  7744. $1=$self._atEnd();
  7745. if($core.assert($1)){
  7746. return nil;
  7747. } else {
  7748. return $self._subclassResponsibility();
  7749. }
  7750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7751. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7752. //>>excludeEnd("ctx");
  7753. }; }),
  7754. $globals.ProtoStream);
  7755. $core.addMethod(
  7756. $core.method({
  7757. selector: "nextPut:",
  7758. protocol: "writing",
  7759. //>>excludeStart("ide", pragmas.excludeIdeData);
  7760. args: ["anObject"],
  7761. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7762. referencedClasses: [],
  7763. //>>excludeEnd("ide");
  7764. pragmas: [],
  7765. messageSends: ["subclassResponsibility"]
  7766. }, function ($methodClass){ return function (anObject){
  7767. var self=this,$self=this;
  7768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7769. return $core.withContext(function($ctx1) {
  7770. //>>excludeEnd("ctx");
  7771. $self._subclassResponsibility();
  7772. return self;
  7773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7774. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7775. //>>excludeEnd("ctx");
  7776. }; }),
  7777. $globals.ProtoStream);
  7778. $core.addMethod(
  7779. $core.method({
  7780. selector: "nextPutAll:",
  7781. protocol: "writing",
  7782. //>>excludeStart("ide", pragmas.excludeIdeData);
  7783. args: ["aCollection"],
  7784. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7785. referencedClasses: [],
  7786. //>>excludeEnd("ide");
  7787. pragmas: [],
  7788. messageSends: ["do:", "nextPut:"]
  7789. }, function ($methodClass){ return function (aCollection){
  7790. var self=this,$self=this;
  7791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7792. return $core.withContext(function($ctx1) {
  7793. //>>excludeEnd("ctx");
  7794. $recv(aCollection)._do_((function(each){
  7795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7796. return $core.withContext(function($ctx2) {
  7797. //>>excludeEnd("ctx");
  7798. return $self._nextPut_(each);
  7799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7801. //>>excludeEnd("ctx");
  7802. }));
  7803. return self;
  7804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7805. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7806. //>>excludeEnd("ctx");
  7807. }; }),
  7808. $globals.ProtoStream);
  7809. $core.addMethod(
  7810. $core.method({
  7811. selector: "nextPutString:",
  7812. protocol: "writing",
  7813. //>>excludeStart("ide", pragmas.excludeIdeData);
  7814. args: ["aString"],
  7815. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7816. referencedClasses: [],
  7817. //>>excludeEnd("ide");
  7818. pragmas: [],
  7819. messageSends: ["nextPut:"]
  7820. }, function ($methodClass){ return function (aString){
  7821. var self=this,$self=this;
  7822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7823. return $core.withContext(function($ctx1) {
  7824. //>>excludeEnd("ctx");
  7825. $self._nextPut_(aString);
  7826. return self;
  7827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7828. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7829. //>>excludeEnd("ctx");
  7830. }; }),
  7831. $globals.ProtoStream);
  7832. $core.addMethod(
  7833. $core.method({
  7834. selector: "peek",
  7835. protocol: "reading",
  7836. //>>excludeStart("ide", pragmas.excludeIdeData);
  7837. args: [],
  7838. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7839. referencedClasses: [],
  7840. //>>excludeEnd("ide");
  7841. pragmas: [],
  7842. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7843. }, function ($methodClass){ return function (){
  7844. var self=this,$self=this;
  7845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7846. return $core.withContext(function($ctx1) {
  7847. //>>excludeEnd("ctx");
  7848. var $1;
  7849. $1=$self._atEnd();
  7850. if($core.assert($1)){
  7851. return nil;
  7852. } else {
  7853. return $self._subclassResponsibility();
  7854. }
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  7857. //>>excludeEnd("ctx");
  7858. }; }),
  7859. $globals.ProtoStream);
  7860. $core.addMethod(
  7861. $core.method({
  7862. selector: "reset",
  7863. protocol: "actions",
  7864. //>>excludeStart("ide", pragmas.excludeIdeData);
  7865. args: [],
  7866. source: "reset\x0a\x09self subclassResponsibility",
  7867. referencedClasses: [],
  7868. //>>excludeEnd("ide");
  7869. pragmas: [],
  7870. messageSends: ["subclassResponsibility"]
  7871. }, function ($methodClass){ return function (){
  7872. var self=this,$self=this;
  7873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7874. return $core.withContext(function($ctx1) {
  7875. //>>excludeEnd("ctx");
  7876. $self._subclassResponsibility();
  7877. return self;
  7878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7879. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  7880. //>>excludeEnd("ctx");
  7881. }; }),
  7882. $globals.ProtoStream);
  7883. $core.addMethod(
  7884. $core.method({
  7885. selector: "resetContents",
  7886. protocol: "actions",
  7887. //>>excludeStart("ide", pragmas.excludeIdeData);
  7888. args: [],
  7889. source: "resetContents\x0a\x09self subclassResponsibility",
  7890. referencedClasses: [],
  7891. //>>excludeEnd("ide");
  7892. pragmas: [],
  7893. messageSends: ["subclassResponsibility"]
  7894. }, function ($methodClass){ return function (){
  7895. var self=this,$self=this;
  7896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7897. return $core.withContext(function($ctx1) {
  7898. //>>excludeEnd("ctx");
  7899. $self._subclassResponsibility();
  7900. return self;
  7901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7902. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  7903. //>>excludeEnd("ctx");
  7904. }; }),
  7905. $globals.ProtoStream);
  7906. $core.addMethod(
  7907. $core.method({
  7908. selector: "setToEnd",
  7909. protocol: "positioning",
  7910. //>>excludeStart("ide", pragmas.excludeIdeData);
  7911. args: [],
  7912. source: "setToEnd\x0a\x09self subclassResponsibility",
  7913. referencedClasses: [],
  7914. //>>excludeEnd("ide");
  7915. pragmas: [],
  7916. messageSends: ["subclassResponsibility"]
  7917. }, function ($methodClass){ return function (){
  7918. var self=this,$self=this;
  7919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7920. return $core.withContext(function($ctx1) {
  7921. //>>excludeEnd("ctx");
  7922. $self._subclassResponsibility();
  7923. return self;
  7924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7925. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  7926. //>>excludeEnd("ctx");
  7927. }; }),
  7928. $globals.ProtoStream);
  7929. $core.addMethod(
  7930. $core.method({
  7931. selector: "setToStart",
  7932. protocol: "positioning",
  7933. //>>excludeStart("ide", pragmas.excludeIdeData);
  7934. args: [],
  7935. source: "setToStart\x0a\x09self reset",
  7936. referencedClasses: [],
  7937. //>>excludeEnd("ide");
  7938. pragmas: [],
  7939. messageSends: ["reset"]
  7940. }, function ($methodClass){ return function (){
  7941. var self=this,$self=this;
  7942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7943. return $core.withContext(function($ctx1) {
  7944. //>>excludeEnd("ctx");
  7945. $self._reset();
  7946. return self;
  7947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7948. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  7949. //>>excludeEnd("ctx");
  7950. }; }),
  7951. $globals.ProtoStream);
  7952. $core.addMethod(
  7953. $core.method({
  7954. selector: "write:",
  7955. protocol: "writing",
  7956. //>>excludeStart("ide", pragmas.excludeIdeData);
  7957. args: ["anObject"],
  7958. source: "write: anObject\x0a\x09anObject putOn: self",
  7959. referencedClasses: [],
  7960. //>>excludeEnd("ide");
  7961. pragmas: [],
  7962. messageSends: ["putOn:"]
  7963. }, function ($methodClass){ return function (anObject){
  7964. var self=this,$self=this;
  7965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7966. return $core.withContext(function($ctx1) {
  7967. //>>excludeEnd("ctx");
  7968. $recv(anObject)._putOn_(self);
  7969. return self;
  7970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7971. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  7972. //>>excludeEnd("ctx");
  7973. }; }),
  7974. $globals.ProtoStream);
  7975. $core.addMethod(
  7976. $core.method({
  7977. selector: "on:",
  7978. protocol: "instance creation",
  7979. //>>excludeStart("ide", pragmas.excludeIdeData);
  7980. args: ["aCollection"],
  7981. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  7982. referencedClasses: [],
  7983. //>>excludeEnd("ide");
  7984. pragmas: [],
  7985. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  7986. }, function ($methodClass){ return function (aCollection){
  7987. var self=this,$self=this;
  7988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7989. return $core.withContext(function($ctx1) {
  7990. //>>excludeEnd("ctx");
  7991. var $1;
  7992. $1=$self._new();
  7993. $recv($1)._setCollection_(aCollection);
  7994. $recv($1)._setStreamSize_($recv(aCollection)._size());
  7995. return $recv($1)._yourself();
  7996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7997. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  7998. //>>excludeEnd("ctx");
  7999. }; }),
  8000. $globals.ProtoStream.a$cls);
  8001. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8002. //>>excludeStart("ide", pragmas.excludeIdeData);
  8003. $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.";
  8004. //>>excludeEnd("ide");
  8005. $core.addMethod(
  8006. $core.method({
  8007. selector: "atEnd",
  8008. protocol: "testing",
  8009. //>>excludeStart("ide", pragmas.excludeIdeData);
  8010. args: [],
  8011. source: "atEnd\x0a\x09^ self position = self size",
  8012. referencedClasses: [],
  8013. //>>excludeEnd("ide");
  8014. pragmas: [],
  8015. messageSends: ["=", "position", "size"]
  8016. }, function ($methodClass){ return function (){
  8017. var self=this,$self=this;
  8018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8019. return $core.withContext(function($ctx1) {
  8020. //>>excludeEnd("ctx");
  8021. return $recv($self._position()).__eq($self._size());
  8022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8023. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8024. //>>excludeEnd("ctx");
  8025. }; }),
  8026. $globals.Stream);
  8027. $core.addMethod(
  8028. $core.method({
  8029. selector: "atStart",
  8030. protocol: "testing",
  8031. //>>excludeStart("ide", pragmas.excludeIdeData);
  8032. args: [],
  8033. source: "atStart\x0a\x09^ self position = 0",
  8034. referencedClasses: [],
  8035. //>>excludeEnd("ide");
  8036. pragmas: [],
  8037. messageSends: ["=", "position"]
  8038. }, function ($methodClass){ return function (){
  8039. var self=this,$self=this;
  8040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8041. return $core.withContext(function($ctx1) {
  8042. //>>excludeEnd("ctx");
  8043. return $recv($self._position()).__eq((0));
  8044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8045. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8046. //>>excludeEnd("ctx");
  8047. }; }),
  8048. $globals.Stream);
  8049. $core.addMethod(
  8050. $core.method({
  8051. selector: "close",
  8052. protocol: "actions",
  8053. //>>excludeStart("ide", pragmas.excludeIdeData);
  8054. args: [],
  8055. source: "close",
  8056. referencedClasses: [],
  8057. //>>excludeEnd("ide");
  8058. pragmas: [],
  8059. messageSends: []
  8060. }, function ($methodClass){ return function (){
  8061. var self=this,$self=this;
  8062. return self;
  8063. }; }),
  8064. $globals.Stream);
  8065. $core.addMethod(
  8066. $core.method({
  8067. selector: "collection",
  8068. protocol: "accessing",
  8069. //>>excludeStart("ide", pragmas.excludeIdeData);
  8070. args: [],
  8071. source: "collection\x0a\x09^ collection",
  8072. referencedClasses: [],
  8073. //>>excludeEnd("ide");
  8074. pragmas: [],
  8075. messageSends: []
  8076. }, function ($methodClass){ return function (){
  8077. var self=this,$self=this;
  8078. return $self.collection;
  8079. }; }),
  8080. $globals.Stream);
  8081. $core.addMethod(
  8082. $core.method({
  8083. selector: "contents",
  8084. protocol: "accessing",
  8085. //>>excludeStart("ide", pragmas.excludeIdeData);
  8086. args: [],
  8087. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8088. referencedClasses: [],
  8089. //>>excludeEnd("ide");
  8090. pragmas: [],
  8091. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8092. }, function ($methodClass){ return function (){
  8093. var self=this,$self=this;
  8094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8095. return $core.withContext(function($ctx1) {
  8096. //>>excludeEnd("ctx");
  8097. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8099. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8100. //>>excludeEnd("ctx");
  8101. }; }),
  8102. $globals.Stream);
  8103. $core.addMethod(
  8104. $core.method({
  8105. selector: "flush",
  8106. protocol: "actions",
  8107. //>>excludeStart("ide", pragmas.excludeIdeData);
  8108. args: [],
  8109. source: "flush",
  8110. referencedClasses: [],
  8111. //>>excludeEnd("ide");
  8112. pragmas: [],
  8113. messageSends: []
  8114. }, function ($methodClass){ return function (){
  8115. var self=this,$self=this;
  8116. return self;
  8117. }; }),
  8118. $globals.Stream);
  8119. $core.addMethod(
  8120. $core.method({
  8121. selector: "isEmpty",
  8122. protocol: "testing",
  8123. //>>excludeStart("ide", pragmas.excludeIdeData);
  8124. args: [],
  8125. source: "isEmpty\x0a\x09^ self size = 0",
  8126. referencedClasses: [],
  8127. //>>excludeEnd("ide");
  8128. pragmas: [],
  8129. messageSends: ["=", "size"]
  8130. }, function ($methodClass){ return function (){
  8131. var self=this,$self=this;
  8132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8133. return $core.withContext(function($ctx1) {
  8134. //>>excludeEnd("ctx");
  8135. return $recv($self._size()).__eq((0));
  8136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8137. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8138. //>>excludeEnd("ctx");
  8139. }; }),
  8140. $globals.Stream);
  8141. $core.addMethod(
  8142. $core.method({
  8143. selector: "next",
  8144. protocol: "reading",
  8145. //>>excludeStart("ide", pragmas.excludeIdeData);
  8146. args: [],
  8147. 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 ]",
  8148. referencedClasses: [],
  8149. //>>excludeEnd("ide");
  8150. pragmas: [],
  8151. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8152. }, function ($methodClass){ return function (){
  8153. var self=this,$self=this;
  8154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8155. return $core.withContext(function($ctx1) {
  8156. //>>excludeEnd("ctx");
  8157. var $1,$3,$2;
  8158. $1=$self._atEnd();
  8159. if($core.assert($1)){
  8160. return nil;
  8161. } else {
  8162. $3=$self._position();
  8163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8164. $ctx1.sendIdx["position"]=1;
  8165. //>>excludeEnd("ctx");
  8166. $2=$recv($3).__plus((1));
  8167. $self._position_($2);
  8168. return $recv($self.collection)._at_($self._position());
  8169. }
  8170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8171. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8172. //>>excludeEnd("ctx");
  8173. }; }),
  8174. $globals.Stream);
  8175. $core.addMethod(
  8176. $core.method({
  8177. selector: "next:",
  8178. protocol: "reading",
  8179. //>>excludeStart("ide", pragmas.excludeIdeData);
  8180. args: ["anInteger"],
  8181. 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",
  8182. referencedClasses: [],
  8183. //>>excludeEnd("ide");
  8184. pragmas: [],
  8185. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8186. }, function ($methodClass){ return function (anInteger){
  8187. var self=this,$self=this;
  8188. var tempCollection;
  8189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8190. return $core.withContext(function($ctx1) {
  8191. //>>excludeEnd("ctx");
  8192. var $1;
  8193. tempCollection=$recv($recv($self._collection())._class())._new();
  8194. $recv(anInteger)._timesRepeat_((function(){
  8195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8196. return $core.withContext(function($ctx2) {
  8197. //>>excludeEnd("ctx");
  8198. $1=$self._atEnd();
  8199. if(!$core.assert($1)){
  8200. return $recv(tempCollection)._add_($self._next());
  8201. }
  8202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8204. //>>excludeEnd("ctx");
  8205. }));
  8206. return tempCollection;
  8207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8208. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8209. //>>excludeEnd("ctx");
  8210. }; }),
  8211. $globals.Stream);
  8212. $core.addMethod(
  8213. $core.method({
  8214. selector: "nextPut:",
  8215. protocol: "writing",
  8216. //>>excludeStart("ide", pragmas.excludeIdeData);
  8217. args: ["anObject"],
  8218. 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)",
  8219. referencedClasses: [],
  8220. //>>excludeEnd("ide");
  8221. pragmas: [],
  8222. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8223. }, function ($methodClass){ return function (anObject){
  8224. var self=this,$self=this;
  8225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8226. return $core.withContext(function($ctx1) {
  8227. //>>excludeEnd("ctx");
  8228. var $2,$1,$3,$4;
  8229. $2=$self._position();
  8230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8231. $ctx1.sendIdx["position"]=1;
  8232. //>>excludeEnd("ctx");
  8233. $1=$recv($2).__plus((1));
  8234. $self._position_($1);
  8235. $3=$self._collection();
  8236. $4=$self._position();
  8237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8238. $ctx1.sendIdx["position"]=2;
  8239. //>>excludeEnd("ctx");
  8240. $recv($3)._at_put_($4,anObject);
  8241. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8242. return self;
  8243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8244. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8245. //>>excludeEnd("ctx");
  8246. }; }),
  8247. $globals.Stream);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "peek",
  8251. protocol: "reading",
  8252. //>>excludeStart("ide", pragmas.excludeIdeData);
  8253. args: [],
  8254. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8255. referencedClasses: [],
  8256. //>>excludeEnd("ide");
  8257. pragmas: [],
  8258. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8259. }, function ($methodClass){ return function (){
  8260. var self=this,$self=this;
  8261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8262. return $core.withContext(function($ctx1) {
  8263. //>>excludeEnd("ctx");
  8264. var $1;
  8265. $1=$self._atEnd();
  8266. if(!$core.assert($1)){
  8267. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8268. }
  8269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8270. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8271. //>>excludeEnd("ctx");
  8272. }; }),
  8273. $globals.Stream);
  8274. $core.addMethod(
  8275. $core.method({
  8276. selector: "position",
  8277. protocol: "accessing",
  8278. //>>excludeStart("ide", pragmas.excludeIdeData);
  8279. args: [],
  8280. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8281. referencedClasses: [],
  8282. //>>excludeEnd("ide");
  8283. pragmas: [],
  8284. messageSends: ["ifNil:"]
  8285. }, function ($methodClass){ return function (){
  8286. var self=this,$self=this;
  8287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8288. return $core.withContext(function($ctx1) {
  8289. //>>excludeEnd("ctx");
  8290. var $1,$receiver;
  8291. $1=$self.position;
  8292. if(($receiver = $1) == null || $receiver.a$nil){
  8293. $self.position=(0);
  8294. return $self.position;
  8295. } else {
  8296. return $1;
  8297. }
  8298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8299. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8300. //>>excludeEnd("ctx");
  8301. }; }),
  8302. $globals.Stream);
  8303. $core.addMethod(
  8304. $core.method({
  8305. selector: "position:",
  8306. protocol: "accessing",
  8307. //>>excludeStart("ide", pragmas.excludeIdeData);
  8308. args: ["anInteger"],
  8309. source: "position: anInteger\x0a\x09position := anInteger",
  8310. referencedClasses: [],
  8311. //>>excludeEnd("ide");
  8312. pragmas: [],
  8313. messageSends: []
  8314. }, function ($methodClass){ return function (anInteger){
  8315. var self=this,$self=this;
  8316. $self.position=anInteger;
  8317. return self;
  8318. }; }),
  8319. $globals.Stream);
  8320. $core.addMethod(
  8321. $core.method({
  8322. selector: "reset",
  8323. protocol: "actions",
  8324. //>>excludeStart("ide", pragmas.excludeIdeData);
  8325. args: [],
  8326. source: "reset\x0a\x09self position: 0",
  8327. referencedClasses: [],
  8328. //>>excludeEnd("ide");
  8329. pragmas: [],
  8330. messageSends: ["position:"]
  8331. }, function ($methodClass){ return function (){
  8332. var self=this,$self=this;
  8333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8334. return $core.withContext(function($ctx1) {
  8335. //>>excludeEnd("ctx");
  8336. $self._position_((0));
  8337. return self;
  8338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8339. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8340. //>>excludeEnd("ctx");
  8341. }; }),
  8342. $globals.Stream);
  8343. $core.addMethod(
  8344. $core.method({
  8345. selector: "resetContents",
  8346. protocol: "actions",
  8347. //>>excludeStart("ide", pragmas.excludeIdeData);
  8348. args: [],
  8349. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8350. referencedClasses: [],
  8351. //>>excludeEnd("ide");
  8352. pragmas: [],
  8353. messageSends: ["reset", "setStreamSize:"]
  8354. }, function ($methodClass){ return function (){
  8355. var self=this,$self=this;
  8356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8357. return $core.withContext(function($ctx1) {
  8358. //>>excludeEnd("ctx");
  8359. $self._reset();
  8360. $self._setStreamSize_((0));
  8361. return self;
  8362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8363. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8364. //>>excludeEnd("ctx");
  8365. }; }),
  8366. $globals.Stream);
  8367. $core.addMethod(
  8368. $core.method({
  8369. selector: "setCollection:",
  8370. protocol: "accessing",
  8371. //>>excludeStart("ide", pragmas.excludeIdeData);
  8372. args: ["aCollection"],
  8373. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8374. referencedClasses: [],
  8375. //>>excludeEnd("ide");
  8376. pragmas: [],
  8377. messageSends: []
  8378. }, function ($methodClass){ return function (aCollection){
  8379. var self=this,$self=this;
  8380. $self.collection=aCollection;
  8381. return self;
  8382. }; }),
  8383. $globals.Stream);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "setStreamSize:",
  8387. protocol: "accessing",
  8388. //>>excludeStart("ide", pragmas.excludeIdeData);
  8389. args: ["anInteger"],
  8390. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8391. referencedClasses: [],
  8392. //>>excludeEnd("ide");
  8393. pragmas: [],
  8394. messageSends: []
  8395. }, function ($methodClass){ return function (anInteger){
  8396. var self=this,$self=this;
  8397. $self.streamSize=anInteger;
  8398. return self;
  8399. }; }),
  8400. $globals.Stream);
  8401. $core.addMethod(
  8402. $core.method({
  8403. selector: "setToEnd",
  8404. protocol: "positioning",
  8405. //>>excludeStart("ide", pragmas.excludeIdeData);
  8406. args: [],
  8407. source: "setToEnd\x0a\x09self position: self size",
  8408. referencedClasses: [],
  8409. //>>excludeEnd("ide");
  8410. pragmas: [],
  8411. messageSends: ["position:", "size"]
  8412. }, function ($methodClass){ return function (){
  8413. var self=this,$self=this;
  8414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8415. return $core.withContext(function($ctx1) {
  8416. //>>excludeEnd("ctx");
  8417. $self._position_($self._size());
  8418. return self;
  8419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8420. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8421. //>>excludeEnd("ctx");
  8422. }; }),
  8423. $globals.Stream);
  8424. $core.addMethod(
  8425. $core.method({
  8426. selector: "size",
  8427. protocol: "accessing",
  8428. //>>excludeStart("ide", pragmas.excludeIdeData);
  8429. args: [],
  8430. source: "size\x0a\x09^ self streamSize",
  8431. referencedClasses: [],
  8432. //>>excludeEnd("ide");
  8433. pragmas: [],
  8434. messageSends: ["streamSize"]
  8435. }, function ($methodClass){ return function (){
  8436. var self=this,$self=this;
  8437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8438. return $core.withContext(function($ctx1) {
  8439. //>>excludeEnd("ctx");
  8440. return $self._streamSize();
  8441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8442. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8443. //>>excludeEnd("ctx");
  8444. }; }),
  8445. $globals.Stream);
  8446. $core.addMethod(
  8447. $core.method({
  8448. selector: "skip:",
  8449. protocol: "positioning",
  8450. //>>excludeStart("ide", pragmas.excludeIdeData);
  8451. args: ["anInteger"],
  8452. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8453. referencedClasses: [],
  8454. //>>excludeEnd("ide");
  8455. pragmas: [],
  8456. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8457. }, function ($methodClass){ return function (anInteger){
  8458. var self=this,$self=this;
  8459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8460. return $core.withContext(function($ctx1) {
  8461. //>>excludeEnd("ctx");
  8462. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8463. return self;
  8464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8465. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8466. //>>excludeEnd("ctx");
  8467. }; }),
  8468. $globals.Stream);
  8469. $core.addMethod(
  8470. $core.method({
  8471. selector: "streamSize",
  8472. protocol: "accessing",
  8473. //>>excludeStart("ide", pragmas.excludeIdeData);
  8474. args: [],
  8475. source: "streamSize\x0a\x09^ streamSize",
  8476. referencedClasses: [],
  8477. //>>excludeEnd("ide");
  8478. pragmas: [],
  8479. messageSends: []
  8480. }, function ($methodClass){ return function (){
  8481. var self=this,$self=this;
  8482. return $self.streamSize;
  8483. }; }),
  8484. $globals.Stream);
  8485. $core.addMethod(
  8486. $core.method({
  8487. selector: "on:",
  8488. protocol: "instance creation",
  8489. //>>excludeStart("ide", pragmas.excludeIdeData);
  8490. args: ["aCollection"],
  8491. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8492. referencedClasses: [],
  8493. //>>excludeEnd("ide");
  8494. pragmas: [],
  8495. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8496. }, function ($methodClass){ return function (aCollection){
  8497. var self=this,$self=this;
  8498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8499. return $core.withContext(function($ctx1) {
  8500. //>>excludeEnd("ctx");
  8501. var $1;
  8502. $1=$self._new();
  8503. $recv($1)._setCollection_(aCollection);
  8504. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8505. return $recv($1)._yourself();
  8506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8507. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8508. //>>excludeEnd("ctx");
  8509. }; }),
  8510. $globals.Stream.a$cls);
  8511. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8512. //>>excludeStart("ide", pragmas.excludeIdeData);
  8513. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8514. //>>excludeEnd("ide");
  8515. $core.addMethod(
  8516. $core.method({
  8517. selector: "cr",
  8518. protocol: "writing",
  8519. //>>excludeStart("ide", pragmas.excludeIdeData);
  8520. args: [],
  8521. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8522. referencedClasses: ["String"],
  8523. //>>excludeEnd("ide");
  8524. pragmas: [],
  8525. messageSends: ["nextPutAll:", "cr"]
  8526. }, function ($methodClass){ return function (){
  8527. var self=this,$self=this;
  8528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8529. return $core.withContext(function($ctx1) {
  8530. //>>excludeEnd("ctx");
  8531. return $self._nextPutAll_($recv($globals.String)._cr());
  8532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8533. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8534. //>>excludeEnd("ctx");
  8535. }; }),
  8536. $globals.StringStream);
  8537. $core.addMethod(
  8538. $core.method({
  8539. selector: "crlf",
  8540. protocol: "writing",
  8541. //>>excludeStart("ide", pragmas.excludeIdeData);
  8542. args: [],
  8543. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8544. referencedClasses: ["String"],
  8545. //>>excludeEnd("ide");
  8546. pragmas: [],
  8547. messageSends: ["nextPutAll:", "crlf"]
  8548. }, function ($methodClass){ return function (){
  8549. var self=this,$self=this;
  8550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8551. return $core.withContext(function($ctx1) {
  8552. //>>excludeEnd("ctx");
  8553. return $self._nextPutAll_($recv($globals.String)._crlf());
  8554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8555. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8556. //>>excludeEnd("ctx");
  8557. }; }),
  8558. $globals.StringStream);
  8559. $core.addMethod(
  8560. $core.method({
  8561. selector: "lf",
  8562. protocol: "writing",
  8563. //>>excludeStart("ide", pragmas.excludeIdeData);
  8564. args: [],
  8565. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8566. referencedClasses: ["String"],
  8567. //>>excludeEnd("ide");
  8568. pragmas: [],
  8569. messageSends: ["nextPutAll:", "lf"]
  8570. }, function ($methodClass){ return function (){
  8571. var self=this,$self=this;
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. return $core.withContext(function($ctx1) {
  8574. //>>excludeEnd("ctx");
  8575. return $self._nextPutAll_($recv($globals.String)._lf());
  8576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8577. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8578. //>>excludeEnd("ctx");
  8579. }; }),
  8580. $globals.StringStream);
  8581. $core.addMethod(
  8582. $core.method({
  8583. selector: "next:",
  8584. protocol: "reading",
  8585. //>>excludeStart("ide", pragmas.excludeIdeData);
  8586. args: ["anInteger"],
  8587. 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",
  8588. referencedClasses: [],
  8589. //>>excludeEnd("ide");
  8590. pragmas: [],
  8591. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8592. }, function ($methodClass){ return function (anInteger){
  8593. var self=this,$self=this;
  8594. var tempCollection;
  8595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8596. return $core.withContext(function($ctx1) {
  8597. //>>excludeEnd("ctx");
  8598. var $1;
  8599. tempCollection=$recv($recv($self._collection())._class())._new();
  8600. $recv(anInteger)._timesRepeat_((function(){
  8601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8602. return $core.withContext(function($ctx2) {
  8603. //>>excludeEnd("ctx");
  8604. $1=$self._atEnd();
  8605. if(!$core.assert($1)){
  8606. tempCollection=$recv(tempCollection).__comma($self._next());
  8607. return tempCollection;
  8608. }
  8609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8610. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8611. //>>excludeEnd("ctx");
  8612. }));
  8613. return tempCollection;
  8614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8615. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8616. //>>excludeEnd("ctx");
  8617. }; }),
  8618. $globals.StringStream);
  8619. $core.addMethod(
  8620. $core.method({
  8621. selector: "nextPut:",
  8622. protocol: "writing",
  8623. //>>excludeStart("ide", pragmas.excludeIdeData);
  8624. args: ["aString"],
  8625. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8626. referencedClasses: [],
  8627. //>>excludeEnd("ide");
  8628. pragmas: [],
  8629. messageSends: ["nextPutAll:"]
  8630. }, function ($methodClass){ return function (aString){
  8631. var self=this,$self=this;
  8632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8633. return $core.withContext(function($ctx1) {
  8634. //>>excludeEnd("ctx");
  8635. $self._nextPutAll_(aString);
  8636. return self;
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8639. //>>excludeEnd("ctx");
  8640. }; }),
  8641. $globals.StringStream);
  8642. $core.addMethod(
  8643. $core.method({
  8644. selector: "nextPutAll:",
  8645. protocol: "writing",
  8646. //>>excludeStart("ide", pragmas.excludeIdeData);
  8647. args: ["aString"],
  8648. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self position = self collection size ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  8649. referencedClasses: [],
  8650. //>>excludeEnd("ide");
  8651. pragmas: [],
  8652. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8653. }, function ($methodClass){ return function (aString){
  8654. var self=this,$self=this;
  8655. var pre,post;
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. return $core.withContext(function($ctx1) {
  8658. //>>excludeEnd("ctx");
  8659. var $2,$4,$3,$1,$6,$5,$7,$8,$9,$12,$11,$13,$10,$14,$15,$17,$16;
  8660. $2=$self._position();
  8661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8662. $ctx1.sendIdx["position"]=1;
  8663. //>>excludeEnd("ctx");
  8664. $4=$self._collection();
  8665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8666. $ctx1.sendIdx["collection"]=1;
  8667. //>>excludeEnd("ctx");
  8668. $3=$recv($4)._size();
  8669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8670. $ctx1.sendIdx["size"]=1;
  8671. //>>excludeEnd("ctx");
  8672. $1=$recv($2).__eq($3);
  8673. if($core.assert($1)){
  8674. $6=$self._collection();
  8675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8676. $ctx1.sendIdx["collection"]=2;
  8677. //>>excludeEnd("ctx");
  8678. $5=$recv($6).__comma(aString);
  8679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8680. $ctx1.sendIdx[","]=1;
  8681. //>>excludeEnd("ctx");
  8682. $self._setCollection_($5);
  8683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8684. $ctx1.sendIdx["setCollection:"]=1;
  8685. //>>excludeEnd("ctx");
  8686. } else {
  8687. $7=$self._collection();
  8688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8689. $ctx1.sendIdx["collection"]=3;
  8690. //>>excludeEnd("ctx");
  8691. $8=$self._position();
  8692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8693. $ctx1.sendIdx["position"]=2;
  8694. //>>excludeEnd("ctx");
  8695. pre=$recv($7)._copyFrom_to_((1),$8);
  8696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8697. $ctx1.sendIdx["copyFrom:to:"]=1;
  8698. //>>excludeEnd("ctx");
  8699. $9=$self._collection();
  8700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8701. $ctx1.sendIdx["collection"]=4;
  8702. //>>excludeEnd("ctx");
  8703. $12=$self._position();
  8704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8705. $ctx1.sendIdx["position"]=3;
  8706. //>>excludeEnd("ctx");
  8707. $11=$recv($12).__plus((1));
  8708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8709. $ctx1.sendIdx["+"]=2;
  8710. //>>excludeEnd("ctx");
  8711. $13=$recv(aString)._size();
  8712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8713. $ctx1.sendIdx["size"]=2;
  8714. //>>excludeEnd("ctx");
  8715. $10=$recv($11).__plus($13);
  8716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8717. $ctx1.sendIdx["+"]=1;
  8718. //>>excludeEnd("ctx");
  8719. $14=$recv($self._collection())._size();
  8720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8721. $ctx1.sendIdx["size"]=3;
  8722. //>>excludeEnd("ctx");
  8723. post=$recv($9)._copyFrom_to_($10,$14);
  8724. $15=$recv($recv(pre).__comma(aString)).__comma(post);
  8725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8726. $ctx1.sendIdx[","]=2;
  8727. //>>excludeEnd("ctx");
  8728. $self._setCollection_($15);
  8729. }
  8730. $17=$self._position();
  8731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8732. $ctx1.sendIdx["position"]=4;
  8733. //>>excludeEnd("ctx");
  8734. $16=$recv($17).__plus($recv(aString)._size());
  8735. $self._position_($16);
  8736. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8737. return self;
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8740. //>>excludeEnd("ctx");
  8741. }; }),
  8742. $globals.StringStream);
  8743. $core.addMethod(
  8744. $core.method({
  8745. selector: "nextPutString:",
  8746. protocol: "writing",
  8747. //>>excludeStart("ide", pragmas.excludeIdeData);
  8748. args: ["aString"],
  8749. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8750. referencedClasses: [],
  8751. //>>excludeEnd("ide");
  8752. pragmas: [],
  8753. messageSends: ["nextPutAll:"]
  8754. }, function ($methodClass){ return function (aString){
  8755. var self=this,$self=this;
  8756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8757. return $core.withContext(function($ctx1) {
  8758. //>>excludeEnd("ctx");
  8759. $self._nextPutAll_(aString);
  8760. return self;
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8763. //>>excludeEnd("ctx");
  8764. }; }),
  8765. $globals.StringStream);
  8766. $core.addMethod(
  8767. $core.method({
  8768. selector: "print:",
  8769. protocol: "writing",
  8770. //>>excludeStart("ide", pragmas.excludeIdeData);
  8771. args: ["anObject"],
  8772. source: "print: anObject\x0a\x09anObject printOn: self",
  8773. referencedClasses: [],
  8774. //>>excludeEnd("ide");
  8775. pragmas: [],
  8776. messageSends: ["printOn:"]
  8777. }, function ($methodClass){ return function (anObject){
  8778. var self=this,$self=this;
  8779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8780. return $core.withContext(function($ctx1) {
  8781. //>>excludeEnd("ctx");
  8782. $recv(anObject)._printOn_(self);
  8783. return self;
  8784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8785. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8786. //>>excludeEnd("ctx");
  8787. }; }),
  8788. $globals.StringStream);
  8789. $core.addMethod(
  8790. $core.method({
  8791. selector: "printSymbol:",
  8792. protocol: "writing",
  8793. //>>excludeStart("ide", pragmas.excludeIdeData);
  8794. args: ["anObject"],
  8795. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8796. referencedClasses: [],
  8797. //>>excludeEnd("ide");
  8798. pragmas: [],
  8799. messageSends: ["asSymbolPrintOn:"]
  8800. }, function ($methodClass){ return function (anObject){
  8801. var self=this,$self=this;
  8802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8803. return $core.withContext(function($ctx1) {
  8804. //>>excludeEnd("ctx");
  8805. $recv(anObject)._asSymbolPrintOn_(self);
  8806. return self;
  8807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8808. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8809. //>>excludeEnd("ctx");
  8810. }; }),
  8811. $globals.StringStream);
  8812. $core.addMethod(
  8813. $core.method({
  8814. selector: "space",
  8815. protocol: "writing",
  8816. //>>excludeStart("ide", pragmas.excludeIdeData);
  8817. args: [],
  8818. source: "space\x0a\x09self nextPut: ' '",
  8819. referencedClasses: [],
  8820. //>>excludeEnd("ide");
  8821. pragmas: [],
  8822. messageSends: ["nextPut:"]
  8823. }, function ($methodClass){ return function (){
  8824. var self=this,$self=this;
  8825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8826. return $core.withContext(function($ctx1) {
  8827. //>>excludeEnd("ctx");
  8828. $self._nextPut_(" ");
  8829. return self;
  8830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8831. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8832. //>>excludeEnd("ctx");
  8833. }; }),
  8834. $globals.StringStream);
  8835. $core.addMethod(
  8836. $core.method({
  8837. selector: "tab",
  8838. protocol: "writing",
  8839. //>>excludeStart("ide", pragmas.excludeIdeData);
  8840. args: [],
  8841. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8842. referencedClasses: ["String"],
  8843. //>>excludeEnd("ide");
  8844. pragmas: [],
  8845. messageSends: ["nextPutAll:", "tab"]
  8846. }, function ($methodClass){ return function (){
  8847. var self=this,$self=this;
  8848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8849. return $core.withContext(function($ctx1) {
  8850. //>>excludeEnd("ctx");
  8851. return $self._nextPutAll_($recv($globals.String)._tab());
  8852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8853. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  8854. //>>excludeEnd("ctx");
  8855. }; }),
  8856. $globals.StringStream);
  8857. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8858. //>>excludeStart("ide", pragmas.excludeIdeData);
  8859. $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.";
  8860. //>>excludeEnd("ide");
  8861. $core.addMethod(
  8862. $core.method({
  8863. selector: "initialize",
  8864. protocol: "initialization",
  8865. //>>excludeStart("ide", pragmas.excludeIdeData);
  8866. args: [],
  8867. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8868. referencedClasses: ["OrderedCollection"],
  8869. //>>excludeEnd("ide");
  8870. pragmas: [],
  8871. messageSends: ["initialize", "new"]
  8872. }, function ($methodClass){ return function (){
  8873. var self=this,$self=this;
  8874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8875. return $core.withContext(function($ctx1) {
  8876. //>>excludeEnd("ctx");
  8877. (
  8878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8879. $ctx1.supercall = true,
  8880. //>>excludeEnd("ctx");
  8881. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  8882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8883. $ctx1.supercall = false;
  8884. //>>excludeEnd("ctx");;
  8885. $self.read=$recv($globals.OrderedCollection)._new();
  8886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8887. $ctx1.sendIdx["new"]=1;
  8888. //>>excludeEnd("ctx");
  8889. $self.write=$recv($globals.OrderedCollection)._new();
  8890. $self.readIndex=(1);
  8891. return self;
  8892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8893. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  8894. //>>excludeEnd("ctx");
  8895. }; }),
  8896. $globals.Queue);
  8897. $core.addMethod(
  8898. $core.method({
  8899. selector: "next",
  8900. protocol: "accessing",
  8901. //>>excludeStart("ide", pragmas.excludeIdeData);
  8902. args: [],
  8903. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8904. referencedClasses: [],
  8905. //>>excludeEnd("ide");
  8906. pragmas: [],
  8907. messageSends: ["nextIfAbsent:", "error:"]
  8908. }, function ($methodClass){ return function (){
  8909. var self=this,$self=this;
  8910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8911. return $core.withContext(function($ctx1) {
  8912. //>>excludeEnd("ctx");
  8913. return $self._nextIfAbsent_((function(){
  8914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8915. return $core.withContext(function($ctx2) {
  8916. //>>excludeEnd("ctx");
  8917. return $self._error_("Cannot read from empty Queue.");
  8918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8920. //>>excludeEnd("ctx");
  8921. }));
  8922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8923. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8924. //>>excludeEnd("ctx");
  8925. }; }),
  8926. $globals.Queue);
  8927. $core.addMethod(
  8928. $core.method({
  8929. selector: "nextIfAbsent:",
  8930. protocol: "accessing",
  8931. //>>excludeStart("ide", pragmas.excludeIdeData);
  8932. args: ["aBlock"],
  8933. 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",
  8934. referencedClasses: ["OrderedCollection"],
  8935. //>>excludeEnd("ide");
  8936. pragmas: [],
  8937. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  8938. }, function ($methodClass){ return function (aBlock){
  8939. var self=this,$self=this;
  8940. var result;
  8941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8942. return $core.withContext(function($ctx1) {
  8943. //>>excludeEnd("ctx");
  8944. var $1;
  8945. var $early={};
  8946. try {
  8947. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  8948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8949. return $core.withContext(function($ctx2) {
  8950. //>>excludeEnd("ctx");
  8951. $recv($self.write)._ifEmpty_((function(){
  8952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8953. return $core.withContext(function($ctx3) {
  8954. //>>excludeEnd("ctx");
  8955. $1=$recv($self.readIndex).__gt((1));
  8956. if($core.assert($1)){
  8957. $self.read=[];
  8958. $self.readIndex=(1);
  8959. $self.readIndex;
  8960. }
  8961. throw $early=[$recv(aBlock)._value()];
  8962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8963. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8964. //>>excludeEnd("ctx");
  8965. }));
  8966. $self.read=$self.write;
  8967. $self.readIndex=(1);
  8968. $self.write=$recv($globals.OrderedCollection)._new();
  8969. return $recv($self.read)._first();
  8970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8971. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8972. //>>excludeEnd("ctx");
  8973. }));
  8974. $recv($self.read)._at_put_($self.readIndex,nil);
  8975. $self.readIndex=$recv($self.readIndex).__plus((1));
  8976. return result;
  8977. }
  8978. catch(e) {if(e===$early)return e[0]; throw e}
  8979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8980. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  8981. //>>excludeEnd("ctx");
  8982. }; }),
  8983. $globals.Queue);
  8984. $core.addMethod(
  8985. $core.method({
  8986. selector: "nextPut:",
  8987. protocol: "accessing",
  8988. //>>excludeStart("ide", pragmas.excludeIdeData);
  8989. args: ["anObject"],
  8990. source: "nextPut: anObject\x0a\x09write add: anObject",
  8991. referencedClasses: [],
  8992. //>>excludeEnd("ide");
  8993. pragmas: [],
  8994. messageSends: ["add:"]
  8995. }, function ($methodClass){ return function (anObject){
  8996. var self=this,$self=this;
  8997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8998. return $core.withContext(function($ctx1) {
  8999. //>>excludeEnd("ctx");
  9000. $recv($self.write)._add_(anObject);
  9001. return self;
  9002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9003. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9004. //>>excludeEnd("ctx");
  9005. }; }),
  9006. $globals.Queue);
  9007. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9008. //>>excludeStart("ide", pragmas.excludeIdeData);
  9009. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9010. //>>excludeEnd("ide");
  9011. $core.addMethod(
  9012. $core.method({
  9013. selector: "compile:",
  9014. protocol: "evaluating",
  9015. //>>excludeStart("ide", pragmas.excludeIdeData);
  9016. args: ["aString"],
  9017. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9018. referencedClasses: [],
  9019. //>>excludeEnd("ide");
  9020. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9021. messageSends: []
  9022. }, function ($methodClass){ return function (aString){
  9023. var self=this,$self=this;
  9024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9025. return $core.withContext(function($ctx1) {
  9026. //>>excludeEnd("ctx");
  9027. return self.compile(aString);
  9028. return self;
  9029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9030. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9031. //>>excludeEnd("ctx");
  9032. }; }),
  9033. $globals.RegularExpression);
  9034. $core.addMethod(
  9035. $core.method({
  9036. selector: "exec:",
  9037. protocol: "evaluating",
  9038. //>>excludeStart("ide", pragmas.excludeIdeData);
  9039. args: ["aString"],
  9040. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9041. referencedClasses: [],
  9042. //>>excludeEnd("ide");
  9043. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9044. messageSends: []
  9045. }, function ($methodClass){ return function (aString){
  9046. var self=this,$self=this;
  9047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9048. return $core.withContext(function($ctx1) {
  9049. //>>excludeEnd("ctx");
  9050. return self.exec(aString) || nil;
  9051. return self;
  9052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9053. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9054. //>>excludeEnd("ctx");
  9055. }; }),
  9056. $globals.RegularExpression);
  9057. $core.addMethod(
  9058. $core.method({
  9059. selector: "test:",
  9060. protocol: "evaluating",
  9061. //>>excludeStart("ide", pragmas.excludeIdeData);
  9062. args: ["aString"],
  9063. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9064. referencedClasses: [],
  9065. //>>excludeEnd("ide");
  9066. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9067. messageSends: []
  9068. }, function ($methodClass){ return function (aString){
  9069. var self=this,$self=this;
  9070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9071. return $core.withContext(function($ctx1) {
  9072. //>>excludeEnd("ctx");
  9073. return self.test(aString);
  9074. return self;
  9075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9076. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9077. //>>excludeEnd("ctx");
  9078. }; }),
  9079. $globals.RegularExpression);
  9080. $core.addMethod(
  9081. $core.method({
  9082. selector: "fromString:",
  9083. protocol: "instance creation",
  9084. //>>excludeStart("ide", pragmas.excludeIdeData);
  9085. args: ["aString"],
  9086. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9087. referencedClasses: [],
  9088. //>>excludeEnd("ide");
  9089. pragmas: [],
  9090. messageSends: ["fromString:flag:"]
  9091. }, function ($methodClass){ return function (aString){
  9092. var self=this,$self=this;
  9093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9094. return $core.withContext(function($ctx1) {
  9095. //>>excludeEnd("ctx");
  9096. return $self._fromString_flag_(aString,"");
  9097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9098. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9099. //>>excludeEnd("ctx");
  9100. }; }),
  9101. $globals.RegularExpression.a$cls);
  9102. $core.addMethod(
  9103. $core.method({
  9104. selector: "fromString:flag:",
  9105. protocol: "instance creation",
  9106. //>>excludeStart("ide", pragmas.excludeIdeData);
  9107. args: ["aString", "anotherString"],
  9108. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9109. referencedClasses: [],
  9110. //>>excludeEnd("ide");
  9111. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9112. messageSends: []
  9113. }, function ($methodClass){ return function (aString,anotherString){
  9114. var self=this,$self=this;
  9115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9116. return $core.withContext(function($ctx1) {
  9117. //>>excludeEnd("ctx");
  9118. return new RegExp(aString, anotherString);
  9119. return self;
  9120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9121. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9122. //>>excludeEnd("ctx");
  9123. }; }),
  9124. $globals.RegularExpression.a$cls);
  9125. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9126. $core.addMethod(
  9127. $core.method({
  9128. selector: "at:",
  9129. protocol: "accessing",
  9130. //>>excludeStart("ide", pragmas.excludeIdeData);
  9131. args: ["anIndex"],
  9132. 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 ]",
  9133. referencedClasses: [],
  9134. //>>excludeEnd("ide");
  9135. pragmas: [],
  9136. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9137. }, function ($methodClass){ return function (anIndex){
  9138. var self=this,$self=this;
  9139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9140. return $core.withContext(function($ctx1) {
  9141. //>>excludeEnd("ctx");
  9142. return $self._at_ifAbsent_(anIndex,(function(){
  9143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9144. return $core.withContext(function($ctx2) {
  9145. //>>excludeEnd("ctx");
  9146. return $self._errorNotFound();
  9147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9149. //>>excludeEnd("ctx");
  9150. }));
  9151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9152. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9153. //>>excludeEnd("ctx");
  9154. }; }),
  9155. $globals.TKeyValueCollection);
  9156. $core.addMethod(
  9157. $core.method({
  9158. selector: "at:ifAbsent:",
  9159. protocol: "accessing",
  9160. //>>excludeStart("ide", pragmas.excludeIdeData);
  9161. args: ["anIndex", "aBlock"],
  9162. 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",
  9163. referencedClasses: [],
  9164. //>>excludeEnd("ide");
  9165. pragmas: [],
  9166. messageSends: ["subclassResponsibility"]
  9167. }, function ($methodClass){ return function (anIndex,aBlock){
  9168. var self=this,$self=this;
  9169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9170. return $core.withContext(function($ctx1) {
  9171. //>>excludeEnd("ctx");
  9172. $self._subclassResponsibility();
  9173. return self;
  9174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9175. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9176. //>>excludeEnd("ctx");
  9177. }; }),
  9178. $globals.TKeyValueCollection);
  9179. $core.addMethod(
  9180. $core.method({
  9181. selector: "at:ifAbsentPut:",
  9182. protocol: "accessing",
  9183. //>>excludeStart("ide", pragmas.excludeIdeData);
  9184. args: ["aKey", "aBlock"],
  9185. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9186. referencedClasses: [],
  9187. //>>excludeEnd("ide");
  9188. pragmas: [],
  9189. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9190. }, function ($methodClass){ return function (aKey,aBlock){
  9191. var self=this,$self=this;
  9192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9193. return $core.withContext(function($ctx1) {
  9194. //>>excludeEnd("ctx");
  9195. return $self._at_ifAbsent_(aKey,(function(){
  9196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9197. return $core.withContext(function($ctx2) {
  9198. //>>excludeEnd("ctx");
  9199. return $self._at_put_(aKey,$recv(aBlock)._value());
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9202. //>>excludeEnd("ctx");
  9203. }));
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9206. //>>excludeEnd("ctx");
  9207. }; }),
  9208. $globals.TKeyValueCollection);
  9209. $core.addMethod(
  9210. $core.method({
  9211. selector: "at:ifPresent:",
  9212. protocol: "accessing",
  9213. //>>excludeStart("ide", pragmas.excludeIdeData);
  9214. args: ["anIndex", "aBlock"],
  9215. 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 ]",
  9216. referencedClasses: [],
  9217. //>>excludeEnd("ide");
  9218. pragmas: [],
  9219. messageSends: ["at:ifPresent:ifAbsent:"]
  9220. }, function ($methodClass){ return function (anIndex,aBlock){
  9221. var self=this,$self=this;
  9222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9223. return $core.withContext(function($ctx1) {
  9224. //>>excludeEnd("ctx");
  9225. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9226. return nil;
  9227. }));
  9228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9229. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9230. //>>excludeEnd("ctx");
  9231. }; }),
  9232. $globals.TKeyValueCollection);
  9233. $core.addMethod(
  9234. $core.method({
  9235. selector: "at:ifPresent:ifAbsent:",
  9236. protocol: "accessing",
  9237. //>>excludeStart("ide", pragmas.excludeIdeData);
  9238. args: ["anIndex", "aBlock", "anotherBlock"],
  9239. 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",
  9240. referencedClasses: [],
  9241. //>>excludeEnd("ide");
  9242. pragmas: [],
  9243. messageSends: ["subclassResponsibility"]
  9244. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9245. var self=this,$self=this;
  9246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9247. return $core.withContext(function($ctx1) {
  9248. //>>excludeEnd("ctx");
  9249. $self._subclassResponsibility();
  9250. return self;
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9253. //>>excludeEnd("ctx");
  9254. }; }),
  9255. $globals.TKeyValueCollection);
  9256. $core.addMethod(
  9257. $core.method({
  9258. selector: "at:put:",
  9259. protocol: "accessing",
  9260. //>>excludeStart("ide", pragmas.excludeIdeData);
  9261. args: ["anIndex", "anObject"],
  9262. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9263. referencedClasses: [],
  9264. //>>excludeEnd("ide");
  9265. pragmas: [],
  9266. messageSends: ["subclassResponsibility"]
  9267. }, function ($methodClass){ return function (anIndex,anObject){
  9268. var self=this,$self=this;
  9269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9270. return $core.withContext(function($ctx1) {
  9271. //>>excludeEnd("ctx");
  9272. $self._subclassResponsibility();
  9273. return self;
  9274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9275. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9276. //>>excludeEnd("ctx");
  9277. }; }),
  9278. $globals.TKeyValueCollection);
  9279. $core.addMethod(
  9280. $core.method({
  9281. selector: "indexOf:",
  9282. protocol: "accessing",
  9283. //>>excludeStart("ide", pragmas.excludeIdeData);
  9284. args: ["anObject"],
  9285. 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 ]",
  9286. referencedClasses: [],
  9287. //>>excludeEnd("ide");
  9288. pragmas: [],
  9289. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9290. }, function ($methodClass){ return function (anObject){
  9291. var self=this,$self=this;
  9292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9293. return $core.withContext(function($ctx1) {
  9294. //>>excludeEnd("ctx");
  9295. return $self._indexOf_ifAbsent_(anObject,(function(){
  9296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9297. return $core.withContext(function($ctx2) {
  9298. //>>excludeEnd("ctx");
  9299. return $self._errorNotFound();
  9300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9302. //>>excludeEnd("ctx");
  9303. }));
  9304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9305. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9306. //>>excludeEnd("ctx");
  9307. }; }),
  9308. $globals.TKeyValueCollection);
  9309. $core.addMethod(
  9310. $core.method({
  9311. selector: "indexOf:ifAbsent:",
  9312. protocol: "accessing",
  9313. //>>excludeStart("ide", pragmas.excludeIdeData);
  9314. args: ["anObject", "aBlock"],
  9315. 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",
  9316. referencedClasses: [],
  9317. //>>excludeEnd("ide");
  9318. pragmas: [],
  9319. messageSends: ["subclassResponsibility"]
  9320. }, function ($methodClass){ return function (anObject,aBlock){
  9321. var self=this,$self=this;
  9322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9323. return $core.withContext(function($ctx1) {
  9324. //>>excludeEnd("ctx");
  9325. $self._subclassResponsibility();
  9326. return self;
  9327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9328. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9329. //>>excludeEnd("ctx");
  9330. }; }),
  9331. $globals.TKeyValueCollection);
  9332. $core.addMethod(
  9333. $core.method({
  9334. selector: "with:do:",
  9335. protocol: "enumerating",
  9336. //>>excludeStart("ide", pragmas.excludeIdeData);
  9337. args: ["anotherCollection", "aBlock"],
  9338. 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) ]",
  9339. referencedClasses: [],
  9340. //>>excludeEnd("ide");
  9341. pragmas: [],
  9342. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9343. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9344. var self=this,$self=this;
  9345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9346. return $core.withContext(function($ctx1) {
  9347. //>>excludeEnd("ctx");
  9348. $self._withIndexDo_((function(each,index){
  9349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9350. return $core.withContext(function($ctx2) {
  9351. //>>excludeEnd("ctx");
  9352. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9354. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9355. //>>excludeEnd("ctx");
  9356. }));
  9357. return self;
  9358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9359. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9360. //>>excludeEnd("ctx");
  9361. }; }),
  9362. $globals.TKeyValueCollection);
  9363. $core.addMethod(
  9364. $core.method({
  9365. selector: "withIndexDo:",
  9366. protocol: "enumerating",
  9367. //>>excludeStart("ide", pragmas.excludeIdeData);
  9368. args: ["aBlock"],
  9369. 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",
  9370. referencedClasses: [],
  9371. //>>excludeEnd("ide");
  9372. pragmas: [],
  9373. messageSends: ["subclassResponsibility"]
  9374. }, function ($methodClass){ return function (aBlock){
  9375. var self=this,$self=this;
  9376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9377. return $core.withContext(function($ctx1) {
  9378. //>>excludeEnd("ctx");
  9379. $self._subclassResponsibility();
  9380. return self;
  9381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9382. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9383. //>>excludeEnd("ctx");
  9384. }; }),
  9385. $globals.TKeyValueCollection);
  9386. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9387. $core.addMethod(
  9388. $core.method({
  9389. selector: "at:ifAbsent:",
  9390. protocol: "accessing",
  9391. //>>excludeStart("ide", pragmas.excludeIdeData);
  9392. args: ["anIndex", "aBlock"],
  9393. 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'>",
  9394. referencedClasses: [],
  9395. //>>excludeEnd("ide");
  9396. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09"]]],
  9397. messageSends: []
  9398. }, function ($methodClass){ return function (anIndex,aBlock){
  9399. var self=this,$self=this;
  9400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9401. return $core.withContext(function($ctx1) {
  9402. //>>excludeEnd("ctx");
  9403. return anIndex >= 1 && anIndex <= self.length
  9404. ? self[anIndex - 1]
  9405. : aBlock._value()
  9406. ;
  9407. return self;
  9408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9409. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9410. //>>excludeEnd("ctx");
  9411. }; }),
  9412. $globals.TNativeZeroBasedCollection);
  9413. $core.addMethod(
  9414. $core.method({
  9415. selector: "at:ifPresent:ifAbsent:",
  9416. protocol: "accessing",
  9417. //>>excludeStart("ide", pragmas.excludeIdeData);
  9418. args: ["anIndex", "aBlock", "anotherBlock"],
  9419. 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'>",
  9420. referencedClasses: [],
  9421. //>>excludeEnd("ide");
  9422. pragmas: [["inlineJS:", ["\x0a\x09\x09return anIndex >= 1 && anIndex <= self.length\x0a\x09\x09\x09? aBlock._value_(self[anIndex - 1])\x0a\x09\x09\x09: anotherBlock._value()\x0a\x09"]]],
  9423. messageSends: []
  9424. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9425. var self=this,$self=this;
  9426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9427. return $core.withContext(function($ctx1) {
  9428. //>>excludeEnd("ctx");
  9429. return anIndex >= 1 && anIndex <= self.length
  9430. ? aBlock._value_(self[anIndex - 1])
  9431. : anotherBlock._value()
  9432. ;
  9433. return self;
  9434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9435. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9436. //>>excludeEnd("ctx");
  9437. }; }),
  9438. $globals.TNativeZeroBasedCollection);
  9439. $core.addMethod(
  9440. $core.method({
  9441. selector: "detect:ifNone:",
  9442. protocol: "enumerating",
  9443. //>>excludeStart("ide", pragmas.excludeIdeData);
  9444. args: ["aBlock", "anotherBlock"],
  9445. 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'>",
  9446. referencedClasses: [],
  9447. //>>excludeEnd("ide");
  9448. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock._value_(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock._value();\x0a\x09"]]],
  9449. messageSends: []
  9450. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9451. var self=this,$self=this;
  9452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9453. return $core.withContext(function($ctx1) {
  9454. //>>excludeEnd("ctx");
  9455. for(var i = 0; i < self.length; i++)
  9456. if(aBlock._value_(self[i]))
  9457. return self[i];
  9458. return anotherBlock._value();
  9459. ;
  9460. return self;
  9461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9462. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9463. //>>excludeEnd("ctx");
  9464. }; }),
  9465. $globals.TNativeZeroBasedCollection);
  9466. $core.addMethod(
  9467. $core.method({
  9468. selector: "do:",
  9469. protocol: "enumerating",
  9470. //>>excludeStart("ide", pragmas.excludeIdeData);
  9471. args: ["aBlock"],
  9472. 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'>",
  9473. referencedClasses: [],
  9474. //>>excludeEnd("ide");
  9475. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9476. messageSends: []
  9477. }, function ($methodClass){ return function (aBlock){
  9478. var self=this,$self=this;
  9479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9480. return $core.withContext(function($ctx1) {
  9481. //>>excludeEnd("ctx");
  9482. for(var i=0; i < self.length; i++) {
  9483. aBlock._value_(self[i]);
  9484. }
  9485. ;
  9486. return self;
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9489. //>>excludeEnd("ctx");
  9490. }; }),
  9491. $globals.TNativeZeroBasedCollection);
  9492. $core.addMethod(
  9493. $core.method({
  9494. selector: "indexOf:ifAbsent:",
  9495. protocol: "accessing",
  9496. //>>excludeStart("ide", pragmas.excludeIdeData);
  9497. args: ["anObject", "aBlock"],
  9498. 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'>",
  9499. referencedClasses: [],
  9500. //>>excludeEnd("ide");
  9501. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  9502. messageSends: []
  9503. }, function ($methodClass){ return function (anObject,aBlock){
  9504. var self=this,$self=this;
  9505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9506. return $core.withContext(function($ctx1) {
  9507. //>>excludeEnd("ctx");
  9508. for(var i=0; i < self.length; i++) {
  9509. if($recv(self[i]).__eq(anObject)) {return i+1}
  9510. };
  9511. return aBlock._value();
  9512. ;
  9513. return self;
  9514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9515. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9516. //>>excludeEnd("ctx");
  9517. }; }),
  9518. $globals.TNativeZeroBasedCollection);
  9519. $core.addMethod(
  9520. $core.method({
  9521. selector: "indexOf:startingAt:ifAbsent:",
  9522. protocol: "accessing",
  9523. //>>excludeStart("ide", pragmas.excludeIdeData);
  9524. args: ["anObject", "start", "aBlock"],
  9525. 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'>",
  9526. referencedClasses: [],
  9527. //>>excludeEnd("ide");
  9528. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=start - 1; i < self.length; i++){\x0a\x09\x09\x09if($recv(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09"]]],
  9529. messageSends: []
  9530. }, function ($methodClass){ return function (anObject,start,aBlock){
  9531. var self=this,$self=this;
  9532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9533. return $core.withContext(function($ctx1) {
  9534. //>>excludeEnd("ctx");
  9535. for(var i=start - 1; i < self.length; i++){
  9536. if($recv(self[i]).__eq(anObject)) {return i+1}
  9537. }
  9538. return aBlock._value();
  9539. ;
  9540. return self;
  9541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9542. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9543. //>>excludeEnd("ctx");
  9544. }; }),
  9545. $globals.TNativeZeroBasedCollection);
  9546. $core.addMethod(
  9547. $core.method({
  9548. selector: "single",
  9549. protocol: "accessing",
  9550. //>>excludeStart("ide", pragmas.excludeIdeData);
  9551. args: [],
  9552. 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'>",
  9553. referencedClasses: [],
  9554. //>>excludeEnd("ide");
  9555. pragmas: [["inlineJS:", ["\x0a\x09if (self.length == 0) throw new Error(\x22Collection is empty\x22);\x0a\x09if (self.length > 1) throw new Error(\x22Collection holds more than one element.\x22);\x0a\x09return self[0];"]]],
  9556. messageSends: []
  9557. }, function ($methodClass){ return function (){
  9558. var self=this,$self=this;
  9559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9560. return $core.withContext(function($ctx1) {
  9561. //>>excludeEnd("ctx");
  9562. if (self.length == 0) throw new Error("Collection is empty");
  9563. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9564. return self[0];;
  9565. return self;
  9566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9567. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9568. //>>excludeEnd("ctx");
  9569. }; }),
  9570. $globals.TNativeZeroBasedCollection);
  9571. $core.addMethod(
  9572. $core.method({
  9573. selector: "size",
  9574. protocol: "accessing",
  9575. //>>excludeStart("ide", pragmas.excludeIdeData);
  9576. args: [],
  9577. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9578. referencedClasses: [],
  9579. //>>excludeEnd("ide");
  9580. pragmas: [["inlineJS:", ["return self.length"]]],
  9581. messageSends: []
  9582. }, function ($methodClass){ return function (){
  9583. var self=this,$self=this;
  9584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9585. return $core.withContext(function($ctx1) {
  9586. //>>excludeEnd("ctx");
  9587. return self.length;
  9588. return self;
  9589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9590. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9591. //>>excludeEnd("ctx");
  9592. }; }),
  9593. $globals.TNativeZeroBasedCollection);
  9594. $core.addMethod(
  9595. $core.method({
  9596. selector: "with:do:",
  9597. protocol: "enumerating",
  9598. //>>excludeStart("ide", pragmas.excludeIdeData);
  9599. args: ["anotherCollection", "aBlock"],
  9600. 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'>",
  9601. referencedClasses: [],
  9602. //>>excludeEnd("ide");
  9603. pragmas: [["inlineJS:", ["\x0a\x09 $recv(anotherCollection)._first_(0); // #guardSequenceableCollection\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], anotherCollection[i]);\x0a\x09\x09}\x0a\x09"]]],
  9604. messageSends: []
  9605. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9606. var self=this,$self=this;
  9607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9608. return $core.withContext(function($ctx1) {
  9609. //>>excludeEnd("ctx");
  9610. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9611. for(var i=0; i<self.length; i++) {
  9612. aBlock._value_value_(self[i], anotherCollection[i]);
  9613. }
  9614. ;
  9615. return self;
  9616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9617. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9618. //>>excludeEnd("ctx");
  9619. }; }),
  9620. $globals.TNativeZeroBasedCollection);
  9621. $core.addMethod(
  9622. $core.method({
  9623. selector: "withIndexDo:",
  9624. protocol: "enumerating",
  9625. //>>excludeStart("ide", pragmas.excludeIdeData);
  9626. args: ["aBlock"],
  9627. 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'>",
  9628. referencedClasses: [],
  9629. //>>excludeEnd("ide");
  9630. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_value_(self[i], i+1);\x0a\x09\x09}\x0a\x09"]]],
  9631. messageSends: []
  9632. }, function ($methodClass){ return function (aBlock){
  9633. var self=this,$self=this;
  9634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9635. return $core.withContext(function($ctx1) {
  9636. //>>excludeEnd("ctx");
  9637. for(var i=0; i < self.length; i++) {
  9638. aBlock._value_value_(self[i], i+1);
  9639. }
  9640. ;
  9641. return self;
  9642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9643. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9644. //>>excludeEnd("ctx");
  9645. }; }),
  9646. $globals.TNativeZeroBasedCollection);
  9647. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9648. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9649. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9650. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9651. });