Kernel-Collections.js 352 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222
  1. define(["amber/boot", "require", "amber/core/Kernel-Objects"], function($boot,requirejs){"use strict";
  2. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. var $pkg = $core.addPackage("Kernel-Collections");
  4. $pkg.innerEval = function (expr) { return eval(expr); };
  5. $pkg.transport = {"type":"amd","amdNamespace":"amber/core"};
  6. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: "comparing",
  14. //>>excludeStart("ide", pragmas.excludeIdeData);
  15. args: ["anAssociation"],
  16. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  17. referencedClasses: [],
  18. //>>excludeEnd("ide");
  19. pragmas: [],
  20. messageSends: ["and:", "=", "class", "key", "value"]
  21. }, function ($methodClass){ return function (anAssociation){
  22. var self=this,$self=this;
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. return $core.withContext(function($ctx1) {
  25. //>>excludeEnd("ctx");
  26. return [$recv([$recv([$self._class()
  27. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28. ,$ctx1.sendIdx["class"]=1
  29. //>>excludeEnd("ctx");
  30. ][0]).__eq($recv(anAssociation)._class())
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. ,$ctx1.sendIdx["="]=1
  33. //>>excludeEnd("ctx");
  34. ][0])._and_((function(){
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. return $core.withContext(function($ctx2) {
  37. //>>excludeEnd("ctx");
  38. return $recv([$recv([$self._key()
  39. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40. ,$ctx2.sendIdx["key"]=1
  41. //>>excludeEnd("ctx");
  42. ][0]).__eq($recv(anAssociation)._key())
  43. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44. ,$ctx2.sendIdx["="]=2
  45. //>>excludeEnd("ctx");
  46. ][0])._and_((function(){
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. return $core.withContext(function($ctx3) {
  49. //>>excludeEnd("ctx");
  50. return $recv([$self._value()
  51. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  52. ,$ctx3.sendIdx["value"]=1
  53. //>>excludeEnd("ctx");
  54. ][0]).__eq($recv(anAssociation)._value());
  55. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  57. //>>excludeEnd("ctx");
  58. }));
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61. //>>excludeEnd("ctx");
  62. }))
  63. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64. ,$ctx1.sendIdx["and:"]=1
  65. //>>excludeEnd("ctx");
  66. ][0];
  67. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  68. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation})});
  69. //>>excludeEnd("ctx");
  70. }; }),
  71. $globals.Association);
  72. $core.addMethod(
  73. $core.method({
  74. selector: "key",
  75. protocol: "accessing",
  76. //>>excludeStart("ide", pragmas.excludeIdeData);
  77. args: [],
  78. source: "key\x0a\x09^ key",
  79. referencedClasses: [],
  80. //>>excludeEnd("ide");
  81. pragmas: [],
  82. messageSends: []
  83. }, function ($methodClass){ return function (){
  84. var self=this,$self=this;
  85. return $self.key;
  86. }; }),
  87. $globals.Association);
  88. $core.addMethod(
  89. $core.method({
  90. selector: "key:",
  91. protocol: "accessing",
  92. //>>excludeStart("ide", pragmas.excludeIdeData);
  93. args: ["aKey"],
  94. source: "key: aKey\x0a\x09key := aKey",
  95. referencedClasses: [],
  96. //>>excludeEnd("ide");
  97. pragmas: [],
  98. messageSends: []
  99. }, function ($methodClass){ return function (aKey){
  100. var self=this,$self=this;
  101. $self.key=aKey;
  102. return self;
  103. }; }),
  104. $globals.Association);
  105. $core.addMethod(
  106. $core.method({
  107. selector: "printOn:",
  108. protocol: "printing",
  109. //>>excludeStart("ide", pragmas.excludeIdeData);
  110. args: ["aStream"],
  111. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  112. referencedClasses: [],
  113. //>>excludeEnd("ide");
  114. pragmas: [],
  115. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  116. }, function ($methodClass){ return function (aStream){
  117. var self=this,$self=this;
  118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  119. return $core.withContext(function($ctx1) {
  120. //>>excludeEnd("ctx");
  121. [$recv($self._key())._printOn_(aStream)
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. ,$ctx1.sendIdx["printOn:"]=1
  124. //>>excludeEnd("ctx");
  125. ][0];
  126. $recv(aStream)._nextPutAll_(" -> ");
  127. $recv($self._value())._printOn_(aStream);
  128. return self;
  129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  130. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  131. //>>excludeEnd("ctx");
  132. }; }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: "accessing",
  138. //>>excludeStart("ide", pragmas.excludeIdeData);
  139. args: [],
  140. source: "value\x0a\x09^ value",
  141. referencedClasses: [],
  142. //>>excludeEnd("ide");
  143. pragmas: [],
  144. messageSends: []
  145. }, function ($methodClass){ return function (){
  146. var self=this,$self=this;
  147. return $self.value;
  148. }; }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: "accessing",
  154. //>>excludeStart("ide", pragmas.excludeIdeData);
  155. args: ["aValue"],
  156. source: "value: aValue\x0a\x09value := aValue",
  157. referencedClasses: [],
  158. //>>excludeEnd("ide");
  159. pragmas: [],
  160. messageSends: []
  161. }, function ($methodClass){ return function (aValue){
  162. var self=this,$self=this;
  163. $self.value=aValue;
  164. return self;
  165. }; }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: "instance creation",
  171. //>>excludeStart("ide", pragmas.excludeIdeData);
  172. args: ["aKey", "aValue"],
  173. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  174. referencedClasses: [],
  175. //>>excludeEnd("ide");
  176. pragmas: [],
  177. messageSends: ["key:", "new", "value:", "yourself"]
  178. }, function ($methodClass){ return function (aKey,aValue){
  179. var self=this,$self=this;
  180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  181. return $core.withContext(function($ctx1) {
  182. //>>excludeEnd("ctx");
  183. var $1;
  184. $1=$self._new();
  185. $recv($1)._key_(aKey);
  186. $recv($1)._value_(aValue);
  187. return $recv($1)._yourself();
  188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  189. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue})});
  190. //>>excludeEnd("ctx");
  191. }; }),
  192. $globals.Association.a$cls);
  193. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: "accessing",
  201. //>>excludeStart("ide", pragmas.excludeIdeData);
  202. args: ["anObject"],
  203. source: "bucketOfElement: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09'>",
  204. referencedClasses: [],
  205. //>>excludeEnd("ide");
  206. pragmas: [["inlineJS:", ["\x0a\x09\x09var hash = $self.hashBlock(anObject);\x0a\x09\x09if (!hash) return null;\x0a\x09\x09var buckets = $self.buckets,\x0a\x09\x09\x09bucket = buckets[hash];\x0a\x09\x09if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }\x0a\x09\x09return bucket;\x0a\x09"]]],
  207. messageSends: []
  208. }, function ($methodClass){ return function (anObject){
  209. var self=this,$self=this;
  210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  211. return $core.withContext(function($ctx1) {
  212. //>>excludeEnd("ctx");
  213. var hash = $self.hashBlock(anObject);
  214. if (!hash) return null;
  215. var buckets = $self.buckets,
  216. bucket = buckets[hash];
  217. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  218. return bucket;
  219. ;
  220. return self;
  221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  222. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject})});
  223. //>>excludeEnd("ctx");
  224. }; }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: "enumerating",
  230. //>>excludeStart("ide", pragmas.excludeIdeData);
  231. args: ["aBlock"],
  232. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09'>",
  233. referencedClasses: [],
  234. //>>excludeEnd("ide");
  235. pragmas: [["inlineJS:", ["\x0a\x09\x09var buckets = $self.buckets;\x0a\x09\x09var keys = Object.keys(buckets);\x0a\x09\x09for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }\x0a\x09"]]],
  236. messageSends: []
  237. }, function ($methodClass){ return function (aBlock){
  238. var self=this,$self=this;
  239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  240. return $core.withContext(function($ctx1) {
  241. //>>excludeEnd("ctx");
  242. var buckets = $self.buckets;
  243. var keys = Object.keys(buckets);
  244. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  245. ;
  246. return self;
  247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  248. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  249. //>>excludeEnd("ctx");
  250. }; }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: "accessing",
  256. //>>excludeStart("ide", pragmas.excludeIdeData);
  257. args: ["aBlock"],
  258. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  259. referencedClasses: [],
  260. //>>excludeEnd("ide");
  261. pragmas: [],
  262. messageSends: []
  263. }, function ($methodClass){ return function (aBlock){
  264. var self=this,$self=this;
  265. $self.hashBlock=aBlock;
  266. return self;
  267. }; }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: "initialization",
  273. //>>excludeStart("ide", pragmas.excludeIdeData);
  274. args: [],
  275. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  276. referencedClasses: [],
  277. //>>excludeEnd("ide");
  278. pragmas: [],
  279. messageSends: ["initialize", "removeAll"]
  280. }, function ($methodClass){ return function (){
  281. var self=this,$self=this;
  282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  283. return $core.withContext(function($ctx1) {
  284. //>>excludeEnd("ctx");
  285. [(
  286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  287. $ctx1.supercall = true,
  288. //>>excludeEnd("ctx");
  289. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. ,$ctx1.supercall = false
  292. //>>excludeEnd("ctx");
  293. ][0];
  294. $self._removeAll();
  295. return self;
  296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  297. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  298. //>>excludeEnd("ctx");
  299. }; }),
  300. $globals.BucketStore);
  301. $core.addMethod(
  302. $core.method({
  303. selector: "newBucket",
  304. protocol: "private",
  305. //>>excludeStart("ide", pragmas.excludeIdeData);
  306. args: [],
  307. source: "newBucket\x0a\x09self subclassResponsibility",
  308. referencedClasses: [],
  309. //>>excludeEnd("ide");
  310. pragmas: [],
  311. messageSends: ["subclassResponsibility"]
  312. }, function ($methodClass){ return function (){
  313. var self=this,$self=this;
  314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  315. return $core.withContext(function($ctx1) {
  316. //>>excludeEnd("ctx");
  317. $self._subclassResponsibility();
  318. return self;
  319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  320. }, function($ctx1) {$ctx1.fill(self,"newBucket",{})});
  321. //>>excludeEnd("ctx");
  322. }; }),
  323. $globals.BucketStore);
  324. $core.addMethod(
  325. $core.method({
  326. selector: "removeAll",
  327. protocol: "adding/removing",
  328. //>>excludeStart("ide", pragmas.excludeIdeData);
  329. args: [],
  330. source: "removeAll\x0a\x09<inlineJS: '$self.buckets = Object.create(null);'>",
  331. referencedClasses: [],
  332. //>>excludeEnd("ide");
  333. pragmas: [["inlineJS:", ["$self.buckets = Object.create(null);"]]],
  334. messageSends: []
  335. }, function ($methodClass){ return function (){
  336. var self=this,$self=this;
  337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  338. return $core.withContext(function($ctx1) {
  339. //>>excludeEnd("ctx");
  340. $self.buckets = Object.create(null);;
  341. return self;
  342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  343. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  344. //>>excludeEnd("ctx");
  345. }; }),
  346. $globals.BucketStore);
  347. $core.addMethod(
  348. $core.method({
  349. selector: "hashBlock:",
  350. protocol: "instance creation",
  351. //>>excludeStart("ide", pragmas.excludeIdeData);
  352. args: ["aBlock"],
  353. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  354. referencedClasses: [],
  355. //>>excludeEnd("ide");
  356. pragmas: [],
  357. messageSends: ["hashBlock:", "new", "yourself"]
  358. }, function ($methodClass){ return function (aBlock){
  359. var self=this,$self=this;
  360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  361. return $core.withContext(function($ctx1) {
  362. //>>excludeEnd("ctx");
  363. var $1;
  364. $1=$self._new();
  365. $recv($1)._hashBlock_(aBlock);
  366. return $recv($1)._yourself();
  367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  368. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock})});
  369. //>>excludeEnd("ctx");
  370. }; }),
  371. $globals.BucketStore.a$cls);
  372. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  373. //>>excludeStart("ide", pragmas.excludeIdeData);
  374. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  375. //>>excludeEnd("ide");
  376. $core.addMethod(
  377. $core.method({
  378. selector: "newBucket",
  379. protocol: "private",
  380. //>>excludeStart("ide", pragmas.excludeIdeData);
  381. args: [],
  382. source: "newBucket\x0a\x09^ #()",
  383. referencedClasses: [],
  384. //>>excludeEnd("ide");
  385. pragmas: [],
  386. messageSends: []
  387. }, function ($methodClass){ return function (){
  388. var self=this,$self=this;
  389. return [];
  390. }; }),
  391. $globals.ArrayBucketStore);
  392. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  393. //>>excludeStart("ide", pragmas.excludeIdeData);
  394. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  395. //>>excludeEnd("ide");
  396. $core.addMethod(
  397. $core.method({
  398. selector: ",",
  399. protocol: "copying",
  400. //>>excludeStart("ide", pragmas.excludeIdeData);
  401. args: ["aCollection"],
  402. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  403. referencedClasses: [],
  404. //>>excludeEnd("ide");
  405. pragmas: [],
  406. messageSends: ["addAll:", "copy", "yourself"]
  407. }, function ($methodClass){ return function (aCollection){
  408. var self=this,$self=this;
  409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  410. return $core.withContext(function($ctx1) {
  411. //>>excludeEnd("ctx");
  412. var $1;
  413. $1=$self._copy();
  414. $recv($1)._addAll_(aCollection);
  415. return $recv($1)._yourself();
  416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  417. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection})});
  418. //>>excludeEnd("ctx");
  419. }; }),
  420. $globals.Collection);
  421. $core.addMethod(
  422. $core.method({
  423. selector: "add:",
  424. protocol: "adding/removing",
  425. //>>excludeStart("ide", pragmas.excludeIdeData);
  426. args: ["anObject"],
  427. source: "add: anObject\x0a\x09self subclassResponsibility",
  428. referencedClasses: [],
  429. //>>excludeEnd("ide");
  430. pragmas: [],
  431. messageSends: ["subclassResponsibility"]
  432. }, function ($methodClass){ return function (anObject){
  433. var self=this,$self=this;
  434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  435. return $core.withContext(function($ctx1) {
  436. //>>excludeEnd("ctx");
  437. $self._subclassResponsibility();
  438. return self;
  439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  440. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  441. //>>excludeEnd("ctx");
  442. }; }),
  443. $globals.Collection);
  444. $core.addMethod(
  445. $core.method({
  446. selector: "addAll:",
  447. protocol: "adding/removing",
  448. //>>excludeStart("ide", pragmas.excludeIdeData);
  449. args: ["aCollection"],
  450. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  451. referencedClasses: [],
  452. //>>excludeEnd("ide");
  453. pragmas: [],
  454. messageSends: ["do:", "add:"]
  455. }, function ($methodClass){ return function (aCollection){
  456. var self=this,$self=this;
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. return $core.withContext(function($ctx1) {
  459. //>>excludeEnd("ctx");
  460. $recv(aCollection)._do_((function(each){
  461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  462. return $core.withContext(function($ctx2) {
  463. //>>excludeEnd("ctx");
  464. return $self._add_(each);
  465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  467. //>>excludeEnd("ctx");
  468. }));
  469. return aCollection;
  470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  471. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  472. //>>excludeEnd("ctx");
  473. }; }),
  474. $globals.Collection);
  475. $core.addMethod(
  476. $core.method({
  477. selector: "allSatisfy:",
  478. protocol: "enumerating",
  479. //>>excludeStart("ide", pragmas.excludeIdeData);
  480. args: ["aBlock"],
  481. source: "allSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for any element return false.\x0a\x09Otherwise return true.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  482. referencedClasses: [],
  483. //>>excludeEnd("ide");
  484. pragmas: [],
  485. messageSends: ["do:", "ifFalse:", "value:"]
  486. }, function ($methodClass){ return function (aBlock){
  487. var self=this,$self=this;
  488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  489. return $core.withContext(function($ctx1) {
  490. //>>excludeEnd("ctx");
  491. var $early={};
  492. try {
  493. $self._do_((function(each){
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. return $core.withContext(function($ctx2) {
  496. //>>excludeEnd("ctx");
  497. if(!$core.assert($recv(aBlock)._value_(each))){
  498. throw $early=[false];
  499. }
  500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  502. //>>excludeEnd("ctx");
  503. }));
  504. return true;
  505. }
  506. catch(e) {if(e===$early)return e[0]; throw e}
  507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  508. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock})});
  509. //>>excludeEnd("ctx");
  510. }; }),
  511. $globals.Collection);
  512. $core.addMethod(
  513. $core.method({
  514. selector: "anyOne",
  515. protocol: "accessing",
  516. //>>excludeStart("ide", pragmas.excludeIdeData);
  517. args: [],
  518. source: "anyOne\x0a\x09\x22Answer a representative sample of the receiver. This method can\x0a\x09be helpful when needing to preinfer the nature of the contents of \x0a\x09semi-homogeneous collections.\x22\x0a\x0a\x09self ifEmpty: [ self error: 'Collection is empty' ].\x0a\x09self do: [ :each | ^ each ]",
  519. referencedClasses: [],
  520. //>>excludeEnd("ide");
  521. pragmas: [],
  522. messageSends: ["ifEmpty:", "error:", "do:"]
  523. }, function ($methodClass){ return function (){
  524. var self=this,$self=this;
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. return $core.withContext(function($ctx1) {
  527. //>>excludeEnd("ctx");
  528. var $early={};
  529. try {
  530. $self._ifEmpty_((function(){
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. return $core.withContext(function($ctx2) {
  533. //>>excludeEnd("ctx");
  534. return $self._error_("Collection is empty");
  535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  537. //>>excludeEnd("ctx");
  538. }));
  539. $self._do_((function(each){
  540. throw $early=[each];
  541. }));
  542. return self;
  543. }
  544. catch(e) {if(e===$early)return e[0]; throw e}
  545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  546. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  547. //>>excludeEnd("ctx");
  548. }; }),
  549. $globals.Collection);
  550. $core.addMethod(
  551. $core.method({
  552. selector: "anySatisfy:",
  553. protocol: "enumerating",
  554. //>>excludeStart("ide", pragmas.excludeIdeData);
  555. args: ["aBlock"],
  556. source: "anySatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns true for any element return true.\x0a\x09Otherwise return false.\x22\x0a\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^ true ] ].\x0a\x09^ false",
  557. referencedClasses: [],
  558. //>>excludeEnd("ide");
  559. pragmas: [],
  560. messageSends: ["do:", "ifTrue:", "value:"]
  561. }, function ($methodClass){ return function (aBlock){
  562. var self=this,$self=this;
  563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  564. return $core.withContext(function($ctx1) {
  565. //>>excludeEnd("ctx");
  566. var $early={};
  567. try {
  568. $self._do_((function(each){
  569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  570. return $core.withContext(function($ctx2) {
  571. //>>excludeEnd("ctx");
  572. if($core.assert($recv(aBlock)._value_(each))){
  573. throw $early=[true];
  574. }
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  577. //>>excludeEnd("ctx");
  578. }));
  579. return false;
  580. }
  581. catch(e) {if(e===$early)return e[0]; throw e}
  582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  583. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock})});
  584. //>>excludeEnd("ctx");
  585. }; }),
  586. $globals.Collection);
  587. $core.addMethod(
  588. $core.method({
  589. selector: "asArray",
  590. protocol: "converting",
  591. //>>excludeStart("ide", pragmas.excludeIdeData);
  592. args: [],
  593. source: "asArray\x0a\x09^ Array withAll: self",
  594. referencedClasses: ["Array"],
  595. //>>excludeEnd("ide");
  596. pragmas: [],
  597. messageSends: ["withAll:"]
  598. }, function ($methodClass){ return function (){
  599. var self=this,$self=this;
  600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  601. return $core.withContext(function($ctx1) {
  602. //>>excludeEnd("ctx");
  603. return $recv($globals.Array)._withAll_(self);
  604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  605. }, function($ctx1) {$ctx1.fill(self,"asArray",{})});
  606. //>>excludeEnd("ctx");
  607. }; }),
  608. $globals.Collection);
  609. $core.addMethod(
  610. $core.method({
  611. selector: "asJavaScriptObject",
  612. protocol: "converting",
  613. //>>excludeStart("ide", pragmas.excludeIdeData);
  614. args: [],
  615. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  616. referencedClasses: [],
  617. //>>excludeEnd("ide");
  618. pragmas: [],
  619. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  620. }, function ($methodClass){ return function (){
  621. var self=this,$self=this;
  622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  623. return $core.withContext(function($ctx1) {
  624. //>>excludeEnd("ctx");
  625. return $recv($self._asArray())._collect_((function(each){
  626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  627. return $core.withContext(function($ctx2) {
  628. //>>excludeEnd("ctx");
  629. return $recv(each)._asJavaScriptObject();
  630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  632. //>>excludeEnd("ctx");
  633. }));
  634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  635. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{})});
  636. //>>excludeEnd("ctx");
  637. }; }),
  638. $globals.Collection);
  639. $core.addMethod(
  640. $core.method({
  641. selector: "asOrderedCollection",
  642. protocol: "converting",
  643. //>>excludeStart("ide", pragmas.excludeIdeData);
  644. args: [],
  645. source: "asOrderedCollection\x0a\x09^ self asArray",
  646. referencedClasses: [],
  647. //>>excludeEnd("ide");
  648. pragmas: [],
  649. messageSends: ["asArray"]
  650. }, function ($methodClass){ return function (){
  651. var self=this,$self=this;
  652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  653. return $core.withContext(function($ctx1) {
  654. //>>excludeEnd("ctx");
  655. return $self._asArray();
  656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  657. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{})});
  658. //>>excludeEnd("ctx");
  659. }; }),
  660. $globals.Collection);
  661. $core.addMethod(
  662. $core.method({
  663. selector: "asSet",
  664. protocol: "converting",
  665. //>>excludeStart("ide", pragmas.excludeIdeData);
  666. args: [],
  667. source: "asSet\x0a\x09^ Set withAll: self",
  668. referencedClasses: ["Set"],
  669. //>>excludeEnd("ide");
  670. pragmas: [],
  671. messageSends: ["withAll:"]
  672. }, function ($methodClass){ return function (){
  673. var self=this,$self=this;
  674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  675. return $core.withContext(function($ctx1) {
  676. //>>excludeEnd("ctx");
  677. return $recv($globals.Set)._withAll_(self);
  678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  679. }, function($ctx1) {$ctx1.fill(self,"asSet",{})});
  680. //>>excludeEnd("ctx");
  681. }; }),
  682. $globals.Collection);
  683. $core.addMethod(
  684. $core.method({
  685. selector: "collect:",
  686. protocol: "enumerating",
  687. //>>excludeStart("ide", pragmas.excludeIdeData);
  688. args: ["aBlock"],
  689. source: "collect: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [ :each |\x0a\x09\x09stream nextPut: (aBlock value: each) ].\x0a\x09^ stream contents",
  690. referencedClasses: [],
  691. //>>excludeEnd("ide");
  692. pragmas: [],
  693. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  694. }, function ($methodClass){ return function (aBlock){
  695. var self=this,$self=this;
  696. var stream;
  697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  698. return $core.withContext(function($ctx1) {
  699. //>>excludeEnd("ctx");
  700. stream=$recv($recv($self._class())._new())._writeStream();
  701. $self._do_((function(each){
  702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  703. return $core.withContext(function($ctx2) {
  704. //>>excludeEnd("ctx");
  705. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  707. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  708. //>>excludeEnd("ctx");
  709. }));
  710. return $recv(stream)._contents();
  711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  712. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream})});
  713. //>>excludeEnd("ctx");
  714. }; }),
  715. $globals.Collection);
  716. $core.addMethod(
  717. $core.method({
  718. selector: "copyEmpty",
  719. protocol: "copying",
  720. //>>excludeStart("ide", pragmas.excludeIdeData);
  721. args: [],
  722. source: "copyEmpty\x0a\x09^ self class new",
  723. referencedClasses: [],
  724. //>>excludeEnd("ide");
  725. pragmas: [],
  726. messageSends: ["new", "class"]
  727. }, function ($methodClass){ return function (){
  728. var self=this,$self=this;
  729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  730. return $core.withContext(function($ctx1) {
  731. //>>excludeEnd("ctx");
  732. return $recv($self._class())._new();
  733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  734. }, function($ctx1) {$ctx1.fill(self,"copyEmpty",{})});
  735. //>>excludeEnd("ctx");
  736. }; }),
  737. $globals.Collection);
  738. $core.addMethod(
  739. $core.method({
  740. selector: "copyWith:",
  741. protocol: "copying",
  742. //>>excludeStart("ide", pragmas.excludeIdeData);
  743. args: ["anObject"],
  744. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  745. referencedClasses: [],
  746. //>>excludeEnd("ide");
  747. pragmas: [],
  748. messageSends: ["add:", "copy", "yourself"]
  749. }, function ($methodClass){ return function (anObject){
  750. var self=this,$self=this;
  751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  752. return $core.withContext(function($ctx1) {
  753. //>>excludeEnd("ctx");
  754. var $1;
  755. $1=$self._copy();
  756. $recv($1)._add_(anObject);
  757. return $recv($1)._yourself();
  758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  759. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  760. //>>excludeEnd("ctx");
  761. }; }),
  762. $globals.Collection);
  763. $core.addMethod(
  764. $core.method({
  765. selector: "copyWithAll:",
  766. protocol: "copying",
  767. //>>excludeStart("ide", pragmas.excludeIdeData);
  768. args: ["aCollection"],
  769. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  770. referencedClasses: [],
  771. //>>excludeEnd("ide");
  772. pragmas: [],
  773. messageSends: ["deprecatedAPI:", ","]
  774. }, function ($methodClass){ return function (aCollection){
  775. var self=this,$self=this;
  776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  777. return $core.withContext(function($ctx1) {
  778. //>>excludeEnd("ctx");
  779. $self._deprecatedAPI_("Use #, instead.");
  780. return $self.__comma(aCollection);
  781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  782. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  783. //>>excludeEnd("ctx");
  784. }; }),
  785. $globals.Collection);
  786. $core.addMethod(
  787. $core.method({
  788. selector: "copyWithout:",
  789. protocol: "copying",
  790. //>>excludeStart("ide", pragmas.excludeIdeData);
  791. args: ["anObject"],
  792. 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 ]",
  793. referencedClasses: [],
  794. //>>excludeEnd("ide");
  795. pragmas: [],
  796. messageSends: ["reject:", "="]
  797. }, function ($methodClass){ return function (anObject){
  798. var self=this,$self=this;
  799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  800. return $core.withContext(function($ctx1) {
  801. //>>excludeEnd("ctx");
  802. return $self._reject_((function(each){
  803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  804. return $core.withContext(function($ctx2) {
  805. //>>excludeEnd("ctx");
  806. return $recv(each).__eq(anObject);
  807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  809. //>>excludeEnd("ctx");
  810. }));
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  813. //>>excludeEnd("ctx");
  814. }; }),
  815. $globals.Collection);
  816. $core.addMethod(
  817. $core.method({
  818. selector: "copyWithoutAll:",
  819. protocol: "copying",
  820. //>>excludeStart("ide", pragmas.excludeIdeData);
  821. args: ["aCollection"],
  822. 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 ]",
  823. referencedClasses: [],
  824. //>>excludeEnd("ide");
  825. pragmas: [],
  826. messageSends: ["reject:", "includes:"]
  827. }, function ($methodClass){ return function (aCollection){
  828. var self=this,$self=this;
  829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  830. return $core.withContext(function($ctx1) {
  831. //>>excludeEnd("ctx");
  832. return $self._reject_((function(each){
  833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  834. return $core.withContext(function($ctx2) {
  835. //>>excludeEnd("ctx");
  836. return $recv(aCollection)._includes_(each);
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  839. //>>excludeEnd("ctx");
  840. }));
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  843. //>>excludeEnd("ctx");
  844. }; }),
  845. $globals.Collection);
  846. $core.addMethod(
  847. $core.method({
  848. selector: "deepCopy",
  849. protocol: "copying",
  850. //>>excludeStart("ide", pragmas.excludeIdeData);
  851. args: [],
  852. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  853. referencedClasses: [],
  854. //>>excludeEnd("ide");
  855. pragmas: [],
  856. messageSends: ["collect:", "deepCopy"]
  857. }, function ($methodClass){ return function (){
  858. var self=this,$self=this;
  859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  860. return $core.withContext(function($ctx1) {
  861. //>>excludeEnd("ctx");
  862. return $self._collect_((function(each){
  863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  864. return $core.withContext(function($ctx2) {
  865. //>>excludeEnd("ctx");
  866. return $recv(each)._deepCopy();
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  869. //>>excludeEnd("ctx");
  870. }));
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  873. //>>excludeEnd("ctx");
  874. }; }),
  875. $globals.Collection);
  876. $core.addMethod(
  877. $core.method({
  878. selector: "detect:",
  879. protocol: "enumerating",
  880. //>>excludeStart("ide", pragmas.excludeIdeData);
  881. args: ["aBlock"],
  882. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  883. referencedClasses: [],
  884. //>>excludeEnd("ide");
  885. pragmas: [],
  886. messageSends: ["detect:ifNone:", "errorNotFound"]
  887. }, function ($methodClass){ return function (aBlock){
  888. var self=this,$self=this;
  889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  890. return $core.withContext(function($ctx1) {
  891. //>>excludeEnd("ctx");
  892. return $self._detect_ifNone_(aBlock,(function(){
  893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  894. return $core.withContext(function($ctx2) {
  895. //>>excludeEnd("ctx");
  896. return $self._errorNotFound();
  897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  899. //>>excludeEnd("ctx");
  900. }));
  901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  902. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  903. //>>excludeEnd("ctx");
  904. }; }),
  905. $globals.Collection);
  906. $core.addMethod(
  907. $core.method({
  908. selector: "detect:ifNone:",
  909. protocol: "enumerating",
  910. //>>excludeStart("ide", pragmas.excludeIdeData);
  911. args: ["aBlock", "anotherBlock"],
  912. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  913. referencedClasses: [],
  914. //>>excludeEnd("ide");
  915. pragmas: [],
  916. messageSends: ["do:", "ifTrue:", "value:", "value"]
  917. }, function ($methodClass){ return function (aBlock,anotherBlock){
  918. var self=this,$self=this;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. return $core.withContext(function($ctx1) {
  921. //>>excludeEnd("ctx");
  922. var $early={};
  923. try {
  924. $self._do_((function(each){
  925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  926. return $core.withContext(function($ctx2) {
  927. //>>excludeEnd("ctx");
  928. if($core.assert($recv(aBlock)._value_(each))){
  929. throw $early=[each];
  930. }
  931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  933. //>>excludeEnd("ctx");
  934. }));
  935. return $recv(anotherBlock)._value();
  936. }
  937. catch(e) {if(e===$early)return e[0]; throw e}
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  940. //>>excludeEnd("ctx");
  941. }; }),
  942. $globals.Collection);
  943. $core.addMethod(
  944. $core.method({
  945. selector: "do:",
  946. protocol: "enumerating",
  947. //>>excludeStart("ide", pragmas.excludeIdeData);
  948. args: ["aBlock"],
  949. source: "do: aBlock\x0a\x09self subclassResponsibility",
  950. referencedClasses: [],
  951. //>>excludeEnd("ide");
  952. pragmas: [],
  953. messageSends: ["subclassResponsibility"]
  954. }, function ($methodClass){ return function (aBlock){
  955. var self=this,$self=this;
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. return $core.withContext(function($ctx1) {
  958. //>>excludeEnd("ctx");
  959. $self._subclassResponsibility();
  960. return self;
  961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  962. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  963. //>>excludeEnd("ctx");
  964. }; }),
  965. $globals.Collection);
  966. $core.addMethod(
  967. $core.method({
  968. selector: "do:separatedBy:",
  969. protocol: "enumerating",
  970. //>>excludeStart("ide", pragmas.excludeIdeData);
  971. args: ["aBlock", "anotherBlock"],
  972. 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 ]",
  973. referencedClasses: [],
  974. //>>excludeEnd("ide");
  975. pragmas: [],
  976. messageSends: ["do:", "value", "value:"]
  977. }, function ($methodClass){ return function (aBlock,anotherBlock){
  978. var self=this,$self=this;
  979. var actionBeforeElement;
  980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  981. return $core.withContext(function($ctx1) {
  982. //>>excludeEnd("ctx");
  983. actionBeforeElement=(function(){
  984. actionBeforeElement=anotherBlock;
  985. return actionBeforeElement;
  986. });
  987. $self._do_((function(each){
  988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  989. return $core.withContext(function($ctx2) {
  990. //>>excludeEnd("ctx");
  991. $recv(actionBeforeElement)._value();
  992. return $recv(aBlock)._value_(each);
  993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  994. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  995. //>>excludeEnd("ctx");
  996. }));
  997. return self;
  998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  999. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  1000. //>>excludeEnd("ctx");
  1001. }; }),
  1002. $globals.Collection);
  1003. $core.addMethod(
  1004. $core.method({
  1005. selector: "errorNotFound",
  1006. protocol: "error handling",
  1007. //>>excludeStart("ide", pragmas.excludeIdeData);
  1008. args: [],
  1009. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  1010. referencedClasses: [],
  1011. //>>excludeEnd("ide");
  1012. pragmas: [],
  1013. messageSends: ["error:"]
  1014. }, function ($methodClass){ return function (){
  1015. var self=this,$self=this;
  1016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1017. return $core.withContext(function($ctx1) {
  1018. //>>excludeEnd("ctx");
  1019. $self._error_("Object is not in the collection");
  1020. return self;
  1021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1022. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1023. //>>excludeEnd("ctx");
  1024. }; }),
  1025. $globals.Collection);
  1026. $core.addMethod(
  1027. $core.method({
  1028. selector: "ifEmpty:",
  1029. protocol: "testing",
  1030. //>>excludeStart("ide", pragmas.excludeIdeData);
  1031. args: ["aBlock"],
  1032. 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 ]",
  1033. referencedClasses: [],
  1034. //>>excludeEnd("ide");
  1035. pragmas: [],
  1036. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1037. }, function ($methodClass){ return function (aBlock){
  1038. var self=this,$self=this;
  1039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1040. return $core.withContext(function($ctx1) {
  1041. //>>excludeEnd("ctx");
  1042. if($core.assert($self._isEmpty())){
  1043. return $recv(aBlock)._value();
  1044. } else {
  1045. return self;
  1046. }
  1047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1048. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1049. //>>excludeEnd("ctx");
  1050. }; }),
  1051. $globals.Collection);
  1052. $core.addMethod(
  1053. $core.method({
  1054. selector: "ifEmpty:ifNotEmpty:",
  1055. protocol: "testing",
  1056. //>>excludeStart("ide", pragmas.excludeIdeData);
  1057. args: ["aBlock", "anotherBlock"],
  1058. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1059. referencedClasses: [],
  1060. //>>excludeEnd("ide");
  1061. pragmas: [],
  1062. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1063. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1064. var self=this,$self=this;
  1065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1066. return $core.withContext(function($ctx1) {
  1067. //>>excludeEnd("ctx");
  1068. if($core.assert($self._isEmpty())){
  1069. return $recv(aBlock)._value();
  1070. } else {
  1071. return $recv(anotherBlock)._value_(self);
  1072. }
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1075. //>>excludeEnd("ctx");
  1076. }; }),
  1077. $globals.Collection);
  1078. $core.addMethod(
  1079. $core.method({
  1080. selector: "ifNotEmpty:",
  1081. protocol: "testing",
  1082. //>>excludeStart("ide", pragmas.excludeIdeData);
  1083. args: ["aBlock"],
  1084. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1085. referencedClasses: [],
  1086. //>>excludeEnd("ide");
  1087. pragmas: [],
  1088. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1089. }, function ($methodClass){ return function (aBlock){
  1090. var self=this,$self=this;
  1091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1092. return $core.withContext(function($ctx1) {
  1093. //>>excludeEnd("ctx");
  1094. if($core.assert($self._notEmpty())){
  1095. return $recv(aBlock)._value_(self);
  1096. } else {
  1097. return self;
  1098. }
  1099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1100. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1101. //>>excludeEnd("ctx");
  1102. }; }),
  1103. $globals.Collection);
  1104. $core.addMethod(
  1105. $core.method({
  1106. selector: "ifNotEmpty:ifEmpty:",
  1107. protocol: "testing",
  1108. //>>excludeStart("ide", pragmas.excludeIdeData);
  1109. args: ["aBlock", "anotherBlock"],
  1110. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1111. referencedClasses: [],
  1112. //>>excludeEnd("ide");
  1113. pragmas: [],
  1114. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1115. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1116. var self=this,$self=this;
  1117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1118. return $core.withContext(function($ctx1) {
  1119. //>>excludeEnd("ctx");
  1120. if($core.assert($self._notEmpty())){
  1121. return $recv(aBlock)._value_(self);
  1122. } else {
  1123. return $recv(anotherBlock)._value();
  1124. }
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1127. //>>excludeEnd("ctx");
  1128. }; }),
  1129. $globals.Collection);
  1130. $core.addMethod(
  1131. $core.method({
  1132. selector: "includes:",
  1133. protocol: "testing",
  1134. //>>excludeStart("ide", pragmas.excludeIdeData);
  1135. args: ["anObject"],
  1136. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1137. referencedClasses: [],
  1138. //>>excludeEnd("ide");
  1139. pragmas: [],
  1140. messageSends: ["anySatisfy:", "="]
  1141. }, function ($methodClass){ return function (anObject){
  1142. var self=this,$self=this;
  1143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1144. return $core.withContext(function($ctx1) {
  1145. //>>excludeEnd("ctx");
  1146. return $self._anySatisfy_((function(each){
  1147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1148. return $core.withContext(function($ctx2) {
  1149. //>>excludeEnd("ctx");
  1150. return $recv(each).__eq(anObject);
  1151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1153. //>>excludeEnd("ctx");
  1154. }));
  1155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1156. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1157. //>>excludeEnd("ctx");
  1158. }; }),
  1159. $globals.Collection);
  1160. $core.addMethod(
  1161. $core.method({
  1162. selector: "inject:into:",
  1163. protocol: "enumerating",
  1164. //>>excludeStart("ide", pragmas.excludeIdeData);
  1165. args: ["anObject", "aBlock"],
  1166. 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",
  1167. referencedClasses: [],
  1168. //>>excludeEnd("ide");
  1169. pragmas: [],
  1170. messageSends: ["do:", "value:value:"]
  1171. }, function ($methodClass){ return function (anObject,aBlock){
  1172. var self=this,$self=this;
  1173. var result;
  1174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1175. return $core.withContext(function($ctx1) {
  1176. //>>excludeEnd("ctx");
  1177. result=anObject;
  1178. $self._do_((function(each){
  1179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1180. return $core.withContext(function($ctx2) {
  1181. //>>excludeEnd("ctx");
  1182. result=$recv(aBlock)._value_value_(result,each);
  1183. return result;
  1184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1185. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1186. //>>excludeEnd("ctx");
  1187. }));
  1188. return result;
  1189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1190. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1191. //>>excludeEnd("ctx");
  1192. }; }),
  1193. $globals.Collection);
  1194. $core.addMethod(
  1195. $core.method({
  1196. selector: "intersection:",
  1197. protocol: "enumerating",
  1198. //>>excludeStart("ide", pragmas.excludeIdeData);
  1199. args: ["aCollection"],
  1200. 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",
  1201. referencedClasses: ["Set"],
  1202. //>>excludeEnd("ide");
  1203. pragmas: [],
  1204. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1205. }, function ($methodClass){ return function (aCollection){
  1206. var self=this,$self=this;
  1207. var set,outputSet;
  1208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1209. return $core.withContext(function($ctx1) {
  1210. //>>excludeEnd("ctx");
  1211. set=$self._asSet();
  1212. outputSet=$recv($globals.Set)._new();
  1213. $recv(aCollection)._do_((function(each){
  1214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1215. return $core.withContext(function($ctx2) {
  1216. //>>excludeEnd("ctx");
  1217. if($core.assert($recv([$recv(set)._includes_(each)
  1218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1219. ,$ctx2.sendIdx["includes:"]=1
  1220. //>>excludeEnd("ctx");
  1221. ][0])._and_((function(){
  1222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1223. return $core.withContext(function($ctx3) {
  1224. //>>excludeEnd("ctx");
  1225. return $recv($recv(outputSet)._includes_(each))._not();
  1226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1227. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1228. //>>excludeEnd("ctx");
  1229. })))){
  1230. return $recv(outputSet)._add_(each);
  1231. }
  1232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1233. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1234. //>>excludeEnd("ctx");
  1235. }));
  1236. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1238. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1239. //>>excludeEnd("ctx");
  1240. }; }),
  1241. $globals.Collection);
  1242. $core.addMethod(
  1243. $core.method({
  1244. selector: "isEmpty",
  1245. protocol: "testing",
  1246. //>>excludeStart("ide", pragmas.excludeIdeData);
  1247. args: [],
  1248. source: "isEmpty\x0a\x09^ self size = 0",
  1249. referencedClasses: [],
  1250. //>>excludeEnd("ide");
  1251. pragmas: [],
  1252. messageSends: ["=", "size"]
  1253. }, function ($methodClass){ return function (){
  1254. var self=this,$self=this;
  1255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1256. return $core.withContext(function($ctx1) {
  1257. //>>excludeEnd("ctx");
  1258. return $recv($self._size()).__eq((0));
  1259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1260. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1261. //>>excludeEnd("ctx");
  1262. }; }),
  1263. $globals.Collection);
  1264. $core.addMethod(
  1265. $core.method({
  1266. selector: "noneSatisfy:",
  1267. protocol: "enumerating",
  1268. //>>excludeStart("ide", pragmas.excludeIdeData);
  1269. args: ["aBlock"],
  1270. 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",
  1271. referencedClasses: [],
  1272. //>>excludeEnd("ide");
  1273. pragmas: [],
  1274. messageSends: ["do:", "ifTrue:", "value:"]
  1275. }, function ($methodClass){ return function (aBlock){
  1276. var self=this,$self=this;
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. return $core.withContext(function($ctx1) {
  1279. //>>excludeEnd("ctx");
  1280. var $early={};
  1281. try {
  1282. $self._do_((function(item){
  1283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1284. return $core.withContext(function($ctx2) {
  1285. //>>excludeEnd("ctx");
  1286. if($core.assert($recv(aBlock)._value_(item))){
  1287. throw $early=[false];
  1288. }
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1291. //>>excludeEnd("ctx");
  1292. }));
  1293. return true;
  1294. }
  1295. catch(e) {if(e===$early)return e[0]; throw e}
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1298. //>>excludeEnd("ctx");
  1299. }; }),
  1300. $globals.Collection);
  1301. $core.addMethod(
  1302. $core.method({
  1303. selector: "notEmpty",
  1304. protocol: "testing",
  1305. //>>excludeStart("ide", pragmas.excludeIdeData);
  1306. args: [],
  1307. source: "notEmpty\x0a\x09^ self isEmpty not",
  1308. referencedClasses: [],
  1309. //>>excludeEnd("ide");
  1310. pragmas: [],
  1311. messageSends: ["not", "isEmpty"]
  1312. }, function ($methodClass){ return function (){
  1313. var self=this,$self=this;
  1314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1315. return $core.withContext(function($ctx1) {
  1316. //>>excludeEnd("ctx");
  1317. return $recv($self._isEmpty())._not();
  1318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1319. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1320. //>>excludeEnd("ctx");
  1321. }; }),
  1322. $globals.Collection);
  1323. $core.addMethod(
  1324. $core.method({
  1325. selector: "occurrencesOf:",
  1326. protocol: "accessing",
  1327. //>>excludeStart("ide", pragmas.excludeIdeData);
  1328. args: ["anObject"],
  1329. 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",
  1330. referencedClasses: [],
  1331. //>>excludeEnd("ide");
  1332. pragmas: [],
  1333. messageSends: ["do:", "ifTrue:", "=", "+"]
  1334. }, function ($methodClass){ return function (anObject){
  1335. var self=this,$self=this;
  1336. var tally;
  1337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1338. return $core.withContext(function($ctx1) {
  1339. //>>excludeEnd("ctx");
  1340. tally=(0);
  1341. $self._do_((function(each){
  1342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1343. return $core.withContext(function($ctx2) {
  1344. //>>excludeEnd("ctx");
  1345. if($core.assert($recv(anObject).__eq(each))){
  1346. tally=$recv(tally).__plus((1));
  1347. return tally;
  1348. }
  1349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1351. //>>excludeEnd("ctx");
  1352. }));
  1353. return tally;
  1354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1355. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1356. //>>excludeEnd("ctx");
  1357. }; }),
  1358. $globals.Collection);
  1359. $core.addMethod(
  1360. $core.method({
  1361. selector: "putOn:",
  1362. protocol: "streaming",
  1363. //>>excludeStart("ide", pragmas.excludeIdeData);
  1364. args: ["aStream"],
  1365. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1366. referencedClasses: [],
  1367. //>>excludeEnd("ide");
  1368. pragmas: [],
  1369. messageSends: ["do:", "putOn:"]
  1370. }, function ($methodClass){ return function (aStream){
  1371. var self=this,$self=this;
  1372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1373. return $core.withContext(function($ctx1) {
  1374. //>>excludeEnd("ctx");
  1375. $self._do_((function(each){
  1376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1377. return $core.withContext(function($ctx2) {
  1378. //>>excludeEnd("ctx");
  1379. return $recv(each)._putOn_(aStream);
  1380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1381. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1382. //>>excludeEnd("ctx");
  1383. }));
  1384. return self;
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1387. //>>excludeEnd("ctx");
  1388. }; }),
  1389. $globals.Collection);
  1390. $core.addMethod(
  1391. $core.method({
  1392. selector: "reject:",
  1393. protocol: "enumerating",
  1394. //>>excludeStart("ide", pragmas.excludeIdeData);
  1395. args: ["aBlock"],
  1396. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1397. referencedClasses: [],
  1398. //>>excludeEnd("ide");
  1399. pragmas: [],
  1400. messageSends: ["select:", "=", "value:"]
  1401. }, function ($methodClass){ return function (aBlock){
  1402. var self=this,$self=this;
  1403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1404. return $core.withContext(function($ctx1) {
  1405. //>>excludeEnd("ctx");
  1406. return $self._select_((function(each){
  1407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1408. return $core.withContext(function($ctx2) {
  1409. //>>excludeEnd("ctx");
  1410. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1413. //>>excludeEnd("ctx");
  1414. }));
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1417. //>>excludeEnd("ctx");
  1418. }; }),
  1419. $globals.Collection);
  1420. $core.addMethod(
  1421. $core.method({
  1422. selector: "remove:",
  1423. protocol: "adding/removing",
  1424. //>>excludeStart("ide", pragmas.excludeIdeData);
  1425. args: ["anObject"],
  1426. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1427. referencedClasses: [],
  1428. //>>excludeEnd("ide");
  1429. pragmas: [],
  1430. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1431. }, function ($methodClass){ return function (anObject){
  1432. var self=this,$self=this;
  1433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1434. return $core.withContext(function($ctx1) {
  1435. //>>excludeEnd("ctx");
  1436. return $self._remove_ifAbsent_(anObject,(function(){
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. return $core.withContext(function($ctx2) {
  1439. //>>excludeEnd("ctx");
  1440. return $self._errorNotFound();
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1443. //>>excludeEnd("ctx");
  1444. }));
  1445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1446. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1447. //>>excludeEnd("ctx");
  1448. }; }),
  1449. $globals.Collection);
  1450. $core.addMethod(
  1451. $core.method({
  1452. selector: "remove:ifAbsent:",
  1453. protocol: "adding/removing",
  1454. //>>excludeStart("ide", pragmas.excludeIdeData);
  1455. args: ["anObject", "aBlock"],
  1456. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1457. referencedClasses: [],
  1458. //>>excludeEnd("ide");
  1459. pragmas: [],
  1460. messageSends: ["subclassResponsibility"]
  1461. }, function ($methodClass){ return function (anObject,aBlock){
  1462. var self=this,$self=this;
  1463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1464. return $core.withContext(function($ctx1) {
  1465. //>>excludeEnd("ctx");
  1466. $self._subclassResponsibility();
  1467. return self;
  1468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1469. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1470. //>>excludeEnd("ctx");
  1471. }; }),
  1472. $globals.Collection);
  1473. $core.addMethod(
  1474. $core.method({
  1475. selector: "removeAll",
  1476. protocol: "adding/removing",
  1477. //>>excludeStart("ide", pragmas.excludeIdeData);
  1478. args: [],
  1479. source: "removeAll\x0a\x09self subclassResponsibility",
  1480. referencedClasses: [],
  1481. //>>excludeEnd("ide");
  1482. pragmas: [],
  1483. messageSends: ["subclassResponsibility"]
  1484. }, function ($methodClass){ return function (){
  1485. var self=this,$self=this;
  1486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1487. return $core.withContext(function($ctx1) {
  1488. //>>excludeEnd("ctx");
  1489. $self._subclassResponsibility();
  1490. return self;
  1491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1492. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1493. //>>excludeEnd("ctx");
  1494. }; }),
  1495. $globals.Collection);
  1496. $core.addMethod(
  1497. $core.method({
  1498. selector: "select:",
  1499. protocol: "enumerating",
  1500. //>>excludeStart("ide", pragmas.excludeIdeData);
  1501. args: ["aBlock"],
  1502. 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",
  1503. referencedClasses: [],
  1504. //>>excludeEnd("ide");
  1505. pragmas: [],
  1506. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1507. }, function ($methodClass){ return function (aBlock){
  1508. var self=this,$self=this;
  1509. var stream;
  1510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1511. return $core.withContext(function($ctx1) {
  1512. //>>excludeEnd("ctx");
  1513. stream=$recv($recv($self._class())._new())._writeStream();
  1514. $self._do_((function(each){
  1515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1516. return $core.withContext(function($ctx2) {
  1517. //>>excludeEnd("ctx");
  1518. if($core.assert($recv(aBlock)._value_(each))){
  1519. return $recv(stream)._nextPut_(each);
  1520. }
  1521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1522. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1523. //>>excludeEnd("ctx");
  1524. }));
  1525. return $recv(stream)._contents();
  1526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1527. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1528. //>>excludeEnd("ctx");
  1529. }; }),
  1530. $globals.Collection);
  1531. $core.addMethod(
  1532. $core.method({
  1533. selector: "select:thenCollect:",
  1534. protocol: "enumerating",
  1535. //>>excludeStart("ide", pragmas.excludeIdeData);
  1536. args: ["selectBlock", "collectBlock"],
  1537. 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",
  1538. referencedClasses: [],
  1539. //>>excludeEnd("ide");
  1540. pragmas: [],
  1541. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1542. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1543. var self=this,$self=this;
  1544. var stream;
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. return $core.withContext(function($ctx1) {
  1547. //>>excludeEnd("ctx");
  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. if($core.assert([$recv(selectBlock)._value_(each)
  1554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1555. ,$ctx2.sendIdx["value:"]=1
  1556. //>>excludeEnd("ctx");
  1557. ][0])){
  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. $self._ifEmpty_((function(){
  1611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1612. return $core.withContext(function($ctx2) {
  1613. //>>excludeEnd("ctx");
  1614. return [$self._error_("Collection is empty")
  1615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1616. ,$ctx2.sendIdx["error:"]=1
  1617. //>>excludeEnd("ctx");
  1618. ][0];
  1619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1621. //>>excludeEnd("ctx");
  1622. }));
  1623. if($core.assert($recv($self._size()).__gt((1)))){
  1624. $self._error_("Collection holds more than one element");
  1625. }
  1626. return $self._anyOne();
  1627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1628. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1629. //>>excludeEnd("ctx");
  1630. }; }),
  1631. $globals.Collection);
  1632. $core.addMethod(
  1633. $core.method({
  1634. selector: "size",
  1635. protocol: "accessing",
  1636. //>>excludeStart("ide", pragmas.excludeIdeData);
  1637. args: [],
  1638. source: "size\x0a\x09self subclassResponsibility",
  1639. referencedClasses: [],
  1640. //>>excludeEnd("ide");
  1641. pragmas: [],
  1642. messageSends: ["subclassResponsibility"]
  1643. }, function ($methodClass){ return function (){
  1644. var self=this,$self=this;
  1645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1646. return $core.withContext(function($ctx1) {
  1647. //>>excludeEnd("ctx");
  1648. $self._subclassResponsibility();
  1649. return self;
  1650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1651. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1652. //>>excludeEnd("ctx");
  1653. }; }),
  1654. $globals.Collection);
  1655. $core.addMethod(
  1656. $core.method({
  1657. selector: "classTag",
  1658. protocol: "accessing",
  1659. //>>excludeStart("ide", pragmas.excludeIdeData);
  1660. args: [],
  1661. 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'",
  1662. referencedClasses: [],
  1663. //>>excludeEnd("ide");
  1664. pragmas: [],
  1665. messageSends: []
  1666. }, function ($methodClass){ return function (){
  1667. var self=this,$self=this;
  1668. return "collection";
  1669. }; }),
  1670. $globals.Collection.a$cls);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "new:",
  1674. protocol: "instance creation",
  1675. //>>excludeStart("ide", pragmas.excludeIdeData);
  1676. args: ["anInteger"],
  1677. source: "new: anInteger\x0a\x09^ self new",
  1678. referencedClasses: [],
  1679. //>>excludeEnd("ide");
  1680. pragmas: [],
  1681. messageSends: ["new"]
  1682. }, function ($methodClass){ return function (anInteger){
  1683. var self=this,$self=this;
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. return $core.withContext(function($ctx1) {
  1686. //>>excludeEnd("ctx");
  1687. return $self._new();
  1688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1689. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1690. //>>excludeEnd("ctx");
  1691. }; }),
  1692. $globals.Collection.a$cls);
  1693. $core.addMethod(
  1694. $core.method({
  1695. selector: "with:",
  1696. protocol: "instance creation",
  1697. //>>excludeStart("ide", pragmas.excludeIdeData);
  1698. args: ["anObject"],
  1699. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1700. referencedClasses: [],
  1701. //>>excludeEnd("ide");
  1702. pragmas: [],
  1703. messageSends: ["add:", "new", "yourself"]
  1704. }, function ($methodClass){ return function (anObject){
  1705. var self=this,$self=this;
  1706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1707. return $core.withContext(function($ctx1) {
  1708. //>>excludeEnd("ctx");
  1709. var $1;
  1710. $1=$self._new();
  1711. $recv($1)._add_(anObject);
  1712. return $recv($1)._yourself();
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1715. //>>excludeEnd("ctx");
  1716. }; }),
  1717. $globals.Collection.a$cls);
  1718. $core.addMethod(
  1719. $core.method({
  1720. selector: "with:with:",
  1721. protocol: "instance creation",
  1722. //>>excludeStart("ide", pragmas.excludeIdeData);
  1723. args: ["anObject", "anotherObject"],
  1724. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1725. referencedClasses: [],
  1726. //>>excludeEnd("ide");
  1727. pragmas: [],
  1728. messageSends: ["add:", "new", "yourself"]
  1729. }, function ($methodClass){ return function (anObject,anotherObject){
  1730. var self=this,$self=this;
  1731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1732. return $core.withContext(function($ctx1) {
  1733. //>>excludeEnd("ctx");
  1734. var $1;
  1735. $1=$self._new();
  1736. [$recv($1)._add_(anObject)
  1737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1738. ,$ctx1.sendIdx["add:"]=1
  1739. //>>excludeEnd("ctx");
  1740. ][0];
  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. ][0];
  1771. [$recv($1)._add_(secondObject)
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. ,$ctx1.sendIdx["add:"]=2
  1774. //>>excludeEnd("ctx");
  1775. ][0];
  1776. $recv($1)._add_(thirdObject);
  1777. return $recv($1)._yourself();
  1778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1779. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1780. //>>excludeEnd("ctx");
  1781. }; }),
  1782. $globals.Collection.a$cls);
  1783. $core.addMethod(
  1784. $core.method({
  1785. selector: "withAll:",
  1786. protocol: "instance creation",
  1787. //>>excludeStart("ide", pragmas.excludeIdeData);
  1788. args: ["aCollection"],
  1789. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1790. referencedClasses: [],
  1791. //>>excludeEnd("ide");
  1792. pragmas: [],
  1793. messageSends: ["addAll:", "new", "yourself"]
  1794. }, function ($methodClass){ return function (aCollection){
  1795. var self=this,$self=this;
  1796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1797. return $core.withContext(function($ctx1) {
  1798. //>>excludeEnd("ctx");
  1799. var $1;
  1800. $1=$self._new();
  1801. $recv($1)._addAll_(aCollection);
  1802. return $recv($1)._yourself();
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1805. //>>excludeEnd("ctx");
  1806. }; }),
  1807. $globals.Collection.a$cls);
  1808. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1809. //>>excludeStart("ide", pragmas.excludeIdeData);
  1810. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1811. //>>excludeEnd("ide");
  1812. $core.addMethod(
  1813. $core.method({
  1814. selector: "=",
  1815. protocol: "comparing",
  1816. //>>excludeStart("ide", pragmas.excludeIdeData);
  1817. args: ["anAssocitativeCollection"],
  1818. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1819. referencedClasses: [],
  1820. //>>excludeEnd("ide");
  1821. pragmas: [],
  1822. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1823. }, function ($methodClass){ return function (anAssocitativeCollection){
  1824. var self=this,$self=this;
  1825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1826. return $core.withContext(function($ctx1) {
  1827. //>>excludeEnd("ctx");
  1828. if(!$core.assert([$recv([$self._class()
  1829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1830. ,$ctx1.sendIdx["class"]=1
  1831. //>>excludeEnd("ctx");
  1832. ][0]).__eq($recv(anAssocitativeCollection)._class())
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. ,$ctx1.sendIdx["="]=1
  1835. //>>excludeEnd("ctx");
  1836. ][0])){
  1837. return false;
  1838. }
  1839. if(!$core.assert([$recv([$self._size()
  1840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1841. ,$ctx1.sendIdx["size"]=1
  1842. //>>excludeEnd("ctx");
  1843. ][0]).__eq($recv(anAssocitativeCollection)._size())
  1844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1845. ,$ctx1.sendIdx["="]=2
  1846. //>>excludeEnd("ctx");
  1847. ][0])){
  1848. return false;
  1849. }
  1850. return $recv([$self._associations()
  1851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1852. ,$ctx1.sendIdx["associations"]=1
  1853. //>>excludeEnd("ctx");
  1854. ][0]).__eq($recv(anAssocitativeCollection)._associations());
  1855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1856. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1857. //>>excludeEnd("ctx");
  1858. }; }),
  1859. $globals.AssociativeCollection);
  1860. $core.addMethod(
  1861. $core.method({
  1862. selector: "add:",
  1863. protocol: "adding/removing",
  1864. //>>excludeStart("ide", pragmas.excludeIdeData);
  1865. args: ["anAssociation"],
  1866. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1867. referencedClasses: [],
  1868. //>>excludeEnd("ide");
  1869. pragmas: [],
  1870. messageSends: ["at:put:", "key", "value"]
  1871. }, function ($methodClass){ return function (anAssociation){
  1872. var self=this,$self=this;
  1873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1874. return $core.withContext(function($ctx1) {
  1875. //>>excludeEnd("ctx");
  1876. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1877. return self;
  1878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1879. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1880. //>>excludeEnd("ctx");
  1881. }; }),
  1882. $globals.AssociativeCollection);
  1883. $core.addMethod(
  1884. $core.method({
  1885. selector: "addAll:",
  1886. protocol: "adding/removing",
  1887. //>>excludeStart("ide", pragmas.excludeIdeData);
  1888. args: ["anAssociativeCollection"],
  1889. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1890. referencedClasses: [],
  1891. //>>excludeEnd("ide");
  1892. pragmas: [],
  1893. messageSends: ["addAll:", "associations"]
  1894. }, function ($methodClass){ return function (anAssociativeCollection){
  1895. var self=this,$self=this;
  1896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1897. return $core.withContext(function($ctx1) {
  1898. //>>excludeEnd("ctx");
  1899. [(
  1900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1901. $ctx1.supercall = true,
  1902. //>>excludeEnd("ctx");
  1903. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1905. ,$ctx1.supercall = false
  1906. //>>excludeEnd("ctx");
  1907. ][0];
  1908. return anAssociativeCollection;
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1911. //>>excludeEnd("ctx");
  1912. }; }),
  1913. $globals.AssociativeCollection);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "asDictionary",
  1917. protocol: "converting",
  1918. //>>excludeStart("ide", pragmas.excludeIdeData);
  1919. args: [],
  1920. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1921. referencedClasses: ["Dictionary"],
  1922. //>>excludeEnd("ide");
  1923. pragmas: [],
  1924. messageSends: ["from:", "associations"]
  1925. }, function ($methodClass){ return function (){
  1926. var self=this,$self=this;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. return $core.withContext(function($ctx1) {
  1929. //>>excludeEnd("ctx");
  1930. return $recv($globals.Dictionary)._from_($self._associations());
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1933. //>>excludeEnd("ctx");
  1934. }; }),
  1935. $globals.AssociativeCollection);
  1936. $core.addMethod(
  1937. $core.method({
  1938. selector: "asHashedCollection",
  1939. protocol: "converting",
  1940. //>>excludeStart("ide", pragmas.excludeIdeData);
  1941. args: [],
  1942. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1943. referencedClasses: ["HashedCollection"],
  1944. //>>excludeEnd("ide");
  1945. pragmas: [],
  1946. messageSends: ["from:", "associations"]
  1947. }, function ($methodClass){ return function (){
  1948. var self=this,$self=this;
  1949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1950. return $core.withContext(function($ctx1) {
  1951. //>>excludeEnd("ctx");
  1952. return $recv($globals.HashedCollection)._from_($self._associations());
  1953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1954. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1955. //>>excludeEnd("ctx");
  1956. }; }),
  1957. $globals.AssociativeCollection);
  1958. $core.addMethod(
  1959. $core.method({
  1960. selector: "asJavaScriptObject",
  1961. protocol: "converting",
  1962. //>>excludeStart("ide", pragmas.excludeIdeData);
  1963. args: [],
  1964. 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",
  1965. referencedClasses: ["HashedCollection"],
  1966. //>>excludeEnd("ide");
  1967. pragmas: [],
  1968. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1969. }, function ($methodClass){ return function (){
  1970. var self=this,$self=this;
  1971. var hash;
  1972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1973. return $core.withContext(function($ctx1) {
  1974. //>>excludeEnd("ctx");
  1975. hash=$recv($globals.HashedCollection)._new();
  1976. $self._keysAndValuesDo_((function(key,value){
  1977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1978. return $core.withContext(function($ctx2) {
  1979. //>>excludeEnd("ctx");
  1980. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1982. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1983. //>>excludeEnd("ctx");
  1984. }));
  1985. return hash;
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1988. //>>excludeEnd("ctx");
  1989. }; }),
  1990. $globals.AssociativeCollection);
  1991. $core.addMethod(
  1992. $core.method({
  1993. selector: "associations",
  1994. protocol: "accessing",
  1995. //>>excludeStart("ide", pragmas.excludeIdeData);
  1996. args: [],
  1997. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1998. referencedClasses: [],
  1999. //>>excludeEnd("ide");
  2000. pragmas: [],
  2001. messageSends: ["associationsDo:", "add:"]
  2002. }, function ($methodClass){ return function (){
  2003. var self=this,$self=this;
  2004. var associations;
  2005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2006. return $core.withContext(function($ctx1) {
  2007. //>>excludeEnd("ctx");
  2008. associations=[];
  2009. $self._associationsDo_((function(each){
  2010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2011. return $core.withContext(function($ctx2) {
  2012. //>>excludeEnd("ctx");
  2013. return $recv(associations)._add_(each);
  2014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2016. //>>excludeEnd("ctx");
  2017. }));
  2018. return associations;
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  2021. //>>excludeEnd("ctx");
  2022. }; }),
  2023. $globals.AssociativeCollection);
  2024. $core.addMethod(
  2025. $core.method({
  2026. selector: "associationsDo:",
  2027. protocol: "enumerating",
  2028. //>>excludeStart("ide", pragmas.excludeIdeData);
  2029. args: ["aBlock"],
  2030. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2031. referencedClasses: ["Association"],
  2032. //>>excludeEnd("ide");
  2033. pragmas: [],
  2034. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2035. }, function ($methodClass){ return function (aBlock){
  2036. var self=this,$self=this;
  2037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2038. return $core.withContext(function($ctx1) {
  2039. //>>excludeEnd("ctx");
  2040. $self._keysAndValuesDo_((function(key,value){
  2041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2042. return $core.withContext(function($ctx2) {
  2043. //>>excludeEnd("ctx");
  2044. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2046. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2047. //>>excludeEnd("ctx");
  2048. }));
  2049. return self;
  2050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2051. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2052. //>>excludeEnd("ctx");
  2053. }; }),
  2054. $globals.AssociativeCollection);
  2055. $core.addMethod(
  2056. $core.method({
  2057. selector: "at:ifPresent:ifAbsent:",
  2058. protocol: "accessing",
  2059. //>>excludeStart("ide", pragmas.excludeIdeData);
  2060. args: ["aKey", "aBlock", "anotherBlock"],
  2061. 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 ]",
  2062. referencedClasses: [],
  2063. //>>excludeEnd("ide");
  2064. pragmas: [],
  2065. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2066. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2067. var self=this,$self=this;
  2068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2069. return $core.withContext(function($ctx1) {
  2070. //>>excludeEnd("ctx");
  2071. if($core.assert($self._includesKey_(aKey))){
  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.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2419. //>>excludeEnd("ctx");
  2420. ][0];
  2421. [$recv(aStream)._nextPutAll_(" (")
  2422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2423. ,$ctx1.sendIdx["nextPutAll:"]=1
  2424. //>>excludeEnd("ctx");
  2425. ][0];
  2426. $recv($self._associations())._do_separatedBy_((function(each){
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. return $core.withContext(function($ctx2) {
  2429. //>>excludeEnd("ctx");
  2430. return $recv(each)._printOn_(aStream);
  2431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2432. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2433. //>>excludeEnd("ctx");
  2434. }),(function(){
  2435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2436. return $core.withContext(function($ctx2) {
  2437. //>>excludeEnd("ctx");
  2438. return [$recv(aStream)._nextPutAll_(" , ")
  2439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2440. ,$ctx2.sendIdx["nextPutAll:"]=2
  2441. //>>excludeEnd("ctx");
  2442. ][0];
  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. newDict=$recv($self._class())._new();
  2569. $self._keysAndValuesDo_((function(key,value){
  2570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2571. return $core.withContext(function($ctx2) {
  2572. //>>excludeEnd("ctx");
  2573. if($core.assert($recv(aBlock)._value_(value))){
  2574. return $recv(newDict)._at_put_(key,value);
  2575. }
  2576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2577. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2578. //>>excludeEnd("ctx");
  2579. }));
  2580. return newDict;
  2581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2582. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2583. //>>excludeEnd("ctx");
  2584. }; }),
  2585. $globals.AssociativeCollection);
  2586. $core.addMethod(
  2587. $core.method({
  2588. selector: "select:thenCollect:",
  2589. protocol: "enumerating",
  2590. //>>excludeStart("ide", pragmas.excludeIdeData);
  2591. args: ["selectBlock", "collectBlock"],
  2592. 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",
  2593. referencedClasses: [],
  2594. //>>excludeEnd("ide");
  2595. pragmas: [],
  2596. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2597. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2598. var self=this,$self=this;
  2599. var newDict;
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. return $core.withContext(function($ctx1) {
  2602. //>>excludeEnd("ctx");
  2603. newDict=$recv($self._class())._new();
  2604. $self._keysAndValuesDo_((function(key,value){
  2605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2606. return $core.withContext(function($ctx2) {
  2607. //>>excludeEnd("ctx");
  2608. if($core.assert([$recv(selectBlock)._value_(value)
  2609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2610. ,$ctx2.sendIdx["value:"]=1
  2611. //>>excludeEnd("ctx");
  2612. ][0])){
  2613. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2614. }
  2615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2616. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2617. //>>excludeEnd("ctx");
  2618. }));
  2619. return newDict;
  2620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2621. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2622. //>>excludeEnd("ctx");
  2623. }; }),
  2624. $globals.AssociativeCollection);
  2625. $core.addMethod(
  2626. $core.method({
  2627. selector: "shallowCopy",
  2628. protocol: "copying",
  2629. //>>excludeStart("ide", pragmas.excludeIdeData);
  2630. args: [],
  2631. 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",
  2632. referencedClasses: [],
  2633. //>>excludeEnd("ide");
  2634. pragmas: [],
  2635. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2636. }, function ($methodClass){ return function (){
  2637. var self=this,$self=this;
  2638. var copy;
  2639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2640. return $core.withContext(function($ctx1) {
  2641. //>>excludeEnd("ctx");
  2642. copy=$recv($self._class())._new();
  2643. $self._keysAndValuesDo_((function(key,value){
  2644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2645. return $core.withContext(function($ctx2) {
  2646. //>>excludeEnd("ctx");
  2647. return $recv(copy)._at_put_(key,value);
  2648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2649. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2650. //>>excludeEnd("ctx");
  2651. }));
  2652. return copy;
  2653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2654. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2655. //>>excludeEnd("ctx");
  2656. }; }),
  2657. $globals.AssociativeCollection);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "size",
  2661. protocol: "accessing",
  2662. //>>excludeStart("ide", pragmas.excludeIdeData);
  2663. args: [],
  2664. source: "size\x0a\x09^ self keys size",
  2665. referencedClasses: [],
  2666. //>>excludeEnd("ide");
  2667. pragmas: [],
  2668. messageSends: ["size", "keys"]
  2669. }, function ($methodClass){ return function (){
  2670. var self=this,$self=this;
  2671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2672. return $core.withContext(function($ctx1) {
  2673. //>>excludeEnd("ctx");
  2674. return $recv($self._keys())._size();
  2675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2676. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2677. //>>excludeEnd("ctx");
  2678. }; }),
  2679. $globals.AssociativeCollection);
  2680. $core.addMethod(
  2681. $core.method({
  2682. selector: "values",
  2683. protocol: "accessing",
  2684. //>>excludeStart("ide", pragmas.excludeIdeData);
  2685. args: [],
  2686. source: "values\x0a\x09self subclassResponsibility",
  2687. referencedClasses: [],
  2688. //>>excludeEnd("ide");
  2689. pragmas: [],
  2690. messageSends: ["subclassResponsibility"]
  2691. }, function ($methodClass){ return function (){
  2692. var self=this,$self=this;
  2693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2694. return $core.withContext(function($ctx1) {
  2695. //>>excludeEnd("ctx");
  2696. $self._subclassResponsibility();
  2697. return self;
  2698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2699. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2700. //>>excludeEnd("ctx");
  2701. }; }),
  2702. $globals.AssociativeCollection);
  2703. $core.addMethod(
  2704. $core.method({
  2705. selector: "valuesDo:",
  2706. protocol: "enumerating",
  2707. //>>excludeStart("ide", pragmas.excludeIdeData);
  2708. args: ["aBlock"],
  2709. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2710. referencedClasses: [],
  2711. //>>excludeEnd("ide");
  2712. pragmas: [],
  2713. messageSends: ["subclassResponsibility"]
  2714. }, function ($methodClass){ return function (aBlock){
  2715. var self=this,$self=this;
  2716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2717. return $core.withContext(function($ctx1) {
  2718. //>>excludeEnd("ctx");
  2719. $self._subclassResponsibility();
  2720. return self;
  2721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2722. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2723. //>>excludeEnd("ctx");
  2724. }; }),
  2725. $globals.AssociativeCollection);
  2726. $core.addMethod(
  2727. $core.method({
  2728. selector: "withIndexDo:",
  2729. protocol: "enumerating",
  2730. //>>excludeStart("ide", pragmas.excludeIdeData);
  2731. args: ["aBlock"],
  2732. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2733. referencedClasses: [],
  2734. //>>excludeEnd("ide");
  2735. pragmas: [],
  2736. messageSends: ["keysAndValuesDo:", "value:value:"]
  2737. }, function ($methodClass){ return function (aBlock){
  2738. var self=this,$self=this;
  2739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2740. return $core.withContext(function($ctx1) {
  2741. //>>excludeEnd("ctx");
  2742. $self._keysAndValuesDo_((function(key,value){
  2743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2744. return $core.withContext(function($ctx2) {
  2745. //>>excludeEnd("ctx");
  2746. return $recv(aBlock)._value_value_(value,key);
  2747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2748. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2749. //>>excludeEnd("ctx");
  2750. }));
  2751. return self;
  2752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2753. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2754. //>>excludeEnd("ctx");
  2755. }; }),
  2756. $globals.AssociativeCollection);
  2757. $core.addMethod(
  2758. $core.method({
  2759. selector: "from:",
  2760. protocol: "instance creation",
  2761. //>>excludeStart("ide", pragmas.excludeIdeData);
  2762. args: ["aCollection"],
  2763. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2764. referencedClasses: [],
  2765. //>>excludeEnd("ide");
  2766. pragmas: [],
  2767. messageSends: ["new", "do:", "add:"]
  2768. }, function ($methodClass){ return function (aCollection){
  2769. var self=this,$self=this;
  2770. var newCollection;
  2771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2772. return $core.withContext(function($ctx1) {
  2773. //>>excludeEnd("ctx");
  2774. newCollection=$self._new();
  2775. $recv(aCollection)._do_((function(each){
  2776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2777. return $core.withContext(function($ctx2) {
  2778. //>>excludeEnd("ctx");
  2779. return $recv(newCollection)._add_(each);
  2780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2782. //>>excludeEnd("ctx");
  2783. }));
  2784. return newCollection;
  2785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2786. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2787. //>>excludeEnd("ctx");
  2788. }; }),
  2789. $globals.AssociativeCollection.a$cls);
  2790. $core.addMethod(
  2791. $core.method({
  2792. selector: "fromPairs:",
  2793. protocol: "instance creation",
  2794. //>>excludeStart("ide", pragmas.excludeIdeData);
  2795. args: ["aCollection"],
  2796. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2797. referencedClasses: [],
  2798. //>>excludeEnd("ide");
  2799. pragmas: [],
  2800. messageSends: ["from:"]
  2801. }, function ($methodClass){ return function (aCollection){
  2802. var self=this,$self=this;
  2803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2804. return $core.withContext(function($ctx1) {
  2805. //>>excludeEnd("ctx");
  2806. return $self._from_(aCollection);
  2807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2808. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2809. //>>excludeEnd("ctx");
  2810. }; }),
  2811. $globals.AssociativeCollection.a$cls);
  2812. $core.addMethod(
  2813. $core.method({
  2814. selector: "newFromPairs:",
  2815. protocol: "instance creation",
  2816. //>>excludeStart("ide", pragmas.excludeIdeData);
  2817. args: ["aCollection"],
  2818. 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",
  2819. referencedClasses: [],
  2820. //>>excludeEnd("ide");
  2821. pragmas: [],
  2822. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2823. }, function ($methodClass){ return function (aCollection){
  2824. var self=this,$self=this;
  2825. var newCollection;
  2826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2827. return $core.withContext(function($ctx1) {
  2828. //>>excludeEnd("ctx");
  2829. if(!$core.assert($recv([$recv(aCollection)._size()
  2830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2831. ,$ctx1.sendIdx["size"]=1
  2832. //>>excludeEnd("ctx");
  2833. ][0])._even())){
  2834. $self._error_("#newFromPairs only accepts arrays of an even length");
  2835. }
  2836. newCollection=$self._new();
  2837. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2839. return $core.withContext(function($ctx2) {
  2840. //>>excludeEnd("ctx");
  2841. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2843. ,$ctx2.sendIdx["at:"]=1
  2844. //>>excludeEnd("ctx");
  2845. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2847. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2848. //>>excludeEnd("ctx");
  2849. }));
  2850. return newCollection;
  2851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2852. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2853. //>>excludeEnd("ctx");
  2854. }; }),
  2855. $globals.AssociativeCollection.a$cls);
  2856. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2857. //>>excludeStart("ide", pragmas.excludeIdeData);
  2858. $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.";
  2859. //>>excludeEnd("ide");
  2860. $core.addMethod(
  2861. $core.method({
  2862. selector: "at:ifAbsent:",
  2863. protocol: "accessing",
  2864. //>>excludeStart("ide", pragmas.excludeIdeData);
  2865. args: ["aKey", "aBlock"],
  2866. 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'>",
  2867. referencedClasses: [],
  2868. //>>excludeEnd("ide");
  2869. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2870. messageSends: []
  2871. }, function ($methodClass){ return function (aKey,aBlock){
  2872. var self=this,$self=this;
  2873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2874. return $core.withContext(function($ctx1) {
  2875. //>>excludeEnd("ctx");
  2876. var index = $self._positionOfKey_(aKey);
  2877. return index >=0 ? $self.values[index] : aBlock._value();
  2878. ;
  2879. return self;
  2880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2881. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2882. //>>excludeEnd("ctx");
  2883. }; }),
  2884. $globals.Dictionary);
  2885. $core.addMethod(
  2886. $core.method({
  2887. selector: "at:put:",
  2888. protocol: "accessing",
  2889. //>>excludeStart("ide", pragmas.excludeIdeData);
  2890. args: ["aKey", "aValue"],
  2891. 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'>",
  2892. referencedClasses: [],
  2893. //>>excludeEnd("ide");
  2894. 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"]]],
  2895. messageSends: []
  2896. }, function ($methodClass){ return function (aKey,aValue){
  2897. var self=this,$self=this;
  2898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2899. return $core.withContext(function($ctx1) {
  2900. //>>excludeEnd("ctx");
  2901. var index = $self._positionOfKey_(aKey);
  2902. if(index === -1) {
  2903. var keys = $self.keys;
  2904. index = keys.length;
  2905. keys.push(aKey);
  2906. }
  2907. return $self.values[index] = aValue;
  2908. ;
  2909. return self;
  2910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2911. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2912. //>>excludeEnd("ctx");
  2913. }; }),
  2914. $globals.Dictionary);
  2915. $core.addMethod(
  2916. $core.method({
  2917. selector: "includesKey:",
  2918. protocol: "testing",
  2919. //>>excludeStart("ide", pragmas.excludeIdeData);
  2920. args: ["aKey"],
  2921. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2922. referencedClasses: [],
  2923. //>>excludeEnd("ide");
  2924. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2925. messageSends: []
  2926. }, function ($methodClass){ return function (aKey){
  2927. var self=this,$self=this;
  2928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2929. return $core.withContext(function($ctx1) {
  2930. //>>excludeEnd("ctx");
  2931. return $self._positionOfKey_(aKey) >= 0;;
  2932. return self;
  2933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2934. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2935. //>>excludeEnd("ctx");
  2936. }; }),
  2937. $globals.Dictionary);
  2938. $core.addMethod(
  2939. $core.method({
  2940. selector: "indexOf:ifAbsent:",
  2941. protocol: "accessing",
  2942. //>>excludeStart("ide", pragmas.excludeIdeData);
  2943. args: ["anObject", "aBlock"],
  2944. 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 ]",
  2945. referencedClasses: [],
  2946. //>>excludeEnd("ide");
  2947. pragmas: [],
  2948. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2949. }, function ($methodClass){ return function (anObject,aBlock){
  2950. var self=this,$self=this;
  2951. var index;
  2952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2953. return $core.withContext(function($ctx1) {
  2954. //>>excludeEnd("ctx");
  2955. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2956. return (0);
  2957. }));
  2958. if($core.assert($recv(index).__eq((0)))){
  2959. return $recv(aBlock)._value();
  2960. } else {
  2961. return $recv($self.keys)._at_(index);
  2962. }
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2965. //>>excludeEnd("ctx");
  2966. }; }),
  2967. $globals.Dictionary);
  2968. $core.addMethod(
  2969. $core.method({
  2970. selector: "initialize",
  2971. protocol: "initialization",
  2972. //>>excludeStart("ide", pragmas.excludeIdeData);
  2973. args: [],
  2974. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2975. referencedClasses: [],
  2976. //>>excludeEnd("ide");
  2977. pragmas: [],
  2978. messageSends: ["initialize"]
  2979. }, function ($methodClass){ return function (){
  2980. var self=this,$self=this;
  2981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2982. return $core.withContext(function($ctx1) {
  2983. //>>excludeEnd("ctx");
  2984. [(
  2985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2986. $ctx1.supercall = true,
  2987. //>>excludeEnd("ctx");
  2988. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  2989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2990. ,$ctx1.supercall = false
  2991. //>>excludeEnd("ctx");
  2992. ][0];
  2993. $self.keys=[];
  2994. $self.values=[];
  2995. return self;
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  2998. //>>excludeEnd("ctx");
  2999. }; }),
  3000. $globals.Dictionary);
  3001. $core.addMethod(
  3002. $core.method({
  3003. selector: "keys",
  3004. protocol: "accessing",
  3005. //>>excludeStart("ide", pragmas.excludeIdeData);
  3006. args: [],
  3007. source: "keys\x0a\x09^ keys copy",
  3008. referencedClasses: [],
  3009. //>>excludeEnd("ide");
  3010. pragmas: [],
  3011. messageSends: ["copy"]
  3012. }, function ($methodClass){ return function (){
  3013. var self=this,$self=this;
  3014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3015. return $core.withContext(function($ctx1) {
  3016. //>>excludeEnd("ctx");
  3017. return $recv($self.keys)._copy();
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3020. //>>excludeEnd("ctx");
  3021. }; }),
  3022. $globals.Dictionary);
  3023. $core.addMethod(
  3024. $core.method({
  3025. selector: "keysAndValuesDo:",
  3026. protocol: "enumerating",
  3027. //>>excludeStart("ide", pragmas.excludeIdeData);
  3028. args: ["aBlock"],
  3029. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3030. referencedClasses: [],
  3031. //>>excludeEnd("ide");
  3032. pragmas: [],
  3033. messageSends: ["with:do:"]
  3034. }, function ($methodClass){ return function (aBlock){
  3035. var self=this,$self=this;
  3036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3037. return $core.withContext(function($ctx1) {
  3038. //>>excludeEnd("ctx");
  3039. return $recv($self.keys)._with_do_($self.values,aBlock);
  3040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3041. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3042. //>>excludeEnd("ctx");
  3043. }; }),
  3044. $globals.Dictionary);
  3045. $core.addMethod(
  3046. $core.method({
  3047. selector: "keysDo:",
  3048. protocol: "enumerating",
  3049. //>>excludeStart("ide", pragmas.excludeIdeData);
  3050. args: ["aBlock"],
  3051. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3052. referencedClasses: [],
  3053. //>>excludeEnd("ide");
  3054. pragmas: [],
  3055. messageSends: ["do:"]
  3056. }, function ($methodClass){ return function (aBlock){
  3057. var self=this,$self=this;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. return $core.withContext(function($ctx1) {
  3060. //>>excludeEnd("ctx");
  3061. return $recv($self.keys)._do_(aBlock);
  3062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3063. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3064. //>>excludeEnd("ctx");
  3065. }; }),
  3066. $globals.Dictionary);
  3067. $core.addMethod(
  3068. $core.method({
  3069. selector: "positionOfKey:",
  3070. protocol: "private",
  3071. //>>excludeStart("ide", pragmas.excludeIdeData);
  3072. args: ["anObject"],
  3073. 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'>",
  3074. referencedClasses: [],
  3075. //>>excludeEnd("ide");
  3076. 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"]]],
  3077. messageSends: []
  3078. }, function ($methodClass){ return function (anObject){
  3079. var self=this,$self=this;
  3080. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3081. return $core.withContext(function($ctx1) {
  3082. //>>excludeEnd("ctx");
  3083. var keys = $self.keys;
  3084. for(var i=0;i<keys.length;i++){
  3085. if(keys[i].__eq(anObject)) { return i;}
  3086. }
  3087. return -1;
  3088. ;
  3089. return self;
  3090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3091. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3092. //>>excludeEnd("ctx");
  3093. }; }),
  3094. $globals.Dictionary);
  3095. $core.addMethod(
  3096. $core.method({
  3097. selector: "removeAll",
  3098. protocol: "adding/removing",
  3099. //>>excludeStart("ide", pragmas.excludeIdeData);
  3100. args: [],
  3101. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3102. referencedClasses: [],
  3103. //>>excludeEnd("ide");
  3104. pragmas: [],
  3105. messageSends: ["removeAll"]
  3106. }, function ($methodClass){ return function (){
  3107. var self=this,$self=this;
  3108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3109. return $core.withContext(function($ctx1) {
  3110. //>>excludeEnd("ctx");
  3111. [$recv($self.keys)._removeAll()
  3112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3113. ,$ctx1.sendIdx["removeAll"]=1
  3114. //>>excludeEnd("ctx");
  3115. ][0];
  3116. $recv($self.values)._removeAll();
  3117. return self;
  3118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3119. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3120. //>>excludeEnd("ctx");
  3121. }; }),
  3122. $globals.Dictionary);
  3123. $core.addMethod(
  3124. $core.method({
  3125. selector: "removeKey:ifAbsent:",
  3126. protocol: "adding/removing",
  3127. //>>excludeStart("ide", pragmas.excludeIdeData);
  3128. args: ["aKey", "aBlock"],
  3129. 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'>",
  3130. referencedClasses: [],
  3131. //>>excludeEnd("ide");
  3132. 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"]]],
  3133. messageSends: []
  3134. }, function ($methodClass){ return function (aKey,aBlock){
  3135. var self=this,$self=this;
  3136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3137. return $core.withContext(function($ctx1) {
  3138. //>>excludeEnd("ctx");
  3139. var index = $self._positionOfKey_(aKey);
  3140. if(index === -1) {
  3141. return aBlock._value()
  3142. } else {
  3143. var keys = $self.keys, values = $self.values;
  3144. var value = values[index], l = keys.length;
  3145. keys[index] = keys[l-1];
  3146. keys.pop();
  3147. values[index] = values[l-1];
  3148. values.pop();
  3149. return value;
  3150. }
  3151. ;
  3152. return self;
  3153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3154. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3155. //>>excludeEnd("ctx");
  3156. }; }),
  3157. $globals.Dictionary);
  3158. $core.addMethod(
  3159. $core.method({
  3160. selector: "values",
  3161. protocol: "accessing",
  3162. //>>excludeStart("ide", pragmas.excludeIdeData);
  3163. args: [],
  3164. source: "values\x0a\x09^ values",
  3165. referencedClasses: [],
  3166. //>>excludeEnd("ide");
  3167. pragmas: [],
  3168. messageSends: []
  3169. }, function ($methodClass){ return function (){
  3170. var self=this,$self=this;
  3171. return $self.values;
  3172. }; }),
  3173. $globals.Dictionary);
  3174. $core.addMethod(
  3175. $core.method({
  3176. selector: "valuesDo:",
  3177. protocol: "enumerating",
  3178. //>>excludeStart("ide", pragmas.excludeIdeData);
  3179. args: ["aBlock"],
  3180. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3181. referencedClasses: [],
  3182. //>>excludeEnd("ide");
  3183. pragmas: [],
  3184. messageSends: ["do:"]
  3185. }, function ($methodClass){ return function (aBlock){
  3186. var self=this,$self=this;
  3187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3188. return $core.withContext(function($ctx1) {
  3189. //>>excludeEnd("ctx");
  3190. return $recv($self.values)._do_(aBlock);
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3193. //>>excludeEnd("ctx");
  3194. }; }),
  3195. $globals.Dictionary);
  3196. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3197. //>>excludeStart("ide", pragmas.excludeIdeData);
  3198. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3199. //>>excludeEnd("ide");
  3200. $core.addMethod(
  3201. $core.method({
  3202. selector: "asJavaScriptSource",
  3203. protocol: "accessing",
  3204. //>>excludeStart("ide", pragmas.excludeIdeData);
  3205. args: [],
  3206. 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: '}' ]",
  3207. referencedClasses: ["String"],
  3208. //>>excludeEnd("ide");
  3209. pragmas: [],
  3210. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3211. }, function ($methodClass){ return function (){
  3212. var self=this,$self=this;
  3213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3214. return $core.withContext(function($ctx1) {
  3215. //>>excludeEnd("ctx");
  3216. return $recv($globals.String)._streamContents_((function(str){
  3217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3218. return $core.withContext(function($ctx2) {
  3219. //>>excludeEnd("ctx");
  3220. [$recv(str)._nextPut_("{")
  3221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3222. ,$ctx2.sendIdx["nextPut:"]=1
  3223. //>>excludeEnd("ctx");
  3224. ][0];
  3225. $self._keysAndValuesDo_((function(key,value){
  3226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3227. return $core.withContext(function($ctx3) {
  3228. //>>excludeEnd("ctx");
  3229. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3231. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3232. //>>excludeEnd("ctx");
  3233. ][0])
  3234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3235. ,$ctx3.sendIdx["nextPutAll:"]=1
  3236. //>>excludeEnd("ctx");
  3237. ][0];
  3238. [$recv(str)._nextPut_(":")
  3239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3240. ,$ctx3.sendIdx["nextPut:"]=2
  3241. //>>excludeEnd("ctx");
  3242. ][0];
  3243. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3244. return [$recv(str)._nextPut_(",")
  3245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3246. ,$ctx3.sendIdx["nextPut:"]=3
  3247. //>>excludeEnd("ctx");
  3248. ][0];
  3249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3250. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3251. //>>excludeEnd("ctx");
  3252. }));
  3253. $recv(str)._skip_((-1));
  3254. return $recv(str)._nextPut_("}");
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3257. //>>excludeEnd("ctx");
  3258. }));
  3259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3260. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3261. //>>excludeEnd("ctx");
  3262. }; }),
  3263. $globals.HashedCollection);
  3264. $core.addMethod(
  3265. $core.method({
  3266. selector: "at:ifAbsent:",
  3267. protocol: "accessing",
  3268. //>>excludeStart("ide", pragmas.excludeIdeData);
  3269. args: ["aKey", "aBlock"],
  3270. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3271. referencedClasses: [],
  3272. //>>excludeEnd("ide");
  3273. pragmas: [],
  3274. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3275. }, function ($methodClass){ return function (aKey,aBlock){
  3276. var self=this,$self=this;
  3277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3278. return $core.withContext(function($ctx1) {
  3279. //>>excludeEnd("ctx");
  3280. if($core.assert($self._includesKey_(aKey))){
  3281. return $self._basicAt_(aKey);
  3282. } else {
  3283. return $recv(aBlock)._value();
  3284. }
  3285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3286. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3287. //>>excludeEnd("ctx");
  3288. }; }),
  3289. $globals.HashedCollection);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "at:put:",
  3293. protocol: "accessing",
  3294. //>>excludeStart("ide", pragmas.excludeIdeData);
  3295. args: ["aKey", "aValue"],
  3296. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3297. referencedClasses: [],
  3298. //>>excludeEnd("ide");
  3299. pragmas: [],
  3300. messageSends: ["basicAt:put:"]
  3301. }, function ($methodClass){ return function (aKey,aValue){
  3302. var self=this,$self=this;
  3303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3304. return $core.withContext(function($ctx1) {
  3305. //>>excludeEnd("ctx");
  3306. return $self._basicAt_put_(aKey,aValue);
  3307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3308. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3309. //>>excludeEnd("ctx");
  3310. }; }),
  3311. $globals.HashedCollection);
  3312. $core.addMethod(
  3313. $core.method({
  3314. selector: "includesKey:",
  3315. protocol: "testing",
  3316. //>>excludeStart("ide", pragmas.excludeIdeData);
  3317. args: ["aKey"],
  3318. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3319. referencedClasses: [],
  3320. //>>excludeEnd("ide");
  3321. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3322. messageSends: []
  3323. }, function ($methodClass){ return function (aKey){
  3324. var self=this,$self=this;
  3325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3326. return $core.withContext(function($ctx1) {
  3327. //>>excludeEnd("ctx");
  3328. return self.hasOwnProperty(aKey);
  3329. return self;
  3330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3331. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3332. //>>excludeEnd("ctx");
  3333. }; }),
  3334. $globals.HashedCollection);
  3335. $core.addMethod(
  3336. $core.method({
  3337. selector: "keys",
  3338. protocol: "accessing",
  3339. //>>excludeStart("ide", pragmas.excludeIdeData);
  3340. args: [],
  3341. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3342. referencedClasses: [],
  3343. //>>excludeEnd("ide");
  3344. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3345. messageSends: []
  3346. }, function ($methodClass){ return function (){
  3347. var self=this,$self=this;
  3348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3349. return $core.withContext(function($ctx1) {
  3350. //>>excludeEnd("ctx");
  3351. return Object.keys(self);
  3352. return self;
  3353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3354. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3355. //>>excludeEnd("ctx");
  3356. }; }),
  3357. $globals.HashedCollection);
  3358. $core.addMethod(
  3359. $core.method({
  3360. selector: "keysDo:",
  3361. protocol: "enumerating",
  3362. //>>excludeStart("ide", pragmas.excludeIdeData);
  3363. args: ["aBlock"],
  3364. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3365. referencedClasses: [],
  3366. //>>excludeEnd("ide");
  3367. pragmas: [],
  3368. messageSends: ["do:", "keys"]
  3369. }, function ($methodClass){ return function (aBlock){
  3370. var self=this,$self=this;
  3371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3372. return $core.withContext(function($ctx1) {
  3373. //>>excludeEnd("ctx");
  3374. $recv($self._keys())._do_(aBlock);
  3375. return self;
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3378. //>>excludeEnd("ctx");
  3379. }; }),
  3380. $globals.HashedCollection);
  3381. $core.addMethod(
  3382. $core.method({
  3383. selector: "removeKey:ifAbsent:",
  3384. protocol: "adding/removing",
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. args: ["aKey", "aBlock"],
  3387. 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 ]",
  3388. referencedClasses: [],
  3389. //>>excludeEnd("ide");
  3390. pragmas: [],
  3391. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3392. }, function ($methodClass){ return function (aKey,aBlock){
  3393. var self=this,$self=this;
  3394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3395. return $core.withContext(function($ctx1) {
  3396. //>>excludeEnd("ctx");
  3397. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3399. return $core.withContext(function($ctx2) {
  3400. //>>excludeEnd("ctx");
  3401. $self._basicDelete_(aKey);
  3402. return removed;
  3403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3404. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3405. //>>excludeEnd("ctx");
  3406. }),(function(){
  3407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3408. return $core.withContext(function($ctx2) {
  3409. //>>excludeEnd("ctx");
  3410. return $recv(aBlock)._value();
  3411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3413. //>>excludeEnd("ctx");
  3414. }));
  3415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3416. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3417. //>>excludeEnd("ctx");
  3418. }; }),
  3419. $globals.HashedCollection);
  3420. $core.addMethod(
  3421. $core.method({
  3422. selector: "values",
  3423. protocol: "accessing",
  3424. //>>excludeStart("ide", pragmas.excludeIdeData);
  3425. args: [],
  3426. 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'>",
  3427. referencedClasses: [],
  3428. //>>excludeEnd("ide");
  3429. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3430. messageSends: []
  3431. }, function ($methodClass){ return function (){
  3432. var self=this,$self=this;
  3433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3434. return $core.withContext(function($ctx1) {
  3435. //>>excludeEnd("ctx");
  3436. return $self._keys().map(function(key){
  3437. return $self._at_(key);
  3438. });
  3439. ;
  3440. return self;
  3441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3442. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3443. //>>excludeEnd("ctx");
  3444. }; }),
  3445. $globals.HashedCollection);
  3446. $core.addMethod(
  3447. $core.method({
  3448. selector: "valuesDo:",
  3449. protocol: "enumerating",
  3450. //>>excludeStart("ide", pragmas.excludeIdeData);
  3451. args: ["aBlock"],
  3452. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3453. referencedClasses: [],
  3454. //>>excludeEnd("ide");
  3455. pragmas: [],
  3456. messageSends: ["do:", "values"]
  3457. }, function ($methodClass){ return function (aBlock){
  3458. var self=this,$self=this;
  3459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3460. return $core.withContext(function($ctx1) {
  3461. //>>excludeEnd("ctx");
  3462. $recv($self._values())._do_(aBlock);
  3463. return self;
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3466. //>>excludeEnd("ctx");
  3467. }; }),
  3468. $globals.HashedCollection);
  3469. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3470. //>>excludeStart("ide", pragmas.excludeIdeData);
  3471. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3472. //>>excludeEnd("ide");
  3473. $core.addMethod(
  3474. $core.method({
  3475. selector: "=",
  3476. protocol: "comparing",
  3477. //>>excludeStart("ide", pragmas.excludeIdeData);
  3478. args: ["aCollection"],
  3479. 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",
  3480. referencedClasses: [],
  3481. //>>excludeEnd("ide");
  3482. pragmas: [],
  3483. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3484. }, function ($methodClass){ return function (aCollection){
  3485. var self=this,$self=this;
  3486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3487. return $core.withContext(function($ctx1) {
  3488. //>>excludeEnd("ctx");
  3489. var $early={};
  3490. try {
  3491. if(!$core.assert($recv([$recv([$self._class()
  3492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3493. ,$ctx1.sendIdx["class"]=1
  3494. //>>excludeEnd("ctx");
  3495. ][0]).__eq($recv(aCollection)._class())
  3496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3497. ,$ctx1.sendIdx["="]=1
  3498. //>>excludeEnd("ctx");
  3499. ][0])._and_((function(){
  3500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3501. return $core.withContext(function($ctx2) {
  3502. //>>excludeEnd("ctx");
  3503. return [$recv([$self._size()
  3504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3505. ,$ctx2.sendIdx["size"]=1
  3506. //>>excludeEnd("ctx");
  3507. ][0]).__eq($recv(aCollection)._size())
  3508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3509. ,$ctx2.sendIdx["="]=2
  3510. //>>excludeEnd("ctx");
  3511. ][0];
  3512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3514. //>>excludeEnd("ctx");
  3515. })))){
  3516. return false;
  3517. }
  3518. $self._withIndexDo_((function(each,i){
  3519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3520. return $core.withContext(function($ctx2) {
  3521. //>>excludeEnd("ctx");
  3522. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  3523. throw $early=[false];
  3524. }
  3525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3526. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3527. //>>excludeEnd("ctx");
  3528. }));
  3529. return true;
  3530. }
  3531. catch(e) {if(e===$early)return e[0]; throw e}
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3534. //>>excludeEnd("ctx");
  3535. }; }),
  3536. $globals.SequenceableCollection);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "addLast:",
  3540. protocol: "adding/removing",
  3541. //>>excludeStart("ide", pragmas.excludeIdeData);
  3542. args: ["anObject"],
  3543. source: "addLast: anObject\x0a\x09self add: anObject",
  3544. referencedClasses: [],
  3545. //>>excludeEnd("ide");
  3546. pragmas: [],
  3547. messageSends: ["add:"]
  3548. }, function ($methodClass){ return function (anObject){
  3549. var self=this,$self=this;
  3550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3551. return $core.withContext(function($ctx1) {
  3552. //>>excludeEnd("ctx");
  3553. $self._add_(anObject);
  3554. return self;
  3555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3556. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3557. //>>excludeEnd("ctx");
  3558. }; }),
  3559. $globals.SequenceableCollection);
  3560. $core.addMethod(
  3561. $core.method({
  3562. selector: "allButFirst",
  3563. protocol: "accessing",
  3564. //>>excludeStart("ide", pragmas.excludeIdeData);
  3565. args: [],
  3566. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3567. referencedClasses: [],
  3568. //>>excludeEnd("ide");
  3569. pragmas: [],
  3570. messageSends: ["copyFrom:to:", "size"]
  3571. }, function ($methodClass){ return function (){
  3572. var self=this,$self=this;
  3573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3574. return $core.withContext(function($ctx1) {
  3575. //>>excludeEnd("ctx");
  3576. return $self._copyFrom_to_((2),$self._size());
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3579. //>>excludeEnd("ctx");
  3580. }; }),
  3581. $globals.SequenceableCollection);
  3582. $core.addMethod(
  3583. $core.method({
  3584. selector: "allButLast",
  3585. protocol: "accessing",
  3586. //>>excludeStart("ide", pragmas.excludeIdeData);
  3587. args: [],
  3588. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3589. referencedClasses: [],
  3590. //>>excludeEnd("ide");
  3591. pragmas: [],
  3592. messageSends: ["copyFrom:to:", "-", "size"]
  3593. }, function ($methodClass){ return function (){
  3594. var self=this,$self=this;
  3595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3596. return $core.withContext(function($ctx1) {
  3597. //>>excludeEnd("ctx");
  3598. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3601. //>>excludeEnd("ctx");
  3602. }; }),
  3603. $globals.SequenceableCollection);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "anyOne",
  3607. protocol: "accessing",
  3608. //>>excludeStart("ide", pragmas.excludeIdeData);
  3609. args: [],
  3610. source: "anyOne\x0a\x09^ self at: 1",
  3611. referencedClasses: [],
  3612. //>>excludeEnd("ide");
  3613. pragmas: [],
  3614. messageSends: ["at:"]
  3615. }, function ($methodClass){ return function (){
  3616. var self=this,$self=this;
  3617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3618. return $core.withContext(function($ctx1) {
  3619. //>>excludeEnd("ctx");
  3620. return $self._at_((1));
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3623. //>>excludeEnd("ctx");
  3624. }; }),
  3625. $globals.SequenceableCollection);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "atRandom",
  3629. protocol: "accessing",
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: [],
  3632. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3633. referencedClasses: [],
  3634. //>>excludeEnd("ide");
  3635. pragmas: [],
  3636. messageSends: ["at:", "atRandom", "size"]
  3637. }, function ($methodClass){ return function (){
  3638. var self=this,$self=this;
  3639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3640. return $core.withContext(function($ctx1) {
  3641. //>>excludeEnd("ctx");
  3642. return $self._at_($recv($self._size())._atRandom());
  3643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3644. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3645. //>>excludeEnd("ctx");
  3646. }; }),
  3647. $globals.SequenceableCollection);
  3648. $core.addMethod(
  3649. $core.method({
  3650. selector: "beginsWith:",
  3651. protocol: "testing",
  3652. //>>excludeStart("ide", pragmas.excludeIdeData);
  3653. args: ["prefix"],
  3654. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3655. referencedClasses: [],
  3656. //>>excludeEnd("ide");
  3657. pragmas: [],
  3658. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3659. }, function ($methodClass){ return function (prefix){
  3660. var self=this,$self=this;
  3661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3662. return $core.withContext(function($ctx1) {
  3663. //>>excludeEnd("ctx");
  3664. if($core.assert($recv([$self._size()
  3665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3666. ,$ctx1.sendIdx["size"]=1
  3667. //>>excludeEnd("ctx");
  3668. ][0]).__lt([$recv(prefix)._size()
  3669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3670. ,$ctx1.sendIdx["size"]=2
  3671. //>>excludeEnd("ctx");
  3672. ][0]))){
  3673. return false;
  3674. }
  3675. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3678. //>>excludeEnd("ctx");
  3679. }; }),
  3680. $globals.SequenceableCollection);
  3681. $core.addMethod(
  3682. $core.method({
  3683. selector: "copyFrom:to:",
  3684. protocol: "copying",
  3685. //>>excludeStart("ide", pragmas.excludeIdeData);
  3686. args: ["anIndex", "anotherIndex"],
  3687. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3688. referencedClasses: [],
  3689. //>>excludeEnd("ide");
  3690. pragmas: [],
  3691. messageSends: ["subclassResponsibility"]
  3692. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3693. var self=this,$self=this;
  3694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3695. return $core.withContext(function($ctx1) {
  3696. //>>excludeEnd("ctx");
  3697. $self._subclassResponsibility();
  3698. return self;
  3699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3700. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3701. //>>excludeEnd("ctx");
  3702. }; }),
  3703. $globals.SequenceableCollection);
  3704. $core.addMethod(
  3705. $core.method({
  3706. selector: "copyWithFirst:",
  3707. protocol: "copying",
  3708. //>>excludeStart("ide", pragmas.excludeIdeData);
  3709. args: ["anObject"],
  3710. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3711. referencedClasses: [],
  3712. //>>excludeEnd("ide");
  3713. pragmas: [],
  3714. messageSends: ["addAll:", "with:", "class", "yourself"]
  3715. }, function ($methodClass){ return function (anObject){
  3716. var self=this,$self=this;
  3717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3718. return $core.withContext(function($ctx1) {
  3719. //>>excludeEnd("ctx");
  3720. var $1;
  3721. $1=$recv($self._class())._with_(anObject);
  3722. $recv($1)._addAll_(self);
  3723. return $recv($1)._yourself();
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3726. //>>excludeEnd("ctx");
  3727. }; }),
  3728. $globals.SequenceableCollection);
  3729. $core.addMethod(
  3730. $core.method({
  3731. selector: "endsWith:",
  3732. protocol: "testing",
  3733. //>>excludeStart("ide", pragmas.excludeIdeData);
  3734. args: ["suffix"],
  3735. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3736. referencedClasses: [],
  3737. //>>excludeEnd("ide");
  3738. pragmas: [],
  3739. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3740. }, function ($methodClass){ return function (suffix){
  3741. var self=this,$self=this;
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. return $core.withContext(function($ctx1) {
  3744. //>>excludeEnd("ctx");
  3745. if($core.assert($recv([$self._size()
  3746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3747. ,$ctx1.sendIdx["size"]=1
  3748. //>>excludeEnd("ctx");
  3749. ][0]).__lt([$recv(suffix)._size()
  3750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3751. ,$ctx1.sendIdx["size"]=2
  3752. //>>excludeEnd("ctx");
  3753. ][0]))){
  3754. return false;
  3755. }
  3756. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3758. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3759. //>>excludeEnd("ctx");
  3760. }; }),
  3761. $globals.SequenceableCollection);
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "first",
  3765. protocol: "accessing",
  3766. //>>excludeStart("ide", pragmas.excludeIdeData);
  3767. args: [],
  3768. source: "first\x0a\x09^ self at: 1",
  3769. referencedClasses: [],
  3770. //>>excludeEnd("ide");
  3771. pragmas: [],
  3772. messageSends: ["at:"]
  3773. }, function ($methodClass){ return function (){
  3774. var self=this,$self=this;
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. return $core.withContext(function($ctx1) {
  3777. //>>excludeEnd("ctx");
  3778. return $self._at_((1));
  3779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3780. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  3781. //>>excludeEnd("ctx");
  3782. }; }),
  3783. $globals.SequenceableCollection);
  3784. $core.addMethod(
  3785. $core.method({
  3786. selector: "first:",
  3787. protocol: "accessing",
  3788. //>>excludeStart("ide", pragmas.excludeIdeData);
  3789. args: ["aNumber"],
  3790. 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",
  3791. referencedClasses: [],
  3792. //>>excludeEnd("ide");
  3793. pragmas: [],
  3794. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3795. }, function ($methodClass){ return function (aNumber){
  3796. var self=this,$self=this;
  3797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3798. return $core.withContext(function($ctx1) {
  3799. //>>excludeEnd("ctx");
  3800. if($core.assert($recv($self._size()).__lt(aNumber))){
  3801. $self._error_("Invalid number of elements");
  3802. }
  3803. return $self._copyFrom_to_((1),aNumber);
  3804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3805. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3806. //>>excludeEnd("ctx");
  3807. }; }),
  3808. $globals.SequenceableCollection);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "fourth",
  3812. protocol: "accessing",
  3813. //>>excludeStart("ide", pragmas.excludeIdeData);
  3814. args: [],
  3815. source: "fourth\x0a\x09^ self at: 4",
  3816. referencedClasses: [],
  3817. //>>excludeEnd("ide");
  3818. pragmas: [],
  3819. messageSends: ["at:"]
  3820. }, function ($methodClass){ return function (){
  3821. var self=this,$self=this;
  3822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3823. return $core.withContext(function($ctx1) {
  3824. //>>excludeEnd("ctx");
  3825. return $self._at_((4));
  3826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3827. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3828. //>>excludeEnd("ctx");
  3829. }; }),
  3830. $globals.SequenceableCollection);
  3831. $core.addMethod(
  3832. $core.method({
  3833. selector: "includes:",
  3834. protocol: "testing",
  3835. //>>excludeStart("ide", pragmas.excludeIdeData);
  3836. args: ["anObject"],
  3837. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3838. referencedClasses: [],
  3839. //>>excludeEnd("ide");
  3840. pragmas: [],
  3841. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3842. }, function ($methodClass){ return function (anObject){
  3843. var self=this,$self=this;
  3844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3845. return $core.withContext(function($ctx1) {
  3846. //>>excludeEnd("ctx");
  3847. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3848. return nil;
  3849. })))._notNil();
  3850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3851. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3852. //>>excludeEnd("ctx");
  3853. }; }),
  3854. $globals.SequenceableCollection);
  3855. $core.addMethod(
  3856. $core.method({
  3857. selector: "indexOf:startingAt:",
  3858. protocol: "accessing",
  3859. //>>excludeStart("ide", pragmas.excludeIdeData);
  3860. args: ["anObject", "start"],
  3861. 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 ]",
  3862. referencedClasses: [],
  3863. //>>excludeEnd("ide");
  3864. pragmas: [],
  3865. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3866. }, function ($methodClass){ return function (anObject,start){
  3867. var self=this,$self=this;
  3868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3869. return $core.withContext(function($ctx1) {
  3870. //>>excludeEnd("ctx");
  3871. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3872. return (0);
  3873. }));
  3874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3875. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3876. //>>excludeEnd("ctx");
  3877. }; }),
  3878. $globals.SequenceableCollection);
  3879. $core.addMethod(
  3880. $core.method({
  3881. selector: "indexOf:startingAt:ifAbsent:",
  3882. protocol: "accessing",
  3883. //>>excludeStart("ide", pragmas.excludeIdeData);
  3884. args: ["anObject", "start", "aBlock"],
  3885. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3886. referencedClasses: [],
  3887. //>>excludeEnd("ide");
  3888. pragmas: [],
  3889. messageSends: ["subclassResponsibility"]
  3890. }, function ($methodClass){ return function (anObject,start,aBlock){
  3891. var self=this,$self=this;
  3892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3893. return $core.withContext(function($ctx1) {
  3894. //>>excludeEnd("ctx");
  3895. $self._subclassResponsibility();
  3896. return self;
  3897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3898. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3899. //>>excludeEnd("ctx");
  3900. }; }),
  3901. $globals.SequenceableCollection);
  3902. $core.addMethod(
  3903. $core.method({
  3904. selector: "last",
  3905. protocol: "accessing",
  3906. //>>excludeStart("ide", pragmas.excludeIdeData);
  3907. args: [],
  3908. source: "last\x0a\x09^ self at: self size",
  3909. referencedClasses: [],
  3910. //>>excludeEnd("ide");
  3911. pragmas: [],
  3912. messageSends: ["at:", "size"]
  3913. }, function ($methodClass){ return function (){
  3914. var self=this,$self=this;
  3915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3916. return $core.withContext(function($ctx1) {
  3917. //>>excludeEnd("ctx");
  3918. return $self._at_($self._size());
  3919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3920. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  3921. //>>excludeEnd("ctx");
  3922. }; }),
  3923. $globals.SequenceableCollection);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "last:",
  3927. protocol: "accessing",
  3928. //>>excludeStart("ide", pragmas.excludeIdeData);
  3929. args: ["aNumber"],
  3930. 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",
  3931. referencedClasses: [],
  3932. //>>excludeEnd("ide");
  3933. pragmas: [],
  3934. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3935. }, function ($methodClass){ return function (aNumber){
  3936. var self=this,$self=this;
  3937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3938. return $core.withContext(function($ctx1) {
  3939. //>>excludeEnd("ctx");
  3940. if($core.assert($recv([$self._size()
  3941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3942. ,$ctx1.sendIdx["size"]=1
  3943. //>>excludeEnd("ctx");
  3944. ][0]).__lt(aNumber))){
  3945. $self._error_("Invalid number of elements");
  3946. }
  3947. return $self._copyFrom_to_($recv($recv([$self._size()
  3948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3949. ,$ctx1.sendIdx["size"]=2
  3950. //>>excludeEnd("ctx");
  3951. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  3952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3953. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3954. //>>excludeEnd("ctx");
  3955. }; }),
  3956. $globals.SequenceableCollection);
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "newStream",
  3960. protocol: "streaming",
  3961. //>>excludeStart("ide", pragmas.excludeIdeData);
  3962. args: [],
  3963. source: "newStream\x0a\x09^ self streamClass on: self",
  3964. referencedClasses: [],
  3965. //>>excludeEnd("ide");
  3966. pragmas: [],
  3967. messageSends: ["on:", "streamClass"]
  3968. }, function ($methodClass){ return function (){
  3969. var self=this,$self=this;
  3970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3971. return $core.withContext(function($ctx1) {
  3972. //>>excludeEnd("ctx");
  3973. return $recv($self._streamClass())._on_(self);
  3974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3975. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  3976. //>>excludeEnd("ctx");
  3977. }; }),
  3978. $globals.SequenceableCollection);
  3979. $core.addMethod(
  3980. $core.method({
  3981. selector: "readStream",
  3982. protocol: "streaming",
  3983. //>>excludeStart("ide", pragmas.excludeIdeData);
  3984. args: [],
  3985. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3986. referencedClasses: [],
  3987. //>>excludeEnd("ide");
  3988. pragmas: [],
  3989. messageSends: ["stream"]
  3990. }, function ($methodClass){ return function (){
  3991. var self=this,$self=this;
  3992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3993. return $core.withContext(function($ctx1) {
  3994. //>>excludeEnd("ctx");
  3995. return $self._stream();
  3996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3997. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  3998. //>>excludeEnd("ctx");
  3999. }; }),
  4000. $globals.SequenceableCollection);
  4001. $core.addMethod(
  4002. $core.method({
  4003. selector: "removeLast",
  4004. protocol: "adding/removing",
  4005. //>>excludeStart("ide", pragmas.excludeIdeData);
  4006. args: [],
  4007. source: "removeLast\x0a\x09^ self remove: self last",
  4008. referencedClasses: [],
  4009. //>>excludeEnd("ide");
  4010. pragmas: [],
  4011. messageSends: ["remove:", "last"]
  4012. }, function ($methodClass){ return function (){
  4013. var self=this,$self=this;
  4014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4015. return $core.withContext(function($ctx1) {
  4016. //>>excludeEnd("ctx");
  4017. return $self._remove_($self._last());
  4018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4019. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4020. //>>excludeEnd("ctx");
  4021. }; }),
  4022. $globals.SequenceableCollection);
  4023. $core.addMethod(
  4024. $core.method({
  4025. selector: "reverseDo:",
  4026. protocol: "enumerating",
  4027. //>>excludeStart("ide", pragmas.excludeIdeData);
  4028. args: ["aBlock"],
  4029. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4030. referencedClasses: [],
  4031. //>>excludeEnd("ide");
  4032. pragmas: [],
  4033. messageSends: ["do:", "reversed"]
  4034. }, function ($methodClass){ return function (aBlock){
  4035. var self=this,$self=this;
  4036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4037. return $core.withContext(function($ctx1) {
  4038. //>>excludeEnd("ctx");
  4039. $recv($self._reversed())._do_(aBlock);
  4040. return self;
  4041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4042. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4043. //>>excludeEnd("ctx");
  4044. }; }),
  4045. $globals.SequenceableCollection);
  4046. $core.addMethod(
  4047. $core.method({
  4048. selector: "reversed",
  4049. protocol: "converting",
  4050. //>>excludeStart("ide", pragmas.excludeIdeData);
  4051. args: [],
  4052. source: "reversed\x0a\x09self subclassResponsibility",
  4053. referencedClasses: [],
  4054. //>>excludeEnd("ide");
  4055. pragmas: [],
  4056. messageSends: ["subclassResponsibility"]
  4057. }, function ($methodClass){ return function (){
  4058. var self=this,$self=this;
  4059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4060. return $core.withContext(function($ctx1) {
  4061. //>>excludeEnd("ctx");
  4062. $self._subclassResponsibility();
  4063. return self;
  4064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4065. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4066. //>>excludeEnd("ctx");
  4067. }; }),
  4068. $globals.SequenceableCollection);
  4069. $core.addMethod(
  4070. $core.method({
  4071. selector: "second",
  4072. protocol: "accessing",
  4073. //>>excludeStart("ide", pragmas.excludeIdeData);
  4074. args: [],
  4075. source: "second\x0a\x09^ self at: 2",
  4076. referencedClasses: [],
  4077. //>>excludeEnd("ide");
  4078. pragmas: [],
  4079. messageSends: ["at:"]
  4080. }, function ($methodClass){ return function (){
  4081. var self=this,$self=this;
  4082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4083. return $core.withContext(function($ctx1) {
  4084. //>>excludeEnd("ctx");
  4085. return $self._at_((2));
  4086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4087. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4088. //>>excludeEnd("ctx");
  4089. }; }),
  4090. $globals.SequenceableCollection);
  4091. $core.addMethod(
  4092. $core.method({
  4093. selector: "stream",
  4094. protocol: "streaming",
  4095. //>>excludeStart("ide", pragmas.excludeIdeData);
  4096. args: [],
  4097. source: "stream\x0a\x09^ self newStream",
  4098. referencedClasses: [],
  4099. //>>excludeEnd("ide");
  4100. pragmas: [],
  4101. messageSends: ["newStream"]
  4102. }, function ($methodClass){ return function (){
  4103. var self=this,$self=this;
  4104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4105. return $core.withContext(function($ctx1) {
  4106. //>>excludeEnd("ctx");
  4107. return $self._newStream();
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4110. //>>excludeEnd("ctx");
  4111. }; }),
  4112. $globals.SequenceableCollection);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "streamClass",
  4116. protocol: "streaming",
  4117. //>>excludeStart("ide", pragmas.excludeIdeData);
  4118. args: [],
  4119. source: "streamClass\x0a\x09^ self class streamClass",
  4120. referencedClasses: [],
  4121. //>>excludeEnd("ide");
  4122. pragmas: [],
  4123. messageSends: ["streamClass", "class"]
  4124. }, function ($methodClass){ return function (){
  4125. var self=this,$self=this;
  4126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4127. return $core.withContext(function($ctx1) {
  4128. //>>excludeEnd("ctx");
  4129. return $recv($self._class())._streamClass();
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4132. //>>excludeEnd("ctx");
  4133. }; }),
  4134. $globals.SequenceableCollection);
  4135. $core.addMethod(
  4136. $core.method({
  4137. selector: "third",
  4138. protocol: "accessing",
  4139. //>>excludeStart("ide", pragmas.excludeIdeData);
  4140. args: [],
  4141. source: "third\x0a\x09^ self at: 3",
  4142. referencedClasses: [],
  4143. //>>excludeEnd("ide");
  4144. pragmas: [],
  4145. messageSends: ["at:"]
  4146. }, function ($methodClass){ return function (){
  4147. var self=this,$self=this;
  4148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4149. return $core.withContext(function($ctx1) {
  4150. //>>excludeEnd("ctx");
  4151. return $self._at_((3));
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4154. //>>excludeEnd("ctx");
  4155. }; }),
  4156. $globals.SequenceableCollection);
  4157. $core.addMethod(
  4158. $core.method({
  4159. selector: "writeStream",
  4160. protocol: "streaming",
  4161. //>>excludeStart("ide", pragmas.excludeIdeData);
  4162. args: [],
  4163. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4164. referencedClasses: [],
  4165. //>>excludeEnd("ide");
  4166. pragmas: [],
  4167. messageSends: ["stream"]
  4168. }, function ($methodClass){ return function (){
  4169. var self=this,$self=this;
  4170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4171. return $core.withContext(function($ctx1) {
  4172. //>>excludeEnd("ctx");
  4173. return $self._stream();
  4174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4175. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4176. //>>excludeEnd("ctx");
  4177. }; }),
  4178. $globals.SequenceableCollection);
  4179. $core.addMethod(
  4180. $core.method({
  4181. selector: "streamClass",
  4182. protocol: "accessing",
  4183. //>>excludeStart("ide", pragmas.excludeIdeData);
  4184. args: [],
  4185. source: "streamClass\x0a\x09\x09^ Stream",
  4186. referencedClasses: ["Stream"],
  4187. //>>excludeEnd("ide");
  4188. pragmas: [],
  4189. messageSends: []
  4190. }, function ($methodClass){ return function (){
  4191. var self=this,$self=this;
  4192. return $globals.Stream;
  4193. }; }),
  4194. $globals.SequenceableCollection.a$cls);
  4195. $core.addMethod(
  4196. $core.method({
  4197. selector: "streamContents:",
  4198. protocol: "streaming",
  4199. //>>excludeStart("ide", pragmas.excludeIdeData);
  4200. args: ["aBlock"],
  4201. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4202. referencedClasses: [],
  4203. //>>excludeEnd("ide");
  4204. pragmas: [],
  4205. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4206. }, function ($methodClass){ return function (aBlock){
  4207. var self=this,$self=this;
  4208. var stream;
  4209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4210. return $core.withContext(function($ctx1) {
  4211. //>>excludeEnd("ctx");
  4212. stream=$recv($self._streamClass())._on_($self._new());
  4213. $recv(aBlock)._value_(stream);
  4214. return $recv(stream)._contents();
  4215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4216. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4217. //>>excludeEnd("ctx");
  4218. }; }),
  4219. $globals.SequenceableCollection.a$cls);
  4220. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4221. //>>excludeStart("ide", pragmas.excludeIdeData);
  4222. $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`.";
  4223. //>>excludeEnd("ide");
  4224. $core.addMethod(
  4225. $core.method({
  4226. selector: "add:",
  4227. protocol: "adding/removing",
  4228. //>>excludeStart("ide", pragmas.excludeIdeData);
  4229. args: ["anObject"],
  4230. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4231. referencedClasses: [],
  4232. //>>excludeEnd("ide");
  4233. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4234. messageSends: []
  4235. }, function ($methodClass){ return function (anObject){
  4236. var self=this,$self=this;
  4237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4238. return $core.withContext(function($ctx1) {
  4239. //>>excludeEnd("ctx");
  4240. self.push(anObject); return anObject;;
  4241. return self;
  4242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4243. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4244. //>>excludeEnd("ctx");
  4245. }; }),
  4246. $globals.Array);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "addAll:",
  4250. protocol: "adding/removing",
  4251. //>>excludeStart("ide", pragmas.excludeIdeData);
  4252. args: ["aCollection"],
  4253. 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'>",
  4254. referencedClasses: [],
  4255. //>>excludeEnd("ide");
  4256. 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;"]]],
  4257. messageSends: []
  4258. }, function ($methodClass){ return function (aCollection){
  4259. var self=this,$self=this;
  4260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4261. return $core.withContext(function($ctx1) {
  4262. //>>excludeEnd("ctx");
  4263. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4264. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4265. return aCollection;;
  4266. return self;
  4267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4268. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4269. //>>excludeEnd("ctx");
  4270. }; }),
  4271. $globals.Array);
  4272. $core.addMethod(
  4273. $core.method({
  4274. selector: "addFirst:",
  4275. protocol: "adding/removing",
  4276. //>>excludeStart("ide", pragmas.excludeIdeData);
  4277. args: ["anObject"],
  4278. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4279. referencedClasses: [],
  4280. //>>excludeEnd("ide");
  4281. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4282. messageSends: []
  4283. }, function ($methodClass){ return function (anObject){
  4284. var self=this,$self=this;
  4285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4286. return $core.withContext(function($ctx1) {
  4287. //>>excludeEnd("ctx");
  4288. self.unshift(anObject); return anObject;;
  4289. return self;
  4290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4291. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4292. //>>excludeEnd("ctx");
  4293. }; }),
  4294. $globals.Array);
  4295. $core.addMethod(
  4296. $core.method({
  4297. selector: "allIn:",
  4298. protocol: "enumerating",
  4299. //>>excludeStart("ide", pragmas.excludeIdeData);
  4300. args: ["aBlock"],
  4301. source: "allIn: aBlock\x0a\x09^ aBlock valueWithPossibleArguments:\x0a\x09\x09\x22collect to match #in: behaviour\x22\x0a\x09\x09(self collect: [ :each | each in: [ :x | x ] ])",
  4302. referencedClasses: [],
  4303. //>>excludeEnd("ide");
  4304. pragmas: [],
  4305. messageSends: ["valueWithPossibleArguments:", "collect:", "in:"]
  4306. }, function ($methodClass){ return function (aBlock){
  4307. var self=this,$self=this;
  4308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4309. return $core.withContext(function($ctx1) {
  4310. //>>excludeEnd("ctx");
  4311. return $recv(aBlock)._valueWithPossibleArguments_($self._collect_((function(each){
  4312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4313. return $core.withContext(function($ctx2) {
  4314. //>>excludeEnd("ctx");
  4315. return $recv(each)._in_((function(x){
  4316. return x;
  4317. }));
  4318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4319. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4320. //>>excludeEnd("ctx");
  4321. })));
  4322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4323. }, function($ctx1) {$ctx1.fill(self,"allIn:",{aBlock:aBlock})});
  4324. //>>excludeEnd("ctx");
  4325. }; }),
  4326. $globals.Array);
  4327. $core.addMethod(
  4328. $core.method({
  4329. selector: "asJavaScriptSource",
  4330. protocol: "converting",
  4331. //>>excludeStart("ide", pragmas.excludeIdeData);
  4332. args: [],
  4333. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4334. referencedClasses: [],
  4335. //>>excludeEnd("ide");
  4336. pragmas: [],
  4337. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4338. }, function ($methodClass){ return function (){
  4339. var self=this,$self=this;
  4340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4341. return $core.withContext(function($ctx1) {
  4342. //>>excludeEnd("ctx");
  4343. return [$recv("[".__comma($recv($self._collect_((function(each){
  4344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4345. return $core.withContext(function($ctx2) {
  4346. //>>excludeEnd("ctx");
  4347. return $recv(each)._asJavaScriptSource();
  4348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4349. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4350. //>>excludeEnd("ctx");
  4351. })))._join_(", "))).__comma("]")
  4352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4353. ,$ctx1.sendIdx[","]=1
  4354. //>>excludeEnd("ctx");
  4355. ][0];
  4356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4357. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4358. //>>excludeEnd("ctx");
  4359. }; }),
  4360. $globals.Array);
  4361. $core.addMethod(
  4362. $core.method({
  4363. selector: "at:put:",
  4364. protocol: "accessing",
  4365. //>>excludeStart("ide", pragmas.excludeIdeData);
  4366. args: ["anIndex", "anObject"],
  4367. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4368. referencedClasses: [],
  4369. //>>excludeEnd("ide");
  4370. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4371. messageSends: []
  4372. }, function ($methodClass){ return function (anIndex,anObject){
  4373. var self=this,$self=this;
  4374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4375. return $core.withContext(function($ctx1) {
  4376. //>>excludeEnd("ctx");
  4377. return self[anIndex - 1] = anObject;
  4378. return self;
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4381. //>>excludeEnd("ctx");
  4382. }; }),
  4383. $globals.Array);
  4384. $core.addMethod(
  4385. $core.method({
  4386. selector: "collect:",
  4387. protocol: "enumerating",
  4388. //>>excludeStart("ide", pragmas.excludeIdeData);
  4389. args: ["aBlock"],
  4390. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4391. referencedClasses: [],
  4392. //>>excludeEnd("ide");
  4393. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4394. messageSends: []
  4395. }, function ($methodClass){ return function (aBlock){
  4396. var self=this,$self=this;
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. return $core.withContext(function($ctx1) {
  4399. //>>excludeEnd("ctx");
  4400. return self.map(function(each) {return aBlock._value_(each)});
  4401. return self;
  4402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4403. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4404. //>>excludeEnd("ctx");
  4405. }; }),
  4406. $globals.Array);
  4407. $core.addMethod(
  4408. $core.method({
  4409. selector: "copyFrom:to:",
  4410. protocol: "copying",
  4411. //>>excludeStart("ide", pragmas.excludeIdeData);
  4412. args: ["anIndex", "anotherIndex"],
  4413. 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'>",
  4414. referencedClasses: [],
  4415. //>>excludeEnd("ide");
  4416. 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}"]]],
  4417. messageSends: []
  4418. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4419. var self=this,$self=this;
  4420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4421. return $core.withContext(function($ctx1) {
  4422. //>>excludeEnd("ctx");
  4423. if (anIndex >= 1 && anotherIndex <= self.length) {
  4424. return self.slice(anIndex - 1, anotherIndex);
  4425. } else {
  4426. self._at_(anIndex);
  4427. self._at_(self.length + 1);
  4428. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4429. };
  4430. return self;
  4431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4432. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4433. //>>excludeEnd("ctx");
  4434. }; }),
  4435. $globals.Array);
  4436. $core.addMethod(
  4437. $core.method({
  4438. selector: "join:",
  4439. protocol: "enumerating",
  4440. //>>excludeStart("ide", pragmas.excludeIdeData);
  4441. args: ["aString"],
  4442. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4443. referencedClasses: [],
  4444. //>>excludeEnd("ide");
  4445. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4446. messageSends: []
  4447. }, function ($methodClass){ return function (aString){
  4448. var self=this,$self=this;
  4449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4450. return $core.withContext(function($ctx1) {
  4451. //>>excludeEnd("ctx");
  4452. return self.join(aString);
  4453. return self;
  4454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4455. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4456. //>>excludeEnd("ctx");
  4457. }; }),
  4458. $globals.Array);
  4459. $core.addMethod(
  4460. $core.method({
  4461. selector: "printOn:",
  4462. protocol: "printing",
  4463. //>>excludeStart("ide", pragmas.excludeIdeData);
  4464. args: ["aStream"],
  4465. 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: ')'",
  4466. referencedClasses: [],
  4467. //>>excludeEnd("ide");
  4468. pragmas: [],
  4469. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4470. }, function ($methodClass){ return function (aStream){
  4471. var self=this,$self=this;
  4472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4473. return $core.withContext(function($ctx1) {
  4474. //>>excludeEnd("ctx");
  4475. [(
  4476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4477. $ctx1.supercall = true,
  4478. //>>excludeEnd("ctx");
  4479. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4481. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4482. //>>excludeEnd("ctx");
  4483. ][0];
  4484. [$recv(aStream)._nextPutAll_(" (")
  4485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4486. ,$ctx1.sendIdx["nextPutAll:"]=1
  4487. //>>excludeEnd("ctx");
  4488. ][0];
  4489. $self._do_separatedBy_((function(each){
  4490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4491. return $core.withContext(function($ctx2) {
  4492. //>>excludeEnd("ctx");
  4493. return $recv(each)._printOn_(aStream);
  4494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4496. //>>excludeEnd("ctx");
  4497. }),(function(){
  4498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4499. return $core.withContext(function($ctx2) {
  4500. //>>excludeEnd("ctx");
  4501. return [$recv(aStream)._nextPutAll_(" ")
  4502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4503. ,$ctx2.sendIdx["nextPutAll:"]=2
  4504. //>>excludeEnd("ctx");
  4505. ][0];
  4506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4508. //>>excludeEnd("ctx");
  4509. }));
  4510. $recv(aStream)._nextPutAll_(")");
  4511. return self;
  4512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4513. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4514. //>>excludeEnd("ctx");
  4515. }; }),
  4516. $globals.Array);
  4517. $core.addMethod(
  4518. $core.method({
  4519. selector: "remove:ifAbsent:",
  4520. protocol: "adding/removing",
  4521. //>>excludeStart("ide", pragmas.excludeIdeData);
  4522. args: ["anObject", "aBlock"],
  4523. 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 ]",
  4524. referencedClasses: [],
  4525. //>>excludeEnd("ide");
  4526. pragmas: [],
  4527. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4528. }, function ($methodClass){ return function (anObject,aBlock){
  4529. var self=this,$self=this;
  4530. var index;
  4531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4532. return $core.withContext(function($ctx1) {
  4533. //>>excludeEnd("ctx");
  4534. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4535. return (0);
  4536. }));
  4537. if($core.assert($recv(index).__eq((0)))){
  4538. return $recv(aBlock)._value();
  4539. } else {
  4540. $self._removeIndex_(index);
  4541. return anObject;
  4542. }
  4543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4544. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4545. //>>excludeEnd("ctx");
  4546. }; }),
  4547. $globals.Array);
  4548. $core.addMethod(
  4549. $core.method({
  4550. selector: "removeAll",
  4551. protocol: "adding/removing",
  4552. //>>excludeStart("ide", pragmas.excludeIdeData);
  4553. args: [],
  4554. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4555. referencedClasses: [],
  4556. //>>excludeEnd("ide");
  4557. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4558. messageSends: []
  4559. }, function ($methodClass){ return function (){
  4560. var self=this,$self=this;
  4561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4562. return $core.withContext(function($ctx1) {
  4563. //>>excludeEnd("ctx");
  4564. self.length = 0;
  4565. return self;
  4566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4567. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4568. //>>excludeEnd("ctx");
  4569. }; }),
  4570. $globals.Array);
  4571. $core.addMethod(
  4572. $core.method({
  4573. selector: "removeFrom:to:",
  4574. protocol: "adding/removing",
  4575. //>>excludeStart("ide", pragmas.excludeIdeData);
  4576. args: ["aNumber", "anotherNumber"],
  4577. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4578. referencedClasses: [],
  4579. //>>excludeEnd("ide");
  4580. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4581. messageSends: []
  4582. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4583. var self=this,$self=this;
  4584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4585. return $core.withContext(function($ctx1) {
  4586. //>>excludeEnd("ctx");
  4587. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4588. return self;
  4589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4590. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4591. //>>excludeEnd("ctx");
  4592. }; }),
  4593. $globals.Array);
  4594. $core.addMethod(
  4595. $core.method({
  4596. selector: "removeIndex:",
  4597. protocol: "adding/removing",
  4598. //>>excludeStart("ide", pragmas.excludeIdeData);
  4599. args: ["anInteger"],
  4600. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4601. referencedClasses: [],
  4602. //>>excludeEnd("ide");
  4603. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4604. messageSends: []
  4605. }, function ($methodClass){ return function (anInteger){
  4606. var self=this,$self=this;
  4607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4608. return $core.withContext(function($ctx1) {
  4609. //>>excludeEnd("ctx");
  4610. self.splice(anInteger - 1, 1);
  4611. return self;
  4612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4613. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4614. //>>excludeEnd("ctx");
  4615. }; }),
  4616. $globals.Array);
  4617. $core.addMethod(
  4618. $core.method({
  4619. selector: "removeLast",
  4620. protocol: "adding/removing",
  4621. //>>excludeStart("ide", pragmas.excludeIdeData);
  4622. args: [],
  4623. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4624. referencedClasses: [],
  4625. //>>excludeEnd("ide");
  4626. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4627. messageSends: []
  4628. }, function ($methodClass){ return function (){
  4629. var self=this,$self=this;
  4630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4631. return $core.withContext(function($ctx1) {
  4632. //>>excludeEnd("ctx");
  4633. return self.pop();;
  4634. return self;
  4635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4636. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4637. //>>excludeEnd("ctx");
  4638. }; }),
  4639. $globals.Array);
  4640. $core.addMethod(
  4641. $core.method({
  4642. selector: "reversed",
  4643. protocol: "converting",
  4644. //>>excludeStart("ide", pragmas.excludeIdeData);
  4645. args: [],
  4646. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4647. referencedClasses: [],
  4648. //>>excludeEnd("ide");
  4649. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4650. messageSends: []
  4651. }, function ($methodClass){ return function (){
  4652. var self=this,$self=this;
  4653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4654. return $core.withContext(function($ctx1) {
  4655. //>>excludeEnd("ctx");
  4656. return self.slice().reverse();
  4657. return self;
  4658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4659. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4660. //>>excludeEnd("ctx");
  4661. }; }),
  4662. $globals.Array);
  4663. $core.addMethod(
  4664. $core.method({
  4665. selector: "select:",
  4666. protocol: "enumerating",
  4667. //>>excludeStart("ide", pragmas.excludeIdeData);
  4668. args: ["aBlock"],
  4669. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4670. referencedClasses: [],
  4671. //>>excludeEnd("ide");
  4672. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4673. messageSends: []
  4674. }, function ($methodClass){ return function (aBlock){
  4675. var self=this,$self=this;
  4676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4677. return $core.withContext(function($ctx1) {
  4678. //>>excludeEnd("ctx");
  4679. return self.filter(function(each) {return aBlock._value_(each)});
  4680. return self;
  4681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4682. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4683. //>>excludeEnd("ctx");
  4684. }; }),
  4685. $globals.Array);
  4686. $core.addMethod(
  4687. $core.method({
  4688. selector: "shallowCopy",
  4689. protocol: "copying",
  4690. //>>excludeStart("ide", pragmas.excludeIdeData);
  4691. args: [],
  4692. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4693. referencedClasses: [],
  4694. //>>excludeEnd("ide");
  4695. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4696. messageSends: []
  4697. }, function ($methodClass){ return function (){
  4698. var self=this,$self=this;
  4699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4700. return $core.withContext(function($ctx1) {
  4701. //>>excludeEnd("ctx");
  4702. return self.slice();
  4703. return self;
  4704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4705. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4706. //>>excludeEnd("ctx");
  4707. }; }),
  4708. $globals.Array);
  4709. $core.addMethod(
  4710. $core.method({
  4711. selector: "sort",
  4712. protocol: "enumerating",
  4713. //>>excludeStart("ide", pragmas.excludeIdeData);
  4714. args: [],
  4715. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4716. referencedClasses: [],
  4717. //>>excludeEnd("ide");
  4718. pragmas: [],
  4719. messageSends: ["sort:", "<"]
  4720. }, function ($methodClass){ return function (){
  4721. var self=this,$self=this;
  4722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4723. return $core.withContext(function($ctx1) {
  4724. //>>excludeEnd("ctx");
  4725. return $self._sort_((function(a,b){
  4726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4727. return $core.withContext(function($ctx2) {
  4728. //>>excludeEnd("ctx");
  4729. return $recv(a).__lt(b);
  4730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4731. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4732. //>>excludeEnd("ctx");
  4733. }));
  4734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4735. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4736. //>>excludeEnd("ctx");
  4737. }; }),
  4738. $globals.Array);
  4739. $core.addMethod(
  4740. $core.method({
  4741. selector: "sort:",
  4742. protocol: "enumerating",
  4743. //>>excludeStart("ide", pragmas.excludeIdeData);
  4744. args: ["aBlock"],
  4745. 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'>",
  4746. referencedClasses: [],
  4747. //>>excludeEnd("ide");
  4748. 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"]]],
  4749. messageSends: []
  4750. }, function ($methodClass){ return function (aBlock){
  4751. var self=this,$self=this;
  4752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4753. return $core.withContext(function($ctx1) {
  4754. //>>excludeEnd("ctx");
  4755. return self.sort(function(a, b) {
  4756. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4757. })
  4758. ;
  4759. return self;
  4760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4761. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4762. //>>excludeEnd("ctx");
  4763. }; }),
  4764. $globals.Array);
  4765. $core.addMethod(
  4766. $core.method({
  4767. selector: "sorted",
  4768. protocol: "enumerating",
  4769. //>>excludeStart("ide", pragmas.excludeIdeData);
  4770. args: [],
  4771. source: "sorted\x0a\x09^ self copy sort",
  4772. referencedClasses: [],
  4773. //>>excludeEnd("ide");
  4774. pragmas: [],
  4775. messageSends: ["sort", "copy"]
  4776. }, function ($methodClass){ return function (){
  4777. var self=this,$self=this;
  4778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4779. return $core.withContext(function($ctx1) {
  4780. //>>excludeEnd("ctx");
  4781. return $recv($self._copy())._sort();
  4782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4783. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4784. //>>excludeEnd("ctx");
  4785. }; }),
  4786. $globals.Array);
  4787. $core.addMethod(
  4788. $core.method({
  4789. selector: "sorted:",
  4790. protocol: "enumerating",
  4791. //>>excludeStart("ide", pragmas.excludeIdeData);
  4792. args: ["aBlock"],
  4793. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4794. referencedClasses: [],
  4795. //>>excludeEnd("ide");
  4796. pragmas: [],
  4797. messageSends: ["sort:", "copy"]
  4798. }, function ($methodClass){ return function (aBlock){
  4799. var self=this,$self=this;
  4800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4801. return $core.withContext(function($ctx1) {
  4802. //>>excludeEnd("ctx");
  4803. return $recv($self._copy())._sort_(aBlock);
  4804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4805. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4806. //>>excludeEnd("ctx");
  4807. }; }),
  4808. $globals.Array);
  4809. $core.addMethod(
  4810. $core.method({
  4811. selector: "new:",
  4812. protocol: "instance creation",
  4813. //>>excludeStart("ide", pragmas.excludeIdeData);
  4814. args: ["anInteger"],
  4815. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4816. referencedClasses: [],
  4817. //>>excludeEnd("ide");
  4818. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4819. messageSends: []
  4820. }, function ($methodClass){ return function (anInteger){
  4821. var self=this,$self=this;
  4822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4823. return $core.withContext(function($ctx1) {
  4824. //>>excludeEnd("ctx");
  4825. return new Array(anInteger);
  4826. return self;
  4827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4828. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4829. //>>excludeEnd("ctx");
  4830. }; }),
  4831. $globals.Array.a$cls);
  4832. $core.addMethod(
  4833. $core.method({
  4834. selector: "with:",
  4835. protocol: "instance creation",
  4836. //>>excludeStart("ide", pragmas.excludeIdeData);
  4837. args: ["anObject"],
  4838. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4839. referencedClasses: [],
  4840. //>>excludeEnd("ide");
  4841. pragmas: [],
  4842. messageSends: ["at:put:", "new:", "yourself"]
  4843. }, function ($methodClass){ return function (anObject){
  4844. var self=this,$self=this;
  4845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4846. return $core.withContext(function($ctx1) {
  4847. //>>excludeEnd("ctx");
  4848. var $1;
  4849. $1=$self._new_((1));
  4850. $recv($1)._at_put_((1),anObject);
  4851. return $recv($1)._yourself();
  4852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4853. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4854. //>>excludeEnd("ctx");
  4855. }; }),
  4856. $globals.Array.a$cls);
  4857. $core.addMethod(
  4858. $core.method({
  4859. selector: "with:with:",
  4860. protocol: "instance creation",
  4861. //>>excludeStart("ide", pragmas.excludeIdeData);
  4862. args: ["anObject", "anObject2"],
  4863. 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",
  4864. referencedClasses: [],
  4865. //>>excludeEnd("ide");
  4866. pragmas: [],
  4867. messageSends: ["at:put:", "new:", "yourself"]
  4868. }, function ($methodClass){ return function (anObject,anObject2){
  4869. var self=this,$self=this;
  4870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4871. return $core.withContext(function($ctx1) {
  4872. //>>excludeEnd("ctx");
  4873. var $1;
  4874. $1=$self._new_((2));
  4875. [$recv($1)._at_put_((1),anObject)
  4876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4877. ,$ctx1.sendIdx["at:put:"]=1
  4878. //>>excludeEnd("ctx");
  4879. ][0];
  4880. $recv($1)._at_put_((2),anObject2);
  4881. return $recv($1)._yourself();
  4882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4883. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4884. //>>excludeEnd("ctx");
  4885. }; }),
  4886. $globals.Array.a$cls);
  4887. $core.addMethod(
  4888. $core.method({
  4889. selector: "with:with:with:",
  4890. protocol: "instance creation",
  4891. //>>excludeStart("ide", pragmas.excludeIdeData);
  4892. args: ["anObject", "anObject2", "anObject3"],
  4893. 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",
  4894. referencedClasses: [],
  4895. //>>excludeEnd("ide");
  4896. pragmas: [],
  4897. messageSends: ["at:put:", "new:", "yourself"]
  4898. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4899. var self=this,$self=this;
  4900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4901. return $core.withContext(function($ctx1) {
  4902. //>>excludeEnd("ctx");
  4903. var $1;
  4904. $1=$self._new_((3));
  4905. [$recv($1)._at_put_((1),anObject)
  4906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4907. ,$ctx1.sendIdx["at:put:"]=1
  4908. //>>excludeEnd("ctx");
  4909. ][0];
  4910. [$recv($1)._at_put_((2),anObject2)
  4911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4912. ,$ctx1.sendIdx["at:put:"]=2
  4913. //>>excludeEnd("ctx");
  4914. ][0];
  4915. $recv($1)._at_put_((3),anObject3);
  4916. return $recv($1)._yourself();
  4917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4918. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4919. //>>excludeEnd("ctx");
  4920. }; }),
  4921. $globals.Array.a$cls);
  4922. $core.addMethod(
  4923. $core.method({
  4924. selector: "withAll:",
  4925. protocol: "instance creation",
  4926. //>>excludeStart("ide", pragmas.excludeIdeData);
  4927. args: ["aCollection"],
  4928. 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",
  4929. referencedClasses: [],
  4930. //>>excludeEnd("ide");
  4931. pragmas: [],
  4932. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4933. }, function ($methodClass){ return function (aCollection){
  4934. var self=this,$self=this;
  4935. var instance,index;
  4936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4937. return $core.withContext(function($ctx1) {
  4938. //>>excludeEnd("ctx");
  4939. index=(1);
  4940. instance=$self._new_($recv(aCollection)._size());
  4941. $recv(aCollection)._do_((function(each){
  4942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4943. return $core.withContext(function($ctx2) {
  4944. //>>excludeEnd("ctx");
  4945. $recv(instance)._at_put_(index,each);
  4946. index=$recv(index).__plus((1));
  4947. return index;
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4950. //>>excludeEnd("ctx");
  4951. }));
  4952. return instance;
  4953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4954. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4955. //>>excludeEnd("ctx");
  4956. }; }),
  4957. $globals.Array.a$cls);
  4958. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4959. //>>excludeStart("ide", pragmas.excludeIdeData);
  4960. $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 >> #,`";
  4961. //>>excludeEnd("ide");
  4962. $core.addMethod(
  4963. $core.method({
  4964. selector: ",",
  4965. protocol: "copying",
  4966. //>>excludeStart("ide", pragmas.excludeIdeData);
  4967. args: ["aString"],
  4968. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4969. referencedClasses: [],
  4970. //>>excludeEnd("ide");
  4971. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4972. messageSends: []
  4973. }, function ($methodClass){ return function (aString){
  4974. var self=this,$self=this;
  4975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4976. return $core.withContext(function($ctx1) {
  4977. //>>excludeEnd("ctx");
  4978. return String(self) + aString;
  4979. return self;
  4980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4981. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4982. //>>excludeEnd("ctx");
  4983. }; }),
  4984. $globals.String);
  4985. $core.addMethod(
  4986. $core.method({
  4987. selector: "<",
  4988. protocol: "comparing",
  4989. //>>excludeStart("ide", pragmas.excludeIdeData);
  4990. args: ["aString"],
  4991. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4992. referencedClasses: [],
  4993. //>>excludeEnd("ide");
  4994. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4995. messageSends: []
  4996. }, function ($methodClass){ return function (aString){
  4997. var self=this,$self=this;
  4998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4999. return $core.withContext(function($ctx1) {
  5000. //>>excludeEnd("ctx");
  5001. return String(self) < aString._asString();
  5002. return self;
  5003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5004. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  5005. //>>excludeEnd("ctx");
  5006. }; }),
  5007. $globals.String);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "<=",
  5011. protocol: "comparing",
  5012. //>>excludeStart("ide", pragmas.excludeIdeData);
  5013. args: ["aString"],
  5014. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5015. referencedClasses: [],
  5016. //>>excludeEnd("ide");
  5017. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  5018. messageSends: []
  5019. }, function ($methodClass){ return function (aString){
  5020. var self=this,$self=this;
  5021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5022. return $core.withContext(function($ctx1) {
  5023. //>>excludeEnd("ctx");
  5024. return String(self) <= aString._asString();
  5025. return self;
  5026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5027. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  5028. //>>excludeEnd("ctx");
  5029. }; }),
  5030. $globals.String);
  5031. $core.addMethod(
  5032. $core.method({
  5033. selector: "=",
  5034. protocol: "comparing",
  5035. //>>excludeStart("ide", pragmas.excludeIdeData);
  5036. args: ["aString"],
  5037. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5038. referencedClasses: [],
  5039. //>>excludeEnd("ide");
  5040. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  5041. messageSends: []
  5042. }, function ($methodClass){ return function (aString){
  5043. var self=this,$self=this;
  5044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5045. return $core.withContext(function($ctx1) {
  5046. //>>excludeEnd("ctx");
  5047. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5048. return self;
  5049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5050. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  5051. //>>excludeEnd("ctx");
  5052. }; }),
  5053. $globals.String);
  5054. $core.addMethod(
  5055. $core.method({
  5056. selector: "==",
  5057. protocol: "comparing",
  5058. //>>excludeStart("ide", pragmas.excludeIdeData);
  5059. args: ["aString"],
  5060. 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'>",
  5061. referencedClasses: [],
  5062. //>>excludeEnd("ide");
  5063. 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;"]]],
  5064. messageSends: []
  5065. }, function ($methodClass){ return function (aString){
  5066. var self=this,$self=this;
  5067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5068. return $core.withContext(function($ctx1) {
  5069. //>>excludeEnd("ctx");
  5070. if (typeof aString === "string") return String(self) === aString;
  5071. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5072. else return false;;
  5073. return self;
  5074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5075. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5076. //>>excludeEnd("ctx");
  5077. }; }),
  5078. $globals.String);
  5079. $core.addMethod(
  5080. $core.method({
  5081. selector: ">",
  5082. protocol: "comparing",
  5083. //>>excludeStart("ide", pragmas.excludeIdeData);
  5084. args: ["aString"],
  5085. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5086. referencedClasses: [],
  5087. //>>excludeEnd("ide");
  5088. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5089. messageSends: []
  5090. }, function ($methodClass){ return function (aString){
  5091. var self=this,$self=this;
  5092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5093. return $core.withContext(function($ctx1) {
  5094. //>>excludeEnd("ctx");
  5095. return String(self) > aString._asString();
  5096. return self;
  5097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5098. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5099. //>>excludeEnd("ctx");
  5100. }; }),
  5101. $globals.String);
  5102. $core.addMethod(
  5103. $core.method({
  5104. selector: ">=",
  5105. protocol: "comparing",
  5106. //>>excludeStart("ide", pragmas.excludeIdeData);
  5107. args: ["aString"],
  5108. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5109. referencedClasses: [],
  5110. //>>excludeEnd("ide");
  5111. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5112. messageSends: []
  5113. }, function ($methodClass){ return function (aString){
  5114. var self=this,$self=this;
  5115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5116. return $core.withContext(function($ctx1) {
  5117. //>>excludeEnd("ctx");
  5118. return String(self) >= aString._asString();
  5119. return self;
  5120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5121. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5122. //>>excludeEnd("ctx");
  5123. }; }),
  5124. $globals.String);
  5125. $core.addMethod(
  5126. $core.method({
  5127. selector: "add:",
  5128. protocol: "adding/removing",
  5129. //>>excludeStart("ide", pragmas.excludeIdeData);
  5130. args: ["anObject"],
  5131. source: "add: anObject\x0a\x09self errorReadOnly",
  5132. referencedClasses: [],
  5133. //>>excludeEnd("ide");
  5134. pragmas: [],
  5135. messageSends: ["errorReadOnly"]
  5136. }, function ($methodClass){ return function (anObject){
  5137. var self=this,$self=this;
  5138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5139. return $core.withContext(function($ctx1) {
  5140. //>>excludeEnd("ctx");
  5141. $self._errorReadOnly();
  5142. return self;
  5143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5144. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5145. //>>excludeEnd("ctx");
  5146. }; }),
  5147. $globals.String);
  5148. $core.addMethod(
  5149. $core.method({
  5150. selector: "asJavaScriptMethodName",
  5151. protocol: "converting",
  5152. //>>excludeStart("ide", pragmas.excludeIdeData);
  5153. args: [],
  5154. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5155. referencedClasses: [],
  5156. //>>excludeEnd("ide");
  5157. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5158. messageSends: []
  5159. }, function ($methodClass){ return function (){
  5160. var self=this,$self=this;
  5161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5162. return $core.withContext(function($ctx1) {
  5163. //>>excludeEnd("ctx");
  5164. return $core.st2js(self);
  5165. return self;
  5166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5167. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5168. //>>excludeEnd("ctx");
  5169. }; }),
  5170. $globals.String);
  5171. $core.addMethod(
  5172. $core.method({
  5173. selector: "asJavaScriptObject",
  5174. protocol: "converting",
  5175. //>>excludeStart("ide", pragmas.excludeIdeData);
  5176. args: [],
  5177. source: "asJavaScriptObject\x0a\x09^ self",
  5178. referencedClasses: [],
  5179. //>>excludeEnd("ide");
  5180. pragmas: [],
  5181. messageSends: []
  5182. }, function ($methodClass){ return function (){
  5183. var self=this,$self=this;
  5184. return self;
  5185. }; }),
  5186. $globals.String);
  5187. $core.addMethod(
  5188. $core.method({
  5189. selector: "asJavaScriptSource",
  5190. protocol: "converting",
  5191. //>>excludeStart("ide", pragmas.excludeIdeData);
  5192. args: [],
  5193. 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'>",
  5194. referencedClasses: [],
  5195. //>>excludeEnd("ide");
  5196. 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"]]],
  5197. messageSends: []
  5198. }, function ($methodClass){ return function (){
  5199. var self=this,$self=this;
  5200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5201. return $core.withContext(function($ctx1) {
  5202. //>>excludeEnd("ctx");
  5203. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5204. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5205. else
  5206. return "\"" + self + "\"";
  5207. ;
  5208. return self;
  5209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5210. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5211. //>>excludeEnd("ctx");
  5212. }; }),
  5213. $globals.String);
  5214. $core.addMethod(
  5215. $core.method({
  5216. selector: "asLowercase",
  5217. protocol: "converting",
  5218. //>>excludeStart("ide", pragmas.excludeIdeData);
  5219. args: [],
  5220. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5221. referencedClasses: [],
  5222. //>>excludeEnd("ide");
  5223. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5224. messageSends: []
  5225. }, function ($methodClass){ return function (){
  5226. var self=this,$self=this;
  5227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5228. return $core.withContext(function($ctx1) {
  5229. //>>excludeEnd("ctx");
  5230. return self.toLowerCase();
  5231. return self;
  5232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5233. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5234. //>>excludeEnd("ctx");
  5235. }; }),
  5236. $globals.String);
  5237. $core.addMethod(
  5238. $core.method({
  5239. selector: "asMutator",
  5240. protocol: "converting",
  5241. //>>excludeStart("ide", pragmas.excludeIdeData);
  5242. args: [],
  5243. 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",
  5244. referencedClasses: [],
  5245. //>>excludeEnd("ide");
  5246. pragmas: [],
  5247. messageSends: ["ifFalse:", "=", "last", ","]
  5248. }, function ($methodClass){ return function (){
  5249. var self=this,$self=this;
  5250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5251. return $core.withContext(function($ctx1) {
  5252. //>>excludeEnd("ctx");
  5253. if(!$core.assert($recv($self._last()).__eq(":"))){
  5254. return $self.__comma(":");
  5255. }
  5256. return self;
  5257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5258. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5259. //>>excludeEnd("ctx");
  5260. }; }),
  5261. $globals.String);
  5262. $core.addMethod(
  5263. $core.method({
  5264. selector: "asNumber",
  5265. protocol: "converting",
  5266. //>>excludeStart("ide", pragmas.excludeIdeData);
  5267. args: [],
  5268. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5269. referencedClasses: [],
  5270. //>>excludeEnd("ide");
  5271. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5272. messageSends: []
  5273. }, function ($methodClass){ return function (){
  5274. var self=this,$self=this;
  5275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5276. return $core.withContext(function($ctx1) {
  5277. //>>excludeEnd("ctx");
  5278. return Number(self);
  5279. return self;
  5280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5281. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5282. //>>excludeEnd("ctx");
  5283. }; }),
  5284. $globals.String);
  5285. $core.addMethod(
  5286. $core.method({
  5287. selector: "asRegexp",
  5288. protocol: "converting",
  5289. //>>excludeStart("ide", pragmas.excludeIdeData);
  5290. args: [],
  5291. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5292. referencedClasses: ["RegularExpression"],
  5293. //>>excludeEnd("ide");
  5294. pragmas: [],
  5295. messageSends: ["fromString:"]
  5296. }, function ($methodClass){ return function (){
  5297. var self=this,$self=this;
  5298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5299. return $core.withContext(function($ctx1) {
  5300. //>>excludeEnd("ctx");
  5301. return $recv($globals.RegularExpression)._fromString_(self);
  5302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5303. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5304. //>>excludeEnd("ctx");
  5305. }; }),
  5306. $globals.String);
  5307. $core.addMethod(
  5308. $core.method({
  5309. selector: "asString",
  5310. protocol: "converting",
  5311. //>>excludeStart("ide", pragmas.excludeIdeData);
  5312. args: [],
  5313. source: "asString\x0a\x09^ self",
  5314. referencedClasses: [],
  5315. //>>excludeEnd("ide");
  5316. pragmas: [],
  5317. messageSends: []
  5318. }, function ($methodClass){ return function (){
  5319. var self=this,$self=this;
  5320. return self;
  5321. }; }),
  5322. $globals.String);
  5323. $core.addMethod(
  5324. $core.method({
  5325. selector: "asSymbol",
  5326. protocol: "converting",
  5327. //>>excludeStart("ide", pragmas.excludeIdeData);
  5328. args: [],
  5329. source: "asSymbol\x0a\x09^ self",
  5330. referencedClasses: [],
  5331. //>>excludeEnd("ide");
  5332. pragmas: [],
  5333. messageSends: []
  5334. }, function ($methodClass){ return function (){
  5335. var self=this,$self=this;
  5336. return self;
  5337. }; }),
  5338. $globals.String);
  5339. $core.addMethod(
  5340. $core.method({
  5341. selector: "asSymbolPrintOn:",
  5342. protocol: "printing",
  5343. //>>excludeStart("ide", pragmas.excludeIdeData);
  5344. args: ["aStream"],
  5345. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5346. referencedClasses: [],
  5347. //>>excludeEnd("ide");
  5348. pragmas: [],
  5349. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5350. }, function ($methodClass){ return function (aStream){
  5351. var self=this,$self=this;
  5352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5353. return $core.withContext(function($ctx1) {
  5354. //>>excludeEnd("ctx");
  5355. $recv(aStream)._nextPutAll_("#");
  5356. if($core.assert($recv($self._asString())._isSelector())){
  5357. $recv(aStream)._nextPut_(self);
  5358. } else {
  5359. $self._printOn_(aStream);
  5360. }
  5361. return self;
  5362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5363. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5364. //>>excludeEnd("ctx");
  5365. }; }),
  5366. $globals.String);
  5367. $core.addMethod(
  5368. $core.method({
  5369. selector: "asUppercase",
  5370. protocol: "converting",
  5371. //>>excludeStart("ide", pragmas.excludeIdeData);
  5372. args: [],
  5373. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5374. referencedClasses: [],
  5375. //>>excludeEnd("ide");
  5376. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5377. messageSends: []
  5378. }, function ($methodClass){ return function (){
  5379. var self=this,$self=this;
  5380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5381. return $core.withContext(function($ctx1) {
  5382. //>>excludeEnd("ctx");
  5383. return self.toUpperCase();
  5384. return self;
  5385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5386. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5387. //>>excludeEnd("ctx");
  5388. }; }),
  5389. $globals.String);
  5390. $core.addMethod(
  5391. $core.method({
  5392. selector: "asciiValue",
  5393. protocol: "accessing",
  5394. //>>excludeStart("ide", pragmas.excludeIdeData);
  5395. args: [],
  5396. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5397. referencedClasses: [],
  5398. //>>excludeEnd("ide");
  5399. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5400. messageSends: []
  5401. }, function ($methodClass){ return function (){
  5402. var self=this,$self=this;
  5403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5404. return $core.withContext(function($ctx1) {
  5405. //>>excludeEnd("ctx");
  5406. return self.charCodeAt(0);;
  5407. return self;
  5408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5409. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5410. //>>excludeEnd("ctx");
  5411. }; }),
  5412. $globals.String);
  5413. $core.addMethod(
  5414. $core.method({
  5415. selector: "at:ifAbsent:",
  5416. protocol: "accessing",
  5417. //>>excludeStart("ide", pragmas.excludeIdeData);
  5418. args: ["anIndex", "aBlock"],
  5419. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5420. referencedClasses: [],
  5421. //>>excludeEnd("ide");
  5422. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5423. messageSends: []
  5424. }, function ($methodClass){ return function (anIndex,aBlock){
  5425. var self=this,$self=this;
  5426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5427. return $core.withContext(function($ctx1) {
  5428. //>>excludeEnd("ctx");
  5429. return String(self)[anIndex - 1] || aBlock._value();
  5430. return self;
  5431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5432. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5433. //>>excludeEnd("ctx");
  5434. }; }),
  5435. $globals.String);
  5436. $core.addMethod(
  5437. $core.method({
  5438. selector: "at:ifPresent:ifAbsent:",
  5439. protocol: "accessing",
  5440. //>>excludeStart("ide", pragmas.excludeIdeData);
  5441. args: ["anIndex", "aBlock", "anotherBlock"],
  5442. 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'>",
  5443. referencedClasses: [],
  5444. //>>excludeEnd("ide");
  5445. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5446. messageSends: []
  5447. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5448. var self=this,$self=this;
  5449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5450. return $core.withContext(function($ctx1) {
  5451. //>>excludeEnd("ctx");
  5452. var result = String(self)[anIndex - 1];
  5453. return result ? aBlock._value_(result) : anotherBlock._value();
  5454. ;
  5455. return self;
  5456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5457. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5458. //>>excludeEnd("ctx");
  5459. }; }),
  5460. $globals.String);
  5461. $core.addMethod(
  5462. $core.method({
  5463. selector: "at:put:",
  5464. protocol: "accessing",
  5465. //>>excludeStart("ide", pragmas.excludeIdeData);
  5466. args: ["anIndex", "anObject"],
  5467. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5468. referencedClasses: [],
  5469. //>>excludeEnd("ide");
  5470. pragmas: [],
  5471. messageSends: ["errorReadOnly"]
  5472. }, function ($methodClass){ return function (anIndex,anObject){
  5473. var self=this,$self=this;
  5474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5475. return $core.withContext(function($ctx1) {
  5476. //>>excludeEnd("ctx");
  5477. $self._errorReadOnly();
  5478. return self;
  5479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5480. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5481. //>>excludeEnd("ctx");
  5482. }; }),
  5483. $globals.String);
  5484. $core.addMethod(
  5485. $core.method({
  5486. selector: "capitalized",
  5487. protocol: "converting",
  5488. //>>excludeStart("ide", pragmas.excludeIdeData);
  5489. args: [],
  5490. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5491. referencedClasses: [],
  5492. //>>excludeEnd("ide");
  5493. pragmas: [],
  5494. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5495. }, function ($methodClass){ return function (){
  5496. var self=this,$self=this;
  5497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5498. return $core.withContext(function($ctx1) {
  5499. //>>excludeEnd("ctx");
  5500. return $self._ifNotEmpty_((function(){
  5501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5502. return $core.withContext(function($ctx2) {
  5503. //>>excludeEnd("ctx");
  5504. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5507. //>>excludeEnd("ctx");
  5508. }));
  5509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5510. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5511. //>>excludeEnd("ctx");
  5512. }; }),
  5513. $globals.String);
  5514. $core.addMethod(
  5515. $core.method({
  5516. selector: "charCodeAt:",
  5517. protocol: "accessing",
  5518. //>>excludeStart("ide", pragmas.excludeIdeData);
  5519. args: ["anInteger"],
  5520. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5521. referencedClasses: [],
  5522. //>>excludeEnd("ide");
  5523. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5524. messageSends: []
  5525. }, function ($methodClass){ return function (anInteger){
  5526. var self=this,$self=this;
  5527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5528. return $core.withContext(function($ctx1) {
  5529. //>>excludeEnd("ctx");
  5530. return self.charCodeAt(anInteger - 1);
  5531. return self;
  5532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5533. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5534. //>>excludeEnd("ctx");
  5535. }; }),
  5536. $globals.String);
  5537. $core.addMethod(
  5538. $core.method({
  5539. selector: "copyFrom:to:",
  5540. protocol: "copying",
  5541. //>>excludeStart("ide", pragmas.excludeIdeData);
  5542. args: ["anIndex", "anotherIndex"],
  5543. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5544. referencedClasses: [],
  5545. //>>excludeEnd("ide");
  5546. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5547. messageSends: []
  5548. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5549. var self=this,$self=this;
  5550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5551. return $core.withContext(function($ctx1) {
  5552. //>>excludeEnd("ctx");
  5553. return self.substring(anIndex - 1, anotherIndex);
  5554. return self;
  5555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5556. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5557. //>>excludeEnd("ctx");
  5558. }; }),
  5559. $globals.String);
  5560. $core.addMethod(
  5561. $core.method({
  5562. selector: "copyWithFirst:",
  5563. protocol: "copying",
  5564. //>>excludeStart("ide", pragmas.excludeIdeData);
  5565. args: ["anObject"],
  5566. source: "copyWithFirst: anObject\x0a\x09(anObject isString and: [ anObject size = 1 ]) \x22character is one-char string in JS\x22\x0a\x09\x09ifFalse: [ self error: 'Cannot put ', anObject class name, ' in a String' ].\x0a\x09^ anObject, self",
  5567. referencedClasses: [],
  5568. //>>excludeEnd("ide");
  5569. pragmas: [],
  5570. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5571. }, function ($methodClass){ return function (anObject){
  5572. var self=this,$self=this;
  5573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5574. return $core.withContext(function($ctx1) {
  5575. //>>excludeEnd("ctx");
  5576. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  5577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5578. return $core.withContext(function($ctx2) {
  5579. //>>excludeEnd("ctx");
  5580. return $recv($recv(anObject)._size()).__eq((1));
  5581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5583. //>>excludeEnd("ctx");
  5584. })))){
  5585. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5587. ,$ctx1.sendIdx[","]=2
  5588. //>>excludeEnd("ctx");
  5589. ][0]).__comma(" in a String")
  5590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5591. ,$ctx1.sendIdx[","]=1
  5592. //>>excludeEnd("ctx");
  5593. ][0]);
  5594. }
  5595. return $recv(anObject).__comma(self);
  5596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5597. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5598. //>>excludeEnd("ctx");
  5599. }; }),
  5600. $globals.String);
  5601. $core.addMethod(
  5602. $core.method({
  5603. selector: "crlfSanitized",
  5604. protocol: "converting",
  5605. //>>excludeStart("ide", pragmas.excludeIdeData);
  5606. args: [],
  5607. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5608. referencedClasses: ["String"],
  5609. //>>excludeEnd("ide");
  5610. pragmas: [],
  5611. messageSends: ["join:", "lines", "lf"]
  5612. }, function ($methodClass){ return function (){
  5613. var self=this,$self=this;
  5614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5615. return $core.withContext(function($ctx1) {
  5616. //>>excludeEnd("ctx");
  5617. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5619. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5620. //>>excludeEnd("ctx");
  5621. }; }),
  5622. $globals.String);
  5623. $core.addMethod(
  5624. $core.method({
  5625. selector: "deepCopy",
  5626. protocol: "copying",
  5627. //>>excludeStart("ide", pragmas.excludeIdeData);
  5628. args: [],
  5629. source: "deepCopy\x0a\x09^ self shallowCopy",
  5630. referencedClasses: [],
  5631. //>>excludeEnd("ide");
  5632. pragmas: [],
  5633. messageSends: ["shallowCopy"]
  5634. }, function ($methodClass){ return function (){
  5635. var self=this,$self=this;
  5636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5637. return $core.withContext(function($ctx1) {
  5638. //>>excludeEnd("ctx");
  5639. return $self._shallowCopy();
  5640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5641. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5642. //>>excludeEnd("ctx");
  5643. }; }),
  5644. $globals.String);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: "errorReadOnly",
  5648. protocol: "error handling",
  5649. //>>excludeStart("ide", pragmas.excludeIdeData);
  5650. args: [],
  5651. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5652. referencedClasses: [],
  5653. //>>excludeEnd("ide");
  5654. pragmas: [],
  5655. messageSends: ["error:"]
  5656. }, function ($methodClass){ return function (){
  5657. var self=this,$self=this;
  5658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5659. return $core.withContext(function($ctx1) {
  5660. //>>excludeEnd("ctx");
  5661. $self._error_("Object is read-only");
  5662. return self;
  5663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5664. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5665. //>>excludeEnd("ctx");
  5666. }; }),
  5667. $globals.String);
  5668. $core.addMethod(
  5669. $core.method({
  5670. selector: "escaped",
  5671. protocol: "converting",
  5672. //>>excludeStart("ide", pragmas.excludeIdeData);
  5673. args: [],
  5674. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5675. referencedClasses: [],
  5676. //>>excludeEnd("ide");
  5677. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5678. messageSends: []
  5679. }, function ($methodClass){ return function (){
  5680. var self=this,$self=this;
  5681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5682. return $core.withContext(function($ctx1) {
  5683. //>>excludeEnd("ctx");
  5684. return escape(self);
  5685. return self;
  5686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5687. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5688. //>>excludeEnd("ctx");
  5689. }; }),
  5690. $globals.String);
  5691. $core.addMethod(
  5692. $core.method({
  5693. selector: "includesSubString:",
  5694. protocol: "testing",
  5695. //>>excludeStart("ide", pragmas.excludeIdeData);
  5696. args: ["subString"],
  5697. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5698. referencedClasses: [],
  5699. //>>excludeEnd("ide");
  5700. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5701. messageSends: []
  5702. }, function ($methodClass){ return function (subString){
  5703. var self=this,$self=this;
  5704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5705. return $core.withContext(function($ctx1) {
  5706. //>>excludeEnd("ctx");
  5707. return self.indexOf(subString) != -1;
  5708. return self;
  5709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5710. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5711. //>>excludeEnd("ctx");
  5712. }; }),
  5713. $globals.String);
  5714. $core.addMethod(
  5715. $core.method({
  5716. selector: "isCapitalized",
  5717. protocol: "testing",
  5718. //>>excludeStart("ide", pragmas.excludeIdeData);
  5719. args: [],
  5720. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5721. referencedClasses: [],
  5722. //>>excludeEnd("ide");
  5723. pragmas: [],
  5724. messageSends: ["==", "asUppercase", "first"]
  5725. }, function ($methodClass){ return function (){
  5726. var self=this,$self=this;
  5727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5728. return $core.withContext(function($ctx1) {
  5729. //>>excludeEnd("ctx");
  5730. return $recv($recv([$self._first()
  5731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5732. ,$ctx1.sendIdx["first"]=1
  5733. //>>excludeEnd("ctx");
  5734. ][0])._asUppercase()).__eq_eq($self._first());
  5735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5736. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5737. //>>excludeEnd("ctx");
  5738. }; }),
  5739. $globals.String);
  5740. $core.addMethod(
  5741. $core.method({
  5742. selector: "isImmutable",
  5743. protocol: "testing",
  5744. //>>excludeStart("ide", pragmas.excludeIdeData);
  5745. args: [],
  5746. source: "isImmutable\x0a\x09^ true",
  5747. referencedClasses: [],
  5748. //>>excludeEnd("ide");
  5749. pragmas: [],
  5750. messageSends: []
  5751. }, function ($methodClass){ return function (){
  5752. var self=this,$self=this;
  5753. return true;
  5754. }; }),
  5755. $globals.String);
  5756. $core.addMethod(
  5757. $core.method({
  5758. selector: "isSelector",
  5759. protocol: "testing",
  5760. //>>excludeStart("ide", pragmas.excludeIdeData);
  5761. args: [],
  5762. 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>",
  5763. referencedClasses: [],
  5764. //>>excludeEnd("ide");
  5765. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5766. messageSends: []
  5767. }, function ($methodClass){ return function (){
  5768. var self=this,$self=this;
  5769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5770. return $core.withContext(function($ctx1) {
  5771. //>>excludeEnd("ctx");
  5772. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5773. return self;
  5774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5775. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5776. //>>excludeEnd("ctx");
  5777. }; }),
  5778. $globals.String);
  5779. $core.addMethod(
  5780. $core.method({
  5781. selector: "isString",
  5782. protocol: "testing",
  5783. //>>excludeStart("ide", pragmas.excludeIdeData);
  5784. args: [],
  5785. source: "isString\x0a\x09^ true",
  5786. referencedClasses: [],
  5787. //>>excludeEnd("ide");
  5788. pragmas: [],
  5789. messageSends: []
  5790. }, function ($methodClass){ return function (){
  5791. var self=this,$self=this;
  5792. return true;
  5793. }; }),
  5794. $globals.String);
  5795. $core.addMethod(
  5796. $core.method({
  5797. selector: "isVowel",
  5798. protocol: "testing",
  5799. //>>excludeStart("ide", pragmas.excludeIdeData);
  5800. args: [],
  5801. 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 ]",
  5802. referencedClasses: [],
  5803. //>>excludeEnd("ide");
  5804. pragmas: [],
  5805. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5806. }, function ($methodClass){ return function (){
  5807. var self=this,$self=this;
  5808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5809. return $core.withContext(function($ctx1) {
  5810. //>>excludeEnd("ctx");
  5811. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5813. return $core.withContext(function($ctx2) {
  5814. //>>excludeEnd("ctx");
  5815. return "aeiou"._includes_($self._asLowercase());
  5816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5817. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5818. //>>excludeEnd("ctx");
  5819. }));
  5820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5821. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5822. //>>excludeEnd("ctx");
  5823. }; }),
  5824. $globals.String);
  5825. $core.addMethod(
  5826. $core.method({
  5827. selector: "join:",
  5828. protocol: "split join",
  5829. //>>excludeStart("ide", pragmas.excludeIdeData);
  5830. args: ["aCollection"],
  5831. 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 ]]",
  5832. referencedClasses: ["String"],
  5833. //>>excludeEnd("ide");
  5834. pragmas: [],
  5835. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5836. }, function ($methodClass){ return function (aCollection){
  5837. var self=this,$self=this;
  5838. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5839. return $core.withContext(function($ctx1) {
  5840. //>>excludeEnd("ctx");
  5841. return $recv($globals.String)._streamContents_((function(stream){
  5842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5843. return $core.withContext(function($ctx2) {
  5844. //>>excludeEnd("ctx");
  5845. return $recv(aCollection)._do_separatedBy_((function(each){
  5846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5847. return $core.withContext(function($ctx3) {
  5848. //>>excludeEnd("ctx");
  5849. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. ,$ctx3.sendIdx["nextPutAll:"]=1
  5852. //>>excludeEnd("ctx");
  5853. ][0];
  5854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5855. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5856. //>>excludeEnd("ctx");
  5857. }),(function(){
  5858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5859. return $core.withContext(function($ctx3) {
  5860. //>>excludeEnd("ctx");
  5861. return $recv(stream)._nextPutAll_(self);
  5862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5863. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5864. //>>excludeEnd("ctx");
  5865. }));
  5866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5867. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5868. //>>excludeEnd("ctx");
  5869. }));
  5870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5871. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5872. //>>excludeEnd("ctx");
  5873. }; }),
  5874. $globals.String);
  5875. $core.addMethod(
  5876. $core.method({
  5877. selector: "lineIndicesDo:",
  5878. protocol: "split join",
  5879. //>>excludeStart("ide", pragmas.excludeIdeData);
  5880. args: ["aBlock"],
  5881. 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 ] ]]",
  5882. referencedClasses: ["String"],
  5883. //>>excludeEnd("ide");
  5884. pragmas: [],
  5885. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5886. }, function ($methodClass){ return function (aBlock){
  5887. var self=this,$self=this;
  5888. var cr,lf,start,sz,nextLF,nextCR;
  5889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5890. return $core.withContext(function($ctx1) {
  5891. //>>excludeEnd("ctx");
  5892. var $early={};
  5893. try {
  5894. start=(1);
  5895. sz=$self._size();
  5896. cr=$recv($globals.String)._cr();
  5897. nextCR=[$self._indexOf_startingAt_(cr,(1))
  5898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5899. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  5900. //>>excludeEnd("ctx");
  5901. ][0];
  5902. lf=$recv($globals.String)._lf();
  5903. nextLF=[$self._indexOf_startingAt_(lf,(1))
  5904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5905. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  5906. //>>excludeEnd("ctx");
  5907. ][0];
  5908. $recv((function(){
  5909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5910. return $core.withContext(function($ctx2) {
  5911. //>>excludeEnd("ctx");
  5912. return $recv(start).__lt_eq(sz);
  5913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5914. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5915. //>>excludeEnd("ctx");
  5916. }))._whileTrue_((function(){
  5917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5918. return $core.withContext(function($ctx2) {
  5919. //>>excludeEnd("ctx");
  5920. if($core.assert([$recv([$recv(nextLF).__eq((0))
  5921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5922. ,$ctx2.sendIdx["="]=1
  5923. //>>excludeEnd("ctx");
  5924. ][0])._and_((function(){
  5925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5926. return $core.withContext(function($ctx3) {
  5927. //>>excludeEnd("ctx");
  5928. return [$recv(nextCR).__eq((0))
  5929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5930. ,$ctx3.sendIdx["="]=2
  5931. //>>excludeEnd("ctx");
  5932. ][0];
  5933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5934. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5935. //>>excludeEnd("ctx");
  5936. }))
  5937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5938. ,$ctx2.sendIdx["and:"]=1
  5939. //>>excludeEnd("ctx");
  5940. ][0])){
  5941. [$recv(aBlock)._value_value_value_(start,sz,sz)
  5942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5943. ,$ctx2.sendIdx["value:value:value:"]=1
  5944. //>>excludeEnd("ctx");
  5945. ][0];
  5946. throw $early=[self];
  5947. }
  5948. if($core.assert($recv([$recv(nextCR).__eq((0))
  5949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5950. ,$ctx2.sendIdx["="]=3
  5951. //>>excludeEnd("ctx");
  5952. ][0])._or_((function(){
  5953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5954. return $core.withContext(function($ctx3) {
  5955. //>>excludeEnd("ctx");
  5956. return $recv([(0).__lt(nextLF)
  5957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5958. ,$ctx3.sendIdx["<"]=1
  5959. //>>excludeEnd("ctx");
  5960. ][0])._and_((function(){
  5961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5962. return $core.withContext(function($ctx4) {
  5963. //>>excludeEnd("ctx");
  5964. return $recv(nextLF).__lt(nextCR);
  5965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5966. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5967. //>>excludeEnd("ctx");
  5968. }));
  5969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5970. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5971. //>>excludeEnd("ctx");
  5972. })))){
  5973. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  5974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5975. ,$ctx2.sendIdx["-"]=1
  5976. //>>excludeEnd("ctx");
  5977. ][0],nextLF)
  5978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5979. ,$ctx2.sendIdx["value:value:value:"]=2
  5980. //>>excludeEnd("ctx");
  5981. ][0];
  5982. start=[(1).__plus(nextLF)
  5983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5984. ,$ctx2.sendIdx["+"]=1
  5985. //>>excludeEnd("ctx");
  5986. ][0];
  5987. nextLF=[$self._indexOf_startingAt_(lf,start)
  5988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5989. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  5990. //>>excludeEnd("ctx");
  5991. ][0];
  5992. return nextLF;
  5993. } else {
  5994. if($core.assert($recv([(1).__plus(nextCR)
  5995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5996. ,$ctx2.sendIdx["+"]=2
  5997. //>>excludeEnd("ctx");
  5998. ][0]).__eq(nextLF))){
  5999. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  6000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6001. ,$ctx2.sendIdx["-"]=2
  6002. //>>excludeEnd("ctx");
  6003. ][0],nextLF)
  6004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6005. ,$ctx2.sendIdx["value:value:value:"]=3
  6006. //>>excludeEnd("ctx");
  6007. ][0];
  6008. start=[(1).__plus(nextLF)
  6009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6010. ,$ctx2.sendIdx["+"]=3
  6011. //>>excludeEnd("ctx");
  6012. ][0];
  6013. nextCR=[$self._indexOf_startingAt_(cr,start)
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  6016. //>>excludeEnd("ctx");
  6017. ][0];
  6018. nextLF=[$self._indexOf_startingAt_(lf,start)
  6019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6020. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  6021. //>>excludeEnd("ctx");
  6022. ][0];
  6023. return nextLF;
  6024. } else {
  6025. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6026. start=(1).__plus(nextCR);
  6027. nextCR=$self._indexOf_startingAt_(cr,start);
  6028. return nextCR;
  6029. }
  6030. }
  6031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6033. //>>excludeEnd("ctx");
  6034. }));
  6035. return self;
  6036. }
  6037. catch(e) {if(e===$early)return e[0]; throw e}
  6038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6039. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  6040. //>>excludeEnd("ctx");
  6041. }; }),
  6042. $globals.String);
  6043. $core.addMethod(
  6044. $core.method({
  6045. selector: "lineNumber:",
  6046. protocol: "split join",
  6047. //>>excludeStart("ide", pragmas.excludeIdeData);
  6048. args: ["anIndex"],
  6049. 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",
  6050. referencedClasses: [],
  6051. //>>excludeEnd("ide");
  6052. pragmas: [],
  6053. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6054. }, function ($methodClass){ return function (anIndex){
  6055. var self=this,$self=this;
  6056. var lineCount;
  6057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6058. return $core.withContext(function($ctx1) {
  6059. //>>excludeEnd("ctx");
  6060. var $early={};
  6061. try {
  6062. lineCount=(0);
  6063. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6065. return $core.withContext(function($ctx2) {
  6066. //>>excludeEnd("ctx");
  6067. lineCount=$recv(lineCount).__plus((1));
  6068. if($core.assert($recv(lineCount).__eq(anIndex))){
  6069. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6070. }
  6071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6072. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6073. //>>excludeEnd("ctx");
  6074. }));
  6075. return nil;
  6076. }
  6077. catch(e) {if(e===$early)return e[0]; throw e}
  6078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6079. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6080. //>>excludeEnd("ctx");
  6081. }; }),
  6082. $globals.String);
  6083. $core.addMethod(
  6084. $core.method({
  6085. selector: "lines",
  6086. protocol: "split join",
  6087. //>>excludeStart("ide", pragmas.excludeIdeData);
  6088. args: [],
  6089. 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'>",
  6090. referencedClasses: [],
  6091. //>>excludeEnd("ide");
  6092. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6093. messageSends: []
  6094. }, function ($methodClass){ return function (){
  6095. var self=this,$self=this;
  6096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6097. return $core.withContext(function($ctx1) {
  6098. //>>excludeEnd("ctx");
  6099. var result = self.split(/\r\n|\r|\n/);
  6100. if (!result[result.length-1]) result.pop();
  6101. return result;;
  6102. return self;
  6103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6104. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6105. //>>excludeEnd("ctx");
  6106. }; }),
  6107. $globals.String);
  6108. $core.addMethod(
  6109. $core.method({
  6110. selector: "linesDo:",
  6111. protocol: "split join",
  6112. //>>excludeStart("ide", pragmas.excludeIdeData);
  6113. args: ["aBlock"],
  6114. 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",
  6115. referencedClasses: [],
  6116. //>>excludeEnd("ide");
  6117. pragmas: [],
  6118. messageSends: ["do:", "lines"]
  6119. }, function ($methodClass){ return function (aBlock){
  6120. var self=this,$self=this;
  6121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6122. return $core.withContext(function($ctx1) {
  6123. //>>excludeEnd("ctx");
  6124. $recv($self._lines())._do_(aBlock);
  6125. return self;
  6126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6127. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6128. //>>excludeEnd("ctx");
  6129. }; }),
  6130. $globals.String);
  6131. $core.addMethod(
  6132. $core.method({
  6133. selector: "match:",
  6134. protocol: "regular expressions",
  6135. //>>excludeStart("ide", pragmas.excludeIdeData);
  6136. args: ["aRegexp"],
  6137. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6138. referencedClasses: [],
  6139. //>>excludeEnd("ide");
  6140. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6141. messageSends: []
  6142. }, function ($methodClass){ return function (aRegexp){
  6143. var self=this,$self=this;
  6144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6145. return $core.withContext(function($ctx1) {
  6146. //>>excludeEnd("ctx");
  6147. return self.search(aRegexp) != -1;
  6148. return self;
  6149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6150. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6151. //>>excludeEnd("ctx");
  6152. }; }),
  6153. $globals.String);
  6154. $core.addMethod(
  6155. $core.method({
  6156. selector: "matchesOf:",
  6157. protocol: "regular expressions",
  6158. //>>excludeStart("ide", pragmas.excludeIdeData);
  6159. args: ["aRegularExpression"],
  6160. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6161. referencedClasses: [],
  6162. //>>excludeEnd("ide");
  6163. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6164. messageSends: []
  6165. }, function ($methodClass){ return function (aRegularExpression){
  6166. var self=this,$self=this;
  6167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6168. return $core.withContext(function($ctx1) {
  6169. //>>excludeEnd("ctx");
  6170. return self.match(aRegularExpression);
  6171. return self;
  6172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6173. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6174. //>>excludeEnd("ctx");
  6175. }; }),
  6176. $globals.String);
  6177. $core.addMethod(
  6178. $core.method({
  6179. selector: "printNl",
  6180. protocol: "printing",
  6181. //>>excludeStart("ide", pragmas.excludeIdeData);
  6182. args: [],
  6183. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6184. referencedClasses: [],
  6185. //>>excludeEnd("ide");
  6186. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6187. messageSends: []
  6188. }, function ($methodClass){ return function (){
  6189. var self=this,$self=this;
  6190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6191. return $core.withContext(function($ctx1) {
  6192. //>>excludeEnd("ctx");
  6193. console.log(self);
  6194. return self;
  6195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6196. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6197. //>>excludeEnd("ctx");
  6198. }; }),
  6199. $globals.String);
  6200. $core.addMethod(
  6201. $core.method({
  6202. selector: "printOn:",
  6203. protocol: "printing",
  6204. //>>excludeStart("ide", pragmas.excludeIdeData);
  6205. args: ["aStream"],
  6206. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6207. referencedClasses: [],
  6208. //>>excludeEnd("ide");
  6209. pragmas: [],
  6210. messageSends: ["nextPutAll:", "replace:with:"]
  6211. }, function ($methodClass){ return function (aStream){
  6212. var self=this,$self=this;
  6213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6214. return $core.withContext(function($ctx1) {
  6215. //>>excludeEnd("ctx");
  6216. [$recv(aStream)._nextPutAll_("'")
  6217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6218. ,$ctx1.sendIdx["nextPutAll:"]=1
  6219. //>>excludeEnd("ctx");
  6220. ][0];
  6221. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6223. ,$ctx1.sendIdx["nextPutAll:"]=2
  6224. //>>excludeEnd("ctx");
  6225. ][0];
  6226. $recv(aStream)._nextPutAll_("'");
  6227. return self;
  6228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6229. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6230. //>>excludeEnd("ctx");
  6231. }; }),
  6232. $globals.String);
  6233. $core.addMethod(
  6234. $core.method({
  6235. selector: "putOn:",
  6236. protocol: "streaming",
  6237. //>>excludeStart("ide", pragmas.excludeIdeData);
  6238. args: ["aStream"],
  6239. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6240. referencedClasses: [],
  6241. //>>excludeEnd("ide");
  6242. pragmas: [],
  6243. messageSends: ["nextPutString:"]
  6244. }, function ($methodClass){ return function (aStream){
  6245. var self=this,$self=this;
  6246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6247. return $core.withContext(function($ctx1) {
  6248. //>>excludeEnd("ctx");
  6249. $recv(aStream)._nextPutString_(self);
  6250. return self;
  6251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6252. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6253. //>>excludeEnd("ctx");
  6254. }; }),
  6255. $globals.String);
  6256. $core.addMethod(
  6257. $core.method({
  6258. selector: "remove:",
  6259. protocol: "adding/removing",
  6260. //>>excludeStart("ide", pragmas.excludeIdeData);
  6261. args: ["anObject"],
  6262. source: "remove: anObject\x0a\x09self errorReadOnly",
  6263. referencedClasses: [],
  6264. //>>excludeEnd("ide");
  6265. pragmas: [],
  6266. messageSends: ["errorReadOnly"]
  6267. }, function ($methodClass){ return function (anObject){
  6268. var self=this,$self=this;
  6269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6270. return $core.withContext(function($ctx1) {
  6271. //>>excludeEnd("ctx");
  6272. $self._errorReadOnly();
  6273. return self;
  6274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6275. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6276. //>>excludeEnd("ctx");
  6277. }; }),
  6278. $globals.String);
  6279. $core.addMethod(
  6280. $core.method({
  6281. selector: "remove:ifAbsent:",
  6282. protocol: "adding/removing",
  6283. //>>excludeStart("ide", pragmas.excludeIdeData);
  6284. args: ["anObject", "aBlock"],
  6285. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6286. referencedClasses: [],
  6287. //>>excludeEnd("ide");
  6288. pragmas: [],
  6289. messageSends: ["errorReadOnly"]
  6290. }, function ($methodClass){ return function (anObject,aBlock){
  6291. var self=this,$self=this;
  6292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6293. return $core.withContext(function($ctx1) {
  6294. //>>excludeEnd("ctx");
  6295. $self._errorReadOnly();
  6296. return self;
  6297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6298. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6299. //>>excludeEnd("ctx");
  6300. }; }),
  6301. $globals.String);
  6302. $core.addMethod(
  6303. $core.method({
  6304. selector: "replace:with:",
  6305. protocol: "regular expressions",
  6306. //>>excludeStart("ide", pragmas.excludeIdeData);
  6307. args: ["aString", "anotherString"],
  6308. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6309. referencedClasses: ["RegularExpression"],
  6310. //>>excludeEnd("ide");
  6311. pragmas: [],
  6312. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6313. }, function ($methodClass){ return function (aString,anotherString){
  6314. var self=this,$self=this;
  6315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6316. return $core.withContext(function($ctx1) {
  6317. //>>excludeEnd("ctx");
  6318. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6320. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6321. //>>excludeEnd("ctx");
  6322. }; }),
  6323. $globals.String);
  6324. $core.addMethod(
  6325. $core.method({
  6326. selector: "replaceRegexp:with:",
  6327. protocol: "regular expressions",
  6328. //>>excludeStart("ide", pragmas.excludeIdeData);
  6329. args: ["aRegexp", "aString"],
  6330. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6331. referencedClasses: [],
  6332. //>>excludeEnd("ide");
  6333. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6334. messageSends: []
  6335. }, function ($methodClass){ return function (aRegexp,aString){
  6336. var self=this,$self=this;
  6337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6338. return $core.withContext(function($ctx1) {
  6339. //>>excludeEnd("ctx");
  6340. return self.replace(aRegexp, aString);
  6341. return self;
  6342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6343. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6344. //>>excludeEnd("ctx");
  6345. }; }),
  6346. $globals.String);
  6347. $core.addMethod(
  6348. $core.method({
  6349. selector: "reversed",
  6350. protocol: "converting",
  6351. //>>excludeStart("ide", pragmas.excludeIdeData);
  6352. args: [],
  6353. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6354. referencedClasses: [],
  6355. //>>excludeEnd("ide");
  6356. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6357. messageSends: []
  6358. }, function ($methodClass){ return function (){
  6359. var self=this,$self=this;
  6360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6361. return $core.withContext(function($ctx1) {
  6362. //>>excludeEnd("ctx");
  6363. return self.split("").reverse().join("");
  6364. return self;
  6365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6366. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6367. //>>excludeEnd("ctx");
  6368. }; }),
  6369. $globals.String);
  6370. $core.addMethod(
  6371. $core.method({
  6372. selector: "shallowCopy",
  6373. protocol: "copying",
  6374. //>>excludeStart("ide", pragmas.excludeIdeData);
  6375. args: [],
  6376. source: "shallowCopy\x0a\x09^ self",
  6377. referencedClasses: [],
  6378. //>>excludeEnd("ide");
  6379. pragmas: [],
  6380. messageSends: []
  6381. }, function ($methodClass){ return function (){
  6382. var self=this,$self=this;
  6383. return self;
  6384. }; }),
  6385. $globals.String);
  6386. $core.addMethod(
  6387. $core.method({
  6388. selector: "subStrings:",
  6389. protocol: "split join",
  6390. //>>excludeStart("ide", pragmas.excludeIdeData);
  6391. args: ["aString"],
  6392. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6393. referencedClasses: [],
  6394. //>>excludeEnd("ide");
  6395. pragmas: [],
  6396. messageSends: ["tokenize:"]
  6397. }, function ($methodClass){ return function (aString){
  6398. var self=this,$self=this;
  6399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6400. return $core.withContext(function($ctx1) {
  6401. //>>excludeEnd("ctx");
  6402. return $self._tokenize_(aString);
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6405. //>>excludeEnd("ctx");
  6406. }; }),
  6407. $globals.String);
  6408. $core.addMethod(
  6409. $core.method({
  6410. selector: "symbolPrintString",
  6411. protocol: "printing",
  6412. //>>excludeStart("ide", pragmas.excludeIdeData);
  6413. args: [],
  6414. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6415. referencedClasses: ["String"],
  6416. //>>excludeEnd("ide");
  6417. pragmas: [],
  6418. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6419. }, function ($methodClass){ return function (){
  6420. var self=this,$self=this;
  6421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6422. return $core.withContext(function($ctx1) {
  6423. //>>excludeEnd("ctx");
  6424. return $recv($globals.String)._streamContents_((function(str){
  6425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6426. return $core.withContext(function($ctx2) {
  6427. //>>excludeEnd("ctx");
  6428. return $self._asSymbolPrintOn_(str);
  6429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6430. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6431. //>>excludeEnd("ctx");
  6432. }));
  6433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6434. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6435. //>>excludeEnd("ctx");
  6436. }; }),
  6437. $globals.String);
  6438. $core.addMethod(
  6439. $core.method({
  6440. selector: "tokenize:",
  6441. protocol: "split join",
  6442. //>>excludeStart("ide", pragmas.excludeIdeData);
  6443. args: ["aString"],
  6444. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6445. referencedClasses: [],
  6446. //>>excludeEnd("ide");
  6447. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6448. messageSends: []
  6449. }, function ($methodClass){ return function (aString){
  6450. var self=this,$self=this;
  6451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6452. return $core.withContext(function($ctx1) {
  6453. //>>excludeEnd("ctx");
  6454. return self.split(aString);
  6455. return self;
  6456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6457. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6458. //>>excludeEnd("ctx");
  6459. }; }),
  6460. $globals.String);
  6461. $core.addMethod(
  6462. $core.method({
  6463. selector: "trimBoth",
  6464. protocol: "regular expressions",
  6465. //>>excludeStart("ide", pragmas.excludeIdeData);
  6466. args: [],
  6467. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6468. referencedClasses: [],
  6469. //>>excludeEnd("ide");
  6470. pragmas: [],
  6471. messageSends: ["trimBoth:"]
  6472. }, function ($methodClass){ return function (){
  6473. var self=this,$self=this;
  6474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6475. return $core.withContext(function($ctx1) {
  6476. //>>excludeEnd("ctx");
  6477. return $self._trimBoth_("\x5cs");
  6478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6479. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6480. //>>excludeEnd("ctx");
  6481. }; }),
  6482. $globals.String);
  6483. $core.addMethod(
  6484. $core.method({
  6485. selector: "trimBoth:",
  6486. protocol: "regular expressions",
  6487. //>>excludeStart("ide", pragmas.excludeIdeData);
  6488. args: ["separators"],
  6489. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6490. referencedClasses: [],
  6491. //>>excludeEnd("ide");
  6492. pragmas: [],
  6493. messageSends: ["trimRight:", "trimLeft:"]
  6494. }, function ($methodClass){ return function (separators){
  6495. var self=this,$self=this;
  6496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6497. return $core.withContext(function($ctx1) {
  6498. //>>excludeEnd("ctx");
  6499. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6501. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6502. //>>excludeEnd("ctx");
  6503. }; }),
  6504. $globals.String);
  6505. $core.addMethod(
  6506. $core.method({
  6507. selector: "trimLeft",
  6508. protocol: "regular expressions",
  6509. //>>excludeStart("ide", pragmas.excludeIdeData);
  6510. args: [],
  6511. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6512. referencedClasses: [],
  6513. //>>excludeEnd("ide");
  6514. pragmas: [],
  6515. messageSends: ["trimLeft:"]
  6516. }, function ($methodClass){ return function (){
  6517. var self=this,$self=this;
  6518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6519. return $core.withContext(function($ctx1) {
  6520. //>>excludeEnd("ctx");
  6521. return $self._trimLeft_("\x5cs");
  6522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6523. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6524. //>>excludeEnd("ctx");
  6525. }; }),
  6526. $globals.String);
  6527. $core.addMethod(
  6528. $core.method({
  6529. selector: "trimLeft:",
  6530. protocol: "regular expressions",
  6531. //>>excludeStart("ide", pragmas.excludeIdeData);
  6532. args: ["separators"],
  6533. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6534. referencedClasses: ["RegularExpression"],
  6535. //>>excludeEnd("ide");
  6536. pragmas: [],
  6537. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6538. }, function ($methodClass){ return function (separators){
  6539. var self=this,$self=this;
  6540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6541. return $core.withContext(function($ctx1) {
  6542. //>>excludeEnd("ctx");
  6543. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6545. ,$ctx1.sendIdx[","]=1
  6546. //>>excludeEnd("ctx");
  6547. ][0],"g"),"");
  6548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6549. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6550. //>>excludeEnd("ctx");
  6551. }; }),
  6552. $globals.String);
  6553. $core.addMethod(
  6554. $core.method({
  6555. selector: "trimRight",
  6556. protocol: "regular expressions",
  6557. //>>excludeStart("ide", pragmas.excludeIdeData);
  6558. args: [],
  6559. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6560. referencedClasses: [],
  6561. //>>excludeEnd("ide");
  6562. pragmas: [],
  6563. messageSends: ["trimRight:"]
  6564. }, function ($methodClass){ return function (){
  6565. var self=this,$self=this;
  6566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6567. return $core.withContext(function($ctx1) {
  6568. //>>excludeEnd("ctx");
  6569. return $self._trimRight_("\x5cs");
  6570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6571. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6572. //>>excludeEnd("ctx");
  6573. }; }),
  6574. $globals.String);
  6575. $core.addMethod(
  6576. $core.method({
  6577. selector: "trimRight:",
  6578. protocol: "regular expressions",
  6579. //>>excludeStart("ide", pragmas.excludeIdeData);
  6580. args: ["separators"],
  6581. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6582. referencedClasses: ["RegularExpression"],
  6583. //>>excludeEnd("ide");
  6584. pragmas: [],
  6585. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6586. }, function ($methodClass){ return function (separators){
  6587. var self=this,$self=this;
  6588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6589. return $core.withContext(function($ctx1) {
  6590. //>>excludeEnd("ctx");
  6591. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6593. ,$ctx1.sendIdx[","]=1
  6594. //>>excludeEnd("ctx");
  6595. ][0],"g"),"");
  6596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6597. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6598. //>>excludeEnd("ctx");
  6599. }; }),
  6600. $globals.String);
  6601. $core.addMethod(
  6602. $core.method({
  6603. selector: "unescaped",
  6604. protocol: "converting",
  6605. //>>excludeStart("ide", pragmas.excludeIdeData);
  6606. args: [],
  6607. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6608. referencedClasses: [],
  6609. //>>excludeEnd("ide");
  6610. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6611. messageSends: []
  6612. }, function ($methodClass){ return function (){
  6613. var self=this,$self=this;
  6614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6615. return $core.withContext(function($ctx1) {
  6616. //>>excludeEnd("ctx");
  6617. return unescape(self);
  6618. return self;
  6619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6620. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6621. //>>excludeEnd("ctx");
  6622. }; }),
  6623. $globals.String);
  6624. $core.addMethod(
  6625. $core.method({
  6626. selector: "uriComponentDecoded",
  6627. protocol: "converting",
  6628. //>>excludeStart("ide", pragmas.excludeIdeData);
  6629. args: [],
  6630. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6631. referencedClasses: [],
  6632. //>>excludeEnd("ide");
  6633. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6634. messageSends: []
  6635. }, function ($methodClass){ return function (){
  6636. var self=this,$self=this;
  6637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6638. return $core.withContext(function($ctx1) {
  6639. //>>excludeEnd("ctx");
  6640. return decodeURIComponent(self);
  6641. return self;
  6642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6643. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6644. //>>excludeEnd("ctx");
  6645. }; }),
  6646. $globals.String);
  6647. $core.addMethod(
  6648. $core.method({
  6649. selector: "uriComponentEncoded",
  6650. protocol: "converting",
  6651. //>>excludeStart("ide", pragmas.excludeIdeData);
  6652. args: [],
  6653. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6654. referencedClasses: [],
  6655. //>>excludeEnd("ide");
  6656. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6657. messageSends: []
  6658. }, function ($methodClass){ return function (){
  6659. var self=this,$self=this;
  6660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6661. return $core.withContext(function($ctx1) {
  6662. //>>excludeEnd("ctx");
  6663. return encodeURIComponent(self);
  6664. return self;
  6665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6666. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6667. //>>excludeEnd("ctx");
  6668. }; }),
  6669. $globals.String);
  6670. $core.addMethod(
  6671. $core.method({
  6672. selector: "uriDecoded",
  6673. protocol: "converting",
  6674. //>>excludeStart("ide", pragmas.excludeIdeData);
  6675. args: [],
  6676. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6677. referencedClasses: [],
  6678. //>>excludeEnd("ide");
  6679. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6680. messageSends: []
  6681. }, function ($methodClass){ return function (){
  6682. var self=this,$self=this;
  6683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6684. return $core.withContext(function($ctx1) {
  6685. //>>excludeEnd("ctx");
  6686. return decodeURI(self);
  6687. return self;
  6688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6689. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6690. //>>excludeEnd("ctx");
  6691. }; }),
  6692. $globals.String);
  6693. $core.addMethod(
  6694. $core.method({
  6695. selector: "uriEncoded",
  6696. protocol: "converting",
  6697. //>>excludeStart("ide", pragmas.excludeIdeData);
  6698. args: [],
  6699. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6700. referencedClasses: [],
  6701. //>>excludeEnd("ide");
  6702. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6703. messageSends: []
  6704. }, function ($methodClass){ return function (){
  6705. var self=this,$self=this;
  6706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6707. return $core.withContext(function($ctx1) {
  6708. //>>excludeEnd("ctx");
  6709. return encodeURI(self);
  6710. return self;
  6711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6712. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6713. //>>excludeEnd("ctx");
  6714. }; }),
  6715. $globals.String);
  6716. $core.addMethod(
  6717. $core.method({
  6718. selector: "value:",
  6719. protocol: "evaluating",
  6720. //>>excludeStart("ide", pragmas.excludeIdeData);
  6721. args: ["anObject"],
  6722. source: "value: anObject \x0a\x09^ anObject perform: self",
  6723. referencedClasses: [],
  6724. //>>excludeEnd("ide");
  6725. pragmas: [],
  6726. messageSends: ["perform:"]
  6727. }, function ($methodClass){ return function (anObject){
  6728. var self=this,$self=this;
  6729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6730. return $core.withContext(function($ctx1) {
  6731. //>>excludeEnd("ctx");
  6732. return $recv(anObject)._perform_(self);
  6733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6734. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6735. //>>excludeEnd("ctx");
  6736. }; }),
  6737. $globals.String);
  6738. $core.addMethod(
  6739. $core.method({
  6740. selector: "cr",
  6741. protocol: "accessing",
  6742. //>>excludeStart("ide", pragmas.excludeIdeData);
  6743. args: [],
  6744. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6745. referencedClasses: [],
  6746. //>>excludeEnd("ide");
  6747. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6748. messageSends: []
  6749. }, function ($methodClass){ return function (){
  6750. var self=this,$self=this;
  6751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6752. return $core.withContext(function($ctx1) {
  6753. //>>excludeEnd("ctx");
  6754. return "\r";
  6755. return self;
  6756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6757. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6758. //>>excludeEnd("ctx");
  6759. }; }),
  6760. $globals.String.a$cls);
  6761. $core.addMethod(
  6762. $core.method({
  6763. selector: "crlf",
  6764. protocol: "accessing",
  6765. //>>excludeStart("ide", pragmas.excludeIdeData);
  6766. args: [],
  6767. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6768. referencedClasses: [],
  6769. //>>excludeEnd("ide");
  6770. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6771. messageSends: []
  6772. }, function ($methodClass){ return function (){
  6773. var self=this,$self=this;
  6774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6775. return $core.withContext(function($ctx1) {
  6776. //>>excludeEnd("ctx");
  6777. return "\r\n";
  6778. return self;
  6779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6780. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6781. //>>excludeEnd("ctx");
  6782. }; }),
  6783. $globals.String.a$cls);
  6784. $core.addMethod(
  6785. $core.method({
  6786. selector: "esc",
  6787. protocol: "accessing",
  6788. //>>excludeStart("ide", pragmas.excludeIdeData);
  6789. args: [],
  6790. source: "esc\x0a\x09^ self fromCharCode: 27",
  6791. referencedClasses: [],
  6792. //>>excludeEnd("ide");
  6793. pragmas: [],
  6794. messageSends: ["fromCharCode:"]
  6795. }, function ($methodClass){ return function (){
  6796. var self=this,$self=this;
  6797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6798. return $core.withContext(function($ctx1) {
  6799. //>>excludeEnd("ctx");
  6800. return $self._fromCharCode_((27));
  6801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6802. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6803. //>>excludeEnd("ctx");
  6804. }; }),
  6805. $globals.String.a$cls);
  6806. $core.addMethod(
  6807. $core.method({
  6808. selector: "fromCharCode:",
  6809. protocol: "instance creation",
  6810. //>>excludeStart("ide", pragmas.excludeIdeData);
  6811. args: ["anInteger"],
  6812. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6813. referencedClasses: [],
  6814. //>>excludeEnd("ide");
  6815. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6816. messageSends: []
  6817. }, function ($methodClass){ return function (anInteger){
  6818. var self=this,$self=this;
  6819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6820. return $core.withContext(function($ctx1) {
  6821. //>>excludeEnd("ctx");
  6822. return String.fromCharCode(anInteger);
  6823. return self;
  6824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6825. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6826. //>>excludeEnd("ctx");
  6827. }; }),
  6828. $globals.String.a$cls);
  6829. $core.addMethod(
  6830. $core.method({
  6831. selector: "fromString:",
  6832. protocol: "instance creation",
  6833. //>>excludeStart("ide", pragmas.excludeIdeData);
  6834. args: ["aString"],
  6835. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6836. referencedClasses: [],
  6837. //>>excludeEnd("ide");
  6838. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6839. messageSends: []
  6840. }, function ($methodClass){ return function (aString){
  6841. var self=this,$self=this;
  6842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6843. return $core.withContext(function($ctx1) {
  6844. //>>excludeEnd("ctx");
  6845. return String(aString);
  6846. return self;
  6847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6848. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6849. //>>excludeEnd("ctx");
  6850. }; }),
  6851. $globals.String.a$cls);
  6852. $core.addMethod(
  6853. $core.method({
  6854. selector: "lf",
  6855. protocol: "accessing",
  6856. //>>excludeStart("ide", pragmas.excludeIdeData);
  6857. args: [],
  6858. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6859. referencedClasses: [],
  6860. //>>excludeEnd("ide");
  6861. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6862. messageSends: []
  6863. }, function ($methodClass){ return function (){
  6864. var self=this,$self=this;
  6865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6866. return $core.withContext(function($ctx1) {
  6867. //>>excludeEnd("ctx");
  6868. return "\n";
  6869. return self;
  6870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6871. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6872. //>>excludeEnd("ctx");
  6873. }; }),
  6874. $globals.String.a$cls);
  6875. $core.addMethod(
  6876. $core.method({
  6877. selector: "random",
  6878. protocol: "random",
  6879. //>>excludeStart("ide", pragmas.excludeIdeData);
  6880. args: [],
  6881. 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);'>",
  6882. referencedClasses: [],
  6883. //>>excludeEnd("ide");
  6884. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6885. messageSends: []
  6886. }, function ($methodClass){ return function (){
  6887. var self=this,$self=this;
  6888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6889. return $core.withContext(function($ctx1) {
  6890. //>>excludeEnd("ctx");
  6891. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6892. return self;
  6893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6894. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6895. //>>excludeEnd("ctx");
  6896. }; }),
  6897. $globals.String.a$cls);
  6898. $core.addMethod(
  6899. $core.method({
  6900. selector: "randomNotIn:",
  6901. protocol: "random",
  6902. //>>excludeStart("ide", pragmas.excludeIdeData);
  6903. args: ["aString"],
  6904. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6905. referencedClasses: [],
  6906. //>>excludeEnd("ide");
  6907. pragmas: [],
  6908. messageSends: ["whileTrue", "random", "includesSubString:"]
  6909. }, function ($methodClass){ return function (aString){
  6910. var self=this,$self=this;
  6911. var result;
  6912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6913. return $core.withContext(function($ctx1) {
  6914. //>>excludeEnd("ctx");
  6915. $recv((function(){
  6916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6917. return $core.withContext(function($ctx2) {
  6918. //>>excludeEnd("ctx");
  6919. result=$self._random();
  6920. return $recv(aString)._includesSubString_(result);
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6923. //>>excludeEnd("ctx");
  6924. }))._whileTrue();
  6925. return result;
  6926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6927. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6928. //>>excludeEnd("ctx");
  6929. }; }),
  6930. $globals.String.a$cls);
  6931. $core.addMethod(
  6932. $core.method({
  6933. selector: "space",
  6934. protocol: "accessing",
  6935. //>>excludeStart("ide", pragmas.excludeIdeData);
  6936. args: [],
  6937. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6938. referencedClasses: [],
  6939. //>>excludeEnd("ide");
  6940. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6941. messageSends: []
  6942. }, function ($methodClass){ return function (){
  6943. var self=this,$self=this;
  6944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6945. return $core.withContext(function($ctx1) {
  6946. //>>excludeEnd("ctx");
  6947. return " ";
  6948. return self;
  6949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6950. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6951. //>>excludeEnd("ctx");
  6952. }; }),
  6953. $globals.String.a$cls);
  6954. $core.addMethod(
  6955. $core.method({
  6956. selector: "streamClass",
  6957. protocol: "accessing",
  6958. //>>excludeStart("ide", pragmas.excludeIdeData);
  6959. args: [],
  6960. source: "streamClass\x0a\x09\x09^ StringStream",
  6961. referencedClasses: ["StringStream"],
  6962. //>>excludeEnd("ide");
  6963. pragmas: [],
  6964. messageSends: []
  6965. }, function ($methodClass){ return function (){
  6966. var self=this,$self=this;
  6967. return $globals.StringStream;
  6968. }; }),
  6969. $globals.String.a$cls);
  6970. $core.addMethod(
  6971. $core.method({
  6972. selector: "tab",
  6973. protocol: "accessing",
  6974. //>>excludeStart("ide", pragmas.excludeIdeData);
  6975. args: [],
  6976. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6977. referencedClasses: [],
  6978. //>>excludeEnd("ide");
  6979. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6980. messageSends: []
  6981. }, function ($methodClass){ return function (){
  6982. var self=this,$self=this;
  6983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6984. return $core.withContext(function($ctx1) {
  6985. //>>excludeEnd("ctx");
  6986. return "\t";
  6987. return self;
  6988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6989. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  6990. //>>excludeEnd("ctx");
  6991. }; }),
  6992. $globals.String.a$cls);
  6993. $core.addMethod(
  6994. $core.method({
  6995. selector: "value:",
  6996. protocol: "instance creation",
  6997. //>>excludeStart("ide", pragmas.excludeIdeData);
  6998. args: ["aUTFCharCode"],
  6999. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7000. referencedClasses: [],
  7001. //>>excludeEnd("ide");
  7002. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  7003. messageSends: []
  7004. }, function ($methodClass){ return function (aUTFCharCode){
  7005. var self=this,$self=this;
  7006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7007. return $core.withContext(function($ctx1) {
  7008. //>>excludeEnd("ctx");
  7009. return String.fromCharCode(aUTFCharCode);;
  7010. return self;
  7011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7012. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  7013. //>>excludeEnd("ctx");
  7014. }; }),
  7015. $globals.String.a$cls);
  7016. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7017. //>>excludeStart("ide", pragmas.excludeIdeData);
  7018. $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`.";
  7019. //>>excludeEnd("ide");
  7020. $core.addMethod(
  7021. $core.method({
  7022. selector: "=",
  7023. protocol: "comparing",
  7024. //>>excludeStart("ide", pragmas.excludeIdeData);
  7025. args: ["aCollection"],
  7026. 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",
  7027. referencedClasses: [],
  7028. //>>excludeEnd("ide");
  7029. pragmas: [],
  7030. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7031. }, function ($methodClass){ return function (aCollection){
  7032. var self=this,$self=this;
  7033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7034. return $core.withContext(function($ctx1) {
  7035. //>>excludeEnd("ctx");
  7036. var $early={};
  7037. try {
  7038. if(!$core.assert([$recv([$self._class()
  7039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7040. ,$ctx1.sendIdx["class"]=1
  7041. //>>excludeEnd("ctx");
  7042. ][0]).__eq($recv(aCollection)._class())
  7043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7044. ,$ctx1.sendIdx["="]=1
  7045. //>>excludeEnd("ctx");
  7046. ][0])){
  7047. return false;
  7048. }
  7049. if(!$core.assert($recv([$self._size()
  7050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7051. ,$ctx1.sendIdx["size"]=1
  7052. //>>excludeEnd("ctx");
  7053. ][0]).__eq($recv(aCollection)._size()))){
  7054. return false;
  7055. }
  7056. $self._do_((function(each){
  7057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7058. return $core.withContext(function($ctx2) {
  7059. //>>excludeEnd("ctx");
  7060. if(!$core.assert($recv(aCollection)._includes_(each))){
  7061. throw $early=[false];
  7062. }
  7063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7064. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7065. //>>excludeEnd("ctx");
  7066. }));
  7067. return true;
  7068. }
  7069. catch(e) {if(e===$early)return e[0]; throw e}
  7070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7071. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7072. //>>excludeEnd("ctx");
  7073. }; }),
  7074. $globals.Set);
  7075. $core.addMethod(
  7076. $core.method({
  7077. selector: "add:",
  7078. protocol: "adding/removing",
  7079. //>>excludeStart("ide", pragmas.excludeIdeData);
  7080. args: ["anObject"],
  7081. 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 ]",
  7082. referencedClasses: [],
  7083. //>>excludeEnd("ide");
  7084. pragmas: [],
  7085. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7086. }, function ($methodClass){ return function (anObject){
  7087. var self=this,$self=this;
  7088. var bucket;
  7089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7090. return $core.withContext(function($ctx1) {
  7091. //>>excludeEnd("ctx");
  7092. var $1;
  7093. bucket=$self._bucketsOfElement_(anObject);
  7094. $1=$recv(bucket)._second();
  7095. if($1 == null || $1.a$nil){
  7096. var object,slowBucket;
  7097. object=[$recv(bucket)._first()
  7098. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7099. ,$ctx1.sendIdx["first"]=1
  7100. //>>excludeEnd("ctx");
  7101. ][0];
  7102. slowBucket=$recv(bucket)._third();
  7103. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7105. return $core.withContext(function($ctx2) {
  7106. //>>excludeEnd("ctx");
  7107. $recv(slowBucket)._add_(object);
  7108. $self.size=$recv($self.size).__plus((1));
  7109. return $self.size;
  7110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7112. //>>excludeEnd("ctx");
  7113. }));
  7114. return object;
  7115. } else {
  7116. var primitiveBucket;
  7117. primitiveBucket=$1;
  7118. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7119. }
  7120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7121. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7122. //>>excludeEnd("ctx");
  7123. }; }),
  7124. $globals.Set);
  7125. $core.addMethod(
  7126. $core.method({
  7127. selector: "add:in:",
  7128. protocol: "private",
  7129. //>>excludeStart("ide", pragmas.excludeIdeData);
  7130. args: ["anObject", "anotherObject"],
  7131. 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'>",
  7132. referencedClasses: [],
  7133. //>>excludeEnd("ide");
  7134. 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"]]],
  7135. messageSends: []
  7136. }, function ($methodClass){ return function (anObject,anotherObject){
  7137. var self=this,$self=this;
  7138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7139. return $core.withContext(function($ctx1) {
  7140. //>>excludeEnd("ctx");
  7141. if (anObject in anotherObject.store) { return anObject; }
  7142. $self.size++;
  7143. anotherObject.store[anObject] = true;
  7144. return anObject;
  7145. ;
  7146. return self;
  7147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7148. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7149. //>>excludeEnd("ctx");
  7150. }; }),
  7151. $globals.Set);
  7152. $core.addMethod(
  7153. $core.method({
  7154. selector: "bucketsOfElement:",
  7155. protocol: "private",
  7156. //>>excludeStart("ide", pragmas.excludeIdeData);
  7157. args: ["anObject"],
  7158. 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'>",
  7159. referencedClasses: [],
  7160. //>>excludeEnd("ide");
  7161. 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"]]],
  7162. messageSends: []
  7163. }, function ($methodClass){ return function (anObject){
  7164. var self=this,$self=this;
  7165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7166. return $core.withContext(function($ctx1) {
  7167. //>>excludeEnd("ctx");
  7168. // include nil to well-known objects under "boolean" fastBucket
  7169. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7170. var prim = anObject.valueOf();
  7171. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7172. var bucket = null;
  7173. $self.slowBucketStores.some(function (store) {
  7174. return bucket = store._bucketOfElement_(anObject);
  7175. });
  7176. return [ anObject, null, bucket || $self.defaultBucket ];
  7177. }
  7178. return [ prim, $self.fastBuckets[typeof prim] ];
  7179. ;
  7180. return self;
  7181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7182. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7183. //>>excludeEnd("ctx");
  7184. }; }),
  7185. $globals.Set);
  7186. $core.addMethod(
  7187. $core.method({
  7188. selector: "classNameOf:",
  7189. protocol: "private",
  7190. //>>excludeStart("ide", pragmas.excludeIdeData);
  7191. args: ["anObject"],
  7192. 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'>",
  7193. referencedClasses: [],
  7194. //>>excludeEnd("ide");
  7195. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7196. messageSends: []
  7197. }, function ($methodClass){ return function (anObject){
  7198. var self=this,$self=this;
  7199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7200. return $core.withContext(function($ctx1) {
  7201. //>>excludeEnd("ctx");
  7202. return anObject.a$cls != null && anObject.a$cls.name;
  7203. return self;
  7204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7205. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7206. //>>excludeEnd("ctx");
  7207. }; }),
  7208. $globals.Set);
  7209. $core.addMethod(
  7210. $core.method({
  7211. selector: "collect:",
  7212. protocol: "enumerating",
  7213. //>>excludeStart("ide", pragmas.excludeIdeData);
  7214. args: ["aBlock"],
  7215. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7216. referencedClasses: [],
  7217. //>>excludeEnd("ide");
  7218. pragmas: [],
  7219. messageSends: ["new", "class", "do:", "add:", "value:"]
  7220. }, function ($methodClass){ return function (aBlock){
  7221. var self=this,$self=this;
  7222. var collection;
  7223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7224. return $core.withContext(function($ctx1) {
  7225. //>>excludeEnd("ctx");
  7226. collection=$recv($self._class())._new();
  7227. $self._do_((function(each){
  7228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7229. return $core.withContext(function($ctx2) {
  7230. //>>excludeEnd("ctx");
  7231. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7233. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7234. //>>excludeEnd("ctx");
  7235. }));
  7236. return collection;
  7237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7238. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7239. //>>excludeEnd("ctx");
  7240. }; }),
  7241. $globals.Set);
  7242. $core.addMethod(
  7243. $core.method({
  7244. selector: "do:",
  7245. protocol: "enumerating",
  7246. //>>excludeStart("ide", pragmas.excludeIdeData);
  7247. args: ["aBlock"],
  7248. 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'>",
  7249. referencedClasses: [],
  7250. //>>excludeEnd("ide");
  7251. 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"]]],
  7252. messageSends: []
  7253. }, function ($methodClass){ return function (aBlock){
  7254. var self=this,$self=this;
  7255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7256. return $core.withContext(function($ctx1) {
  7257. //>>excludeEnd("ctx");
  7258. var el, keys, i;
  7259. el = $self.fastBuckets;
  7260. keys = Object.keys(el);
  7261. for (i = 0; i < keys.length; ++i) {
  7262. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7263. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7264. else { store._do_(aBlock); }
  7265. }
  7266. el = $self.slowBucketStores;
  7267. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7268. $self.defaultBucket._do_(aBlock);
  7269. ;
  7270. return self;
  7271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7272. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7273. //>>excludeEnd("ctx");
  7274. }; }),
  7275. $globals.Set);
  7276. $core.addMethod(
  7277. $core.method({
  7278. selector: "includes:",
  7279. protocol: "testing",
  7280. //>>excludeStart("ide", pragmas.excludeIdeData);
  7281. args: ["anObject"],
  7282. 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 ]",
  7283. referencedClasses: [],
  7284. //>>excludeEnd("ide");
  7285. pragmas: [],
  7286. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7287. }, function ($methodClass){ return function (anObject){
  7288. var self=this,$self=this;
  7289. var bucket;
  7290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7291. return $core.withContext(function($ctx1) {
  7292. //>>excludeEnd("ctx");
  7293. var $1;
  7294. bucket=$self._bucketsOfElement_(anObject);
  7295. $1=$recv(bucket)._second();
  7296. if($1 == null || $1.a$nil){
  7297. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7299. ,$ctx1.sendIdx["first"]=1
  7300. //>>excludeEnd("ctx");
  7301. ][0]);
  7302. } else {
  7303. var primitiveBucket;
  7304. primitiveBucket=$1;
  7305. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7306. }
  7307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7308. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7309. //>>excludeEnd("ctx");
  7310. }; }),
  7311. $globals.Set);
  7312. $core.addMethod(
  7313. $core.method({
  7314. selector: "includes:in:",
  7315. protocol: "private",
  7316. //>>excludeStart("ide", pragmas.excludeIdeData);
  7317. args: ["anObject", "anotherObject"],
  7318. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7319. referencedClasses: [],
  7320. //>>excludeEnd("ide");
  7321. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7322. messageSends: []
  7323. }, function ($methodClass){ return function (anObject,anotherObject){
  7324. var self=this,$self=this;
  7325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7326. return $core.withContext(function($ctx1) {
  7327. //>>excludeEnd("ctx");
  7328. return anObject in anotherObject.store;
  7329. return self;
  7330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7331. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7332. //>>excludeEnd("ctx");
  7333. }; }),
  7334. $globals.Set);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "initialize",
  7338. protocol: "initialization",
  7339. //>>excludeStart("ide", pragmas.excludeIdeData);
  7340. args: [],
  7341. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7342. referencedClasses: [],
  7343. //>>excludeEnd("ide");
  7344. pragmas: [],
  7345. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7346. }, function ($methodClass){ return function (){
  7347. var self=this,$self=this;
  7348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7349. return $core.withContext(function($ctx1) {
  7350. //>>excludeEnd("ctx");
  7351. [(
  7352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7353. $ctx1.supercall = true,
  7354. //>>excludeEnd("ctx");
  7355. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7357. ,$ctx1.supercall = false
  7358. //>>excludeEnd("ctx");
  7359. ][0];
  7360. $self.defaultBucket=[];
  7361. $self._initializeSlowBucketStores();
  7362. $self._removeAll();
  7363. return self;
  7364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7365. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7366. //>>excludeEnd("ctx");
  7367. }; }),
  7368. $globals.Set);
  7369. $core.addMethod(
  7370. $core.method({
  7371. selector: "initializeSlowBucketStores",
  7372. protocol: "initialization",
  7373. //>>excludeStart("ide", pragmas.excludeIdeData);
  7374. args: [],
  7375. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7376. referencedClasses: ["ArrayBucketStore"],
  7377. //>>excludeEnd("ide");
  7378. pragmas: [],
  7379. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7380. }, function ($methodClass){ return function (){
  7381. var self=this,$self=this;
  7382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7383. return $core.withContext(function($ctx1) {
  7384. //>>excludeEnd("ctx");
  7385. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7387. return $core.withContext(function($ctx2) {
  7388. //>>excludeEnd("ctx");
  7389. return $self._classNameOf_(x);
  7390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7391. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7392. //>>excludeEnd("ctx");
  7393. }))
  7394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7395. ,$ctx1.sendIdx["hashBlock:"]=1
  7396. //>>excludeEnd("ctx");
  7397. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7399. return $core.withContext(function($ctx2) {
  7400. //>>excludeEnd("ctx");
  7401. return $self._jsConstructorNameOf_(x);
  7402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7403. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7404. //>>excludeEnd("ctx");
  7405. }))];
  7406. return self;
  7407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7408. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7409. //>>excludeEnd("ctx");
  7410. }; }),
  7411. $globals.Set);
  7412. $core.addMethod(
  7413. $core.method({
  7414. selector: "jsConstructorNameOf:",
  7415. protocol: "private",
  7416. //>>excludeStart("ide", pragmas.excludeIdeData);
  7417. args: ["anObject"],
  7418. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7419. referencedClasses: [],
  7420. //>>excludeEnd("ide");
  7421. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7422. messageSends: []
  7423. }, function ($methodClass){ return function (anObject){
  7424. var self=this,$self=this;
  7425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7426. return $core.withContext(function($ctx1) {
  7427. //>>excludeEnd("ctx");
  7428. return anObject.constructor && anObject.constructor.name;
  7429. return self;
  7430. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7431. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7432. //>>excludeEnd("ctx");
  7433. }; }),
  7434. $globals.Set);
  7435. $core.addMethod(
  7436. $core.method({
  7437. selector: "printOn:",
  7438. protocol: "printing",
  7439. //>>excludeStart("ide", pragmas.excludeIdeData);
  7440. args: ["aStream"],
  7441. 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: ')'",
  7442. referencedClasses: [],
  7443. //>>excludeEnd("ide");
  7444. pragmas: [],
  7445. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7446. }, function ($methodClass){ return function (aStream){
  7447. var self=this,$self=this;
  7448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7449. return $core.withContext(function($ctx1) {
  7450. //>>excludeEnd("ctx");
  7451. [(
  7452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7453. $ctx1.supercall = true,
  7454. //>>excludeEnd("ctx");
  7455. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7457. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7458. //>>excludeEnd("ctx");
  7459. ][0];
  7460. [$recv(aStream)._nextPutAll_(" (")
  7461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7462. ,$ctx1.sendIdx["nextPutAll:"]=1
  7463. //>>excludeEnd("ctx");
  7464. ][0];
  7465. $self._do_separatedBy_((function(each){
  7466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7467. return $core.withContext(function($ctx2) {
  7468. //>>excludeEnd("ctx");
  7469. return $recv(each)._printOn_(aStream);
  7470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7471. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7472. //>>excludeEnd("ctx");
  7473. }),(function(){
  7474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7475. return $core.withContext(function($ctx2) {
  7476. //>>excludeEnd("ctx");
  7477. return [$recv(aStream)._nextPutAll_(" ")
  7478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7479. ,$ctx2.sendIdx["nextPutAll:"]=2
  7480. //>>excludeEnd("ctx");
  7481. ][0];
  7482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7484. //>>excludeEnd("ctx");
  7485. }));
  7486. $recv(aStream)._nextPutAll_(")");
  7487. return self;
  7488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7489. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7490. //>>excludeEnd("ctx");
  7491. }; }),
  7492. $globals.Set);
  7493. $core.addMethod(
  7494. $core.method({
  7495. selector: "remove:ifAbsent:",
  7496. protocol: "adding/removing",
  7497. //>>excludeStart("ide", pragmas.excludeIdeData);
  7498. args: ["anObject", "aBlock"],
  7499. 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 ]",
  7500. referencedClasses: [],
  7501. //>>excludeEnd("ide");
  7502. pragmas: [],
  7503. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7504. }, function ($methodClass){ return function (anObject,aBlock){
  7505. var self=this,$self=this;
  7506. var bucket;
  7507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7508. return $core.withContext(function($ctx1) {
  7509. //>>excludeEnd("ctx");
  7510. var $1;
  7511. var $early={};
  7512. try {
  7513. bucket=$self._bucketsOfElement_(anObject);
  7514. $1=$recv(bucket)._second();
  7515. if($1 == null || $1.a$nil){
  7516. var obj;
  7517. obj=[$recv(bucket)._first()
  7518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7519. ,$ctx1.sendIdx["first"]=1
  7520. //>>excludeEnd("ctx");
  7521. ][0];
  7522. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7524. return $core.withContext(function($ctx2) {
  7525. //>>excludeEnd("ctx");
  7526. throw $early=[$recv(aBlock)._value()];
  7527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7529. //>>excludeEnd("ctx");
  7530. }));
  7531. $self.size=$recv($self.size).__minus((1));
  7532. return obj;
  7533. } else {
  7534. var primitiveBucket;
  7535. primitiveBucket=$1;
  7536. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7537. }
  7538. }
  7539. catch(e) {if(e===$early)return e[0]; throw e}
  7540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7541. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7542. //>>excludeEnd("ctx");
  7543. }; }),
  7544. $globals.Set);
  7545. $core.addMethod(
  7546. $core.method({
  7547. selector: "remove:in:ifAbsent:",
  7548. protocol: "private",
  7549. //>>excludeStart("ide", pragmas.excludeIdeData);
  7550. args: ["anObject", "anotherObject", "aBlock"],
  7551. 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}'>",
  7552. referencedClasses: [],
  7553. //>>excludeEnd("ide");
  7554. 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}"]]],
  7555. messageSends: []
  7556. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7557. var self=this,$self=this;
  7558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7559. return $core.withContext(function($ctx1) {
  7560. //>>excludeEnd("ctx");
  7561. if (anObject in anotherObject.store) {
  7562. delete anotherObject.store[anObject];
  7563. $self.size--;
  7564. return anObject;
  7565. } else {
  7566. return aBlock._value();
  7567. };
  7568. return self;
  7569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7570. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7571. //>>excludeEnd("ctx");
  7572. }; }),
  7573. $globals.Set);
  7574. $core.addMethod(
  7575. $core.method({
  7576. selector: "removeAll",
  7577. protocol: "adding/removing",
  7578. //>>excludeStart("ide", pragmas.excludeIdeData);
  7579. args: [],
  7580. 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'>",
  7581. referencedClasses: [],
  7582. //>>excludeEnd("ide");
  7583. 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"]]],
  7584. messageSends: []
  7585. }, function ($methodClass){ return function (){
  7586. var self=this,$self=this;
  7587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7588. return $core.withContext(function($ctx1) {
  7589. //>>excludeEnd("ctx");
  7590. $self.fastBuckets = {
  7591. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7592. "number": { store: Object.create(null), fn: Number },
  7593. "string": { store: Object.create(null) }
  7594. };
  7595. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7596. $self.defaultBucket._removeAll();
  7597. $self.size = 0;
  7598. ;
  7599. return self;
  7600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7601. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7602. //>>excludeEnd("ctx");
  7603. }; }),
  7604. $globals.Set);
  7605. $core.addMethod(
  7606. $core.method({
  7607. selector: "select:",
  7608. protocol: "enumerating",
  7609. //>>excludeStart("ide", pragmas.excludeIdeData);
  7610. args: ["aBlock"],
  7611. 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",
  7612. referencedClasses: [],
  7613. //>>excludeEnd("ide");
  7614. pragmas: [],
  7615. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7616. }, function ($methodClass){ return function (aBlock){
  7617. var self=this,$self=this;
  7618. var collection;
  7619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7620. return $core.withContext(function($ctx1) {
  7621. //>>excludeEnd("ctx");
  7622. collection=$recv($self._class())._new();
  7623. $self._do_((function(each){
  7624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7625. return $core.withContext(function($ctx2) {
  7626. //>>excludeEnd("ctx");
  7627. if($core.assert($recv(aBlock)._value_(each))){
  7628. return $recv(collection)._add_(each);
  7629. }
  7630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7631. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7632. //>>excludeEnd("ctx");
  7633. }));
  7634. return collection;
  7635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7636. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7637. //>>excludeEnd("ctx");
  7638. }; }),
  7639. $globals.Set);
  7640. $core.addMethod(
  7641. $core.method({
  7642. selector: "select:thenCollect:",
  7643. protocol: "enumerating",
  7644. //>>excludeStart("ide", pragmas.excludeIdeData);
  7645. args: ["selectBlock", "collectBlock"],
  7646. 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",
  7647. referencedClasses: [],
  7648. //>>excludeEnd("ide");
  7649. pragmas: [],
  7650. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7651. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7652. var self=this,$self=this;
  7653. var collection;
  7654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7655. return $core.withContext(function($ctx1) {
  7656. //>>excludeEnd("ctx");
  7657. collection=$recv($self._class())._new();
  7658. $self._do_((function(each){
  7659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7660. return $core.withContext(function($ctx2) {
  7661. //>>excludeEnd("ctx");
  7662. if($core.assert([$recv(selectBlock)._value_(each)
  7663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7664. ,$ctx2.sendIdx["value:"]=1
  7665. //>>excludeEnd("ctx");
  7666. ][0])){
  7667. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7668. }
  7669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7670. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7671. //>>excludeEnd("ctx");
  7672. }));
  7673. return collection;
  7674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7675. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7676. //>>excludeEnd("ctx");
  7677. }; }),
  7678. $globals.Set);
  7679. $core.addMethod(
  7680. $core.method({
  7681. selector: "size",
  7682. protocol: "accessing",
  7683. //>>excludeStart("ide", pragmas.excludeIdeData);
  7684. args: [],
  7685. source: "size\x0a\x09^ size",
  7686. referencedClasses: [],
  7687. //>>excludeEnd("ide");
  7688. pragmas: [],
  7689. messageSends: []
  7690. }, function ($methodClass){ return function (){
  7691. var self=this,$self=this;
  7692. return $self.size;
  7693. }; }),
  7694. $globals.Set);
  7695. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7696. //>>excludeStart("ide", pragmas.excludeIdeData);
  7697. $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.";
  7698. //>>excludeEnd("ide");
  7699. $core.addMethod(
  7700. $core.method({
  7701. selector: "<<",
  7702. protocol: "writing",
  7703. //>>excludeStart("ide", pragmas.excludeIdeData);
  7704. args: ["anObject"],
  7705. source: "<< anObject\x0a\x09self write: anObject",
  7706. referencedClasses: [],
  7707. //>>excludeEnd("ide");
  7708. pragmas: [],
  7709. messageSends: ["write:"]
  7710. }, function ($methodClass){ return function (anObject){
  7711. var self=this,$self=this;
  7712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7713. return $core.withContext(function($ctx1) {
  7714. //>>excludeEnd("ctx");
  7715. $self._write_(anObject);
  7716. return self;
  7717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7718. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7719. //>>excludeEnd("ctx");
  7720. }; }),
  7721. $globals.ProtoStream);
  7722. $core.addMethod(
  7723. $core.method({
  7724. selector: "atEnd",
  7725. protocol: "testing",
  7726. //>>excludeStart("ide", pragmas.excludeIdeData);
  7727. args: [],
  7728. source: "atEnd\x0a\x09self subclassResponsibility",
  7729. referencedClasses: [],
  7730. //>>excludeEnd("ide");
  7731. pragmas: [],
  7732. messageSends: ["subclassResponsibility"]
  7733. }, function ($methodClass){ return function (){
  7734. var self=this,$self=this;
  7735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7736. return $core.withContext(function($ctx1) {
  7737. //>>excludeEnd("ctx");
  7738. $self._subclassResponsibility();
  7739. return self;
  7740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7741. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7742. //>>excludeEnd("ctx");
  7743. }; }),
  7744. $globals.ProtoStream);
  7745. $core.addMethod(
  7746. $core.method({
  7747. selector: "atStart",
  7748. protocol: "testing",
  7749. //>>excludeStart("ide", pragmas.excludeIdeData);
  7750. args: [],
  7751. source: "atStart\x0a\x09self subclassResponsibility",
  7752. referencedClasses: [],
  7753. //>>excludeEnd("ide");
  7754. pragmas: [],
  7755. messageSends: ["subclassResponsibility"]
  7756. }, function ($methodClass){ return function (){
  7757. var self=this,$self=this;
  7758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7759. return $core.withContext(function($ctx1) {
  7760. //>>excludeEnd("ctx");
  7761. $self._subclassResponsibility();
  7762. return self;
  7763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7764. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7765. //>>excludeEnd("ctx");
  7766. }; }),
  7767. $globals.ProtoStream);
  7768. $core.addMethod(
  7769. $core.method({
  7770. selector: "contents",
  7771. protocol: "accessing",
  7772. //>>excludeStart("ide", pragmas.excludeIdeData);
  7773. args: [],
  7774. source: "contents\x0a\x09self subclassResponsibility",
  7775. referencedClasses: [],
  7776. //>>excludeEnd("ide");
  7777. pragmas: [],
  7778. messageSends: ["subclassResponsibility"]
  7779. }, function ($methodClass){ return function (){
  7780. var self=this,$self=this;
  7781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7782. return $core.withContext(function($ctx1) {
  7783. //>>excludeEnd("ctx");
  7784. $self._subclassResponsibility();
  7785. return self;
  7786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7787. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7788. //>>excludeEnd("ctx");
  7789. }; }),
  7790. $globals.ProtoStream);
  7791. $core.addMethod(
  7792. $core.method({
  7793. selector: "do:",
  7794. protocol: "enumerating",
  7795. //>>excludeStart("ide", pragmas.excludeIdeData);
  7796. args: ["aBlock"],
  7797. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7798. referencedClasses: [],
  7799. //>>excludeEnd("ide");
  7800. pragmas: [],
  7801. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7802. }, function ($methodClass){ return function (aBlock){
  7803. var self=this,$self=this;
  7804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7805. return $core.withContext(function($ctx1) {
  7806. //>>excludeEnd("ctx");
  7807. $recv((function(){
  7808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7809. return $core.withContext(function($ctx2) {
  7810. //>>excludeEnd("ctx");
  7811. return $self._atEnd();
  7812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7814. //>>excludeEnd("ctx");
  7815. }))._whileFalse_((function(){
  7816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7817. return $core.withContext(function($ctx2) {
  7818. //>>excludeEnd("ctx");
  7819. return $recv(aBlock)._value_($self._next());
  7820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7821. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7822. //>>excludeEnd("ctx");
  7823. }));
  7824. return self;
  7825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7826. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7827. //>>excludeEnd("ctx");
  7828. }; }),
  7829. $globals.ProtoStream);
  7830. $core.addMethod(
  7831. $core.method({
  7832. selector: "isEmpty",
  7833. protocol: "testing",
  7834. //>>excludeStart("ide", pragmas.excludeIdeData);
  7835. args: [],
  7836. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7837. referencedClasses: [],
  7838. //>>excludeEnd("ide");
  7839. pragmas: [],
  7840. messageSends: ["and:", "atStart", "atEnd"]
  7841. }, function ($methodClass){ return function (){
  7842. var self=this,$self=this;
  7843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7844. return $core.withContext(function($ctx1) {
  7845. //>>excludeEnd("ctx");
  7846. return $recv($self._atStart())._and_((function(){
  7847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7848. return $core.withContext(function($ctx2) {
  7849. //>>excludeEnd("ctx");
  7850. return $self._atEnd();
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7853. //>>excludeEnd("ctx");
  7854. }));
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7857. //>>excludeEnd("ctx");
  7858. }; }),
  7859. $globals.ProtoStream);
  7860. $core.addMethod(
  7861. $core.method({
  7862. selector: "next",
  7863. protocol: "reading",
  7864. //>>excludeStart("ide", pragmas.excludeIdeData);
  7865. args: [],
  7866. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7867. referencedClasses: [],
  7868. //>>excludeEnd("ide");
  7869. pragmas: [],
  7870. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7871. }, function ($methodClass){ return function (){
  7872. var self=this,$self=this;
  7873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7874. return $core.withContext(function($ctx1) {
  7875. //>>excludeEnd("ctx");
  7876. if($core.assert($self._atEnd())){
  7877. return nil;
  7878. } else {
  7879. return $self._subclassResponsibility();
  7880. }
  7881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7882. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7883. //>>excludeEnd("ctx");
  7884. }; }),
  7885. $globals.ProtoStream);
  7886. $core.addMethod(
  7887. $core.method({
  7888. selector: "nextPut:",
  7889. protocol: "writing",
  7890. //>>excludeStart("ide", pragmas.excludeIdeData);
  7891. args: ["anObject"],
  7892. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7893. referencedClasses: [],
  7894. //>>excludeEnd("ide");
  7895. pragmas: [],
  7896. messageSends: ["subclassResponsibility"]
  7897. }, function ($methodClass){ return function (anObject){
  7898. var self=this,$self=this;
  7899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7900. return $core.withContext(function($ctx1) {
  7901. //>>excludeEnd("ctx");
  7902. $self._subclassResponsibility();
  7903. return self;
  7904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7905. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7906. //>>excludeEnd("ctx");
  7907. }; }),
  7908. $globals.ProtoStream);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "nextPutAll:",
  7912. protocol: "writing",
  7913. //>>excludeStart("ide", pragmas.excludeIdeData);
  7914. args: ["aCollection"],
  7915. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7916. referencedClasses: [],
  7917. //>>excludeEnd("ide");
  7918. pragmas: [],
  7919. messageSends: ["do:", "nextPut:"]
  7920. }, function ($methodClass){ return function (aCollection){
  7921. var self=this,$self=this;
  7922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7923. return $core.withContext(function($ctx1) {
  7924. //>>excludeEnd("ctx");
  7925. $recv(aCollection)._do_((function(each){
  7926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7927. return $core.withContext(function($ctx2) {
  7928. //>>excludeEnd("ctx");
  7929. return $self._nextPut_(each);
  7930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7932. //>>excludeEnd("ctx");
  7933. }));
  7934. return self;
  7935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7936. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7937. //>>excludeEnd("ctx");
  7938. }; }),
  7939. $globals.ProtoStream);
  7940. $core.addMethod(
  7941. $core.method({
  7942. selector: "nextPutString:",
  7943. protocol: "writing",
  7944. //>>excludeStart("ide", pragmas.excludeIdeData);
  7945. args: ["aString"],
  7946. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7947. referencedClasses: [],
  7948. //>>excludeEnd("ide");
  7949. pragmas: [],
  7950. messageSends: ["nextPut:"]
  7951. }, function ($methodClass){ return function (aString){
  7952. var self=this,$self=this;
  7953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7954. return $core.withContext(function($ctx1) {
  7955. //>>excludeEnd("ctx");
  7956. $self._nextPut_(aString);
  7957. return self;
  7958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7959. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7960. //>>excludeEnd("ctx");
  7961. }; }),
  7962. $globals.ProtoStream);
  7963. $core.addMethod(
  7964. $core.method({
  7965. selector: "peek",
  7966. protocol: "reading",
  7967. //>>excludeStart("ide", pragmas.excludeIdeData);
  7968. args: [],
  7969. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7970. referencedClasses: [],
  7971. //>>excludeEnd("ide");
  7972. pragmas: [],
  7973. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7974. }, function ($methodClass){ return function (){
  7975. var self=this,$self=this;
  7976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7977. return $core.withContext(function($ctx1) {
  7978. //>>excludeEnd("ctx");
  7979. if($core.assert($self._atEnd())){
  7980. return nil;
  7981. } else {
  7982. return $self._subclassResponsibility();
  7983. }
  7984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7985. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  7986. //>>excludeEnd("ctx");
  7987. }; }),
  7988. $globals.ProtoStream);
  7989. $core.addMethod(
  7990. $core.method({
  7991. selector: "reset",
  7992. protocol: "actions",
  7993. //>>excludeStart("ide", pragmas.excludeIdeData);
  7994. args: [],
  7995. source: "reset\x0a\x09self subclassResponsibility",
  7996. referencedClasses: [],
  7997. //>>excludeEnd("ide");
  7998. pragmas: [],
  7999. messageSends: ["subclassResponsibility"]
  8000. }, function ($methodClass){ return function (){
  8001. var self=this,$self=this;
  8002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8003. return $core.withContext(function($ctx1) {
  8004. //>>excludeEnd("ctx");
  8005. $self._subclassResponsibility();
  8006. return self;
  8007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8008. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8009. //>>excludeEnd("ctx");
  8010. }; }),
  8011. $globals.ProtoStream);
  8012. $core.addMethod(
  8013. $core.method({
  8014. selector: "resetContents",
  8015. protocol: "actions",
  8016. //>>excludeStart("ide", pragmas.excludeIdeData);
  8017. args: [],
  8018. source: "resetContents\x0a\x09self subclassResponsibility",
  8019. referencedClasses: [],
  8020. //>>excludeEnd("ide");
  8021. pragmas: [],
  8022. messageSends: ["subclassResponsibility"]
  8023. }, function ($methodClass){ return function (){
  8024. var self=this,$self=this;
  8025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8026. return $core.withContext(function($ctx1) {
  8027. //>>excludeEnd("ctx");
  8028. $self._subclassResponsibility();
  8029. return self;
  8030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8031. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8032. //>>excludeEnd("ctx");
  8033. }; }),
  8034. $globals.ProtoStream);
  8035. $core.addMethod(
  8036. $core.method({
  8037. selector: "setToEnd",
  8038. protocol: "positioning",
  8039. //>>excludeStart("ide", pragmas.excludeIdeData);
  8040. args: [],
  8041. source: "setToEnd\x0a\x09self subclassResponsibility",
  8042. referencedClasses: [],
  8043. //>>excludeEnd("ide");
  8044. pragmas: [],
  8045. messageSends: ["subclassResponsibility"]
  8046. }, function ($methodClass){ return function (){
  8047. var self=this,$self=this;
  8048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8049. return $core.withContext(function($ctx1) {
  8050. //>>excludeEnd("ctx");
  8051. $self._subclassResponsibility();
  8052. return self;
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8055. //>>excludeEnd("ctx");
  8056. }; }),
  8057. $globals.ProtoStream);
  8058. $core.addMethod(
  8059. $core.method({
  8060. selector: "setToStart",
  8061. protocol: "positioning",
  8062. //>>excludeStart("ide", pragmas.excludeIdeData);
  8063. args: [],
  8064. source: "setToStart\x0a\x09self reset",
  8065. referencedClasses: [],
  8066. //>>excludeEnd("ide");
  8067. pragmas: [],
  8068. messageSends: ["reset"]
  8069. }, function ($methodClass){ return function (){
  8070. var self=this,$self=this;
  8071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8072. return $core.withContext(function($ctx1) {
  8073. //>>excludeEnd("ctx");
  8074. $self._reset();
  8075. return self;
  8076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8077. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8078. //>>excludeEnd("ctx");
  8079. }; }),
  8080. $globals.ProtoStream);
  8081. $core.addMethod(
  8082. $core.method({
  8083. selector: "write:",
  8084. protocol: "writing",
  8085. //>>excludeStart("ide", pragmas.excludeIdeData);
  8086. args: ["anObject"],
  8087. source: "write: anObject\x0a\x09anObject putOn: self",
  8088. referencedClasses: [],
  8089. //>>excludeEnd("ide");
  8090. pragmas: [],
  8091. messageSends: ["putOn:"]
  8092. }, function ($methodClass){ return function (anObject){
  8093. var self=this,$self=this;
  8094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8095. return $core.withContext(function($ctx1) {
  8096. //>>excludeEnd("ctx");
  8097. $recv(anObject)._putOn_(self);
  8098. return self;
  8099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8100. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8101. //>>excludeEnd("ctx");
  8102. }; }),
  8103. $globals.ProtoStream);
  8104. $core.addMethod(
  8105. $core.method({
  8106. selector: "on:",
  8107. protocol: "instance creation",
  8108. //>>excludeStart("ide", pragmas.excludeIdeData);
  8109. args: ["aCollection"],
  8110. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8111. referencedClasses: [],
  8112. //>>excludeEnd("ide");
  8113. pragmas: [],
  8114. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8115. }, function ($methodClass){ return function (aCollection){
  8116. var self=this,$self=this;
  8117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8118. return $core.withContext(function($ctx1) {
  8119. //>>excludeEnd("ctx");
  8120. var $1;
  8121. $1=$self._new();
  8122. $recv($1)._setCollection_(aCollection);
  8123. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8124. return $recv($1)._yourself();
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8127. //>>excludeEnd("ctx");
  8128. }; }),
  8129. $globals.ProtoStream.a$cls);
  8130. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8131. //>>excludeStart("ide", pragmas.excludeIdeData);
  8132. $globals.Stream.comment="I represent an accessor for a sequence of objects. This sequence is referred to as my \x22contents\x22.\x0aMy instances are read/write streams to the contents sequence collection.";
  8133. //>>excludeEnd("ide");
  8134. $core.addMethod(
  8135. $core.method({
  8136. selector: "atEnd",
  8137. protocol: "testing",
  8138. //>>excludeStart("ide", pragmas.excludeIdeData);
  8139. args: [],
  8140. source: "atEnd\x0a\x09^ self position = self size",
  8141. referencedClasses: [],
  8142. //>>excludeEnd("ide");
  8143. pragmas: [],
  8144. messageSends: ["=", "position", "size"]
  8145. }, function ($methodClass){ return function (){
  8146. var self=this,$self=this;
  8147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8148. return $core.withContext(function($ctx1) {
  8149. //>>excludeEnd("ctx");
  8150. return $recv($self._position()).__eq($self._size());
  8151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8152. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8153. //>>excludeEnd("ctx");
  8154. }; }),
  8155. $globals.Stream);
  8156. $core.addMethod(
  8157. $core.method({
  8158. selector: "atStart",
  8159. protocol: "testing",
  8160. //>>excludeStart("ide", pragmas.excludeIdeData);
  8161. args: [],
  8162. source: "atStart\x0a\x09^ self position = 0",
  8163. referencedClasses: [],
  8164. //>>excludeEnd("ide");
  8165. pragmas: [],
  8166. messageSends: ["=", "position"]
  8167. }, function ($methodClass){ return function (){
  8168. var self=this,$self=this;
  8169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8170. return $core.withContext(function($ctx1) {
  8171. //>>excludeEnd("ctx");
  8172. return $recv($self._position()).__eq((0));
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8175. //>>excludeEnd("ctx");
  8176. }; }),
  8177. $globals.Stream);
  8178. $core.addMethod(
  8179. $core.method({
  8180. selector: "close",
  8181. protocol: "actions",
  8182. //>>excludeStart("ide", pragmas.excludeIdeData);
  8183. args: [],
  8184. source: "close",
  8185. referencedClasses: [],
  8186. //>>excludeEnd("ide");
  8187. pragmas: [],
  8188. messageSends: []
  8189. }, function ($methodClass){ return function (){
  8190. var self=this,$self=this;
  8191. return self;
  8192. }; }),
  8193. $globals.Stream);
  8194. $core.addMethod(
  8195. $core.method({
  8196. selector: "collection",
  8197. protocol: "accessing",
  8198. //>>excludeStart("ide", pragmas.excludeIdeData);
  8199. args: [],
  8200. source: "collection\x0a\x09^ collection",
  8201. referencedClasses: [],
  8202. //>>excludeEnd("ide");
  8203. pragmas: [],
  8204. messageSends: []
  8205. }, function ($methodClass){ return function (){
  8206. var self=this,$self=this;
  8207. return $self.collection;
  8208. }; }),
  8209. $globals.Stream);
  8210. $core.addMethod(
  8211. $core.method({
  8212. selector: "contents",
  8213. protocol: "accessing",
  8214. //>>excludeStart("ide", pragmas.excludeIdeData);
  8215. args: [],
  8216. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8217. referencedClasses: [],
  8218. //>>excludeEnd("ide");
  8219. pragmas: [],
  8220. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8221. }, function ($methodClass){ return function (){
  8222. var self=this,$self=this;
  8223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8224. return $core.withContext(function($ctx1) {
  8225. //>>excludeEnd("ctx");
  8226. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  8227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8228. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8229. //>>excludeEnd("ctx");
  8230. }; }),
  8231. $globals.Stream);
  8232. $core.addMethod(
  8233. $core.method({
  8234. selector: "flush",
  8235. protocol: "actions",
  8236. //>>excludeStart("ide", pragmas.excludeIdeData);
  8237. args: [],
  8238. source: "flush",
  8239. referencedClasses: [],
  8240. //>>excludeEnd("ide");
  8241. pragmas: [],
  8242. messageSends: []
  8243. }, function ($methodClass){ return function (){
  8244. var self=this,$self=this;
  8245. return self;
  8246. }; }),
  8247. $globals.Stream);
  8248. $core.addMethod(
  8249. $core.method({
  8250. selector: "isEmpty",
  8251. protocol: "testing",
  8252. //>>excludeStart("ide", pragmas.excludeIdeData);
  8253. args: [],
  8254. source: "isEmpty\x0a\x09^ self size = 0",
  8255. referencedClasses: [],
  8256. //>>excludeEnd("ide");
  8257. pragmas: [],
  8258. messageSends: ["=", "size"]
  8259. }, function ($methodClass){ return function (){
  8260. var self=this,$self=this;
  8261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8262. return $core.withContext(function($ctx1) {
  8263. //>>excludeEnd("ctx");
  8264. return $recv($self._size()).__eq((0));
  8265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8266. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8267. //>>excludeEnd("ctx");
  8268. }; }),
  8269. $globals.Stream);
  8270. $core.addMethod(
  8271. $core.method({
  8272. selector: "next",
  8273. protocol: "reading",
  8274. //>>excludeStart("ide", pragmas.excludeIdeData);
  8275. args: [],
  8276. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09self position: self position + 1.\x0a\x09\x09\x09collection at: self position ]",
  8277. referencedClasses: [],
  8278. //>>excludeEnd("ide");
  8279. pragmas: [],
  8280. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8281. }, function ($methodClass){ return function (){
  8282. var self=this,$self=this;
  8283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8284. return $core.withContext(function($ctx1) {
  8285. //>>excludeEnd("ctx");
  8286. if($core.assert($self._atEnd())){
  8287. return nil;
  8288. } else {
  8289. $self._position_($recv([$self._position()
  8290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8291. ,$ctx1.sendIdx["position"]=1
  8292. //>>excludeEnd("ctx");
  8293. ][0]).__plus((1)));
  8294. return $recv($self.collection)._at_($self._position());
  8295. }
  8296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8297. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8298. //>>excludeEnd("ctx");
  8299. }; }),
  8300. $globals.Stream);
  8301. $core.addMethod(
  8302. $core.method({
  8303. selector: "next:",
  8304. protocol: "reading",
  8305. //>>excludeStart("ide", pragmas.excludeIdeData);
  8306. args: ["anInteger"],
  8307. 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",
  8308. referencedClasses: [],
  8309. //>>excludeEnd("ide");
  8310. pragmas: [],
  8311. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8312. }, function ($methodClass){ return function (anInteger){
  8313. var self=this,$self=this;
  8314. var tempCollection;
  8315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8316. return $core.withContext(function($ctx1) {
  8317. //>>excludeEnd("ctx");
  8318. tempCollection=$recv($recv($self._collection())._class())._new();
  8319. $recv(anInteger)._timesRepeat_((function(){
  8320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8321. return $core.withContext(function($ctx2) {
  8322. //>>excludeEnd("ctx");
  8323. if(!$core.assert($self._atEnd())){
  8324. return $recv(tempCollection)._add_($self._next());
  8325. }
  8326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8328. //>>excludeEnd("ctx");
  8329. }));
  8330. return tempCollection;
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8333. //>>excludeEnd("ctx");
  8334. }; }),
  8335. $globals.Stream);
  8336. $core.addMethod(
  8337. $core.method({
  8338. selector: "nextPut:",
  8339. protocol: "writing",
  8340. //>>excludeStart("ide", pragmas.excludeIdeData);
  8341. args: ["anObject"],
  8342. 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)",
  8343. referencedClasses: [],
  8344. //>>excludeEnd("ide");
  8345. pragmas: [],
  8346. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8347. }, function ($methodClass){ return function (anObject){
  8348. var self=this,$self=this;
  8349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8350. return $core.withContext(function($ctx1) {
  8351. //>>excludeEnd("ctx");
  8352. $self._position_($recv([$self._position()
  8353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8354. ,$ctx1.sendIdx["position"]=1
  8355. //>>excludeEnd("ctx");
  8356. ][0]).__plus((1)));
  8357. $recv($self._collection())._at_put_([$self._position()
  8358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8359. ,$ctx1.sendIdx["position"]=2
  8360. //>>excludeEnd("ctx");
  8361. ][0],anObject);
  8362. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8363. return self;
  8364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8365. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8366. //>>excludeEnd("ctx");
  8367. }; }),
  8368. $globals.Stream);
  8369. $core.addMethod(
  8370. $core.method({
  8371. selector: "peek",
  8372. protocol: "reading",
  8373. //>>excludeStart("ide", pragmas.excludeIdeData);
  8374. args: [],
  8375. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8376. referencedClasses: [],
  8377. //>>excludeEnd("ide");
  8378. pragmas: [],
  8379. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8380. }, function ($methodClass){ return function (){
  8381. var self=this,$self=this;
  8382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8383. return $core.withContext(function($ctx1) {
  8384. //>>excludeEnd("ctx");
  8385. if(!$core.assert($self._atEnd())){
  8386. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8387. }
  8388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8389. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8390. //>>excludeEnd("ctx");
  8391. }; }),
  8392. $globals.Stream);
  8393. $core.addMethod(
  8394. $core.method({
  8395. selector: "position",
  8396. protocol: "accessing",
  8397. //>>excludeStart("ide", pragmas.excludeIdeData);
  8398. args: [],
  8399. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8400. referencedClasses: [],
  8401. //>>excludeEnd("ide");
  8402. pragmas: [],
  8403. messageSends: ["ifNil:"]
  8404. }, function ($methodClass){ return function (){
  8405. var self=this,$self=this;
  8406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8407. return $core.withContext(function($ctx1) {
  8408. //>>excludeEnd("ctx");
  8409. var $1;
  8410. $1=$self.position;
  8411. if($1 == null || $1.a$nil){
  8412. $self.position=(0);
  8413. return $self.position;
  8414. } else {
  8415. return $1;
  8416. }
  8417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8418. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8419. //>>excludeEnd("ctx");
  8420. }; }),
  8421. $globals.Stream);
  8422. $core.addMethod(
  8423. $core.method({
  8424. selector: "position:",
  8425. protocol: "accessing",
  8426. //>>excludeStart("ide", pragmas.excludeIdeData);
  8427. args: ["anInteger"],
  8428. source: "position: anInteger\x0a\x09position := anInteger",
  8429. referencedClasses: [],
  8430. //>>excludeEnd("ide");
  8431. pragmas: [],
  8432. messageSends: []
  8433. }, function ($methodClass){ return function (anInteger){
  8434. var self=this,$self=this;
  8435. $self.position=anInteger;
  8436. return self;
  8437. }; }),
  8438. $globals.Stream);
  8439. $core.addMethod(
  8440. $core.method({
  8441. selector: "reset",
  8442. protocol: "actions",
  8443. //>>excludeStart("ide", pragmas.excludeIdeData);
  8444. args: [],
  8445. source: "reset\x0a\x09self position: 0",
  8446. referencedClasses: [],
  8447. //>>excludeEnd("ide");
  8448. pragmas: [],
  8449. messageSends: ["position:"]
  8450. }, function ($methodClass){ return function (){
  8451. var self=this,$self=this;
  8452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8453. return $core.withContext(function($ctx1) {
  8454. //>>excludeEnd("ctx");
  8455. $self._position_((0));
  8456. return self;
  8457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8458. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8459. //>>excludeEnd("ctx");
  8460. }; }),
  8461. $globals.Stream);
  8462. $core.addMethod(
  8463. $core.method({
  8464. selector: "resetContents",
  8465. protocol: "actions",
  8466. //>>excludeStart("ide", pragmas.excludeIdeData);
  8467. args: [],
  8468. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8469. referencedClasses: [],
  8470. //>>excludeEnd("ide");
  8471. pragmas: [],
  8472. messageSends: ["reset", "setStreamSize:"]
  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._reset();
  8479. $self._setStreamSize_((0));
  8480. return self;
  8481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8482. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8483. //>>excludeEnd("ctx");
  8484. }; }),
  8485. $globals.Stream);
  8486. $core.addMethod(
  8487. $core.method({
  8488. selector: "setCollection:",
  8489. protocol: "accessing",
  8490. //>>excludeStart("ide", pragmas.excludeIdeData);
  8491. args: ["aCollection"],
  8492. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8493. referencedClasses: [],
  8494. //>>excludeEnd("ide");
  8495. pragmas: [],
  8496. messageSends: []
  8497. }, function ($methodClass){ return function (aCollection){
  8498. var self=this,$self=this;
  8499. $self.collection=aCollection;
  8500. return self;
  8501. }; }),
  8502. $globals.Stream);
  8503. $core.addMethod(
  8504. $core.method({
  8505. selector: "setStreamSize:",
  8506. protocol: "accessing",
  8507. //>>excludeStart("ide", pragmas.excludeIdeData);
  8508. args: ["anInteger"],
  8509. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8510. referencedClasses: [],
  8511. //>>excludeEnd("ide");
  8512. pragmas: [],
  8513. messageSends: []
  8514. }, function ($methodClass){ return function (anInteger){
  8515. var self=this,$self=this;
  8516. $self.streamSize=anInteger;
  8517. return self;
  8518. }; }),
  8519. $globals.Stream);
  8520. $core.addMethod(
  8521. $core.method({
  8522. selector: "setToEnd",
  8523. protocol: "positioning",
  8524. //>>excludeStart("ide", pragmas.excludeIdeData);
  8525. args: [],
  8526. source: "setToEnd\x0a\x09self position: self size",
  8527. referencedClasses: [],
  8528. //>>excludeEnd("ide");
  8529. pragmas: [],
  8530. messageSends: ["position:", "size"]
  8531. }, function ($methodClass){ return function (){
  8532. var self=this,$self=this;
  8533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8534. return $core.withContext(function($ctx1) {
  8535. //>>excludeEnd("ctx");
  8536. $self._position_($self._size());
  8537. return self;
  8538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8539. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8540. //>>excludeEnd("ctx");
  8541. }; }),
  8542. $globals.Stream);
  8543. $core.addMethod(
  8544. $core.method({
  8545. selector: "size",
  8546. protocol: "accessing",
  8547. //>>excludeStart("ide", pragmas.excludeIdeData);
  8548. args: [],
  8549. source: "size\x0a\x09^ self streamSize",
  8550. referencedClasses: [],
  8551. //>>excludeEnd("ide");
  8552. pragmas: [],
  8553. messageSends: ["streamSize"]
  8554. }, function ($methodClass){ return function (){
  8555. var self=this,$self=this;
  8556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8557. return $core.withContext(function($ctx1) {
  8558. //>>excludeEnd("ctx");
  8559. return $self._streamSize();
  8560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8561. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8562. //>>excludeEnd("ctx");
  8563. }; }),
  8564. $globals.Stream);
  8565. $core.addMethod(
  8566. $core.method({
  8567. selector: "skip:",
  8568. protocol: "positioning",
  8569. //>>excludeStart("ide", pragmas.excludeIdeData);
  8570. args: ["anInteger"],
  8571. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8572. referencedClasses: [],
  8573. //>>excludeEnd("ide");
  8574. pragmas: [],
  8575. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8576. }, function ($methodClass){ return function (anInteger){
  8577. var self=this,$self=this;
  8578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8579. return $core.withContext(function($ctx1) {
  8580. //>>excludeEnd("ctx");
  8581. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8582. return self;
  8583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8584. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8585. //>>excludeEnd("ctx");
  8586. }; }),
  8587. $globals.Stream);
  8588. $core.addMethod(
  8589. $core.method({
  8590. selector: "streamSize",
  8591. protocol: "accessing",
  8592. //>>excludeStart("ide", pragmas.excludeIdeData);
  8593. args: [],
  8594. source: "streamSize\x0a\x09^ streamSize",
  8595. referencedClasses: [],
  8596. //>>excludeEnd("ide");
  8597. pragmas: [],
  8598. messageSends: []
  8599. }, function ($methodClass){ return function (){
  8600. var self=this,$self=this;
  8601. return $self.streamSize;
  8602. }; }),
  8603. $globals.Stream);
  8604. $core.addMethod(
  8605. $core.method({
  8606. selector: "on:",
  8607. protocol: "instance creation",
  8608. //>>excludeStart("ide", pragmas.excludeIdeData);
  8609. args: ["aCollection"],
  8610. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8611. referencedClasses: [],
  8612. //>>excludeEnd("ide");
  8613. pragmas: [],
  8614. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8615. }, function ($methodClass){ return function (aCollection){
  8616. var self=this,$self=this;
  8617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8618. return $core.withContext(function($ctx1) {
  8619. //>>excludeEnd("ctx");
  8620. var $1;
  8621. $1=$self._new();
  8622. $recv($1)._setCollection_(aCollection);
  8623. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8624. return $recv($1)._yourself();
  8625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8626. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8627. //>>excludeEnd("ctx");
  8628. }; }),
  8629. $globals.Stream.a$cls);
  8630. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8631. //>>excludeStart("ide", pragmas.excludeIdeData);
  8632. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8633. //>>excludeEnd("ide");
  8634. $core.addMethod(
  8635. $core.method({
  8636. selector: "cr",
  8637. protocol: "writing",
  8638. //>>excludeStart("ide", pragmas.excludeIdeData);
  8639. args: [],
  8640. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8641. referencedClasses: ["String"],
  8642. //>>excludeEnd("ide");
  8643. pragmas: [],
  8644. messageSends: ["nextPutAll:", "cr"]
  8645. }, function ($methodClass){ return function (){
  8646. var self=this,$self=this;
  8647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8648. return $core.withContext(function($ctx1) {
  8649. //>>excludeEnd("ctx");
  8650. return $self._nextPutAll_($recv($globals.String)._cr());
  8651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8652. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8653. //>>excludeEnd("ctx");
  8654. }; }),
  8655. $globals.StringStream);
  8656. $core.addMethod(
  8657. $core.method({
  8658. selector: "crlf",
  8659. protocol: "writing",
  8660. //>>excludeStart("ide", pragmas.excludeIdeData);
  8661. args: [],
  8662. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8663. referencedClasses: ["String"],
  8664. //>>excludeEnd("ide");
  8665. pragmas: [],
  8666. messageSends: ["nextPutAll:", "crlf"]
  8667. }, function ($methodClass){ return function (){
  8668. var self=this,$self=this;
  8669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8670. return $core.withContext(function($ctx1) {
  8671. //>>excludeEnd("ctx");
  8672. return $self._nextPutAll_($recv($globals.String)._crlf());
  8673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8674. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8675. //>>excludeEnd("ctx");
  8676. }; }),
  8677. $globals.StringStream);
  8678. $core.addMethod(
  8679. $core.method({
  8680. selector: "lf",
  8681. protocol: "writing",
  8682. //>>excludeStart("ide", pragmas.excludeIdeData);
  8683. args: [],
  8684. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8685. referencedClasses: ["String"],
  8686. //>>excludeEnd("ide");
  8687. pragmas: [],
  8688. messageSends: ["nextPutAll:", "lf"]
  8689. }, function ($methodClass){ return function (){
  8690. var self=this,$self=this;
  8691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8692. return $core.withContext(function($ctx1) {
  8693. //>>excludeEnd("ctx");
  8694. return $self._nextPutAll_($recv($globals.String)._lf());
  8695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8696. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8697. //>>excludeEnd("ctx");
  8698. }; }),
  8699. $globals.StringStream);
  8700. $core.addMethod(
  8701. $core.method({
  8702. selector: "next:",
  8703. protocol: "reading",
  8704. //>>excludeStart("ide", pragmas.excludeIdeData);
  8705. args: ["anInteger"],
  8706. 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",
  8707. referencedClasses: [],
  8708. //>>excludeEnd("ide");
  8709. pragmas: [],
  8710. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8711. }, function ($methodClass){ return function (anInteger){
  8712. var self=this,$self=this;
  8713. var tempCollection;
  8714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8715. return $core.withContext(function($ctx1) {
  8716. //>>excludeEnd("ctx");
  8717. tempCollection=$recv($recv($self._collection())._class())._new();
  8718. $recv(anInteger)._timesRepeat_((function(){
  8719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8720. return $core.withContext(function($ctx2) {
  8721. //>>excludeEnd("ctx");
  8722. if(!$core.assert($self._atEnd())){
  8723. tempCollection=$recv(tempCollection).__comma($self._next());
  8724. return tempCollection;
  8725. }
  8726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8727. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8728. //>>excludeEnd("ctx");
  8729. }));
  8730. return tempCollection;
  8731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8732. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8733. //>>excludeEnd("ctx");
  8734. }; }),
  8735. $globals.StringStream);
  8736. $core.addMethod(
  8737. $core.method({
  8738. selector: "nextPut:",
  8739. protocol: "writing",
  8740. //>>excludeStart("ide", pragmas.excludeIdeData);
  8741. args: ["aString"],
  8742. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8743. referencedClasses: [],
  8744. //>>excludeEnd("ide");
  8745. pragmas: [],
  8746. messageSends: ["nextPutAll:"]
  8747. }, function ($methodClass){ return function (aString){
  8748. var self=this,$self=this;
  8749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8750. return $core.withContext(function($ctx1) {
  8751. //>>excludeEnd("ctx");
  8752. $self._nextPutAll_(aString);
  8753. return self;
  8754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8755. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8756. //>>excludeEnd("ctx");
  8757. }; }),
  8758. $globals.StringStream);
  8759. $core.addMethod(
  8760. $core.method({
  8761. selector: "nextPutAll:",
  8762. protocol: "writing",
  8763. //>>excludeStart("ide", pragmas.excludeIdeData);
  8764. args: ["aString"],
  8765. 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)",
  8766. referencedClasses: [],
  8767. //>>excludeEnd("ide");
  8768. pragmas: [],
  8769. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8770. }, function ($methodClass){ return function (aString){
  8771. var self=this,$self=this;
  8772. var pre,post;
  8773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8774. return $core.withContext(function($ctx1) {
  8775. //>>excludeEnd("ctx");
  8776. if($core.assert($recv([$self._position()
  8777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8778. ,$ctx1.sendIdx["position"]=1
  8779. //>>excludeEnd("ctx");
  8780. ][0]).__eq([$recv([$self._collection()
  8781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8782. ,$ctx1.sendIdx["collection"]=1
  8783. //>>excludeEnd("ctx");
  8784. ][0])._size()
  8785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8786. ,$ctx1.sendIdx["size"]=1
  8787. //>>excludeEnd("ctx");
  8788. ][0]))){
  8789. [$self._setCollection_([$recv([$self._collection()
  8790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8791. ,$ctx1.sendIdx["collection"]=2
  8792. //>>excludeEnd("ctx");
  8793. ][0]).__comma(aString)
  8794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8795. ,$ctx1.sendIdx[","]=1
  8796. //>>excludeEnd("ctx");
  8797. ][0])
  8798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8799. ,$ctx1.sendIdx["setCollection:"]=1
  8800. //>>excludeEnd("ctx");
  8801. ][0];
  8802. } else {
  8803. pre=[$recv([$self._collection()
  8804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8805. ,$ctx1.sendIdx["collection"]=3
  8806. //>>excludeEnd("ctx");
  8807. ][0])._copyFrom_to_((1),[$self._position()
  8808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8809. ,$ctx1.sendIdx["position"]=2
  8810. //>>excludeEnd("ctx");
  8811. ][0])
  8812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8813. ,$ctx1.sendIdx["copyFrom:to:"]=1
  8814. //>>excludeEnd("ctx");
  8815. ][0];
  8816. post=$recv([$self._collection()
  8817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8818. ,$ctx1.sendIdx["collection"]=4
  8819. //>>excludeEnd("ctx");
  8820. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  8821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8822. ,$ctx1.sendIdx["position"]=3
  8823. //>>excludeEnd("ctx");
  8824. ][0]).__plus((1))
  8825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8826. ,$ctx1.sendIdx["+"]=2
  8827. //>>excludeEnd("ctx");
  8828. ][0]).__plus([$recv(aString)._size()
  8829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8830. ,$ctx1.sendIdx["size"]=2
  8831. //>>excludeEnd("ctx");
  8832. ][0])
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. ,$ctx1.sendIdx["+"]=1
  8835. //>>excludeEnd("ctx");
  8836. ][0],[$recv($self._collection())._size()
  8837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8838. ,$ctx1.sendIdx["size"]=3
  8839. //>>excludeEnd("ctx");
  8840. ][0]);
  8841. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  8842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8843. ,$ctx1.sendIdx[","]=2
  8844. //>>excludeEnd("ctx");
  8845. ][0]);
  8846. }
  8847. $self._position_($recv([$self._position()
  8848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8849. ,$ctx1.sendIdx["position"]=4
  8850. //>>excludeEnd("ctx");
  8851. ][0]).__plus($recv(aString)._size()));
  8852. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8853. return self;
  8854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8855. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8856. //>>excludeEnd("ctx");
  8857. }; }),
  8858. $globals.StringStream);
  8859. $core.addMethod(
  8860. $core.method({
  8861. selector: "nextPutString:",
  8862. protocol: "writing",
  8863. //>>excludeStart("ide", pragmas.excludeIdeData);
  8864. args: ["aString"],
  8865. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8866. referencedClasses: [],
  8867. //>>excludeEnd("ide");
  8868. pragmas: [],
  8869. messageSends: ["nextPutAll:"]
  8870. }, function ($methodClass){ return function (aString){
  8871. var self=this,$self=this;
  8872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8873. return $core.withContext(function($ctx1) {
  8874. //>>excludeEnd("ctx");
  8875. $self._nextPutAll_(aString);
  8876. return self;
  8877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8878. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8879. //>>excludeEnd("ctx");
  8880. }; }),
  8881. $globals.StringStream);
  8882. $core.addMethod(
  8883. $core.method({
  8884. selector: "print:",
  8885. protocol: "writing",
  8886. //>>excludeStart("ide", pragmas.excludeIdeData);
  8887. args: ["anObject"],
  8888. source: "print: anObject\x0a\x09anObject printOn: self",
  8889. referencedClasses: [],
  8890. //>>excludeEnd("ide");
  8891. pragmas: [],
  8892. messageSends: ["printOn:"]
  8893. }, function ($methodClass){ return function (anObject){
  8894. var self=this,$self=this;
  8895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8896. return $core.withContext(function($ctx1) {
  8897. //>>excludeEnd("ctx");
  8898. $recv(anObject)._printOn_(self);
  8899. return self;
  8900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8901. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8902. //>>excludeEnd("ctx");
  8903. }; }),
  8904. $globals.StringStream);
  8905. $core.addMethod(
  8906. $core.method({
  8907. selector: "printSymbol:",
  8908. protocol: "writing",
  8909. //>>excludeStart("ide", pragmas.excludeIdeData);
  8910. args: ["anObject"],
  8911. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8912. referencedClasses: [],
  8913. //>>excludeEnd("ide");
  8914. pragmas: [],
  8915. messageSends: ["asSymbolPrintOn:"]
  8916. }, function ($methodClass){ return function (anObject){
  8917. var self=this,$self=this;
  8918. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8919. return $core.withContext(function($ctx1) {
  8920. //>>excludeEnd("ctx");
  8921. $recv(anObject)._asSymbolPrintOn_(self);
  8922. return self;
  8923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8924. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8925. //>>excludeEnd("ctx");
  8926. }; }),
  8927. $globals.StringStream);
  8928. $core.addMethod(
  8929. $core.method({
  8930. selector: "space",
  8931. protocol: "writing",
  8932. //>>excludeStart("ide", pragmas.excludeIdeData);
  8933. args: [],
  8934. source: "space\x0a\x09self nextPut: ' '",
  8935. referencedClasses: [],
  8936. //>>excludeEnd("ide");
  8937. pragmas: [],
  8938. messageSends: ["nextPut:"]
  8939. }, function ($methodClass){ return function (){
  8940. var self=this,$self=this;
  8941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8942. return $core.withContext(function($ctx1) {
  8943. //>>excludeEnd("ctx");
  8944. $self._nextPut_(" ");
  8945. return self;
  8946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8947. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8948. //>>excludeEnd("ctx");
  8949. }; }),
  8950. $globals.StringStream);
  8951. $core.addMethod(
  8952. $core.method({
  8953. selector: "tab",
  8954. protocol: "writing",
  8955. //>>excludeStart("ide", pragmas.excludeIdeData);
  8956. args: [],
  8957. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8958. referencedClasses: ["String"],
  8959. //>>excludeEnd("ide");
  8960. pragmas: [],
  8961. messageSends: ["nextPutAll:", "tab"]
  8962. }, function ($methodClass){ return function (){
  8963. var self=this,$self=this;
  8964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8965. return $core.withContext(function($ctx1) {
  8966. //>>excludeEnd("ctx");
  8967. return $self._nextPutAll_($recv($globals.String)._tab());
  8968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8969. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  8970. //>>excludeEnd("ctx");
  8971. }; }),
  8972. $globals.StringStream);
  8973. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8974. //>>excludeStart("ide", pragmas.excludeIdeData);
  8975. $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.";
  8976. //>>excludeEnd("ide");
  8977. $core.addMethod(
  8978. $core.method({
  8979. selector: "initialize",
  8980. protocol: "initialization",
  8981. //>>excludeStart("ide", pragmas.excludeIdeData);
  8982. args: [],
  8983. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8984. referencedClasses: ["OrderedCollection"],
  8985. //>>excludeEnd("ide");
  8986. pragmas: [],
  8987. messageSends: ["initialize", "new"]
  8988. }, function ($methodClass){ return function (){
  8989. var self=this,$self=this;
  8990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8991. return $core.withContext(function($ctx1) {
  8992. //>>excludeEnd("ctx");
  8993. [(
  8994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8995. $ctx1.supercall = true,
  8996. //>>excludeEnd("ctx");
  8997. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  8998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8999. ,$ctx1.supercall = false
  9000. //>>excludeEnd("ctx");
  9001. ][0];
  9002. $self.read=[$recv($globals.OrderedCollection)._new()
  9003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9004. ,$ctx1.sendIdx["new"]=1
  9005. //>>excludeEnd("ctx");
  9006. ][0];
  9007. $self.write=$recv($globals.OrderedCollection)._new();
  9008. $self.readIndex=(1);
  9009. return self;
  9010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9011. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  9012. //>>excludeEnd("ctx");
  9013. }; }),
  9014. $globals.Queue);
  9015. $core.addMethod(
  9016. $core.method({
  9017. selector: "next",
  9018. protocol: "accessing",
  9019. //>>excludeStart("ide", pragmas.excludeIdeData);
  9020. args: [],
  9021. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9022. referencedClasses: [],
  9023. //>>excludeEnd("ide");
  9024. pragmas: [],
  9025. messageSends: ["nextIfAbsent:", "error:"]
  9026. }, function ($methodClass){ return function (){
  9027. var self=this,$self=this;
  9028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9029. return $core.withContext(function($ctx1) {
  9030. //>>excludeEnd("ctx");
  9031. return $self._nextIfAbsent_((function(){
  9032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9033. return $core.withContext(function($ctx2) {
  9034. //>>excludeEnd("ctx");
  9035. return $self._error_("Cannot read from empty Queue.");
  9036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9037. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9038. //>>excludeEnd("ctx");
  9039. }));
  9040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9041. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  9042. //>>excludeEnd("ctx");
  9043. }; }),
  9044. $globals.Queue);
  9045. $core.addMethod(
  9046. $core.method({
  9047. selector: "nextIfAbsent:",
  9048. protocol: "accessing",
  9049. //>>excludeStart("ide", pragmas.excludeIdeData);
  9050. args: ["aBlock"],
  9051. 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",
  9052. referencedClasses: ["OrderedCollection"],
  9053. //>>excludeEnd("ide");
  9054. pragmas: [],
  9055. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9056. }, function ($methodClass){ return function (aBlock){
  9057. var self=this,$self=this;
  9058. var result;
  9059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9060. return $core.withContext(function($ctx1) {
  9061. //>>excludeEnd("ctx");
  9062. var $early={};
  9063. try {
  9064. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9066. return $core.withContext(function($ctx2) {
  9067. //>>excludeEnd("ctx");
  9068. $recv($self.write)._ifEmpty_((function(){
  9069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9070. return $core.withContext(function($ctx3) {
  9071. //>>excludeEnd("ctx");
  9072. if($core.assert($recv($self.readIndex).__gt((1)))){
  9073. $self.read=[];
  9074. $self.readIndex=(1);
  9075. $self.readIndex;
  9076. }
  9077. throw $early=[$recv(aBlock)._value()];
  9078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9079. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9080. //>>excludeEnd("ctx");
  9081. }));
  9082. $self.read=$self.write;
  9083. $self.readIndex=(1);
  9084. $self.write=$recv($globals.OrderedCollection)._new();
  9085. return $recv($self.read)._first();
  9086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9087. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9088. //>>excludeEnd("ctx");
  9089. }));
  9090. $recv($self.read)._at_put_($self.readIndex,nil);
  9091. $self.readIndex=$recv($self.readIndex).__plus((1));
  9092. return result;
  9093. }
  9094. catch(e) {if(e===$early)return e[0]; throw e}
  9095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9096. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9097. //>>excludeEnd("ctx");
  9098. }; }),
  9099. $globals.Queue);
  9100. $core.addMethod(
  9101. $core.method({
  9102. selector: "nextPut:",
  9103. protocol: "accessing",
  9104. //>>excludeStart("ide", pragmas.excludeIdeData);
  9105. args: ["anObject"],
  9106. source: "nextPut: anObject\x0a\x09write add: anObject",
  9107. referencedClasses: [],
  9108. //>>excludeEnd("ide");
  9109. pragmas: [],
  9110. messageSends: ["add:"]
  9111. }, function ($methodClass){ return function (anObject){
  9112. var self=this,$self=this;
  9113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9114. return $core.withContext(function($ctx1) {
  9115. //>>excludeEnd("ctx");
  9116. $recv($self.write)._add_(anObject);
  9117. return self;
  9118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9119. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9120. //>>excludeEnd("ctx");
  9121. }; }),
  9122. $globals.Queue);
  9123. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9124. //>>excludeStart("ide", pragmas.excludeIdeData);
  9125. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9126. //>>excludeEnd("ide");
  9127. $core.addMethod(
  9128. $core.method({
  9129. selector: "compile:",
  9130. protocol: "evaluating",
  9131. //>>excludeStart("ide", pragmas.excludeIdeData);
  9132. args: ["aString"],
  9133. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9134. referencedClasses: [],
  9135. //>>excludeEnd("ide");
  9136. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9137. messageSends: []
  9138. }, function ($methodClass){ return function (aString){
  9139. var self=this,$self=this;
  9140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9141. return $core.withContext(function($ctx1) {
  9142. //>>excludeEnd("ctx");
  9143. return self.compile(aString);
  9144. return self;
  9145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9146. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9147. //>>excludeEnd("ctx");
  9148. }; }),
  9149. $globals.RegularExpression);
  9150. $core.addMethod(
  9151. $core.method({
  9152. selector: "exec:",
  9153. protocol: "evaluating",
  9154. //>>excludeStart("ide", pragmas.excludeIdeData);
  9155. args: ["aString"],
  9156. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9157. referencedClasses: [],
  9158. //>>excludeEnd("ide");
  9159. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9160. messageSends: []
  9161. }, function ($methodClass){ return function (aString){
  9162. var self=this,$self=this;
  9163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9164. return $core.withContext(function($ctx1) {
  9165. //>>excludeEnd("ctx");
  9166. return self.exec(aString) || nil;
  9167. return self;
  9168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9169. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9170. //>>excludeEnd("ctx");
  9171. }; }),
  9172. $globals.RegularExpression);
  9173. $core.addMethod(
  9174. $core.method({
  9175. selector: "test:",
  9176. protocol: "evaluating",
  9177. //>>excludeStart("ide", pragmas.excludeIdeData);
  9178. args: ["aString"],
  9179. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9180. referencedClasses: [],
  9181. //>>excludeEnd("ide");
  9182. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9183. messageSends: []
  9184. }, function ($methodClass){ return function (aString){
  9185. var self=this,$self=this;
  9186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9187. return $core.withContext(function($ctx1) {
  9188. //>>excludeEnd("ctx");
  9189. return self.test(aString);
  9190. return self;
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9193. //>>excludeEnd("ctx");
  9194. }; }),
  9195. $globals.RegularExpression);
  9196. $core.addMethod(
  9197. $core.method({
  9198. selector: "fromString:",
  9199. protocol: "instance creation",
  9200. //>>excludeStart("ide", pragmas.excludeIdeData);
  9201. args: ["aString"],
  9202. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9203. referencedClasses: [],
  9204. //>>excludeEnd("ide");
  9205. pragmas: [],
  9206. messageSends: ["fromString:flag:"]
  9207. }, function ($methodClass){ return function (aString){
  9208. var self=this,$self=this;
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. return $core.withContext(function($ctx1) {
  9211. //>>excludeEnd("ctx");
  9212. return $self._fromString_flag_(aString,"");
  9213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9214. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9215. //>>excludeEnd("ctx");
  9216. }; }),
  9217. $globals.RegularExpression.a$cls);
  9218. $core.addMethod(
  9219. $core.method({
  9220. selector: "fromString:flag:",
  9221. protocol: "instance creation",
  9222. //>>excludeStart("ide", pragmas.excludeIdeData);
  9223. args: ["aString", "anotherString"],
  9224. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9225. referencedClasses: [],
  9226. //>>excludeEnd("ide");
  9227. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9228. messageSends: []
  9229. }, function ($methodClass){ return function (aString,anotherString){
  9230. var self=this,$self=this;
  9231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9232. return $core.withContext(function($ctx1) {
  9233. //>>excludeEnd("ctx");
  9234. return new RegExp(aString, anotherString);
  9235. return self;
  9236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9237. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9238. //>>excludeEnd("ctx");
  9239. }; }),
  9240. $globals.RegularExpression.a$cls);
  9241. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9242. $core.addMethod(
  9243. $core.method({
  9244. selector: "at:",
  9245. protocol: "accessing",
  9246. //>>excludeStart("ide", pragmas.excludeIdeData);
  9247. args: ["anIndex"],
  9248. 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 ]",
  9249. referencedClasses: [],
  9250. //>>excludeEnd("ide");
  9251. pragmas: [],
  9252. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9253. }, function ($methodClass){ return function (anIndex){
  9254. var self=this,$self=this;
  9255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9256. return $core.withContext(function($ctx1) {
  9257. //>>excludeEnd("ctx");
  9258. return $self._at_ifAbsent_(anIndex,(function(){
  9259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9260. return $core.withContext(function($ctx2) {
  9261. //>>excludeEnd("ctx");
  9262. return $self._errorNotFound();
  9263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9264. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9265. //>>excludeEnd("ctx");
  9266. }));
  9267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9268. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9269. //>>excludeEnd("ctx");
  9270. }; }),
  9271. $globals.TKeyValueCollection);
  9272. $core.addMethod(
  9273. $core.method({
  9274. selector: "at:ifAbsent:",
  9275. protocol: "accessing",
  9276. //>>excludeStart("ide", pragmas.excludeIdeData);
  9277. args: ["anIndex", "aBlock"],
  9278. 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",
  9279. referencedClasses: [],
  9280. //>>excludeEnd("ide");
  9281. pragmas: [],
  9282. messageSends: ["subclassResponsibility"]
  9283. }, function ($methodClass){ return function (anIndex,aBlock){
  9284. var self=this,$self=this;
  9285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9286. return $core.withContext(function($ctx1) {
  9287. //>>excludeEnd("ctx");
  9288. $self._subclassResponsibility();
  9289. return self;
  9290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9291. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9292. //>>excludeEnd("ctx");
  9293. }; }),
  9294. $globals.TKeyValueCollection);
  9295. $core.addMethod(
  9296. $core.method({
  9297. selector: "at:ifAbsentPut:",
  9298. protocol: "accessing",
  9299. //>>excludeStart("ide", pragmas.excludeIdeData);
  9300. args: ["aKey", "aBlock"],
  9301. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9302. referencedClasses: [],
  9303. //>>excludeEnd("ide");
  9304. pragmas: [],
  9305. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9306. }, function ($methodClass){ return function (aKey,aBlock){
  9307. var self=this,$self=this;
  9308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9309. return $core.withContext(function($ctx1) {
  9310. //>>excludeEnd("ctx");
  9311. return $self._at_ifAbsent_(aKey,(function(){
  9312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9313. return $core.withContext(function($ctx2) {
  9314. //>>excludeEnd("ctx");
  9315. return $self._at_put_(aKey,$recv(aBlock)._value());
  9316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9318. //>>excludeEnd("ctx");
  9319. }));
  9320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9321. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9322. //>>excludeEnd("ctx");
  9323. }; }),
  9324. $globals.TKeyValueCollection);
  9325. $core.addMethod(
  9326. $core.method({
  9327. selector: "at:ifPresent:",
  9328. protocol: "accessing",
  9329. //>>excludeStart("ide", pragmas.excludeIdeData);
  9330. args: ["anIndex", "aBlock"],
  9331. 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 ]",
  9332. referencedClasses: [],
  9333. //>>excludeEnd("ide");
  9334. pragmas: [],
  9335. messageSends: ["at:ifPresent:ifAbsent:"]
  9336. }, function ($methodClass){ return function (anIndex,aBlock){
  9337. var self=this,$self=this;
  9338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9339. return $core.withContext(function($ctx1) {
  9340. //>>excludeEnd("ctx");
  9341. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9342. return nil;
  9343. }));
  9344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9345. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9346. //>>excludeEnd("ctx");
  9347. }; }),
  9348. $globals.TKeyValueCollection);
  9349. $core.addMethod(
  9350. $core.method({
  9351. selector: "at:ifPresent:ifAbsent:",
  9352. protocol: "accessing",
  9353. //>>excludeStart("ide", pragmas.excludeIdeData);
  9354. args: ["anIndex", "aBlock", "anotherBlock"],
  9355. 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",
  9356. referencedClasses: [],
  9357. //>>excludeEnd("ide");
  9358. pragmas: [],
  9359. messageSends: ["subclassResponsibility"]
  9360. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9361. var self=this,$self=this;
  9362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9363. return $core.withContext(function($ctx1) {
  9364. //>>excludeEnd("ctx");
  9365. $self._subclassResponsibility();
  9366. return self;
  9367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9368. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9369. //>>excludeEnd("ctx");
  9370. }; }),
  9371. $globals.TKeyValueCollection);
  9372. $core.addMethod(
  9373. $core.method({
  9374. selector: "at:put:",
  9375. protocol: "accessing",
  9376. //>>excludeStart("ide", pragmas.excludeIdeData);
  9377. args: ["anIndex", "anObject"],
  9378. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9379. referencedClasses: [],
  9380. //>>excludeEnd("ide");
  9381. pragmas: [],
  9382. messageSends: ["subclassResponsibility"]
  9383. }, function ($methodClass){ return function (anIndex,anObject){
  9384. var self=this,$self=this;
  9385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9386. return $core.withContext(function($ctx1) {
  9387. //>>excludeEnd("ctx");
  9388. $self._subclassResponsibility();
  9389. return self;
  9390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9391. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9392. //>>excludeEnd("ctx");
  9393. }; }),
  9394. $globals.TKeyValueCollection);
  9395. $core.addMethod(
  9396. $core.method({
  9397. selector: "indexOf:",
  9398. protocol: "accessing",
  9399. //>>excludeStart("ide", pragmas.excludeIdeData);
  9400. args: ["anObject"],
  9401. 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 ]",
  9402. referencedClasses: [],
  9403. //>>excludeEnd("ide");
  9404. pragmas: [],
  9405. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9406. }, function ($methodClass){ return function (anObject){
  9407. var self=this,$self=this;
  9408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9409. return $core.withContext(function($ctx1) {
  9410. //>>excludeEnd("ctx");
  9411. return $self._indexOf_ifAbsent_(anObject,(function(){
  9412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9413. return $core.withContext(function($ctx2) {
  9414. //>>excludeEnd("ctx");
  9415. return $self._errorNotFound();
  9416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9417. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9418. //>>excludeEnd("ctx");
  9419. }));
  9420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9421. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9422. //>>excludeEnd("ctx");
  9423. }; }),
  9424. $globals.TKeyValueCollection);
  9425. $core.addMethod(
  9426. $core.method({
  9427. selector: "indexOf:ifAbsent:",
  9428. protocol: "accessing",
  9429. //>>excludeStart("ide", pragmas.excludeIdeData);
  9430. args: ["anObject", "aBlock"],
  9431. 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",
  9432. referencedClasses: [],
  9433. //>>excludeEnd("ide");
  9434. pragmas: [],
  9435. messageSends: ["subclassResponsibility"]
  9436. }, function ($methodClass){ return function (anObject,aBlock){
  9437. var self=this,$self=this;
  9438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9439. return $core.withContext(function($ctx1) {
  9440. //>>excludeEnd("ctx");
  9441. $self._subclassResponsibility();
  9442. return self;
  9443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9444. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9445. //>>excludeEnd("ctx");
  9446. }; }),
  9447. $globals.TKeyValueCollection);
  9448. $core.addMethod(
  9449. $core.method({
  9450. selector: "with:do:",
  9451. protocol: "enumerating",
  9452. //>>excludeStart("ide", pragmas.excludeIdeData);
  9453. args: ["anotherCollection", "aBlock"],
  9454. 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) ]",
  9455. referencedClasses: [],
  9456. //>>excludeEnd("ide");
  9457. pragmas: [],
  9458. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9459. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9460. var self=this,$self=this;
  9461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9462. return $core.withContext(function($ctx1) {
  9463. //>>excludeEnd("ctx");
  9464. $self._withIndexDo_((function(each,index){
  9465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9466. return $core.withContext(function($ctx2) {
  9467. //>>excludeEnd("ctx");
  9468. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9470. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9471. //>>excludeEnd("ctx");
  9472. }));
  9473. return self;
  9474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9475. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9476. //>>excludeEnd("ctx");
  9477. }; }),
  9478. $globals.TKeyValueCollection);
  9479. $core.addMethod(
  9480. $core.method({
  9481. selector: "withIndexDo:",
  9482. protocol: "enumerating",
  9483. //>>excludeStart("ide", pragmas.excludeIdeData);
  9484. args: ["aBlock"],
  9485. 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",
  9486. referencedClasses: [],
  9487. //>>excludeEnd("ide");
  9488. pragmas: [],
  9489. messageSends: ["subclassResponsibility"]
  9490. }, function ($methodClass){ return function (aBlock){
  9491. var self=this,$self=this;
  9492. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9493. return $core.withContext(function($ctx1) {
  9494. //>>excludeEnd("ctx");
  9495. $self._subclassResponsibility();
  9496. return self;
  9497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9498. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9499. //>>excludeEnd("ctx");
  9500. }; }),
  9501. $globals.TKeyValueCollection);
  9502. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9503. $core.addMethod(
  9504. $core.method({
  9505. selector: "at:ifAbsent:",
  9506. protocol: "accessing",
  9507. //>>excludeStart("ide", pragmas.excludeIdeData);
  9508. args: ["anIndex", "aBlock"],
  9509. 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'>",
  9510. referencedClasses: [],
  9511. //>>excludeEnd("ide");
  9512. 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"]]],
  9513. messageSends: []
  9514. }, function ($methodClass){ return function (anIndex,aBlock){
  9515. var self=this,$self=this;
  9516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9517. return $core.withContext(function($ctx1) {
  9518. //>>excludeEnd("ctx");
  9519. return anIndex >= 1 && anIndex <= self.length
  9520. ? self[anIndex - 1]
  9521. : aBlock._value()
  9522. ;
  9523. return self;
  9524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9525. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9526. //>>excludeEnd("ctx");
  9527. }; }),
  9528. $globals.TNativeZeroBasedCollection);
  9529. $core.addMethod(
  9530. $core.method({
  9531. selector: "at:ifPresent:ifAbsent:",
  9532. protocol: "accessing",
  9533. //>>excludeStart("ide", pragmas.excludeIdeData);
  9534. args: ["anIndex", "aBlock", "anotherBlock"],
  9535. 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'>",
  9536. referencedClasses: [],
  9537. //>>excludeEnd("ide");
  9538. 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"]]],
  9539. messageSends: []
  9540. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9541. var self=this,$self=this;
  9542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9543. return $core.withContext(function($ctx1) {
  9544. //>>excludeEnd("ctx");
  9545. return anIndex >= 1 && anIndex <= self.length
  9546. ? aBlock._value_(self[anIndex - 1])
  9547. : anotherBlock._value()
  9548. ;
  9549. return self;
  9550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9551. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9552. //>>excludeEnd("ctx");
  9553. }; }),
  9554. $globals.TNativeZeroBasedCollection);
  9555. $core.addMethod(
  9556. $core.method({
  9557. selector: "detect:ifNone:",
  9558. protocol: "enumerating",
  9559. //>>excludeStart("ide", pragmas.excludeIdeData);
  9560. args: ["aBlock", "anotherBlock"],
  9561. 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'>",
  9562. referencedClasses: [],
  9563. //>>excludeEnd("ide");
  9564. 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"]]],
  9565. messageSends: []
  9566. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9567. var self=this,$self=this;
  9568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9569. return $core.withContext(function($ctx1) {
  9570. //>>excludeEnd("ctx");
  9571. for(var i = 0; i < self.length; i++)
  9572. if(aBlock._value_(self[i]))
  9573. return self[i];
  9574. return anotherBlock._value();
  9575. ;
  9576. return self;
  9577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9578. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9579. //>>excludeEnd("ctx");
  9580. }; }),
  9581. $globals.TNativeZeroBasedCollection);
  9582. $core.addMethod(
  9583. $core.method({
  9584. selector: "do:",
  9585. protocol: "enumerating",
  9586. //>>excludeStart("ide", pragmas.excludeIdeData);
  9587. args: ["aBlock"],
  9588. 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'>",
  9589. referencedClasses: [],
  9590. //>>excludeEnd("ide");
  9591. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9592. messageSends: []
  9593. }, function ($methodClass){ return function (aBlock){
  9594. var self=this,$self=this;
  9595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9596. return $core.withContext(function($ctx1) {
  9597. //>>excludeEnd("ctx");
  9598. for(var i=0; i < self.length; i++) {
  9599. aBlock._value_(self[i]);
  9600. }
  9601. ;
  9602. return self;
  9603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9604. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9605. //>>excludeEnd("ctx");
  9606. }; }),
  9607. $globals.TNativeZeroBasedCollection);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "indexOf:ifAbsent:",
  9611. protocol: "accessing",
  9612. //>>excludeStart("ide", pragmas.excludeIdeData);
  9613. args: ["anObject", "aBlock"],
  9614. 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'>",
  9615. referencedClasses: [],
  9616. //>>excludeEnd("ide");
  9617. 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"]]],
  9618. messageSends: []
  9619. }, function ($methodClass){ return function (anObject,aBlock){
  9620. var self=this,$self=this;
  9621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9622. return $core.withContext(function($ctx1) {
  9623. //>>excludeEnd("ctx");
  9624. for(var i=0; i < self.length; i++) {
  9625. if($recv(self[i]).__eq(anObject)) {return i+1}
  9626. };
  9627. return aBlock._value();
  9628. ;
  9629. return self;
  9630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9631. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9632. //>>excludeEnd("ctx");
  9633. }; }),
  9634. $globals.TNativeZeroBasedCollection);
  9635. $core.addMethod(
  9636. $core.method({
  9637. selector: "indexOf:startingAt:ifAbsent:",
  9638. protocol: "accessing",
  9639. //>>excludeStart("ide", pragmas.excludeIdeData);
  9640. args: ["anObject", "start", "aBlock"],
  9641. 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'>",
  9642. referencedClasses: [],
  9643. //>>excludeEnd("ide");
  9644. 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"]]],
  9645. messageSends: []
  9646. }, function ($methodClass){ return function (anObject,start,aBlock){
  9647. var self=this,$self=this;
  9648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9649. return $core.withContext(function($ctx1) {
  9650. //>>excludeEnd("ctx");
  9651. for(var i=start - 1; i < self.length; i++){
  9652. if($recv(self[i]).__eq(anObject)) {return i+1}
  9653. }
  9654. return aBlock._value();
  9655. ;
  9656. return self;
  9657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9658. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9659. //>>excludeEnd("ctx");
  9660. }; }),
  9661. $globals.TNativeZeroBasedCollection);
  9662. $core.addMethod(
  9663. $core.method({
  9664. selector: "single",
  9665. protocol: "accessing",
  9666. //>>excludeStart("ide", pragmas.excludeIdeData);
  9667. args: [],
  9668. 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'>",
  9669. referencedClasses: [],
  9670. //>>excludeEnd("ide");
  9671. 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];"]]],
  9672. messageSends: []
  9673. }, function ($methodClass){ return function (){
  9674. var self=this,$self=this;
  9675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9676. return $core.withContext(function($ctx1) {
  9677. //>>excludeEnd("ctx");
  9678. if (self.length == 0) throw new Error("Collection is empty");
  9679. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9680. return self[0];;
  9681. return self;
  9682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9683. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9684. //>>excludeEnd("ctx");
  9685. }; }),
  9686. $globals.TNativeZeroBasedCollection);
  9687. $core.addMethod(
  9688. $core.method({
  9689. selector: "size",
  9690. protocol: "accessing",
  9691. //>>excludeStart("ide", pragmas.excludeIdeData);
  9692. args: [],
  9693. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9694. referencedClasses: [],
  9695. //>>excludeEnd("ide");
  9696. pragmas: [["inlineJS:", ["return self.length"]]],
  9697. messageSends: []
  9698. }, function ($methodClass){ return function (){
  9699. var self=this,$self=this;
  9700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9701. return $core.withContext(function($ctx1) {
  9702. //>>excludeEnd("ctx");
  9703. return self.length;
  9704. return self;
  9705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9706. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9707. //>>excludeEnd("ctx");
  9708. }; }),
  9709. $globals.TNativeZeroBasedCollection);
  9710. $core.addMethod(
  9711. $core.method({
  9712. selector: "with:do:",
  9713. protocol: "enumerating",
  9714. //>>excludeStart("ide", pragmas.excludeIdeData);
  9715. args: ["anotherCollection", "aBlock"],
  9716. 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'>",
  9717. referencedClasses: [],
  9718. //>>excludeEnd("ide");
  9719. 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"]]],
  9720. messageSends: []
  9721. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9722. var self=this,$self=this;
  9723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9724. return $core.withContext(function($ctx1) {
  9725. //>>excludeEnd("ctx");
  9726. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9727. for(var i=0; i<self.length; i++) {
  9728. aBlock._value_value_(self[i], anotherCollection[i]);
  9729. }
  9730. ;
  9731. return self;
  9732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9733. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9734. //>>excludeEnd("ctx");
  9735. }; }),
  9736. $globals.TNativeZeroBasedCollection);
  9737. $core.addMethod(
  9738. $core.method({
  9739. selector: "withIndexDo:",
  9740. protocol: "enumerating",
  9741. //>>excludeStart("ide", pragmas.excludeIdeData);
  9742. args: ["aBlock"],
  9743. 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'>",
  9744. referencedClasses: [],
  9745. //>>excludeEnd("ide");
  9746. 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"]]],
  9747. messageSends: []
  9748. }, function ($methodClass){ return function (aBlock){
  9749. var self=this,$self=this;
  9750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9751. return $core.withContext(function($ctx1) {
  9752. //>>excludeEnd("ctx");
  9753. for(var i=0; i < self.length; i++) {
  9754. aBlock._value_value_(self[i], i+1);
  9755. }
  9756. ;
  9757. return self;
  9758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9759. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9760. //>>excludeEnd("ctx");
  9761. }; }),
  9762. $globals.TNativeZeroBasedCollection);
  9763. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9764. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9765. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9766. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9767. });