Kernel-Collections.js 349 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anAssociation"],
  16. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["and:", "=", "class", "key", "value"]
  21. }, function ($methodClass){ return function (anAssociation){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. var $3,$2,$5,$4,$6,$1;
  27. $3=$self._class();
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. $ctx1.sendIdx["class"]=1;
  30. //>>excludeEnd("ctx");
  31. $2=$recv($3).__eq($recv(anAssociation)._class());
  32. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33. $ctx1.sendIdx["="]=1;
  34. //>>excludeEnd("ctx");
  35. $1=$recv($2)._and_((function(){
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. return $core.withContext(function($ctx2) {
  38. //>>excludeEnd("ctx");
  39. $5=$self._key();
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. $ctx2.sendIdx["key"]=1;
  42. //>>excludeEnd("ctx");
  43. $4=$recv($5).__eq($recv(anAssociation)._key());
  44. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45. $ctx2.sendIdx["="]=2;
  46. //>>excludeEnd("ctx");
  47. return $recv($4)._and_((function(){
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. return $core.withContext(function($ctx3) {
  50. //>>excludeEnd("ctx");
  51. $6=$self._value();
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. $ctx3.sendIdx["value"]=1;
  54. //>>excludeEnd("ctx");
  55. return $recv($6).__eq($recv(anAssociation)._value());
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  58. //>>excludeEnd("ctx");
  59. }));
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62. //>>excludeEnd("ctx");
  63. }));
  64. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  65. $ctx1.sendIdx["and:"]=1;
  66. //>>excludeEnd("ctx");
  67. return $1;
  68. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  69. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  70. //>>excludeEnd("ctx");
  71. }; }),
  72. $globals.Association);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "key",
  76. protocol: "accessing",
  77. //>>excludeStart("ide", pragmas.excludeIdeData);
  78. args: [],
  79. source: "key\x0a\x09^ key",
  80. referencedClasses: [],
  81. //>>excludeEnd("ide");
  82. pragmas: [],
  83. messageSends: []
  84. }, function ($methodClass){ return function (){
  85. var self=this,$self=this;
  86. return $self.key;
  87. }; }),
  88. $globals.Association);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "key:",
  92. protocol: "accessing",
  93. //>>excludeStart("ide", pragmas.excludeIdeData);
  94. args: ["aKey"],
  95. source: "key: aKey\x0a\x09key := aKey",
  96. referencedClasses: [],
  97. //>>excludeEnd("ide");
  98. pragmas: [],
  99. messageSends: []
  100. }, function ($methodClass){ return function (aKey){
  101. var self=this,$self=this;
  102. $self.key=aKey;
  103. return self;
  104. }; }),
  105. $globals.Association);
  106. $core.addMethod(
  107. $core.method({
  108. selector: "printOn:",
  109. protocol: "printing",
  110. //>>excludeStart("ide", pragmas.excludeIdeData);
  111. args: ["aStream"],
  112. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  113. referencedClasses: [],
  114. //>>excludeEnd("ide");
  115. pragmas: [],
  116. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  117. }, function ($methodClass){ return function (aStream){
  118. var self=this,$self=this;
  119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  120. return $core.withContext(function($ctx1) {
  121. //>>excludeEnd("ctx");
  122. $recv($self._key())._printOn_(aStream);
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. $ctx1.sendIdx["printOn:"]=1;
  125. //>>excludeEnd("ctx");
  126. $recv(aStream)._nextPutAll_(" -> ");
  127. $recv($self._value())._printOn_(aStream);
  128. return self;
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  131. //>>excludeEnd("ctx");
  132. }; }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: "accessing",
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: [],
  140. source: "value\x0a\x09^ value",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. pragmas: [],
  144. messageSends: []
  145. }, function ($methodClass){ return function (){
  146. var self=this,$self=this;
  147. return $self.value;
  148. }; }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: "accessing",
  154. //>>excludeStart("ide", pragmas.excludeIdeData);
  155. args: ["aValue"],
  156. source: "value: aValue\x0a\x09value := aValue",
  157. referencedClasses: [],
  158. //>>excludeEnd("ide");
  159. pragmas: [],
  160. messageSends: []
  161. }, function ($methodClass){ return function (aValue){
  162. var self=this,$self=this;
  163. $self.value=aValue;
  164. return self;
  165. }; }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: "instance creation",
  171. //>>excludeStart("ide", pragmas.excludeIdeData);
  172. args: ["aKey", "aValue"],
  173. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  174. referencedClasses: [],
  175. //>>excludeEnd("ide");
  176. pragmas: [],
  177. messageSends: ["key:", "new", "value:", "yourself"]
  178. }, function ($methodClass){ return function (aKey,aValue){
  179. var self=this,$self=this;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. return $core.withContext(function($ctx1) {
  182. //>>excludeEnd("ctx");
  183. var $1;
  184. $1=$self._new();
  185. $recv($1)._key_(aKey);
  186. $recv($1)._value_(aValue);
  187. return $recv($1)._yourself();
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  190. //>>excludeEnd("ctx");
  191. }; }),
  192. $globals.Association.a$cls);
  193. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: "accessing",
  201. //>>excludeStart("ide", pragmas.excludeIdeData);
  202. args: ["anObject"],
  203. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  204. referencedClasses: [],
  205. //>>excludeEnd("ide");
  206. pragmas: [["inlineJS:", ["\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09"]]],
  207. messageSends: []
  208. }, function ($methodClass){ return function (anObject){
  209. var self=this,$self=this;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. return $core.withContext(function($ctx1) {
  212. //>>excludeEnd("ctx");
  213. var hash = $self.hashBlock(anObject);
  214. if (!hash) return null;
  215. var buckets = $self.buckets,
  216. bucket = buckets[hash];
  217. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  218. return bucket;
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  223. //>>excludeEnd("ctx");
  224. }; }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: "enumerating",
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["aBlock"],
  232. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. pragmas: [["inlineJS:", ["\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09"]]],
  236. messageSends: []
  237. }, function ($methodClass){ return function (aBlock){
  238. var self=this,$self=this;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. return $core.withContext(function($ctx1) {
  241. //>>excludeEnd("ctx");
  242. var buckets = $self.buckets;
  243. var keys = Object.keys(buckets);
  244. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  245. ;
  246. return self;
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  249. //>>excludeEnd("ctx");
  250. }; }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: "accessing",
  256. //>>excludeStart("ide", pragmas.excludeIdeData);
  257. args: ["aBlock"],
  258. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  259. referencedClasses: [],
  260. //>>excludeEnd("ide");
  261. pragmas: [],
  262. messageSends: []
  263. }, function ($methodClass){ return function (aBlock){
  264. var self=this,$self=this;
  265. $self.hashBlock=aBlock;
  266. return self;
  267. }; }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: "initialization",
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. pragmas: [],
  279. messageSends: ["initialize", "removeAll"]
  280. }, function ($methodClass){ return function (){
  281. var self=this,$self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. (
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. $ctx1.supercall = true,
  288. //>>excludeEnd("ctx");
  289. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. $ctx1.supercall = false;
  292. //>>excludeEnd("ctx");;
  293. $self._removeAll();
  294. return self;
  295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  296. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  297. //>>excludeEnd("ctx");
  298. }; }),
  299. $globals.BucketStore);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "newBucket",
  303. protocol: "private",
  304. //>>excludeStart("ide", pragmas.excludeIdeData);
  305. args: [],
  306. source: "newBucket\x0a\x09self subclassResponsibility",
  307. referencedClasses: [],
  308. //>>excludeEnd("ide");
  309. pragmas: [],
  310. messageSends: ["subclassResponsibility"]
  311. }, function ($methodClass){ return function (){
  312. var self=this,$self=this;
  313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  314. return $core.withContext(function($ctx1) {
  315. //>>excludeEnd("ctx");
  316. $self._subclassResponsibility();
  317. return self;
  318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  319. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  320. //>>excludeEnd("ctx");
  321. }; }),
  322. $globals.BucketStore);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "removeAll",
  326. protocol: "adding/removing",
  327. //>>excludeStart("ide", pragmas.excludeIdeData);
  328. args: [],
  329. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  330. referencedClasses: [],
  331. //>>excludeEnd("ide");
  332. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  333. messageSends: []
  334. }, function ($methodClass){ return function (){
  335. var self=this,$self=this;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. return $core.withContext(function($ctx1) {
  338. //>>excludeEnd("ctx");
  339. $self.buckets = Object.create(null);;
  340. return self;
  341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  342. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  343. //>>excludeEnd("ctx");
  344. }; }),
  345. $globals.BucketStore);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "hashBlock:",
  349. protocol: "instance creation",
  350. //>>excludeStart("ide", pragmas.excludeIdeData);
  351. args: ["aBlock"],
  352. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  353. referencedClasses: [],
  354. //>>excludeEnd("ide");
  355. pragmas: [],
  356. messageSends: ["hashBlock:", "new", "yourself"]
  357. }, function ($methodClass){ return function (aBlock){
  358. var self=this,$self=this;
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. return $core.withContext(function($ctx1) {
  361. //>>excludeEnd("ctx");
  362. var $1;
  363. $1=$self._new();
  364. $recv($1)._hashBlock_(aBlock);
  365. return $recv($1)._yourself();
  366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  367. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  368. //>>excludeEnd("ctx");
  369. }; }),
  370. $globals.BucketStore.a$cls);
  371. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  372. //>>excludeStart("ide", pragmas.excludeIdeData);
  373. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  374. //>>excludeEnd("ide");
  375. $core.addMethod(
  376. $core.method({
  377. selector: "newBucket",
  378. protocol: "private",
  379. //>>excludeStart("ide", pragmas.excludeIdeData);
  380. args: [],
  381. source: "newBucket\x0a\x09^ #()",
  382. referencedClasses: [],
  383. //>>excludeEnd("ide");
  384. pragmas: [],
  385. messageSends: []
  386. }, function ($methodClass){ return function (){
  387. var self=this,$self=this;
  388. return [];
  389. }; }),
  390. $globals.ArrayBucketStore);
  391. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  394. //>>excludeEnd("ide");
  395. $core.addMethod(
  396. $core.method({
  397. selector: ",",
  398. protocol: "copying",
  399. //>>excludeStart("ide", pragmas.excludeIdeData);
  400. args: ["aCollection"],
  401. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  402. referencedClasses: [],
  403. //>>excludeEnd("ide");
  404. pragmas: [],
  405. messageSends: ["addAll:", "copy", "yourself"]
  406. }, function ($methodClass){ return function (aCollection){
  407. var self=this,$self=this;
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. return $core.withContext(function($ctx1) {
  410. //>>excludeEnd("ctx");
  411. var $1;
  412. $1=$self._copy();
  413. $recv($1)._addAll_(aCollection);
  414. return $recv($1)._yourself();
  415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  416. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  417. //>>excludeEnd("ctx");
  418. }; }),
  419. $globals.Collection);
  420. $core.addMethod(
  421. $core.method({
  422. selector: "add:",
  423. protocol: "adding/removing",
  424. //>>excludeStart("ide", pragmas.excludeIdeData);
  425. args: ["anObject"],
  426. source: "add: anObject\x0a\x09self subclassResponsibility",
  427. referencedClasses: [],
  428. //>>excludeEnd("ide");
  429. pragmas: [],
  430. messageSends: ["subclassResponsibility"]
  431. }, function ($methodClass){ return function (anObject){
  432. var self=this,$self=this;
  433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  434. return $core.withContext(function($ctx1) {
  435. //>>excludeEnd("ctx");
  436. $self._subclassResponsibility();
  437. return self;
  438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  439. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  440. //>>excludeEnd("ctx");
  441. }; }),
  442. $globals.Collection);
  443. $core.addMethod(
  444. $core.method({
  445. selector: "addAll:",
  446. protocol: "adding/removing",
  447. //>>excludeStart("ide", pragmas.excludeIdeData);
  448. args: ["aCollection"],
  449. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  450. referencedClasses: [],
  451. //>>excludeEnd("ide");
  452. pragmas: [],
  453. messageSends: ["do:", "add:"]
  454. }, function ($methodClass){ return function (aCollection){
  455. var self=this,$self=this;
  456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  457. return $core.withContext(function($ctx1) {
  458. //>>excludeEnd("ctx");
  459. $recv(aCollection)._do_((function(each){
  460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  461. return $core.withContext(function($ctx2) {
  462. //>>excludeEnd("ctx");
  463. return $self._add_(each);
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  466. //>>excludeEnd("ctx");
  467. }));
  468. return aCollection;
  469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  470. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  471. //>>excludeEnd("ctx");
  472. }; }),
  473. $globals.Collection);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "allSatisfy:",
  477. protocol: "enumerating",
  478. //>>excludeStart("ide", pragmas.excludeIdeData);
  479. args: ["aBlock"],
  480. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  481. referencedClasses: [],
  482. //>>excludeEnd("ide");
  483. pragmas: [],
  484. messageSends: ["do:", "ifFalse:", "value:"]
  485. }, function ($methodClass){ return function (aBlock){
  486. var self=this,$self=this;
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx1) {
  489. //>>excludeEnd("ctx");
  490. var $1;
  491. var $early={};
  492. try {
  493. $self._do_((function(each){
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx2) {
  496. //>>excludeEnd("ctx");
  497. $1=$recv(aBlock)._value_(each);
  498. if(!$core.assert($1)){
  499. throw $early=[false];
  500. }
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  503. //>>excludeEnd("ctx");
  504. }));
  505. return true;
  506. }
  507. catch(e) {if(e===$early)return e[0]; throw e}
  508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  509. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  510. //>>excludeEnd("ctx");
  511. }; }),
  512. $globals.Collection);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "anyOne",
  516. protocol: "accessing",
  517. //>>excludeStart("ide", pragmas.excludeIdeData);
  518. args: [],
  519. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  520. referencedClasses: [],
  521. //>>excludeEnd("ide");
  522. pragmas: [],
  523. messageSends: ["ifEmpty:", "error:", "do:"]
  524. }, function ($methodClass){ return function (){
  525. var self=this,$self=this;
  526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  527. return $core.withContext(function($ctx1) {
  528. //>>excludeEnd("ctx");
  529. var $early={};
  530. try {
  531. $self._ifEmpty_((function(){
  532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  533. return $core.withContext(function($ctx2) {
  534. //>>excludeEnd("ctx");
  535. return $self._error_("Collection is empty");
  536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  538. //>>excludeEnd("ctx");
  539. }));
  540. $self._do_((function(each){
  541. throw $early=[each];
  542. }));
  543. return self;
  544. }
  545. catch(e) {if(e===$early)return e[0]; throw e}
  546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  547. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  548. //>>excludeEnd("ctx");
  549. }; }),
  550. $globals.Collection);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "anySatisfy:",
  554. protocol: "enumerating",
  555. //>>excludeStart("ide", pragmas.excludeIdeData);
  556. args: ["aBlock"],
  557. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  558. referencedClasses: [],
  559. //>>excludeEnd("ide");
  560. pragmas: [],
  561. messageSends: ["do:", "ifTrue:", "value:"]
  562. }, function ($methodClass){ return function (aBlock){
  563. var self=this,$self=this;
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. return $core.withContext(function($ctx1) {
  566. //>>excludeEnd("ctx");
  567. var $1;
  568. var $early={};
  569. try {
  570. $self._do_((function(each){
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. return $core.withContext(function($ctx2) {
  573. //>>excludeEnd("ctx");
  574. $1=$recv(aBlock)._value_(each);
  575. if($core.assert($1)){
  576. throw $early=[true];
  577. }
  578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  580. //>>excludeEnd("ctx");
  581. }));
  582. return false;
  583. }
  584. catch(e) {if(e===$early)return e[0]; throw e}
  585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  586. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  587. //>>excludeEnd("ctx");
  588. }; }),
  589. $globals.Collection);
  590. $core.addMethod(
  591. $core.method({
  592. selector: "asArray",
  593. protocol: "converting",
  594. //>>excludeStart("ide", pragmas.excludeIdeData);
  595. args: [],
  596. source: "asArray\x0a\x09^ Array withAll: self",
  597. referencedClasses: ["Array"],
  598. //>>excludeEnd("ide");
  599. pragmas: [],
  600. messageSends: ["withAll:"]
  601. }, function ($methodClass){ return function (){
  602. var self=this,$self=this;
  603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  604. return $core.withContext(function($ctx1) {
  605. //>>excludeEnd("ctx");
  606. return $recv($globals.Array)._withAll_(self);
  607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  608. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  609. //>>excludeEnd("ctx");
  610. }; }),
  611. $globals.Collection);
  612. $core.addMethod(
  613. $core.method({
  614. selector: "asJavaScriptObject",
  615. protocol: "converting",
  616. //>>excludeStart("ide", pragmas.excludeIdeData);
  617. args: [],
  618. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  619. referencedClasses: [],
  620. //>>excludeEnd("ide");
  621. pragmas: [],
  622. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  623. }, function ($methodClass){ return function (){
  624. var self=this,$self=this;
  625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  626. return $core.withContext(function($ctx1) {
  627. //>>excludeEnd("ctx");
  628. return $recv($self._asArray())._collect_((function(each){
  629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  630. return $core.withContext(function($ctx2) {
  631. //>>excludeEnd("ctx");
  632. return $recv(each)._asJavaScriptObject();
  633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  635. //>>excludeEnd("ctx");
  636. }));
  637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  638. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  639. //>>excludeEnd("ctx");
  640. }; }),
  641. $globals.Collection);
  642. $core.addMethod(
  643. $core.method({
  644. selector: "asOrderedCollection",
  645. protocol: "converting",
  646. //>>excludeStart("ide", pragmas.excludeIdeData);
  647. args: [],
  648. source: "asOrderedCollection\x0a\x09^ self asArray",
  649. referencedClasses: [],
  650. //>>excludeEnd("ide");
  651. pragmas: [],
  652. messageSends: ["asArray"]
  653. }, function ($methodClass){ return function (){
  654. var self=this,$self=this;
  655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  656. return $core.withContext(function($ctx1) {
  657. //>>excludeEnd("ctx");
  658. return $self._asArray();
  659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  660. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  661. //>>excludeEnd("ctx");
  662. }; }),
  663. $globals.Collection);
  664. $core.addMethod(
  665. $core.method({
  666. selector: "asSet",
  667. protocol: "converting",
  668. //>>excludeStart("ide", pragmas.excludeIdeData);
  669. args: [],
  670. source: "asSet\x0a\x09^ Set withAll: self",
  671. referencedClasses: ["Set"],
  672. //>>excludeEnd("ide");
  673. pragmas: [],
  674. messageSends: ["withAll:"]
  675. }, function ($methodClass){ return function (){
  676. var self=this,$self=this;
  677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  678. return $core.withContext(function($ctx1) {
  679. //>>excludeEnd("ctx");
  680. return $recv($globals.Set)._withAll_(self);
  681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  682. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  683. //>>excludeEnd("ctx");
  684. }; }),
  685. $globals.Collection);
  686. $core.addMethod(
  687. $core.method({
  688. selector: "collect:",
  689. protocol: "enumerating",
  690. //>>excludeStart("ide", pragmas.excludeIdeData);
  691. args: ["aBlock"],
  692. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  693. referencedClasses: [],
  694. //>>excludeEnd("ide");
  695. pragmas: [],
  696. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  697. }, function ($methodClass){ return function (aBlock){
  698. var self=this,$self=this;
  699. var stream;
  700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  701. return $core.withContext(function($ctx1) {
  702. //>>excludeEnd("ctx");
  703. stream=$recv($recv($self._class())._new())._writeStream();
  704. $self._do_((function(each){
  705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  706. return $core.withContext(function($ctx2) {
  707. //>>excludeEnd("ctx");
  708. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  710. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  711. //>>excludeEnd("ctx");
  712. }));
  713. return $recv(stream)._contents();
  714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  715. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  716. //>>excludeEnd("ctx");
  717. }; }),
  718. $globals.Collection);
  719. $core.addMethod(
  720. $core.method({
  721. selector: "copyWith:",
  722. protocol: "copying",
  723. //>>excludeStart("ide", pragmas.excludeIdeData);
  724. args: ["anObject"],
  725. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  726. referencedClasses: [],
  727. //>>excludeEnd("ide");
  728. pragmas: [],
  729. messageSends: ["add:", "copy", "yourself"]
  730. }, function ($methodClass){ return function (anObject){
  731. var self=this,$self=this;
  732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  733. return $core.withContext(function($ctx1) {
  734. //>>excludeEnd("ctx");
  735. var $1;
  736. $1=$self._copy();
  737. $recv($1)._add_(anObject);
  738. return $recv($1)._yourself();
  739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  740. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  741. //>>excludeEnd("ctx");
  742. }; }),
  743. $globals.Collection);
  744. $core.addMethod(
  745. $core.method({
  746. selector: "copyWithAll:",
  747. protocol: "copying",
  748. //>>excludeStart("ide", pragmas.excludeIdeData);
  749. args: ["aCollection"],
  750. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  751. referencedClasses: [],
  752. //>>excludeEnd("ide");
  753. pragmas: [],
  754. messageSends: ["deprecatedAPI:", ","]
  755. }, function ($methodClass){ return function (aCollection){
  756. var self=this,$self=this;
  757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  758. return $core.withContext(function($ctx1) {
  759. //>>excludeEnd("ctx");
  760. $self._deprecatedAPI_("Use #, instead.");
  761. return $self.__comma(aCollection);
  762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  763. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  764. //>>excludeEnd("ctx");
  765. }; }),
  766. $globals.Collection);
  767. $core.addMethod(
  768. $core.method({
  769. selector: "copyWithout:",
  770. protocol: "copying",
  771. //>>excludeStart("ide", pragmas.excludeIdeData);
  772. args: ["anObject"],
  773. source: "copyWithout: anObject\x0a\x09\x22Answer a copy of the receiver that does not contain\x0a\x09any occurrences of anObject.\x22\x0a\x0a\x09^ self reject: [ :each | each = anObject ]",
  774. referencedClasses: [],
  775. //>>excludeEnd("ide");
  776. pragmas: [],
  777. messageSends: ["reject:", "="]
  778. }, function ($methodClass){ return function (anObject){
  779. var self=this,$self=this;
  780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  781. return $core.withContext(function($ctx1) {
  782. //>>excludeEnd("ctx");
  783. return $self._reject_((function(each){
  784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  785. return $core.withContext(function($ctx2) {
  786. //>>excludeEnd("ctx");
  787. return $recv(each).__eq(anObject);
  788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  790. //>>excludeEnd("ctx");
  791. }));
  792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  793. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  794. //>>excludeEnd("ctx");
  795. }; }),
  796. $globals.Collection);
  797. $core.addMethod(
  798. $core.method({
  799. selector: "copyWithoutAll:",
  800. protocol: "copying",
  801. //>>excludeStart("ide", pragmas.excludeIdeData);
  802. args: ["aCollection"],
  803. source: "copyWithoutAll: aCollection\x0a\x09\x22Answer a copy of the receiver that does not contain any elements\x0a\x09equal to those in aCollection.\x22\x0a\x0a\x09^ self reject: [ :each | aCollection includes: each ]",
  804. referencedClasses: [],
  805. //>>excludeEnd("ide");
  806. pragmas: [],
  807. messageSends: ["reject:", "includes:"]
  808. }, function ($methodClass){ return function (aCollection){
  809. var self=this,$self=this;
  810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  811. return $core.withContext(function($ctx1) {
  812. //>>excludeEnd("ctx");
  813. return $self._reject_((function(each){
  814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  815. return $core.withContext(function($ctx2) {
  816. //>>excludeEnd("ctx");
  817. return $recv(aCollection)._includes_(each);
  818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  820. //>>excludeEnd("ctx");
  821. }));
  822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  823. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  824. //>>excludeEnd("ctx");
  825. }; }),
  826. $globals.Collection);
  827. $core.addMethod(
  828. $core.method({
  829. selector: "deepCopy",
  830. protocol: "copying",
  831. //>>excludeStart("ide", pragmas.excludeIdeData);
  832. args: [],
  833. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  834. referencedClasses: [],
  835. //>>excludeEnd("ide");
  836. pragmas: [],
  837. messageSends: ["collect:", "deepCopy"]
  838. }, function ($methodClass){ return function (){
  839. var self=this,$self=this;
  840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  841. return $core.withContext(function($ctx1) {
  842. //>>excludeEnd("ctx");
  843. return $self._collect_((function(each){
  844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  845. return $core.withContext(function($ctx2) {
  846. //>>excludeEnd("ctx");
  847. return $recv(each)._deepCopy();
  848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  849. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  850. //>>excludeEnd("ctx");
  851. }));
  852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  853. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  854. //>>excludeEnd("ctx");
  855. }; }),
  856. $globals.Collection);
  857. $core.addMethod(
  858. $core.method({
  859. selector: "detect:",
  860. protocol: "enumerating",
  861. //>>excludeStart("ide", pragmas.excludeIdeData);
  862. args: ["aBlock"],
  863. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  864. referencedClasses: [],
  865. //>>excludeEnd("ide");
  866. pragmas: [],
  867. messageSends: ["detect:ifNone:", "errorNotFound"]
  868. }, function ($methodClass){ return function (aBlock){
  869. var self=this,$self=this;
  870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  871. return $core.withContext(function($ctx1) {
  872. //>>excludeEnd("ctx");
  873. return $self._detect_ifNone_(aBlock,(function(){
  874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  875. return $core.withContext(function($ctx2) {
  876. //>>excludeEnd("ctx");
  877. return $self._errorNotFound();
  878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  879. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  880. //>>excludeEnd("ctx");
  881. }));
  882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  883. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  884. //>>excludeEnd("ctx");
  885. }; }),
  886. $globals.Collection);
  887. $core.addMethod(
  888. $core.method({
  889. selector: "detect:ifNone:",
  890. protocol: "enumerating",
  891. //>>excludeStart("ide", pragmas.excludeIdeData);
  892. args: ["aBlock", "anotherBlock"],
  893. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  894. referencedClasses: [],
  895. //>>excludeEnd("ide");
  896. pragmas: [],
  897. messageSends: ["do:", "ifTrue:", "value:", "value"]
  898. }, function ($methodClass){ return function (aBlock,anotherBlock){
  899. var self=this,$self=this;
  900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  901. return $core.withContext(function($ctx1) {
  902. //>>excludeEnd("ctx");
  903. var $1;
  904. var $early={};
  905. try {
  906. $self._do_((function(each){
  907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  908. return $core.withContext(function($ctx2) {
  909. //>>excludeEnd("ctx");
  910. $1=$recv(aBlock)._value_(each);
  911. if($core.assert($1)){
  912. throw $early=[each];
  913. }
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  916. //>>excludeEnd("ctx");
  917. }));
  918. return $recv(anotherBlock)._value();
  919. }
  920. catch(e) {if(e===$early)return e[0]; throw e}
  921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  922. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  923. //>>excludeEnd("ctx");
  924. }; }),
  925. $globals.Collection);
  926. $core.addMethod(
  927. $core.method({
  928. selector: "do:",
  929. protocol: "enumerating",
  930. //>>excludeStart("ide", pragmas.excludeIdeData);
  931. args: ["aBlock"],
  932. source: "do: aBlock\x0a\x09self subclassResponsibility",
  933. referencedClasses: [],
  934. //>>excludeEnd("ide");
  935. pragmas: [],
  936. messageSends: ["subclassResponsibility"]
  937. }, function ($methodClass){ return function (aBlock){
  938. var self=this,$self=this;
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. return $core.withContext(function($ctx1) {
  941. //>>excludeEnd("ctx");
  942. $self._subclassResponsibility();
  943. return self;
  944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  945. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  946. //>>excludeEnd("ctx");
  947. }; }),
  948. $globals.Collection);
  949. $core.addMethod(
  950. $core.method({
  951. selector: "do:separatedBy:",
  952. protocol: "enumerating",
  953. //>>excludeStart("ide", pragmas.excludeIdeData);
  954. args: ["aBlock", "anotherBlock"],
  955. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [ actionBeforeElement := anotherBlock ].\x0a\x09self do: [ :each |\x0a\x09\x09actionBeforeElement value.\x0a\x09\x09aBlock value: each ]",
  956. referencedClasses: [],
  957. //>>excludeEnd("ide");
  958. pragmas: [],
  959. messageSends: ["do:", "value", "value:"]
  960. }, function ($methodClass){ return function (aBlock,anotherBlock){
  961. var self=this,$self=this;
  962. var actionBeforeElement;
  963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  964. return $core.withContext(function($ctx1) {
  965. //>>excludeEnd("ctx");
  966. actionBeforeElement=(function(){
  967. actionBeforeElement=anotherBlock;
  968. return actionBeforeElement;
  969. });
  970. $self._do_((function(each){
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. return $core.withContext(function($ctx2) {
  973. //>>excludeEnd("ctx");
  974. $recv(actionBeforeElement)._value();
  975. return $recv(aBlock)._value_(each);
  976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  977. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  978. //>>excludeEnd("ctx");
  979. }));
  980. return self;
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  983. //>>excludeEnd("ctx");
  984. }; }),
  985. $globals.Collection);
  986. $core.addMethod(
  987. $core.method({
  988. selector: "errorNotFound",
  989. protocol: "error handling",
  990. //>>excludeStart("ide", pragmas.excludeIdeData);
  991. args: [],
  992. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  993. referencedClasses: [],
  994. //>>excludeEnd("ide");
  995. pragmas: [],
  996. messageSends: ["error:"]
  997. }, function ($methodClass){ return function (){
  998. var self=this,$self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. $self._error_("Object is not in the collection");
  1003. return self;
  1004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1005. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1006. //>>excludeEnd("ctx");
  1007. }; }),
  1008. $globals.Collection);
  1009. $core.addMethod(
  1010. $core.method({
  1011. selector: "ifEmpty:",
  1012. protocol: "testing",
  1013. //>>excludeStart("ide", pragmas.excludeIdeData);
  1014. args: ["aBlock"],
  1015. source: "ifEmpty: aBlock\x0a\x09\x22Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. \x0a\x09Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: \x0a\x09\x09self classifyMethodAs:\x0a\x09\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  1016. referencedClasses: [],
  1017. //>>excludeEnd("ide");
  1018. pragmas: [],
  1019. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1020. }, function ($methodClass){ return function (aBlock){
  1021. var self=this,$self=this;
  1022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1023. return $core.withContext(function($ctx1) {
  1024. //>>excludeEnd("ctx");
  1025. var $1;
  1026. $1=$self._isEmpty();
  1027. if($core.assert($1)){
  1028. return $recv(aBlock)._value();
  1029. } else {
  1030. return self;
  1031. }
  1032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1033. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1034. //>>excludeEnd("ctx");
  1035. }; }),
  1036. $globals.Collection);
  1037. $core.addMethod(
  1038. $core.method({
  1039. selector: "ifEmpty:ifNotEmpty:",
  1040. protocol: "testing",
  1041. //>>excludeStart("ide", pragmas.excludeIdeData);
  1042. args: ["aBlock", "anotherBlock"],
  1043. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1044. referencedClasses: [],
  1045. //>>excludeEnd("ide");
  1046. pragmas: [],
  1047. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1048. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1049. var self=this,$self=this;
  1050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1051. return $core.withContext(function($ctx1) {
  1052. //>>excludeEnd("ctx");
  1053. var $1;
  1054. $1=$self._isEmpty();
  1055. if($core.assert($1)){
  1056. return $recv(aBlock)._value();
  1057. } else {
  1058. return $recv(anotherBlock)._value_(self);
  1059. }
  1060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1061. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1062. //>>excludeEnd("ctx");
  1063. }; }),
  1064. $globals.Collection);
  1065. $core.addMethod(
  1066. $core.method({
  1067. selector: "ifNotEmpty:",
  1068. protocol: "testing",
  1069. //>>excludeStart("ide", pragmas.excludeIdeData);
  1070. args: ["aBlock"],
  1071. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1072. referencedClasses: [],
  1073. //>>excludeEnd("ide");
  1074. pragmas: [],
  1075. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1076. }, function ($methodClass){ return function (aBlock){
  1077. var self=this,$self=this;
  1078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1079. return $core.withContext(function($ctx1) {
  1080. //>>excludeEnd("ctx");
  1081. var $1;
  1082. $1=$self._notEmpty();
  1083. if($core.assert($1)){
  1084. return $recv(aBlock)._value_(self);
  1085. } else {
  1086. return self;
  1087. }
  1088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1089. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1090. //>>excludeEnd("ctx");
  1091. }; }),
  1092. $globals.Collection);
  1093. $core.addMethod(
  1094. $core.method({
  1095. selector: "ifNotEmpty:ifEmpty:",
  1096. protocol: "testing",
  1097. //>>excludeStart("ide", pragmas.excludeIdeData);
  1098. args: ["aBlock", "anotherBlock"],
  1099. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1100. referencedClasses: [],
  1101. //>>excludeEnd("ide");
  1102. pragmas: [],
  1103. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1104. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1105. var self=this,$self=this;
  1106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1107. return $core.withContext(function($ctx1) {
  1108. //>>excludeEnd("ctx");
  1109. var $1;
  1110. $1=$self._notEmpty();
  1111. if($core.assert($1)){
  1112. return $recv(aBlock)._value_(self);
  1113. } else {
  1114. return $recv(anotherBlock)._value();
  1115. }
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1118. //>>excludeEnd("ctx");
  1119. }; }),
  1120. $globals.Collection);
  1121. $core.addMethod(
  1122. $core.method({
  1123. selector: "includes:",
  1124. protocol: "testing",
  1125. //>>excludeStart("ide", pragmas.excludeIdeData);
  1126. args: ["anObject"],
  1127. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1128. referencedClasses: [],
  1129. //>>excludeEnd("ide");
  1130. pragmas: [],
  1131. messageSends: ["anySatisfy:", "="]
  1132. }, function ($methodClass){ return function (anObject){
  1133. var self=this,$self=this;
  1134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1135. return $core.withContext(function($ctx1) {
  1136. //>>excludeEnd("ctx");
  1137. return $self._anySatisfy_((function(each){
  1138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1139. return $core.withContext(function($ctx2) {
  1140. //>>excludeEnd("ctx");
  1141. return $recv(each).__eq(anObject);
  1142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1144. //>>excludeEnd("ctx");
  1145. }));
  1146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1147. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1148. //>>excludeEnd("ctx");
  1149. }; }),
  1150. $globals.Collection);
  1151. $core.addMethod(
  1152. $core.method({
  1153. selector: "inject:into:",
  1154. protocol: "enumerating",
  1155. //>>excludeStart("ide", pragmas.excludeIdeData);
  1156. args: ["anObject", "aBlock"],
  1157. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [ :each |\x0a\x09\x09result := aBlock value: result value: each ].\x0a\x09^ result",
  1158. referencedClasses: [],
  1159. //>>excludeEnd("ide");
  1160. pragmas: [],
  1161. messageSends: ["do:", "value:value:"]
  1162. }, function ($methodClass){ return function (anObject,aBlock){
  1163. var self=this,$self=this;
  1164. var result;
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. return $core.withContext(function($ctx1) {
  1167. //>>excludeEnd("ctx");
  1168. result=anObject;
  1169. $self._do_((function(each){
  1170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1171. return $core.withContext(function($ctx2) {
  1172. //>>excludeEnd("ctx");
  1173. result=$recv(aBlock)._value_value_(result,each);
  1174. return result;
  1175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1176. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1177. //>>excludeEnd("ctx");
  1178. }));
  1179. return result;
  1180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1181. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1182. //>>excludeEnd("ctx");
  1183. }; }),
  1184. $globals.Collection);
  1185. $core.addMethod(
  1186. $core.method({
  1187. selector: "intersection:",
  1188. protocol: "enumerating",
  1189. //>>excludeStart("ide", pragmas.excludeIdeData);
  1190. args: ["aCollection"],
  1191. source: "intersection: aCollection\x0a\x09\x22Answer the set theoretic intersection of two collections.\x22\x0a\x0a\x09| set outputSet |\x0a\x09\x0a\x09set := self asSet.\x0a\x09outputSet := Set new.\x0a\x09\x0a\x09aCollection do: [ :each |\x0a\x09\x09((set includes: each) and: [ (outputSet includes: each) not ])\x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09outputSet add: each ]].\x0a\x09\x09\x0a\x09^ self class withAll: outputSet asArray",
  1192. referencedClasses: ["Set"],
  1193. //>>excludeEnd("ide");
  1194. pragmas: [],
  1195. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1196. }, function ($methodClass){ return function (aCollection){
  1197. var self=this,$self=this;
  1198. var set,outputSet;
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. return $core.withContext(function($ctx1) {
  1201. //>>excludeEnd("ctx");
  1202. var $2,$1;
  1203. set=$self._asSet();
  1204. outputSet=$recv($globals.Set)._new();
  1205. $recv(aCollection)._do_((function(each){
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. return $core.withContext(function($ctx2) {
  1208. //>>excludeEnd("ctx");
  1209. $2=$recv(set)._includes_(each);
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. $ctx2.sendIdx["includes:"]=1;
  1212. //>>excludeEnd("ctx");
  1213. $1=$recv($2)._and_((function(){
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. return $core.withContext(function($ctx3) {
  1216. //>>excludeEnd("ctx");
  1217. return $recv($recv(outputSet)._includes_(each))._not();
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1220. //>>excludeEnd("ctx");
  1221. }));
  1222. if($core.assert($1)){
  1223. return $recv(outputSet)._add_(each);
  1224. }
  1225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1227. //>>excludeEnd("ctx");
  1228. }));
  1229. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1231. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1232. //>>excludeEnd("ctx");
  1233. }; }),
  1234. $globals.Collection);
  1235. $core.addMethod(
  1236. $core.method({
  1237. selector: "isEmpty",
  1238. protocol: "testing",
  1239. //>>excludeStart("ide", pragmas.excludeIdeData);
  1240. args: [],
  1241. source: "isEmpty\x0a\x09^ self size = 0",
  1242. referencedClasses: [],
  1243. //>>excludeEnd("ide");
  1244. pragmas: [],
  1245. messageSends: ["=", "size"]
  1246. }, function ($methodClass){ return function (){
  1247. var self=this,$self=this;
  1248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1249. return $core.withContext(function($ctx1) {
  1250. //>>excludeEnd("ctx");
  1251. return $recv($self._size()).__eq((0));
  1252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1253. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1254. //>>excludeEnd("ctx");
  1255. }; }),
  1256. $globals.Collection);
  1257. $core.addMethod(
  1258. $core.method({
  1259. selector: "noneSatisfy:",
  1260. protocol: "enumerating",
  1261. //>>excludeStart("ide", pragmas.excludeIdeData);
  1262. args: ["aBlock"],
  1263. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  1264. referencedClasses: [],
  1265. //>>excludeEnd("ide");
  1266. pragmas: [],
  1267. messageSends: ["do:", "ifTrue:", "value:"]
  1268. }, function ($methodClass){ return function (aBlock){
  1269. var self=this,$self=this;
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return $core.withContext(function($ctx1) {
  1272. //>>excludeEnd("ctx");
  1273. var $1;
  1274. var $early={};
  1275. try {
  1276. $self._do_((function(item){
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. return $core.withContext(function($ctx2) {
  1279. //>>excludeEnd("ctx");
  1280. $1=$recv(aBlock)._value_(item);
  1281. if($core.assert($1)){
  1282. throw $early=[false];
  1283. }
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1286. //>>excludeEnd("ctx");
  1287. }));
  1288. return true;
  1289. }
  1290. catch(e) {if(e===$early)return e[0]; throw e}
  1291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1292. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1293. //>>excludeEnd("ctx");
  1294. }; }),
  1295. $globals.Collection);
  1296. $core.addMethod(
  1297. $core.method({
  1298. selector: "notEmpty",
  1299. protocol: "testing",
  1300. //>>excludeStart("ide", pragmas.excludeIdeData);
  1301. args: [],
  1302. source: "notEmpty\x0a\x09^ self isEmpty not",
  1303. referencedClasses: [],
  1304. //>>excludeEnd("ide");
  1305. pragmas: [],
  1306. messageSends: ["not", "isEmpty"]
  1307. }, function ($methodClass){ return function (){
  1308. var self=this,$self=this;
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. return $core.withContext(function($ctx1) {
  1311. //>>excludeEnd("ctx");
  1312. return $recv($self._isEmpty())._not();
  1313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1314. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1315. //>>excludeEnd("ctx");
  1316. }; }),
  1317. $globals.Collection);
  1318. $core.addMethod(
  1319. $core.method({
  1320. selector: "occurrencesOf:",
  1321. protocol: "accessing",
  1322. //>>excludeStart("ide", pragmas.excludeIdeData);
  1323. args: ["anObject"],
  1324. source: "occurrencesOf: anObject\x0a\x09\x22Answer how many of the receiver's elements are equal to anObject.\x22\x0a\x0a\x09| tally |\x0a\x09tally := 0.\x0a\x09self do: [ :each | anObject = each ifTrue: [ tally := tally + 1 ]].\x0a\x09^ tally",
  1325. referencedClasses: [],
  1326. //>>excludeEnd("ide");
  1327. pragmas: [],
  1328. messageSends: ["do:", "ifTrue:", "=", "+"]
  1329. }, function ($methodClass){ return function (anObject){
  1330. var self=this,$self=this;
  1331. var tally;
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. return $core.withContext(function($ctx1) {
  1334. //>>excludeEnd("ctx");
  1335. var $1;
  1336. tally=(0);
  1337. $self._do_((function(each){
  1338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1339. return $core.withContext(function($ctx2) {
  1340. //>>excludeEnd("ctx");
  1341. $1=$recv(anObject).__eq(each);
  1342. if($core.assert($1)){
  1343. tally=$recv(tally).__plus((1));
  1344. return tally;
  1345. }
  1346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1347. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1348. //>>excludeEnd("ctx");
  1349. }));
  1350. return tally;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1353. //>>excludeEnd("ctx");
  1354. }; }),
  1355. $globals.Collection);
  1356. $core.addMethod(
  1357. $core.method({
  1358. selector: "putOn:",
  1359. protocol: "streaming",
  1360. //>>excludeStart("ide", pragmas.excludeIdeData);
  1361. args: ["aStream"],
  1362. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1363. referencedClasses: [],
  1364. //>>excludeEnd("ide");
  1365. pragmas: [],
  1366. messageSends: ["do:", "putOn:"]
  1367. }, function ($methodClass){ return function (aStream){
  1368. var self=this,$self=this;
  1369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1370. return $core.withContext(function($ctx1) {
  1371. //>>excludeEnd("ctx");
  1372. $self._do_((function(each){
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. return $core.withContext(function($ctx2) {
  1375. //>>excludeEnd("ctx");
  1376. return $recv(each)._putOn_(aStream);
  1377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1378. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1379. //>>excludeEnd("ctx");
  1380. }));
  1381. return self;
  1382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1383. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1384. //>>excludeEnd("ctx");
  1385. }; }),
  1386. $globals.Collection);
  1387. $core.addMethod(
  1388. $core.method({
  1389. selector: "reject:",
  1390. protocol: "enumerating",
  1391. //>>excludeStart("ide", pragmas.excludeIdeData);
  1392. args: ["aBlock"],
  1393. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1394. referencedClasses: [],
  1395. //>>excludeEnd("ide");
  1396. pragmas: [],
  1397. messageSends: ["select:", "=", "value:"]
  1398. }, function ($methodClass){ return function (aBlock){
  1399. var self=this,$self=this;
  1400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1401. return $core.withContext(function($ctx1) {
  1402. //>>excludeEnd("ctx");
  1403. return $self._select_((function(each){
  1404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1405. return $core.withContext(function($ctx2) {
  1406. //>>excludeEnd("ctx");
  1407. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1409. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1410. //>>excludeEnd("ctx");
  1411. }));
  1412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1413. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1414. //>>excludeEnd("ctx");
  1415. }; }),
  1416. $globals.Collection);
  1417. $core.addMethod(
  1418. $core.method({
  1419. selector: "remove:",
  1420. protocol: "adding/removing",
  1421. //>>excludeStart("ide", pragmas.excludeIdeData);
  1422. args: ["anObject"],
  1423. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1424. referencedClasses: [],
  1425. //>>excludeEnd("ide");
  1426. pragmas: [],
  1427. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1428. }, function ($methodClass){ return function (anObject){
  1429. var self=this,$self=this;
  1430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1431. return $core.withContext(function($ctx1) {
  1432. //>>excludeEnd("ctx");
  1433. return $self._remove_ifAbsent_(anObject,(function(){
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. return $core.withContext(function($ctx2) {
  1436. //>>excludeEnd("ctx");
  1437. return $self._errorNotFound();
  1438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1439. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1440. //>>excludeEnd("ctx");
  1441. }));
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1444. //>>excludeEnd("ctx");
  1445. }; }),
  1446. $globals.Collection);
  1447. $core.addMethod(
  1448. $core.method({
  1449. selector: "remove:ifAbsent:",
  1450. protocol: "adding/removing",
  1451. //>>excludeStart("ide", pragmas.excludeIdeData);
  1452. args: ["anObject", "aBlock"],
  1453. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1454. referencedClasses: [],
  1455. //>>excludeEnd("ide");
  1456. pragmas: [],
  1457. messageSends: ["subclassResponsibility"]
  1458. }, function ($methodClass){ return function (anObject,aBlock){
  1459. var self=this,$self=this;
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return $core.withContext(function($ctx1) {
  1462. //>>excludeEnd("ctx");
  1463. $self._subclassResponsibility();
  1464. return self;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1467. //>>excludeEnd("ctx");
  1468. }; }),
  1469. $globals.Collection);
  1470. $core.addMethod(
  1471. $core.method({
  1472. selector: "removeAll",
  1473. protocol: "adding/removing",
  1474. //>>excludeStart("ide", pragmas.excludeIdeData);
  1475. args: [],
  1476. source: "removeAll\x0a\x09self subclassResponsibility",
  1477. referencedClasses: [],
  1478. //>>excludeEnd("ide");
  1479. pragmas: [],
  1480. messageSends: ["subclassResponsibility"]
  1481. }, function ($methodClass){ return function (){
  1482. var self=this,$self=this;
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. return $core.withContext(function($ctx1) {
  1485. //>>excludeEnd("ctx");
  1486. $self._subclassResponsibility();
  1487. return self;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1490. //>>excludeEnd("ctx");
  1491. }; }),
  1492. $globals.Collection);
  1493. $core.addMethod(
  1494. $core.method({
  1495. selector: "select:",
  1496. protocol: "enumerating",
  1497. //>>excludeStart("ide", pragmas.excludeIdeData);
  1498. args: ["aBlock"],
  1499. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each ] ].\x0a\x09^ stream contents",
  1500. referencedClasses: [],
  1501. //>>excludeEnd("ide");
  1502. pragmas: [],
  1503. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1504. }, function ($methodClass){ return function (aBlock){
  1505. var self=this,$self=this;
  1506. var stream;
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return $core.withContext(function($ctx1) {
  1509. //>>excludeEnd("ctx");
  1510. var $1;
  1511. stream=$recv($recv($self._class())._new())._writeStream();
  1512. $self._do_((function(each){
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. return $core.withContext(function($ctx2) {
  1515. //>>excludeEnd("ctx");
  1516. $1=$recv(aBlock)._value_(each);
  1517. if($core.assert($1)){
  1518. return $recv(stream)._nextPut_(each);
  1519. }
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1522. //>>excludeEnd("ctx");
  1523. }));
  1524. return $recv(stream)._contents();
  1525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1526. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1527. //>>excludeEnd("ctx");
  1528. }; }),
  1529. $globals.Collection);
  1530. $core.addMethod(
  1531. $core.method({
  1532. selector: "select:thenCollect:",
  1533. protocol: "enumerating",
  1534. //>>excludeStart("ide", pragmas.excludeIdeData);
  1535. args: ["selectBlock", "collectBlock"],
  1536. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09(selectBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: (collectBlock value: each) ] ].\x0a\x09^ stream contents",
  1537. referencedClasses: [],
  1538. //>>excludeEnd("ide");
  1539. pragmas: [],
  1540. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1541. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1542. var self=this,$self=this;
  1543. var stream;
  1544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1545. return $core.withContext(function($ctx1) {
  1546. //>>excludeEnd("ctx");
  1547. var $1;
  1548. stream=$recv($recv($self._class())._new())._writeStream();
  1549. $self._do_((function(each){
  1550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1551. return $core.withContext(function($ctx2) {
  1552. //>>excludeEnd("ctx");
  1553. $1=$recv(selectBlock)._value_(each);
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. $ctx2.sendIdx["value:"]=1;
  1556. //>>excludeEnd("ctx");
  1557. if($core.assert($1)){
  1558. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1559. }
  1560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1562. //>>excludeEnd("ctx");
  1563. }));
  1564. return $recv(stream)._contents();
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1567. //>>excludeEnd("ctx");
  1568. }; }),
  1569. $globals.Collection);
  1570. $core.addMethod(
  1571. $core.method({
  1572. selector: "shallowCopy",
  1573. protocol: "copying",
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: [],
  1576. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. pragmas: [],
  1580. messageSends: ["collect:"]
  1581. }, function ($methodClass){ return function (){
  1582. var self=this,$self=this;
  1583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1584. return $core.withContext(function($ctx1) {
  1585. //>>excludeEnd("ctx");
  1586. return $self._collect_((function(each){
  1587. return each;
  1588. }));
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1591. //>>excludeEnd("ctx");
  1592. }; }),
  1593. $globals.Collection);
  1594. $core.addMethod(
  1595. $core.method({
  1596. selector: "single",
  1597. protocol: "accessing",
  1598. //>>excludeStart("ide", pragmas.excludeIdeData);
  1599. args: [],
  1600. source: "single\x0a\x09\x22Answer a single element.\x0a\x09Raise an error if collection holds less or more than one element.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self size > 1 ifTrue: [ self error: 'Collection holds more than one element' ].\x0a\x09^ self anyOne",
  1601. referencedClasses: [],
  1602. //>>excludeEnd("ide");
  1603. pragmas: [],
  1604. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1605. }, function ($methodClass){ return function (){
  1606. var self=this,$self=this;
  1607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1608. return $core.withContext(function($ctx1) {
  1609. //>>excludeEnd("ctx");
  1610. var $1;
  1611. $self._ifEmpty_((function(){
  1612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1613. return $core.withContext(function($ctx2) {
  1614. //>>excludeEnd("ctx");
  1615. return $self._error_("Collection is empty");
  1616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1617. $ctx2.sendIdx["error:"]=1;
  1618. //>>excludeEnd("ctx");
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1621. //>>excludeEnd("ctx");
  1622. }));
  1623. $1=$recv($self._size()).__gt((1));
  1624. if($core.assert($1)){
  1625. $self._error_("Collection holds more than one element");
  1626. }
  1627. return $self._anyOne();
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1630. //>>excludeEnd("ctx");
  1631. }; }),
  1632. $globals.Collection);
  1633. $core.addMethod(
  1634. $core.method({
  1635. selector: "size",
  1636. protocol: "accessing",
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: [],
  1639. source: "size\x0a\x09self subclassResponsibility",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. pragmas: [],
  1643. messageSends: ["subclassResponsibility"]
  1644. }, function ($methodClass){ return function (){
  1645. var self=this,$self=this;
  1646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1647. return $core.withContext(function($ctx1) {
  1648. //>>excludeEnd("ctx");
  1649. $self._subclassResponsibility();
  1650. return self;
  1651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1652. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1653. //>>excludeEnd("ctx");
  1654. }; }),
  1655. $globals.Collection);
  1656. $core.addMethod(
  1657. $core.method({
  1658. selector: "classTag",
  1659. protocol: "accessing",
  1660. //>>excludeStart("ide", pragmas.excludeIdeData);
  1661. args: [],
  1662. source: "classTag\x0a\x09\x22Returns a tag or general category for this class.\x0a\x09Typically used to help tools do some reflection.\x0a\x09Helios, for example, uses this to decide what icon the class should display.\x22\x0a\x09\x0a\x09^ 'collection'",
  1663. referencedClasses: [],
  1664. //>>excludeEnd("ide");
  1665. pragmas: [],
  1666. messageSends: []
  1667. }, function ($methodClass){ return function (){
  1668. var self=this,$self=this;
  1669. return "collection";
  1670. }; }),
  1671. $globals.Collection.a$cls);
  1672. $core.addMethod(
  1673. $core.method({
  1674. selector: "new:",
  1675. protocol: "instance creation",
  1676. //>>excludeStart("ide", pragmas.excludeIdeData);
  1677. args: ["anInteger"],
  1678. source: "new: anInteger\x0a\x09^ self new",
  1679. referencedClasses: [],
  1680. //>>excludeEnd("ide");
  1681. pragmas: [],
  1682. messageSends: ["new"]
  1683. }, function ($methodClass){ return function (anInteger){
  1684. var self=this,$self=this;
  1685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1686. return $core.withContext(function($ctx1) {
  1687. //>>excludeEnd("ctx");
  1688. return $self._new();
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1691. //>>excludeEnd("ctx");
  1692. }; }),
  1693. $globals.Collection.a$cls);
  1694. $core.addMethod(
  1695. $core.method({
  1696. selector: "with:",
  1697. protocol: "instance creation",
  1698. //>>excludeStart("ide", pragmas.excludeIdeData);
  1699. args: ["anObject"],
  1700. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1701. referencedClasses: [],
  1702. //>>excludeEnd("ide");
  1703. pragmas: [],
  1704. messageSends: ["add:", "new", "yourself"]
  1705. }, function ($methodClass){ return function (anObject){
  1706. var self=this,$self=this;
  1707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1708. return $core.withContext(function($ctx1) {
  1709. //>>excludeEnd("ctx");
  1710. var $1;
  1711. $1=$self._new();
  1712. $recv($1)._add_(anObject);
  1713. return $recv($1)._yourself();
  1714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1715. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1716. //>>excludeEnd("ctx");
  1717. }; }),
  1718. $globals.Collection.a$cls);
  1719. $core.addMethod(
  1720. $core.method({
  1721. selector: "with:with:",
  1722. protocol: "instance creation",
  1723. //>>excludeStart("ide", pragmas.excludeIdeData);
  1724. args: ["anObject", "anotherObject"],
  1725. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1726. referencedClasses: [],
  1727. //>>excludeEnd("ide");
  1728. pragmas: [],
  1729. messageSends: ["add:", "new", "yourself"]
  1730. }, function ($methodClass){ return function (anObject,anotherObject){
  1731. var self=this,$self=this;
  1732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1733. return $core.withContext(function($ctx1) {
  1734. //>>excludeEnd("ctx");
  1735. var $1;
  1736. $1=$self._new();
  1737. $recv($1)._add_(anObject);
  1738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1739. $ctx1.sendIdx["add:"]=1;
  1740. //>>excludeEnd("ctx");
  1741. $recv($1)._add_(anotherObject);
  1742. return $recv($1)._yourself();
  1743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1744. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1745. //>>excludeEnd("ctx");
  1746. }; }),
  1747. $globals.Collection.a$cls);
  1748. $core.addMethod(
  1749. $core.method({
  1750. selector: "with:with:with:",
  1751. protocol: "instance creation",
  1752. //>>excludeStart("ide", pragmas.excludeIdeData);
  1753. args: ["firstObject", "secondObject", "thirdObject"],
  1754. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09\x09^ self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  1755. referencedClasses: [],
  1756. //>>excludeEnd("ide");
  1757. pragmas: [],
  1758. messageSends: ["add:", "new", "yourself"]
  1759. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1760. var self=this,$self=this;
  1761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1762. return $core.withContext(function($ctx1) {
  1763. //>>excludeEnd("ctx");
  1764. var $1;
  1765. $1=$self._new();
  1766. $recv($1)._add_(firstObject);
  1767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1768. $ctx1.sendIdx["add:"]=1;
  1769. //>>excludeEnd("ctx");
  1770. $recv($1)._add_(secondObject);
  1771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1772. $ctx1.sendIdx["add:"]=2;
  1773. //>>excludeEnd("ctx");
  1774. $recv($1)._add_(thirdObject);
  1775. return $recv($1)._yourself();
  1776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1777. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1778. //>>excludeEnd("ctx");
  1779. }; }),
  1780. $globals.Collection.a$cls);
  1781. $core.addMethod(
  1782. $core.method({
  1783. selector: "withAll:",
  1784. protocol: "instance creation",
  1785. //>>excludeStart("ide", pragmas.excludeIdeData);
  1786. args: ["aCollection"],
  1787. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1788. referencedClasses: [],
  1789. //>>excludeEnd("ide");
  1790. pragmas: [],
  1791. messageSends: ["addAll:", "new", "yourself"]
  1792. }, function ($methodClass){ return function (aCollection){
  1793. var self=this,$self=this;
  1794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1795. return $core.withContext(function($ctx1) {
  1796. //>>excludeEnd("ctx");
  1797. var $1;
  1798. $1=$self._new();
  1799. $recv($1)._addAll_(aCollection);
  1800. return $recv($1)._yourself();
  1801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1802. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1803. //>>excludeEnd("ctx");
  1804. }; }),
  1805. $globals.Collection.a$cls);
  1806. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1807. //>>excludeStart("ide", pragmas.excludeIdeData);
  1808. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1809. //>>excludeEnd("ide");
  1810. $core.addMethod(
  1811. $core.method({
  1812. selector: "=",
  1813. protocol: "comparing",
  1814. //>>excludeStart("ide", pragmas.excludeIdeData);
  1815. args: ["anAssocitativeCollection"],
  1816. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1817. referencedClasses: [],
  1818. //>>excludeEnd("ide");
  1819. pragmas: [],
  1820. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1821. }, function ($methodClass){ return function (anAssocitativeCollection){
  1822. var self=this,$self=this;
  1823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1824. return $core.withContext(function($ctx1) {
  1825. //>>excludeEnd("ctx");
  1826. var $2,$1,$4,$3,$5;
  1827. $2=$self._class();
  1828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1829. $ctx1.sendIdx["class"]=1;
  1830. //>>excludeEnd("ctx");
  1831. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. $ctx1.sendIdx["="]=1;
  1834. //>>excludeEnd("ctx");
  1835. if(!$core.assert($1)){
  1836. return false;
  1837. }
  1838. $4=$self._size();
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. $ctx1.sendIdx["size"]=1;
  1841. //>>excludeEnd("ctx");
  1842. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  1843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1844. $ctx1.sendIdx["="]=2;
  1845. //>>excludeEnd("ctx");
  1846. if(!$core.assert($3)){
  1847. return false;
  1848. }
  1849. $5=$self._associations();
  1850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1851. $ctx1.sendIdx["associations"]=1;
  1852. //>>excludeEnd("ctx");
  1853. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1856. //>>excludeEnd("ctx");
  1857. }; }),
  1858. $globals.AssociativeCollection);
  1859. $core.addMethod(
  1860. $core.method({
  1861. selector: "add:",
  1862. protocol: "adding/removing",
  1863. //>>excludeStart("ide", pragmas.excludeIdeData);
  1864. args: ["anAssociation"],
  1865. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1866. referencedClasses: [],
  1867. //>>excludeEnd("ide");
  1868. pragmas: [],
  1869. messageSends: ["at:put:", "key", "value"]
  1870. }, function ($methodClass){ return function (anAssociation){
  1871. var self=this,$self=this;
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. return $core.withContext(function($ctx1) {
  1874. //>>excludeEnd("ctx");
  1875. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1876. return self;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1879. //>>excludeEnd("ctx");
  1880. }; }),
  1881. $globals.AssociativeCollection);
  1882. $core.addMethod(
  1883. $core.method({
  1884. selector: "addAll:",
  1885. protocol: "adding/removing",
  1886. //>>excludeStart("ide", pragmas.excludeIdeData);
  1887. args: ["anAssociativeCollection"],
  1888. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1889. referencedClasses: [],
  1890. //>>excludeEnd("ide");
  1891. pragmas: [],
  1892. messageSends: ["addAll:", "associations"]
  1893. }, function ($methodClass){ return function (anAssociativeCollection){
  1894. var self=this,$self=this;
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx1) {
  1897. //>>excludeEnd("ctx");
  1898. (
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. $ctx1.supercall = true,
  1901. //>>excludeEnd("ctx");
  1902. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()));
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. $ctx1.supercall = false;
  1905. //>>excludeEnd("ctx");;
  1906. return anAssociativeCollection;
  1907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1908. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1909. //>>excludeEnd("ctx");
  1910. }; }),
  1911. $globals.AssociativeCollection);
  1912. $core.addMethod(
  1913. $core.method({
  1914. selector: "asDictionary",
  1915. protocol: "converting",
  1916. //>>excludeStart("ide", pragmas.excludeIdeData);
  1917. args: [],
  1918. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1919. referencedClasses: ["Dictionary"],
  1920. //>>excludeEnd("ide");
  1921. pragmas: [],
  1922. messageSends: ["from:", "associations"]
  1923. }, function ($methodClass){ return function (){
  1924. var self=this,$self=this;
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. return $core.withContext(function($ctx1) {
  1927. //>>excludeEnd("ctx");
  1928. return $recv($globals.Dictionary)._from_($self._associations());
  1929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1930. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1931. //>>excludeEnd("ctx");
  1932. }; }),
  1933. $globals.AssociativeCollection);
  1934. $core.addMethod(
  1935. $core.method({
  1936. selector: "asHashedCollection",
  1937. protocol: "converting",
  1938. //>>excludeStart("ide", pragmas.excludeIdeData);
  1939. args: [],
  1940. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1941. referencedClasses: ["HashedCollection"],
  1942. //>>excludeEnd("ide");
  1943. pragmas: [],
  1944. messageSends: ["from:", "associations"]
  1945. }, function ($methodClass){ return function (){
  1946. var self=this,$self=this;
  1947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1948. return $core.withContext(function($ctx1) {
  1949. //>>excludeEnd("ctx");
  1950. return $recv($globals.HashedCollection)._from_($self._associations());
  1951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1952. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1953. //>>excludeEnd("ctx");
  1954. }; }),
  1955. $globals.AssociativeCollection);
  1956. $core.addMethod(
  1957. $core.method({
  1958. selector: "asJavaScriptObject",
  1959. protocol: "converting",
  1960. //>>excludeStart("ide", pragmas.excludeIdeData);
  1961. args: [],
  1962. source: "asJavaScriptObject\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJavaScriptObject ].\x0a\x09^ hash",
  1963. referencedClasses: ["HashedCollection"],
  1964. //>>excludeEnd("ide");
  1965. pragmas: [],
  1966. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1967. }, function ($methodClass){ return function (){
  1968. var self=this,$self=this;
  1969. var hash;
  1970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1971. return $core.withContext(function($ctx1) {
  1972. //>>excludeEnd("ctx");
  1973. hash=$recv($globals.HashedCollection)._new();
  1974. $self._keysAndValuesDo_((function(key,value){
  1975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1976. return $core.withContext(function($ctx2) {
  1977. //>>excludeEnd("ctx");
  1978. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1980. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1981. //>>excludeEnd("ctx");
  1982. }));
  1983. return hash;
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1986. //>>excludeEnd("ctx");
  1987. }; }),
  1988. $globals.AssociativeCollection);
  1989. $core.addMethod(
  1990. $core.method({
  1991. selector: "associations",
  1992. protocol: "accessing",
  1993. //>>excludeStart("ide", pragmas.excludeIdeData);
  1994. args: [],
  1995. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1996. referencedClasses: [],
  1997. //>>excludeEnd("ide");
  1998. pragmas: [],
  1999. messageSends: ["associationsDo:", "add:"]
  2000. }, function ($methodClass){ return function (){
  2001. var self=this,$self=this;
  2002. var associations;
  2003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2004. return $core.withContext(function($ctx1) {
  2005. //>>excludeEnd("ctx");
  2006. associations=[];
  2007. $self._associationsDo_((function(each){
  2008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2009. return $core.withContext(function($ctx2) {
  2010. //>>excludeEnd("ctx");
  2011. return $recv(associations)._add_(each);
  2012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2013. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2014. //>>excludeEnd("ctx");
  2015. }));
  2016. return associations;
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2019. //>>excludeEnd("ctx");
  2020. }; }),
  2021. $globals.AssociativeCollection);
  2022. $core.addMethod(
  2023. $core.method({
  2024. selector: "associationsDo:",
  2025. protocol: "enumerating",
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["aBlock"],
  2028. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2029. referencedClasses: ["Association"],
  2030. //>>excludeEnd("ide");
  2031. pragmas: [],
  2032. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2033. }, function ($methodClass){ return function (aBlock){
  2034. var self=this,$self=this;
  2035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2036. return $core.withContext(function($ctx1) {
  2037. //>>excludeEnd("ctx");
  2038. $self._keysAndValuesDo_((function(key,value){
  2039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2040. return $core.withContext(function($ctx2) {
  2041. //>>excludeEnd("ctx");
  2042. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2044. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2045. //>>excludeEnd("ctx");
  2046. }));
  2047. return self;
  2048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2049. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2050. //>>excludeEnd("ctx");
  2051. }; }),
  2052. $globals.AssociativeCollection);
  2053. $core.addMethod(
  2054. $core.method({
  2055. selector: "at:ifPresent:ifAbsent:",
  2056. protocol: "accessing",
  2057. //>>excludeStart("ide", pragmas.excludeIdeData);
  2058. args: ["aKey", "aBlock", "anotherBlock"],
  2059. source: "at: aKey ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09\x22Lookup the given key in the receiver.\x0a\x09If it is present, answer the value of evaluating the oneArgBlock \x0a\x09with the value associated with the key, otherwise answer the value \x0a\x09of absentBlock.\x22\x0a\x09\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ anotherBlock value ]",
  2060. referencedClasses: [],
  2061. //>>excludeEnd("ide");
  2062. pragmas: [],
  2063. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2064. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2065. var self=this,$self=this;
  2066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2067. return $core.withContext(function($ctx1) {
  2068. //>>excludeEnd("ctx");
  2069. var $1;
  2070. $1=$self._includesKey_(aKey);
  2071. if($core.assert($1)){
  2072. return $recv(aBlock)._value_($self._at_(aKey));
  2073. } else {
  2074. return $recv(anotherBlock)._value();
  2075. }
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2078. //>>excludeEnd("ctx");
  2079. }; }),
  2080. $globals.AssociativeCollection);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "collect:",
  2084. protocol: "enumerating",
  2085. //>>excludeStart("ide", pragmas.excludeIdeData);
  2086. args: ["aBlock"],
  2087. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09newDict at: key put: (aBlock value: value) ].\x0a\x09^ newDict",
  2088. referencedClasses: [],
  2089. //>>excludeEnd("ide");
  2090. pragmas: [],
  2091. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2092. }, function ($methodClass){ return function (aBlock){
  2093. var self=this,$self=this;
  2094. var newDict;
  2095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2096. return $core.withContext(function($ctx1) {
  2097. //>>excludeEnd("ctx");
  2098. newDict=$recv($self._class())._new();
  2099. $self._keysAndValuesDo_((function(key,value){
  2100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2101. return $core.withContext(function($ctx2) {
  2102. //>>excludeEnd("ctx");
  2103. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2105. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2106. //>>excludeEnd("ctx");
  2107. }));
  2108. return newDict;
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2111. //>>excludeEnd("ctx");
  2112. }; }),
  2113. $globals.AssociativeCollection);
  2114. $core.addMethod(
  2115. $core.method({
  2116. selector: "deepCopy",
  2117. protocol: "copying",
  2118. //>>excludeStart("ide", pragmas.excludeIdeData);
  2119. args: [],
  2120. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value deepCopy ].\x0a\x09^ copy",
  2121. referencedClasses: [],
  2122. //>>excludeEnd("ide");
  2123. pragmas: [],
  2124. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2125. }, function ($methodClass){ return function (){
  2126. var self=this,$self=this;
  2127. var copy;
  2128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2129. return $core.withContext(function($ctx1) {
  2130. //>>excludeEnd("ctx");
  2131. copy=$recv($self._class())._new();
  2132. $self._keysAndValuesDo_((function(key,value){
  2133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2134. return $core.withContext(function($ctx2) {
  2135. //>>excludeEnd("ctx");
  2136. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2138. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2139. //>>excludeEnd("ctx");
  2140. }));
  2141. return copy;
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2144. //>>excludeEnd("ctx");
  2145. }; }),
  2146. $globals.AssociativeCollection);
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: "detect:ifNone:",
  2150. protocol: "enumerating",
  2151. //>>excludeStart("ide", pragmas.excludeIdeData);
  2152. args: ["aBlock", "anotherBlock"],
  2153. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2154. referencedClasses: [],
  2155. //>>excludeEnd("ide");
  2156. pragmas: [],
  2157. messageSends: ["detect:ifNone:", "values"]
  2158. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2159. var self=this,$self=this;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2165. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2166. //>>excludeEnd("ctx");
  2167. }; }),
  2168. $globals.AssociativeCollection);
  2169. $core.addMethod(
  2170. $core.method({
  2171. selector: "do:",
  2172. protocol: "enumerating",
  2173. //>>excludeStart("ide", pragmas.excludeIdeData);
  2174. args: ["aBlock"],
  2175. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2176. referencedClasses: [],
  2177. //>>excludeEnd("ide");
  2178. pragmas: [],
  2179. messageSends: ["valuesDo:"]
  2180. }, function ($methodClass){ return function (aBlock){
  2181. var self=this,$self=this;
  2182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2183. return $core.withContext(function($ctx1) {
  2184. //>>excludeEnd("ctx");
  2185. $self._valuesDo_(aBlock);
  2186. return self;
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2189. //>>excludeEnd("ctx");
  2190. }; }),
  2191. $globals.AssociativeCollection);
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "includes:",
  2195. protocol: "enumerating",
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["anObject"],
  2198. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. pragmas: [],
  2202. messageSends: ["includes:", "values"]
  2203. }, function ($methodClass){ return function (anObject){
  2204. var self=this,$self=this;
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return $core.withContext(function($ctx1) {
  2207. //>>excludeEnd("ctx");
  2208. return $recv($self._values())._includes_(anObject);
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2211. //>>excludeEnd("ctx");
  2212. }; }),
  2213. $globals.AssociativeCollection);
  2214. $core.addMethod(
  2215. $core.method({
  2216. selector: "includesKey:",
  2217. protocol: "testing",
  2218. //>>excludeStart("ide", pragmas.excludeIdeData);
  2219. args: ["aKey"],
  2220. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2221. referencedClasses: [],
  2222. //>>excludeEnd("ide");
  2223. pragmas: [],
  2224. messageSends: ["subclassResponsibility"]
  2225. }, function ($methodClass){ return function (aKey){
  2226. var self=this,$self=this;
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. return $core.withContext(function($ctx1) {
  2229. //>>excludeEnd("ctx");
  2230. $self._subclassResponsibility();
  2231. return self;
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2234. //>>excludeEnd("ctx");
  2235. }; }),
  2236. $globals.AssociativeCollection);
  2237. $core.addMethod(
  2238. $core.method({
  2239. selector: "indexOf:ifAbsent:",
  2240. protocol: "accessing",
  2241. //>>excludeStart("ide", pragmas.excludeIdeData);
  2242. args: ["anObject", "aBlock"],
  2243. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2244. referencedClasses: [],
  2245. //>>excludeEnd("ide");
  2246. pragmas: [],
  2247. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2248. }, function ($methodClass){ return function (anObject,aBlock){
  2249. var self=this,$self=this;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. return $recv($self._keys())._detect_ifNone_((function(each){
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. return $core.withContext(function($ctx2) {
  2256. //>>excludeEnd("ctx");
  2257. return $recv($self._at_(each)).__eq(anObject);
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2260. //>>excludeEnd("ctx");
  2261. }),aBlock);
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2264. //>>excludeEnd("ctx");
  2265. }; }),
  2266. $globals.AssociativeCollection);
  2267. $core.addMethod(
  2268. $core.method({
  2269. selector: "keyAtValue:",
  2270. protocol: "accessing",
  2271. //>>excludeStart("ide", pragmas.excludeIdeData);
  2272. args: ["anObject"],
  2273. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2274. referencedClasses: [],
  2275. //>>excludeEnd("ide");
  2276. pragmas: [],
  2277. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2278. }, function ($methodClass){ return function (anObject){
  2279. var self=this,$self=this;
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx1) {
  2282. //>>excludeEnd("ctx");
  2283. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return $core.withContext(function($ctx2) {
  2286. //>>excludeEnd("ctx");
  2287. return $self._errorNotFound();
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2290. //>>excludeEnd("ctx");
  2291. }));
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2294. //>>excludeEnd("ctx");
  2295. }; }),
  2296. $globals.AssociativeCollection);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "keyAtValue:ifAbsent:",
  2300. protocol: "accessing",
  2301. //>>excludeStart("ide", pragmas.excludeIdeData);
  2302. args: ["anObject", "aBlock"],
  2303. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2304. referencedClasses: [],
  2305. //>>excludeEnd("ide");
  2306. pragmas: [],
  2307. messageSends: ["indexOf:ifAbsent:"]
  2308. }, function ($methodClass){ return function (anObject,aBlock){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2315. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2316. //>>excludeEnd("ctx");
  2317. }; }),
  2318. $globals.AssociativeCollection);
  2319. $core.addMethod(
  2320. $core.method({
  2321. selector: "keys",
  2322. protocol: "accessing",
  2323. //>>excludeStart("ide", pragmas.excludeIdeData);
  2324. args: [],
  2325. source: "keys\x0a\x09self subclassResponsibility",
  2326. referencedClasses: [],
  2327. //>>excludeEnd("ide");
  2328. pragmas: [],
  2329. messageSends: ["subclassResponsibility"]
  2330. }, function ($methodClass){ return function (){
  2331. var self=this,$self=this;
  2332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2333. return $core.withContext(function($ctx1) {
  2334. //>>excludeEnd("ctx");
  2335. $self._subclassResponsibility();
  2336. return self;
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2339. //>>excludeEnd("ctx");
  2340. }; }),
  2341. $globals.AssociativeCollection);
  2342. $core.addMethod(
  2343. $core.method({
  2344. selector: "keysAndValuesDo:",
  2345. protocol: "enumerating",
  2346. //>>excludeStart("ide", pragmas.excludeIdeData);
  2347. args: ["aBlock"],
  2348. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2349. referencedClasses: [],
  2350. //>>excludeEnd("ide");
  2351. pragmas: [],
  2352. messageSends: ["keysDo:", "value:value:", "at:"]
  2353. }, function ($methodClass){ return function (aBlock){
  2354. var self=this,$self=this;
  2355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2356. return $core.withContext(function($ctx1) {
  2357. //>>excludeEnd("ctx");
  2358. $self._keysDo_((function(each){
  2359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2360. return $core.withContext(function($ctx2) {
  2361. //>>excludeEnd("ctx");
  2362. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2364. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2365. //>>excludeEnd("ctx");
  2366. }));
  2367. return self;
  2368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2369. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2370. //>>excludeEnd("ctx");
  2371. }; }),
  2372. $globals.AssociativeCollection);
  2373. $core.addMethod(
  2374. $core.method({
  2375. selector: "keysDo:",
  2376. protocol: "enumerating",
  2377. //>>excludeStart("ide", pragmas.excludeIdeData);
  2378. args: ["aBlock"],
  2379. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2380. referencedClasses: [],
  2381. //>>excludeEnd("ide");
  2382. pragmas: [],
  2383. messageSends: ["subclassResponsibility"]
  2384. }, function ($methodClass){ return function (aBlock){
  2385. var self=this,$self=this;
  2386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2387. return $core.withContext(function($ctx1) {
  2388. //>>excludeEnd("ctx");
  2389. $self._subclassResponsibility();
  2390. return self;
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2393. //>>excludeEnd("ctx");
  2394. }; }),
  2395. $globals.AssociativeCollection);
  2396. $core.addMethod(
  2397. $core.method({
  2398. selector: "printOn:",
  2399. protocol: "printing",
  2400. //>>excludeStart("ide", pragmas.excludeIdeData);
  2401. args: ["aStream"],
  2402. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09\x0a\x09aStream nextPutAll: ' ('.\x0a\x09self associations\x0a\x09\x09do: [ :each | each printOn: aStream ]\x0a\x09\x09separatedBy: [ aStream nextPutAll: ' , ' ].\x0a\x09aStream nextPutAll: ')'",
  2403. referencedClasses: [],
  2404. //>>excludeEnd("ide");
  2405. pragmas: [],
  2406. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2407. }, function ($methodClass){ return function (aStream){
  2408. var self=this,$self=this;
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. return $core.withContext(function($ctx1) {
  2411. //>>excludeEnd("ctx");
  2412. (
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. $ctx1.supercall = true,
  2415. //>>excludeEnd("ctx");
  2416. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream));
  2417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2418. $ctx1.supercall = false;
  2419. //>>excludeEnd("ctx");;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. $ctx1.sendIdx["printOn:"]=1;
  2422. //>>excludeEnd("ctx");
  2423. $recv(aStream)._nextPutAll_(" (");
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. $ctx1.sendIdx["nextPutAll:"]=1;
  2426. //>>excludeEnd("ctx");
  2427. $recv($self._associations())._do_separatedBy_((function(each){
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. return $core.withContext(function($ctx2) {
  2430. //>>excludeEnd("ctx");
  2431. return $recv(each)._printOn_(aStream);
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2434. //>>excludeEnd("ctx");
  2435. }),(function(){
  2436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2437. return $core.withContext(function($ctx2) {
  2438. //>>excludeEnd("ctx");
  2439. return $recv(aStream)._nextPutAll_(" , ");
  2440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2441. $ctx2.sendIdx["nextPutAll:"]=2;
  2442. //>>excludeEnd("ctx");
  2443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2445. //>>excludeEnd("ctx");
  2446. }));
  2447. $recv(aStream)._nextPutAll_(")");
  2448. return self;
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2451. //>>excludeEnd("ctx");
  2452. }; }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "remove:ifAbsent:",
  2457. protocol: "adding/removing",
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: ["aKey", "aBlock"],
  2460. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2461. referencedClasses: [],
  2462. //>>excludeEnd("ide");
  2463. pragmas: [],
  2464. messageSends: ["removeKey:ifAbsent:"]
  2465. }, function ($methodClass){ return function (aKey,aBlock){
  2466. var self=this,$self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2473. //>>excludeEnd("ctx");
  2474. }; }),
  2475. $globals.AssociativeCollection);
  2476. $core.addMethod(
  2477. $core.method({
  2478. selector: "removeAll",
  2479. protocol: "adding/removing",
  2480. //>>excludeStart("ide", pragmas.excludeIdeData);
  2481. args: [],
  2482. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2483. referencedClasses: [],
  2484. //>>excludeEnd("ide");
  2485. pragmas: [],
  2486. messageSends: ["do:", "keys", "removeKey:"]
  2487. }, function ($methodClass){ return function (){
  2488. var self=this,$self=this;
  2489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2490. return $core.withContext(function($ctx1) {
  2491. //>>excludeEnd("ctx");
  2492. return $recv($self._keys())._do_((function(each){
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. return $core.withContext(function($ctx2) {
  2495. //>>excludeEnd("ctx");
  2496. return $self._removeKey_(each);
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2499. //>>excludeEnd("ctx");
  2500. }));
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2503. //>>excludeEnd("ctx");
  2504. }; }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "removeKey:",
  2509. protocol: "adding/removing",
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["aKey"],
  2512. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. pragmas: [],
  2516. messageSends: ["remove:"]
  2517. }, function ($methodClass){ return function (aKey){
  2518. var self=this,$self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. return $self._remove_(aKey);
  2523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2524. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2525. //>>excludeEnd("ctx");
  2526. }; }),
  2527. $globals.AssociativeCollection);
  2528. $core.addMethod(
  2529. $core.method({
  2530. selector: "removeKey:ifAbsent:",
  2531. protocol: "adding/removing",
  2532. //>>excludeStart("ide", pragmas.excludeIdeData);
  2533. args: ["aKey", "aBlock"],
  2534. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2535. referencedClasses: [],
  2536. //>>excludeEnd("ide");
  2537. pragmas: [],
  2538. messageSends: ["subclassResponsibility"]
  2539. }, function ($methodClass){ return function (aKey,aBlock){
  2540. var self=this,$self=this;
  2541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2542. return $core.withContext(function($ctx1) {
  2543. //>>excludeEnd("ctx");
  2544. $self._subclassResponsibility();
  2545. return self;
  2546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2547. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2548. //>>excludeEnd("ctx");
  2549. }; }),
  2550. $globals.AssociativeCollection);
  2551. $core.addMethod(
  2552. $core.method({
  2553. selector: "select:",
  2554. protocol: "enumerating",
  2555. //>>excludeStart("ide", pragmas.excludeIdeData);
  2556. args: ["aBlock"],
  2557. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(aBlock value: value) ifTrue: [ newDict at: key put: value ]].\x0a\x09^ newDict",
  2558. referencedClasses: [],
  2559. //>>excludeEnd("ide");
  2560. pragmas: [],
  2561. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2562. }, function ($methodClass){ return function (aBlock){
  2563. var self=this,$self=this;
  2564. var newDict;
  2565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2566. return $core.withContext(function($ctx1) {
  2567. //>>excludeEnd("ctx");
  2568. var $1;
  2569. newDict=$recv($self._class())._new();
  2570. $self._keysAndValuesDo_((function(key,value){
  2571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2572. return $core.withContext(function($ctx2) {
  2573. //>>excludeEnd("ctx");
  2574. $1=$recv(aBlock)._value_(value);
  2575. if($core.assert($1)){
  2576. return $recv(newDict)._at_put_(key,value);
  2577. }
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2580. //>>excludeEnd("ctx");
  2581. }));
  2582. return newDict;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2585. //>>excludeEnd("ctx");
  2586. }; }),
  2587. $globals.AssociativeCollection);
  2588. $core.addMethod(
  2589. $core.method({
  2590. selector: "select:thenCollect:",
  2591. protocol: "enumerating",
  2592. //>>excludeStart("ide", pragmas.excludeIdeData);
  2593. args: ["selectBlock", "collectBlock"],
  2594. source: "select: selectBlock thenCollect: collectBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09(selectBlock value: value) ifTrue: [ newDict at: key put: (collectBlock value: value) ]].\x0a\x09^ newDict",
  2595. referencedClasses: [],
  2596. //>>excludeEnd("ide");
  2597. pragmas: [],
  2598. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2599. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2600. var self=this,$self=this;
  2601. var newDict;
  2602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2603. return $core.withContext(function($ctx1) {
  2604. //>>excludeEnd("ctx");
  2605. var $1;
  2606. newDict=$recv($self._class())._new();
  2607. $self._keysAndValuesDo_((function(key,value){
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. return $core.withContext(function($ctx2) {
  2610. //>>excludeEnd("ctx");
  2611. $1=$recv(selectBlock)._value_(value);
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. $ctx2.sendIdx["value:"]=1;
  2614. //>>excludeEnd("ctx");
  2615. if($core.assert($1)){
  2616. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2617. }
  2618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2619. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2620. //>>excludeEnd("ctx");
  2621. }));
  2622. return newDict;
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2625. //>>excludeEnd("ctx");
  2626. }; }),
  2627. $globals.AssociativeCollection);
  2628. $core.addMethod(
  2629. $core.method({
  2630. selector: "shallowCopy",
  2631. protocol: "copying",
  2632. //>>excludeStart("ide", pragmas.excludeIdeData);
  2633. args: [],
  2634. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09copy at: key put: value ].\x0a\x09^ copy",
  2635. referencedClasses: [],
  2636. //>>excludeEnd("ide");
  2637. pragmas: [],
  2638. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2639. }, function ($methodClass){ return function (){
  2640. var self=this,$self=this;
  2641. var copy;
  2642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2643. return $core.withContext(function($ctx1) {
  2644. //>>excludeEnd("ctx");
  2645. copy=$recv($self._class())._new();
  2646. $self._keysAndValuesDo_((function(key,value){
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. return $core.withContext(function($ctx2) {
  2649. //>>excludeEnd("ctx");
  2650. return $recv(copy)._at_put_(key,value);
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2653. //>>excludeEnd("ctx");
  2654. }));
  2655. return copy;
  2656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2657. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2658. //>>excludeEnd("ctx");
  2659. }; }),
  2660. $globals.AssociativeCollection);
  2661. $core.addMethod(
  2662. $core.method({
  2663. selector: "size",
  2664. protocol: "accessing",
  2665. //>>excludeStart("ide", pragmas.excludeIdeData);
  2666. args: [],
  2667. source: "size\x0a\x09^ self keys size",
  2668. referencedClasses: [],
  2669. //>>excludeEnd("ide");
  2670. pragmas: [],
  2671. messageSends: ["size", "keys"]
  2672. }, function ($methodClass){ return function (){
  2673. var self=this,$self=this;
  2674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2675. return $core.withContext(function($ctx1) {
  2676. //>>excludeEnd("ctx");
  2677. return $recv($self._keys())._size();
  2678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2679. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2680. //>>excludeEnd("ctx");
  2681. }; }),
  2682. $globals.AssociativeCollection);
  2683. $core.addMethod(
  2684. $core.method({
  2685. selector: "values",
  2686. protocol: "accessing",
  2687. //>>excludeStart("ide", pragmas.excludeIdeData);
  2688. args: [],
  2689. source: "values\x0a\x09self subclassResponsibility",
  2690. referencedClasses: [],
  2691. //>>excludeEnd("ide");
  2692. pragmas: [],
  2693. messageSends: ["subclassResponsibility"]
  2694. }, function ($methodClass){ return function (){
  2695. var self=this,$self=this;
  2696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2697. return $core.withContext(function($ctx1) {
  2698. //>>excludeEnd("ctx");
  2699. $self._subclassResponsibility();
  2700. return self;
  2701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2702. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2703. //>>excludeEnd("ctx");
  2704. }; }),
  2705. $globals.AssociativeCollection);
  2706. $core.addMethod(
  2707. $core.method({
  2708. selector: "valuesDo:",
  2709. protocol: "enumerating",
  2710. //>>excludeStart("ide", pragmas.excludeIdeData);
  2711. args: ["aBlock"],
  2712. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2713. referencedClasses: [],
  2714. //>>excludeEnd("ide");
  2715. pragmas: [],
  2716. messageSends: ["subclassResponsibility"]
  2717. }, function ($methodClass){ return function (aBlock){
  2718. var self=this,$self=this;
  2719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2720. return $core.withContext(function($ctx1) {
  2721. //>>excludeEnd("ctx");
  2722. $self._subclassResponsibility();
  2723. return self;
  2724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2725. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2726. //>>excludeEnd("ctx");
  2727. }; }),
  2728. $globals.AssociativeCollection);
  2729. $core.addMethod(
  2730. $core.method({
  2731. selector: "withIndexDo:",
  2732. protocol: "enumerating",
  2733. //>>excludeStart("ide", pragmas.excludeIdeData);
  2734. args: ["aBlock"],
  2735. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2736. referencedClasses: [],
  2737. //>>excludeEnd("ide");
  2738. pragmas: [],
  2739. messageSends: ["keysAndValuesDo:", "value:value:"]
  2740. }, function ($methodClass){ return function (aBlock){
  2741. var self=this,$self=this;
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. return $core.withContext(function($ctx1) {
  2744. //>>excludeEnd("ctx");
  2745. $self._keysAndValuesDo_((function(key,value){
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. return $core.withContext(function($ctx2) {
  2748. //>>excludeEnd("ctx");
  2749. return $recv(aBlock)._value_value_(value,key);
  2750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2751. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2752. //>>excludeEnd("ctx");
  2753. }));
  2754. return self;
  2755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2756. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2757. //>>excludeEnd("ctx");
  2758. }; }),
  2759. $globals.AssociativeCollection);
  2760. $core.addMethod(
  2761. $core.method({
  2762. selector: "from:",
  2763. protocol: "instance creation",
  2764. //>>excludeStart("ide", pragmas.excludeIdeData);
  2765. args: ["aCollection"],
  2766. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2767. referencedClasses: [],
  2768. //>>excludeEnd("ide");
  2769. pragmas: [],
  2770. messageSends: ["new", "do:", "add:"]
  2771. }, function ($methodClass){ return function (aCollection){
  2772. var self=this,$self=this;
  2773. var newCollection;
  2774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2775. return $core.withContext(function($ctx1) {
  2776. //>>excludeEnd("ctx");
  2777. newCollection=$self._new();
  2778. $recv(aCollection)._do_((function(each){
  2779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2780. return $core.withContext(function($ctx2) {
  2781. //>>excludeEnd("ctx");
  2782. return $recv(newCollection)._add_(each);
  2783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2785. //>>excludeEnd("ctx");
  2786. }));
  2787. return newCollection;
  2788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2789. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2790. //>>excludeEnd("ctx");
  2791. }; }),
  2792. $globals.AssociativeCollection.a$cls);
  2793. $core.addMethod(
  2794. $core.method({
  2795. selector: "fromPairs:",
  2796. protocol: "instance creation",
  2797. //>>excludeStart("ide", pragmas.excludeIdeData);
  2798. args: ["aCollection"],
  2799. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2800. referencedClasses: [],
  2801. //>>excludeEnd("ide");
  2802. pragmas: [],
  2803. messageSends: ["from:"]
  2804. }, function ($methodClass){ return function (aCollection){
  2805. var self=this,$self=this;
  2806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2807. return $core.withContext(function($ctx1) {
  2808. //>>excludeEnd("ctx");
  2809. return $self._from_(aCollection);
  2810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2811. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2812. //>>excludeEnd("ctx");
  2813. }; }),
  2814. $globals.AssociativeCollection.a$cls);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "newFromPairs:",
  2818. protocol: "instance creation",
  2819. //>>excludeStart("ide", pragmas.excludeIdeData);
  2820. args: ["aCollection"],
  2821. source: "newFromPairs: aCollection\x0a\x09\x22Accept an array of elements where every two elements form an \x0a\x09association - the odd element being the key, and the even element the value.\x22\x0a\x09\x0a\x09| newCollection |\x0a\x09\x0a\x09aCollection size even ifFalse: [ \x0a\x09\x09self error: '#newFromPairs only accepts arrays of an even length' ].\x0a\x09\x09\x0a\x09newCollection := self new.\x0a\x09( 1 to: aCollection size by: 2 ) do: [ :each | \x0a\x09\x09newCollection at: (aCollection at: each) put: (aCollection at: each + 1) ].\x0a\x09\x09\x0a\x09^ newCollection",
  2822. referencedClasses: [],
  2823. //>>excludeEnd("ide");
  2824. pragmas: [],
  2825. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2826. }, function ($methodClass){ return function (aCollection){
  2827. var self=this,$self=this;
  2828. var newCollection;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. return $core.withContext(function($ctx1) {
  2831. //>>excludeEnd("ctx");
  2832. var $2,$1,$3,$4;
  2833. $2=$recv(aCollection)._size();
  2834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2835. $ctx1.sendIdx["size"]=1;
  2836. //>>excludeEnd("ctx");
  2837. $1=$recv($2)._even();
  2838. if(!$core.assert($1)){
  2839. $self._error_("#newFromPairs only accepts arrays of an even length");
  2840. }
  2841. newCollection=$self._new();
  2842. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. return $core.withContext(function($ctx2) {
  2845. //>>excludeEnd("ctx");
  2846. $3=newCollection;
  2847. $4=$recv(aCollection)._at_(each);
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. $ctx2.sendIdx["at:"]=1;
  2850. //>>excludeEnd("ctx");
  2851. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2854. //>>excludeEnd("ctx");
  2855. }));
  2856. return newCollection;
  2857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2858. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2859. //>>excludeEnd("ctx");
  2860. }; }),
  2861. $globals.AssociativeCollection.a$cls);
  2862. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2863. //>>excludeStart("ide", pragmas.excludeIdeData);
  2864. $globals.Dictionary.comment="I represent a set of elements that can be viewed from one of two perspectives: a set of associations,\x0aor a container of values that are externally named where the name can be any object that responds to `=`.\x0a\x0aThe external name is referred to as the key.";
  2865. //>>excludeEnd("ide");
  2866. $core.addMethod(
  2867. $core.method({
  2868. selector: "at:ifAbsent:",
  2869. protocol: "accessing",
  2870. //>>excludeStart("ide", pragmas.excludeIdeData);
  2871. args: ["aKey", "aBlock"],
  2872. source: "at: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09'>",
  2873. referencedClasses: [],
  2874. //>>excludeEnd("ide");
  2875. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2876. messageSends: []
  2877. }, function ($methodClass){ return function (aKey,aBlock){
  2878. var self=this,$self=this;
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. return $core.withContext(function($ctx1) {
  2881. //>>excludeEnd("ctx");
  2882. var index = $self._positionOfKey_(aKey);
  2883. return index >=0 ? $self.values[index] : aBlock._value();
  2884. ;
  2885. return self;
  2886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2887. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2888. //>>excludeEnd("ctx");
  2889. }; }),
  2890. $globals.Dictionary);
  2891. $core.addMethod(
  2892. $core.method({
  2893. selector: "at:put:",
  2894. protocol: "accessing",
  2895. //>>excludeStart("ide", pragmas.excludeIdeData);
  2896. args: ["aKey", "aValue"],
  2897. source: "at: aKey put: aValue\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self.keys;\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self.values[index] = aValue;\x0a\x09'>",
  2898. referencedClasses: [],
  2899. //>>excludeEnd("ide");
  2900. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09var keys = $self.keys;\x0a\x09\x09\x09index = keys.length;\x0a\x09\x09\x09keys.push(aKey);\x0a\x09\x09}\x0a\x0a\x09\x09return $self.values[index] = aValue;\x0a\x09"]]],
  2901. messageSends: []
  2902. }, function ($methodClass){ return function (aKey,aValue){
  2903. var self=this,$self=this;
  2904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2905. return $core.withContext(function($ctx1) {
  2906. //>>excludeEnd("ctx");
  2907. var index = $self._positionOfKey_(aKey);
  2908. if(index === -1) {
  2909. var keys = $self.keys;
  2910. index = keys.length;
  2911. keys.push(aKey);
  2912. }
  2913. return $self.values[index] = aValue;
  2914. ;
  2915. return self;
  2916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2917. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2918. //>>excludeEnd("ctx");
  2919. }; }),
  2920. $globals.Dictionary);
  2921. $core.addMethod(
  2922. $core.method({
  2923. selector: "includesKey:",
  2924. protocol: "testing",
  2925. //>>excludeStart("ide", pragmas.excludeIdeData);
  2926. args: ["aKey"],
  2927. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2928. referencedClasses: [],
  2929. //>>excludeEnd("ide");
  2930. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2931. messageSends: []
  2932. }, function ($methodClass){ return function (aKey){
  2933. var self=this,$self=this;
  2934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2935. return $core.withContext(function($ctx1) {
  2936. //>>excludeEnd("ctx");
  2937. return $self._positionOfKey_(aKey) >= 0;;
  2938. return self;
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2941. //>>excludeEnd("ctx");
  2942. }; }),
  2943. $globals.Dictionary);
  2944. $core.addMethod(
  2945. $core.method({
  2946. selector: "indexOf:ifAbsent:",
  2947. protocol: "accessing",
  2948. //>>excludeStart("ide", pragmas.excludeIdeData);
  2949. args: ["anObject", "aBlock"],
  2950. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09| index |\x0a\x09index := values \x0a\x09\x09indexOf: anObject \x0a\x09\x09ifAbsent: [ 0 ].\x0a\x09^ index = 0 \x0a\x09\x09ifTrue: [ aBlock value ] \x0a\x09\x09ifFalse: [ keys at: index ]",
  2951. referencedClasses: [],
  2952. //>>excludeEnd("ide");
  2953. pragmas: [],
  2954. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2955. }, function ($methodClass){ return function (anObject,aBlock){
  2956. var self=this,$self=this;
  2957. var index;
  2958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2959. return $core.withContext(function($ctx1) {
  2960. //>>excludeEnd("ctx");
  2961. var $1;
  2962. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2963. return (0);
  2964. }));
  2965. $1=$recv(index).__eq((0));
  2966. if($core.assert($1)){
  2967. return $recv(aBlock)._value();
  2968. } else {
  2969. return $recv($self.keys)._at_(index);
  2970. }
  2971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2972. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2973. //>>excludeEnd("ctx");
  2974. }; }),
  2975. $globals.Dictionary);
  2976. $core.addMethod(
  2977. $core.method({
  2978. selector: "initialize",
  2979. protocol: "initialization",
  2980. //>>excludeStart("ide", pragmas.excludeIdeData);
  2981. args: [],
  2982. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2983. referencedClasses: [],
  2984. //>>excludeEnd("ide");
  2985. pragmas: [],
  2986. messageSends: ["initialize"]
  2987. }, function ($methodClass){ return function (){
  2988. var self=this,$self=this;
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. return $core.withContext(function($ctx1) {
  2991. //>>excludeEnd("ctx");
  2992. (
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. $ctx1.supercall = true,
  2995. //>>excludeEnd("ctx");
  2996. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  2997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2998. $ctx1.supercall = false;
  2999. //>>excludeEnd("ctx");;
  3000. $self.keys=[];
  3001. $self.values=[];
  3002. return self;
  3003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3004. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  3005. //>>excludeEnd("ctx");
  3006. }; }),
  3007. $globals.Dictionary);
  3008. $core.addMethod(
  3009. $core.method({
  3010. selector: "keys",
  3011. protocol: "accessing",
  3012. //>>excludeStart("ide", pragmas.excludeIdeData);
  3013. args: [],
  3014. source: "keys\x0a\x09^ keys copy",
  3015. referencedClasses: [],
  3016. //>>excludeEnd("ide");
  3017. pragmas: [],
  3018. messageSends: ["copy"]
  3019. }, function ($methodClass){ return function (){
  3020. var self=this,$self=this;
  3021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3022. return $core.withContext(function($ctx1) {
  3023. //>>excludeEnd("ctx");
  3024. return $recv($self.keys)._copy();
  3025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3026. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3027. //>>excludeEnd("ctx");
  3028. }; }),
  3029. $globals.Dictionary);
  3030. $core.addMethod(
  3031. $core.method({
  3032. selector: "keysAndValuesDo:",
  3033. protocol: "enumerating",
  3034. //>>excludeStart("ide", pragmas.excludeIdeData);
  3035. args: ["aBlock"],
  3036. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3037. referencedClasses: [],
  3038. //>>excludeEnd("ide");
  3039. pragmas: [],
  3040. messageSends: ["with:do:"]
  3041. }, function ($methodClass){ return function (aBlock){
  3042. var self=this,$self=this;
  3043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3044. return $core.withContext(function($ctx1) {
  3045. //>>excludeEnd("ctx");
  3046. return $recv($self.keys)._with_do_($self.values,aBlock);
  3047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3048. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3049. //>>excludeEnd("ctx");
  3050. }; }),
  3051. $globals.Dictionary);
  3052. $core.addMethod(
  3053. $core.method({
  3054. selector: "keysDo:",
  3055. protocol: "enumerating",
  3056. //>>excludeStart("ide", pragmas.excludeIdeData);
  3057. args: ["aBlock"],
  3058. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3059. referencedClasses: [],
  3060. //>>excludeEnd("ide");
  3061. pragmas: [],
  3062. messageSends: ["do:"]
  3063. }, function ($methodClass){ return function (aBlock){
  3064. var self=this,$self=this;
  3065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3066. return $core.withContext(function($ctx1) {
  3067. //>>excludeEnd("ctx");
  3068. return $recv($self.keys)._do_(aBlock);
  3069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3070. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3071. //>>excludeEnd("ctx");
  3072. }; }),
  3073. $globals.Dictionary);
  3074. $core.addMethod(
  3075. $core.method({
  3076. selector: "positionOfKey:",
  3077. protocol: "private",
  3078. //>>excludeStart("ide", pragmas.excludeIdeData);
  3079. args: ["anObject"],
  3080. source: "positionOfKey: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var keys = $self.keys;\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09'>",
  3081. referencedClasses: [],
  3082. //>>excludeEnd("ide");
  3083. pragmas: [["inlineJS:", ["\x0a\x09\x09var keys = $self.keys;\x0a\x09\x09for(var i=0;i<keys.length;i++){\x0a\x09\x09\x09if(keys[i].__eq(anObject)) { return i;}\x0a\x09\x09}\x0a\x09\x09return -1;\x0a\x09"]]],
  3084. messageSends: []
  3085. }, function ($methodClass){ return function (anObject){
  3086. var self=this,$self=this;
  3087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3088. return $core.withContext(function($ctx1) {
  3089. //>>excludeEnd("ctx");
  3090. var keys = $self.keys;
  3091. for(var i=0;i<keys.length;i++){
  3092. if(keys[i].__eq(anObject)) { return i;}
  3093. }
  3094. return -1;
  3095. ;
  3096. return self;
  3097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3098. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3099. //>>excludeEnd("ctx");
  3100. }; }),
  3101. $globals.Dictionary);
  3102. $core.addMethod(
  3103. $core.method({
  3104. selector: "removeAll",
  3105. protocol: "adding/removing",
  3106. //>>excludeStart("ide", pragmas.excludeIdeData);
  3107. args: [],
  3108. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3109. referencedClasses: [],
  3110. //>>excludeEnd("ide");
  3111. pragmas: [],
  3112. messageSends: ["removeAll"]
  3113. }, function ($methodClass){ return function (){
  3114. var self=this,$self=this;
  3115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3116. return $core.withContext(function($ctx1) {
  3117. //>>excludeEnd("ctx");
  3118. $recv($self.keys)._removeAll();
  3119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3120. $ctx1.sendIdx["removeAll"]=1;
  3121. //>>excludeEnd("ctx");
  3122. $recv($self.values)._removeAll();
  3123. return self;
  3124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3125. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3126. //>>excludeEnd("ctx");
  3127. }; }),
  3128. $globals.Dictionary);
  3129. $core.addMethod(
  3130. $core.method({
  3131. selector: "removeKey:ifAbsent:",
  3132. protocol: "adding/removing",
  3133. //>>excludeStart("ide", pragmas.excludeIdeData);
  3134. args: ["aKey", "aBlock"],
  3135. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self.keys, values = $self.values;\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09'>",
  3136. referencedClasses: [],
  3137. //>>excludeEnd("ide");
  3138. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock._value()\x0a\x09\x09} else {\x0a\x09\x09\x09var keys = $self.keys, values = $self.values;\x0a\x09\x09\x09var value = values[index], l = keys.length;\x0a\x09\x09\x09keys[index] = keys[l-1];\x0a\x09\x09\x09keys.pop();\x0a\x09\x09\x09values[index] = values[l-1];\x0a\x09\x09\x09values.pop();\x0a\x09\x09\x09return value;\x0a\x09\x09}\x0a\x09"]]],
  3139. messageSends: []
  3140. }, function ($methodClass){ return function (aKey,aBlock){
  3141. var self=this,$self=this;
  3142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3143. return $core.withContext(function($ctx1) {
  3144. //>>excludeEnd("ctx");
  3145. var index = $self._positionOfKey_(aKey);
  3146. if(index === -1) {
  3147. return aBlock._value()
  3148. } else {
  3149. var keys = $self.keys, values = $self.values;
  3150. var value = values[index], l = keys.length;
  3151. keys[index] = keys[l-1];
  3152. keys.pop();
  3153. values[index] = values[l-1];
  3154. values.pop();
  3155. return value;
  3156. }
  3157. ;
  3158. return self;
  3159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3160. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3161. //>>excludeEnd("ctx");
  3162. }; }),
  3163. $globals.Dictionary);
  3164. $core.addMethod(
  3165. $core.method({
  3166. selector: "values",
  3167. protocol: "accessing",
  3168. //>>excludeStart("ide", pragmas.excludeIdeData);
  3169. args: [],
  3170. source: "values\x0a\x09^ values",
  3171. referencedClasses: [],
  3172. //>>excludeEnd("ide");
  3173. pragmas: [],
  3174. messageSends: []
  3175. }, function ($methodClass){ return function (){
  3176. var self=this,$self=this;
  3177. return $self.values;
  3178. }; }),
  3179. $globals.Dictionary);
  3180. $core.addMethod(
  3181. $core.method({
  3182. selector: "valuesDo:",
  3183. protocol: "enumerating",
  3184. //>>excludeStart("ide", pragmas.excludeIdeData);
  3185. args: ["aBlock"],
  3186. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3187. referencedClasses: [],
  3188. //>>excludeEnd("ide");
  3189. pragmas: [],
  3190. messageSends: ["do:"]
  3191. }, function ($methodClass){ return function (aBlock){
  3192. var self=this,$self=this;
  3193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3194. return $core.withContext(function($ctx1) {
  3195. //>>excludeEnd("ctx");
  3196. return $recv($self.values)._do_(aBlock);
  3197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3198. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3199. //>>excludeEnd("ctx");
  3200. }; }),
  3201. $globals.Dictionary);
  3202. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3203. //>>excludeStart("ide", pragmas.excludeIdeData);
  3204. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3205. //>>excludeEnd("ide");
  3206. $core.addMethod(
  3207. $core.method({
  3208. selector: "asJavaScriptSource",
  3209. protocol: "accessing",
  3210. //>>excludeStart("ide", pragmas.excludeIdeData);
  3211. args: [],
  3212. source: "asJavaScriptSource\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09str nextPut: '{'.\x0a\x09\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09\x09str nextPutAll: key asJavaScriptSource; nextPut: ':'; nextPutAll: value asJavaScriptSource; nextPut: ',' ].\x0a\x09\x09str skip: -1; nextPut: '}' ]",
  3213. referencedClasses: ["String"],
  3214. //>>excludeEnd("ide");
  3215. pragmas: [],
  3216. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3217. }, function ($methodClass){ return function (){
  3218. var self=this,$self=this;
  3219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3220. return $core.withContext(function($ctx1) {
  3221. //>>excludeEnd("ctx");
  3222. var $1;
  3223. return $recv($globals.String)._streamContents_((function(str){
  3224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3225. return $core.withContext(function($ctx2) {
  3226. //>>excludeEnd("ctx");
  3227. $recv(str)._nextPut_("{");
  3228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3229. $ctx2.sendIdx["nextPut:"]=1;
  3230. //>>excludeEnd("ctx");
  3231. $self._keysAndValuesDo_((function(key,value){
  3232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3233. return $core.withContext(function($ctx3) {
  3234. //>>excludeEnd("ctx");
  3235. $1=$recv(key)._asJavaScriptSource();
  3236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3237. $ctx3.sendIdx["asJavaScriptSource"]=1;
  3238. //>>excludeEnd("ctx");
  3239. $recv(str)._nextPutAll_($1);
  3240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3241. $ctx3.sendIdx["nextPutAll:"]=1;
  3242. //>>excludeEnd("ctx");
  3243. $recv(str)._nextPut_(":");
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. $ctx3.sendIdx["nextPut:"]=2;
  3246. //>>excludeEnd("ctx");
  3247. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3248. return $recv(str)._nextPut_(",");
  3249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3250. $ctx3.sendIdx["nextPut:"]=3;
  3251. //>>excludeEnd("ctx");
  3252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3253. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3254. //>>excludeEnd("ctx");
  3255. }));
  3256. $recv(str)._skip_((-1));
  3257. return $recv(str)._nextPut_("}");
  3258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3259. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3260. //>>excludeEnd("ctx");
  3261. }));
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3264. //>>excludeEnd("ctx");
  3265. }; }),
  3266. $globals.HashedCollection);
  3267. $core.addMethod(
  3268. $core.method({
  3269. selector: "at:ifAbsent:",
  3270. protocol: "accessing",
  3271. //>>excludeStart("ide", pragmas.excludeIdeData);
  3272. args: ["aKey", "aBlock"],
  3273. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3274. referencedClasses: [],
  3275. //>>excludeEnd("ide");
  3276. pragmas: [],
  3277. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3278. }, function ($methodClass){ return function (aKey,aBlock){
  3279. var self=this,$self=this;
  3280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3281. return $core.withContext(function($ctx1) {
  3282. //>>excludeEnd("ctx");
  3283. var $1;
  3284. $1=$self._includesKey_(aKey);
  3285. if($core.assert($1)){
  3286. return $self._basicAt_(aKey);
  3287. } else {
  3288. return $recv(aBlock)._value();
  3289. }
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3292. //>>excludeEnd("ctx");
  3293. }; }),
  3294. $globals.HashedCollection);
  3295. $core.addMethod(
  3296. $core.method({
  3297. selector: "at:put:",
  3298. protocol: "accessing",
  3299. //>>excludeStart("ide", pragmas.excludeIdeData);
  3300. args: ["aKey", "aValue"],
  3301. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3302. referencedClasses: [],
  3303. //>>excludeEnd("ide");
  3304. pragmas: [],
  3305. messageSends: ["basicAt:put:"]
  3306. }, function ($methodClass){ return function (aKey,aValue){
  3307. var self=this,$self=this;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. return $core.withContext(function($ctx1) {
  3310. //>>excludeEnd("ctx");
  3311. return $self._basicAt_put_(aKey,aValue);
  3312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3313. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3314. //>>excludeEnd("ctx");
  3315. }; }),
  3316. $globals.HashedCollection);
  3317. $core.addMethod(
  3318. $core.method({
  3319. selector: "includesKey:",
  3320. protocol: "testing",
  3321. //>>excludeStart("ide", pragmas.excludeIdeData);
  3322. args: ["aKey"],
  3323. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3324. referencedClasses: [],
  3325. //>>excludeEnd("ide");
  3326. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3327. messageSends: []
  3328. }, function ($methodClass){ return function (aKey){
  3329. var self=this,$self=this;
  3330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3331. return $core.withContext(function($ctx1) {
  3332. //>>excludeEnd("ctx");
  3333. return self.hasOwnProperty(aKey);
  3334. return self;
  3335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3336. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3337. //>>excludeEnd("ctx");
  3338. }; }),
  3339. $globals.HashedCollection);
  3340. $core.addMethod(
  3341. $core.method({
  3342. selector: "keys",
  3343. protocol: "accessing",
  3344. //>>excludeStart("ide", pragmas.excludeIdeData);
  3345. args: [],
  3346. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3347. referencedClasses: [],
  3348. //>>excludeEnd("ide");
  3349. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3350. messageSends: []
  3351. }, function ($methodClass){ return function (){
  3352. var self=this,$self=this;
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. return $core.withContext(function($ctx1) {
  3355. //>>excludeEnd("ctx");
  3356. return Object.keys(self);
  3357. return self;
  3358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3359. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3360. //>>excludeEnd("ctx");
  3361. }; }),
  3362. $globals.HashedCollection);
  3363. $core.addMethod(
  3364. $core.method({
  3365. selector: "keysDo:",
  3366. protocol: "enumerating",
  3367. //>>excludeStart("ide", pragmas.excludeIdeData);
  3368. args: ["aBlock"],
  3369. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3370. referencedClasses: [],
  3371. //>>excludeEnd("ide");
  3372. pragmas: [],
  3373. messageSends: ["do:", "keys"]
  3374. }, function ($methodClass){ return function (aBlock){
  3375. var self=this,$self=this;
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return $core.withContext(function($ctx1) {
  3378. //>>excludeEnd("ctx");
  3379. $recv($self._keys())._do_(aBlock);
  3380. return self;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3383. //>>excludeEnd("ctx");
  3384. }; }),
  3385. $globals.HashedCollection);
  3386. $core.addMethod(
  3387. $core.method({
  3388. selector: "removeKey:ifAbsent:",
  3389. protocol: "adding/removing",
  3390. //>>excludeStart("ide", pragmas.excludeIdeData);
  3391. args: ["aKey", "aBlock"],
  3392. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^ self\x0a\x09\x09at: aKey\x0a\x09\x09ifPresent: [ :removed | self basicDelete: aKey. removed ]\x0a\x09\x09ifAbsent: [ aBlock value ]",
  3393. referencedClasses: [],
  3394. //>>excludeEnd("ide");
  3395. pragmas: [],
  3396. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3397. }, function ($methodClass){ return function (aKey,aBlock){
  3398. var self=this,$self=this;
  3399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3400. return $core.withContext(function($ctx1) {
  3401. //>>excludeEnd("ctx");
  3402. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3404. return $core.withContext(function($ctx2) {
  3405. //>>excludeEnd("ctx");
  3406. $self._basicDelete_(aKey);
  3407. return removed;
  3408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3409. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3410. //>>excludeEnd("ctx");
  3411. }),(function(){
  3412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3413. return $core.withContext(function($ctx2) {
  3414. //>>excludeEnd("ctx");
  3415. return $recv(aBlock)._value();
  3416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3418. //>>excludeEnd("ctx");
  3419. }));
  3420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3421. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3422. //>>excludeEnd("ctx");
  3423. }; }),
  3424. $globals.HashedCollection);
  3425. $core.addMethod(
  3426. $core.method({
  3427. selector: "values",
  3428. protocol: "accessing",
  3429. //>>excludeStart("ide", pragmas.excludeIdeData);
  3430. args: [],
  3431. source: "values\x0a\x09<inlineJS: '\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09'>",
  3432. referencedClasses: [],
  3433. //>>excludeEnd("ide");
  3434. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3435. messageSends: []
  3436. }, function ($methodClass){ return function (){
  3437. var self=this,$self=this;
  3438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3439. return $core.withContext(function($ctx1) {
  3440. //>>excludeEnd("ctx");
  3441. return $self._keys().map(function(key){
  3442. return $self._at_(key);
  3443. });
  3444. ;
  3445. return self;
  3446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3447. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3448. //>>excludeEnd("ctx");
  3449. }; }),
  3450. $globals.HashedCollection);
  3451. $core.addMethod(
  3452. $core.method({
  3453. selector: "valuesDo:",
  3454. protocol: "enumerating",
  3455. //>>excludeStart("ide", pragmas.excludeIdeData);
  3456. args: ["aBlock"],
  3457. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3458. referencedClasses: [],
  3459. //>>excludeEnd("ide");
  3460. pragmas: [],
  3461. messageSends: ["do:", "values"]
  3462. }, function ($methodClass){ return function (aBlock){
  3463. var self=this,$self=this;
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. return $core.withContext(function($ctx1) {
  3466. //>>excludeEnd("ctx");
  3467. $recv($self._values())._do_(aBlock);
  3468. return self;
  3469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3470. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3471. //>>excludeEnd("ctx");
  3472. }; }),
  3473. $globals.HashedCollection);
  3474. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3475. //>>excludeStart("ide", pragmas.excludeIdeData);
  3476. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3477. //>>excludeEnd("ide");
  3478. $core.addMethod(
  3479. $core.method({
  3480. selector: "=",
  3481. protocol: "comparing",
  3482. //>>excludeStart("ide", pragmas.excludeIdeData);
  3483. args: ["aCollection"],
  3484. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size ]) ifFalse: [ ^ false ].\x0a\x09self withIndexDo: [ :each :i |\x0a\x09\x09\x09\x09(aCollection at: i) = each ifFalse: [ ^ false ]].\x0a\x09^ true",
  3485. referencedClasses: [],
  3486. //>>excludeEnd("ide");
  3487. pragmas: [],
  3488. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3489. }, function ($methodClass){ return function (aCollection){
  3490. var self=this,$self=this;
  3491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3492. return $core.withContext(function($ctx1) {
  3493. //>>excludeEnd("ctx");
  3494. var $3,$2,$4,$1,$5;
  3495. var $early={};
  3496. try {
  3497. $3=$self._class();
  3498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3499. $ctx1.sendIdx["class"]=1;
  3500. //>>excludeEnd("ctx");
  3501. $2=$recv($3).__eq($recv(aCollection)._class());
  3502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3503. $ctx1.sendIdx["="]=1;
  3504. //>>excludeEnd("ctx");
  3505. $1=$recv($2)._and_((function(){
  3506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3507. return $core.withContext(function($ctx2) {
  3508. //>>excludeEnd("ctx");
  3509. $4=$self._size();
  3510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3511. $ctx2.sendIdx["size"]=1;
  3512. //>>excludeEnd("ctx");
  3513. return $recv($4).__eq($recv(aCollection)._size());
  3514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3515. $ctx2.sendIdx["="]=2;
  3516. //>>excludeEnd("ctx");
  3517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3518. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3519. //>>excludeEnd("ctx");
  3520. }));
  3521. if(!$core.assert($1)){
  3522. return false;
  3523. }
  3524. $self._withIndexDo_((function(each,i){
  3525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3526. return $core.withContext(function($ctx2) {
  3527. //>>excludeEnd("ctx");
  3528. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3529. if(!$core.assert($5)){
  3530. throw $early=[false];
  3531. }
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3534. //>>excludeEnd("ctx");
  3535. }));
  3536. return true;
  3537. }
  3538. catch(e) {if(e===$early)return e[0]; throw e}
  3539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3540. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3541. //>>excludeEnd("ctx");
  3542. }; }),
  3543. $globals.SequenceableCollection);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "addLast:",
  3547. protocol: "adding/removing",
  3548. //>>excludeStart("ide", pragmas.excludeIdeData);
  3549. args: ["anObject"],
  3550. source: "addLast: anObject\x0a\x09self add: anObject",
  3551. referencedClasses: [],
  3552. //>>excludeEnd("ide");
  3553. pragmas: [],
  3554. messageSends: ["add:"]
  3555. }, function ($methodClass){ return function (anObject){
  3556. var self=this,$self=this;
  3557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3558. return $core.withContext(function($ctx1) {
  3559. //>>excludeEnd("ctx");
  3560. $self._add_(anObject);
  3561. return self;
  3562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3563. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3564. //>>excludeEnd("ctx");
  3565. }; }),
  3566. $globals.SequenceableCollection);
  3567. $core.addMethod(
  3568. $core.method({
  3569. selector: "allButFirst",
  3570. protocol: "accessing",
  3571. //>>excludeStart("ide", pragmas.excludeIdeData);
  3572. args: [],
  3573. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3574. referencedClasses: [],
  3575. //>>excludeEnd("ide");
  3576. pragmas: [],
  3577. messageSends: ["copyFrom:to:", "size"]
  3578. }, function ($methodClass){ return function (){
  3579. var self=this,$self=this;
  3580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3581. return $core.withContext(function($ctx1) {
  3582. //>>excludeEnd("ctx");
  3583. return $self._copyFrom_to_((2),$self._size());
  3584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3585. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3586. //>>excludeEnd("ctx");
  3587. }; }),
  3588. $globals.SequenceableCollection);
  3589. $core.addMethod(
  3590. $core.method({
  3591. selector: "allButLast",
  3592. protocol: "accessing",
  3593. //>>excludeStart("ide", pragmas.excludeIdeData);
  3594. args: [],
  3595. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3596. referencedClasses: [],
  3597. //>>excludeEnd("ide");
  3598. pragmas: [],
  3599. messageSends: ["copyFrom:to:", "-", "size"]
  3600. }, function ($methodClass){ return function (){
  3601. var self=this,$self=this;
  3602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3603. return $core.withContext(function($ctx1) {
  3604. //>>excludeEnd("ctx");
  3605. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3607. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3608. //>>excludeEnd("ctx");
  3609. }; }),
  3610. $globals.SequenceableCollection);
  3611. $core.addMethod(
  3612. $core.method({
  3613. selector: "anyOne",
  3614. protocol: "accessing",
  3615. //>>excludeStart("ide", pragmas.excludeIdeData);
  3616. args: [],
  3617. source: "anyOne\x0a\x09^ self at: 1",
  3618. referencedClasses: [],
  3619. //>>excludeEnd("ide");
  3620. pragmas: [],
  3621. messageSends: ["at:"]
  3622. }, function ($methodClass){ return function (){
  3623. var self=this,$self=this;
  3624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3625. return $core.withContext(function($ctx1) {
  3626. //>>excludeEnd("ctx");
  3627. return $self._at_((1));
  3628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3629. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3630. //>>excludeEnd("ctx");
  3631. }; }),
  3632. $globals.SequenceableCollection);
  3633. $core.addMethod(
  3634. $core.method({
  3635. selector: "atRandom",
  3636. protocol: "accessing",
  3637. //>>excludeStart("ide", pragmas.excludeIdeData);
  3638. args: [],
  3639. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3640. referencedClasses: [],
  3641. //>>excludeEnd("ide");
  3642. pragmas: [],
  3643. messageSends: ["at:", "atRandom", "size"]
  3644. }, function ($methodClass){ return function (){
  3645. var self=this,$self=this;
  3646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3647. return $core.withContext(function($ctx1) {
  3648. //>>excludeEnd("ctx");
  3649. return $self._at_($recv($self._size())._atRandom());
  3650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3651. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3652. //>>excludeEnd("ctx");
  3653. }; }),
  3654. $globals.SequenceableCollection);
  3655. $core.addMethod(
  3656. $core.method({
  3657. selector: "beginsWith:",
  3658. protocol: "testing",
  3659. //>>excludeStart("ide", pragmas.excludeIdeData);
  3660. args: ["prefix"],
  3661. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3662. referencedClasses: [],
  3663. //>>excludeEnd("ide");
  3664. pragmas: [],
  3665. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3666. }, function ($methodClass){ return function (prefix){
  3667. var self=this,$self=this;
  3668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3669. return $core.withContext(function($ctx1) {
  3670. //>>excludeEnd("ctx");
  3671. var $2,$3,$1;
  3672. $2=$self._size();
  3673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3674. $ctx1.sendIdx["size"]=1;
  3675. //>>excludeEnd("ctx");
  3676. $3=$recv(prefix)._size();
  3677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3678. $ctx1.sendIdx["size"]=2;
  3679. //>>excludeEnd("ctx");
  3680. $1=$recv($2).__lt($3);
  3681. if($core.assert($1)){
  3682. return false;
  3683. }
  3684. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3686. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3687. //>>excludeEnd("ctx");
  3688. }; }),
  3689. $globals.SequenceableCollection);
  3690. $core.addMethod(
  3691. $core.method({
  3692. selector: "copyFrom:to:",
  3693. protocol: "copying",
  3694. //>>excludeStart("ide", pragmas.excludeIdeData);
  3695. args: ["anIndex", "anotherIndex"],
  3696. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3697. referencedClasses: [],
  3698. //>>excludeEnd("ide");
  3699. pragmas: [],
  3700. messageSends: ["subclassResponsibility"]
  3701. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3702. var self=this,$self=this;
  3703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3704. return $core.withContext(function($ctx1) {
  3705. //>>excludeEnd("ctx");
  3706. $self._subclassResponsibility();
  3707. return self;
  3708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3709. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3710. //>>excludeEnd("ctx");
  3711. }; }),
  3712. $globals.SequenceableCollection);
  3713. $core.addMethod(
  3714. $core.method({
  3715. selector: "endsWith:",
  3716. protocol: "testing",
  3717. //>>excludeStart("ide", pragmas.excludeIdeData);
  3718. args: ["suffix"],
  3719. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3720. referencedClasses: [],
  3721. //>>excludeEnd("ide");
  3722. pragmas: [],
  3723. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3724. }, function ($methodClass){ return function (suffix){
  3725. var self=this,$self=this;
  3726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3727. return $core.withContext(function($ctx1) {
  3728. //>>excludeEnd("ctx");
  3729. var $2,$3,$1;
  3730. $2=$self._size();
  3731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3732. $ctx1.sendIdx["size"]=1;
  3733. //>>excludeEnd("ctx");
  3734. $3=$recv(suffix)._size();
  3735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3736. $ctx1.sendIdx["size"]=2;
  3737. //>>excludeEnd("ctx");
  3738. $1=$recv($2).__lt($3);
  3739. if($core.assert($1)){
  3740. return false;
  3741. }
  3742. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3744. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3745. //>>excludeEnd("ctx");
  3746. }; }),
  3747. $globals.SequenceableCollection);
  3748. $core.addMethod(
  3749. $core.method({
  3750. selector: "first",
  3751. protocol: "accessing",
  3752. //>>excludeStart("ide", pragmas.excludeIdeData);
  3753. args: [],
  3754. source: "first\x0a\x09^ self at: 1",
  3755. referencedClasses: [],
  3756. //>>excludeEnd("ide");
  3757. pragmas: [],
  3758. messageSends: ["at:"]
  3759. }, function ($methodClass){ return function (){
  3760. var self=this,$self=this;
  3761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3762. return $core.withContext(function($ctx1) {
  3763. //>>excludeEnd("ctx");
  3764. return $self._at_((1));
  3765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3766. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3767. //>>excludeEnd("ctx");
  3768. }; }),
  3769. $globals.SequenceableCollection);
  3770. $core.addMethod(
  3771. $core.method({
  3772. selector: "first:",
  3773. protocol: "accessing",
  3774. //>>excludeStart("ide", pragmas.excludeIdeData);
  3775. args: ["aNumber"],
  3776. 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",
  3777. referencedClasses: [],
  3778. //>>excludeEnd("ide");
  3779. pragmas: [],
  3780. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3781. }, function ($methodClass){ return function (aNumber){
  3782. var self=this,$self=this;
  3783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3784. return $core.withContext(function($ctx1) {
  3785. //>>excludeEnd("ctx");
  3786. var $1;
  3787. $1=$recv($self._size()).__lt(aNumber);
  3788. if($core.assert($1)){
  3789. $self._error_("Invalid number of elements");
  3790. }
  3791. return $self._copyFrom_to_((1),aNumber);
  3792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3793. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3794. //>>excludeEnd("ctx");
  3795. }; }),
  3796. $globals.SequenceableCollection);
  3797. $core.addMethod(
  3798. $core.method({
  3799. selector: "fourth",
  3800. protocol: "accessing",
  3801. //>>excludeStart("ide", pragmas.excludeIdeData);
  3802. args: [],
  3803. source: "fourth\x0a\x09^ self at: 4",
  3804. referencedClasses: [],
  3805. //>>excludeEnd("ide");
  3806. pragmas: [],
  3807. messageSends: ["at:"]
  3808. }, function ($methodClass){ return function (){
  3809. var self=this,$self=this;
  3810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3811. return $core.withContext(function($ctx1) {
  3812. //>>excludeEnd("ctx");
  3813. return $self._at_((4));
  3814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3815. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3816. //>>excludeEnd("ctx");
  3817. }; }),
  3818. $globals.SequenceableCollection);
  3819. $core.addMethod(
  3820. $core.method({
  3821. selector: "includes:",
  3822. protocol: "testing",
  3823. //>>excludeStart("ide", pragmas.excludeIdeData);
  3824. args: ["anObject"],
  3825. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3826. referencedClasses: [],
  3827. //>>excludeEnd("ide");
  3828. pragmas: [],
  3829. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3830. }, function ($methodClass){ return function (anObject){
  3831. var self=this,$self=this;
  3832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3833. return $core.withContext(function($ctx1) {
  3834. //>>excludeEnd("ctx");
  3835. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3836. return nil;
  3837. })))._notNil();
  3838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3839. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3840. //>>excludeEnd("ctx");
  3841. }; }),
  3842. $globals.SequenceableCollection);
  3843. $core.addMethod(
  3844. $core.method({
  3845. selector: "indexOf:startingAt:",
  3846. protocol: "accessing",
  3847. //>>excludeStart("ide", pragmas.excludeIdeData);
  3848. args: ["anObject", "start"],
  3849. 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 ]",
  3850. referencedClasses: [],
  3851. //>>excludeEnd("ide");
  3852. pragmas: [],
  3853. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3854. }, function ($methodClass){ return function (anObject,start){
  3855. var self=this,$self=this;
  3856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3857. return $core.withContext(function($ctx1) {
  3858. //>>excludeEnd("ctx");
  3859. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3860. return (0);
  3861. }));
  3862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3863. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3864. //>>excludeEnd("ctx");
  3865. }; }),
  3866. $globals.SequenceableCollection);
  3867. $core.addMethod(
  3868. $core.method({
  3869. selector: "indexOf:startingAt:ifAbsent:",
  3870. protocol: "accessing",
  3871. //>>excludeStart("ide", pragmas.excludeIdeData);
  3872. args: ["anObject", "start", "aBlock"],
  3873. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3874. referencedClasses: [],
  3875. //>>excludeEnd("ide");
  3876. pragmas: [],
  3877. messageSends: ["subclassResponsibility"]
  3878. }, function ($methodClass){ return function (anObject,start,aBlock){
  3879. var self=this,$self=this;
  3880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3881. return $core.withContext(function($ctx1) {
  3882. //>>excludeEnd("ctx");
  3883. $self._subclassResponsibility();
  3884. return self;
  3885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3886. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3887. //>>excludeEnd("ctx");
  3888. }; }),
  3889. $globals.SequenceableCollection);
  3890. $core.addMethod(
  3891. $core.method({
  3892. selector: "last",
  3893. protocol: "accessing",
  3894. //>>excludeStart("ide", pragmas.excludeIdeData);
  3895. args: [],
  3896. source: "last\x0a\x09^ self at: self size",
  3897. referencedClasses: [],
  3898. //>>excludeEnd("ide");
  3899. pragmas: [],
  3900. messageSends: ["at:", "size"]
  3901. }, function ($methodClass){ return function (){
  3902. var self=this,$self=this;
  3903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3904. return $core.withContext(function($ctx1) {
  3905. //>>excludeEnd("ctx");
  3906. return $self._at_($self._size());
  3907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3908. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3909. //>>excludeEnd("ctx");
  3910. }; }),
  3911. $globals.SequenceableCollection);
  3912. $core.addMethod(
  3913. $core.method({
  3914. selector: "last:",
  3915. protocol: "accessing",
  3916. //>>excludeStart("ide", pragmas.excludeIdeData);
  3917. args: ["aNumber"],
  3918. 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",
  3919. referencedClasses: [],
  3920. //>>excludeEnd("ide");
  3921. pragmas: [],
  3922. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3923. }, function ($methodClass){ return function (aNumber){
  3924. var self=this,$self=this;
  3925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3926. return $core.withContext(function($ctx1) {
  3927. //>>excludeEnd("ctx");
  3928. var $2,$1,$5,$4,$3;
  3929. $2=$self._size();
  3930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3931. $ctx1.sendIdx["size"]=1;
  3932. //>>excludeEnd("ctx");
  3933. $1=$recv($2).__lt(aNumber);
  3934. if($core.assert($1)){
  3935. $self._error_("Invalid number of elements");
  3936. }
  3937. $5=$self._size();
  3938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3939. $ctx1.sendIdx["size"]=2;
  3940. //>>excludeEnd("ctx");
  3941. $4=$recv($5).__minus(aNumber);
  3942. $3=$recv($4).__plus((1));
  3943. return $self._copyFrom_to_($3,$self._size());
  3944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3945. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3946. //>>excludeEnd("ctx");
  3947. }; }),
  3948. $globals.SequenceableCollection);
  3949. $core.addMethod(
  3950. $core.method({
  3951. selector: "newStream",
  3952. protocol: "streaming",
  3953. //>>excludeStart("ide", pragmas.excludeIdeData);
  3954. args: [],
  3955. source: "newStream\x0a\x09^ self streamClass on: self",
  3956. referencedClasses: [],
  3957. //>>excludeEnd("ide");
  3958. pragmas: [],
  3959. messageSends: ["on:", "streamClass"]
  3960. }, function ($methodClass){ return function (){
  3961. var self=this,$self=this;
  3962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3963. return $core.withContext(function($ctx1) {
  3964. //>>excludeEnd("ctx");
  3965. return $recv($self._streamClass())._on_(self);
  3966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3967. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  3968. //>>excludeEnd("ctx");
  3969. }; }),
  3970. $globals.SequenceableCollection);
  3971. $core.addMethod(
  3972. $core.method({
  3973. selector: "readStream",
  3974. protocol: "streaming",
  3975. //>>excludeStart("ide", pragmas.excludeIdeData);
  3976. args: [],
  3977. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3978. referencedClasses: [],
  3979. //>>excludeEnd("ide");
  3980. pragmas: [],
  3981. messageSends: ["stream"]
  3982. }, function ($methodClass){ return function (){
  3983. var self=this,$self=this;
  3984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3985. return $core.withContext(function($ctx1) {
  3986. //>>excludeEnd("ctx");
  3987. return $self._stream();
  3988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3989. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  3990. //>>excludeEnd("ctx");
  3991. }; }),
  3992. $globals.SequenceableCollection);
  3993. $core.addMethod(
  3994. $core.method({
  3995. selector: "removeLast",
  3996. protocol: "adding/removing",
  3997. //>>excludeStart("ide", pragmas.excludeIdeData);
  3998. args: [],
  3999. source: "removeLast\x0a\x09^ self remove: self last",
  4000. referencedClasses: [],
  4001. //>>excludeEnd("ide");
  4002. pragmas: [],
  4003. messageSends: ["remove:", "last"]
  4004. }, function ($methodClass){ return function (){
  4005. var self=this,$self=this;
  4006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4007. return $core.withContext(function($ctx1) {
  4008. //>>excludeEnd("ctx");
  4009. return $self._remove_($self._last());
  4010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4011. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4012. //>>excludeEnd("ctx");
  4013. }; }),
  4014. $globals.SequenceableCollection);
  4015. $core.addMethod(
  4016. $core.method({
  4017. selector: "reverseDo:",
  4018. protocol: "enumerating",
  4019. //>>excludeStart("ide", pragmas.excludeIdeData);
  4020. args: ["aBlock"],
  4021. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4022. referencedClasses: [],
  4023. //>>excludeEnd("ide");
  4024. pragmas: [],
  4025. messageSends: ["do:", "reversed"]
  4026. }, function ($methodClass){ return function (aBlock){
  4027. var self=this,$self=this;
  4028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4029. return $core.withContext(function($ctx1) {
  4030. //>>excludeEnd("ctx");
  4031. $recv($self._reversed())._do_(aBlock);
  4032. return self;
  4033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4034. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4035. //>>excludeEnd("ctx");
  4036. }; }),
  4037. $globals.SequenceableCollection);
  4038. $core.addMethod(
  4039. $core.method({
  4040. selector: "reversed",
  4041. protocol: "converting",
  4042. //>>excludeStart("ide", pragmas.excludeIdeData);
  4043. args: [],
  4044. source: "reversed\x0a\x09self subclassResponsibility",
  4045. referencedClasses: [],
  4046. //>>excludeEnd("ide");
  4047. pragmas: [],
  4048. messageSends: ["subclassResponsibility"]
  4049. }, function ($methodClass){ return function (){
  4050. var self=this,$self=this;
  4051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4052. return $core.withContext(function($ctx1) {
  4053. //>>excludeEnd("ctx");
  4054. $self._subclassResponsibility();
  4055. return self;
  4056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4057. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4058. //>>excludeEnd("ctx");
  4059. }; }),
  4060. $globals.SequenceableCollection);
  4061. $core.addMethod(
  4062. $core.method({
  4063. selector: "second",
  4064. protocol: "accessing",
  4065. //>>excludeStart("ide", pragmas.excludeIdeData);
  4066. args: [],
  4067. source: "second\x0a\x09^ self at: 2",
  4068. referencedClasses: [],
  4069. //>>excludeEnd("ide");
  4070. pragmas: [],
  4071. messageSends: ["at:"]
  4072. }, function ($methodClass){ return function (){
  4073. var self=this,$self=this;
  4074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4075. return $core.withContext(function($ctx1) {
  4076. //>>excludeEnd("ctx");
  4077. return $self._at_((2));
  4078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4079. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4080. //>>excludeEnd("ctx");
  4081. }; }),
  4082. $globals.SequenceableCollection);
  4083. $core.addMethod(
  4084. $core.method({
  4085. selector: "stream",
  4086. protocol: "streaming",
  4087. //>>excludeStart("ide", pragmas.excludeIdeData);
  4088. args: [],
  4089. source: "stream\x0a\x09^ self newStream",
  4090. referencedClasses: [],
  4091. //>>excludeEnd("ide");
  4092. pragmas: [],
  4093. messageSends: ["newStream"]
  4094. }, function ($methodClass){ return function (){
  4095. var self=this,$self=this;
  4096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4097. return $core.withContext(function($ctx1) {
  4098. //>>excludeEnd("ctx");
  4099. return $self._newStream();
  4100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4101. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4102. //>>excludeEnd("ctx");
  4103. }; }),
  4104. $globals.SequenceableCollection);
  4105. $core.addMethod(
  4106. $core.method({
  4107. selector: "streamClass",
  4108. protocol: "streaming",
  4109. //>>excludeStart("ide", pragmas.excludeIdeData);
  4110. args: [],
  4111. source: "streamClass\x0a\x09^ self class streamClass",
  4112. referencedClasses: [],
  4113. //>>excludeEnd("ide");
  4114. pragmas: [],
  4115. messageSends: ["streamClass", "class"]
  4116. }, function ($methodClass){ return function (){
  4117. var self=this,$self=this;
  4118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4119. return $core.withContext(function($ctx1) {
  4120. //>>excludeEnd("ctx");
  4121. return $recv($self._class())._streamClass();
  4122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4123. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4124. //>>excludeEnd("ctx");
  4125. }; }),
  4126. $globals.SequenceableCollection);
  4127. $core.addMethod(
  4128. $core.method({
  4129. selector: "third",
  4130. protocol: "accessing",
  4131. //>>excludeStart("ide", pragmas.excludeIdeData);
  4132. args: [],
  4133. source: "third\x0a\x09^ self at: 3",
  4134. referencedClasses: [],
  4135. //>>excludeEnd("ide");
  4136. pragmas: [],
  4137. messageSends: ["at:"]
  4138. }, function ($methodClass){ return function (){
  4139. var self=this,$self=this;
  4140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4141. return $core.withContext(function($ctx1) {
  4142. //>>excludeEnd("ctx");
  4143. return $self._at_((3));
  4144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4145. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4146. //>>excludeEnd("ctx");
  4147. }; }),
  4148. $globals.SequenceableCollection);
  4149. $core.addMethod(
  4150. $core.method({
  4151. selector: "writeStream",
  4152. protocol: "streaming",
  4153. //>>excludeStart("ide", pragmas.excludeIdeData);
  4154. args: [],
  4155. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4156. referencedClasses: [],
  4157. //>>excludeEnd("ide");
  4158. pragmas: [],
  4159. messageSends: ["stream"]
  4160. }, function ($methodClass){ return function (){
  4161. var self=this,$self=this;
  4162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4163. return $core.withContext(function($ctx1) {
  4164. //>>excludeEnd("ctx");
  4165. return $self._stream();
  4166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4167. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4168. //>>excludeEnd("ctx");
  4169. }; }),
  4170. $globals.SequenceableCollection);
  4171. $core.addMethod(
  4172. $core.method({
  4173. selector: "streamClass",
  4174. protocol: "accessing",
  4175. //>>excludeStart("ide", pragmas.excludeIdeData);
  4176. args: [],
  4177. source: "streamClass\x0a\x09\x09^ Stream",
  4178. referencedClasses: ["Stream"],
  4179. //>>excludeEnd("ide");
  4180. pragmas: [],
  4181. messageSends: []
  4182. }, function ($methodClass){ return function (){
  4183. var self=this,$self=this;
  4184. return $globals.Stream;
  4185. }; }),
  4186. $globals.SequenceableCollection.a$cls);
  4187. $core.addMethod(
  4188. $core.method({
  4189. selector: "streamContents:",
  4190. protocol: "streaming",
  4191. //>>excludeStart("ide", pragmas.excludeIdeData);
  4192. args: ["aBlock"],
  4193. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4194. referencedClasses: [],
  4195. //>>excludeEnd("ide");
  4196. pragmas: [],
  4197. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4198. }, function ($methodClass){ return function (aBlock){
  4199. var self=this,$self=this;
  4200. var stream;
  4201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4202. return $core.withContext(function($ctx1) {
  4203. //>>excludeEnd("ctx");
  4204. stream=$recv($self._streamClass())._on_($self._new());
  4205. $recv(aBlock)._value_(stream);
  4206. return $recv(stream)._contents();
  4207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4208. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4209. //>>excludeEnd("ctx");
  4210. }; }),
  4211. $globals.SequenceableCollection.a$cls);
  4212. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4213. //>>excludeStart("ide", pragmas.excludeIdeData);
  4214. $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`.";
  4215. //>>excludeEnd("ide");
  4216. $core.addMethod(
  4217. $core.method({
  4218. selector: "add:",
  4219. protocol: "adding/removing",
  4220. //>>excludeStart("ide", pragmas.excludeIdeData);
  4221. args: ["anObject"],
  4222. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4223. referencedClasses: [],
  4224. //>>excludeEnd("ide");
  4225. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4226. messageSends: []
  4227. }, function ($methodClass){ return function (anObject){
  4228. var self=this,$self=this;
  4229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4230. return $core.withContext(function($ctx1) {
  4231. //>>excludeEnd("ctx");
  4232. self.push(anObject); return anObject;;
  4233. return self;
  4234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4235. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4236. //>>excludeEnd("ctx");
  4237. }; }),
  4238. $globals.Array);
  4239. $core.addMethod(
  4240. $core.method({
  4241. selector: "addAll:",
  4242. protocol: "adding/removing",
  4243. //>>excludeStart("ide", pragmas.excludeIdeData);
  4244. args: ["aCollection"],
  4245. 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'>",
  4246. referencedClasses: [],
  4247. //>>excludeEnd("ide");
  4248. 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;"]]],
  4249. messageSends: []
  4250. }, function ($methodClass){ return function (aCollection){
  4251. var self=this,$self=this;
  4252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4253. return $core.withContext(function($ctx1) {
  4254. //>>excludeEnd("ctx");
  4255. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4256. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4257. return aCollection;;
  4258. return self;
  4259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4260. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4261. //>>excludeEnd("ctx");
  4262. }; }),
  4263. $globals.Array);
  4264. $core.addMethod(
  4265. $core.method({
  4266. selector: "addFirst:",
  4267. protocol: "adding/removing",
  4268. //>>excludeStart("ide", pragmas.excludeIdeData);
  4269. args: ["anObject"],
  4270. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4271. referencedClasses: [],
  4272. //>>excludeEnd("ide");
  4273. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4274. messageSends: []
  4275. }, function ($methodClass){ return function (anObject){
  4276. var self=this,$self=this;
  4277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4278. return $core.withContext(function($ctx1) {
  4279. //>>excludeEnd("ctx");
  4280. self.unshift(anObject); return anObject;;
  4281. return self;
  4282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4283. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4284. //>>excludeEnd("ctx");
  4285. }; }),
  4286. $globals.Array);
  4287. $core.addMethod(
  4288. $core.method({
  4289. selector: "asJavaScriptSource",
  4290. protocol: "converting",
  4291. //>>excludeStart("ide", pragmas.excludeIdeData);
  4292. args: [],
  4293. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4294. referencedClasses: [],
  4295. //>>excludeEnd("ide");
  4296. pragmas: [],
  4297. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4298. }, function ($methodClass){ return function (){
  4299. var self=this,$self=this;
  4300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4301. return $core.withContext(function($ctx1) {
  4302. //>>excludeEnd("ctx");
  4303. var $1;
  4304. $1=$recv("[".__comma($recv($self._collect_((function(each){
  4305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4306. return $core.withContext(function($ctx2) {
  4307. //>>excludeEnd("ctx");
  4308. return $recv(each)._asJavaScriptSource();
  4309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4310. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4311. //>>excludeEnd("ctx");
  4312. })))._join_(", "))).__comma("]");
  4313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4314. $ctx1.sendIdx[","]=1;
  4315. //>>excludeEnd("ctx");
  4316. return $1;
  4317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4318. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4319. //>>excludeEnd("ctx");
  4320. }; }),
  4321. $globals.Array);
  4322. $core.addMethod(
  4323. $core.method({
  4324. selector: "at:put:",
  4325. protocol: "accessing",
  4326. //>>excludeStart("ide", pragmas.excludeIdeData);
  4327. args: ["anIndex", "anObject"],
  4328. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4329. referencedClasses: [],
  4330. //>>excludeEnd("ide");
  4331. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4332. messageSends: []
  4333. }, function ($methodClass){ return function (anIndex,anObject){
  4334. var self=this,$self=this;
  4335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4336. return $core.withContext(function($ctx1) {
  4337. //>>excludeEnd("ctx");
  4338. return self[anIndex - 1] = anObject;
  4339. return self;
  4340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4341. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4342. //>>excludeEnd("ctx");
  4343. }; }),
  4344. $globals.Array);
  4345. $core.addMethod(
  4346. $core.method({
  4347. selector: "collect:",
  4348. protocol: "enumerating",
  4349. //>>excludeStart("ide", pragmas.excludeIdeData);
  4350. args: ["aBlock"],
  4351. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4352. referencedClasses: [],
  4353. //>>excludeEnd("ide");
  4354. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4355. messageSends: []
  4356. }, function ($methodClass){ return function (aBlock){
  4357. var self=this,$self=this;
  4358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4359. return $core.withContext(function($ctx1) {
  4360. //>>excludeEnd("ctx");
  4361. return self.map(function(each) {return aBlock._value_(each)});
  4362. return self;
  4363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4364. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4365. //>>excludeEnd("ctx");
  4366. }; }),
  4367. $globals.Array);
  4368. $core.addMethod(
  4369. $core.method({
  4370. selector: "copyFrom:to:",
  4371. protocol: "copying",
  4372. //>>excludeStart("ide", pragmas.excludeIdeData);
  4373. args: ["anIndex", "anotherIndex"],
  4374. 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'>",
  4375. referencedClasses: [],
  4376. //>>excludeEnd("ide");
  4377. 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}"]]],
  4378. messageSends: []
  4379. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4380. var self=this,$self=this;
  4381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4382. return $core.withContext(function($ctx1) {
  4383. //>>excludeEnd("ctx");
  4384. if (anIndex >= 1 && anotherIndex <= self.length) {
  4385. return self.slice(anIndex - 1, anotherIndex);
  4386. } else {
  4387. self._at_(anIndex);
  4388. self._at_(self.length + 1);
  4389. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4390. };
  4391. return self;
  4392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4393. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4394. //>>excludeEnd("ctx");
  4395. }; }),
  4396. $globals.Array);
  4397. $core.addMethod(
  4398. $core.method({
  4399. selector: "join:",
  4400. protocol: "enumerating",
  4401. //>>excludeStart("ide", pragmas.excludeIdeData);
  4402. args: ["aString"],
  4403. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4404. referencedClasses: [],
  4405. //>>excludeEnd("ide");
  4406. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4407. messageSends: []
  4408. }, function ($methodClass){ return function (aString){
  4409. var self=this,$self=this;
  4410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4411. return $core.withContext(function($ctx1) {
  4412. //>>excludeEnd("ctx");
  4413. return self.join(aString);
  4414. return self;
  4415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4416. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4417. //>>excludeEnd("ctx");
  4418. }; }),
  4419. $globals.Array);
  4420. $core.addMethod(
  4421. $core.method({
  4422. selector: "printOn:",
  4423. protocol: "printing",
  4424. //>>excludeStart("ide", pragmas.excludeIdeData);
  4425. args: ["aStream"],
  4426. 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: ')'",
  4427. referencedClasses: [],
  4428. //>>excludeEnd("ide");
  4429. pragmas: [],
  4430. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4431. }, function ($methodClass){ return function (aStream){
  4432. var self=this,$self=this;
  4433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4434. return $core.withContext(function($ctx1) {
  4435. //>>excludeEnd("ctx");
  4436. (
  4437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4438. $ctx1.supercall = true,
  4439. //>>excludeEnd("ctx");
  4440. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream));
  4441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4442. $ctx1.supercall = false;
  4443. //>>excludeEnd("ctx");;
  4444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4445. $ctx1.sendIdx["printOn:"]=1;
  4446. //>>excludeEnd("ctx");
  4447. $recv(aStream)._nextPutAll_(" (");
  4448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4449. $ctx1.sendIdx["nextPutAll:"]=1;
  4450. //>>excludeEnd("ctx");
  4451. $self._do_separatedBy_((function(each){
  4452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4453. return $core.withContext(function($ctx2) {
  4454. //>>excludeEnd("ctx");
  4455. return $recv(each)._printOn_(aStream);
  4456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4457. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4458. //>>excludeEnd("ctx");
  4459. }),(function(){
  4460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4461. return $core.withContext(function($ctx2) {
  4462. //>>excludeEnd("ctx");
  4463. return $recv(aStream)._nextPutAll_(" ");
  4464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4465. $ctx2.sendIdx["nextPutAll:"]=2;
  4466. //>>excludeEnd("ctx");
  4467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4468. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4469. //>>excludeEnd("ctx");
  4470. }));
  4471. $recv(aStream)._nextPutAll_(")");
  4472. return self;
  4473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4474. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4475. //>>excludeEnd("ctx");
  4476. }; }),
  4477. $globals.Array);
  4478. $core.addMethod(
  4479. $core.method({
  4480. selector: "remove:ifAbsent:",
  4481. protocol: "adding/removing",
  4482. //>>excludeStart("ide", pragmas.excludeIdeData);
  4483. args: ["anObject", "aBlock"],
  4484. 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 ]",
  4485. referencedClasses: [],
  4486. //>>excludeEnd("ide");
  4487. pragmas: [],
  4488. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4489. }, function ($methodClass){ return function (anObject,aBlock){
  4490. var self=this,$self=this;
  4491. var index;
  4492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4493. return $core.withContext(function($ctx1) {
  4494. //>>excludeEnd("ctx");
  4495. var $1;
  4496. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4497. return (0);
  4498. }));
  4499. $1=$recv(index).__eq((0));
  4500. if($core.assert($1)){
  4501. return $recv(aBlock)._value();
  4502. } else {
  4503. $self._removeIndex_(index);
  4504. return anObject;
  4505. }
  4506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4507. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4508. //>>excludeEnd("ctx");
  4509. }; }),
  4510. $globals.Array);
  4511. $core.addMethod(
  4512. $core.method({
  4513. selector: "removeAll",
  4514. protocol: "adding/removing",
  4515. //>>excludeStart("ide", pragmas.excludeIdeData);
  4516. args: [],
  4517. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4518. referencedClasses: [],
  4519. //>>excludeEnd("ide");
  4520. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4521. messageSends: []
  4522. }, function ($methodClass){ return function (){
  4523. var self=this,$self=this;
  4524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4525. return $core.withContext(function($ctx1) {
  4526. //>>excludeEnd("ctx");
  4527. self.length = 0;
  4528. return self;
  4529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4530. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4531. //>>excludeEnd("ctx");
  4532. }; }),
  4533. $globals.Array);
  4534. $core.addMethod(
  4535. $core.method({
  4536. selector: "removeFrom:to:",
  4537. protocol: "adding/removing",
  4538. //>>excludeStart("ide", pragmas.excludeIdeData);
  4539. args: ["aNumber", "anotherNumber"],
  4540. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4541. referencedClasses: [],
  4542. //>>excludeEnd("ide");
  4543. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4544. messageSends: []
  4545. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4546. var self=this,$self=this;
  4547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4548. return $core.withContext(function($ctx1) {
  4549. //>>excludeEnd("ctx");
  4550. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4551. return self;
  4552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4553. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4554. //>>excludeEnd("ctx");
  4555. }; }),
  4556. $globals.Array);
  4557. $core.addMethod(
  4558. $core.method({
  4559. selector: "removeIndex:",
  4560. protocol: "adding/removing",
  4561. //>>excludeStart("ide", pragmas.excludeIdeData);
  4562. args: ["anInteger"],
  4563. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4564. referencedClasses: [],
  4565. //>>excludeEnd("ide");
  4566. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4567. messageSends: []
  4568. }, function ($methodClass){ return function (anInteger){
  4569. var self=this,$self=this;
  4570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4571. return $core.withContext(function($ctx1) {
  4572. //>>excludeEnd("ctx");
  4573. self.splice(anInteger - 1, 1);
  4574. return self;
  4575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4576. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4577. //>>excludeEnd("ctx");
  4578. }; }),
  4579. $globals.Array);
  4580. $core.addMethod(
  4581. $core.method({
  4582. selector: "removeLast",
  4583. protocol: "adding/removing",
  4584. //>>excludeStart("ide", pragmas.excludeIdeData);
  4585. args: [],
  4586. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4587. referencedClasses: [],
  4588. //>>excludeEnd("ide");
  4589. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4590. messageSends: []
  4591. }, function ($methodClass){ return function (){
  4592. var self=this,$self=this;
  4593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4594. return $core.withContext(function($ctx1) {
  4595. //>>excludeEnd("ctx");
  4596. return self.pop();;
  4597. return self;
  4598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4599. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4600. //>>excludeEnd("ctx");
  4601. }; }),
  4602. $globals.Array);
  4603. $core.addMethod(
  4604. $core.method({
  4605. selector: "reversed",
  4606. protocol: "converting",
  4607. //>>excludeStart("ide", pragmas.excludeIdeData);
  4608. args: [],
  4609. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4610. referencedClasses: [],
  4611. //>>excludeEnd("ide");
  4612. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4613. messageSends: []
  4614. }, function ($methodClass){ return function (){
  4615. var self=this,$self=this;
  4616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4617. return $core.withContext(function($ctx1) {
  4618. //>>excludeEnd("ctx");
  4619. return self.slice().reverse();
  4620. return self;
  4621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4622. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4623. //>>excludeEnd("ctx");
  4624. }; }),
  4625. $globals.Array);
  4626. $core.addMethod(
  4627. $core.method({
  4628. selector: "select:",
  4629. protocol: "enumerating",
  4630. //>>excludeStart("ide", pragmas.excludeIdeData);
  4631. args: ["aBlock"],
  4632. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4633. referencedClasses: [],
  4634. //>>excludeEnd("ide");
  4635. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4636. messageSends: []
  4637. }, function ($methodClass){ return function (aBlock){
  4638. var self=this,$self=this;
  4639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4640. return $core.withContext(function($ctx1) {
  4641. //>>excludeEnd("ctx");
  4642. return self.filter(function(each) {return aBlock._value_(each)});
  4643. return self;
  4644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4645. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4646. //>>excludeEnd("ctx");
  4647. }; }),
  4648. $globals.Array);
  4649. $core.addMethod(
  4650. $core.method({
  4651. selector: "shallowCopy",
  4652. protocol: "copying",
  4653. //>>excludeStart("ide", pragmas.excludeIdeData);
  4654. args: [],
  4655. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4656. referencedClasses: [],
  4657. //>>excludeEnd("ide");
  4658. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4659. messageSends: []
  4660. }, function ($methodClass){ return function (){
  4661. var self=this,$self=this;
  4662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4663. return $core.withContext(function($ctx1) {
  4664. //>>excludeEnd("ctx");
  4665. return self.slice();
  4666. return self;
  4667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4668. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4669. //>>excludeEnd("ctx");
  4670. }; }),
  4671. $globals.Array);
  4672. $core.addMethod(
  4673. $core.method({
  4674. selector: "sort",
  4675. protocol: "enumerating",
  4676. //>>excludeStart("ide", pragmas.excludeIdeData);
  4677. args: [],
  4678. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4679. referencedClasses: [],
  4680. //>>excludeEnd("ide");
  4681. pragmas: [],
  4682. messageSends: ["sort:", "<"]
  4683. }, function ($methodClass){ return function (){
  4684. var self=this,$self=this;
  4685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4686. return $core.withContext(function($ctx1) {
  4687. //>>excludeEnd("ctx");
  4688. return $self._sort_((function(a,b){
  4689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4690. return $core.withContext(function($ctx2) {
  4691. //>>excludeEnd("ctx");
  4692. return $recv(a).__lt(b);
  4693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4694. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4695. //>>excludeEnd("ctx");
  4696. }));
  4697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4698. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4699. //>>excludeEnd("ctx");
  4700. }; }),
  4701. $globals.Array);
  4702. $core.addMethod(
  4703. $core.method({
  4704. selector: "sort:",
  4705. protocol: "enumerating",
  4706. //>>excludeStart("ide", pragmas.excludeIdeData);
  4707. args: ["aBlock"],
  4708. 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'>",
  4709. referencedClasses: [],
  4710. //>>excludeEnd("ide");
  4711. 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"]]],
  4712. messageSends: []
  4713. }, function ($methodClass){ return function (aBlock){
  4714. var self=this,$self=this;
  4715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4716. return $core.withContext(function($ctx1) {
  4717. //>>excludeEnd("ctx");
  4718. return self.sort(function(a, b) {
  4719. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4720. })
  4721. ;
  4722. return self;
  4723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4724. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4725. //>>excludeEnd("ctx");
  4726. }; }),
  4727. $globals.Array);
  4728. $core.addMethod(
  4729. $core.method({
  4730. selector: "sorted",
  4731. protocol: "enumerating",
  4732. //>>excludeStart("ide", pragmas.excludeIdeData);
  4733. args: [],
  4734. source: "sorted\x0a\x09^ self copy sort",
  4735. referencedClasses: [],
  4736. //>>excludeEnd("ide");
  4737. pragmas: [],
  4738. messageSends: ["sort", "copy"]
  4739. }, function ($methodClass){ return function (){
  4740. var self=this,$self=this;
  4741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4742. return $core.withContext(function($ctx1) {
  4743. //>>excludeEnd("ctx");
  4744. return $recv($self._copy())._sort();
  4745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4746. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4747. //>>excludeEnd("ctx");
  4748. }; }),
  4749. $globals.Array);
  4750. $core.addMethod(
  4751. $core.method({
  4752. selector: "sorted:",
  4753. protocol: "enumerating",
  4754. //>>excludeStart("ide", pragmas.excludeIdeData);
  4755. args: ["aBlock"],
  4756. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4757. referencedClasses: [],
  4758. //>>excludeEnd("ide");
  4759. pragmas: [],
  4760. messageSends: ["sort:", "copy"]
  4761. }, function ($methodClass){ return function (aBlock){
  4762. var self=this,$self=this;
  4763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4764. return $core.withContext(function($ctx1) {
  4765. //>>excludeEnd("ctx");
  4766. return $recv($self._copy())._sort_(aBlock);
  4767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4768. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4769. //>>excludeEnd("ctx");
  4770. }; }),
  4771. $globals.Array);
  4772. $core.addMethod(
  4773. $core.method({
  4774. selector: "new:",
  4775. protocol: "instance creation",
  4776. //>>excludeStart("ide", pragmas.excludeIdeData);
  4777. args: ["anInteger"],
  4778. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4779. referencedClasses: [],
  4780. //>>excludeEnd("ide");
  4781. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4782. messageSends: []
  4783. }, function ($methodClass){ return function (anInteger){
  4784. var self=this,$self=this;
  4785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4786. return $core.withContext(function($ctx1) {
  4787. //>>excludeEnd("ctx");
  4788. return new Array(anInteger);
  4789. return self;
  4790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4791. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4792. //>>excludeEnd("ctx");
  4793. }; }),
  4794. $globals.Array.a$cls);
  4795. $core.addMethod(
  4796. $core.method({
  4797. selector: "with:",
  4798. protocol: "instance creation",
  4799. //>>excludeStart("ide", pragmas.excludeIdeData);
  4800. args: ["anObject"],
  4801. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4802. referencedClasses: [],
  4803. //>>excludeEnd("ide");
  4804. pragmas: [],
  4805. messageSends: ["at:put:", "new:", "yourself"]
  4806. }, function ($methodClass){ return function (anObject){
  4807. var self=this,$self=this;
  4808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4809. return $core.withContext(function($ctx1) {
  4810. //>>excludeEnd("ctx");
  4811. var $1;
  4812. $1=$self._new_((1));
  4813. $recv($1)._at_put_((1),anObject);
  4814. return $recv($1)._yourself();
  4815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4816. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4817. //>>excludeEnd("ctx");
  4818. }; }),
  4819. $globals.Array.a$cls);
  4820. $core.addMethod(
  4821. $core.method({
  4822. selector: "with:with:",
  4823. protocol: "instance creation",
  4824. //>>excludeStart("ide", pragmas.excludeIdeData);
  4825. args: ["anObject", "anObject2"],
  4826. 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",
  4827. referencedClasses: [],
  4828. //>>excludeEnd("ide");
  4829. pragmas: [],
  4830. messageSends: ["at:put:", "new:", "yourself"]
  4831. }, function ($methodClass){ return function (anObject,anObject2){
  4832. var self=this,$self=this;
  4833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4834. return $core.withContext(function($ctx1) {
  4835. //>>excludeEnd("ctx");
  4836. var $1;
  4837. $1=$self._new_((2));
  4838. $recv($1)._at_put_((1),anObject);
  4839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4840. $ctx1.sendIdx["at:put:"]=1;
  4841. //>>excludeEnd("ctx");
  4842. $recv($1)._at_put_((2),anObject2);
  4843. return $recv($1)._yourself();
  4844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4845. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4846. //>>excludeEnd("ctx");
  4847. }; }),
  4848. $globals.Array.a$cls);
  4849. $core.addMethod(
  4850. $core.method({
  4851. selector: "with:with:with:",
  4852. protocol: "instance creation",
  4853. //>>excludeStart("ide", pragmas.excludeIdeData);
  4854. args: ["anObject", "anObject2", "anObject3"],
  4855. 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",
  4856. referencedClasses: [],
  4857. //>>excludeEnd("ide");
  4858. pragmas: [],
  4859. messageSends: ["at:put:", "new:", "yourself"]
  4860. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4861. var self=this,$self=this;
  4862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4863. return $core.withContext(function($ctx1) {
  4864. //>>excludeEnd("ctx");
  4865. var $1;
  4866. $1=$self._new_((3));
  4867. $recv($1)._at_put_((1),anObject);
  4868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4869. $ctx1.sendIdx["at:put:"]=1;
  4870. //>>excludeEnd("ctx");
  4871. $recv($1)._at_put_((2),anObject2);
  4872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4873. $ctx1.sendIdx["at:put:"]=2;
  4874. //>>excludeEnd("ctx");
  4875. $recv($1)._at_put_((3),anObject3);
  4876. return $recv($1)._yourself();
  4877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4878. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4879. //>>excludeEnd("ctx");
  4880. }; }),
  4881. $globals.Array.a$cls);
  4882. $core.addMethod(
  4883. $core.method({
  4884. selector: "withAll:",
  4885. protocol: "instance creation",
  4886. //>>excludeStart("ide", pragmas.excludeIdeData);
  4887. args: ["aCollection"],
  4888. 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",
  4889. referencedClasses: [],
  4890. //>>excludeEnd("ide");
  4891. pragmas: [],
  4892. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4893. }, function ($methodClass){ return function (aCollection){
  4894. var self=this,$self=this;
  4895. var instance,index;
  4896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4897. return $core.withContext(function($ctx1) {
  4898. //>>excludeEnd("ctx");
  4899. index=(1);
  4900. instance=$self._new_($recv(aCollection)._size());
  4901. $recv(aCollection)._do_((function(each){
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. return $core.withContext(function($ctx2) {
  4904. //>>excludeEnd("ctx");
  4905. $recv(instance)._at_put_(index,each);
  4906. index=$recv(index).__plus((1));
  4907. return index;
  4908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4910. //>>excludeEnd("ctx");
  4911. }));
  4912. return instance;
  4913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4914. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4915. //>>excludeEnd("ctx");
  4916. }; }),
  4917. $globals.Array.a$cls);
  4918. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4919. //>>excludeStart("ide", pragmas.excludeIdeData);
  4920. $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 >> #,`";
  4921. //>>excludeEnd("ide");
  4922. $core.addMethod(
  4923. $core.method({
  4924. selector: ",",
  4925. protocol: "copying",
  4926. //>>excludeStart("ide", pragmas.excludeIdeData);
  4927. args: ["aString"],
  4928. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4929. referencedClasses: [],
  4930. //>>excludeEnd("ide");
  4931. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4932. messageSends: []
  4933. }, function ($methodClass){ return function (aString){
  4934. var self=this,$self=this;
  4935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4936. return $core.withContext(function($ctx1) {
  4937. //>>excludeEnd("ctx");
  4938. return String(self) + aString;
  4939. return self;
  4940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4941. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4942. //>>excludeEnd("ctx");
  4943. }; }),
  4944. $globals.String);
  4945. $core.addMethod(
  4946. $core.method({
  4947. selector: "<",
  4948. protocol: "comparing",
  4949. //>>excludeStart("ide", pragmas.excludeIdeData);
  4950. args: ["aString"],
  4951. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4952. referencedClasses: [],
  4953. //>>excludeEnd("ide");
  4954. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4955. messageSends: []
  4956. }, function ($methodClass){ return function (aString){
  4957. var self=this,$self=this;
  4958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4959. return $core.withContext(function($ctx1) {
  4960. //>>excludeEnd("ctx");
  4961. return String(self) < aString._asString();
  4962. return self;
  4963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4964. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  4965. //>>excludeEnd("ctx");
  4966. }; }),
  4967. $globals.String);
  4968. $core.addMethod(
  4969. $core.method({
  4970. selector: "<=",
  4971. protocol: "comparing",
  4972. //>>excludeStart("ide", pragmas.excludeIdeData);
  4973. args: ["aString"],
  4974. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4975. referencedClasses: [],
  4976. //>>excludeEnd("ide");
  4977. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  4978. messageSends: []
  4979. }, function ($methodClass){ return function (aString){
  4980. var self=this,$self=this;
  4981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4982. return $core.withContext(function($ctx1) {
  4983. //>>excludeEnd("ctx");
  4984. return String(self) <= aString._asString();
  4985. return self;
  4986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4987. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  4988. //>>excludeEnd("ctx");
  4989. }; }),
  4990. $globals.String);
  4991. $core.addMethod(
  4992. $core.method({
  4993. selector: "=",
  4994. protocol: "comparing",
  4995. //>>excludeStart("ide", pragmas.excludeIdeData);
  4996. args: ["aString"],
  4997. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  4998. referencedClasses: [],
  4999. //>>excludeEnd("ide");
  5000. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5001. messageSends: []
  5002. }, function ($methodClass){ return function (aString){
  5003. var self=this,$self=this;
  5004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5005. return $core.withContext(function($ctx1) {
  5006. //>>excludeEnd("ctx");
  5007. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5008. return self;
  5009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5010. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5011. //>>excludeEnd("ctx");
  5012. }; }),
  5013. $globals.String);
  5014. $core.addMethod(
  5015. $core.method({
  5016. selector: "==",
  5017. protocol: "comparing",
  5018. //>>excludeStart("ide", pragmas.excludeIdeData);
  5019. args: ["aString"],
  5020. 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'>",
  5021. referencedClasses: [],
  5022. //>>excludeEnd("ide");
  5023. 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;"]]],
  5024. messageSends: []
  5025. }, function ($methodClass){ return function (aString){
  5026. var self=this,$self=this;
  5027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5028. return $core.withContext(function($ctx1) {
  5029. //>>excludeEnd("ctx");
  5030. if (typeof aString === "string") return String(self) === aString;
  5031. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5032. else return false;;
  5033. return self;
  5034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5035. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5036. //>>excludeEnd("ctx");
  5037. }; }),
  5038. $globals.String);
  5039. $core.addMethod(
  5040. $core.method({
  5041. selector: ">",
  5042. protocol: "comparing",
  5043. //>>excludeStart("ide", pragmas.excludeIdeData);
  5044. args: ["aString"],
  5045. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5046. referencedClasses: [],
  5047. //>>excludeEnd("ide");
  5048. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5049. messageSends: []
  5050. }, function ($methodClass){ return function (aString){
  5051. var self=this,$self=this;
  5052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5053. return $core.withContext(function($ctx1) {
  5054. //>>excludeEnd("ctx");
  5055. return String(self) > aString._asString();
  5056. return self;
  5057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5058. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5059. //>>excludeEnd("ctx");
  5060. }; }),
  5061. $globals.String);
  5062. $core.addMethod(
  5063. $core.method({
  5064. selector: ">=",
  5065. protocol: "comparing",
  5066. //>>excludeStart("ide", pragmas.excludeIdeData);
  5067. args: ["aString"],
  5068. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5069. referencedClasses: [],
  5070. //>>excludeEnd("ide");
  5071. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5072. messageSends: []
  5073. }, function ($methodClass){ return function (aString){
  5074. var self=this,$self=this;
  5075. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5076. return $core.withContext(function($ctx1) {
  5077. //>>excludeEnd("ctx");
  5078. return String(self) >= aString._asString();
  5079. return self;
  5080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5081. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5082. //>>excludeEnd("ctx");
  5083. }; }),
  5084. $globals.String);
  5085. $core.addMethod(
  5086. $core.method({
  5087. selector: "add:",
  5088. protocol: "adding/removing",
  5089. //>>excludeStart("ide", pragmas.excludeIdeData);
  5090. args: ["anObject"],
  5091. source: "add: anObject\x0a\x09self errorReadOnly",
  5092. referencedClasses: [],
  5093. //>>excludeEnd("ide");
  5094. pragmas: [],
  5095. messageSends: ["errorReadOnly"]
  5096. }, function ($methodClass){ return function (anObject){
  5097. var self=this,$self=this;
  5098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5099. return $core.withContext(function($ctx1) {
  5100. //>>excludeEnd("ctx");
  5101. $self._errorReadOnly();
  5102. return self;
  5103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5104. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5105. //>>excludeEnd("ctx");
  5106. }; }),
  5107. $globals.String);
  5108. $core.addMethod(
  5109. $core.method({
  5110. selector: "asJavaScriptMethodName",
  5111. protocol: "converting",
  5112. //>>excludeStart("ide", pragmas.excludeIdeData);
  5113. args: [],
  5114. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5115. referencedClasses: [],
  5116. //>>excludeEnd("ide");
  5117. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5118. messageSends: []
  5119. }, function ($methodClass){ return function (){
  5120. var self=this,$self=this;
  5121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5122. return $core.withContext(function($ctx1) {
  5123. //>>excludeEnd("ctx");
  5124. return $core.st2js(self);
  5125. return self;
  5126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5127. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5128. //>>excludeEnd("ctx");
  5129. }; }),
  5130. $globals.String);
  5131. $core.addMethod(
  5132. $core.method({
  5133. selector: "asJavaScriptObject",
  5134. protocol: "converting",
  5135. //>>excludeStart("ide", pragmas.excludeIdeData);
  5136. args: [],
  5137. source: "asJavaScriptObject\x0a\x09^ self",
  5138. referencedClasses: [],
  5139. //>>excludeEnd("ide");
  5140. pragmas: [],
  5141. messageSends: []
  5142. }, function ($methodClass){ return function (){
  5143. var self=this,$self=this;
  5144. return self;
  5145. }; }),
  5146. $globals.String);
  5147. $core.addMethod(
  5148. $core.method({
  5149. selector: "asJavaScriptSource",
  5150. protocol: "converting",
  5151. //>>excludeStart("ide", pragmas.excludeIdeData);
  5152. args: [],
  5153. 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'>",
  5154. referencedClasses: [],
  5155. //>>excludeEnd("ide");
  5156. 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"]]],
  5157. messageSends: []
  5158. }, function ($methodClass){ return function (){
  5159. var self=this,$self=this;
  5160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5161. return $core.withContext(function($ctx1) {
  5162. //>>excludeEnd("ctx");
  5163. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5164. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5165. else
  5166. return "\"" + self + "\"";
  5167. ;
  5168. return self;
  5169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5170. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5171. //>>excludeEnd("ctx");
  5172. }; }),
  5173. $globals.String);
  5174. $core.addMethod(
  5175. $core.method({
  5176. selector: "asLowercase",
  5177. protocol: "converting",
  5178. //>>excludeStart("ide", pragmas.excludeIdeData);
  5179. args: [],
  5180. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5181. referencedClasses: [],
  5182. //>>excludeEnd("ide");
  5183. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5184. messageSends: []
  5185. }, function ($methodClass){ return function (){
  5186. var self=this,$self=this;
  5187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5188. return $core.withContext(function($ctx1) {
  5189. //>>excludeEnd("ctx");
  5190. return self.toLowerCase();
  5191. return self;
  5192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5193. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5194. //>>excludeEnd("ctx");
  5195. }; }),
  5196. $globals.String);
  5197. $core.addMethod(
  5198. $core.method({
  5199. selector: "asMutator",
  5200. protocol: "converting",
  5201. //>>excludeStart("ide", pragmas.excludeIdeData);
  5202. args: [],
  5203. 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",
  5204. referencedClasses: [],
  5205. //>>excludeEnd("ide");
  5206. pragmas: [],
  5207. messageSends: ["ifFalse:", "=", "last", ","]
  5208. }, function ($methodClass){ return function (){
  5209. var self=this,$self=this;
  5210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5211. return $core.withContext(function($ctx1) {
  5212. //>>excludeEnd("ctx");
  5213. var $1;
  5214. $1=$recv($self._last()).__eq(":");
  5215. if(!$core.assert($1)){
  5216. return $self.__comma(":");
  5217. }
  5218. return self;
  5219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5220. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5221. //>>excludeEnd("ctx");
  5222. }; }),
  5223. $globals.String);
  5224. $core.addMethod(
  5225. $core.method({
  5226. selector: "asNumber",
  5227. protocol: "converting",
  5228. //>>excludeStart("ide", pragmas.excludeIdeData);
  5229. args: [],
  5230. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5231. referencedClasses: [],
  5232. //>>excludeEnd("ide");
  5233. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5234. messageSends: []
  5235. }, function ($methodClass){ return function (){
  5236. var self=this,$self=this;
  5237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5238. return $core.withContext(function($ctx1) {
  5239. //>>excludeEnd("ctx");
  5240. return Number(self);
  5241. return self;
  5242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5243. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5244. //>>excludeEnd("ctx");
  5245. }; }),
  5246. $globals.String);
  5247. $core.addMethod(
  5248. $core.method({
  5249. selector: "asRegexp",
  5250. protocol: "converting",
  5251. //>>excludeStart("ide", pragmas.excludeIdeData);
  5252. args: [],
  5253. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5254. referencedClasses: ["RegularExpression"],
  5255. //>>excludeEnd("ide");
  5256. pragmas: [],
  5257. messageSends: ["fromString:"]
  5258. }, function ($methodClass){ return function (){
  5259. var self=this,$self=this;
  5260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5261. return $core.withContext(function($ctx1) {
  5262. //>>excludeEnd("ctx");
  5263. return $recv($globals.RegularExpression)._fromString_(self);
  5264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5265. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5266. //>>excludeEnd("ctx");
  5267. }; }),
  5268. $globals.String);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "asString",
  5272. protocol: "converting",
  5273. //>>excludeStart("ide", pragmas.excludeIdeData);
  5274. args: [],
  5275. source: "asString\x0a\x09^ self",
  5276. referencedClasses: [],
  5277. //>>excludeEnd("ide");
  5278. pragmas: [],
  5279. messageSends: []
  5280. }, function ($methodClass){ return function (){
  5281. var self=this,$self=this;
  5282. return self;
  5283. }; }),
  5284. $globals.String);
  5285. $core.addMethod(
  5286. $core.method({
  5287. selector: "asSymbol",
  5288. protocol: "converting",
  5289. //>>excludeStart("ide", pragmas.excludeIdeData);
  5290. args: [],
  5291. source: "asSymbol\x0a\x09^ self",
  5292. referencedClasses: [],
  5293. //>>excludeEnd("ide");
  5294. pragmas: [],
  5295. messageSends: []
  5296. }, function ($methodClass){ return function (){
  5297. var self=this,$self=this;
  5298. return self;
  5299. }; }),
  5300. $globals.String);
  5301. $core.addMethod(
  5302. $core.method({
  5303. selector: "asSymbolPrintOn:",
  5304. protocol: "printing",
  5305. //>>excludeStart("ide", pragmas.excludeIdeData);
  5306. args: ["aStream"],
  5307. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5308. referencedClasses: [],
  5309. //>>excludeEnd("ide");
  5310. pragmas: [],
  5311. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5312. }, function ($methodClass){ return function (aStream){
  5313. var self=this,$self=this;
  5314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5315. return $core.withContext(function($ctx1) {
  5316. //>>excludeEnd("ctx");
  5317. var $1;
  5318. $recv(aStream)._nextPutAll_("#");
  5319. $1=$recv($self._asString())._isSelector();
  5320. if($core.assert($1)){
  5321. $recv(aStream)._nextPut_(self);
  5322. } else {
  5323. $self._printOn_(aStream);
  5324. }
  5325. return self;
  5326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5327. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5328. //>>excludeEnd("ctx");
  5329. }; }),
  5330. $globals.String);
  5331. $core.addMethod(
  5332. $core.method({
  5333. selector: "asUppercase",
  5334. protocol: "converting",
  5335. //>>excludeStart("ide", pragmas.excludeIdeData);
  5336. args: [],
  5337. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5338. referencedClasses: [],
  5339. //>>excludeEnd("ide");
  5340. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5341. messageSends: []
  5342. }, function ($methodClass){ return function (){
  5343. var self=this,$self=this;
  5344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5345. return $core.withContext(function($ctx1) {
  5346. //>>excludeEnd("ctx");
  5347. return self.toUpperCase();
  5348. return self;
  5349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5350. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5351. //>>excludeEnd("ctx");
  5352. }; }),
  5353. $globals.String);
  5354. $core.addMethod(
  5355. $core.method({
  5356. selector: "asciiValue",
  5357. protocol: "accessing",
  5358. //>>excludeStart("ide", pragmas.excludeIdeData);
  5359. args: [],
  5360. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5361. referencedClasses: [],
  5362. //>>excludeEnd("ide");
  5363. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5364. messageSends: []
  5365. }, function ($methodClass){ return function (){
  5366. var self=this,$self=this;
  5367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5368. return $core.withContext(function($ctx1) {
  5369. //>>excludeEnd("ctx");
  5370. return self.charCodeAt(0);;
  5371. return self;
  5372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5373. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5374. //>>excludeEnd("ctx");
  5375. }; }),
  5376. $globals.String);
  5377. $core.addMethod(
  5378. $core.method({
  5379. selector: "at:ifAbsent:",
  5380. protocol: "accessing",
  5381. //>>excludeStart("ide", pragmas.excludeIdeData);
  5382. args: ["anIndex", "aBlock"],
  5383. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5384. referencedClasses: [],
  5385. //>>excludeEnd("ide");
  5386. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5387. messageSends: []
  5388. }, function ($methodClass){ return function (anIndex,aBlock){
  5389. var self=this,$self=this;
  5390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5391. return $core.withContext(function($ctx1) {
  5392. //>>excludeEnd("ctx");
  5393. return String(self)[anIndex - 1] || aBlock._value();
  5394. return self;
  5395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5396. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5397. //>>excludeEnd("ctx");
  5398. }; }),
  5399. $globals.String);
  5400. $core.addMethod(
  5401. $core.method({
  5402. selector: "at:ifPresent:ifAbsent:",
  5403. protocol: "accessing",
  5404. //>>excludeStart("ide", pragmas.excludeIdeData);
  5405. args: ["anIndex", "aBlock", "anotherBlock"],
  5406. 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'>",
  5407. referencedClasses: [],
  5408. //>>excludeEnd("ide");
  5409. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5410. messageSends: []
  5411. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5412. var self=this,$self=this;
  5413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5414. return $core.withContext(function($ctx1) {
  5415. //>>excludeEnd("ctx");
  5416. var result = String(self)[anIndex - 1];
  5417. return result ? aBlock._value_(result) : anotherBlock._value();
  5418. ;
  5419. return self;
  5420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5421. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5422. //>>excludeEnd("ctx");
  5423. }; }),
  5424. $globals.String);
  5425. $core.addMethod(
  5426. $core.method({
  5427. selector: "at:put:",
  5428. protocol: "accessing",
  5429. //>>excludeStart("ide", pragmas.excludeIdeData);
  5430. args: ["anIndex", "anObject"],
  5431. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5432. referencedClasses: [],
  5433. //>>excludeEnd("ide");
  5434. pragmas: [],
  5435. messageSends: ["errorReadOnly"]
  5436. }, function ($methodClass){ return function (anIndex,anObject){
  5437. var self=this,$self=this;
  5438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5439. return $core.withContext(function($ctx1) {
  5440. //>>excludeEnd("ctx");
  5441. $self._errorReadOnly();
  5442. return self;
  5443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5444. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5445. //>>excludeEnd("ctx");
  5446. }; }),
  5447. $globals.String);
  5448. $core.addMethod(
  5449. $core.method({
  5450. selector: "capitalized",
  5451. protocol: "converting",
  5452. //>>excludeStart("ide", pragmas.excludeIdeData);
  5453. args: [],
  5454. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5455. referencedClasses: [],
  5456. //>>excludeEnd("ide");
  5457. pragmas: [],
  5458. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5459. }, function ($methodClass){ return function (){
  5460. var self=this,$self=this;
  5461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5462. return $core.withContext(function($ctx1) {
  5463. //>>excludeEnd("ctx");
  5464. return $self._ifNotEmpty_((function(){
  5465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5466. return $core.withContext(function($ctx2) {
  5467. //>>excludeEnd("ctx");
  5468. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5470. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5471. //>>excludeEnd("ctx");
  5472. }));
  5473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5474. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5475. //>>excludeEnd("ctx");
  5476. }; }),
  5477. $globals.String);
  5478. $core.addMethod(
  5479. $core.method({
  5480. selector: "charCodeAt:",
  5481. protocol: "accessing",
  5482. //>>excludeStart("ide", pragmas.excludeIdeData);
  5483. args: ["anInteger"],
  5484. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5485. referencedClasses: [],
  5486. //>>excludeEnd("ide");
  5487. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5488. messageSends: []
  5489. }, function ($methodClass){ return function (anInteger){
  5490. var self=this,$self=this;
  5491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5492. return $core.withContext(function($ctx1) {
  5493. //>>excludeEnd("ctx");
  5494. return self.charCodeAt(anInteger - 1);
  5495. return self;
  5496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5497. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5498. //>>excludeEnd("ctx");
  5499. }; }),
  5500. $globals.String);
  5501. $core.addMethod(
  5502. $core.method({
  5503. selector: "copyFrom:to:",
  5504. protocol: "copying",
  5505. //>>excludeStart("ide", pragmas.excludeIdeData);
  5506. args: ["anIndex", "anotherIndex"],
  5507. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5508. referencedClasses: [],
  5509. //>>excludeEnd("ide");
  5510. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5511. messageSends: []
  5512. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5513. var self=this,$self=this;
  5514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5515. return $core.withContext(function($ctx1) {
  5516. //>>excludeEnd("ctx");
  5517. return self.substring(anIndex - 1, anotherIndex);
  5518. return self;
  5519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5520. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5521. //>>excludeEnd("ctx");
  5522. }; }),
  5523. $globals.String);
  5524. $core.addMethod(
  5525. $core.method({
  5526. selector: "crlfSanitized",
  5527. protocol: "converting",
  5528. //>>excludeStart("ide", pragmas.excludeIdeData);
  5529. args: [],
  5530. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5531. referencedClasses: ["String"],
  5532. //>>excludeEnd("ide");
  5533. pragmas: [],
  5534. messageSends: ["join:", "lines", "lf"]
  5535. }, function ($methodClass){ return function (){
  5536. var self=this,$self=this;
  5537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5538. return $core.withContext(function($ctx1) {
  5539. //>>excludeEnd("ctx");
  5540. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5542. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5543. //>>excludeEnd("ctx");
  5544. }; }),
  5545. $globals.String);
  5546. $core.addMethod(
  5547. $core.method({
  5548. selector: "deepCopy",
  5549. protocol: "copying",
  5550. //>>excludeStart("ide", pragmas.excludeIdeData);
  5551. args: [],
  5552. source: "deepCopy\x0a\x09^ self shallowCopy",
  5553. referencedClasses: [],
  5554. //>>excludeEnd("ide");
  5555. pragmas: [],
  5556. messageSends: ["shallowCopy"]
  5557. }, function ($methodClass){ return function (){
  5558. var self=this,$self=this;
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. return $core.withContext(function($ctx1) {
  5561. //>>excludeEnd("ctx");
  5562. return $self._shallowCopy();
  5563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5564. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5565. //>>excludeEnd("ctx");
  5566. }; }),
  5567. $globals.String);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "errorReadOnly",
  5571. protocol: "error handling",
  5572. //>>excludeStart("ide", pragmas.excludeIdeData);
  5573. args: [],
  5574. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5575. referencedClasses: [],
  5576. //>>excludeEnd("ide");
  5577. pragmas: [],
  5578. messageSends: ["error:"]
  5579. }, function ($methodClass){ return function (){
  5580. var self=this,$self=this;
  5581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5582. return $core.withContext(function($ctx1) {
  5583. //>>excludeEnd("ctx");
  5584. $self._error_("Object is read-only");
  5585. return self;
  5586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5587. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5588. //>>excludeEnd("ctx");
  5589. }; }),
  5590. $globals.String);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "escaped",
  5594. protocol: "converting",
  5595. //>>excludeStart("ide", pragmas.excludeIdeData);
  5596. args: [],
  5597. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5598. referencedClasses: [],
  5599. //>>excludeEnd("ide");
  5600. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5601. messageSends: []
  5602. }, function ($methodClass){ return function (){
  5603. var self=this,$self=this;
  5604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5605. return $core.withContext(function($ctx1) {
  5606. //>>excludeEnd("ctx");
  5607. return escape(self);
  5608. return self;
  5609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5610. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5611. //>>excludeEnd("ctx");
  5612. }; }),
  5613. $globals.String);
  5614. $core.addMethod(
  5615. $core.method({
  5616. selector: "includesSubString:",
  5617. protocol: "testing",
  5618. //>>excludeStart("ide", pragmas.excludeIdeData);
  5619. args: ["subString"],
  5620. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5621. referencedClasses: [],
  5622. //>>excludeEnd("ide");
  5623. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5624. messageSends: []
  5625. }, function ($methodClass){ return function (subString){
  5626. var self=this,$self=this;
  5627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5628. return $core.withContext(function($ctx1) {
  5629. //>>excludeEnd("ctx");
  5630. return self.indexOf(subString) != -1;
  5631. return self;
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5634. //>>excludeEnd("ctx");
  5635. }; }),
  5636. $globals.String);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "isCapitalized",
  5640. protocol: "testing",
  5641. //>>excludeStart("ide", pragmas.excludeIdeData);
  5642. args: [],
  5643. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5644. referencedClasses: [],
  5645. //>>excludeEnd("ide");
  5646. pragmas: [],
  5647. messageSends: ["==", "asUppercase", "first"]
  5648. }, function ($methodClass){ return function (){
  5649. var self=this,$self=this;
  5650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5651. return $core.withContext(function($ctx1) {
  5652. //>>excludeEnd("ctx");
  5653. var $2,$1;
  5654. $2=$self._first();
  5655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5656. $ctx1.sendIdx["first"]=1;
  5657. //>>excludeEnd("ctx");
  5658. $1=$recv($2)._asUppercase();
  5659. return $recv($1).__eq_eq($self._first());
  5660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5661. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5662. //>>excludeEnd("ctx");
  5663. }; }),
  5664. $globals.String);
  5665. $core.addMethod(
  5666. $core.method({
  5667. selector: "isImmutable",
  5668. protocol: "testing",
  5669. //>>excludeStart("ide", pragmas.excludeIdeData);
  5670. args: [],
  5671. source: "isImmutable\x0a\x09^ true",
  5672. referencedClasses: [],
  5673. //>>excludeEnd("ide");
  5674. pragmas: [],
  5675. messageSends: []
  5676. }, function ($methodClass){ return function (){
  5677. var self=this,$self=this;
  5678. return true;
  5679. }; }),
  5680. $globals.String);
  5681. $core.addMethod(
  5682. $core.method({
  5683. selector: "isSelector",
  5684. protocol: "testing",
  5685. //>>excludeStart("ide", pragmas.excludeIdeData);
  5686. args: [],
  5687. 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>",
  5688. referencedClasses: [],
  5689. //>>excludeEnd("ide");
  5690. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5691. messageSends: []
  5692. }, function ($methodClass){ return function (){
  5693. var self=this,$self=this;
  5694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5695. return $core.withContext(function($ctx1) {
  5696. //>>excludeEnd("ctx");
  5697. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5698. return self;
  5699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5700. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5701. //>>excludeEnd("ctx");
  5702. }; }),
  5703. $globals.String);
  5704. $core.addMethod(
  5705. $core.method({
  5706. selector: "isString",
  5707. protocol: "testing",
  5708. //>>excludeStart("ide", pragmas.excludeIdeData);
  5709. args: [],
  5710. source: "isString\x0a\x09^ true",
  5711. referencedClasses: [],
  5712. //>>excludeEnd("ide");
  5713. pragmas: [],
  5714. messageSends: []
  5715. }, function ($methodClass){ return function (){
  5716. var self=this,$self=this;
  5717. return true;
  5718. }; }),
  5719. $globals.String);
  5720. $core.addMethod(
  5721. $core.method({
  5722. selector: "isVowel",
  5723. protocol: "testing",
  5724. //>>excludeStart("ide", pragmas.excludeIdeData);
  5725. args: [],
  5726. 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 ]",
  5727. referencedClasses: [],
  5728. //>>excludeEnd("ide");
  5729. pragmas: [],
  5730. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5731. }, function ($methodClass){ return function (){
  5732. var self=this,$self=this;
  5733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5734. return $core.withContext(function($ctx1) {
  5735. //>>excludeEnd("ctx");
  5736. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5738. return $core.withContext(function($ctx2) {
  5739. //>>excludeEnd("ctx");
  5740. return "aeiou"._includes_($self._asLowercase());
  5741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5742. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5743. //>>excludeEnd("ctx");
  5744. }));
  5745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5746. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5747. //>>excludeEnd("ctx");
  5748. }; }),
  5749. $globals.String);
  5750. $core.addMethod(
  5751. $core.method({
  5752. selector: "join:",
  5753. protocol: "split join",
  5754. //>>excludeStart("ide", pragmas.excludeIdeData);
  5755. args: ["aCollection"],
  5756. 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 ]]",
  5757. referencedClasses: ["String"],
  5758. //>>excludeEnd("ide");
  5759. pragmas: [],
  5760. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5761. }, function ($methodClass){ return function (aCollection){
  5762. var self=this,$self=this;
  5763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5764. return $core.withContext(function($ctx1) {
  5765. //>>excludeEnd("ctx");
  5766. return $recv($globals.String)._streamContents_((function(stream){
  5767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5768. return $core.withContext(function($ctx2) {
  5769. //>>excludeEnd("ctx");
  5770. return $recv(aCollection)._do_separatedBy_((function(each){
  5771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5772. return $core.withContext(function($ctx3) {
  5773. //>>excludeEnd("ctx");
  5774. return $recv(stream)._nextPutAll_($recv(each)._asString());
  5775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5776. $ctx3.sendIdx["nextPutAll:"]=1;
  5777. //>>excludeEnd("ctx");
  5778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5779. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5780. //>>excludeEnd("ctx");
  5781. }),(function(){
  5782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5783. return $core.withContext(function($ctx3) {
  5784. //>>excludeEnd("ctx");
  5785. return $recv(stream)._nextPutAll_(self);
  5786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5787. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5788. //>>excludeEnd("ctx");
  5789. }));
  5790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5791. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5792. //>>excludeEnd("ctx");
  5793. }));
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5796. //>>excludeEnd("ctx");
  5797. }; }),
  5798. $globals.String);
  5799. $core.addMethod(
  5800. $core.method({
  5801. selector: "lineIndicesDo:",
  5802. protocol: "split join",
  5803. //>>excludeStart("ide", pragmas.excludeIdeData);
  5804. args: ["aBlock"],
  5805. 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 ] ]]",
  5806. referencedClasses: ["String"],
  5807. //>>excludeEnd("ide");
  5808. pragmas: [],
  5809. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5810. }, function ($methodClass){ return function (aBlock){
  5811. var self=this,$self=this;
  5812. var cr,lf,start,sz,nextLF,nextCR;
  5813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5814. return $core.withContext(function($ctx1) {
  5815. //>>excludeEnd("ctx");
  5816. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  5817. var $early={};
  5818. try {
  5819. start=(1);
  5820. sz=$self._size();
  5821. cr=$recv($globals.String)._cr();
  5822. nextCR=$self._indexOf_startingAt_(cr,(1));
  5823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5824. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  5825. //>>excludeEnd("ctx");
  5826. lf=$recv($globals.String)._lf();
  5827. nextLF=$self._indexOf_startingAt_(lf,(1));
  5828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5829. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  5830. //>>excludeEnd("ctx");
  5831. $recv((function(){
  5832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5833. return $core.withContext(function($ctx2) {
  5834. //>>excludeEnd("ctx");
  5835. return $recv(start).__lt_eq(sz);
  5836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5838. //>>excludeEnd("ctx");
  5839. }))._whileTrue_((function(){
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. return $core.withContext(function($ctx2) {
  5842. //>>excludeEnd("ctx");
  5843. $2=$recv(nextLF).__eq((0));
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. $ctx2.sendIdx["="]=1;
  5846. //>>excludeEnd("ctx");
  5847. $1=$recv($2)._and_((function(){
  5848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5849. return $core.withContext(function($ctx3) {
  5850. //>>excludeEnd("ctx");
  5851. return $recv(nextCR).__eq((0));
  5852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5853. $ctx3.sendIdx["="]=2;
  5854. //>>excludeEnd("ctx");
  5855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5856. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5857. //>>excludeEnd("ctx");
  5858. }));
  5859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5860. $ctx2.sendIdx["and:"]=1;
  5861. //>>excludeEnd("ctx");
  5862. if($core.assert($1)){
  5863. $recv(aBlock)._value_value_value_(start,sz,sz);
  5864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5865. $ctx2.sendIdx["value:value:value:"]=1;
  5866. //>>excludeEnd("ctx");
  5867. throw $early=[self];
  5868. }
  5869. $4=$recv(nextCR).__eq((0));
  5870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5871. $ctx2.sendIdx["="]=3;
  5872. //>>excludeEnd("ctx");
  5873. $3=$recv($4)._or_((function(){
  5874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5875. return $core.withContext(function($ctx3) {
  5876. //>>excludeEnd("ctx");
  5877. $5=(0).__lt(nextLF);
  5878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5879. $ctx3.sendIdx["<"]=1;
  5880. //>>excludeEnd("ctx");
  5881. return $recv($5)._and_((function(){
  5882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5883. return $core.withContext(function($ctx4) {
  5884. //>>excludeEnd("ctx");
  5885. return $recv(nextLF).__lt(nextCR);
  5886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5887. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5888. //>>excludeEnd("ctx");
  5889. }));
  5890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5891. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5892. //>>excludeEnd("ctx");
  5893. }));
  5894. if($core.assert($3)){
  5895. $6=start;
  5896. $7=$recv(nextLF).__minus((1));
  5897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5898. $ctx2.sendIdx["-"]=1;
  5899. //>>excludeEnd("ctx");
  5900. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  5901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5902. $ctx2.sendIdx["value:value:value:"]=2;
  5903. //>>excludeEnd("ctx");
  5904. start=(1).__plus(nextLF);
  5905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5906. $ctx2.sendIdx["+"]=1;
  5907. //>>excludeEnd("ctx");
  5908. nextLF=$self._indexOf_startingAt_(lf,start);
  5909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5910. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  5911. //>>excludeEnd("ctx");
  5912. return nextLF;
  5913. } else {
  5914. $9=(1).__plus(nextCR);
  5915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5916. $ctx2.sendIdx["+"]=2;
  5917. //>>excludeEnd("ctx");
  5918. $8=$recv($9).__eq(nextLF);
  5919. if($core.assert($8)){
  5920. $10=start;
  5921. $11=$recv(nextCR).__minus((1));
  5922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5923. $ctx2.sendIdx["-"]=2;
  5924. //>>excludeEnd("ctx");
  5925. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  5926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5927. $ctx2.sendIdx["value:value:value:"]=3;
  5928. //>>excludeEnd("ctx");
  5929. start=(1).__plus(nextLF);
  5930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5931. $ctx2.sendIdx["+"]=3;
  5932. //>>excludeEnd("ctx");
  5933. nextCR=$self._indexOf_startingAt_(cr,start);
  5934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5935. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  5936. //>>excludeEnd("ctx");
  5937. nextLF=$self._indexOf_startingAt_(lf,start);
  5938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5939. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  5940. //>>excludeEnd("ctx");
  5941. return nextLF;
  5942. } else {
  5943. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5944. start=(1).__plus(nextCR);
  5945. nextCR=$self._indexOf_startingAt_(cr,start);
  5946. return nextCR;
  5947. }
  5948. }
  5949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5950. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5951. //>>excludeEnd("ctx");
  5952. }));
  5953. return self;
  5954. }
  5955. catch(e) {if(e===$early)return e[0]; throw e}
  5956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5957. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  5958. //>>excludeEnd("ctx");
  5959. }; }),
  5960. $globals.String);
  5961. $core.addMethod(
  5962. $core.method({
  5963. selector: "lineNumber:",
  5964. protocol: "split join",
  5965. //>>excludeStart("ide", pragmas.excludeIdeData);
  5966. args: ["anIndex"],
  5967. 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",
  5968. referencedClasses: [],
  5969. //>>excludeEnd("ide");
  5970. pragmas: [],
  5971. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  5972. }, function ($methodClass){ return function (anIndex){
  5973. var self=this,$self=this;
  5974. var lineCount;
  5975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5976. return $core.withContext(function($ctx1) {
  5977. //>>excludeEnd("ctx");
  5978. var $2,$1;
  5979. var $early={};
  5980. try {
  5981. lineCount=(0);
  5982. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. return $core.withContext(function($ctx2) {
  5985. //>>excludeEnd("ctx");
  5986. lineCount=$recv(lineCount).__plus((1));
  5987. $2=lineCount;
  5988. $1=$recv($2).__eq(anIndex);
  5989. if($core.assert($1)){
  5990. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  5991. }
  5992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5993. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  5994. //>>excludeEnd("ctx");
  5995. }));
  5996. return nil;
  5997. }
  5998. catch(e) {if(e===$early)return e[0]; throw e}
  5999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6000. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6001. //>>excludeEnd("ctx");
  6002. }; }),
  6003. $globals.String);
  6004. $core.addMethod(
  6005. $core.method({
  6006. selector: "lines",
  6007. protocol: "split join",
  6008. //>>excludeStart("ide", pragmas.excludeIdeData);
  6009. args: [],
  6010. 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'>",
  6011. referencedClasses: [],
  6012. //>>excludeEnd("ide");
  6013. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6014. messageSends: []
  6015. }, function ($methodClass){ return function (){
  6016. var self=this,$self=this;
  6017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6018. return $core.withContext(function($ctx1) {
  6019. //>>excludeEnd("ctx");
  6020. var result = self.split(/\r\n|\r|\n/);
  6021. if (!result[result.length-1]) result.pop();
  6022. return result;;
  6023. return self;
  6024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6025. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6026. //>>excludeEnd("ctx");
  6027. }; }),
  6028. $globals.String);
  6029. $core.addMethod(
  6030. $core.method({
  6031. selector: "linesDo:",
  6032. protocol: "split join",
  6033. //>>excludeStart("ide", pragmas.excludeIdeData);
  6034. args: ["aBlock"],
  6035. 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",
  6036. referencedClasses: [],
  6037. //>>excludeEnd("ide");
  6038. pragmas: [],
  6039. messageSends: ["do:", "lines"]
  6040. }, function ($methodClass){ return function (aBlock){
  6041. var self=this,$self=this;
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. return $core.withContext(function($ctx1) {
  6044. //>>excludeEnd("ctx");
  6045. $recv($self._lines())._do_(aBlock);
  6046. return self;
  6047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6048. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6049. //>>excludeEnd("ctx");
  6050. }; }),
  6051. $globals.String);
  6052. $core.addMethod(
  6053. $core.method({
  6054. selector: "match:",
  6055. protocol: "regular expressions",
  6056. //>>excludeStart("ide", pragmas.excludeIdeData);
  6057. args: ["aRegexp"],
  6058. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6059. referencedClasses: [],
  6060. //>>excludeEnd("ide");
  6061. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6062. messageSends: []
  6063. }, function ($methodClass){ return function (aRegexp){
  6064. var self=this,$self=this;
  6065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6066. return $core.withContext(function($ctx1) {
  6067. //>>excludeEnd("ctx");
  6068. return self.search(aRegexp) != -1;
  6069. return self;
  6070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6071. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6072. //>>excludeEnd("ctx");
  6073. }; }),
  6074. $globals.String);
  6075. $core.addMethod(
  6076. $core.method({
  6077. selector: "matchesOf:",
  6078. protocol: "regular expressions",
  6079. //>>excludeStart("ide", pragmas.excludeIdeData);
  6080. args: ["aRegularExpression"],
  6081. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6082. referencedClasses: [],
  6083. //>>excludeEnd("ide");
  6084. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6085. messageSends: []
  6086. }, function ($methodClass){ return function (aRegularExpression){
  6087. var self=this,$self=this;
  6088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6089. return $core.withContext(function($ctx1) {
  6090. //>>excludeEnd("ctx");
  6091. return self.match(aRegularExpression);
  6092. return self;
  6093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6094. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6095. //>>excludeEnd("ctx");
  6096. }; }),
  6097. $globals.String);
  6098. $core.addMethod(
  6099. $core.method({
  6100. selector: "printNl",
  6101. protocol: "printing",
  6102. //>>excludeStart("ide", pragmas.excludeIdeData);
  6103. args: [],
  6104. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6105. referencedClasses: [],
  6106. //>>excludeEnd("ide");
  6107. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6108. messageSends: []
  6109. }, function ($methodClass){ return function (){
  6110. var self=this,$self=this;
  6111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6112. return $core.withContext(function($ctx1) {
  6113. //>>excludeEnd("ctx");
  6114. console.log(self);
  6115. return self;
  6116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6117. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6118. //>>excludeEnd("ctx");
  6119. }; }),
  6120. $globals.String);
  6121. $core.addMethod(
  6122. $core.method({
  6123. selector: "printOn:",
  6124. protocol: "printing",
  6125. //>>excludeStart("ide", pragmas.excludeIdeData);
  6126. args: ["aStream"],
  6127. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6128. referencedClasses: [],
  6129. //>>excludeEnd("ide");
  6130. pragmas: [],
  6131. messageSends: ["nextPutAll:", "replace:with:"]
  6132. }, function ($methodClass){ return function (aStream){
  6133. var self=this,$self=this;
  6134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6135. return $core.withContext(function($ctx1) {
  6136. //>>excludeEnd("ctx");
  6137. $recv(aStream)._nextPutAll_("'");
  6138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6139. $ctx1.sendIdx["nextPutAll:"]=1;
  6140. //>>excludeEnd("ctx");
  6141. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  6142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6143. $ctx1.sendIdx["nextPutAll:"]=2;
  6144. //>>excludeEnd("ctx");
  6145. $recv(aStream)._nextPutAll_("'");
  6146. return self;
  6147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6148. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6149. //>>excludeEnd("ctx");
  6150. }; }),
  6151. $globals.String);
  6152. $core.addMethod(
  6153. $core.method({
  6154. selector: "putOn:",
  6155. protocol: "streaming",
  6156. //>>excludeStart("ide", pragmas.excludeIdeData);
  6157. args: ["aStream"],
  6158. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6159. referencedClasses: [],
  6160. //>>excludeEnd("ide");
  6161. pragmas: [],
  6162. messageSends: ["nextPutString:"]
  6163. }, function ($methodClass){ return function (aStream){
  6164. var self=this,$self=this;
  6165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6166. return $core.withContext(function($ctx1) {
  6167. //>>excludeEnd("ctx");
  6168. $recv(aStream)._nextPutString_(self);
  6169. return self;
  6170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6171. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6172. //>>excludeEnd("ctx");
  6173. }; }),
  6174. $globals.String);
  6175. $core.addMethod(
  6176. $core.method({
  6177. selector: "remove:",
  6178. protocol: "adding/removing",
  6179. //>>excludeStart("ide", pragmas.excludeIdeData);
  6180. args: ["anObject"],
  6181. source: "remove: anObject\x0a\x09self errorReadOnly",
  6182. referencedClasses: [],
  6183. //>>excludeEnd("ide");
  6184. pragmas: [],
  6185. messageSends: ["errorReadOnly"]
  6186. }, function ($methodClass){ return function (anObject){
  6187. var self=this,$self=this;
  6188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6189. return $core.withContext(function($ctx1) {
  6190. //>>excludeEnd("ctx");
  6191. $self._errorReadOnly();
  6192. return self;
  6193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6194. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6195. //>>excludeEnd("ctx");
  6196. }; }),
  6197. $globals.String);
  6198. $core.addMethod(
  6199. $core.method({
  6200. selector: "remove:ifAbsent:",
  6201. protocol: "adding/removing",
  6202. //>>excludeStart("ide", pragmas.excludeIdeData);
  6203. args: ["anObject", "aBlock"],
  6204. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6205. referencedClasses: [],
  6206. //>>excludeEnd("ide");
  6207. pragmas: [],
  6208. messageSends: ["errorReadOnly"]
  6209. }, function ($methodClass){ return function (anObject,aBlock){
  6210. var self=this,$self=this;
  6211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6212. return $core.withContext(function($ctx1) {
  6213. //>>excludeEnd("ctx");
  6214. $self._errorReadOnly();
  6215. return self;
  6216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6217. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6218. //>>excludeEnd("ctx");
  6219. }; }),
  6220. $globals.String);
  6221. $core.addMethod(
  6222. $core.method({
  6223. selector: "replace:with:",
  6224. protocol: "regular expressions",
  6225. //>>excludeStart("ide", pragmas.excludeIdeData);
  6226. args: ["aString", "anotherString"],
  6227. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6228. referencedClasses: ["RegularExpression"],
  6229. //>>excludeEnd("ide");
  6230. pragmas: [],
  6231. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6232. }, function ($methodClass){ return function (aString,anotherString){
  6233. var self=this,$self=this;
  6234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6235. return $core.withContext(function($ctx1) {
  6236. //>>excludeEnd("ctx");
  6237. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6239. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6240. //>>excludeEnd("ctx");
  6241. }; }),
  6242. $globals.String);
  6243. $core.addMethod(
  6244. $core.method({
  6245. selector: "replaceRegexp:with:",
  6246. protocol: "regular expressions",
  6247. //>>excludeStart("ide", pragmas.excludeIdeData);
  6248. args: ["aRegexp", "aString"],
  6249. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6250. referencedClasses: [],
  6251. //>>excludeEnd("ide");
  6252. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6253. messageSends: []
  6254. }, function ($methodClass){ return function (aRegexp,aString){
  6255. var self=this,$self=this;
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. return $core.withContext(function($ctx1) {
  6258. //>>excludeEnd("ctx");
  6259. return self.replace(aRegexp, aString);
  6260. return self;
  6261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6262. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6263. //>>excludeEnd("ctx");
  6264. }; }),
  6265. $globals.String);
  6266. $core.addMethod(
  6267. $core.method({
  6268. selector: "reversed",
  6269. protocol: "converting",
  6270. //>>excludeStart("ide", pragmas.excludeIdeData);
  6271. args: [],
  6272. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6273. referencedClasses: [],
  6274. //>>excludeEnd("ide");
  6275. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6276. messageSends: []
  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 self.split("").reverse().join("");
  6283. return self;
  6284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6285. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6286. //>>excludeEnd("ctx");
  6287. }; }),
  6288. $globals.String);
  6289. $core.addMethod(
  6290. $core.method({
  6291. selector: "shallowCopy",
  6292. protocol: "copying",
  6293. //>>excludeStart("ide", pragmas.excludeIdeData);
  6294. args: [],
  6295. source: "shallowCopy\x0a\x09^ self",
  6296. referencedClasses: [],
  6297. //>>excludeEnd("ide");
  6298. pragmas: [],
  6299. messageSends: []
  6300. }, function ($methodClass){ return function (){
  6301. var self=this,$self=this;
  6302. return self;
  6303. }; }),
  6304. $globals.String);
  6305. $core.addMethod(
  6306. $core.method({
  6307. selector: "subStrings:",
  6308. protocol: "split join",
  6309. //>>excludeStart("ide", pragmas.excludeIdeData);
  6310. args: ["aString"],
  6311. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6312. referencedClasses: [],
  6313. //>>excludeEnd("ide");
  6314. pragmas: [],
  6315. messageSends: ["tokenize:"]
  6316. }, function ($methodClass){ return function (aString){
  6317. var self=this,$self=this;
  6318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6319. return $core.withContext(function($ctx1) {
  6320. //>>excludeEnd("ctx");
  6321. return $self._tokenize_(aString);
  6322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6323. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6324. //>>excludeEnd("ctx");
  6325. }; }),
  6326. $globals.String);
  6327. $core.addMethod(
  6328. $core.method({
  6329. selector: "symbolPrintString",
  6330. protocol: "printing",
  6331. //>>excludeStart("ide", pragmas.excludeIdeData);
  6332. args: [],
  6333. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6334. referencedClasses: ["String"],
  6335. //>>excludeEnd("ide");
  6336. pragmas: [],
  6337. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6338. }, function ($methodClass){ return function (){
  6339. var self=this,$self=this;
  6340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6341. return $core.withContext(function($ctx1) {
  6342. //>>excludeEnd("ctx");
  6343. return $recv($globals.String)._streamContents_((function(str){
  6344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6345. return $core.withContext(function($ctx2) {
  6346. //>>excludeEnd("ctx");
  6347. return $self._asSymbolPrintOn_(str);
  6348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6349. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6350. //>>excludeEnd("ctx");
  6351. }));
  6352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6353. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6354. //>>excludeEnd("ctx");
  6355. }; }),
  6356. $globals.String);
  6357. $core.addMethod(
  6358. $core.method({
  6359. selector: "tokenize:",
  6360. protocol: "split join",
  6361. //>>excludeStart("ide", pragmas.excludeIdeData);
  6362. args: ["aString"],
  6363. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6364. referencedClasses: [],
  6365. //>>excludeEnd("ide");
  6366. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6367. messageSends: []
  6368. }, function ($methodClass){ return function (aString){
  6369. var self=this,$self=this;
  6370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6371. return $core.withContext(function($ctx1) {
  6372. //>>excludeEnd("ctx");
  6373. return self.split(aString);
  6374. return self;
  6375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6376. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6377. //>>excludeEnd("ctx");
  6378. }; }),
  6379. $globals.String);
  6380. $core.addMethod(
  6381. $core.method({
  6382. selector: "trimBoth",
  6383. protocol: "regular expressions",
  6384. //>>excludeStart("ide", pragmas.excludeIdeData);
  6385. args: [],
  6386. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6387. referencedClasses: [],
  6388. //>>excludeEnd("ide");
  6389. pragmas: [],
  6390. messageSends: ["trimBoth:"]
  6391. }, function ($methodClass){ return function (){
  6392. var self=this,$self=this;
  6393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6394. return $core.withContext(function($ctx1) {
  6395. //>>excludeEnd("ctx");
  6396. return $self._trimBoth_("\x5cs");
  6397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6398. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6399. //>>excludeEnd("ctx");
  6400. }; }),
  6401. $globals.String);
  6402. $core.addMethod(
  6403. $core.method({
  6404. selector: "trimBoth:",
  6405. protocol: "regular expressions",
  6406. //>>excludeStart("ide", pragmas.excludeIdeData);
  6407. args: ["separators"],
  6408. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6409. referencedClasses: [],
  6410. //>>excludeEnd("ide");
  6411. pragmas: [],
  6412. messageSends: ["trimRight:", "trimLeft:"]
  6413. }, function ($methodClass){ return function (separators){
  6414. var self=this,$self=this;
  6415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6416. return $core.withContext(function($ctx1) {
  6417. //>>excludeEnd("ctx");
  6418. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6420. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6421. //>>excludeEnd("ctx");
  6422. }; }),
  6423. $globals.String);
  6424. $core.addMethod(
  6425. $core.method({
  6426. selector: "trimLeft",
  6427. protocol: "regular expressions",
  6428. //>>excludeStart("ide", pragmas.excludeIdeData);
  6429. args: [],
  6430. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6431. referencedClasses: [],
  6432. //>>excludeEnd("ide");
  6433. pragmas: [],
  6434. messageSends: ["trimLeft:"]
  6435. }, function ($methodClass){ return function (){
  6436. var self=this,$self=this;
  6437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6438. return $core.withContext(function($ctx1) {
  6439. //>>excludeEnd("ctx");
  6440. return $self._trimLeft_("\x5cs");
  6441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6442. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6443. //>>excludeEnd("ctx");
  6444. }; }),
  6445. $globals.String);
  6446. $core.addMethod(
  6447. $core.method({
  6448. selector: "trimLeft:",
  6449. protocol: "regular expressions",
  6450. //>>excludeStart("ide", pragmas.excludeIdeData);
  6451. args: ["separators"],
  6452. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6453. referencedClasses: ["RegularExpression"],
  6454. //>>excludeEnd("ide");
  6455. pragmas: [],
  6456. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6457. }, function ($methodClass){ return function (separators){
  6458. var self=this,$self=this;
  6459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6460. return $core.withContext(function($ctx1) {
  6461. //>>excludeEnd("ctx");
  6462. var $2,$1;
  6463. $2=$recv("^[".__comma(separators)).__comma("]+");
  6464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6465. $ctx1.sendIdx[","]=1;
  6466. //>>excludeEnd("ctx");
  6467. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6468. return $self._replaceRegexp_with_($1,"");
  6469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6470. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6471. //>>excludeEnd("ctx");
  6472. }; }),
  6473. $globals.String);
  6474. $core.addMethod(
  6475. $core.method({
  6476. selector: "trimRight",
  6477. protocol: "regular expressions",
  6478. //>>excludeStart("ide", pragmas.excludeIdeData);
  6479. args: [],
  6480. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6481. referencedClasses: [],
  6482. //>>excludeEnd("ide");
  6483. pragmas: [],
  6484. messageSends: ["trimRight:"]
  6485. }, function ($methodClass){ return function (){
  6486. var self=this,$self=this;
  6487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6488. return $core.withContext(function($ctx1) {
  6489. //>>excludeEnd("ctx");
  6490. return $self._trimRight_("\x5cs");
  6491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6492. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6493. //>>excludeEnd("ctx");
  6494. }; }),
  6495. $globals.String);
  6496. $core.addMethod(
  6497. $core.method({
  6498. selector: "trimRight:",
  6499. protocol: "regular expressions",
  6500. //>>excludeStart("ide", pragmas.excludeIdeData);
  6501. args: ["separators"],
  6502. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6503. referencedClasses: ["RegularExpression"],
  6504. //>>excludeEnd("ide");
  6505. pragmas: [],
  6506. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6507. }, function ($methodClass){ return function (separators){
  6508. var self=this,$self=this;
  6509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6510. return $core.withContext(function($ctx1) {
  6511. //>>excludeEnd("ctx");
  6512. var $2,$1;
  6513. $2=$recv("[".__comma(separators)).__comma("]+$");
  6514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6515. $ctx1.sendIdx[","]=1;
  6516. //>>excludeEnd("ctx");
  6517. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6518. return $self._replaceRegexp_with_($1,"");
  6519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6520. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6521. //>>excludeEnd("ctx");
  6522. }; }),
  6523. $globals.String);
  6524. $core.addMethod(
  6525. $core.method({
  6526. selector: "unescaped",
  6527. protocol: "converting",
  6528. //>>excludeStart("ide", pragmas.excludeIdeData);
  6529. args: [],
  6530. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6531. referencedClasses: [],
  6532. //>>excludeEnd("ide");
  6533. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6534. messageSends: []
  6535. }, function ($methodClass){ return function (){
  6536. var self=this,$self=this;
  6537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6538. return $core.withContext(function($ctx1) {
  6539. //>>excludeEnd("ctx");
  6540. return unescape(self);
  6541. return self;
  6542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6543. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6544. //>>excludeEnd("ctx");
  6545. }; }),
  6546. $globals.String);
  6547. $core.addMethod(
  6548. $core.method({
  6549. selector: "uriComponentDecoded",
  6550. protocol: "converting",
  6551. //>>excludeStart("ide", pragmas.excludeIdeData);
  6552. args: [],
  6553. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6554. referencedClasses: [],
  6555. //>>excludeEnd("ide");
  6556. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6557. messageSends: []
  6558. }, function ($methodClass){ return function (){
  6559. var self=this,$self=this;
  6560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6561. return $core.withContext(function($ctx1) {
  6562. //>>excludeEnd("ctx");
  6563. return decodeURIComponent(self);
  6564. return self;
  6565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6566. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6567. //>>excludeEnd("ctx");
  6568. }; }),
  6569. $globals.String);
  6570. $core.addMethod(
  6571. $core.method({
  6572. selector: "uriComponentEncoded",
  6573. protocol: "converting",
  6574. //>>excludeStart("ide", pragmas.excludeIdeData);
  6575. args: [],
  6576. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6577. referencedClasses: [],
  6578. //>>excludeEnd("ide");
  6579. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6580. messageSends: []
  6581. }, function ($methodClass){ return function (){
  6582. var self=this,$self=this;
  6583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6584. return $core.withContext(function($ctx1) {
  6585. //>>excludeEnd("ctx");
  6586. return encodeURIComponent(self);
  6587. return self;
  6588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6589. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6590. //>>excludeEnd("ctx");
  6591. }; }),
  6592. $globals.String);
  6593. $core.addMethod(
  6594. $core.method({
  6595. selector: "uriDecoded",
  6596. protocol: "converting",
  6597. //>>excludeStart("ide", pragmas.excludeIdeData);
  6598. args: [],
  6599. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6600. referencedClasses: [],
  6601. //>>excludeEnd("ide");
  6602. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6603. messageSends: []
  6604. }, function ($methodClass){ return function (){
  6605. var self=this,$self=this;
  6606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6607. return $core.withContext(function($ctx1) {
  6608. //>>excludeEnd("ctx");
  6609. return decodeURI(self);
  6610. return self;
  6611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6612. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6613. //>>excludeEnd("ctx");
  6614. }; }),
  6615. $globals.String);
  6616. $core.addMethod(
  6617. $core.method({
  6618. selector: "uriEncoded",
  6619. protocol: "converting",
  6620. //>>excludeStart("ide", pragmas.excludeIdeData);
  6621. args: [],
  6622. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6623. referencedClasses: [],
  6624. //>>excludeEnd("ide");
  6625. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6626. messageSends: []
  6627. }, function ($methodClass){ return function (){
  6628. var self=this,$self=this;
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. return $core.withContext(function($ctx1) {
  6631. //>>excludeEnd("ctx");
  6632. return encodeURI(self);
  6633. return self;
  6634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6635. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6636. //>>excludeEnd("ctx");
  6637. }; }),
  6638. $globals.String);
  6639. $core.addMethod(
  6640. $core.method({
  6641. selector: "value:",
  6642. protocol: "evaluating",
  6643. //>>excludeStart("ide", pragmas.excludeIdeData);
  6644. args: ["anObject"],
  6645. source: "value: anObject \x0a\x09^ anObject perform: self",
  6646. referencedClasses: [],
  6647. //>>excludeEnd("ide");
  6648. pragmas: [],
  6649. messageSends: ["perform:"]
  6650. }, function ($methodClass){ return function (anObject){
  6651. var self=this,$self=this;
  6652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6653. return $core.withContext(function($ctx1) {
  6654. //>>excludeEnd("ctx");
  6655. return $recv(anObject)._perform_(self);
  6656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6657. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6658. //>>excludeEnd("ctx");
  6659. }; }),
  6660. $globals.String);
  6661. $core.addMethod(
  6662. $core.method({
  6663. selector: "cr",
  6664. protocol: "accessing",
  6665. //>>excludeStart("ide", pragmas.excludeIdeData);
  6666. args: [],
  6667. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6668. referencedClasses: [],
  6669. //>>excludeEnd("ide");
  6670. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6671. messageSends: []
  6672. }, function ($methodClass){ return function (){
  6673. var self=this,$self=this;
  6674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6675. return $core.withContext(function($ctx1) {
  6676. //>>excludeEnd("ctx");
  6677. return "\r";
  6678. return self;
  6679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6680. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6681. //>>excludeEnd("ctx");
  6682. }; }),
  6683. $globals.String.a$cls);
  6684. $core.addMethod(
  6685. $core.method({
  6686. selector: "crlf",
  6687. protocol: "accessing",
  6688. //>>excludeStart("ide", pragmas.excludeIdeData);
  6689. args: [],
  6690. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6691. referencedClasses: [],
  6692. //>>excludeEnd("ide");
  6693. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6694. messageSends: []
  6695. }, function ($methodClass){ return function (){
  6696. var self=this,$self=this;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. return $core.withContext(function($ctx1) {
  6699. //>>excludeEnd("ctx");
  6700. return "\r\n";
  6701. return self;
  6702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6703. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6704. //>>excludeEnd("ctx");
  6705. }; }),
  6706. $globals.String.a$cls);
  6707. $core.addMethod(
  6708. $core.method({
  6709. selector: "esc",
  6710. protocol: "accessing",
  6711. //>>excludeStart("ide", pragmas.excludeIdeData);
  6712. args: [],
  6713. source: "esc\x0a\x09^ self fromCharCode: 27",
  6714. referencedClasses: [],
  6715. //>>excludeEnd("ide");
  6716. pragmas: [],
  6717. messageSends: ["fromCharCode:"]
  6718. }, function ($methodClass){ return function (){
  6719. var self=this,$self=this;
  6720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6721. return $core.withContext(function($ctx1) {
  6722. //>>excludeEnd("ctx");
  6723. return $self._fromCharCode_((27));
  6724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6725. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6726. //>>excludeEnd("ctx");
  6727. }; }),
  6728. $globals.String.a$cls);
  6729. $core.addMethod(
  6730. $core.method({
  6731. selector: "fromCharCode:",
  6732. protocol: "instance creation",
  6733. //>>excludeStart("ide", pragmas.excludeIdeData);
  6734. args: ["anInteger"],
  6735. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6736. referencedClasses: [],
  6737. //>>excludeEnd("ide");
  6738. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6739. messageSends: []
  6740. }, function ($methodClass){ return function (anInteger){
  6741. var self=this,$self=this;
  6742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6743. return $core.withContext(function($ctx1) {
  6744. //>>excludeEnd("ctx");
  6745. return String.fromCharCode(anInteger);
  6746. return self;
  6747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6748. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6749. //>>excludeEnd("ctx");
  6750. }; }),
  6751. $globals.String.a$cls);
  6752. $core.addMethod(
  6753. $core.method({
  6754. selector: "fromString:",
  6755. protocol: "instance creation",
  6756. //>>excludeStart("ide", pragmas.excludeIdeData);
  6757. args: ["aString"],
  6758. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6759. referencedClasses: [],
  6760. //>>excludeEnd("ide");
  6761. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6762. messageSends: []
  6763. }, function ($methodClass){ return function (aString){
  6764. var self=this,$self=this;
  6765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6766. return $core.withContext(function($ctx1) {
  6767. //>>excludeEnd("ctx");
  6768. return String(aString);
  6769. return self;
  6770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6771. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6772. //>>excludeEnd("ctx");
  6773. }; }),
  6774. $globals.String.a$cls);
  6775. $core.addMethod(
  6776. $core.method({
  6777. selector: "lf",
  6778. protocol: "accessing",
  6779. //>>excludeStart("ide", pragmas.excludeIdeData);
  6780. args: [],
  6781. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6782. referencedClasses: [],
  6783. //>>excludeEnd("ide");
  6784. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6785. messageSends: []
  6786. }, function ($methodClass){ return function (){
  6787. var self=this,$self=this;
  6788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6789. return $core.withContext(function($ctx1) {
  6790. //>>excludeEnd("ctx");
  6791. return "\n";
  6792. return self;
  6793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6794. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6795. //>>excludeEnd("ctx");
  6796. }; }),
  6797. $globals.String.a$cls);
  6798. $core.addMethod(
  6799. $core.method({
  6800. selector: "random",
  6801. protocol: "random",
  6802. //>>excludeStart("ide", pragmas.excludeIdeData);
  6803. args: [],
  6804. 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);'>",
  6805. referencedClasses: [],
  6806. //>>excludeEnd("ide");
  6807. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6808. messageSends: []
  6809. }, function ($methodClass){ return function (){
  6810. var self=this,$self=this;
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. return $core.withContext(function($ctx1) {
  6813. //>>excludeEnd("ctx");
  6814. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6815. return self;
  6816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6817. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6818. //>>excludeEnd("ctx");
  6819. }; }),
  6820. $globals.String.a$cls);
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "randomNotIn:",
  6824. protocol: "random",
  6825. //>>excludeStart("ide", pragmas.excludeIdeData);
  6826. args: ["aString"],
  6827. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6828. referencedClasses: [],
  6829. //>>excludeEnd("ide");
  6830. pragmas: [],
  6831. messageSends: ["whileTrue", "random", "includesSubString:"]
  6832. }, function ($methodClass){ return function (aString){
  6833. var self=this,$self=this;
  6834. var result;
  6835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6836. return $core.withContext(function($ctx1) {
  6837. //>>excludeEnd("ctx");
  6838. $recv((function(){
  6839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6840. return $core.withContext(function($ctx2) {
  6841. //>>excludeEnd("ctx");
  6842. result=$self._random();
  6843. return $recv(aString)._includesSubString_(result);
  6844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6845. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6846. //>>excludeEnd("ctx");
  6847. }))._whileTrue();
  6848. return result;
  6849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6850. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6851. //>>excludeEnd("ctx");
  6852. }; }),
  6853. $globals.String.a$cls);
  6854. $core.addMethod(
  6855. $core.method({
  6856. selector: "space",
  6857. protocol: "accessing",
  6858. //>>excludeStart("ide", pragmas.excludeIdeData);
  6859. args: [],
  6860. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6861. referencedClasses: [],
  6862. //>>excludeEnd("ide");
  6863. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6864. messageSends: []
  6865. }, function ($methodClass){ return function (){
  6866. var self=this,$self=this;
  6867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6868. return $core.withContext(function($ctx1) {
  6869. //>>excludeEnd("ctx");
  6870. return " ";
  6871. return self;
  6872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6873. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6874. //>>excludeEnd("ctx");
  6875. }; }),
  6876. $globals.String.a$cls);
  6877. $core.addMethod(
  6878. $core.method({
  6879. selector: "streamClass",
  6880. protocol: "accessing",
  6881. //>>excludeStart("ide", pragmas.excludeIdeData);
  6882. args: [],
  6883. source: "streamClass\x0a\x09\x09^ StringStream",
  6884. referencedClasses: ["StringStream"],
  6885. //>>excludeEnd("ide");
  6886. pragmas: [],
  6887. messageSends: []
  6888. }, function ($methodClass){ return function (){
  6889. var self=this,$self=this;
  6890. return $globals.StringStream;
  6891. }; }),
  6892. $globals.String.a$cls);
  6893. $core.addMethod(
  6894. $core.method({
  6895. selector: "tab",
  6896. protocol: "accessing",
  6897. //>>excludeStart("ide", pragmas.excludeIdeData);
  6898. args: [],
  6899. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6900. referencedClasses: [],
  6901. //>>excludeEnd("ide");
  6902. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6903. messageSends: []
  6904. }, function ($methodClass){ return function (){
  6905. var self=this,$self=this;
  6906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6907. return $core.withContext(function($ctx1) {
  6908. //>>excludeEnd("ctx");
  6909. return "\t";
  6910. return self;
  6911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6912. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  6913. //>>excludeEnd("ctx");
  6914. }; }),
  6915. $globals.String.a$cls);
  6916. $core.addMethod(
  6917. $core.method({
  6918. selector: "value:",
  6919. protocol: "instance creation",
  6920. //>>excludeStart("ide", pragmas.excludeIdeData);
  6921. args: ["aUTFCharCode"],
  6922. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6923. referencedClasses: [],
  6924. //>>excludeEnd("ide");
  6925. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  6926. messageSends: []
  6927. }, function ($methodClass){ return function (aUTFCharCode){
  6928. var self=this,$self=this;
  6929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6930. return $core.withContext(function($ctx1) {
  6931. //>>excludeEnd("ctx");
  6932. return String.fromCharCode(aUTFCharCode);;
  6933. return self;
  6934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6935. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  6936. //>>excludeEnd("ctx");
  6937. }; }),
  6938. $globals.String.a$cls);
  6939. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6940. //>>excludeStart("ide", pragmas.excludeIdeData);
  6941. $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`.";
  6942. //>>excludeEnd("ide");
  6943. $core.addMethod(
  6944. $core.method({
  6945. selector: "=",
  6946. protocol: "comparing",
  6947. //>>excludeStart("ide", pragmas.excludeIdeData);
  6948. args: ["aCollection"],
  6949. 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",
  6950. referencedClasses: [],
  6951. //>>excludeEnd("ide");
  6952. pragmas: [],
  6953. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  6954. }, function ($methodClass){ return function (aCollection){
  6955. var self=this,$self=this;
  6956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6957. return $core.withContext(function($ctx1) {
  6958. //>>excludeEnd("ctx");
  6959. var $2,$1,$4,$3,$5;
  6960. var $early={};
  6961. try {
  6962. $2=$self._class();
  6963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6964. $ctx1.sendIdx["class"]=1;
  6965. //>>excludeEnd("ctx");
  6966. $1=$recv($2).__eq($recv(aCollection)._class());
  6967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6968. $ctx1.sendIdx["="]=1;
  6969. //>>excludeEnd("ctx");
  6970. if(!$core.assert($1)){
  6971. return false;
  6972. }
  6973. $4=$self._size();
  6974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6975. $ctx1.sendIdx["size"]=1;
  6976. //>>excludeEnd("ctx");
  6977. $3=$recv($4).__eq($recv(aCollection)._size());
  6978. if(!$core.assert($3)){
  6979. return false;
  6980. }
  6981. $self._do_((function(each){
  6982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6983. return $core.withContext(function($ctx2) {
  6984. //>>excludeEnd("ctx");
  6985. $5=$recv(aCollection)._includes_(each);
  6986. if(!$core.assert($5)){
  6987. throw $early=[false];
  6988. }
  6989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  6991. //>>excludeEnd("ctx");
  6992. }));
  6993. return true;
  6994. }
  6995. catch(e) {if(e===$early)return e[0]; throw e}
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  6998. //>>excludeEnd("ctx");
  6999. }; }),
  7000. $globals.Set);
  7001. $core.addMethod(
  7002. $core.method({
  7003. selector: "add:",
  7004. protocol: "adding/removing",
  7005. //>>excludeStart("ide", pragmas.excludeIdeData);
  7006. args: ["anObject"],
  7007. 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 ]",
  7008. referencedClasses: [],
  7009. //>>excludeEnd("ide");
  7010. pragmas: [],
  7011. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7012. }, function ($methodClass){ return function (anObject){
  7013. var self=this,$self=this;
  7014. var bucket;
  7015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7016. return $core.withContext(function($ctx1) {
  7017. //>>excludeEnd("ctx");
  7018. var $1,$receiver;
  7019. bucket=$self._bucketsOfElement_(anObject);
  7020. $1=$recv(bucket)._second();
  7021. if(($receiver = $1) == null || $receiver.a$nil){
  7022. var object,slowBucket;
  7023. object=$recv(bucket)._first();
  7024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7025. $ctx1.sendIdx["first"]=1;
  7026. //>>excludeEnd("ctx");
  7027. slowBucket=$recv(bucket)._third();
  7028. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7030. return $core.withContext(function($ctx2) {
  7031. //>>excludeEnd("ctx");
  7032. $recv(slowBucket)._add_(object);
  7033. $self.size=$recv($self.size).__plus((1));
  7034. return $self.size;
  7035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7036. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7037. //>>excludeEnd("ctx");
  7038. }));
  7039. return object;
  7040. } else {
  7041. var primitiveBucket;
  7042. primitiveBucket=$receiver;
  7043. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7044. }
  7045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7046. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7047. //>>excludeEnd("ctx");
  7048. }; }),
  7049. $globals.Set);
  7050. $core.addMethod(
  7051. $core.method({
  7052. selector: "add:in:",
  7053. protocol: "private",
  7054. //>>excludeStart("ide", pragmas.excludeIdeData);
  7055. args: ["anObject", "anotherObject"],
  7056. 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'>",
  7057. referencedClasses: [],
  7058. //>>excludeEnd("ide");
  7059. 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"]]],
  7060. messageSends: []
  7061. }, function ($methodClass){ return function (anObject,anotherObject){
  7062. var self=this,$self=this;
  7063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7064. return $core.withContext(function($ctx1) {
  7065. //>>excludeEnd("ctx");
  7066. if (anObject in anotherObject.store) { return anObject; }
  7067. $self.size++;
  7068. anotherObject.store[anObject] = true;
  7069. return anObject;
  7070. ;
  7071. return self;
  7072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7073. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7074. //>>excludeEnd("ctx");
  7075. }; }),
  7076. $globals.Set);
  7077. $core.addMethod(
  7078. $core.method({
  7079. selector: "bucketsOfElement:",
  7080. protocol: "private",
  7081. //>>excludeStart("ide", pragmas.excludeIdeData);
  7082. args: ["anObject"],
  7083. 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'>",
  7084. referencedClasses: [],
  7085. //>>excludeEnd("ide");
  7086. 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"]]],
  7087. messageSends: []
  7088. }, function ($methodClass){ return function (anObject){
  7089. var self=this,$self=this;
  7090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7091. return $core.withContext(function($ctx1) {
  7092. //>>excludeEnd("ctx");
  7093. // include nil to well-known objects under "boolean" fastBucket
  7094. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7095. var prim = anObject.valueOf();
  7096. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7097. var bucket = null;
  7098. $self.slowBucketStores.some(function (store) {
  7099. return bucket = store._bucketOfElement_(anObject);
  7100. });
  7101. return [ anObject, null, bucket || $self.defaultBucket ];
  7102. }
  7103. return [ prim, $self.fastBuckets[typeof prim] ];
  7104. ;
  7105. return self;
  7106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7107. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7108. //>>excludeEnd("ctx");
  7109. }; }),
  7110. $globals.Set);
  7111. $core.addMethod(
  7112. $core.method({
  7113. selector: "classNameOf:",
  7114. protocol: "private",
  7115. //>>excludeStart("ide", pragmas.excludeIdeData);
  7116. args: ["anObject"],
  7117. 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'>",
  7118. referencedClasses: [],
  7119. //>>excludeEnd("ide");
  7120. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7121. messageSends: []
  7122. }, function ($methodClass){ return function (anObject){
  7123. var self=this,$self=this;
  7124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7125. return $core.withContext(function($ctx1) {
  7126. //>>excludeEnd("ctx");
  7127. return anObject.a$cls != null && anObject.a$cls.name;
  7128. return self;
  7129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7130. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7131. //>>excludeEnd("ctx");
  7132. }; }),
  7133. $globals.Set);
  7134. $core.addMethod(
  7135. $core.method({
  7136. selector: "collect:",
  7137. protocol: "enumerating",
  7138. //>>excludeStart("ide", pragmas.excludeIdeData);
  7139. args: ["aBlock"],
  7140. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7141. referencedClasses: [],
  7142. //>>excludeEnd("ide");
  7143. pragmas: [],
  7144. messageSends: ["new", "class", "do:", "add:", "value:"]
  7145. }, function ($methodClass){ return function (aBlock){
  7146. var self=this,$self=this;
  7147. var collection;
  7148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7149. return $core.withContext(function($ctx1) {
  7150. //>>excludeEnd("ctx");
  7151. collection=$recv($self._class())._new();
  7152. $self._do_((function(each){
  7153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7154. return $core.withContext(function($ctx2) {
  7155. //>>excludeEnd("ctx");
  7156. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7158. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7159. //>>excludeEnd("ctx");
  7160. }));
  7161. return collection;
  7162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7163. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7164. //>>excludeEnd("ctx");
  7165. }; }),
  7166. $globals.Set);
  7167. $core.addMethod(
  7168. $core.method({
  7169. selector: "do:",
  7170. protocol: "enumerating",
  7171. //>>excludeStart("ide", pragmas.excludeIdeData);
  7172. args: ["aBlock"],
  7173. 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'>",
  7174. referencedClasses: [],
  7175. //>>excludeEnd("ide");
  7176. 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"]]],
  7177. messageSends: []
  7178. }, function ($methodClass){ return function (aBlock){
  7179. var self=this,$self=this;
  7180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7181. return $core.withContext(function($ctx1) {
  7182. //>>excludeEnd("ctx");
  7183. var el, keys, i;
  7184. el = $self.fastBuckets;
  7185. keys = Object.keys(el);
  7186. for (i = 0; i < keys.length; ++i) {
  7187. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7188. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7189. else { store._do_(aBlock); }
  7190. }
  7191. el = $self.slowBucketStores;
  7192. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7193. $self.defaultBucket._do_(aBlock);
  7194. ;
  7195. return self;
  7196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7197. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7198. //>>excludeEnd("ctx");
  7199. }; }),
  7200. $globals.Set);
  7201. $core.addMethod(
  7202. $core.method({
  7203. selector: "includes:",
  7204. protocol: "testing",
  7205. //>>excludeStart("ide", pragmas.excludeIdeData);
  7206. args: ["anObject"],
  7207. 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 ]",
  7208. referencedClasses: [],
  7209. //>>excludeEnd("ide");
  7210. pragmas: [],
  7211. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7212. }, function ($methodClass){ return function (anObject){
  7213. var self=this,$self=this;
  7214. var bucket;
  7215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7216. return $core.withContext(function($ctx1) {
  7217. //>>excludeEnd("ctx");
  7218. var $1,$2,$3,$receiver;
  7219. bucket=$self._bucketsOfElement_(anObject);
  7220. $1=$recv(bucket)._second();
  7221. if(($receiver = $1) == null || $receiver.a$nil){
  7222. $2=$recv(bucket)._third();
  7223. $3=$recv(bucket)._first();
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. $ctx1.sendIdx["first"]=1;
  7226. //>>excludeEnd("ctx");
  7227. return $recv($2)._includes_($3);
  7228. } else {
  7229. var primitiveBucket;
  7230. primitiveBucket=$receiver;
  7231. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7232. }
  7233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7234. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7235. //>>excludeEnd("ctx");
  7236. }; }),
  7237. $globals.Set);
  7238. $core.addMethod(
  7239. $core.method({
  7240. selector: "includes:in:",
  7241. protocol: "private",
  7242. //>>excludeStart("ide", pragmas.excludeIdeData);
  7243. args: ["anObject", "anotherObject"],
  7244. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7245. referencedClasses: [],
  7246. //>>excludeEnd("ide");
  7247. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7248. messageSends: []
  7249. }, function ($methodClass){ return function (anObject,anotherObject){
  7250. var self=this,$self=this;
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. return $core.withContext(function($ctx1) {
  7253. //>>excludeEnd("ctx");
  7254. return anObject in anotherObject.store;
  7255. return self;
  7256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7257. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7258. //>>excludeEnd("ctx");
  7259. }; }),
  7260. $globals.Set);
  7261. $core.addMethod(
  7262. $core.method({
  7263. selector: "initialize",
  7264. protocol: "initialization",
  7265. //>>excludeStart("ide", pragmas.excludeIdeData);
  7266. args: [],
  7267. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7268. referencedClasses: [],
  7269. //>>excludeEnd("ide");
  7270. pragmas: [],
  7271. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7272. }, function ($methodClass){ return function (){
  7273. var self=this,$self=this;
  7274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7275. return $core.withContext(function($ctx1) {
  7276. //>>excludeEnd("ctx");
  7277. (
  7278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7279. $ctx1.supercall = true,
  7280. //>>excludeEnd("ctx");
  7281. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  7282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7283. $ctx1.supercall = false;
  7284. //>>excludeEnd("ctx");;
  7285. $self.defaultBucket=[];
  7286. $self._initializeSlowBucketStores();
  7287. $self._removeAll();
  7288. return self;
  7289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7290. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7291. //>>excludeEnd("ctx");
  7292. }; }),
  7293. $globals.Set);
  7294. $core.addMethod(
  7295. $core.method({
  7296. selector: "initializeSlowBucketStores",
  7297. protocol: "initialization",
  7298. //>>excludeStart("ide", pragmas.excludeIdeData);
  7299. args: [],
  7300. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7301. referencedClasses: ["ArrayBucketStore"],
  7302. //>>excludeEnd("ide");
  7303. pragmas: [],
  7304. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7305. }, function ($methodClass){ return function (){
  7306. var self=this,$self=this;
  7307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7308. return $core.withContext(function($ctx1) {
  7309. //>>excludeEnd("ctx");
  7310. var $1;
  7311. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7313. return $core.withContext(function($ctx2) {
  7314. //>>excludeEnd("ctx");
  7315. return $self._classNameOf_(x);
  7316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7317. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7318. //>>excludeEnd("ctx");
  7319. }));
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. $ctx1.sendIdx["hashBlock:"]=1;
  7322. //>>excludeEnd("ctx");
  7323. $self.slowBucketStores=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7325. return $core.withContext(function($ctx2) {
  7326. //>>excludeEnd("ctx");
  7327. return $self._jsConstructorNameOf_(x);
  7328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7329. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7330. //>>excludeEnd("ctx");
  7331. }))];
  7332. return self;
  7333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7334. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7335. //>>excludeEnd("ctx");
  7336. }; }),
  7337. $globals.Set);
  7338. $core.addMethod(
  7339. $core.method({
  7340. selector: "jsConstructorNameOf:",
  7341. protocol: "private",
  7342. //>>excludeStart("ide", pragmas.excludeIdeData);
  7343. args: ["anObject"],
  7344. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7345. referencedClasses: [],
  7346. //>>excludeEnd("ide");
  7347. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7348. messageSends: []
  7349. }, function ($methodClass){ return function (anObject){
  7350. var self=this,$self=this;
  7351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7352. return $core.withContext(function($ctx1) {
  7353. //>>excludeEnd("ctx");
  7354. return anObject.constructor && anObject.constructor.name;
  7355. return self;
  7356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7357. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7358. //>>excludeEnd("ctx");
  7359. }; }),
  7360. $globals.Set);
  7361. $core.addMethod(
  7362. $core.method({
  7363. selector: "printOn:",
  7364. protocol: "printing",
  7365. //>>excludeStart("ide", pragmas.excludeIdeData);
  7366. args: ["aStream"],
  7367. 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: ')'",
  7368. referencedClasses: [],
  7369. //>>excludeEnd("ide");
  7370. pragmas: [],
  7371. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7372. }, function ($methodClass){ return function (aStream){
  7373. var self=this,$self=this;
  7374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7375. return $core.withContext(function($ctx1) {
  7376. //>>excludeEnd("ctx");
  7377. (
  7378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7379. $ctx1.supercall = true,
  7380. //>>excludeEnd("ctx");
  7381. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream));
  7382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7383. $ctx1.supercall = false;
  7384. //>>excludeEnd("ctx");;
  7385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7386. $ctx1.sendIdx["printOn:"]=1;
  7387. //>>excludeEnd("ctx");
  7388. $recv(aStream)._nextPutAll_(" (");
  7389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7390. $ctx1.sendIdx["nextPutAll:"]=1;
  7391. //>>excludeEnd("ctx");
  7392. $self._do_separatedBy_((function(each){
  7393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7394. return $core.withContext(function($ctx2) {
  7395. //>>excludeEnd("ctx");
  7396. return $recv(each)._printOn_(aStream);
  7397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7398. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7399. //>>excludeEnd("ctx");
  7400. }),(function(){
  7401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7402. return $core.withContext(function($ctx2) {
  7403. //>>excludeEnd("ctx");
  7404. return $recv(aStream)._nextPutAll_(" ");
  7405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7406. $ctx2.sendIdx["nextPutAll:"]=2;
  7407. //>>excludeEnd("ctx");
  7408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7409. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7410. //>>excludeEnd("ctx");
  7411. }));
  7412. $recv(aStream)._nextPutAll_(")");
  7413. return self;
  7414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7415. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7416. //>>excludeEnd("ctx");
  7417. }; }),
  7418. $globals.Set);
  7419. $core.addMethod(
  7420. $core.method({
  7421. selector: "remove:ifAbsent:",
  7422. protocol: "adding/removing",
  7423. //>>excludeStart("ide", pragmas.excludeIdeData);
  7424. args: ["anObject", "aBlock"],
  7425. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ | obj | obj := bucket first. bucket third remove: obj ifAbsent: [ ^aBlock value ]. size := size - 1. obj ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ifAbsent: aBlock ]",
  7426. referencedClasses: [],
  7427. //>>excludeEnd("ide");
  7428. pragmas: [],
  7429. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7430. }, function ($methodClass){ return function (anObject,aBlock){
  7431. var self=this,$self=this;
  7432. var bucket;
  7433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7434. return $core.withContext(function($ctx1) {
  7435. //>>excludeEnd("ctx");
  7436. var $1,$receiver;
  7437. var $early={};
  7438. try {
  7439. bucket=$self._bucketsOfElement_(anObject);
  7440. $1=$recv(bucket)._second();
  7441. if(($receiver = $1) == null || $receiver.a$nil){
  7442. var obj;
  7443. obj=$recv(bucket)._first();
  7444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7445. $ctx1.sendIdx["first"]=1;
  7446. //>>excludeEnd("ctx");
  7447. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7449. return $core.withContext(function($ctx2) {
  7450. //>>excludeEnd("ctx");
  7451. throw $early=[$recv(aBlock)._value()];
  7452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7454. //>>excludeEnd("ctx");
  7455. }));
  7456. $self.size=$recv($self.size).__minus((1));
  7457. return obj;
  7458. } else {
  7459. var primitiveBucket;
  7460. primitiveBucket=$receiver;
  7461. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7462. }
  7463. }
  7464. catch(e) {if(e===$early)return e[0]; throw e}
  7465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7466. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7467. //>>excludeEnd("ctx");
  7468. }; }),
  7469. $globals.Set);
  7470. $core.addMethod(
  7471. $core.method({
  7472. selector: "remove:in:ifAbsent:",
  7473. protocol: "private",
  7474. //>>excludeStart("ide", pragmas.excludeIdeData);
  7475. args: ["anObject", "anotherObject", "aBlock"],
  7476. 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}'>",
  7477. referencedClasses: [],
  7478. //>>excludeEnd("ide");
  7479. 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}"]]],
  7480. messageSends: []
  7481. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7482. var self=this,$self=this;
  7483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7484. return $core.withContext(function($ctx1) {
  7485. //>>excludeEnd("ctx");
  7486. if (anObject in anotherObject.store) {
  7487. delete anotherObject.store[anObject];
  7488. $self.size--;
  7489. return anObject;
  7490. } else {
  7491. return aBlock._value();
  7492. };
  7493. return self;
  7494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7495. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7496. //>>excludeEnd("ctx");
  7497. }; }),
  7498. $globals.Set);
  7499. $core.addMethod(
  7500. $core.method({
  7501. selector: "removeAll",
  7502. protocol: "adding/removing",
  7503. //>>excludeStart("ide", pragmas.excludeIdeData);
  7504. args: [],
  7505. 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'>",
  7506. referencedClasses: [],
  7507. //>>excludeEnd("ide");
  7508. 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"]]],
  7509. messageSends: []
  7510. }, function ($methodClass){ return function (){
  7511. var self=this,$self=this;
  7512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7513. return $core.withContext(function($ctx1) {
  7514. //>>excludeEnd("ctx");
  7515. $self.fastBuckets = {
  7516. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7517. "number": { store: Object.create(null), fn: Number },
  7518. "string": { store: Object.create(null) }
  7519. };
  7520. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7521. $self.defaultBucket._removeAll();
  7522. $self.size = 0;
  7523. ;
  7524. return self;
  7525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7526. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7527. //>>excludeEnd("ctx");
  7528. }; }),
  7529. $globals.Set);
  7530. $core.addMethod(
  7531. $core.method({
  7532. selector: "select:",
  7533. protocol: "enumerating",
  7534. //>>excludeStart("ide", pragmas.excludeIdeData);
  7535. args: ["aBlock"],
  7536. 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",
  7537. referencedClasses: [],
  7538. //>>excludeEnd("ide");
  7539. pragmas: [],
  7540. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7541. }, function ($methodClass){ return function (aBlock){
  7542. var self=this,$self=this;
  7543. var collection;
  7544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7545. return $core.withContext(function($ctx1) {
  7546. //>>excludeEnd("ctx");
  7547. var $1;
  7548. collection=$recv($self._class())._new();
  7549. $self._do_((function(each){
  7550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7551. return $core.withContext(function($ctx2) {
  7552. //>>excludeEnd("ctx");
  7553. $1=$recv(aBlock)._value_(each);
  7554. if($core.assert($1)){
  7555. return $recv(collection)._add_(each);
  7556. }
  7557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7558. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7559. //>>excludeEnd("ctx");
  7560. }));
  7561. return collection;
  7562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7563. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7564. //>>excludeEnd("ctx");
  7565. }; }),
  7566. $globals.Set);
  7567. $core.addMethod(
  7568. $core.method({
  7569. selector: "select:thenCollect:",
  7570. protocol: "enumerating",
  7571. //>>excludeStart("ide", pragmas.excludeIdeData);
  7572. args: ["selectBlock", "collectBlock"],
  7573. 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",
  7574. referencedClasses: [],
  7575. //>>excludeEnd("ide");
  7576. pragmas: [],
  7577. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7578. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7579. var self=this,$self=this;
  7580. var collection;
  7581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7582. return $core.withContext(function($ctx1) {
  7583. //>>excludeEnd("ctx");
  7584. var $1;
  7585. collection=$recv($self._class())._new();
  7586. $self._do_((function(each){
  7587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7588. return $core.withContext(function($ctx2) {
  7589. //>>excludeEnd("ctx");
  7590. $1=$recv(selectBlock)._value_(each);
  7591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7592. $ctx2.sendIdx["value:"]=1;
  7593. //>>excludeEnd("ctx");
  7594. if($core.assert($1)){
  7595. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7596. }
  7597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7598. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7599. //>>excludeEnd("ctx");
  7600. }));
  7601. return collection;
  7602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7603. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7604. //>>excludeEnd("ctx");
  7605. }; }),
  7606. $globals.Set);
  7607. $core.addMethod(
  7608. $core.method({
  7609. selector: "size",
  7610. protocol: "accessing",
  7611. //>>excludeStart("ide", pragmas.excludeIdeData);
  7612. args: [],
  7613. source: "size\x0a\x09^ size",
  7614. referencedClasses: [],
  7615. //>>excludeEnd("ide");
  7616. pragmas: [],
  7617. messageSends: []
  7618. }, function ($methodClass){ return function (){
  7619. var self=this,$self=this;
  7620. return $self.size;
  7621. }; }),
  7622. $globals.Set);
  7623. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7624. //>>excludeStart("ide", pragmas.excludeIdeData);
  7625. $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.";
  7626. //>>excludeEnd("ide");
  7627. $core.addMethod(
  7628. $core.method({
  7629. selector: "<<",
  7630. protocol: "writing",
  7631. //>>excludeStart("ide", pragmas.excludeIdeData);
  7632. args: ["anObject"],
  7633. source: "<< anObject\x0a\x09self write: anObject",
  7634. referencedClasses: [],
  7635. //>>excludeEnd("ide");
  7636. pragmas: [],
  7637. messageSends: ["write:"]
  7638. }, function ($methodClass){ return function (anObject){
  7639. var self=this,$self=this;
  7640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7641. return $core.withContext(function($ctx1) {
  7642. //>>excludeEnd("ctx");
  7643. $self._write_(anObject);
  7644. return self;
  7645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7646. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7647. //>>excludeEnd("ctx");
  7648. }; }),
  7649. $globals.ProtoStream);
  7650. $core.addMethod(
  7651. $core.method({
  7652. selector: "atEnd",
  7653. protocol: "testing",
  7654. //>>excludeStart("ide", pragmas.excludeIdeData);
  7655. args: [],
  7656. source: "atEnd\x0a\x09self subclassResponsibility",
  7657. referencedClasses: [],
  7658. //>>excludeEnd("ide");
  7659. pragmas: [],
  7660. messageSends: ["subclassResponsibility"]
  7661. }, function ($methodClass){ return function (){
  7662. var self=this,$self=this;
  7663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7664. return $core.withContext(function($ctx1) {
  7665. //>>excludeEnd("ctx");
  7666. $self._subclassResponsibility();
  7667. return self;
  7668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7669. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7670. //>>excludeEnd("ctx");
  7671. }; }),
  7672. $globals.ProtoStream);
  7673. $core.addMethod(
  7674. $core.method({
  7675. selector: "atStart",
  7676. protocol: "testing",
  7677. //>>excludeStart("ide", pragmas.excludeIdeData);
  7678. args: [],
  7679. source: "atStart\x0a\x09self subclassResponsibility",
  7680. referencedClasses: [],
  7681. //>>excludeEnd("ide");
  7682. pragmas: [],
  7683. messageSends: ["subclassResponsibility"]
  7684. }, function ($methodClass){ return function (){
  7685. var self=this,$self=this;
  7686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7687. return $core.withContext(function($ctx1) {
  7688. //>>excludeEnd("ctx");
  7689. $self._subclassResponsibility();
  7690. return self;
  7691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7692. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7693. //>>excludeEnd("ctx");
  7694. }; }),
  7695. $globals.ProtoStream);
  7696. $core.addMethod(
  7697. $core.method({
  7698. selector: "contents",
  7699. protocol: "accessing",
  7700. //>>excludeStart("ide", pragmas.excludeIdeData);
  7701. args: [],
  7702. source: "contents\x0a\x09self subclassResponsibility",
  7703. referencedClasses: [],
  7704. //>>excludeEnd("ide");
  7705. pragmas: [],
  7706. messageSends: ["subclassResponsibility"]
  7707. }, function ($methodClass){ return function (){
  7708. var self=this,$self=this;
  7709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7710. return $core.withContext(function($ctx1) {
  7711. //>>excludeEnd("ctx");
  7712. $self._subclassResponsibility();
  7713. return self;
  7714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7715. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7716. //>>excludeEnd("ctx");
  7717. }; }),
  7718. $globals.ProtoStream);
  7719. $core.addMethod(
  7720. $core.method({
  7721. selector: "do:",
  7722. protocol: "enumerating",
  7723. //>>excludeStart("ide", pragmas.excludeIdeData);
  7724. args: ["aBlock"],
  7725. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7726. referencedClasses: [],
  7727. //>>excludeEnd("ide");
  7728. pragmas: [],
  7729. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7730. }, function ($methodClass){ return function (aBlock){
  7731. var self=this,$self=this;
  7732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7733. return $core.withContext(function($ctx1) {
  7734. //>>excludeEnd("ctx");
  7735. $recv((function(){
  7736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7737. return $core.withContext(function($ctx2) {
  7738. //>>excludeEnd("ctx");
  7739. return $self._atEnd();
  7740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7742. //>>excludeEnd("ctx");
  7743. }))._whileFalse_((function(){
  7744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7745. return $core.withContext(function($ctx2) {
  7746. //>>excludeEnd("ctx");
  7747. return $recv(aBlock)._value_($self._next());
  7748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7749. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7750. //>>excludeEnd("ctx");
  7751. }));
  7752. return self;
  7753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7754. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7755. //>>excludeEnd("ctx");
  7756. }; }),
  7757. $globals.ProtoStream);
  7758. $core.addMethod(
  7759. $core.method({
  7760. selector: "isEmpty",
  7761. protocol: "testing",
  7762. //>>excludeStart("ide", pragmas.excludeIdeData);
  7763. args: [],
  7764. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7765. referencedClasses: [],
  7766. //>>excludeEnd("ide");
  7767. pragmas: [],
  7768. messageSends: ["and:", "atStart", "atEnd"]
  7769. }, function ($methodClass){ return function (){
  7770. var self=this,$self=this;
  7771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7772. return $core.withContext(function($ctx1) {
  7773. //>>excludeEnd("ctx");
  7774. return $recv($self._atStart())._and_((function(){
  7775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7776. return $core.withContext(function($ctx2) {
  7777. //>>excludeEnd("ctx");
  7778. return $self._atEnd();
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7781. //>>excludeEnd("ctx");
  7782. }));
  7783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7784. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7785. //>>excludeEnd("ctx");
  7786. }; }),
  7787. $globals.ProtoStream);
  7788. $core.addMethod(
  7789. $core.method({
  7790. selector: "next",
  7791. protocol: "reading",
  7792. //>>excludeStart("ide", pragmas.excludeIdeData);
  7793. args: [],
  7794. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7795. referencedClasses: [],
  7796. //>>excludeEnd("ide");
  7797. pragmas: [],
  7798. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7799. }, function ($methodClass){ return function (){
  7800. var self=this,$self=this;
  7801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7802. return $core.withContext(function($ctx1) {
  7803. //>>excludeEnd("ctx");
  7804. var $1;
  7805. $1=$self._atEnd();
  7806. if($core.assert($1)){
  7807. return nil;
  7808. } else {
  7809. return $self._subclassResponsibility();
  7810. }
  7811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7812. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7813. //>>excludeEnd("ctx");
  7814. }; }),
  7815. $globals.ProtoStream);
  7816. $core.addMethod(
  7817. $core.method({
  7818. selector: "nextPut:",
  7819. protocol: "writing",
  7820. //>>excludeStart("ide", pragmas.excludeIdeData);
  7821. args: ["anObject"],
  7822. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7823. referencedClasses: [],
  7824. //>>excludeEnd("ide");
  7825. pragmas: [],
  7826. messageSends: ["subclassResponsibility"]
  7827. }, function ($methodClass){ return function (anObject){
  7828. var self=this,$self=this;
  7829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7830. return $core.withContext(function($ctx1) {
  7831. //>>excludeEnd("ctx");
  7832. $self._subclassResponsibility();
  7833. return self;
  7834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7835. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7836. //>>excludeEnd("ctx");
  7837. }; }),
  7838. $globals.ProtoStream);
  7839. $core.addMethod(
  7840. $core.method({
  7841. selector: "nextPutAll:",
  7842. protocol: "writing",
  7843. //>>excludeStart("ide", pragmas.excludeIdeData);
  7844. args: ["aCollection"],
  7845. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7846. referencedClasses: [],
  7847. //>>excludeEnd("ide");
  7848. pragmas: [],
  7849. messageSends: ["do:", "nextPut:"]
  7850. }, function ($methodClass){ return function (aCollection){
  7851. var self=this,$self=this;
  7852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7853. return $core.withContext(function($ctx1) {
  7854. //>>excludeEnd("ctx");
  7855. $recv(aCollection)._do_((function(each){
  7856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7857. return $core.withContext(function($ctx2) {
  7858. //>>excludeEnd("ctx");
  7859. return $self._nextPut_(each);
  7860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7861. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7862. //>>excludeEnd("ctx");
  7863. }));
  7864. return self;
  7865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7866. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7867. //>>excludeEnd("ctx");
  7868. }; }),
  7869. $globals.ProtoStream);
  7870. $core.addMethod(
  7871. $core.method({
  7872. selector: "nextPutString:",
  7873. protocol: "writing",
  7874. //>>excludeStart("ide", pragmas.excludeIdeData);
  7875. args: ["aString"],
  7876. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7877. referencedClasses: [],
  7878. //>>excludeEnd("ide");
  7879. pragmas: [],
  7880. messageSends: ["nextPut:"]
  7881. }, function ($methodClass){ return function (aString){
  7882. var self=this,$self=this;
  7883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7884. return $core.withContext(function($ctx1) {
  7885. //>>excludeEnd("ctx");
  7886. $self._nextPut_(aString);
  7887. return self;
  7888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7889. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7890. //>>excludeEnd("ctx");
  7891. }; }),
  7892. $globals.ProtoStream);
  7893. $core.addMethod(
  7894. $core.method({
  7895. selector: "peek",
  7896. protocol: "reading",
  7897. //>>excludeStart("ide", pragmas.excludeIdeData);
  7898. args: [],
  7899. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7900. referencedClasses: [],
  7901. //>>excludeEnd("ide");
  7902. pragmas: [],
  7903. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7904. }, function ($methodClass){ return function (){
  7905. var self=this,$self=this;
  7906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7907. return $core.withContext(function($ctx1) {
  7908. //>>excludeEnd("ctx");
  7909. var $1;
  7910. $1=$self._atEnd();
  7911. if($core.assert($1)){
  7912. return nil;
  7913. } else {
  7914. return $self._subclassResponsibility();
  7915. }
  7916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7917. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  7918. //>>excludeEnd("ctx");
  7919. }; }),
  7920. $globals.ProtoStream);
  7921. $core.addMethod(
  7922. $core.method({
  7923. selector: "reset",
  7924. protocol: "actions",
  7925. //>>excludeStart("ide", pragmas.excludeIdeData);
  7926. args: [],
  7927. source: "reset\x0a\x09self subclassResponsibility",
  7928. referencedClasses: [],
  7929. //>>excludeEnd("ide");
  7930. pragmas: [],
  7931. messageSends: ["subclassResponsibility"]
  7932. }, function ($methodClass){ return function (){
  7933. var self=this,$self=this;
  7934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7935. return $core.withContext(function($ctx1) {
  7936. //>>excludeEnd("ctx");
  7937. $self._subclassResponsibility();
  7938. return self;
  7939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7940. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  7941. //>>excludeEnd("ctx");
  7942. }; }),
  7943. $globals.ProtoStream);
  7944. $core.addMethod(
  7945. $core.method({
  7946. selector: "resetContents",
  7947. protocol: "actions",
  7948. //>>excludeStart("ide", pragmas.excludeIdeData);
  7949. args: [],
  7950. source: "resetContents\x0a\x09self subclassResponsibility",
  7951. referencedClasses: [],
  7952. //>>excludeEnd("ide");
  7953. pragmas: [],
  7954. messageSends: ["subclassResponsibility"]
  7955. }, function ($methodClass){ return function (){
  7956. var self=this,$self=this;
  7957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7958. return $core.withContext(function($ctx1) {
  7959. //>>excludeEnd("ctx");
  7960. $self._subclassResponsibility();
  7961. return self;
  7962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7963. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  7964. //>>excludeEnd("ctx");
  7965. }; }),
  7966. $globals.ProtoStream);
  7967. $core.addMethod(
  7968. $core.method({
  7969. selector: "setToEnd",
  7970. protocol: "positioning",
  7971. //>>excludeStart("ide", pragmas.excludeIdeData);
  7972. args: [],
  7973. source: "setToEnd\x0a\x09self subclassResponsibility",
  7974. referencedClasses: [],
  7975. //>>excludeEnd("ide");
  7976. pragmas: [],
  7977. messageSends: ["subclassResponsibility"]
  7978. }, function ($methodClass){ return function (){
  7979. var self=this,$self=this;
  7980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7981. return $core.withContext(function($ctx1) {
  7982. //>>excludeEnd("ctx");
  7983. $self._subclassResponsibility();
  7984. return self;
  7985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7986. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  7987. //>>excludeEnd("ctx");
  7988. }; }),
  7989. $globals.ProtoStream);
  7990. $core.addMethod(
  7991. $core.method({
  7992. selector: "setToStart",
  7993. protocol: "positioning",
  7994. //>>excludeStart("ide", pragmas.excludeIdeData);
  7995. args: [],
  7996. source: "setToStart\x0a\x09self reset",
  7997. referencedClasses: [],
  7998. //>>excludeEnd("ide");
  7999. pragmas: [],
  8000. messageSends: ["reset"]
  8001. }, function ($methodClass){ return function (){
  8002. var self=this,$self=this;
  8003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8004. return $core.withContext(function($ctx1) {
  8005. //>>excludeEnd("ctx");
  8006. $self._reset();
  8007. return self;
  8008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8009. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8010. //>>excludeEnd("ctx");
  8011. }; }),
  8012. $globals.ProtoStream);
  8013. $core.addMethod(
  8014. $core.method({
  8015. selector: "write:",
  8016. protocol: "writing",
  8017. //>>excludeStart("ide", pragmas.excludeIdeData);
  8018. args: ["anObject"],
  8019. source: "write: anObject\x0a\x09anObject putOn: self",
  8020. referencedClasses: [],
  8021. //>>excludeEnd("ide");
  8022. pragmas: [],
  8023. messageSends: ["putOn:"]
  8024. }, function ($methodClass){ return function (anObject){
  8025. var self=this,$self=this;
  8026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8027. return $core.withContext(function($ctx1) {
  8028. //>>excludeEnd("ctx");
  8029. $recv(anObject)._putOn_(self);
  8030. return self;
  8031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8032. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8033. //>>excludeEnd("ctx");
  8034. }; }),
  8035. $globals.ProtoStream);
  8036. $core.addMethod(
  8037. $core.method({
  8038. selector: "on:",
  8039. protocol: "instance creation",
  8040. //>>excludeStart("ide", pragmas.excludeIdeData);
  8041. args: ["aCollection"],
  8042. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8043. referencedClasses: [],
  8044. //>>excludeEnd("ide");
  8045. pragmas: [],
  8046. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8047. }, function ($methodClass){ return function (aCollection){
  8048. var self=this,$self=this;
  8049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8050. return $core.withContext(function($ctx1) {
  8051. //>>excludeEnd("ctx");
  8052. var $1;
  8053. $1=$self._new();
  8054. $recv($1)._setCollection_(aCollection);
  8055. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8056. return $recv($1)._yourself();
  8057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8058. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8059. //>>excludeEnd("ctx");
  8060. }; }),
  8061. $globals.ProtoStream.a$cls);
  8062. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8063. //>>excludeStart("ide", pragmas.excludeIdeData);
  8064. $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.";
  8065. //>>excludeEnd("ide");
  8066. $core.addMethod(
  8067. $core.method({
  8068. selector: "atEnd",
  8069. protocol: "testing",
  8070. //>>excludeStart("ide", pragmas.excludeIdeData);
  8071. args: [],
  8072. source: "atEnd\x0a\x09^ self position = self size",
  8073. referencedClasses: [],
  8074. //>>excludeEnd("ide");
  8075. pragmas: [],
  8076. messageSends: ["=", "position", "size"]
  8077. }, function ($methodClass){ return function (){
  8078. var self=this,$self=this;
  8079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8080. return $core.withContext(function($ctx1) {
  8081. //>>excludeEnd("ctx");
  8082. return $recv($self._position()).__eq($self._size());
  8083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8084. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8085. //>>excludeEnd("ctx");
  8086. }; }),
  8087. $globals.Stream);
  8088. $core.addMethod(
  8089. $core.method({
  8090. selector: "atStart",
  8091. protocol: "testing",
  8092. //>>excludeStart("ide", pragmas.excludeIdeData);
  8093. args: [],
  8094. source: "atStart\x0a\x09^ self position = 0",
  8095. referencedClasses: [],
  8096. //>>excludeEnd("ide");
  8097. pragmas: [],
  8098. messageSends: ["=", "position"]
  8099. }, function ($methodClass){ return function (){
  8100. var self=this,$self=this;
  8101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8102. return $core.withContext(function($ctx1) {
  8103. //>>excludeEnd("ctx");
  8104. return $recv($self._position()).__eq((0));
  8105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8106. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8107. //>>excludeEnd("ctx");
  8108. }; }),
  8109. $globals.Stream);
  8110. $core.addMethod(
  8111. $core.method({
  8112. selector: "close",
  8113. protocol: "actions",
  8114. //>>excludeStart("ide", pragmas.excludeIdeData);
  8115. args: [],
  8116. source: "close",
  8117. referencedClasses: [],
  8118. //>>excludeEnd("ide");
  8119. pragmas: [],
  8120. messageSends: []
  8121. }, function ($methodClass){ return function (){
  8122. var self=this,$self=this;
  8123. return self;
  8124. }; }),
  8125. $globals.Stream);
  8126. $core.addMethod(
  8127. $core.method({
  8128. selector: "collection",
  8129. protocol: "accessing",
  8130. //>>excludeStart("ide", pragmas.excludeIdeData);
  8131. args: [],
  8132. source: "collection\x0a\x09^ collection",
  8133. referencedClasses: [],
  8134. //>>excludeEnd("ide");
  8135. pragmas: [],
  8136. messageSends: []
  8137. }, function ($methodClass){ return function (){
  8138. var self=this,$self=this;
  8139. return $self.collection;
  8140. }; }),
  8141. $globals.Stream);
  8142. $core.addMethod(
  8143. $core.method({
  8144. selector: "contents",
  8145. protocol: "accessing",
  8146. //>>excludeStart("ide", pragmas.excludeIdeData);
  8147. args: [],
  8148. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8149. referencedClasses: [],
  8150. //>>excludeEnd("ide");
  8151. pragmas: [],
  8152. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8153. }, function ($methodClass){ return function (){
  8154. var self=this,$self=this;
  8155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8156. return $core.withContext(function($ctx1) {
  8157. //>>excludeEnd("ctx");
  8158. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8160. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8161. //>>excludeEnd("ctx");
  8162. }; }),
  8163. $globals.Stream);
  8164. $core.addMethod(
  8165. $core.method({
  8166. selector: "flush",
  8167. protocol: "actions",
  8168. //>>excludeStart("ide", pragmas.excludeIdeData);
  8169. args: [],
  8170. source: "flush",
  8171. referencedClasses: [],
  8172. //>>excludeEnd("ide");
  8173. pragmas: [],
  8174. messageSends: []
  8175. }, function ($methodClass){ return function (){
  8176. var self=this,$self=this;
  8177. return self;
  8178. }; }),
  8179. $globals.Stream);
  8180. $core.addMethod(
  8181. $core.method({
  8182. selector: "isEmpty",
  8183. protocol: "testing",
  8184. //>>excludeStart("ide", pragmas.excludeIdeData);
  8185. args: [],
  8186. source: "isEmpty\x0a\x09^ self size = 0",
  8187. referencedClasses: [],
  8188. //>>excludeEnd("ide");
  8189. pragmas: [],
  8190. messageSends: ["=", "size"]
  8191. }, function ($methodClass){ return function (){
  8192. var self=this,$self=this;
  8193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8194. return $core.withContext(function($ctx1) {
  8195. //>>excludeEnd("ctx");
  8196. return $recv($self._size()).__eq((0));
  8197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8198. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8199. //>>excludeEnd("ctx");
  8200. }; }),
  8201. $globals.Stream);
  8202. $core.addMethod(
  8203. $core.method({
  8204. selector: "next",
  8205. protocol: "reading",
  8206. //>>excludeStart("ide", pragmas.excludeIdeData);
  8207. args: [],
  8208. 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 ]",
  8209. referencedClasses: [],
  8210. //>>excludeEnd("ide");
  8211. pragmas: [],
  8212. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8213. }, function ($methodClass){ return function (){
  8214. var self=this,$self=this;
  8215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8216. return $core.withContext(function($ctx1) {
  8217. //>>excludeEnd("ctx");
  8218. var $1,$3,$2;
  8219. $1=$self._atEnd();
  8220. if($core.assert($1)){
  8221. return nil;
  8222. } else {
  8223. $3=$self._position();
  8224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8225. $ctx1.sendIdx["position"]=1;
  8226. //>>excludeEnd("ctx");
  8227. $2=$recv($3).__plus((1));
  8228. $self._position_($2);
  8229. return $recv($self.collection)._at_($self._position());
  8230. }
  8231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8232. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8233. //>>excludeEnd("ctx");
  8234. }; }),
  8235. $globals.Stream);
  8236. $core.addMethod(
  8237. $core.method({
  8238. selector: "next:",
  8239. protocol: "reading",
  8240. //>>excludeStart("ide", pragmas.excludeIdeData);
  8241. args: ["anInteger"],
  8242. 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",
  8243. referencedClasses: [],
  8244. //>>excludeEnd("ide");
  8245. pragmas: [],
  8246. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8247. }, function ($methodClass){ return function (anInteger){
  8248. var self=this,$self=this;
  8249. var tempCollection;
  8250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8251. return $core.withContext(function($ctx1) {
  8252. //>>excludeEnd("ctx");
  8253. var $1;
  8254. tempCollection=$recv($recv($self._collection())._class())._new();
  8255. $recv(anInteger)._timesRepeat_((function(){
  8256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8257. return $core.withContext(function($ctx2) {
  8258. //>>excludeEnd("ctx");
  8259. $1=$self._atEnd();
  8260. if(!$core.assert($1)){
  8261. return $recv(tempCollection)._add_($self._next());
  8262. }
  8263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8265. //>>excludeEnd("ctx");
  8266. }));
  8267. return tempCollection;
  8268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8269. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8270. //>>excludeEnd("ctx");
  8271. }; }),
  8272. $globals.Stream);
  8273. $core.addMethod(
  8274. $core.method({
  8275. selector: "nextPut:",
  8276. protocol: "writing",
  8277. //>>excludeStart("ide", pragmas.excludeIdeData);
  8278. args: ["anObject"],
  8279. 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)",
  8280. referencedClasses: [],
  8281. //>>excludeEnd("ide");
  8282. pragmas: [],
  8283. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8284. }, function ($methodClass){ return function (anObject){
  8285. var self=this,$self=this;
  8286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8287. return $core.withContext(function($ctx1) {
  8288. //>>excludeEnd("ctx");
  8289. var $2,$1,$3,$4;
  8290. $2=$self._position();
  8291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8292. $ctx1.sendIdx["position"]=1;
  8293. //>>excludeEnd("ctx");
  8294. $1=$recv($2).__plus((1));
  8295. $self._position_($1);
  8296. $3=$self._collection();
  8297. $4=$self._position();
  8298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8299. $ctx1.sendIdx["position"]=2;
  8300. //>>excludeEnd("ctx");
  8301. $recv($3)._at_put_($4,anObject);
  8302. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8303. return self;
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8306. //>>excludeEnd("ctx");
  8307. }; }),
  8308. $globals.Stream);
  8309. $core.addMethod(
  8310. $core.method({
  8311. selector: "peek",
  8312. protocol: "reading",
  8313. //>>excludeStart("ide", pragmas.excludeIdeData);
  8314. args: [],
  8315. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8316. referencedClasses: [],
  8317. //>>excludeEnd("ide");
  8318. pragmas: [],
  8319. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8320. }, function ($methodClass){ return function (){
  8321. var self=this,$self=this;
  8322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8323. return $core.withContext(function($ctx1) {
  8324. //>>excludeEnd("ctx");
  8325. var $1;
  8326. $1=$self._atEnd();
  8327. if(!$core.assert($1)){
  8328. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8329. }
  8330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8331. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8332. //>>excludeEnd("ctx");
  8333. }; }),
  8334. $globals.Stream);
  8335. $core.addMethod(
  8336. $core.method({
  8337. selector: "position",
  8338. protocol: "accessing",
  8339. //>>excludeStart("ide", pragmas.excludeIdeData);
  8340. args: [],
  8341. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8342. referencedClasses: [],
  8343. //>>excludeEnd("ide");
  8344. pragmas: [],
  8345. messageSends: ["ifNil:"]
  8346. }, function ($methodClass){ return function (){
  8347. var self=this,$self=this;
  8348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8349. return $core.withContext(function($ctx1) {
  8350. //>>excludeEnd("ctx");
  8351. var $1,$receiver;
  8352. $1=$self.position;
  8353. if(($receiver = $1) == null || $receiver.a$nil){
  8354. $self.position=(0);
  8355. return $self.position;
  8356. } else {
  8357. return $1;
  8358. }
  8359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8360. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8361. //>>excludeEnd("ctx");
  8362. }; }),
  8363. $globals.Stream);
  8364. $core.addMethod(
  8365. $core.method({
  8366. selector: "position:",
  8367. protocol: "accessing",
  8368. //>>excludeStart("ide", pragmas.excludeIdeData);
  8369. args: ["anInteger"],
  8370. source: "position: anInteger\x0a\x09position := anInteger",
  8371. referencedClasses: [],
  8372. //>>excludeEnd("ide");
  8373. pragmas: [],
  8374. messageSends: []
  8375. }, function ($methodClass){ return function (anInteger){
  8376. var self=this,$self=this;
  8377. $self.position=anInteger;
  8378. return self;
  8379. }; }),
  8380. $globals.Stream);
  8381. $core.addMethod(
  8382. $core.method({
  8383. selector: "reset",
  8384. protocol: "actions",
  8385. //>>excludeStart("ide", pragmas.excludeIdeData);
  8386. args: [],
  8387. source: "reset\x0a\x09self position: 0",
  8388. referencedClasses: [],
  8389. //>>excludeEnd("ide");
  8390. pragmas: [],
  8391. messageSends: ["position:"]
  8392. }, function ($methodClass){ return function (){
  8393. var self=this,$self=this;
  8394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8395. return $core.withContext(function($ctx1) {
  8396. //>>excludeEnd("ctx");
  8397. $self._position_((0));
  8398. return self;
  8399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8400. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8401. //>>excludeEnd("ctx");
  8402. }; }),
  8403. $globals.Stream);
  8404. $core.addMethod(
  8405. $core.method({
  8406. selector: "resetContents",
  8407. protocol: "actions",
  8408. //>>excludeStart("ide", pragmas.excludeIdeData);
  8409. args: [],
  8410. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8411. referencedClasses: [],
  8412. //>>excludeEnd("ide");
  8413. pragmas: [],
  8414. messageSends: ["reset", "setStreamSize:"]
  8415. }, function ($methodClass){ return function (){
  8416. var self=this,$self=this;
  8417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8418. return $core.withContext(function($ctx1) {
  8419. //>>excludeEnd("ctx");
  8420. $self._reset();
  8421. $self._setStreamSize_((0));
  8422. return self;
  8423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8424. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8425. //>>excludeEnd("ctx");
  8426. }; }),
  8427. $globals.Stream);
  8428. $core.addMethod(
  8429. $core.method({
  8430. selector: "setCollection:",
  8431. protocol: "accessing",
  8432. //>>excludeStart("ide", pragmas.excludeIdeData);
  8433. args: ["aCollection"],
  8434. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8435. referencedClasses: [],
  8436. //>>excludeEnd("ide");
  8437. pragmas: [],
  8438. messageSends: []
  8439. }, function ($methodClass){ return function (aCollection){
  8440. var self=this,$self=this;
  8441. $self.collection=aCollection;
  8442. return self;
  8443. }; }),
  8444. $globals.Stream);
  8445. $core.addMethod(
  8446. $core.method({
  8447. selector: "setStreamSize:",
  8448. protocol: "accessing",
  8449. //>>excludeStart("ide", pragmas.excludeIdeData);
  8450. args: ["anInteger"],
  8451. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8452. referencedClasses: [],
  8453. //>>excludeEnd("ide");
  8454. pragmas: [],
  8455. messageSends: []
  8456. }, function ($methodClass){ return function (anInteger){
  8457. var self=this,$self=this;
  8458. $self.streamSize=anInteger;
  8459. return self;
  8460. }; }),
  8461. $globals.Stream);
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "setToEnd",
  8465. protocol: "positioning",
  8466. //>>excludeStart("ide", pragmas.excludeIdeData);
  8467. args: [],
  8468. source: "setToEnd\x0a\x09self position: self size",
  8469. referencedClasses: [],
  8470. //>>excludeEnd("ide");
  8471. pragmas: [],
  8472. messageSends: ["position:", "size"]
  8473. }, function ($methodClass){ return function (){
  8474. var self=this,$self=this;
  8475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8476. return $core.withContext(function($ctx1) {
  8477. //>>excludeEnd("ctx");
  8478. $self._position_($self._size());
  8479. return self;
  8480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8481. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8482. //>>excludeEnd("ctx");
  8483. }; }),
  8484. $globals.Stream);
  8485. $core.addMethod(
  8486. $core.method({
  8487. selector: "size",
  8488. protocol: "accessing",
  8489. //>>excludeStart("ide", pragmas.excludeIdeData);
  8490. args: [],
  8491. source: "size\x0a\x09^ self streamSize",
  8492. referencedClasses: [],
  8493. //>>excludeEnd("ide");
  8494. pragmas: [],
  8495. messageSends: ["streamSize"]
  8496. }, function ($methodClass){ return function (){
  8497. var self=this,$self=this;
  8498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8499. return $core.withContext(function($ctx1) {
  8500. //>>excludeEnd("ctx");
  8501. return $self._streamSize();
  8502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8503. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8504. //>>excludeEnd("ctx");
  8505. }; }),
  8506. $globals.Stream);
  8507. $core.addMethod(
  8508. $core.method({
  8509. selector: "skip:",
  8510. protocol: "positioning",
  8511. //>>excludeStart("ide", pragmas.excludeIdeData);
  8512. args: ["anInteger"],
  8513. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8514. referencedClasses: [],
  8515. //>>excludeEnd("ide");
  8516. pragmas: [],
  8517. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8518. }, function ($methodClass){ return function (anInteger){
  8519. var self=this,$self=this;
  8520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8521. return $core.withContext(function($ctx1) {
  8522. //>>excludeEnd("ctx");
  8523. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8524. return self;
  8525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8526. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8527. //>>excludeEnd("ctx");
  8528. }; }),
  8529. $globals.Stream);
  8530. $core.addMethod(
  8531. $core.method({
  8532. selector: "streamSize",
  8533. protocol: "accessing",
  8534. //>>excludeStart("ide", pragmas.excludeIdeData);
  8535. args: [],
  8536. source: "streamSize\x0a\x09^ streamSize",
  8537. referencedClasses: [],
  8538. //>>excludeEnd("ide");
  8539. pragmas: [],
  8540. messageSends: []
  8541. }, function ($methodClass){ return function (){
  8542. var self=this,$self=this;
  8543. return $self.streamSize;
  8544. }; }),
  8545. $globals.Stream);
  8546. $core.addMethod(
  8547. $core.method({
  8548. selector: "on:",
  8549. protocol: "instance creation",
  8550. //>>excludeStart("ide", pragmas.excludeIdeData);
  8551. args: ["aCollection"],
  8552. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8553. referencedClasses: [],
  8554. //>>excludeEnd("ide");
  8555. pragmas: [],
  8556. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8557. }, function ($methodClass){ return function (aCollection){
  8558. var self=this,$self=this;
  8559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8560. return $core.withContext(function($ctx1) {
  8561. //>>excludeEnd("ctx");
  8562. var $1;
  8563. $1=$self._new();
  8564. $recv($1)._setCollection_(aCollection);
  8565. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8566. return $recv($1)._yourself();
  8567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8568. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8569. //>>excludeEnd("ctx");
  8570. }; }),
  8571. $globals.Stream.a$cls);
  8572. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8573. //>>excludeStart("ide", pragmas.excludeIdeData);
  8574. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8575. //>>excludeEnd("ide");
  8576. $core.addMethod(
  8577. $core.method({
  8578. selector: "cr",
  8579. protocol: "writing",
  8580. //>>excludeStart("ide", pragmas.excludeIdeData);
  8581. args: [],
  8582. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8583. referencedClasses: ["String"],
  8584. //>>excludeEnd("ide");
  8585. pragmas: [],
  8586. messageSends: ["nextPutAll:", "cr"]
  8587. }, function ($methodClass){ return function (){
  8588. var self=this,$self=this;
  8589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8590. return $core.withContext(function($ctx1) {
  8591. //>>excludeEnd("ctx");
  8592. return $self._nextPutAll_($recv($globals.String)._cr());
  8593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8594. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8595. //>>excludeEnd("ctx");
  8596. }; }),
  8597. $globals.StringStream);
  8598. $core.addMethod(
  8599. $core.method({
  8600. selector: "crlf",
  8601. protocol: "writing",
  8602. //>>excludeStart("ide", pragmas.excludeIdeData);
  8603. args: [],
  8604. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8605. referencedClasses: ["String"],
  8606. //>>excludeEnd("ide");
  8607. pragmas: [],
  8608. messageSends: ["nextPutAll:", "crlf"]
  8609. }, function ($methodClass){ return function (){
  8610. var self=this,$self=this;
  8611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8612. return $core.withContext(function($ctx1) {
  8613. //>>excludeEnd("ctx");
  8614. return $self._nextPutAll_($recv($globals.String)._crlf());
  8615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8616. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8617. //>>excludeEnd("ctx");
  8618. }; }),
  8619. $globals.StringStream);
  8620. $core.addMethod(
  8621. $core.method({
  8622. selector: "lf",
  8623. protocol: "writing",
  8624. //>>excludeStart("ide", pragmas.excludeIdeData);
  8625. args: [],
  8626. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8627. referencedClasses: ["String"],
  8628. //>>excludeEnd("ide");
  8629. pragmas: [],
  8630. messageSends: ["nextPutAll:", "lf"]
  8631. }, function ($methodClass){ return function (){
  8632. var self=this,$self=this;
  8633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8634. return $core.withContext(function($ctx1) {
  8635. //>>excludeEnd("ctx");
  8636. return $self._nextPutAll_($recv($globals.String)._lf());
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8639. //>>excludeEnd("ctx");
  8640. }; }),
  8641. $globals.StringStream);
  8642. $core.addMethod(
  8643. $core.method({
  8644. selector: "next:",
  8645. protocol: "reading",
  8646. //>>excludeStart("ide", pragmas.excludeIdeData);
  8647. args: ["anInteger"],
  8648. 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",
  8649. referencedClasses: [],
  8650. //>>excludeEnd("ide");
  8651. pragmas: [],
  8652. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8653. }, function ($methodClass){ return function (anInteger){
  8654. var self=this,$self=this;
  8655. var tempCollection;
  8656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8657. return $core.withContext(function($ctx1) {
  8658. //>>excludeEnd("ctx");
  8659. var $1;
  8660. tempCollection=$recv($recv($self._collection())._class())._new();
  8661. $recv(anInteger)._timesRepeat_((function(){
  8662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8663. return $core.withContext(function($ctx2) {
  8664. //>>excludeEnd("ctx");
  8665. $1=$self._atEnd();
  8666. if(!$core.assert($1)){
  8667. tempCollection=$recv(tempCollection).__comma($self._next());
  8668. return tempCollection;
  8669. }
  8670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8672. //>>excludeEnd("ctx");
  8673. }));
  8674. return tempCollection;
  8675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8676. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8677. //>>excludeEnd("ctx");
  8678. }; }),
  8679. $globals.StringStream);
  8680. $core.addMethod(
  8681. $core.method({
  8682. selector: "nextPut:",
  8683. protocol: "writing",
  8684. //>>excludeStart("ide", pragmas.excludeIdeData);
  8685. args: ["aString"],
  8686. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8687. referencedClasses: [],
  8688. //>>excludeEnd("ide");
  8689. pragmas: [],
  8690. messageSends: ["nextPutAll:"]
  8691. }, function ($methodClass){ return function (aString){
  8692. var self=this,$self=this;
  8693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8694. return $core.withContext(function($ctx1) {
  8695. //>>excludeEnd("ctx");
  8696. $self._nextPutAll_(aString);
  8697. return self;
  8698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8699. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8700. //>>excludeEnd("ctx");
  8701. }; }),
  8702. $globals.StringStream);
  8703. $core.addMethod(
  8704. $core.method({
  8705. selector: "nextPutAll:",
  8706. protocol: "writing",
  8707. //>>excludeStart("ide", pragmas.excludeIdeData);
  8708. args: ["aString"],
  8709. 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)",
  8710. referencedClasses: [],
  8711. //>>excludeEnd("ide");
  8712. pragmas: [],
  8713. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8714. }, function ($methodClass){ return function (aString){
  8715. var self=this,$self=this;
  8716. var pre,post;
  8717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8718. return $core.withContext(function($ctx1) {
  8719. //>>excludeEnd("ctx");
  8720. var $2,$4,$3,$1,$6,$5,$7,$8,$9,$12,$11,$13,$10,$14,$15,$17,$16;
  8721. $2=$self._position();
  8722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8723. $ctx1.sendIdx["position"]=1;
  8724. //>>excludeEnd("ctx");
  8725. $4=$self._collection();
  8726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8727. $ctx1.sendIdx["collection"]=1;
  8728. //>>excludeEnd("ctx");
  8729. $3=$recv($4)._size();
  8730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8731. $ctx1.sendIdx["size"]=1;
  8732. //>>excludeEnd("ctx");
  8733. $1=$recv($2).__eq($3);
  8734. if($core.assert($1)){
  8735. $6=$self._collection();
  8736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8737. $ctx1.sendIdx["collection"]=2;
  8738. //>>excludeEnd("ctx");
  8739. $5=$recv($6).__comma(aString);
  8740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8741. $ctx1.sendIdx[","]=1;
  8742. //>>excludeEnd("ctx");
  8743. $self._setCollection_($5);
  8744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8745. $ctx1.sendIdx["setCollection:"]=1;
  8746. //>>excludeEnd("ctx");
  8747. } else {
  8748. $7=$self._collection();
  8749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8750. $ctx1.sendIdx["collection"]=3;
  8751. //>>excludeEnd("ctx");
  8752. $8=$self._position();
  8753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8754. $ctx1.sendIdx["position"]=2;
  8755. //>>excludeEnd("ctx");
  8756. pre=$recv($7)._copyFrom_to_((1),$8);
  8757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8758. $ctx1.sendIdx["copyFrom:to:"]=1;
  8759. //>>excludeEnd("ctx");
  8760. $9=$self._collection();
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. $ctx1.sendIdx["collection"]=4;
  8763. //>>excludeEnd("ctx");
  8764. $12=$self._position();
  8765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8766. $ctx1.sendIdx["position"]=3;
  8767. //>>excludeEnd("ctx");
  8768. $11=$recv($12).__plus((1));
  8769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8770. $ctx1.sendIdx["+"]=2;
  8771. //>>excludeEnd("ctx");
  8772. $13=$recv(aString)._size();
  8773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8774. $ctx1.sendIdx["size"]=2;
  8775. //>>excludeEnd("ctx");
  8776. $10=$recv($11).__plus($13);
  8777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8778. $ctx1.sendIdx["+"]=1;
  8779. //>>excludeEnd("ctx");
  8780. $14=$recv($self._collection())._size();
  8781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8782. $ctx1.sendIdx["size"]=3;
  8783. //>>excludeEnd("ctx");
  8784. post=$recv($9)._copyFrom_to_($10,$14);
  8785. $15=$recv($recv(pre).__comma(aString)).__comma(post);
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. $ctx1.sendIdx[","]=2;
  8788. //>>excludeEnd("ctx");
  8789. $self._setCollection_($15);
  8790. }
  8791. $17=$self._position();
  8792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8793. $ctx1.sendIdx["position"]=4;
  8794. //>>excludeEnd("ctx");
  8795. $16=$recv($17).__plus($recv(aString)._size());
  8796. $self._position_($16);
  8797. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8798. return self;
  8799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8800. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8801. //>>excludeEnd("ctx");
  8802. }; }),
  8803. $globals.StringStream);
  8804. $core.addMethod(
  8805. $core.method({
  8806. selector: "nextPutString:",
  8807. protocol: "writing",
  8808. //>>excludeStart("ide", pragmas.excludeIdeData);
  8809. args: ["aString"],
  8810. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8811. referencedClasses: [],
  8812. //>>excludeEnd("ide");
  8813. pragmas: [],
  8814. messageSends: ["nextPutAll:"]
  8815. }, function ($methodClass){ return function (aString){
  8816. var self=this,$self=this;
  8817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8818. return $core.withContext(function($ctx1) {
  8819. //>>excludeEnd("ctx");
  8820. $self._nextPutAll_(aString);
  8821. return self;
  8822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8823. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8824. //>>excludeEnd("ctx");
  8825. }; }),
  8826. $globals.StringStream);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "print:",
  8830. protocol: "writing",
  8831. //>>excludeStart("ide", pragmas.excludeIdeData);
  8832. args: ["anObject"],
  8833. source: "print: anObject\x0a\x09anObject printOn: self",
  8834. referencedClasses: [],
  8835. //>>excludeEnd("ide");
  8836. pragmas: [],
  8837. messageSends: ["printOn:"]
  8838. }, function ($methodClass){ return function (anObject){
  8839. var self=this,$self=this;
  8840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8841. return $core.withContext(function($ctx1) {
  8842. //>>excludeEnd("ctx");
  8843. $recv(anObject)._printOn_(self);
  8844. return self;
  8845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8846. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8847. //>>excludeEnd("ctx");
  8848. }; }),
  8849. $globals.StringStream);
  8850. $core.addMethod(
  8851. $core.method({
  8852. selector: "printSymbol:",
  8853. protocol: "writing",
  8854. //>>excludeStart("ide", pragmas.excludeIdeData);
  8855. args: ["anObject"],
  8856. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8857. referencedClasses: [],
  8858. //>>excludeEnd("ide");
  8859. pragmas: [],
  8860. messageSends: ["asSymbolPrintOn:"]
  8861. }, function ($methodClass){ return function (anObject){
  8862. var self=this,$self=this;
  8863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8864. return $core.withContext(function($ctx1) {
  8865. //>>excludeEnd("ctx");
  8866. $recv(anObject)._asSymbolPrintOn_(self);
  8867. return self;
  8868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8869. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8870. //>>excludeEnd("ctx");
  8871. }; }),
  8872. $globals.StringStream);
  8873. $core.addMethod(
  8874. $core.method({
  8875. selector: "space",
  8876. protocol: "writing",
  8877. //>>excludeStart("ide", pragmas.excludeIdeData);
  8878. args: [],
  8879. source: "space\x0a\x09self nextPut: ' '",
  8880. referencedClasses: [],
  8881. //>>excludeEnd("ide");
  8882. pragmas: [],
  8883. messageSends: ["nextPut:"]
  8884. }, function ($methodClass){ return function (){
  8885. var self=this,$self=this;
  8886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8887. return $core.withContext(function($ctx1) {
  8888. //>>excludeEnd("ctx");
  8889. $self._nextPut_(" ");
  8890. return self;
  8891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8892. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8893. //>>excludeEnd("ctx");
  8894. }; }),
  8895. $globals.StringStream);
  8896. $core.addMethod(
  8897. $core.method({
  8898. selector: "tab",
  8899. protocol: "writing",
  8900. //>>excludeStart("ide", pragmas.excludeIdeData);
  8901. args: [],
  8902. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8903. referencedClasses: ["String"],
  8904. //>>excludeEnd("ide");
  8905. pragmas: [],
  8906. messageSends: ["nextPutAll:", "tab"]
  8907. }, function ($methodClass){ return function (){
  8908. var self=this,$self=this;
  8909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8910. return $core.withContext(function($ctx1) {
  8911. //>>excludeEnd("ctx");
  8912. return $self._nextPutAll_($recv($globals.String)._tab());
  8913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8914. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  8915. //>>excludeEnd("ctx");
  8916. }; }),
  8917. $globals.StringStream);
  8918. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8919. //>>excludeStart("ide", pragmas.excludeIdeData);
  8920. $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.";
  8921. //>>excludeEnd("ide");
  8922. $core.addMethod(
  8923. $core.method({
  8924. selector: "initialize",
  8925. protocol: "initialization",
  8926. //>>excludeStart("ide", pragmas.excludeIdeData);
  8927. args: [],
  8928. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8929. referencedClasses: ["OrderedCollection"],
  8930. //>>excludeEnd("ide");
  8931. pragmas: [],
  8932. messageSends: ["initialize", "new"]
  8933. }, function ($methodClass){ return function (){
  8934. var self=this,$self=this;
  8935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8936. return $core.withContext(function($ctx1) {
  8937. //>>excludeEnd("ctx");
  8938. (
  8939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8940. $ctx1.supercall = true,
  8941. //>>excludeEnd("ctx");
  8942. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self));
  8943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8944. $ctx1.supercall = false;
  8945. //>>excludeEnd("ctx");;
  8946. $self.read=$recv($globals.OrderedCollection)._new();
  8947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8948. $ctx1.sendIdx["new"]=1;
  8949. //>>excludeEnd("ctx");
  8950. $self.write=$recv($globals.OrderedCollection)._new();
  8951. $self.readIndex=(1);
  8952. return self;
  8953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8954. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  8955. //>>excludeEnd("ctx");
  8956. }; }),
  8957. $globals.Queue);
  8958. $core.addMethod(
  8959. $core.method({
  8960. selector: "next",
  8961. protocol: "accessing",
  8962. //>>excludeStart("ide", pragmas.excludeIdeData);
  8963. args: [],
  8964. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8965. referencedClasses: [],
  8966. //>>excludeEnd("ide");
  8967. pragmas: [],
  8968. messageSends: ["nextIfAbsent:", "error:"]
  8969. }, function ($methodClass){ return function (){
  8970. var self=this,$self=this;
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. return $core.withContext(function($ctx1) {
  8973. //>>excludeEnd("ctx");
  8974. return $self._nextIfAbsent_((function(){
  8975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8976. return $core.withContext(function($ctx2) {
  8977. //>>excludeEnd("ctx");
  8978. return $self._error_("Cannot read from empty Queue.");
  8979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8981. //>>excludeEnd("ctx");
  8982. }));
  8983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8984. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8985. //>>excludeEnd("ctx");
  8986. }; }),
  8987. $globals.Queue);
  8988. $core.addMethod(
  8989. $core.method({
  8990. selector: "nextIfAbsent:",
  8991. protocol: "accessing",
  8992. //>>excludeStart("ide", pragmas.excludeIdeData);
  8993. args: ["aBlock"],
  8994. 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",
  8995. referencedClasses: ["OrderedCollection"],
  8996. //>>excludeEnd("ide");
  8997. pragmas: [],
  8998. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  8999. }, function ($methodClass){ return function (aBlock){
  9000. var self=this,$self=this;
  9001. var result;
  9002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9003. return $core.withContext(function($ctx1) {
  9004. //>>excludeEnd("ctx");
  9005. var $1;
  9006. var $early={};
  9007. try {
  9008. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9010. return $core.withContext(function($ctx2) {
  9011. //>>excludeEnd("ctx");
  9012. $recv($self.write)._ifEmpty_((function(){
  9013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9014. return $core.withContext(function($ctx3) {
  9015. //>>excludeEnd("ctx");
  9016. $1=$recv($self.readIndex).__gt((1));
  9017. if($core.assert($1)){
  9018. $self.read=[];
  9019. $self.readIndex=(1);
  9020. $self.readIndex;
  9021. }
  9022. throw $early=[$recv(aBlock)._value()];
  9023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9024. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9025. //>>excludeEnd("ctx");
  9026. }));
  9027. $self.read=$self.write;
  9028. $self.readIndex=(1);
  9029. $self.write=$recv($globals.OrderedCollection)._new();
  9030. return $recv($self.read)._first();
  9031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9033. //>>excludeEnd("ctx");
  9034. }));
  9035. $recv($self.read)._at_put_($self.readIndex,nil);
  9036. $self.readIndex=$recv($self.readIndex).__plus((1));
  9037. return result;
  9038. }
  9039. catch(e) {if(e===$early)return e[0]; throw e}
  9040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9041. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9042. //>>excludeEnd("ctx");
  9043. }; }),
  9044. $globals.Queue);
  9045. $core.addMethod(
  9046. $core.method({
  9047. selector: "nextPut:",
  9048. protocol: "accessing",
  9049. //>>excludeStart("ide", pragmas.excludeIdeData);
  9050. args: ["anObject"],
  9051. source: "nextPut: anObject\x0a\x09write add: anObject",
  9052. referencedClasses: [],
  9053. //>>excludeEnd("ide");
  9054. pragmas: [],
  9055. messageSends: ["add:"]
  9056. }, function ($methodClass){ return function (anObject){
  9057. var self=this,$self=this;
  9058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9059. return $core.withContext(function($ctx1) {
  9060. //>>excludeEnd("ctx");
  9061. $recv($self.write)._add_(anObject);
  9062. return self;
  9063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9064. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9065. //>>excludeEnd("ctx");
  9066. }; }),
  9067. $globals.Queue);
  9068. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9069. //>>excludeStart("ide", pragmas.excludeIdeData);
  9070. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9071. //>>excludeEnd("ide");
  9072. $core.addMethod(
  9073. $core.method({
  9074. selector: "compile:",
  9075. protocol: "evaluating",
  9076. //>>excludeStart("ide", pragmas.excludeIdeData);
  9077. args: ["aString"],
  9078. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9079. referencedClasses: [],
  9080. //>>excludeEnd("ide");
  9081. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9082. messageSends: []
  9083. }, function ($methodClass){ return function (aString){
  9084. var self=this,$self=this;
  9085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9086. return $core.withContext(function($ctx1) {
  9087. //>>excludeEnd("ctx");
  9088. return self.compile(aString);
  9089. return self;
  9090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9091. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9092. //>>excludeEnd("ctx");
  9093. }; }),
  9094. $globals.RegularExpression);
  9095. $core.addMethod(
  9096. $core.method({
  9097. selector: "exec:",
  9098. protocol: "evaluating",
  9099. //>>excludeStart("ide", pragmas.excludeIdeData);
  9100. args: ["aString"],
  9101. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9102. referencedClasses: [],
  9103. //>>excludeEnd("ide");
  9104. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9105. messageSends: []
  9106. }, function ($methodClass){ return function (aString){
  9107. var self=this,$self=this;
  9108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9109. return $core.withContext(function($ctx1) {
  9110. //>>excludeEnd("ctx");
  9111. return self.exec(aString) || nil;
  9112. return self;
  9113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9114. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9115. //>>excludeEnd("ctx");
  9116. }; }),
  9117. $globals.RegularExpression);
  9118. $core.addMethod(
  9119. $core.method({
  9120. selector: "test:",
  9121. protocol: "evaluating",
  9122. //>>excludeStart("ide", pragmas.excludeIdeData);
  9123. args: ["aString"],
  9124. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9125. referencedClasses: [],
  9126. //>>excludeEnd("ide");
  9127. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9128. messageSends: []
  9129. }, function ($methodClass){ return function (aString){
  9130. var self=this,$self=this;
  9131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9132. return $core.withContext(function($ctx1) {
  9133. //>>excludeEnd("ctx");
  9134. return self.test(aString);
  9135. return self;
  9136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9137. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9138. //>>excludeEnd("ctx");
  9139. }; }),
  9140. $globals.RegularExpression);
  9141. $core.addMethod(
  9142. $core.method({
  9143. selector: "fromString:",
  9144. protocol: "instance creation",
  9145. //>>excludeStart("ide", pragmas.excludeIdeData);
  9146. args: ["aString"],
  9147. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9148. referencedClasses: [],
  9149. //>>excludeEnd("ide");
  9150. pragmas: [],
  9151. messageSends: ["fromString:flag:"]
  9152. }, function ($methodClass){ return function (aString){
  9153. var self=this,$self=this;
  9154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9155. return $core.withContext(function($ctx1) {
  9156. //>>excludeEnd("ctx");
  9157. return $self._fromString_flag_(aString,"");
  9158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9159. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9160. //>>excludeEnd("ctx");
  9161. }; }),
  9162. $globals.RegularExpression.a$cls);
  9163. $core.addMethod(
  9164. $core.method({
  9165. selector: "fromString:flag:",
  9166. protocol: "instance creation",
  9167. //>>excludeStart("ide", pragmas.excludeIdeData);
  9168. args: ["aString", "anotherString"],
  9169. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9170. referencedClasses: [],
  9171. //>>excludeEnd("ide");
  9172. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9173. messageSends: []
  9174. }, function ($methodClass){ return function (aString,anotherString){
  9175. var self=this,$self=this;
  9176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9177. return $core.withContext(function($ctx1) {
  9178. //>>excludeEnd("ctx");
  9179. return new RegExp(aString, anotherString);
  9180. return self;
  9181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9182. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9183. //>>excludeEnd("ctx");
  9184. }; }),
  9185. $globals.RegularExpression.a$cls);
  9186. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9187. $core.addMethod(
  9188. $core.method({
  9189. selector: "at:",
  9190. protocol: "accessing",
  9191. //>>excludeStart("ide", pragmas.excludeIdeData);
  9192. args: ["anIndex"],
  9193. 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 ]",
  9194. referencedClasses: [],
  9195. //>>excludeEnd("ide");
  9196. pragmas: [],
  9197. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9198. }, function ($methodClass){ return function (anIndex){
  9199. var self=this,$self=this;
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. return $core.withContext(function($ctx1) {
  9202. //>>excludeEnd("ctx");
  9203. return $self._at_ifAbsent_(anIndex,(function(){
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. return $core.withContext(function($ctx2) {
  9206. //>>excludeEnd("ctx");
  9207. return $self._errorNotFound();
  9208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9210. //>>excludeEnd("ctx");
  9211. }));
  9212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9213. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9214. //>>excludeEnd("ctx");
  9215. }; }),
  9216. $globals.TKeyValueCollection);
  9217. $core.addMethod(
  9218. $core.method({
  9219. selector: "at:ifAbsent:",
  9220. protocol: "accessing",
  9221. //>>excludeStart("ide", pragmas.excludeIdeData);
  9222. args: ["anIndex", "aBlock"],
  9223. 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",
  9224. referencedClasses: [],
  9225. //>>excludeEnd("ide");
  9226. pragmas: [],
  9227. messageSends: ["subclassResponsibility"]
  9228. }, function ($methodClass){ return function (anIndex,aBlock){
  9229. var self=this,$self=this;
  9230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9231. return $core.withContext(function($ctx1) {
  9232. //>>excludeEnd("ctx");
  9233. $self._subclassResponsibility();
  9234. return self;
  9235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9236. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9237. //>>excludeEnd("ctx");
  9238. }; }),
  9239. $globals.TKeyValueCollection);
  9240. $core.addMethod(
  9241. $core.method({
  9242. selector: "at:ifAbsentPut:",
  9243. protocol: "accessing",
  9244. //>>excludeStart("ide", pragmas.excludeIdeData);
  9245. args: ["aKey", "aBlock"],
  9246. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9247. referencedClasses: [],
  9248. //>>excludeEnd("ide");
  9249. pragmas: [],
  9250. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9251. }, function ($methodClass){ return function (aKey,aBlock){
  9252. var self=this,$self=this;
  9253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9254. return $core.withContext(function($ctx1) {
  9255. //>>excludeEnd("ctx");
  9256. return $self._at_ifAbsent_(aKey,(function(){
  9257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9258. return $core.withContext(function($ctx2) {
  9259. //>>excludeEnd("ctx");
  9260. return $self._at_put_(aKey,$recv(aBlock)._value());
  9261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9263. //>>excludeEnd("ctx");
  9264. }));
  9265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9266. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9267. //>>excludeEnd("ctx");
  9268. }; }),
  9269. $globals.TKeyValueCollection);
  9270. $core.addMethod(
  9271. $core.method({
  9272. selector: "at:ifPresent:",
  9273. protocol: "accessing",
  9274. //>>excludeStart("ide", pragmas.excludeIdeData);
  9275. args: ["anIndex", "aBlock"],
  9276. 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 ]",
  9277. referencedClasses: [],
  9278. //>>excludeEnd("ide");
  9279. pragmas: [],
  9280. messageSends: ["at:ifPresent:ifAbsent:"]
  9281. }, function ($methodClass){ return function (anIndex,aBlock){
  9282. var self=this,$self=this;
  9283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9284. return $core.withContext(function($ctx1) {
  9285. //>>excludeEnd("ctx");
  9286. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9287. return nil;
  9288. }));
  9289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9290. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9291. //>>excludeEnd("ctx");
  9292. }; }),
  9293. $globals.TKeyValueCollection);
  9294. $core.addMethod(
  9295. $core.method({
  9296. selector: "at:ifPresent:ifAbsent:",
  9297. protocol: "accessing",
  9298. //>>excludeStart("ide", pragmas.excludeIdeData);
  9299. args: ["anIndex", "aBlock", "anotherBlock"],
  9300. 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",
  9301. referencedClasses: [],
  9302. //>>excludeEnd("ide");
  9303. pragmas: [],
  9304. messageSends: ["subclassResponsibility"]
  9305. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9306. var self=this,$self=this;
  9307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9308. return $core.withContext(function($ctx1) {
  9309. //>>excludeEnd("ctx");
  9310. $self._subclassResponsibility();
  9311. return self;
  9312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9313. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9314. //>>excludeEnd("ctx");
  9315. }; }),
  9316. $globals.TKeyValueCollection);
  9317. $core.addMethod(
  9318. $core.method({
  9319. selector: "at:put:",
  9320. protocol: "accessing",
  9321. //>>excludeStart("ide", pragmas.excludeIdeData);
  9322. args: ["anIndex", "anObject"],
  9323. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9324. referencedClasses: [],
  9325. //>>excludeEnd("ide");
  9326. pragmas: [],
  9327. messageSends: ["subclassResponsibility"]
  9328. }, function ($methodClass){ return function (anIndex,anObject){
  9329. var self=this,$self=this;
  9330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9331. return $core.withContext(function($ctx1) {
  9332. //>>excludeEnd("ctx");
  9333. $self._subclassResponsibility();
  9334. return self;
  9335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9336. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9337. //>>excludeEnd("ctx");
  9338. }; }),
  9339. $globals.TKeyValueCollection);
  9340. $core.addMethod(
  9341. $core.method({
  9342. selector: "indexOf:",
  9343. protocol: "accessing",
  9344. //>>excludeStart("ide", pragmas.excludeIdeData);
  9345. args: ["anObject"],
  9346. 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 ]",
  9347. referencedClasses: [],
  9348. //>>excludeEnd("ide");
  9349. pragmas: [],
  9350. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9351. }, function ($methodClass){ return function (anObject){
  9352. var self=this,$self=this;
  9353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9354. return $core.withContext(function($ctx1) {
  9355. //>>excludeEnd("ctx");
  9356. return $self._indexOf_ifAbsent_(anObject,(function(){
  9357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9358. return $core.withContext(function($ctx2) {
  9359. //>>excludeEnd("ctx");
  9360. return $self._errorNotFound();
  9361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9363. //>>excludeEnd("ctx");
  9364. }));
  9365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9366. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9367. //>>excludeEnd("ctx");
  9368. }; }),
  9369. $globals.TKeyValueCollection);
  9370. $core.addMethod(
  9371. $core.method({
  9372. selector: "indexOf:ifAbsent:",
  9373. protocol: "accessing",
  9374. //>>excludeStart("ide", pragmas.excludeIdeData);
  9375. args: ["anObject", "aBlock"],
  9376. 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",
  9377. referencedClasses: [],
  9378. //>>excludeEnd("ide");
  9379. pragmas: [],
  9380. messageSends: ["subclassResponsibility"]
  9381. }, function ($methodClass){ return function (anObject,aBlock){
  9382. var self=this,$self=this;
  9383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9384. return $core.withContext(function($ctx1) {
  9385. //>>excludeEnd("ctx");
  9386. $self._subclassResponsibility();
  9387. return self;
  9388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9389. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9390. //>>excludeEnd("ctx");
  9391. }; }),
  9392. $globals.TKeyValueCollection);
  9393. $core.addMethod(
  9394. $core.method({
  9395. selector: "with:do:",
  9396. protocol: "enumerating",
  9397. //>>excludeStart("ide", pragmas.excludeIdeData);
  9398. args: ["anotherCollection", "aBlock"],
  9399. 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) ]",
  9400. referencedClasses: [],
  9401. //>>excludeEnd("ide");
  9402. pragmas: [],
  9403. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9404. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9405. var self=this,$self=this;
  9406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9407. return $core.withContext(function($ctx1) {
  9408. //>>excludeEnd("ctx");
  9409. $self._withIndexDo_((function(each,index){
  9410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9411. return $core.withContext(function($ctx2) {
  9412. //>>excludeEnd("ctx");
  9413. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9415. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9416. //>>excludeEnd("ctx");
  9417. }));
  9418. return self;
  9419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9420. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9421. //>>excludeEnd("ctx");
  9422. }; }),
  9423. $globals.TKeyValueCollection);
  9424. $core.addMethod(
  9425. $core.method({
  9426. selector: "withIndexDo:",
  9427. protocol: "enumerating",
  9428. //>>excludeStart("ide", pragmas.excludeIdeData);
  9429. args: ["aBlock"],
  9430. 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",
  9431. referencedClasses: [],
  9432. //>>excludeEnd("ide");
  9433. pragmas: [],
  9434. messageSends: ["subclassResponsibility"]
  9435. }, function ($methodClass){ return function (aBlock){
  9436. var self=this,$self=this;
  9437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9438. return $core.withContext(function($ctx1) {
  9439. //>>excludeEnd("ctx");
  9440. $self._subclassResponsibility();
  9441. return self;
  9442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9443. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9444. //>>excludeEnd("ctx");
  9445. }; }),
  9446. $globals.TKeyValueCollection);
  9447. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9448. $core.addMethod(
  9449. $core.method({
  9450. selector: "at:ifAbsent:",
  9451. protocol: "accessing",
  9452. //>>excludeStart("ide", pragmas.excludeIdeData);
  9453. args: ["anIndex", "aBlock"],
  9454. 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'>",
  9455. referencedClasses: [],
  9456. //>>excludeEnd("ide");
  9457. 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"]]],
  9458. messageSends: []
  9459. }, function ($methodClass){ return function (anIndex,aBlock){
  9460. var self=this,$self=this;
  9461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9462. return $core.withContext(function($ctx1) {
  9463. //>>excludeEnd("ctx");
  9464. return anIndex >= 1 && anIndex <= self.length
  9465. ? self[anIndex - 1]
  9466. : aBlock._value()
  9467. ;
  9468. return self;
  9469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9470. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9471. //>>excludeEnd("ctx");
  9472. }; }),
  9473. $globals.TNativeZeroBasedCollection);
  9474. $core.addMethod(
  9475. $core.method({
  9476. selector: "at:ifPresent:ifAbsent:",
  9477. protocol: "accessing",
  9478. //>>excludeStart("ide", pragmas.excludeIdeData);
  9479. args: ["anIndex", "aBlock", "anotherBlock"],
  9480. 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'>",
  9481. referencedClasses: [],
  9482. //>>excludeEnd("ide");
  9483. 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"]]],
  9484. messageSends: []
  9485. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9486. var self=this,$self=this;
  9487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9488. return $core.withContext(function($ctx1) {
  9489. //>>excludeEnd("ctx");
  9490. return anIndex >= 1 && anIndex <= self.length
  9491. ? aBlock._value_(self[anIndex - 1])
  9492. : anotherBlock._value()
  9493. ;
  9494. return self;
  9495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9496. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9497. //>>excludeEnd("ctx");
  9498. }; }),
  9499. $globals.TNativeZeroBasedCollection);
  9500. $core.addMethod(
  9501. $core.method({
  9502. selector: "detect:ifNone:",
  9503. protocol: "enumerating",
  9504. //>>excludeStart("ide", pragmas.excludeIdeData);
  9505. args: ["aBlock", "anotherBlock"],
  9506. 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'>",
  9507. referencedClasses: [],
  9508. //>>excludeEnd("ide");
  9509. 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"]]],
  9510. messageSends: []
  9511. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9512. var self=this,$self=this;
  9513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9514. return $core.withContext(function($ctx1) {
  9515. //>>excludeEnd("ctx");
  9516. for(var i = 0; i < self.length; i++)
  9517. if(aBlock._value_(self[i]))
  9518. return self[i];
  9519. return anotherBlock._value();
  9520. ;
  9521. return self;
  9522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9523. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9524. //>>excludeEnd("ctx");
  9525. }; }),
  9526. $globals.TNativeZeroBasedCollection);
  9527. $core.addMethod(
  9528. $core.method({
  9529. selector: "do:",
  9530. protocol: "enumerating",
  9531. //>>excludeStart("ide", pragmas.excludeIdeData);
  9532. args: ["aBlock"],
  9533. 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'>",
  9534. referencedClasses: [],
  9535. //>>excludeEnd("ide");
  9536. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9537. messageSends: []
  9538. }, function ($methodClass){ return function (aBlock){
  9539. var self=this,$self=this;
  9540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9541. return $core.withContext(function($ctx1) {
  9542. //>>excludeEnd("ctx");
  9543. for(var i=0; i < self.length; i++) {
  9544. aBlock._value_(self[i]);
  9545. }
  9546. ;
  9547. return self;
  9548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9549. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9550. //>>excludeEnd("ctx");
  9551. }; }),
  9552. $globals.TNativeZeroBasedCollection);
  9553. $core.addMethod(
  9554. $core.method({
  9555. selector: "indexOf:ifAbsent:",
  9556. protocol: "accessing",
  9557. //>>excludeStart("ide", pragmas.excludeIdeData);
  9558. args: ["anObject", "aBlock"],
  9559. 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'>",
  9560. referencedClasses: [],
  9561. //>>excludeEnd("ide");
  9562. 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"]]],
  9563. messageSends: []
  9564. }, function ($methodClass){ return function (anObject,aBlock){
  9565. var self=this,$self=this;
  9566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9567. return $core.withContext(function($ctx1) {
  9568. //>>excludeEnd("ctx");
  9569. for(var i=0; i < self.length; i++) {
  9570. if($recv(self[i]).__eq(anObject)) {return i+1}
  9571. };
  9572. return aBlock._value();
  9573. ;
  9574. return self;
  9575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9576. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9577. //>>excludeEnd("ctx");
  9578. }; }),
  9579. $globals.TNativeZeroBasedCollection);
  9580. $core.addMethod(
  9581. $core.method({
  9582. selector: "indexOf:startingAt:ifAbsent:",
  9583. protocol: "accessing",
  9584. //>>excludeStart("ide", pragmas.excludeIdeData);
  9585. args: ["anObject", "start", "aBlock"],
  9586. 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'>",
  9587. referencedClasses: [],
  9588. //>>excludeEnd("ide");
  9589. 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"]]],
  9590. messageSends: []
  9591. }, function ($methodClass){ return function (anObject,start,aBlock){
  9592. var self=this,$self=this;
  9593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9594. return $core.withContext(function($ctx1) {
  9595. //>>excludeEnd("ctx");
  9596. for(var i=start - 1; i < self.length; i++){
  9597. if($recv(self[i]).__eq(anObject)) {return i+1}
  9598. }
  9599. return aBlock._value();
  9600. ;
  9601. return self;
  9602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9603. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9604. //>>excludeEnd("ctx");
  9605. }; }),
  9606. $globals.TNativeZeroBasedCollection);
  9607. $core.addMethod(
  9608. $core.method({
  9609. selector: "single",
  9610. protocol: "accessing",
  9611. //>>excludeStart("ide", pragmas.excludeIdeData);
  9612. args: [],
  9613. 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'>",
  9614. referencedClasses: [],
  9615. //>>excludeEnd("ide");
  9616. 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];"]]],
  9617. messageSends: []
  9618. }, function ($methodClass){ return function (){
  9619. var self=this,$self=this;
  9620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9621. return $core.withContext(function($ctx1) {
  9622. //>>excludeEnd("ctx");
  9623. if (self.length == 0) throw new Error("Collection is empty");
  9624. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9625. return self[0];;
  9626. return self;
  9627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9628. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9629. //>>excludeEnd("ctx");
  9630. }; }),
  9631. $globals.TNativeZeroBasedCollection);
  9632. $core.addMethod(
  9633. $core.method({
  9634. selector: "size",
  9635. protocol: "accessing",
  9636. //>>excludeStart("ide", pragmas.excludeIdeData);
  9637. args: [],
  9638. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9639. referencedClasses: [],
  9640. //>>excludeEnd("ide");
  9641. pragmas: [["inlineJS:", ["return self.length"]]],
  9642. messageSends: []
  9643. }, function ($methodClass){ return function (){
  9644. var self=this,$self=this;
  9645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9646. return $core.withContext(function($ctx1) {
  9647. //>>excludeEnd("ctx");
  9648. return self.length;
  9649. return self;
  9650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9651. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9652. //>>excludeEnd("ctx");
  9653. }; }),
  9654. $globals.TNativeZeroBasedCollection);
  9655. $core.addMethod(
  9656. $core.method({
  9657. selector: "with:do:",
  9658. protocol: "enumerating",
  9659. //>>excludeStart("ide", pragmas.excludeIdeData);
  9660. args: ["anotherCollection", "aBlock"],
  9661. 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'>",
  9662. referencedClasses: [],
  9663. //>>excludeEnd("ide");
  9664. 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"]]],
  9665. messageSends: []
  9666. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9667. var self=this,$self=this;
  9668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9669. return $core.withContext(function($ctx1) {
  9670. //>>excludeEnd("ctx");
  9671. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9672. for(var i=0; i<self.length; i++) {
  9673. aBlock._value_value_(self[i], anotherCollection[i]);
  9674. }
  9675. ;
  9676. return self;
  9677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9678. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9679. //>>excludeEnd("ctx");
  9680. }; }),
  9681. $globals.TNativeZeroBasedCollection);
  9682. $core.addMethod(
  9683. $core.method({
  9684. selector: "withIndexDo:",
  9685. protocol: "enumerating",
  9686. //>>excludeStart("ide", pragmas.excludeIdeData);
  9687. args: ["aBlock"],
  9688. 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'>",
  9689. referencedClasses: [],
  9690. //>>excludeEnd("ide");
  9691. 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"]]],
  9692. messageSends: []
  9693. }, function ($methodClass){ return function (aBlock){
  9694. var self=this,$self=this;
  9695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9696. return $core.withContext(function($ctx1) {
  9697. //>>excludeEnd("ctx");
  9698. for(var i=0; i < self.length; i++) {
  9699. aBlock._value_value_(self[i], i+1);
  9700. }
  9701. ;
  9702. return self;
  9703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9704. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9705. //>>excludeEnd("ctx");
  9706. }; }),
  9707. $globals.TNativeZeroBasedCollection);
  9708. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9709. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9710. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9711. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9712. });