Kernel-Collections.js 350 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165
  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: "copyWith:",
  719. protocol: "copying",
  720. //>>excludeStart("ide", pragmas.excludeIdeData);
  721. args: ["anObject"],
  722. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  723. referencedClasses: [],
  724. //>>excludeEnd("ide");
  725. pragmas: [],
  726. messageSends: ["add:", "copy", "yourself"]
  727. }, function ($methodClass){ return function (anObject){
  728. var self=this,$self=this;
  729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  730. return $core.withContext(function($ctx1) {
  731. //>>excludeEnd("ctx");
  732. var $1;
  733. $1=$self._copy();
  734. $recv($1)._add_(anObject);
  735. return $recv($1)._yourself();
  736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  737. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject})});
  738. //>>excludeEnd("ctx");
  739. }; }),
  740. $globals.Collection);
  741. $core.addMethod(
  742. $core.method({
  743. selector: "copyWithAll:",
  744. protocol: "copying",
  745. //>>excludeStart("ide", pragmas.excludeIdeData);
  746. args: ["aCollection"],
  747. source: "copyWithAll: aCollection\x0a\x09self deprecatedAPI: 'Use #, instead.'.\x0a\x09^ self, aCollection",
  748. referencedClasses: [],
  749. //>>excludeEnd("ide");
  750. pragmas: [],
  751. messageSends: ["deprecatedAPI:", ","]
  752. }, function ($methodClass){ return function (aCollection){
  753. var self=this,$self=this;
  754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  755. return $core.withContext(function($ctx1) {
  756. //>>excludeEnd("ctx");
  757. $self._deprecatedAPI_("Use #, instead.");
  758. return $self.__comma(aCollection);
  759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  760. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection})});
  761. //>>excludeEnd("ctx");
  762. }; }),
  763. $globals.Collection);
  764. $core.addMethod(
  765. $core.method({
  766. selector: "copyWithout:",
  767. protocol: "copying",
  768. //>>excludeStart("ide", pragmas.excludeIdeData);
  769. args: ["anObject"],
  770. 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 ]",
  771. referencedClasses: [],
  772. //>>excludeEnd("ide");
  773. pragmas: [],
  774. messageSends: ["reject:", "="]
  775. }, function ($methodClass){ return function (anObject){
  776. var self=this,$self=this;
  777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  778. return $core.withContext(function($ctx1) {
  779. //>>excludeEnd("ctx");
  780. return $self._reject_((function(each){
  781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  782. return $core.withContext(function($ctx2) {
  783. //>>excludeEnd("ctx");
  784. return $recv(each).__eq(anObject);
  785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  786. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  787. //>>excludeEnd("ctx");
  788. }));
  789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  790. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject})});
  791. //>>excludeEnd("ctx");
  792. }; }),
  793. $globals.Collection);
  794. $core.addMethod(
  795. $core.method({
  796. selector: "copyWithoutAll:",
  797. protocol: "copying",
  798. //>>excludeStart("ide", pragmas.excludeIdeData);
  799. args: ["aCollection"],
  800. 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 ]",
  801. referencedClasses: [],
  802. //>>excludeEnd("ide");
  803. pragmas: [],
  804. messageSends: ["reject:", "includes:"]
  805. }, function ($methodClass){ return function (aCollection){
  806. var self=this,$self=this;
  807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  808. return $core.withContext(function($ctx1) {
  809. //>>excludeEnd("ctx");
  810. return $self._reject_((function(each){
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. return $core.withContext(function($ctx2) {
  813. //>>excludeEnd("ctx");
  814. return $recv(aCollection)._includes_(each);
  815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  816. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  817. //>>excludeEnd("ctx");
  818. }));
  819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  820. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection})});
  821. //>>excludeEnd("ctx");
  822. }; }),
  823. $globals.Collection);
  824. $core.addMethod(
  825. $core.method({
  826. selector: "deepCopy",
  827. protocol: "copying",
  828. //>>excludeStart("ide", pragmas.excludeIdeData);
  829. args: [],
  830. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  831. referencedClasses: [],
  832. //>>excludeEnd("ide");
  833. pragmas: [],
  834. messageSends: ["collect:", "deepCopy"]
  835. }, function ($methodClass){ return function (){
  836. var self=this,$self=this;
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. return $core.withContext(function($ctx1) {
  839. //>>excludeEnd("ctx");
  840. return $self._collect_((function(each){
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx2) {
  843. //>>excludeEnd("ctx");
  844. return $recv(each)._deepCopy();
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  847. //>>excludeEnd("ctx");
  848. }));
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  851. //>>excludeEnd("ctx");
  852. }; }),
  853. $globals.Collection);
  854. $core.addMethod(
  855. $core.method({
  856. selector: "detect:",
  857. protocol: "enumerating",
  858. //>>excludeStart("ide", pragmas.excludeIdeData);
  859. args: ["aBlock"],
  860. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  861. referencedClasses: [],
  862. //>>excludeEnd("ide");
  863. pragmas: [],
  864. messageSends: ["detect:ifNone:", "errorNotFound"]
  865. }, function ($methodClass){ return function (aBlock){
  866. var self=this,$self=this;
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. return $core.withContext(function($ctx1) {
  869. //>>excludeEnd("ctx");
  870. return $self._detect_ifNone_(aBlock,(function(){
  871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  872. return $core.withContext(function($ctx2) {
  873. //>>excludeEnd("ctx");
  874. return $self._errorNotFound();
  875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  876. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  877. //>>excludeEnd("ctx");
  878. }));
  879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  880. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock})});
  881. //>>excludeEnd("ctx");
  882. }; }),
  883. $globals.Collection);
  884. $core.addMethod(
  885. $core.method({
  886. selector: "detect:ifNone:",
  887. protocol: "enumerating",
  888. //>>excludeStart("ide", pragmas.excludeIdeData);
  889. args: ["aBlock", "anotherBlock"],
  890. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  891. referencedClasses: [],
  892. //>>excludeEnd("ide");
  893. pragmas: [],
  894. messageSends: ["do:", "ifTrue:", "value:", "value"]
  895. }, function ($methodClass){ return function (aBlock,anotherBlock){
  896. var self=this,$self=this;
  897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  898. return $core.withContext(function($ctx1) {
  899. //>>excludeEnd("ctx");
  900. var $early={};
  901. try {
  902. $self._do_((function(each){
  903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  904. return $core.withContext(function($ctx2) {
  905. //>>excludeEnd("ctx");
  906. if($core.assert($recv(aBlock)._value_(each))){
  907. throw $early=[each];
  908. }
  909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  911. //>>excludeEnd("ctx");
  912. }));
  913. return $recv(anotherBlock)._value();
  914. }
  915. catch(e) {if(e===$early)return e[0]; throw e}
  916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  917. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  918. //>>excludeEnd("ctx");
  919. }; }),
  920. $globals.Collection);
  921. $core.addMethod(
  922. $core.method({
  923. selector: "do:",
  924. protocol: "enumerating",
  925. //>>excludeStart("ide", pragmas.excludeIdeData);
  926. args: ["aBlock"],
  927. source: "do: aBlock\x0a\x09self subclassResponsibility",
  928. referencedClasses: [],
  929. //>>excludeEnd("ide");
  930. pragmas: [],
  931. messageSends: ["subclassResponsibility"]
  932. }, function ($methodClass){ return function (aBlock){
  933. var self=this,$self=this;
  934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  935. return $core.withContext(function($ctx1) {
  936. //>>excludeEnd("ctx");
  937. $self._subclassResponsibility();
  938. return self;
  939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  940. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  941. //>>excludeEnd("ctx");
  942. }; }),
  943. $globals.Collection);
  944. $core.addMethod(
  945. $core.method({
  946. selector: "do:separatedBy:",
  947. protocol: "enumerating",
  948. //>>excludeStart("ide", pragmas.excludeIdeData);
  949. args: ["aBlock", "anotherBlock"],
  950. 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 ]",
  951. referencedClasses: [],
  952. //>>excludeEnd("ide");
  953. pragmas: [],
  954. messageSends: ["do:", "value", "value:"]
  955. }, function ($methodClass){ return function (aBlock,anotherBlock){
  956. var self=this,$self=this;
  957. var actionBeforeElement;
  958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  959. return $core.withContext(function($ctx1) {
  960. //>>excludeEnd("ctx");
  961. actionBeforeElement=(function(){
  962. actionBeforeElement=anotherBlock;
  963. return actionBeforeElement;
  964. });
  965. $self._do_((function(each){
  966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  967. return $core.withContext(function($ctx2) {
  968. //>>excludeEnd("ctx");
  969. $recv(actionBeforeElement)._value();
  970. return $recv(aBlock)._value_(each);
  971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  973. //>>excludeEnd("ctx");
  974. }));
  975. return self;
  976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  977. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement})});
  978. //>>excludeEnd("ctx");
  979. }; }),
  980. $globals.Collection);
  981. $core.addMethod(
  982. $core.method({
  983. selector: "errorNotFound",
  984. protocol: "error handling",
  985. //>>excludeStart("ide", pragmas.excludeIdeData);
  986. args: [],
  987. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  988. referencedClasses: [],
  989. //>>excludeEnd("ide");
  990. pragmas: [],
  991. messageSends: ["error:"]
  992. }, function ($methodClass){ return function (){
  993. var self=this,$self=this;
  994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  995. return $core.withContext(function($ctx1) {
  996. //>>excludeEnd("ctx");
  997. $self._error_("Object is not in the collection");
  998. return self;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{})});
  1001. //>>excludeEnd("ctx");
  1002. }; }),
  1003. $globals.Collection);
  1004. $core.addMethod(
  1005. $core.method({
  1006. selector: "ifEmpty:",
  1007. protocol: "testing",
  1008. //>>excludeStart("ide", pragmas.excludeIdeData);
  1009. args: ["aBlock"],
  1010. 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 ]",
  1011. referencedClasses: [],
  1012. //>>excludeEnd("ide");
  1013. pragmas: [],
  1014. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1015. }, function ($methodClass){ return function (aBlock){
  1016. var self=this,$self=this;
  1017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1018. return $core.withContext(function($ctx1) {
  1019. //>>excludeEnd("ctx");
  1020. if($core.assert($self._isEmpty())){
  1021. return $recv(aBlock)._value();
  1022. } else {
  1023. return self;
  1024. }
  1025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1026. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock})});
  1027. //>>excludeEnd("ctx");
  1028. }; }),
  1029. $globals.Collection);
  1030. $core.addMethod(
  1031. $core.method({
  1032. selector: "ifEmpty:ifNotEmpty:",
  1033. protocol: "testing",
  1034. //>>excludeStart("ide", pragmas.excludeIdeData);
  1035. args: ["aBlock", "anotherBlock"],
  1036. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1037. referencedClasses: [],
  1038. //>>excludeEnd("ide");
  1039. pragmas: [],
  1040. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1041. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1042. var self=this,$self=this;
  1043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1044. return $core.withContext(function($ctx1) {
  1045. //>>excludeEnd("ctx");
  1046. if($core.assert($self._isEmpty())){
  1047. return $recv(aBlock)._value();
  1048. } else {
  1049. return $recv(anotherBlock)._value_(self);
  1050. }
  1051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1052. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1053. //>>excludeEnd("ctx");
  1054. }; }),
  1055. $globals.Collection);
  1056. $core.addMethod(
  1057. $core.method({
  1058. selector: "ifNotEmpty:",
  1059. protocol: "testing",
  1060. //>>excludeStart("ide", pragmas.excludeIdeData);
  1061. args: ["aBlock"],
  1062. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1063. referencedClasses: [],
  1064. //>>excludeEnd("ide");
  1065. pragmas: [],
  1066. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1067. }, function ($methodClass){ return function (aBlock){
  1068. var self=this,$self=this;
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. return $core.withContext(function($ctx1) {
  1071. //>>excludeEnd("ctx");
  1072. if($core.assert($self._notEmpty())){
  1073. return $recv(aBlock)._value_(self);
  1074. } else {
  1075. return self;
  1076. }
  1077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1078. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock})});
  1079. //>>excludeEnd("ctx");
  1080. }; }),
  1081. $globals.Collection);
  1082. $core.addMethod(
  1083. $core.method({
  1084. selector: "ifNotEmpty:ifEmpty:",
  1085. protocol: "testing",
  1086. //>>excludeStart("ide", pragmas.excludeIdeData);
  1087. args: ["aBlock", "anotherBlock"],
  1088. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1089. referencedClasses: [],
  1090. //>>excludeEnd("ide");
  1091. pragmas: [],
  1092. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1093. }, function ($methodClass){ return function (aBlock,anotherBlock){
  1094. var self=this,$self=this;
  1095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1096. return $core.withContext(function($ctx1) {
  1097. //>>excludeEnd("ctx");
  1098. if($core.assert($self._notEmpty())){
  1099. return $recv(aBlock)._value_(self);
  1100. } else {
  1101. return $recv(anotherBlock)._value();
  1102. }
  1103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1104. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  1105. //>>excludeEnd("ctx");
  1106. }; }),
  1107. $globals.Collection);
  1108. $core.addMethod(
  1109. $core.method({
  1110. selector: "includes:",
  1111. protocol: "testing",
  1112. //>>excludeStart("ide", pragmas.excludeIdeData);
  1113. args: ["anObject"],
  1114. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1115. referencedClasses: [],
  1116. //>>excludeEnd("ide");
  1117. pragmas: [],
  1118. messageSends: ["anySatisfy:", "="]
  1119. }, function ($methodClass){ return function (anObject){
  1120. var self=this,$self=this;
  1121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1122. return $core.withContext(function($ctx1) {
  1123. //>>excludeEnd("ctx");
  1124. return $self._anySatisfy_((function(each){
  1125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1126. return $core.withContext(function($ctx2) {
  1127. //>>excludeEnd("ctx");
  1128. return $recv(each).__eq(anObject);
  1129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1130. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1131. //>>excludeEnd("ctx");
  1132. }));
  1133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1134. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  1135. //>>excludeEnd("ctx");
  1136. }; }),
  1137. $globals.Collection);
  1138. $core.addMethod(
  1139. $core.method({
  1140. selector: "inject:into:",
  1141. protocol: "enumerating",
  1142. //>>excludeStart("ide", pragmas.excludeIdeData);
  1143. args: ["anObject", "aBlock"],
  1144. 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",
  1145. referencedClasses: [],
  1146. //>>excludeEnd("ide");
  1147. pragmas: [],
  1148. messageSends: ["do:", "value:value:"]
  1149. }, function ($methodClass){ return function (anObject,aBlock){
  1150. var self=this,$self=this;
  1151. var result;
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. return $core.withContext(function($ctx1) {
  1154. //>>excludeEnd("ctx");
  1155. result=anObject;
  1156. $self._do_((function(each){
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. return $core.withContext(function($ctx2) {
  1159. //>>excludeEnd("ctx");
  1160. result=$recv(aBlock)._value_value_(result,each);
  1161. return result;
  1162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1163. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1164. //>>excludeEnd("ctx");
  1165. }));
  1166. return result;
  1167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1168. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result})});
  1169. //>>excludeEnd("ctx");
  1170. }; }),
  1171. $globals.Collection);
  1172. $core.addMethod(
  1173. $core.method({
  1174. selector: "intersection:",
  1175. protocol: "enumerating",
  1176. //>>excludeStart("ide", pragmas.excludeIdeData);
  1177. args: ["aCollection"],
  1178. 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",
  1179. referencedClasses: ["Set"],
  1180. //>>excludeEnd("ide");
  1181. pragmas: [],
  1182. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1183. }, function ($methodClass){ return function (aCollection){
  1184. var self=this,$self=this;
  1185. var set,outputSet;
  1186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1187. return $core.withContext(function($ctx1) {
  1188. //>>excludeEnd("ctx");
  1189. set=$self._asSet();
  1190. outputSet=$recv($globals.Set)._new();
  1191. $recv(aCollection)._do_((function(each){
  1192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1193. return $core.withContext(function($ctx2) {
  1194. //>>excludeEnd("ctx");
  1195. if($core.assert($recv([$recv(set)._includes_(each)
  1196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1197. ,$ctx2.sendIdx["includes:"]=1
  1198. //>>excludeEnd("ctx");
  1199. ][0])._and_((function(){
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. return $core.withContext(function($ctx3) {
  1202. //>>excludeEnd("ctx");
  1203. return $recv($recv(outputSet)._includes_(each))._not();
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1206. //>>excludeEnd("ctx");
  1207. })))){
  1208. return $recv(outputSet)._add_(each);
  1209. }
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1212. //>>excludeEnd("ctx");
  1213. }));
  1214. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  1215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1216. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet})});
  1217. //>>excludeEnd("ctx");
  1218. }; }),
  1219. $globals.Collection);
  1220. $core.addMethod(
  1221. $core.method({
  1222. selector: "isEmpty",
  1223. protocol: "testing",
  1224. //>>excludeStart("ide", pragmas.excludeIdeData);
  1225. args: [],
  1226. source: "isEmpty\x0a\x09^ self size = 0",
  1227. referencedClasses: [],
  1228. //>>excludeEnd("ide");
  1229. pragmas: [],
  1230. messageSends: ["=", "size"]
  1231. }, function ($methodClass){ return function (){
  1232. var self=this,$self=this;
  1233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1234. return $core.withContext(function($ctx1) {
  1235. //>>excludeEnd("ctx");
  1236. return $recv($self._size()).__eq((0));
  1237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1238. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  1239. //>>excludeEnd("ctx");
  1240. }; }),
  1241. $globals.Collection);
  1242. $core.addMethod(
  1243. $core.method({
  1244. selector: "noneSatisfy:",
  1245. protocol: "enumerating",
  1246. //>>excludeStart("ide", pragmas.excludeIdeData);
  1247. args: ["aBlock"],
  1248. 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",
  1249. referencedClasses: [],
  1250. //>>excludeEnd("ide");
  1251. pragmas: [],
  1252. messageSends: ["do:", "ifTrue:", "value:"]
  1253. }, function ($methodClass){ return function (aBlock){
  1254. var self=this,$self=this;
  1255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1256. return $core.withContext(function($ctx1) {
  1257. //>>excludeEnd("ctx");
  1258. var $early={};
  1259. try {
  1260. $self._do_((function(item){
  1261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1262. return $core.withContext(function($ctx2) {
  1263. //>>excludeEnd("ctx");
  1264. if($core.assert($recv(aBlock)._value_(item))){
  1265. throw $early=[false];
  1266. }
  1267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1268. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1269. //>>excludeEnd("ctx");
  1270. }));
  1271. return true;
  1272. }
  1273. catch(e) {if(e===$early)return e[0]; throw e}
  1274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1275. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock})});
  1276. //>>excludeEnd("ctx");
  1277. }; }),
  1278. $globals.Collection);
  1279. $core.addMethod(
  1280. $core.method({
  1281. selector: "notEmpty",
  1282. protocol: "testing",
  1283. //>>excludeStart("ide", pragmas.excludeIdeData);
  1284. args: [],
  1285. source: "notEmpty\x0a\x09^ self isEmpty not",
  1286. referencedClasses: [],
  1287. //>>excludeEnd("ide");
  1288. pragmas: [],
  1289. messageSends: ["not", "isEmpty"]
  1290. }, function ($methodClass){ return function (){
  1291. var self=this,$self=this;
  1292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1293. return $core.withContext(function($ctx1) {
  1294. //>>excludeEnd("ctx");
  1295. return $recv($self._isEmpty())._not();
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{})});
  1298. //>>excludeEnd("ctx");
  1299. }; }),
  1300. $globals.Collection);
  1301. $core.addMethod(
  1302. $core.method({
  1303. selector: "occurrencesOf:",
  1304. protocol: "accessing",
  1305. //>>excludeStart("ide", pragmas.excludeIdeData);
  1306. args: ["anObject"],
  1307. 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",
  1308. referencedClasses: [],
  1309. //>>excludeEnd("ide");
  1310. pragmas: [],
  1311. messageSends: ["do:", "ifTrue:", "=", "+"]
  1312. }, function ($methodClass){ return function (anObject){
  1313. var self=this,$self=this;
  1314. var tally;
  1315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1316. return $core.withContext(function($ctx1) {
  1317. //>>excludeEnd("ctx");
  1318. tally=(0);
  1319. $self._do_((function(each){
  1320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1321. return $core.withContext(function($ctx2) {
  1322. //>>excludeEnd("ctx");
  1323. if($core.assert($recv(anObject).__eq(each))){
  1324. tally=$recv(tally).__plus((1));
  1325. return tally;
  1326. }
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1329. //>>excludeEnd("ctx");
  1330. }));
  1331. return tally;
  1332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1333. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally})});
  1334. //>>excludeEnd("ctx");
  1335. }; }),
  1336. $globals.Collection);
  1337. $core.addMethod(
  1338. $core.method({
  1339. selector: "putOn:",
  1340. protocol: "streaming",
  1341. //>>excludeStart("ide", pragmas.excludeIdeData);
  1342. args: ["aStream"],
  1343. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1344. referencedClasses: [],
  1345. //>>excludeEnd("ide");
  1346. pragmas: [],
  1347. messageSends: ["do:", "putOn:"]
  1348. }, function ($methodClass){ return function (aStream){
  1349. var self=this,$self=this;
  1350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1351. return $core.withContext(function($ctx1) {
  1352. //>>excludeEnd("ctx");
  1353. $self._do_((function(each){
  1354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1355. return $core.withContext(function($ctx2) {
  1356. //>>excludeEnd("ctx");
  1357. return $recv(each)._putOn_(aStream);
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1360. //>>excludeEnd("ctx");
  1361. }));
  1362. return self;
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  1365. //>>excludeEnd("ctx");
  1366. }; }),
  1367. $globals.Collection);
  1368. $core.addMethod(
  1369. $core.method({
  1370. selector: "reject:",
  1371. protocol: "enumerating",
  1372. //>>excludeStart("ide", pragmas.excludeIdeData);
  1373. args: ["aBlock"],
  1374. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1375. referencedClasses: [],
  1376. //>>excludeEnd("ide");
  1377. pragmas: [],
  1378. messageSends: ["select:", "=", "value:"]
  1379. }, function ($methodClass){ return function (aBlock){
  1380. var self=this,$self=this;
  1381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1382. return $core.withContext(function($ctx1) {
  1383. //>>excludeEnd("ctx");
  1384. return $self._select_((function(each){
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. return $core.withContext(function($ctx2) {
  1387. //>>excludeEnd("ctx");
  1388. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1391. //>>excludeEnd("ctx");
  1392. }));
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock})});
  1395. //>>excludeEnd("ctx");
  1396. }; }),
  1397. $globals.Collection);
  1398. $core.addMethod(
  1399. $core.method({
  1400. selector: "remove:",
  1401. protocol: "adding/removing",
  1402. //>>excludeStart("ide", pragmas.excludeIdeData);
  1403. args: ["anObject"],
  1404. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1405. referencedClasses: [],
  1406. //>>excludeEnd("ide");
  1407. pragmas: [],
  1408. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1409. }, function ($methodClass){ return function (anObject){
  1410. var self=this,$self=this;
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. return $core.withContext(function($ctx1) {
  1413. //>>excludeEnd("ctx");
  1414. return $self._remove_ifAbsent_(anObject,(function(){
  1415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1416. return $core.withContext(function($ctx2) {
  1417. //>>excludeEnd("ctx");
  1418. return $self._errorNotFound();
  1419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1421. //>>excludeEnd("ctx");
  1422. }));
  1423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1424. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  1425. //>>excludeEnd("ctx");
  1426. }; }),
  1427. $globals.Collection);
  1428. $core.addMethod(
  1429. $core.method({
  1430. selector: "remove:ifAbsent:",
  1431. protocol: "adding/removing",
  1432. //>>excludeStart("ide", pragmas.excludeIdeData);
  1433. args: ["anObject", "aBlock"],
  1434. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1435. referencedClasses: [],
  1436. //>>excludeEnd("ide");
  1437. pragmas: [],
  1438. messageSends: ["subclassResponsibility"]
  1439. }, function ($methodClass){ return function (anObject,aBlock){
  1440. var self=this,$self=this;
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. return $core.withContext(function($ctx1) {
  1443. //>>excludeEnd("ctx");
  1444. $self._subclassResponsibility();
  1445. return self;
  1446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1447. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  1448. //>>excludeEnd("ctx");
  1449. }; }),
  1450. $globals.Collection);
  1451. $core.addMethod(
  1452. $core.method({
  1453. selector: "removeAll",
  1454. protocol: "adding/removing",
  1455. //>>excludeStart("ide", pragmas.excludeIdeData);
  1456. args: [],
  1457. source: "removeAll\x0a\x09self subclassResponsibility",
  1458. referencedClasses: [],
  1459. //>>excludeEnd("ide");
  1460. pragmas: [],
  1461. messageSends: ["subclassResponsibility"]
  1462. }, function ($methodClass){ return function (){
  1463. var self=this,$self=this;
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. return $core.withContext(function($ctx1) {
  1466. //>>excludeEnd("ctx");
  1467. $self._subclassResponsibility();
  1468. return self;
  1469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1470. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  1471. //>>excludeEnd("ctx");
  1472. }; }),
  1473. $globals.Collection);
  1474. $core.addMethod(
  1475. $core.method({
  1476. selector: "select:",
  1477. protocol: "enumerating",
  1478. //>>excludeStart("ide", pragmas.excludeIdeData);
  1479. args: ["aBlock"],
  1480. 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",
  1481. referencedClasses: [],
  1482. //>>excludeEnd("ide");
  1483. pragmas: [],
  1484. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1485. }, function ($methodClass){ return function (aBlock){
  1486. var self=this,$self=this;
  1487. var stream;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. return $core.withContext(function($ctx1) {
  1490. //>>excludeEnd("ctx");
  1491. stream=$recv($recv($self._class())._new())._writeStream();
  1492. $self._do_((function(each){
  1493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1494. return $core.withContext(function($ctx2) {
  1495. //>>excludeEnd("ctx");
  1496. if($core.assert($recv(aBlock)._value_(each))){
  1497. return $recv(stream)._nextPut_(each);
  1498. }
  1499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1500. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1501. //>>excludeEnd("ctx");
  1502. }));
  1503. return $recv(stream)._contents();
  1504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1505. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream})});
  1506. //>>excludeEnd("ctx");
  1507. }; }),
  1508. $globals.Collection);
  1509. $core.addMethod(
  1510. $core.method({
  1511. selector: "select:thenCollect:",
  1512. protocol: "enumerating",
  1513. //>>excludeStart("ide", pragmas.excludeIdeData);
  1514. args: ["selectBlock", "collectBlock"],
  1515. 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",
  1516. referencedClasses: [],
  1517. //>>excludeEnd("ide");
  1518. pragmas: [],
  1519. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1520. }, function ($methodClass){ return function (selectBlock,collectBlock){
  1521. var self=this,$self=this;
  1522. var stream;
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. return $core.withContext(function($ctx1) {
  1525. //>>excludeEnd("ctx");
  1526. stream=$recv($recv($self._class())._new())._writeStream();
  1527. $self._do_((function(each){
  1528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1529. return $core.withContext(function($ctx2) {
  1530. //>>excludeEnd("ctx");
  1531. if($core.assert([$recv(selectBlock)._value_(each)
  1532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1533. ,$ctx2.sendIdx["value:"]=1
  1534. //>>excludeEnd("ctx");
  1535. ][0])){
  1536. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1537. }
  1538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1539. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1540. //>>excludeEnd("ctx");
  1541. }));
  1542. return $recv(stream)._contents();
  1543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1544. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream})});
  1545. //>>excludeEnd("ctx");
  1546. }; }),
  1547. $globals.Collection);
  1548. $core.addMethod(
  1549. $core.method({
  1550. selector: "shallowCopy",
  1551. protocol: "copying",
  1552. //>>excludeStart("ide", pragmas.excludeIdeData);
  1553. args: [],
  1554. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1555. referencedClasses: [],
  1556. //>>excludeEnd("ide");
  1557. pragmas: [],
  1558. messageSends: ["collect:"]
  1559. }, function ($methodClass){ return function (){
  1560. var self=this,$self=this;
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. return $core.withContext(function($ctx1) {
  1563. //>>excludeEnd("ctx");
  1564. return $self._collect_((function(each){
  1565. return each;
  1566. }));
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  1569. //>>excludeEnd("ctx");
  1570. }; }),
  1571. $globals.Collection);
  1572. $core.addMethod(
  1573. $core.method({
  1574. selector: "single",
  1575. protocol: "accessing",
  1576. //>>excludeStart("ide", pragmas.excludeIdeData);
  1577. args: [],
  1578. 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",
  1579. referencedClasses: [],
  1580. //>>excludeEnd("ide");
  1581. pragmas: [],
  1582. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1583. }, function ($methodClass){ return function (){
  1584. var self=this,$self=this;
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. return $core.withContext(function($ctx1) {
  1587. //>>excludeEnd("ctx");
  1588. $self._ifEmpty_((function(){
  1589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1590. return $core.withContext(function($ctx2) {
  1591. //>>excludeEnd("ctx");
  1592. return [$self._error_("Collection is empty")
  1593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1594. ,$ctx2.sendIdx["error:"]=1
  1595. //>>excludeEnd("ctx");
  1596. ][0];
  1597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1599. //>>excludeEnd("ctx");
  1600. }));
  1601. if($core.assert($recv($self._size()).__gt((1)))){
  1602. $self._error_("Collection holds more than one element");
  1603. }
  1604. return $self._anyOne();
  1605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1606. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  1607. //>>excludeEnd("ctx");
  1608. }; }),
  1609. $globals.Collection);
  1610. $core.addMethod(
  1611. $core.method({
  1612. selector: "size",
  1613. protocol: "accessing",
  1614. //>>excludeStart("ide", pragmas.excludeIdeData);
  1615. args: [],
  1616. source: "size\x0a\x09self subclassResponsibility",
  1617. referencedClasses: [],
  1618. //>>excludeEnd("ide");
  1619. pragmas: [],
  1620. messageSends: ["subclassResponsibility"]
  1621. }, function ($methodClass){ return function (){
  1622. var self=this,$self=this;
  1623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1624. return $core.withContext(function($ctx1) {
  1625. //>>excludeEnd("ctx");
  1626. $self._subclassResponsibility();
  1627. return self;
  1628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1629. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  1630. //>>excludeEnd("ctx");
  1631. }; }),
  1632. $globals.Collection);
  1633. $core.addMethod(
  1634. $core.method({
  1635. selector: "classTag",
  1636. protocol: "accessing",
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: [],
  1639. 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'",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. pragmas: [],
  1643. messageSends: []
  1644. }, function ($methodClass){ return function (){
  1645. var self=this,$self=this;
  1646. return "collection";
  1647. }; }),
  1648. $globals.Collection.a$cls);
  1649. $core.addMethod(
  1650. $core.method({
  1651. selector: "new:",
  1652. protocol: "instance creation",
  1653. //>>excludeStart("ide", pragmas.excludeIdeData);
  1654. args: ["anInteger"],
  1655. source: "new: anInteger\x0a\x09^ self new",
  1656. referencedClasses: [],
  1657. //>>excludeEnd("ide");
  1658. pragmas: [],
  1659. messageSends: ["new"]
  1660. }, function ($methodClass){ return function (anInteger){
  1661. var self=this,$self=this;
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. return $core.withContext(function($ctx1) {
  1664. //>>excludeEnd("ctx");
  1665. return $self._new();
  1666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1667. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  1668. //>>excludeEnd("ctx");
  1669. }; }),
  1670. $globals.Collection.a$cls);
  1671. $core.addMethod(
  1672. $core.method({
  1673. selector: "with:",
  1674. protocol: "instance creation",
  1675. //>>excludeStart("ide", pragmas.excludeIdeData);
  1676. args: ["anObject"],
  1677. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1678. referencedClasses: [],
  1679. //>>excludeEnd("ide");
  1680. pragmas: [],
  1681. messageSends: ["add:", "new", "yourself"]
  1682. }, function ($methodClass){ return function (anObject){
  1683. var self=this,$self=this;
  1684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1685. return $core.withContext(function($ctx1) {
  1686. //>>excludeEnd("ctx");
  1687. var $1;
  1688. $1=$self._new();
  1689. $recv($1)._add_(anObject);
  1690. return $recv($1)._yourself();
  1691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1692. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  1693. //>>excludeEnd("ctx");
  1694. }; }),
  1695. $globals.Collection.a$cls);
  1696. $core.addMethod(
  1697. $core.method({
  1698. selector: "with:with:",
  1699. protocol: "instance creation",
  1700. //>>excludeStart("ide", pragmas.excludeIdeData);
  1701. args: ["anObject", "anotherObject"],
  1702. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1703. referencedClasses: [],
  1704. //>>excludeEnd("ide");
  1705. pragmas: [],
  1706. messageSends: ["add:", "new", "yourself"]
  1707. }, function ($methodClass){ return function (anObject,anotherObject){
  1708. var self=this,$self=this;
  1709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1710. return $core.withContext(function($ctx1) {
  1711. //>>excludeEnd("ctx");
  1712. var $1;
  1713. $1=$self._new();
  1714. [$recv($1)._add_(anObject)
  1715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1716. ,$ctx1.sendIdx["add:"]=1
  1717. //>>excludeEnd("ctx");
  1718. ][0];
  1719. $recv($1)._add_(anotherObject);
  1720. return $recv($1)._yourself();
  1721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1722. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject})});
  1723. //>>excludeEnd("ctx");
  1724. }; }),
  1725. $globals.Collection.a$cls);
  1726. $core.addMethod(
  1727. $core.method({
  1728. selector: "with:with:with:",
  1729. protocol: "instance creation",
  1730. //>>excludeStart("ide", pragmas.excludeIdeData);
  1731. args: ["firstObject", "secondObject", "thirdObject"],
  1732. 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",
  1733. referencedClasses: [],
  1734. //>>excludeEnd("ide");
  1735. pragmas: [],
  1736. messageSends: ["add:", "new", "yourself"]
  1737. }, function ($methodClass){ return function (firstObject,secondObject,thirdObject){
  1738. var self=this,$self=this;
  1739. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1740. return $core.withContext(function($ctx1) {
  1741. //>>excludeEnd("ctx");
  1742. var $1;
  1743. $1=$self._new();
  1744. [$recv($1)._add_(firstObject)
  1745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1746. ,$ctx1.sendIdx["add:"]=1
  1747. //>>excludeEnd("ctx");
  1748. ][0];
  1749. [$recv($1)._add_(secondObject)
  1750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1751. ,$ctx1.sendIdx["add:"]=2
  1752. //>>excludeEnd("ctx");
  1753. ][0];
  1754. $recv($1)._add_(thirdObject);
  1755. return $recv($1)._yourself();
  1756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1757. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject})});
  1758. //>>excludeEnd("ctx");
  1759. }; }),
  1760. $globals.Collection.a$cls);
  1761. $core.addMethod(
  1762. $core.method({
  1763. selector: "withAll:",
  1764. protocol: "instance creation",
  1765. //>>excludeStart("ide", pragmas.excludeIdeData);
  1766. args: ["aCollection"],
  1767. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1768. referencedClasses: [],
  1769. //>>excludeEnd("ide");
  1770. pragmas: [],
  1771. messageSends: ["addAll:", "new", "yourself"]
  1772. }, function ($methodClass){ return function (aCollection){
  1773. var self=this,$self=this;
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. return $core.withContext(function($ctx1) {
  1776. //>>excludeEnd("ctx");
  1777. var $1;
  1778. $1=$self._new();
  1779. $recv($1)._addAll_(aCollection);
  1780. return $recv($1)._yourself();
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection})});
  1783. //>>excludeEnd("ctx");
  1784. }; }),
  1785. $globals.Collection.a$cls);
  1786. $core.addClass("AssociativeCollection", $globals.Collection, [], "Kernel-Collections");
  1787. //>>excludeStart("ide", pragmas.excludeIdeData);
  1788. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1789. //>>excludeEnd("ide");
  1790. $core.addMethod(
  1791. $core.method({
  1792. selector: "=",
  1793. protocol: "comparing",
  1794. //>>excludeStart("ide", pragmas.excludeIdeData);
  1795. args: ["anAssocitativeCollection"],
  1796. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  1797. referencedClasses: [],
  1798. //>>excludeEnd("ide");
  1799. pragmas: [],
  1800. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  1801. }, function ($methodClass){ return function (anAssocitativeCollection){
  1802. var self=this,$self=this;
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. return $core.withContext(function($ctx1) {
  1805. //>>excludeEnd("ctx");
  1806. if(!$core.assert([$recv([$self._class()
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. ,$ctx1.sendIdx["class"]=1
  1809. //>>excludeEnd("ctx");
  1810. ][0]).__eq($recv(anAssocitativeCollection)._class())
  1811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1812. ,$ctx1.sendIdx["="]=1
  1813. //>>excludeEnd("ctx");
  1814. ][0])){
  1815. return false;
  1816. }
  1817. if(!$core.assert([$recv([$self._size()
  1818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1819. ,$ctx1.sendIdx["size"]=1
  1820. //>>excludeEnd("ctx");
  1821. ][0]).__eq($recv(anAssocitativeCollection)._size())
  1822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1823. ,$ctx1.sendIdx["="]=2
  1824. //>>excludeEnd("ctx");
  1825. ][0])){
  1826. return false;
  1827. }
  1828. return $recv([$self._associations()
  1829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1830. ,$ctx1.sendIdx["associations"]=1
  1831. //>>excludeEnd("ctx");
  1832. ][0]).__eq($recv(anAssocitativeCollection)._associations());
  1833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1834. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection})});
  1835. //>>excludeEnd("ctx");
  1836. }; }),
  1837. $globals.AssociativeCollection);
  1838. $core.addMethod(
  1839. $core.method({
  1840. selector: "add:",
  1841. protocol: "adding/removing",
  1842. //>>excludeStart("ide", pragmas.excludeIdeData);
  1843. args: ["anAssociation"],
  1844. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1845. referencedClasses: [],
  1846. //>>excludeEnd("ide");
  1847. pragmas: [],
  1848. messageSends: ["at:put:", "key", "value"]
  1849. }, function ($methodClass){ return function (anAssociation){
  1850. var self=this,$self=this;
  1851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1852. return $core.withContext(function($ctx1) {
  1853. //>>excludeEnd("ctx");
  1854. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  1855. return self;
  1856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1857. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation})});
  1858. //>>excludeEnd("ctx");
  1859. }; }),
  1860. $globals.AssociativeCollection);
  1861. $core.addMethod(
  1862. $core.method({
  1863. selector: "addAll:",
  1864. protocol: "adding/removing",
  1865. //>>excludeStart("ide", pragmas.excludeIdeData);
  1866. args: ["anAssociativeCollection"],
  1867. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  1868. referencedClasses: [],
  1869. //>>excludeEnd("ide");
  1870. pragmas: [],
  1871. messageSends: ["addAll:", "associations"]
  1872. }, function ($methodClass){ return function (anAssociativeCollection){
  1873. var self=this,$self=this;
  1874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1875. return $core.withContext(function($ctx1) {
  1876. //>>excludeEnd("ctx");
  1877. [(
  1878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1879. $ctx1.supercall = true,
  1880. //>>excludeEnd("ctx");
  1881. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._addAll_.call($self,$recv(anAssociativeCollection)._associations()))
  1882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1883. ,$ctx1.supercall = false
  1884. //>>excludeEnd("ctx");
  1885. ][0];
  1886. return anAssociativeCollection;
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection})});
  1889. //>>excludeEnd("ctx");
  1890. }; }),
  1891. $globals.AssociativeCollection);
  1892. $core.addMethod(
  1893. $core.method({
  1894. selector: "asDictionary",
  1895. protocol: "converting",
  1896. //>>excludeStart("ide", pragmas.excludeIdeData);
  1897. args: [],
  1898. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  1899. referencedClasses: ["Dictionary"],
  1900. //>>excludeEnd("ide");
  1901. pragmas: [],
  1902. messageSends: ["from:", "associations"]
  1903. }, function ($methodClass){ return function (){
  1904. var self=this,$self=this;
  1905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1906. return $core.withContext(function($ctx1) {
  1907. //>>excludeEnd("ctx");
  1908. return $recv($globals.Dictionary)._from_($self._associations());
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{})});
  1911. //>>excludeEnd("ctx");
  1912. }; }),
  1913. $globals.AssociativeCollection);
  1914. $core.addMethod(
  1915. $core.method({
  1916. selector: "asHashedCollection",
  1917. protocol: "converting",
  1918. //>>excludeStart("ide", pragmas.excludeIdeData);
  1919. args: [],
  1920. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  1921. referencedClasses: ["HashedCollection"],
  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.HashedCollection)._from_($self._associations());
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{})});
  1933. //>>excludeEnd("ctx");
  1934. }; }),
  1935. $globals.AssociativeCollection);
  1936. $core.addMethod(
  1937. $core.method({
  1938. selector: "asJavaScriptObject",
  1939. protocol: "converting",
  1940. //>>excludeStart("ide", pragmas.excludeIdeData);
  1941. args: [],
  1942. 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",
  1943. referencedClasses: ["HashedCollection"],
  1944. //>>excludeEnd("ide");
  1945. pragmas: [],
  1946. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  1947. }, function ($methodClass){ return function (){
  1948. var self=this,$self=this;
  1949. var hash;
  1950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1951. return $core.withContext(function($ctx1) {
  1952. //>>excludeEnd("ctx");
  1953. hash=$recv($globals.HashedCollection)._new();
  1954. $self._keysAndValuesDo_((function(key,value){
  1955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1956. return $core.withContext(function($ctx2) {
  1957. //>>excludeEnd("ctx");
  1958. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  1959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1960. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  1961. //>>excludeEnd("ctx");
  1962. }));
  1963. return hash;
  1964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1965. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash})});
  1966. //>>excludeEnd("ctx");
  1967. }; }),
  1968. $globals.AssociativeCollection);
  1969. $core.addMethod(
  1970. $core.method({
  1971. selector: "associations",
  1972. protocol: "accessing",
  1973. //>>excludeStart("ide", pragmas.excludeIdeData);
  1974. args: [],
  1975. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  1976. referencedClasses: [],
  1977. //>>excludeEnd("ide");
  1978. pragmas: [],
  1979. messageSends: ["associationsDo:", "add:"]
  1980. }, function ($methodClass){ return function (){
  1981. var self=this,$self=this;
  1982. var associations;
  1983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1984. return $core.withContext(function($ctx1) {
  1985. //>>excludeEnd("ctx");
  1986. associations=[];
  1987. $self._associationsDo_((function(each){
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. return $core.withContext(function($ctx2) {
  1990. //>>excludeEnd("ctx");
  1991. return $recv(associations)._add_(each);
  1992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1993. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1994. //>>excludeEnd("ctx");
  1995. }));
  1996. return associations;
  1997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1998. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations})});
  1999. //>>excludeEnd("ctx");
  2000. }; }),
  2001. $globals.AssociativeCollection);
  2002. $core.addMethod(
  2003. $core.method({
  2004. selector: "associationsDo:",
  2005. protocol: "enumerating",
  2006. //>>excludeStart("ide", pragmas.excludeIdeData);
  2007. args: ["aBlock"],
  2008. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2009. referencedClasses: ["Association"],
  2010. //>>excludeEnd("ide");
  2011. pragmas: [],
  2012. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2013. }, function ($methodClass){ return function (aBlock){
  2014. var self=this,$self=this;
  2015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2016. return $core.withContext(function($ctx1) {
  2017. //>>excludeEnd("ctx");
  2018. $self._keysAndValuesDo_((function(key,value){
  2019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2020. return $core.withContext(function($ctx2) {
  2021. //>>excludeEnd("ctx");
  2022. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2025. //>>excludeEnd("ctx");
  2026. }));
  2027. return self;
  2028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2029. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock})});
  2030. //>>excludeEnd("ctx");
  2031. }; }),
  2032. $globals.AssociativeCollection);
  2033. $core.addMethod(
  2034. $core.method({
  2035. selector: "at:ifPresent:ifAbsent:",
  2036. protocol: "accessing",
  2037. //>>excludeStart("ide", pragmas.excludeIdeData);
  2038. args: ["aKey", "aBlock", "anotherBlock"],
  2039. 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 ]",
  2040. referencedClasses: [],
  2041. //>>excludeEnd("ide");
  2042. pragmas: [],
  2043. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2044. }, function ($methodClass){ return function (aKey,aBlock,anotherBlock){
  2045. var self=this,$self=this;
  2046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2047. return $core.withContext(function($ctx1) {
  2048. //>>excludeEnd("ctx");
  2049. if($core.assert($self._includesKey_(aKey))){
  2050. return $recv(aBlock)._value_($self._at_(aKey));
  2051. } else {
  2052. return $recv(anotherBlock)._value();
  2053. }
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock})});
  2056. //>>excludeEnd("ctx");
  2057. }; }),
  2058. $globals.AssociativeCollection);
  2059. $core.addMethod(
  2060. $core.method({
  2061. selector: "collect:",
  2062. protocol: "enumerating",
  2063. //>>excludeStart("ide", pragmas.excludeIdeData);
  2064. args: ["aBlock"],
  2065. 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",
  2066. referencedClasses: [],
  2067. //>>excludeEnd("ide");
  2068. pragmas: [],
  2069. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2070. }, function ($methodClass){ return function (aBlock){
  2071. var self=this,$self=this;
  2072. var newDict;
  2073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2074. return $core.withContext(function($ctx1) {
  2075. //>>excludeEnd("ctx");
  2076. newDict=$recv($self._class())._new();
  2077. $self._keysAndValuesDo_((function(key,value){
  2078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2079. return $core.withContext(function($ctx2) {
  2080. //>>excludeEnd("ctx");
  2081. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2083. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2084. //>>excludeEnd("ctx");
  2085. }));
  2086. return newDict;
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict})});
  2089. //>>excludeEnd("ctx");
  2090. }; }),
  2091. $globals.AssociativeCollection);
  2092. $core.addMethod(
  2093. $core.method({
  2094. selector: "deepCopy",
  2095. protocol: "copying",
  2096. //>>excludeStart("ide", pragmas.excludeIdeData);
  2097. args: [],
  2098. 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",
  2099. referencedClasses: [],
  2100. //>>excludeEnd("ide");
  2101. pragmas: [],
  2102. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2103. }, function ($methodClass){ return function (){
  2104. var self=this,$self=this;
  2105. var copy;
  2106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2107. return $core.withContext(function($ctx1) {
  2108. //>>excludeEnd("ctx");
  2109. copy=$recv($self._class())._new();
  2110. $self._keysAndValuesDo_((function(key,value){
  2111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2112. return $core.withContext(function($ctx2) {
  2113. //>>excludeEnd("ctx");
  2114. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2116. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2117. //>>excludeEnd("ctx");
  2118. }));
  2119. return copy;
  2120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2121. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy})});
  2122. //>>excludeEnd("ctx");
  2123. }; }),
  2124. $globals.AssociativeCollection);
  2125. $core.addMethod(
  2126. $core.method({
  2127. selector: "detect:ifNone:",
  2128. protocol: "enumerating",
  2129. //>>excludeStart("ide", pragmas.excludeIdeData);
  2130. args: ["aBlock", "anotherBlock"],
  2131. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2132. referencedClasses: [],
  2133. //>>excludeEnd("ide");
  2134. pragmas: [],
  2135. messageSends: ["detect:ifNone:", "values"]
  2136. }, function ($methodClass){ return function (aBlock,anotherBlock){
  2137. var self=this,$self=this;
  2138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2139. return $core.withContext(function($ctx1) {
  2140. //>>excludeEnd("ctx");
  2141. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  2142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2143. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  2144. //>>excludeEnd("ctx");
  2145. }; }),
  2146. $globals.AssociativeCollection);
  2147. $core.addMethod(
  2148. $core.method({
  2149. selector: "do:",
  2150. protocol: "enumerating",
  2151. //>>excludeStart("ide", pragmas.excludeIdeData);
  2152. args: ["aBlock"],
  2153. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2154. referencedClasses: [],
  2155. //>>excludeEnd("ide");
  2156. pragmas: [],
  2157. messageSends: ["valuesDo:"]
  2158. }, function ($methodClass){ return function (aBlock){
  2159. var self=this,$self=this;
  2160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2161. return $core.withContext(function($ctx1) {
  2162. //>>excludeEnd("ctx");
  2163. $self._valuesDo_(aBlock);
  2164. return self;
  2165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2166. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  2167. //>>excludeEnd("ctx");
  2168. }; }),
  2169. $globals.AssociativeCollection);
  2170. $core.addMethod(
  2171. $core.method({
  2172. selector: "includes:",
  2173. protocol: "enumerating",
  2174. //>>excludeStart("ide", pragmas.excludeIdeData);
  2175. args: ["anObject"],
  2176. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2177. referencedClasses: [],
  2178. //>>excludeEnd("ide");
  2179. pragmas: [],
  2180. messageSends: ["includes:", "values"]
  2181. }, function ($methodClass){ return function (anObject){
  2182. var self=this,$self=this;
  2183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2184. return $core.withContext(function($ctx1) {
  2185. //>>excludeEnd("ctx");
  2186. return $recv($self._values())._includes_(anObject);
  2187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2188. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  2189. //>>excludeEnd("ctx");
  2190. }; }),
  2191. $globals.AssociativeCollection);
  2192. $core.addMethod(
  2193. $core.method({
  2194. selector: "includesKey:",
  2195. protocol: "testing",
  2196. //>>excludeStart("ide", pragmas.excludeIdeData);
  2197. args: ["aKey"],
  2198. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2199. referencedClasses: [],
  2200. //>>excludeEnd("ide");
  2201. pragmas: [],
  2202. messageSends: ["subclassResponsibility"]
  2203. }, function ($methodClass){ return function (aKey){
  2204. var self=this,$self=this;
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return $core.withContext(function($ctx1) {
  2207. //>>excludeEnd("ctx");
  2208. $self._subclassResponsibility();
  2209. return self;
  2210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2211. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2212. //>>excludeEnd("ctx");
  2213. }; }),
  2214. $globals.AssociativeCollection);
  2215. $core.addMethod(
  2216. $core.method({
  2217. selector: "indexOf:ifAbsent:",
  2218. protocol: "accessing",
  2219. //>>excludeStart("ide", pragmas.excludeIdeData);
  2220. args: ["anObject", "aBlock"],
  2221. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2222. referencedClasses: [],
  2223. //>>excludeEnd("ide");
  2224. pragmas: [],
  2225. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2226. }, function ($methodClass){ return function (anObject,aBlock){
  2227. var self=this,$self=this;
  2228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2229. return $core.withContext(function($ctx1) {
  2230. //>>excludeEnd("ctx");
  2231. return $recv($self._keys())._detect_ifNone_((function(each){
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. return $core.withContext(function($ctx2) {
  2234. //>>excludeEnd("ctx");
  2235. return $recv($self._at_(each)).__eq(anObject);
  2236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2238. //>>excludeEnd("ctx");
  2239. }),aBlock);
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2242. //>>excludeEnd("ctx");
  2243. }; }),
  2244. $globals.AssociativeCollection);
  2245. $core.addMethod(
  2246. $core.method({
  2247. selector: "keyAtValue:",
  2248. protocol: "accessing",
  2249. //>>excludeStart("ide", pragmas.excludeIdeData);
  2250. args: ["anObject"],
  2251. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2252. referencedClasses: [],
  2253. //>>excludeEnd("ide");
  2254. pragmas: [],
  2255. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2256. }, function ($methodClass){ return function (anObject){
  2257. var self=this,$self=this;
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. return $core.withContext(function($ctx1) {
  2260. //>>excludeEnd("ctx");
  2261. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. return $core.withContext(function($ctx2) {
  2264. //>>excludeEnd("ctx");
  2265. return $self._errorNotFound();
  2266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2268. //>>excludeEnd("ctx");
  2269. }));
  2270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2271. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject})});
  2272. //>>excludeEnd("ctx");
  2273. }; }),
  2274. $globals.AssociativeCollection);
  2275. $core.addMethod(
  2276. $core.method({
  2277. selector: "keyAtValue:ifAbsent:",
  2278. protocol: "accessing",
  2279. //>>excludeStart("ide", pragmas.excludeIdeData);
  2280. args: ["anObject", "aBlock"],
  2281. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2282. referencedClasses: [],
  2283. //>>excludeEnd("ide");
  2284. pragmas: [],
  2285. messageSends: ["indexOf:ifAbsent:"]
  2286. }, function ($methodClass){ return function (anObject,aBlock){
  2287. var self=this,$self=this;
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. return $core.withContext(function($ctx1) {
  2290. //>>excludeEnd("ctx");
  2291. return $self._indexOf_ifAbsent_(anObject,aBlock);
  2292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2293. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  2294. //>>excludeEnd("ctx");
  2295. }; }),
  2296. $globals.AssociativeCollection);
  2297. $core.addMethod(
  2298. $core.method({
  2299. selector: "keys",
  2300. protocol: "accessing",
  2301. //>>excludeStart("ide", pragmas.excludeIdeData);
  2302. args: [],
  2303. source: "keys\x0a\x09self subclassResponsibility",
  2304. referencedClasses: [],
  2305. //>>excludeEnd("ide");
  2306. pragmas: [],
  2307. messageSends: ["subclassResponsibility"]
  2308. }, function ($methodClass){ return function (){
  2309. var self=this,$self=this;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. $self._subclassResponsibility();
  2314. return self;
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2317. //>>excludeEnd("ctx");
  2318. }; }),
  2319. $globals.AssociativeCollection);
  2320. $core.addMethod(
  2321. $core.method({
  2322. selector: "keysAndValuesDo:",
  2323. protocol: "enumerating",
  2324. //>>excludeStart("ide", pragmas.excludeIdeData);
  2325. args: ["aBlock"],
  2326. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2327. referencedClasses: [],
  2328. //>>excludeEnd("ide");
  2329. pragmas: [],
  2330. messageSends: ["keysDo:", "value:value:", "at:"]
  2331. }, function ($methodClass){ return function (aBlock){
  2332. var self=this,$self=this;
  2333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2334. return $core.withContext(function($ctx1) {
  2335. //>>excludeEnd("ctx");
  2336. $self._keysDo_((function(each){
  2337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2338. return $core.withContext(function($ctx2) {
  2339. //>>excludeEnd("ctx");
  2340. return $recv(aBlock)._value_value_(each,$self._at_(each));
  2341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2343. //>>excludeEnd("ctx");
  2344. }));
  2345. return self;
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  2348. //>>excludeEnd("ctx");
  2349. }; }),
  2350. $globals.AssociativeCollection);
  2351. $core.addMethod(
  2352. $core.method({
  2353. selector: "keysDo:",
  2354. protocol: "enumerating",
  2355. //>>excludeStart("ide", pragmas.excludeIdeData);
  2356. args: ["aBlock"],
  2357. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2358. referencedClasses: [],
  2359. //>>excludeEnd("ide");
  2360. pragmas: [],
  2361. messageSends: ["subclassResponsibility"]
  2362. }, function ($methodClass){ return function (aBlock){
  2363. var self=this,$self=this;
  2364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2365. return $core.withContext(function($ctx1) {
  2366. //>>excludeEnd("ctx");
  2367. $self._subclassResponsibility();
  2368. return self;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  2371. //>>excludeEnd("ctx");
  2372. }; }),
  2373. $globals.AssociativeCollection);
  2374. $core.addMethod(
  2375. $core.method({
  2376. selector: "printOn:",
  2377. protocol: "printing",
  2378. //>>excludeStart("ide", pragmas.excludeIdeData);
  2379. args: ["aStream"],
  2380. 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: ')'",
  2381. referencedClasses: [],
  2382. //>>excludeEnd("ide");
  2383. pragmas: [],
  2384. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2385. }, function ($methodClass){ return function (aStream){
  2386. var self=this,$self=this;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. return $core.withContext(function($ctx1) {
  2389. //>>excludeEnd("ctx");
  2390. [(
  2391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2392. $ctx1.supercall = true,
  2393. //>>excludeEnd("ctx");
  2394. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  2395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2396. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  2397. //>>excludeEnd("ctx");
  2398. ][0];
  2399. [$recv(aStream)._nextPutAll_(" (")
  2400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2401. ,$ctx1.sendIdx["nextPutAll:"]=1
  2402. //>>excludeEnd("ctx");
  2403. ][0];
  2404. $recv($self._associations())._do_separatedBy_((function(each){
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. return $core.withContext(function($ctx2) {
  2407. //>>excludeEnd("ctx");
  2408. return $recv(each)._printOn_(aStream);
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2411. //>>excludeEnd("ctx");
  2412. }),(function(){
  2413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2414. return $core.withContext(function($ctx2) {
  2415. //>>excludeEnd("ctx");
  2416. return [$recv(aStream)._nextPutAll_(" , ")
  2417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2418. ,$ctx2.sendIdx["nextPutAll:"]=2
  2419. //>>excludeEnd("ctx");
  2420. ][0];
  2421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2423. //>>excludeEnd("ctx");
  2424. }));
  2425. $recv(aStream)._nextPutAll_(")");
  2426. return self;
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  2429. //>>excludeEnd("ctx");
  2430. }; }),
  2431. $globals.AssociativeCollection);
  2432. $core.addMethod(
  2433. $core.method({
  2434. selector: "remove:ifAbsent:",
  2435. protocol: "adding/removing",
  2436. //>>excludeStart("ide", pragmas.excludeIdeData);
  2437. args: ["aKey", "aBlock"],
  2438. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2439. referencedClasses: [],
  2440. //>>excludeEnd("ide");
  2441. pragmas: [],
  2442. messageSends: ["removeKey:ifAbsent:"]
  2443. }, function ($methodClass){ return function (aKey,aBlock){
  2444. var self=this,$self=this;
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. return $core.withContext(function($ctx1) {
  2447. //>>excludeEnd("ctx");
  2448. return $self._removeKey_ifAbsent_(aKey,aBlock);
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2451. //>>excludeEnd("ctx");
  2452. }; }),
  2453. $globals.AssociativeCollection);
  2454. $core.addMethod(
  2455. $core.method({
  2456. selector: "removeAll",
  2457. protocol: "adding/removing",
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: [],
  2460. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2461. referencedClasses: [],
  2462. //>>excludeEnd("ide");
  2463. pragmas: [],
  2464. messageSends: ["do:", "keys", "removeKey:"]
  2465. }, function ($methodClass){ return function (){
  2466. var self=this,$self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. return $recv($self._keys())._do_((function(each){
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. return $core.withContext(function($ctx2) {
  2473. //>>excludeEnd("ctx");
  2474. return $self._removeKey_(each);
  2475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2477. //>>excludeEnd("ctx");
  2478. }));
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  2481. //>>excludeEnd("ctx");
  2482. }; }),
  2483. $globals.AssociativeCollection);
  2484. $core.addMethod(
  2485. $core.method({
  2486. selector: "removeKey:",
  2487. protocol: "adding/removing",
  2488. //>>excludeStart("ide", pragmas.excludeIdeData);
  2489. args: ["aKey"],
  2490. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2491. referencedClasses: [],
  2492. //>>excludeEnd("ide");
  2493. pragmas: [],
  2494. messageSends: ["remove:"]
  2495. }, function ($methodClass){ return function (aKey){
  2496. var self=this,$self=this;
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. return $core.withContext(function($ctx1) {
  2499. //>>excludeEnd("ctx");
  2500. return $self._remove_(aKey);
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey})});
  2503. //>>excludeEnd("ctx");
  2504. }; }),
  2505. $globals.AssociativeCollection);
  2506. $core.addMethod(
  2507. $core.method({
  2508. selector: "removeKey:ifAbsent:",
  2509. protocol: "adding/removing",
  2510. //>>excludeStart("ide", pragmas.excludeIdeData);
  2511. args: ["aKey", "aBlock"],
  2512. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2513. referencedClasses: [],
  2514. //>>excludeEnd("ide");
  2515. pragmas: [],
  2516. messageSends: ["subclassResponsibility"]
  2517. }, function ($methodClass){ return function (aKey,aBlock){
  2518. var self=this,$self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. $self._subclassResponsibility();
  2523. return self;
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2526. //>>excludeEnd("ctx");
  2527. }; }),
  2528. $globals.AssociativeCollection);
  2529. $core.addMethod(
  2530. $core.method({
  2531. selector: "select:",
  2532. protocol: "enumerating",
  2533. //>>excludeStart("ide", pragmas.excludeIdeData);
  2534. args: ["aBlock"],
  2535. 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",
  2536. referencedClasses: [],
  2537. //>>excludeEnd("ide");
  2538. pragmas: [],
  2539. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2540. }, function ($methodClass){ return function (aBlock){
  2541. var self=this,$self=this;
  2542. var newDict;
  2543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2544. return $core.withContext(function($ctx1) {
  2545. //>>excludeEnd("ctx");
  2546. newDict=$recv($self._class())._new();
  2547. $self._keysAndValuesDo_((function(key,value){
  2548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2549. return $core.withContext(function($ctx2) {
  2550. //>>excludeEnd("ctx");
  2551. if($core.assert($recv(aBlock)._value_(value))){
  2552. return $recv(newDict)._at_put_(key,value);
  2553. }
  2554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2555. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2556. //>>excludeEnd("ctx");
  2557. }));
  2558. return newDict;
  2559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2560. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict})});
  2561. //>>excludeEnd("ctx");
  2562. }; }),
  2563. $globals.AssociativeCollection);
  2564. $core.addMethod(
  2565. $core.method({
  2566. selector: "select:thenCollect:",
  2567. protocol: "enumerating",
  2568. //>>excludeStart("ide", pragmas.excludeIdeData);
  2569. args: ["selectBlock", "collectBlock"],
  2570. 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",
  2571. referencedClasses: [],
  2572. //>>excludeEnd("ide");
  2573. pragmas: [],
  2574. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2575. }, function ($methodClass){ return function (selectBlock,collectBlock){
  2576. var self=this,$self=this;
  2577. var newDict;
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. return $core.withContext(function($ctx1) {
  2580. //>>excludeEnd("ctx");
  2581. newDict=$recv($self._class())._new();
  2582. $self._keysAndValuesDo_((function(key,value){
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. return $core.withContext(function($ctx2) {
  2585. //>>excludeEnd("ctx");
  2586. if($core.assert([$recv(selectBlock)._value_(value)
  2587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2588. ,$ctx2.sendIdx["value:"]=1
  2589. //>>excludeEnd("ctx");
  2590. ][0])){
  2591. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  2592. }
  2593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2594. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2595. //>>excludeEnd("ctx");
  2596. }));
  2597. return newDict;
  2598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2599. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict})});
  2600. //>>excludeEnd("ctx");
  2601. }; }),
  2602. $globals.AssociativeCollection);
  2603. $core.addMethod(
  2604. $core.method({
  2605. selector: "shallowCopy",
  2606. protocol: "copying",
  2607. //>>excludeStart("ide", pragmas.excludeIdeData);
  2608. args: [],
  2609. 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",
  2610. referencedClasses: [],
  2611. //>>excludeEnd("ide");
  2612. pragmas: [],
  2613. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2614. }, function ($methodClass){ return function (){
  2615. var self=this,$self=this;
  2616. var copy;
  2617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2618. return $core.withContext(function($ctx1) {
  2619. //>>excludeEnd("ctx");
  2620. copy=$recv($self._class())._new();
  2621. $self._keysAndValuesDo_((function(key,value){
  2622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2623. return $core.withContext(function($ctx2) {
  2624. //>>excludeEnd("ctx");
  2625. return $recv(copy)._at_put_(key,value);
  2626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2627. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2628. //>>excludeEnd("ctx");
  2629. }));
  2630. return copy;
  2631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2632. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy})});
  2633. //>>excludeEnd("ctx");
  2634. }; }),
  2635. $globals.AssociativeCollection);
  2636. $core.addMethod(
  2637. $core.method({
  2638. selector: "size",
  2639. protocol: "accessing",
  2640. //>>excludeStart("ide", pragmas.excludeIdeData);
  2641. args: [],
  2642. source: "size\x0a\x09^ self keys size",
  2643. referencedClasses: [],
  2644. //>>excludeEnd("ide");
  2645. pragmas: [],
  2646. messageSends: ["size", "keys"]
  2647. }, function ($methodClass){ return function (){
  2648. var self=this,$self=this;
  2649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2650. return $core.withContext(function($ctx1) {
  2651. //>>excludeEnd("ctx");
  2652. return $recv($self._keys())._size();
  2653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2654. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  2655. //>>excludeEnd("ctx");
  2656. }; }),
  2657. $globals.AssociativeCollection);
  2658. $core.addMethod(
  2659. $core.method({
  2660. selector: "values",
  2661. protocol: "accessing",
  2662. //>>excludeStart("ide", pragmas.excludeIdeData);
  2663. args: [],
  2664. source: "values\x0a\x09self subclassResponsibility",
  2665. referencedClasses: [],
  2666. //>>excludeEnd("ide");
  2667. pragmas: [],
  2668. messageSends: ["subclassResponsibility"]
  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. $self._subclassResponsibility();
  2675. return self;
  2676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2677. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  2678. //>>excludeEnd("ctx");
  2679. }; }),
  2680. $globals.AssociativeCollection);
  2681. $core.addMethod(
  2682. $core.method({
  2683. selector: "valuesDo:",
  2684. protocol: "enumerating",
  2685. //>>excludeStart("ide", pragmas.excludeIdeData);
  2686. args: ["aBlock"],
  2687. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2688. referencedClasses: [],
  2689. //>>excludeEnd("ide");
  2690. pragmas: [],
  2691. messageSends: ["subclassResponsibility"]
  2692. }, function ($methodClass){ return function (aBlock){
  2693. var self=this,$self=this;
  2694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2695. return $core.withContext(function($ctx1) {
  2696. //>>excludeEnd("ctx");
  2697. $self._subclassResponsibility();
  2698. return self;
  2699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2700. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  2701. //>>excludeEnd("ctx");
  2702. }; }),
  2703. $globals.AssociativeCollection);
  2704. $core.addMethod(
  2705. $core.method({
  2706. selector: "withIndexDo:",
  2707. protocol: "enumerating",
  2708. //>>excludeStart("ide", pragmas.excludeIdeData);
  2709. args: ["aBlock"],
  2710. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2711. referencedClasses: [],
  2712. //>>excludeEnd("ide");
  2713. pragmas: [],
  2714. messageSends: ["keysAndValuesDo:", "value:value:"]
  2715. }, function ($methodClass){ return function (aBlock){
  2716. var self=this,$self=this;
  2717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2718. return $core.withContext(function($ctx1) {
  2719. //>>excludeEnd("ctx");
  2720. $self._keysAndValuesDo_((function(key,value){
  2721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2722. return $core.withContext(function($ctx2) {
  2723. //>>excludeEnd("ctx");
  2724. return $recv(aBlock)._value_value_(value,key);
  2725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2726. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2727. //>>excludeEnd("ctx");
  2728. }));
  2729. return self;
  2730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2731. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  2732. //>>excludeEnd("ctx");
  2733. }; }),
  2734. $globals.AssociativeCollection);
  2735. $core.addMethod(
  2736. $core.method({
  2737. selector: "from:",
  2738. protocol: "instance creation",
  2739. //>>excludeStart("ide", pragmas.excludeIdeData);
  2740. args: ["aCollection"],
  2741. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2742. referencedClasses: [],
  2743. //>>excludeEnd("ide");
  2744. pragmas: [],
  2745. messageSends: ["new", "do:", "add:"]
  2746. }, function ($methodClass){ return function (aCollection){
  2747. var self=this,$self=this;
  2748. var newCollection;
  2749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2750. return $core.withContext(function($ctx1) {
  2751. //>>excludeEnd("ctx");
  2752. newCollection=$self._new();
  2753. $recv(aCollection)._do_((function(each){
  2754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2755. return $core.withContext(function($ctx2) {
  2756. //>>excludeEnd("ctx");
  2757. return $recv(newCollection)._add_(each);
  2758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2759. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2760. //>>excludeEnd("ctx");
  2761. }));
  2762. return newCollection;
  2763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2764. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection})});
  2765. //>>excludeEnd("ctx");
  2766. }; }),
  2767. $globals.AssociativeCollection.a$cls);
  2768. $core.addMethod(
  2769. $core.method({
  2770. selector: "fromPairs:",
  2771. protocol: "instance creation",
  2772. //>>excludeStart("ide", pragmas.excludeIdeData);
  2773. args: ["aCollection"],
  2774. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2775. referencedClasses: [],
  2776. //>>excludeEnd("ide");
  2777. pragmas: [],
  2778. messageSends: ["from:"]
  2779. }, function ($methodClass){ return function (aCollection){
  2780. var self=this,$self=this;
  2781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2782. return $core.withContext(function($ctx1) {
  2783. //>>excludeEnd("ctx");
  2784. return $self._from_(aCollection);
  2785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2786. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection})});
  2787. //>>excludeEnd("ctx");
  2788. }; }),
  2789. $globals.AssociativeCollection.a$cls);
  2790. $core.addMethod(
  2791. $core.method({
  2792. selector: "newFromPairs:",
  2793. protocol: "instance creation",
  2794. //>>excludeStart("ide", pragmas.excludeIdeData);
  2795. args: ["aCollection"],
  2796. 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",
  2797. referencedClasses: [],
  2798. //>>excludeEnd("ide");
  2799. pragmas: [],
  2800. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  2801. }, function ($methodClass){ return function (aCollection){
  2802. var self=this,$self=this;
  2803. var newCollection;
  2804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2805. return $core.withContext(function($ctx1) {
  2806. //>>excludeEnd("ctx");
  2807. if(!$core.assert($recv([$recv(aCollection)._size()
  2808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2809. ,$ctx1.sendIdx["size"]=1
  2810. //>>excludeEnd("ctx");
  2811. ][0])._even())){
  2812. $self._error_("#newFromPairs only accepts arrays of an even length");
  2813. }
  2814. newCollection=$self._new();
  2815. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2817. return $core.withContext(function($ctx2) {
  2818. //>>excludeEnd("ctx");
  2819. return $recv(newCollection)._at_put_([$recv(aCollection)._at_(each)
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. ,$ctx2.sendIdx["at:"]=1
  2822. //>>excludeEnd("ctx");
  2823. ][0],$recv(aCollection)._at_($recv(each).__plus((1))));
  2824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  2826. //>>excludeEnd("ctx");
  2827. }));
  2828. return newCollection;
  2829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2830. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection})});
  2831. //>>excludeEnd("ctx");
  2832. }; }),
  2833. $globals.AssociativeCollection.a$cls);
  2834. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  2835. //>>excludeStart("ide", pragmas.excludeIdeData);
  2836. $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.";
  2837. //>>excludeEnd("ide");
  2838. $core.addMethod(
  2839. $core.method({
  2840. selector: "at:ifAbsent:",
  2841. protocol: "accessing",
  2842. //>>excludeStart("ide", pragmas.excludeIdeData);
  2843. args: ["aKey", "aBlock"],
  2844. 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'>",
  2845. referencedClasses: [],
  2846. //>>excludeEnd("ide");
  2847. pragmas: [["inlineJS:", ["\x0a\x09\x09var index = $self._positionOfKey_(aKey);\x0a\x09\x09return index >=0 ? $self.values[index] : aBlock._value();\x0a\x09"]]],
  2848. messageSends: []
  2849. }, function ($methodClass){ return function (aKey,aBlock){
  2850. var self=this,$self=this;
  2851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2852. return $core.withContext(function($ctx1) {
  2853. //>>excludeEnd("ctx");
  2854. var index = $self._positionOfKey_(aKey);
  2855. return index >=0 ? $self.values[index] : aBlock._value();
  2856. ;
  2857. return self;
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  2860. //>>excludeEnd("ctx");
  2861. }; }),
  2862. $globals.Dictionary);
  2863. $core.addMethod(
  2864. $core.method({
  2865. selector: "at:put:",
  2866. protocol: "accessing",
  2867. //>>excludeStart("ide", pragmas.excludeIdeData);
  2868. args: ["aKey", "aValue"],
  2869. 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'>",
  2870. referencedClasses: [],
  2871. //>>excludeEnd("ide");
  2872. 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"]]],
  2873. messageSends: []
  2874. }, function ($methodClass){ return function (aKey,aValue){
  2875. var self=this,$self=this;
  2876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2877. return $core.withContext(function($ctx1) {
  2878. //>>excludeEnd("ctx");
  2879. var index = $self._positionOfKey_(aKey);
  2880. if(index === -1) {
  2881. var keys = $self.keys;
  2882. index = keys.length;
  2883. keys.push(aKey);
  2884. }
  2885. return $self.values[index] = aValue;
  2886. ;
  2887. return self;
  2888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2889. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  2890. //>>excludeEnd("ctx");
  2891. }; }),
  2892. $globals.Dictionary);
  2893. $core.addMethod(
  2894. $core.method({
  2895. selector: "includesKey:",
  2896. protocol: "testing",
  2897. //>>excludeStart("ide", pragmas.excludeIdeData);
  2898. args: ["aKey"],
  2899. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  2900. referencedClasses: [],
  2901. //>>excludeEnd("ide");
  2902. pragmas: [["inlineJS:", ["return $self._positionOfKey_(aKey) >= 0;"]]],
  2903. messageSends: []
  2904. }, function ($methodClass){ return function (aKey){
  2905. var self=this,$self=this;
  2906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2907. return $core.withContext(function($ctx1) {
  2908. //>>excludeEnd("ctx");
  2909. return $self._positionOfKey_(aKey) >= 0;;
  2910. return self;
  2911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2912. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  2913. //>>excludeEnd("ctx");
  2914. }; }),
  2915. $globals.Dictionary);
  2916. $core.addMethod(
  2917. $core.method({
  2918. selector: "indexOf:ifAbsent:",
  2919. protocol: "accessing",
  2920. //>>excludeStart("ide", pragmas.excludeIdeData);
  2921. args: ["anObject", "aBlock"],
  2922. 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 ]",
  2923. referencedClasses: [],
  2924. //>>excludeEnd("ide");
  2925. pragmas: [],
  2926. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  2927. }, function ($methodClass){ return function (anObject,aBlock){
  2928. var self=this,$self=this;
  2929. var index;
  2930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2931. return $core.withContext(function($ctx1) {
  2932. //>>excludeEnd("ctx");
  2933. index=$recv($self.values)._indexOf_ifAbsent_(anObject,(function(){
  2934. return (0);
  2935. }));
  2936. if($core.assert($recv(index).__eq((0)))){
  2937. return $recv(aBlock)._value();
  2938. } else {
  2939. return $recv($self.keys)._at_(index);
  2940. }
  2941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2942. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  2943. //>>excludeEnd("ctx");
  2944. }; }),
  2945. $globals.Dictionary);
  2946. $core.addMethod(
  2947. $core.method({
  2948. selector: "initialize",
  2949. protocol: "initialization",
  2950. //>>excludeStart("ide", pragmas.excludeIdeData);
  2951. args: [],
  2952. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  2953. referencedClasses: [],
  2954. //>>excludeEnd("ide");
  2955. pragmas: [],
  2956. messageSends: ["initialize"]
  2957. }, function ($methodClass){ return function (){
  2958. var self=this,$self=this;
  2959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2960. return $core.withContext(function($ctx1) {
  2961. //>>excludeEnd("ctx");
  2962. [(
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. $ctx1.supercall = true,
  2965. //>>excludeEnd("ctx");
  2966. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  2967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2968. ,$ctx1.supercall = false
  2969. //>>excludeEnd("ctx");
  2970. ][0];
  2971. $self.keys=[];
  2972. $self.values=[];
  2973. return self;
  2974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2975. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  2976. //>>excludeEnd("ctx");
  2977. }; }),
  2978. $globals.Dictionary);
  2979. $core.addMethod(
  2980. $core.method({
  2981. selector: "keys",
  2982. protocol: "accessing",
  2983. //>>excludeStart("ide", pragmas.excludeIdeData);
  2984. args: [],
  2985. source: "keys\x0a\x09^ keys copy",
  2986. referencedClasses: [],
  2987. //>>excludeEnd("ide");
  2988. pragmas: [],
  2989. messageSends: ["copy"]
  2990. }, function ($methodClass){ return function (){
  2991. var self=this,$self=this;
  2992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2993. return $core.withContext(function($ctx1) {
  2994. //>>excludeEnd("ctx");
  2995. return $recv($self.keys)._copy();
  2996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2997. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  2998. //>>excludeEnd("ctx");
  2999. }; }),
  3000. $globals.Dictionary);
  3001. $core.addMethod(
  3002. $core.method({
  3003. selector: "keysAndValuesDo:",
  3004. protocol: "enumerating",
  3005. //>>excludeStart("ide", pragmas.excludeIdeData);
  3006. args: ["aBlock"],
  3007. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3008. referencedClasses: [],
  3009. //>>excludeEnd("ide");
  3010. pragmas: [],
  3011. messageSends: ["with:do:"]
  3012. }, function ($methodClass){ return function (aBlock){
  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)._with_do_($self.values,aBlock);
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock})});
  3020. //>>excludeEnd("ctx");
  3021. }; }),
  3022. $globals.Dictionary);
  3023. $core.addMethod(
  3024. $core.method({
  3025. selector: "keysDo:",
  3026. protocol: "enumerating",
  3027. //>>excludeStart("ide", pragmas.excludeIdeData);
  3028. args: ["aBlock"],
  3029. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3030. referencedClasses: [],
  3031. //>>excludeEnd("ide");
  3032. pragmas: [],
  3033. messageSends: ["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)._do_(aBlock);
  3040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3041. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3042. //>>excludeEnd("ctx");
  3043. }; }),
  3044. $globals.Dictionary);
  3045. $core.addMethod(
  3046. $core.method({
  3047. selector: "positionOfKey:",
  3048. protocol: "private",
  3049. //>>excludeStart("ide", pragmas.excludeIdeData);
  3050. args: ["anObject"],
  3051. 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'>",
  3052. referencedClasses: [],
  3053. //>>excludeEnd("ide");
  3054. 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"]]],
  3055. messageSends: []
  3056. }, function ($methodClass){ return function (anObject){
  3057. var self=this,$self=this;
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. return $core.withContext(function($ctx1) {
  3060. //>>excludeEnd("ctx");
  3061. var keys = $self.keys;
  3062. for(var i=0;i<keys.length;i++){
  3063. if(keys[i].__eq(anObject)) { return i;}
  3064. }
  3065. return -1;
  3066. ;
  3067. return self;
  3068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3069. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject})});
  3070. //>>excludeEnd("ctx");
  3071. }; }),
  3072. $globals.Dictionary);
  3073. $core.addMethod(
  3074. $core.method({
  3075. selector: "removeAll",
  3076. protocol: "adding/removing",
  3077. //>>excludeStart("ide", pragmas.excludeIdeData);
  3078. args: [],
  3079. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3080. referencedClasses: [],
  3081. //>>excludeEnd("ide");
  3082. pragmas: [],
  3083. messageSends: ["removeAll"]
  3084. }, function ($methodClass){ return function (){
  3085. var self=this,$self=this;
  3086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3087. return $core.withContext(function($ctx1) {
  3088. //>>excludeEnd("ctx");
  3089. [$recv($self.keys)._removeAll()
  3090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3091. ,$ctx1.sendIdx["removeAll"]=1
  3092. //>>excludeEnd("ctx");
  3093. ][0];
  3094. $recv($self.values)._removeAll();
  3095. return self;
  3096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3097. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  3098. //>>excludeEnd("ctx");
  3099. }; }),
  3100. $globals.Dictionary);
  3101. $core.addMethod(
  3102. $core.method({
  3103. selector: "removeKey:ifAbsent:",
  3104. protocol: "adding/removing",
  3105. //>>excludeStart("ide", pragmas.excludeIdeData);
  3106. args: ["aKey", "aBlock"],
  3107. 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'>",
  3108. referencedClasses: [],
  3109. //>>excludeEnd("ide");
  3110. 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"]]],
  3111. messageSends: []
  3112. }, function ($methodClass){ return function (aKey,aBlock){
  3113. var self=this,$self=this;
  3114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3115. return $core.withContext(function($ctx1) {
  3116. //>>excludeEnd("ctx");
  3117. var index = $self._positionOfKey_(aKey);
  3118. if(index === -1) {
  3119. return aBlock._value()
  3120. } else {
  3121. var keys = $self.keys, values = $self.values;
  3122. var value = values[index], l = keys.length;
  3123. keys[index] = keys[l-1];
  3124. keys.pop();
  3125. values[index] = values[l-1];
  3126. values.pop();
  3127. return value;
  3128. }
  3129. ;
  3130. return self;
  3131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3132. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3133. //>>excludeEnd("ctx");
  3134. }; }),
  3135. $globals.Dictionary);
  3136. $core.addMethod(
  3137. $core.method({
  3138. selector: "values",
  3139. protocol: "accessing",
  3140. //>>excludeStart("ide", pragmas.excludeIdeData);
  3141. args: [],
  3142. source: "values\x0a\x09^ values",
  3143. referencedClasses: [],
  3144. //>>excludeEnd("ide");
  3145. pragmas: [],
  3146. messageSends: []
  3147. }, function ($methodClass){ return function (){
  3148. var self=this,$self=this;
  3149. return $self.values;
  3150. }; }),
  3151. $globals.Dictionary);
  3152. $core.addMethod(
  3153. $core.method({
  3154. selector: "valuesDo:",
  3155. protocol: "enumerating",
  3156. //>>excludeStart("ide", pragmas.excludeIdeData);
  3157. args: ["aBlock"],
  3158. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3159. referencedClasses: [],
  3160. //>>excludeEnd("ide");
  3161. pragmas: [],
  3162. messageSends: ["do:"]
  3163. }, function ($methodClass){ return function (aBlock){
  3164. var self=this,$self=this;
  3165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3166. return $core.withContext(function($ctx1) {
  3167. //>>excludeEnd("ctx");
  3168. return $recv($self.values)._do_(aBlock);
  3169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3170. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3171. //>>excludeEnd("ctx");
  3172. }; }),
  3173. $globals.Dictionary);
  3174. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3175. //>>excludeStart("ide", pragmas.excludeIdeData);
  3176. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3177. //>>excludeEnd("ide");
  3178. $core.addMethod(
  3179. $core.method({
  3180. selector: "asJavaScriptSource",
  3181. protocol: "accessing",
  3182. //>>excludeStart("ide", pragmas.excludeIdeData);
  3183. args: [],
  3184. 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: '}' ]",
  3185. referencedClasses: ["String"],
  3186. //>>excludeEnd("ide");
  3187. pragmas: [],
  3188. messageSends: ["streamContents:", "nextPut:", "keysAndValuesDo:", "nextPutAll:", "asJavaScriptSource", "skip:"]
  3189. }, function ($methodClass){ return function (){
  3190. var self=this,$self=this;
  3191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3192. return $core.withContext(function($ctx1) {
  3193. //>>excludeEnd("ctx");
  3194. return $recv($globals.String)._streamContents_((function(str){
  3195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3196. return $core.withContext(function($ctx2) {
  3197. //>>excludeEnd("ctx");
  3198. [$recv(str)._nextPut_("{")
  3199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3200. ,$ctx2.sendIdx["nextPut:"]=1
  3201. //>>excludeEnd("ctx");
  3202. ][0];
  3203. $self._keysAndValuesDo_((function(key,value){
  3204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3205. return $core.withContext(function($ctx3) {
  3206. //>>excludeEnd("ctx");
  3207. [$recv(str)._nextPutAll_([$recv(key)._asJavaScriptSource()
  3208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3209. ,$ctx3.sendIdx["asJavaScriptSource"]=1
  3210. //>>excludeEnd("ctx");
  3211. ][0])
  3212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3213. ,$ctx3.sendIdx["nextPutAll:"]=1
  3214. //>>excludeEnd("ctx");
  3215. ][0];
  3216. [$recv(str)._nextPut_(":")
  3217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3218. ,$ctx3.sendIdx["nextPut:"]=2
  3219. //>>excludeEnd("ctx");
  3220. ][0];
  3221. $recv(str)._nextPutAll_($recv(value)._asJavaScriptSource());
  3222. return [$recv(str)._nextPut_(",")
  3223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3224. ,$ctx3.sendIdx["nextPut:"]=3
  3225. //>>excludeEnd("ctx");
  3226. ][0];
  3227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3228. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  3229. //>>excludeEnd("ctx");
  3230. }));
  3231. $recv(str)._skip_((-1));
  3232. return $recv(str)._nextPut_("}");
  3233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3234. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  3235. //>>excludeEnd("ctx");
  3236. }));
  3237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3238. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  3239. //>>excludeEnd("ctx");
  3240. }; }),
  3241. $globals.HashedCollection);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "at:ifAbsent:",
  3245. protocol: "accessing",
  3246. //>>excludeStart("ide", pragmas.excludeIdeData);
  3247. args: ["aKey", "aBlock"],
  3248. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3249. referencedClasses: [],
  3250. //>>excludeEnd("ide");
  3251. pragmas: [],
  3252. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3253. }, function ($methodClass){ return function (aKey,aBlock){
  3254. var self=this,$self=this;
  3255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3256. return $core.withContext(function($ctx1) {
  3257. //>>excludeEnd("ctx");
  3258. if($core.assert($self._includesKey_(aKey))){
  3259. return $self._basicAt_(aKey);
  3260. } else {
  3261. return $recv(aBlock)._value();
  3262. }
  3263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3264. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3265. //>>excludeEnd("ctx");
  3266. }; }),
  3267. $globals.HashedCollection);
  3268. $core.addMethod(
  3269. $core.method({
  3270. selector: "at:put:",
  3271. protocol: "accessing",
  3272. //>>excludeStart("ide", pragmas.excludeIdeData);
  3273. args: ["aKey", "aValue"],
  3274. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3275. referencedClasses: [],
  3276. //>>excludeEnd("ide");
  3277. pragmas: [],
  3278. messageSends: ["basicAt:put:"]
  3279. }, function ($methodClass){ return function (aKey,aValue){
  3280. var self=this,$self=this;
  3281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3282. return $core.withContext(function($ctx1) {
  3283. //>>excludeEnd("ctx");
  3284. return $self._basicAt_put_(aKey,aValue);
  3285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3286. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue})});
  3287. //>>excludeEnd("ctx");
  3288. }; }),
  3289. $globals.HashedCollection);
  3290. $core.addMethod(
  3291. $core.method({
  3292. selector: "includesKey:",
  3293. protocol: "testing",
  3294. //>>excludeStart("ide", pragmas.excludeIdeData);
  3295. args: ["aKey"],
  3296. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3297. referencedClasses: [],
  3298. //>>excludeEnd("ide");
  3299. pragmas: [["inlineJS:", ["return self.hasOwnProperty(aKey)"]]],
  3300. messageSends: []
  3301. }, function ($methodClass){ return function (aKey){
  3302. var self=this,$self=this;
  3303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3304. return $core.withContext(function($ctx1) {
  3305. //>>excludeEnd("ctx");
  3306. return self.hasOwnProperty(aKey);
  3307. return self;
  3308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3309. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey})});
  3310. //>>excludeEnd("ctx");
  3311. }; }),
  3312. $globals.HashedCollection);
  3313. $core.addMethod(
  3314. $core.method({
  3315. selector: "keys",
  3316. protocol: "accessing",
  3317. //>>excludeStart("ide", pragmas.excludeIdeData);
  3318. args: [],
  3319. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3320. referencedClasses: [],
  3321. //>>excludeEnd("ide");
  3322. pragmas: [["inlineJS:", ["return Object.keys(self)"]]],
  3323. messageSends: []
  3324. }, function ($methodClass){ return function (){
  3325. var self=this,$self=this;
  3326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3327. return $core.withContext(function($ctx1) {
  3328. //>>excludeEnd("ctx");
  3329. return Object.keys(self);
  3330. return self;
  3331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3332. }, function($ctx1) {$ctx1.fill(self,"keys",{})});
  3333. //>>excludeEnd("ctx");
  3334. }; }),
  3335. $globals.HashedCollection);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: "keysDo:",
  3339. protocol: "enumerating",
  3340. //>>excludeStart("ide", pragmas.excludeIdeData);
  3341. args: ["aBlock"],
  3342. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3343. referencedClasses: [],
  3344. //>>excludeEnd("ide");
  3345. pragmas: [],
  3346. messageSends: ["do:", "keys"]
  3347. }, function ($methodClass){ return function (aBlock){
  3348. var self=this,$self=this;
  3349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3350. return $core.withContext(function($ctx1) {
  3351. //>>excludeEnd("ctx");
  3352. $recv($self._keys())._do_(aBlock);
  3353. return self;
  3354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3355. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock})});
  3356. //>>excludeEnd("ctx");
  3357. }; }),
  3358. $globals.HashedCollection);
  3359. $core.addMethod(
  3360. $core.method({
  3361. selector: "removeKey:ifAbsent:",
  3362. protocol: "adding/removing",
  3363. //>>excludeStart("ide", pragmas.excludeIdeData);
  3364. args: ["aKey", "aBlock"],
  3365. 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 ]",
  3366. referencedClasses: [],
  3367. //>>excludeEnd("ide");
  3368. pragmas: [],
  3369. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3370. }, function ($methodClass){ return function (aKey,aBlock){
  3371. var self=this,$self=this;
  3372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3373. return $core.withContext(function($ctx1) {
  3374. //>>excludeEnd("ctx");
  3375. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. return $core.withContext(function($ctx2) {
  3378. //>>excludeEnd("ctx");
  3379. $self._basicDelete_(aKey);
  3380. return removed;
  3381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3382. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3383. //>>excludeEnd("ctx");
  3384. }),(function(){
  3385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3386. return $core.withContext(function($ctx2) {
  3387. //>>excludeEnd("ctx");
  3388. return $recv(aBlock)._value();
  3389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3391. //>>excludeEnd("ctx");
  3392. }));
  3393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3394. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock})});
  3395. //>>excludeEnd("ctx");
  3396. }; }),
  3397. $globals.HashedCollection);
  3398. $core.addMethod(
  3399. $core.method({
  3400. selector: "values",
  3401. protocol: "accessing",
  3402. //>>excludeStart("ide", pragmas.excludeIdeData);
  3403. args: [],
  3404. 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'>",
  3405. referencedClasses: [],
  3406. //>>excludeEnd("ide");
  3407. pragmas: [["inlineJS:", ["\x0a\x09\x09return $self._keys().map(function(key){\x0a\x09\x09\x09return $self._at_(key);\x0a\x09\x09});\x0a\x09"]]],
  3408. messageSends: []
  3409. }, function ($methodClass){ return function (){
  3410. var self=this,$self=this;
  3411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3412. return $core.withContext(function($ctx1) {
  3413. //>>excludeEnd("ctx");
  3414. return $self._keys().map(function(key){
  3415. return $self._at_(key);
  3416. });
  3417. ;
  3418. return self;
  3419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3420. }, function($ctx1) {$ctx1.fill(self,"values",{})});
  3421. //>>excludeEnd("ctx");
  3422. }; }),
  3423. $globals.HashedCollection);
  3424. $core.addMethod(
  3425. $core.method({
  3426. selector: "valuesDo:",
  3427. protocol: "enumerating",
  3428. //>>excludeStart("ide", pragmas.excludeIdeData);
  3429. args: ["aBlock"],
  3430. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3431. referencedClasses: [],
  3432. //>>excludeEnd("ide");
  3433. pragmas: [],
  3434. messageSends: ["do:", "values"]
  3435. }, function ($methodClass){ return function (aBlock){
  3436. var self=this,$self=this;
  3437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3438. return $core.withContext(function($ctx1) {
  3439. //>>excludeEnd("ctx");
  3440. $recv($self._values())._do_(aBlock);
  3441. return self;
  3442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3443. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock})});
  3444. //>>excludeEnd("ctx");
  3445. }; }),
  3446. $globals.HashedCollection);
  3447. $core.addClass("SequenceableCollection", $globals.Collection, [], "Kernel-Collections");
  3448. //>>excludeStart("ide", pragmas.excludeIdeData);
  3449. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3450. //>>excludeEnd("ide");
  3451. $core.addMethod(
  3452. $core.method({
  3453. selector: "=",
  3454. protocol: "comparing",
  3455. //>>excludeStart("ide", pragmas.excludeIdeData);
  3456. args: ["aCollection"],
  3457. 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",
  3458. referencedClasses: [],
  3459. //>>excludeEnd("ide");
  3460. pragmas: [],
  3461. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3462. }, function ($methodClass){ return function (aCollection){
  3463. var self=this,$self=this;
  3464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3465. return $core.withContext(function($ctx1) {
  3466. //>>excludeEnd("ctx");
  3467. var $early={};
  3468. try {
  3469. if(!$core.assert($recv([$recv([$self._class()
  3470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3471. ,$ctx1.sendIdx["class"]=1
  3472. //>>excludeEnd("ctx");
  3473. ][0]).__eq($recv(aCollection)._class())
  3474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3475. ,$ctx1.sendIdx["="]=1
  3476. //>>excludeEnd("ctx");
  3477. ][0])._and_((function(){
  3478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3479. return $core.withContext(function($ctx2) {
  3480. //>>excludeEnd("ctx");
  3481. return [$recv([$self._size()
  3482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3483. ,$ctx2.sendIdx["size"]=1
  3484. //>>excludeEnd("ctx");
  3485. ][0]).__eq($recv(aCollection)._size())
  3486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3487. ,$ctx2.sendIdx["="]=2
  3488. //>>excludeEnd("ctx");
  3489. ][0];
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3492. //>>excludeEnd("ctx");
  3493. })))){
  3494. return false;
  3495. }
  3496. $self._withIndexDo_((function(each,i){
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. return $core.withContext(function($ctx2) {
  3499. //>>excludeEnd("ctx");
  3500. if(!$core.assert($recv($recv(aCollection)._at_(i)).__eq(each))){
  3501. throw $early=[false];
  3502. }
  3503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3504. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3505. //>>excludeEnd("ctx");
  3506. }));
  3507. return true;
  3508. }
  3509. catch(e) {if(e===$early)return e[0]; throw e}
  3510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3511. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  3512. //>>excludeEnd("ctx");
  3513. }; }),
  3514. $globals.SequenceableCollection);
  3515. $core.addMethod(
  3516. $core.method({
  3517. selector: "addLast:",
  3518. protocol: "adding/removing",
  3519. //>>excludeStart("ide", pragmas.excludeIdeData);
  3520. args: ["anObject"],
  3521. source: "addLast: anObject\x0a\x09self add: anObject",
  3522. referencedClasses: [],
  3523. //>>excludeEnd("ide");
  3524. pragmas: [],
  3525. messageSends: ["add:"]
  3526. }, function ($methodClass){ return function (anObject){
  3527. var self=this,$self=this;
  3528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3529. return $core.withContext(function($ctx1) {
  3530. //>>excludeEnd("ctx");
  3531. $self._add_(anObject);
  3532. return self;
  3533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3534. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject})});
  3535. //>>excludeEnd("ctx");
  3536. }; }),
  3537. $globals.SequenceableCollection);
  3538. $core.addMethod(
  3539. $core.method({
  3540. selector: "allButFirst",
  3541. protocol: "accessing",
  3542. //>>excludeStart("ide", pragmas.excludeIdeData);
  3543. args: [],
  3544. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3545. referencedClasses: [],
  3546. //>>excludeEnd("ide");
  3547. pragmas: [],
  3548. messageSends: ["copyFrom:to:", "size"]
  3549. }, function ($methodClass){ return function (){
  3550. var self=this,$self=this;
  3551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3552. return $core.withContext(function($ctx1) {
  3553. //>>excludeEnd("ctx");
  3554. return $self._copyFrom_to_((2),$self._size());
  3555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3556. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{})});
  3557. //>>excludeEnd("ctx");
  3558. }; }),
  3559. $globals.SequenceableCollection);
  3560. $core.addMethod(
  3561. $core.method({
  3562. selector: "allButLast",
  3563. protocol: "accessing",
  3564. //>>excludeStart("ide", pragmas.excludeIdeData);
  3565. args: [],
  3566. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  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_((1),$recv($self._size()).__minus((1)));
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. }, function($ctx1) {$ctx1.fill(self,"allButLast",{})});
  3579. //>>excludeEnd("ctx");
  3580. }; }),
  3581. $globals.SequenceableCollection);
  3582. $core.addMethod(
  3583. $core.method({
  3584. selector: "anyOne",
  3585. protocol: "accessing",
  3586. //>>excludeStart("ide", pragmas.excludeIdeData);
  3587. args: [],
  3588. source: "anyOne\x0a\x09^ self at: 1",
  3589. referencedClasses: [],
  3590. //>>excludeEnd("ide");
  3591. pragmas: [],
  3592. messageSends: ["at:"]
  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._at_((1));
  3599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3600. }, function($ctx1) {$ctx1.fill(self,"anyOne",{})});
  3601. //>>excludeEnd("ctx");
  3602. }; }),
  3603. $globals.SequenceableCollection);
  3604. $core.addMethod(
  3605. $core.method({
  3606. selector: "atRandom",
  3607. protocol: "accessing",
  3608. //>>excludeStart("ide", pragmas.excludeIdeData);
  3609. args: [],
  3610. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3611. referencedClasses: [],
  3612. //>>excludeEnd("ide");
  3613. pragmas: [],
  3614. messageSends: ["at:", "atRandom", "size"]
  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_($recv($self._size())._atRandom());
  3621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3622. }, function($ctx1) {$ctx1.fill(self,"atRandom",{})});
  3623. //>>excludeEnd("ctx");
  3624. }; }),
  3625. $globals.SequenceableCollection);
  3626. $core.addMethod(
  3627. $core.method({
  3628. selector: "beginsWith:",
  3629. protocol: "testing",
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: ["prefix"],
  3632. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3633. referencedClasses: [],
  3634. //>>excludeEnd("ide");
  3635. pragmas: [],
  3636. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3637. }, function ($methodClass){ return function (prefix){
  3638. var self=this,$self=this;
  3639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3640. return $core.withContext(function($ctx1) {
  3641. //>>excludeEnd("ctx");
  3642. if($core.assert($recv([$self._size()
  3643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3644. ,$ctx1.sendIdx["size"]=1
  3645. //>>excludeEnd("ctx");
  3646. ][0]).__lt([$recv(prefix)._size()
  3647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3648. ,$ctx1.sendIdx["size"]=2
  3649. //>>excludeEnd("ctx");
  3650. ][0]))){
  3651. return false;
  3652. }
  3653. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  3654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3655. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix})});
  3656. //>>excludeEnd("ctx");
  3657. }; }),
  3658. $globals.SequenceableCollection);
  3659. $core.addMethod(
  3660. $core.method({
  3661. selector: "copyFrom:to:",
  3662. protocol: "copying",
  3663. //>>excludeStart("ide", pragmas.excludeIdeData);
  3664. args: ["anIndex", "anotherIndex"],
  3665. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3666. referencedClasses: [],
  3667. //>>excludeEnd("ide");
  3668. pragmas: [],
  3669. messageSends: ["subclassResponsibility"]
  3670. }, function ($methodClass){ return function (anIndex,anotherIndex){
  3671. var self=this,$self=this;
  3672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3673. return $core.withContext(function($ctx1) {
  3674. //>>excludeEnd("ctx");
  3675. $self._subclassResponsibility();
  3676. return self;
  3677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3678. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  3679. //>>excludeEnd("ctx");
  3680. }; }),
  3681. $globals.SequenceableCollection);
  3682. $core.addMethod(
  3683. $core.method({
  3684. selector: "copyWithFirst:",
  3685. protocol: "copying",
  3686. //>>excludeStart("ide", pragmas.excludeIdeData);
  3687. args: ["anObject"],
  3688. source: "copyWithFirst: anObject\x0a\x09^ (self class with: anObject) addAll: self; yourself",
  3689. referencedClasses: [],
  3690. //>>excludeEnd("ide");
  3691. pragmas: [],
  3692. messageSends: ["addAll:", "with:", "class", "yourself"]
  3693. }, function ($methodClass){ return function (anObject){
  3694. var self=this,$self=this;
  3695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3696. return $core.withContext(function($ctx1) {
  3697. //>>excludeEnd("ctx");
  3698. var $1;
  3699. $1=$recv($self._class())._with_(anObject);
  3700. $recv($1)._addAll_(self);
  3701. return $recv($1)._yourself();
  3702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3703. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  3704. //>>excludeEnd("ctx");
  3705. }; }),
  3706. $globals.SequenceableCollection);
  3707. $core.addMethod(
  3708. $core.method({
  3709. selector: "endsWith:",
  3710. protocol: "testing",
  3711. //>>excludeStart("ide", pragmas.excludeIdeData);
  3712. args: ["suffix"],
  3713. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3714. referencedClasses: [],
  3715. //>>excludeEnd("ide");
  3716. pragmas: [],
  3717. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3718. }, function ($methodClass){ return function (suffix){
  3719. var self=this,$self=this;
  3720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3721. return $core.withContext(function($ctx1) {
  3722. //>>excludeEnd("ctx");
  3723. if($core.assert($recv([$self._size()
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. ,$ctx1.sendIdx["size"]=1
  3726. //>>excludeEnd("ctx");
  3727. ][0]).__lt([$recv(suffix)._size()
  3728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3729. ,$ctx1.sendIdx["size"]=2
  3730. //>>excludeEnd("ctx");
  3731. ][0]))){
  3732. return false;
  3733. }
  3734. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  3735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3736. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix})});
  3737. //>>excludeEnd("ctx");
  3738. }; }),
  3739. $globals.SequenceableCollection);
  3740. $core.addMethod(
  3741. $core.method({
  3742. selector: "first",
  3743. protocol: "accessing",
  3744. //>>excludeStart("ide", pragmas.excludeIdeData);
  3745. args: [],
  3746. source: "first\x0a\x09^ self at: 1",
  3747. referencedClasses: [],
  3748. //>>excludeEnd("ide");
  3749. pragmas: [],
  3750. messageSends: ["at:"]
  3751. }, function ($methodClass){ return function (){
  3752. var self=this,$self=this;
  3753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3754. return $core.withContext(function($ctx1) {
  3755. //>>excludeEnd("ctx");
  3756. return $self._at_((1));
  3757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3758. }, function($ctx1) {$ctx1.fill(self,"first",{})});
  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: ["aNumber"],
  3768. 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",
  3769. referencedClasses: [],
  3770. //>>excludeEnd("ide");
  3771. pragmas: [],
  3772. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3773. }, function ($methodClass){ return function (aNumber){
  3774. var self=this,$self=this;
  3775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3776. return $core.withContext(function($ctx1) {
  3777. //>>excludeEnd("ctx");
  3778. if($core.assert($recv($self._size()).__lt(aNumber))){
  3779. $self._error_("Invalid number of elements");
  3780. }
  3781. return $self._copyFrom_to_((1),aNumber);
  3782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3783. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber})});
  3784. //>>excludeEnd("ctx");
  3785. }; }),
  3786. $globals.SequenceableCollection);
  3787. $core.addMethod(
  3788. $core.method({
  3789. selector: "fourth",
  3790. protocol: "accessing",
  3791. //>>excludeStart("ide", pragmas.excludeIdeData);
  3792. args: [],
  3793. source: "fourth\x0a\x09^ self at: 4",
  3794. referencedClasses: [],
  3795. //>>excludeEnd("ide");
  3796. pragmas: [],
  3797. messageSends: ["at:"]
  3798. }, function ($methodClass){ return function (){
  3799. var self=this,$self=this;
  3800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3801. return $core.withContext(function($ctx1) {
  3802. //>>excludeEnd("ctx");
  3803. return $self._at_((4));
  3804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3805. }, function($ctx1) {$ctx1.fill(self,"fourth",{})});
  3806. //>>excludeEnd("ctx");
  3807. }; }),
  3808. $globals.SequenceableCollection);
  3809. $core.addMethod(
  3810. $core.method({
  3811. selector: "includes:",
  3812. protocol: "testing",
  3813. //>>excludeStart("ide", pragmas.excludeIdeData);
  3814. args: ["anObject"],
  3815. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3816. referencedClasses: [],
  3817. //>>excludeEnd("ide");
  3818. pragmas: [],
  3819. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3820. }, function ($methodClass){ return function (anObject){
  3821. var self=this,$self=this;
  3822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3823. return $core.withContext(function($ctx1) {
  3824. //>>excludeEnd("ctx");
  3825. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  3826. return nil;
  3827. })))._notNil();
  3828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3829. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject})});
  3830. //>>excludeEnd("ctx");
  3831. }; }),
  3832. $globals.SequenceableCollection);
  3833. $core.addMethod(
  3834. $core.method({
  3835. selector: "indexOf:startingAt:",
  3836. protocol: "accessing",
  3837. //>>excludeStart("ide", pragmas.excludeIdeData);
  3838. args: ["anObject", "start"],
  3839. 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 ]",
  3840. referencedClasses: [],
  3841. //>>excludeEnd("ide");
  3842. pragmas: [],
  3843. messageSends: ["indexOf:startingAt:ifAbsent:"]
  3844. }, function ($methodClass){ return function (anObject,start){
  3845. var self=this,$self=this;
  3846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3847. return $core.withContext(function($ctx1) {
  3848. //>>excludeEnd("ctx");
  3849. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  3850. return (0);
  3851. }));
  3852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3853. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start})});
  3854. //>>excludeEnd("ctx");
  3855. }; }),
  3856. $globals.SequenceableCollection);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "indexOf:startingAt:ifAbsent:",
  3860. protocol: "accessing",
  3861. //>>excludeStart("ide", pragmas.excludeIdeData);
  3862. args: ["anObject", "start", "aBlock"],
  3863. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  3864. referencedClasses: [],
  3865. //>>excludeEnd("ide");
  3866. pragmas: [],
  3867. messageSends: ["subclassResponsibility"]
  3868. }, function ($methodClass){ return function (anObject,start,aBlock){
  3869. var self=this,$self=this;
  3870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3871. return $core.withContext(function($ctx1) {
  3872. //>>excludeEnd("ctx");
  3873. $self._subclassResponsibility();
  3874. return self;
  3875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3876. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  3877. //>>excludeEnd("ctx");
  3878. }; }),
  3879. $globals.SequenceableCollection);
  3880. $core.addMethod(
  3881. $core.method({
  3882. selector: "last",
  3883. protocol: "accessing",
  3884. //>>excludeStart("ide", pragmas.excludeIdeData);
  3885. args: [],
  3886. source: "last\x0a\x09^ self at: self size",
  3887. referencedClasses: [],
  3888. //>>excludeEnd("ide");
  3889. pragmas: [],
  3890. messageSends: ["at:", "size"]
  3891. }, function ($methodClass){ return function (){
  3892. var self=this,$self=this;
  3893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3894. return $core.withContext(function($ctx1) {
  3895. //>>excludeEnd("ctx");
  3896. return $self._at_($self._size());
  3897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3898. }, function($ctx1) {$ctx1.fill(self,"last",{})});
  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: ["aNumber"],
  3908. 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",
  3909. referencedClasses: [],
  3910. //>>excludeEnd("ide");
  3911. pragmas: [],
  3912. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  3913. }, function ($methodClass){ return function (aNumber){
  3914. var self=this,$self=this;
  3915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3916. return $core.withContext(function($ctx1) {
  3917. //>>excludeEnd("ctx");
  3918. if($core.assert($recv([$self._size()
  3919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3920. ,$ctx1.sendIdx["size"]=1
  3921. //>>excludeEnd("ctx");
  3922. ][0]).__lt(aNumber))){
  3923. $self._error_("Invalid number of elements");
  3924. }
  3925. return $self._copyFrom_to_($recv($recv([$self._size()
  3926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3927. ,$ctx1.sendIdx["size"]=2
  3928. //>>excludeEnd("ctx");
  3929. ][0]).__minus(aNumber)).__plus((1)),$self._size());
  3930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3931. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber})});
  3932. //>>excludeEnd("ctx");
  3933. }; }),
  3934. $globals.SequenceableCollection);
  3935. $core.addMethod(
  3936. $core.method({
  3937. selector: "newStream",
  3938. protocol: "streaming",
  3939. //>>excludeStart("ide", pragmas.excludeIdeData);
  3940. args: [],
  3941. source: "newStream\x0a\x09^ self streamClass on: self",
  3942. referencedClasses: [],
  3943. //>>excludeEnd("ide");
  3944. pragmas: [],
  3945. messageSends: ["on:", "streamClass"]
  3946. }, function ($methodClass){ return function (){
  3947. var self=this,$self=this;
  3948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3949. return $core.withContext(function($ctx1) {
  3950. //>>excludeEnd("ctx");
  3951. return $recv($self._streamClass())._on_(self);
  3952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3953. }, function($ctx1) {$ctx1.fill(self,"newStream",{})});
  3954. //>>excludeEnd("ctx");
  3955. }; }),
  3956. $globals.SequenceableCollection);
  3957. $core.addMethod(
  3958. $core.method({
  3959. selector: "readStream",
  3960. protocol: "streaming",
  3961. //>>excludeStart("ide", pragmas.excludeIdeData);
  3962. args: [],
  3963. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  3964. referencedClasses: [],
  3965. //>>excludeEnd("ide");
  3966. pragmas: [],
  3967. messageSends: ["stream"]
  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 $self._stream();
  3974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3975. }, function($ctx1) {$ctx1.fill(self,"readStream",{})});
  3976. //>>excludeEnd("ctx");
  3977. }; }),
  3978. $globals.SequenceableCollection);
  3979. $core.addMethod(
  3980. $core.method({
  3981. selector: "removeLast",
  3982. protocol: "adding/removing",
  3983. //>>excludeStart("ide", pragmas.excludeIdeData);
  3984. args: [],
  3985. source: "removeLast\x0a\x09^ self remove: self last",
  3986. referencedClasses: [],
  3987. //>>excludeEnd("ide");
  3988. pragmas: [],
  3989. messageSends: ["remove:", "last"]
  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._remove_($self._last());
  3996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3997. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  3998. //>>excludeEnd("ctx");
  3999. }; }),
  4000. $globals.SequenceableCollection);
  4001. $core.addMethod(
  4002. $core.method({
  4003. selector: "reverseDo:",
  4004. protocol: "enumerating",
  4005. //>>excludeStart("ide", pragmas.excludeIdeData);
  4006. args: ["aBlock"],
  4007. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  4008. referencedClasses: [],
  4009. //>>excludeEnd("ide");
  4010. pragmas: [],
  4011. messageSends: ["do:", "reversed"]
  4012. }, function ($methodClass){ return function (aBlock){
  4013. var self=this,$self=this;
  4014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4015. return $core.withContext(function($ctx1) {
  4016. //>>excludeEnd("ctx");
  4017. $recv($self._reversed())._do_(aBlock);
  4018. return self;
  4019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4020. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock})});
  4021. //>>excludeEnd("ctx");
  4022. }; }),
  4023. $globals.SequenceableCollection);
  4024. $core.addMethod(
  4025. $core.method({
  4026. selector: "reversed",
  4027. protocol: "converting",
  4028. //>>excludeStart("ide", pragmas.excludeIdeData);
  4029. args: [],
  4030. source: "reversed\x0a\x09self subclassResponsibility",
  4031. referencedClasses: [],
  4032. //>>excludeEnd("ide");
  4033. pragmas: [],
  4034. messageSends: ["subclassResponsibility"]
  4035. }, function ($methodClass){ return function (){
  4036. var self=this,$self=this;
  4037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4038. return $core.withContext(function($ctx1) {
  4039. //>>excludeEnd("ctx");
  4040. $self._subclassResponsibility();
  4041. return self;
  4042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4043. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4044. //>>excludeEnd("ctx");
  4045. }; }),
  4046. $globals.SequenceableCollection);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "second",
  4050. protocol: "accessing",
  4051. //>>excludeStart("ide", pragmas.excludeIdeData);
  4052. args: [],
  4053. source: "second\x0a\x09^ self at: 2",
  4054. referencedClasses: [],
  4055. //>>excludeEnd("ide");
  4056. pragmas: [],
  4057. messageSends: ["at:"]
  4058. }, function ($methodClass){ return function (){
  4059. var self=this,$self=this;
  4060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4061. return $core.withContext(function($ctx1) {
  4062. //>>excludeEnd("ctx");
  4063. return $self._at_((2));
  4064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4065. }, function($ctx1) {$ctx1.fill(self,"second",{})});
  4066. //>>excludeEnd("ctx");
  4067. }; }),
  4068. $globals.SequenceableCollection);
  4069. $core.addMethod(
  4070. $core.method({
  4071. selector: "stream",
  4072. protocol: "streaming",
  4073. //>>excludeStart("ide", pragmas.excludeIdeData);
  4074. args: [],
  4075. source: "stream\x0a\x09^ self newStream",
  4076. referencedClasses: [],
  4077. //>>excludeEnd("ide");
  4078. pragmas: [],
  4079. messageSends: ["newStream"]
  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._newStream();
  4086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4087. }, function($ctx1) {$ctx1.fill(self,"stream",{})});
  4088. //>>excludeEnd("ctx");
  4089. }; }),
  4090. $globals.SequenceableCollection);
  4091. $core.addMethod(
  4092. $core.method({
  4093. selector: "streamClass",
  4094. protocol: "streaming",
  4095. //>>excludeStart("ide", pragmas.excludeIdeData);
  4096. args: [],
  4097. source: "streamClass\x0a\x09^ self class streamClass",
  4098. referencedClasses: [],
  4099. //>>excludeEnd("ide");
  4100. pragmas: [],
  4101. messageSends: ["streamClass", "class"]
  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 $recv($self._class())._streamClass();
  4108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4109. }, function($ctx1) {$ctx1.fill(self,"streamClass",{})});
  4110. //>>excludeEnd("ctx");
  4111. }; }),
  4112. $globals.SequenceableCollection);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "third",
  4116. protocol: "accessing",
  4117. //>>excludeStart("ide", pragmas.excludeIdeData);
  4118. args: [],
  4119. source: "third\x0a\x09^ self at: 3",
  4120. referencedClasses: [],
  4121. //>>excludeEnd("ide");
  4122. pragmas: [],
  4123. messageSends: ["at:"]
  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 $self._at_((3));
  4130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4131. }, function($ctx1) {$ctx1.fill(self,"third",{})});
  4132. //>>excludeEnd("ctx");
  4133. }; }),
  4134. $globals.SequenceableCollection);
  4135. $core.addMethod(
  4136. $core.method({
  4137. selector: "writeStream",
  4138. protocol: "streaming",
  4139. //>>excludeStart("ide", pragmas.excludeIdeData);
  4140. args: [],
  4141. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4142. referencedClasses: [],
  4143. //>>excludeEnd("ide");
  4144. pragmas: [],
  4145. messageSends: ["stream"]
  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._stream();
  4152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4153. }, function($ctx1) {$ctx1.fill(self,"writeStream",{})});
  4154. //>>excludeEnd("ctx");
  4155. }; }),
  4156. $globals.SequenceableCollection);
  4157. $core.addMethod(
  4158. $core.method({
  4159. selector: "streamClass",
  4160. protocol: "accessing",
  4161. //>>excludeStart("ide", pragmas.excludeIdeData);
  4162. args: [],
  4163. source: "streamClass\x0a\x09\x09^ Stream",
  4164. referencedClasses: ["Stream"],
  4165. //>>excludeEnd("ide");
  4166. pragmas: [],
  4167. messageSends: []
  4168. }, function ($methodClass){ return function (){
  4169. var self=this,$self=this;
  4170. return $globals.Stream;
  4171. }; }),
  4172. $globals.SequenceableCollection.a$cls);
  4173. $core.addMethod(
  4174. $core.method({
  4175. selector: "streamContents:",
  4176. protocol: "streaming",
  4177. //>>excludeStart("ide", pragmas.excludeIdeData);
  4178. args: ["aBlock"],
  4179. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4180. referencedClasses: [],
  4181. //>>excludeEnd("ide");
  4182. pragmas: [],
  4183. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4184. }, function ($methodClass){ return function (aBlock){
  4185. var self=this,$self=this;
  4186. var stream;
  4187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4188. return $core.withContext(function($ctx1) {
  4189. //>>excludeEnd("ctx");
  4190. stream=$recv($self._streamClass())._on_($self._new());
  4191. $recv(aBlock)._value_(stream);
  4192. return $recv(stream)._contents();
  4193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4194. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream})});
  4195. //>>excludeEnd("ctx");
  4196. }; }),
  4197. $globals.SequenceableCollection.a$cls);
  4198. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4199. //>>excludeStart("ide", pragmas.excludeIdeData);
  4200. $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`.";
  4201. //>>excludeEnd("ide");
  4202. $core.addMethod(
  4203. $core.method({
  4204. selector: "add:",
  4205. protocol: "adding/removing",
  4206. //>>excludeStart("ide", pragmas.excludeIdeData);
  4207. args: ["anObject"],
  4208. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4209. referencedClasses: [],
  4210. //>>excludeEnd("ide");
  4211. pragmas: [["inlineJS:", ["self.push(anObject); return anObject;"]]],
  4212. messageSends: []
  4213. }, function ($methodClass){ return function (anObject){
  4214. var self=this,$self=this;
  4215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4216. return $core.withContext(function($ctx1) {
  4217. //>>excludeEnd("ctx");
  4218. self.push(anObject); return anObject;;
  4219. return self;
  4220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4221. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  4222. //>>excludeEnd("ctx");
  4223. }; }),
  4224. $globals.Array);
  4225. $core.addMethod(
  4226. $core.method({
  4227. selector: "addAll:",
  4228. protocol: "adding/removing",
  4229. //>>excludeStart("ide", pragmas.excludeIdeData);
  4230. args: ["aCollection"],
  4231. 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'>",
  4232. referencedClasses: [],
  4233. //>>excludeEnd("ide");
  4234. 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;"]]],
  4235. messageSends: []
  4236. }, function ($methodClass){ return function (aCollection){
  4237. var self=this,$self=this;
  4238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4239. return $core.withContext(function($ctx1) {
  4240. //>>excludeEnd("ctx");
  4241. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4242. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  4243. return aCollection;;
  4244. return self;
  4245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4246. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection})});
  4247. //>>excludeEnd("ctx");
  4248. }; }),
  4249. $globals.Array);
  4250. $core.addMethod(
  4251. $core.method({
  4252. selector: "addFirst:",
  4253. protocol: "adding/removing",
  4254. //>>excludeStart("ide", pragmas.excludeIdeData);
  4255. args: ["anObject"],
  4256. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4257. referencedClasses: [],
  4258. //>>excludeEnd("ide");
  4259. pragmas: [["inlineJS:", ["self.unshift(anObject); return anObject;"]]],
  4260. messageSends: []
  4261. }, function ($methodClass){ return function (anObject){
  4262. var self=this,$self=this;
  4263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4264. return $core.withContext(function($ctx1) {
  4265. //>>excludeEnd("ctx");
  4266. self.unshift(anObject); return anObject;;
  4267. return self;
  4268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4269. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject})});
  4270. //>>excludeEnd("ctx");
  4271. }; }),
  4272. $globals.Array);
  4273. $core.addMethod(
  4274. $core.method({
  4275. selector: "asJavaScriptSource",
  4276. protocol: "converting",
  4277. //>>excludeStart("ide", pragmas.excludeIdeData);
  4278. args: [],
  4279. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  4280. referencedClasses: [],
  4281. //>>excludeEnd("ide");
  4282. pragmas: [],
  4283. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  4284. }, function ($methodClass){ return function (){
  4285. var self=this,$self=this;
  4286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4287. return $core.withContext(function($ctx1) {
  4288. //>>excludeEnd("ctx");
  4289. return [$recv("[".__comma($recv($self._collect_((function(each){
  4290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4291. return $core.withContext(function($ctx2) {
  4292. //>>excludeEnd("ctx");
  4293. return $recv(each)._asJavaScriptSource();
  4294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4296. //>>excludeEnd("ctx");
  4297. })))._join_(", "))).__comma("]")
  4298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4299. ,$ctx1.sendIdx[","]=1
  4300. //>>excludeEnd("ctx");
  4301. ][0];
  4302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4303. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  4304. //>>excludeEnd("ctx");
  4305. }; }),
  4306. $globals.Array);
  4307. $core.addMethod(
  4308. $core.method({
  4309. selector: "at:put:",
  4310. protocol: "accessing",
  4311. //>>excludeStart("ide", pragmas.excludeIdeData);
  4312. args: ["anIndex", "anObject"],
  4313. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4314. referencedClasses: [],
  4315. //>>excludeEnd("ide");
  4316. pragmas: [["inlineJS:", ["return self[anIndex - 1] = anObject"]]],
  4317. messageSends: []
  4318. }, function ($methodClass){ return function (anIndex,anObject){
  4319. var self=this,$self=this;
  4320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4321. return $core.withContext(function($ctx1) {
  4322. //>>excludeEnd("ctx");
  4323. return self[anIndex - 1] = anObject;
  4324. return self;
  4325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4326. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  4327. //>>excludeEnd("ctx");
  4328. }; }),
  4329. $globals.Array);
  4330. $core.addMethod(
  4331. $core.method({
  4332. selector: "collect:",
  4333. protocol: "enumerating",
  4334. //>>excludeStart("ide", pragmas.excludeIdeData);
  4335. args: ["aBlock"],
  4336. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4337. referencedClasses: [],
  4338. //>>excludeEnd("ide");
  4339. pragmas: [["inlineJS:", ["return self.map(function(each) {return aBlock._value_(each)})"]]],
  4340. messageSends: []
  4341. }, function ($methodClass){ return function (aBlock){
  4342. var self=this,$self=this;
  4343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4344. return $core.withContext(function($ctx1) {
  4345. //>>excludeEnd("ctx");
  4346. return self.map(function(each) {return aBlock._value_(each)});
  4347. return self;
  4348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4349. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock})});
  4350. //>>excludeEnd("ctx");
  4351. }; }),
  4352. $globals.Array);
  4353. $core.addMethod(
  4354. $core.method({
  4355. selector: "copyFrom:to:",
  4356. protocol: "copying",
  4357. //>>excludeStart("ide", pragmas.excludeIdeData);
  4358. args: ["anIndex", "anotherIndex"],
  4359. 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'>",
  4360. referencedClasses: [],
  4361. //>>excludeEnd("ide");
  4362. 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}"]]],
  4363. messageSends: []
  4364. }, function ($methodClass){ return function (anIndex,anotherIndex){
  4365. var self=this,$self=this;
  4366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4367. return $core.withContext(function($ctx1) {
  4368. //>>excludeEnd("ctx");
  4369. if (anIndex >= 1 && anotherIndex <= self.length) {
  4370. return self.slice(anIndex - 1, anotherIndex);
  4371. } else {
  4372. self._at_(anIndex);
  4373. self._at_(self.length + 1);
  4374. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4375. };
  4376. return self;
  4377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4378. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  4379. //>>excludeEnd("ctx");
  4380. }; }),
  4381. $globals.Array);
  4382. $core.addMethod(
  4383. $core.method({
  4384. selector: "join:",
  4385. protocol: "enumerating",
  4386. //>>excludeStart("ide", pragmas.excludeIdeData);
  4387. args: ["aString"],
  4388. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4389. referencedClasses: [],
  4390. //>>excludeEnd("ide");
  4391. pragmas: [["inlineJS:", ["return self.join(aString)"]]],
  4392. messageSends: []
  4393. }, function ($methodClass){ return function (aString){
  4394. var self=this,$self=this;
  4395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4396. return $core.withContext(function($ctx1) {
  4397. //>>excludeEnd("ctx");
  4398. return self.join(aString);
  4399. return self;
  4400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4401. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString})});
  4402. //>>excludeEnd("ctx");
  4403. }; }),
  4404. $globals.Array);
  4405. $core.addMethod(
  4406. $core.method({
  4407. selector: "printOn:",
  4408. protocol: "printing",
  4409. //>>excludeStart("ide", pragmas.excludeIdeData);
  4410. args: ["aStream"],
  4411. 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: ')'",
  4412. referencedClasses: [],
  4413. //>>excludeEnd("ide");
  4414. pragmas: [],
  4415. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4416. }, function ($methodClass){ return function (aStream){
  4417. var self=this,$self=this;
  4418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4419. return $core.withContext(function($ctx1) {
  4420. //>>excludeEnd("ctx");
  4421. [(
  4422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4423. $ctx1.supercall = true,
  4424. //>>excludeEnd("ctx");
  4425. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  4426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4427. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  4428. //>>excludeEnd("ctx");
  4429. ][0];
  4430. [$recv(aStream)._nextPutAll_(" (")
  4431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4432. ,$ctx1.sendIdx["nextPutAll:"]=1
  4433. //>>excludeEnd("ctx");
  4434. ][0];
  4435. $self._do_separatedBy_((function(each){
  4436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4437. return $core.withContext(function($ctx2) {
  4438. //>>excludeEnd("ctx");
  4439. return $recv(each)._printOn_(aStream);
  4440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4441. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4442. //>>excludeEnd("ctx");
  4443. }),(function(){
  4444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4445. return $core.withContext(function($ctx2) {
  4446. //>>excludeEnd("ctx");
  4447. return [$recv(aStream)._nextPutAll_(" ")
  4448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4449. ,$ctx2.sendIdx["nextPutAll:"]=2
  4450. //>>excludeEnd("ctx");
  4451. ][0];
  4452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4453. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4454. //>>excludeEnd("ctx");
  4455. }));
  4456. $recv(aStream)._nextPutAll_(")");
  4457. return self;
  4458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4459. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  4460. //>>excludeEnd("ctx");
  4461. }; }),
  4462. $globals.Array);
  4463. $core.addMethod(
  4464. $core.method({
  4465. selector: "remove:ifAbsent:",
  4466. protocol: "adding/removing",
  4467. //>>excludeStart("ide", pragmas.excludeIdeData);
  4468. args: ["anObject", "aBlock"],
  4469. 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 ]",
  4470. referencedClasses: [],
  4471. //>>excludeEnd("ide");
  4472. pragmas: [],
  4473. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4474. }, function ($methodClass){ return function (anObject,aBlock){
  4475. var self=this,$self=this;
  4476. var index;
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. return $core.withContext(function($ctx1) {
  4479. //>>excludeEnd("ctx");
  4480. index=$self._indexOf_ifAbsent_(anObject,(function(){
  4481. return (0);
  4482. }));
  4483. if($core.assert($recv(index).__eq((0)))){
  4484. return $recv(aBlock)._value();
  4485. } else {
  4486. $self._removeIndex_(index);
  4487. return anObject;
  4488. }
  4489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4490. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index})});
  4491. //>>excludeEnd("ctx");
  4492. }; }),
  4493. $globals.Array);
  4494. $core.addMethod(
  4495. $core.method({
  4496. selector: "removeAll",
  4497. protocol: "adding/removing",
  4498. //>>excludeStart("ide", pragmas.excludeIdeData);
  4499. args: [],
  4500. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4501. referencedClasses: [],
  4502. //>>excludeEnd("ide");
  4503. pragmas: [["inlineJS:", ["self.length = 0"]]],
  4504. messageSends: []
  4505. }, function ($methodClass){ return function (){
  4506. var self=this,$self=this;
  4507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4508. return $core.withContext(function($ctx1) {
  4509. //>>excludeEnd("ctx");
  4510. self.length = 0;
  4511. return self;
  4512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4513. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  4514. //>>excludeEnd("ctx");
  4515. }; }),
  4516. $globals.Array);
  4517. $core.addMethod(
  4518. $core.method({
  4519. selector: "removeFrom:to:",
  4520. protocol: "adding/removing",
  4521. //>>excludeStart("ide", pragmas.excludeIdeData);
  4522. args: ["aNumber", "anotherNumber"],
  4523. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4524. referencedClasses: [],
  4525. //>>excludeEnd("ide");
  4526. pragmas: [["inlineJS:", ["self.splice(aNumber -1, anotherNumber - aNumber + 1)"]]],
  4527. messageSends: []
  4528. }, function ($methodClass){ return function (aNumber,anotherNumber){
  4529. var self=this,$self=this;
  4530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4531. return $core.withContext(function($ctx1) {
  4532. //>>excludeEnd("ctx");
  4533. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4534. return self;
  4535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4536. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber})});
  4537. //>>excludeEnd("ctx");
  4538. }; }),
  4539. $globals.Array);
  4540. $core.addMethod(
  4541. $core.method({
  4542. selector: "removeIndex:",
  4543. protocol: "adding/removing",
  4544. //>>excludeStart("ide", pragmas.excludeIdeData);
  4545. args: ["anInteger"],
  4546. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4547. referencedClasses: [],
  4548. //>>excludeEnd("ide");
  4549. pragmas: [["inlineJS:", ["self.splice(anInteger - 1, 1)"]]],
  4550. messageSends: []
  4551. }, function ($methodClass){ return function (anInteger){
  4552. var self=this,$self=this;
  4553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4554. return $core.withContext(function($ctx1) {
  4555. //>>excludeEnd("ctx");
  4556. self.splice(anInteger - 1, 1);
  4557. return self;
  4558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4559. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger})});
  4560. //>>excludeEnd("ctx");
  4561. }; }),
  4562. $globals.Array);
  4563. $core.addMethod(
  4564. $core.method({
  4565. selector: "removeLast",
  4566. protocol: "adding/removing",
  4567. //>>excludeStart("ide", pragmas.excludeIdeData);
  4568. args: [],
  4569. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4570. referencedClasses: [],
  4571. //>>excludeEnd("ide");
  4572. pragmas: [["inlineJS:", ["return self.pop();"]]],
  4573. messageSends: []
  4574. }, function ($methodClass){ return function (){
  4575. var self=this,$self=this;
  4576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4577. return $core.withContext(function($ctx1) {
  4578. //>>excludeEnd("ctx");
  4579. return self.pop();;
  4580. return self;
  4581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4582. }, function($ctx1) {$ctx1.fill(self,"removeLast",{})});
  4583. //>>excludeEnd("ctx");
  4584. }; }),
  4585. $globals.Array);
  4586. $core.addMethod(
  4587. $core.method({
  4588. selector: "reversed",
  4589. protocol: "converting",
  4590. //>>excludeStart("ide", pragmas.excludeIdeData);
  4591. args: [],
  4592. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4593. referencedClasses: [],
  4594. //>>excludeEnd("ide");
  4595. pragmas: [["inlineJS:", ["return self.slice().reverse()"]]],
  4596. messageSends: []
  4597. }, function ($methodClass){ return function (){
  4598. var self=this,$self=this;
  4599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4600. return $core.withContext(function($ctx1) {
  4601. //>>excludeEnd("ctx");
  4602. return self.slice().reverse();
  4603. return self;
  4604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4605. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  4606. //>>excludeEnd("ctx");
  4607. }; }),
  4608. $globals.Array);
  4609. $core.addMethod(
  4610. $core.method({
  4611. selector: "select:",
  4612. protocol: "enumerating",
  4613. //>>excludeStart("ide", pragmas.excludeIdeData);
  4614. args: ["aBlock"],
  4615. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  4616. referencedClasses: [],
  4617. //>>excludeEnd("ide");
  4618. pragmas: [["inlineJS:", ["return self.filter(function(each) {return aBlock._value_(each)})"]]],
  4619. messageSends: []
  4620. }, function ($methodClass){ return function (aBlock){
  4621. var self=this,$self=this;
  4622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4623. return $core.withContext(function($ctx1) {
  4624. //>>excludeEnd("ctx");
  4625. return self.filter(function(each) {return aBlock._value_(each)});
  4626. return self;
  4627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4628. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock})});
  4629. //>>excludeEnd("ctx");
  4630. }; }),
  4631. $globals.Array);
  4632. $core.addMethod(
  4633. $core.method({
  4634. selector: "shallowCopy",
  4635. protocol: "copying",
  4636. //>>excludeStart("ide", pragmas.excludeIdeData);
  4637. args: [],
  4638. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  4639. referencedClasses: [],
  4640. //>>excludeEnd("ide");
  4641. pragmas: [["inlineJS:", ["return self.slice()"]]],
  4642. messageSends: []
  4643. }, function ($methodClass){ return function (){
  4644. var self=this,$self=this;
  4645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4646. return $core.withContext(function($ctx1) {
  4647. //>>excludeEnd("ctx");
  4648. return self.slice();
  4649. return self;
  4650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4651. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{})});
  4652. //>>excludeEnd("ctx");
  4653. }; }),
  4654. $globals.Array);
  4655. $core.addMethod(
  4656. $core.method({
  4657. selector: "sort",
  4658. protocol: "enumerating",
  4659. //>>excludeStart("ide", pragmas.excludeIdeData);
  4660. args: [],
  4661. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  4662. referencedClasses: [],
  4663. //>>excludeEnd("ide");
  4664. pragmas: [],
  4665. messageSends: ["sort:", "<"]
  4666. }, function ($methodClass){ return function (){
  4667. var self=this,$self=this;
  4668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4669. return $core.withContext(function($ctx1) {
  4670. //>>excludeEnd("ctx");
  4671. return $self._sort_((function(a,b){
  4672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4673. return $core.withContext(function($ctx2) {
  4674. //>>excludeEnd("ctx");
  4675. return $recv(a).__lt(b);
  4676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4677. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4678. //>>excludeEnd("ctx");
  4679. }));
  4680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4681. }, function($ctx1) {$ctx1.fill(self,"sort",{})});
  4682. //>>excludeEnd("ctx");
  4683. }; }),
  4684. $globals.Array);
  4685. $core.addMethod(
  4686. $core.method({
  4687. selector: "sort:",
  4688. protocol: "enumerating",
  4689. //>>excludeStart("ide", pragmas.excludeIdeData);
  4690. args: ["aBlock"],
  4691. 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'>",
  4692. referencedClasses: [],
  4693. //>>excludeEnd("ide");
  4694. 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"]]],
  4695. messageSends: []
  4696. }, function ($methodClass){ return function (aBlock){
  4697. var self=this,$self=this;
  4698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4699. return $core.withContext(function($ctx1) {
  4700. //>>excludeEnd("ctx");
  4701. return self.sort(function(a, b) {
  4702. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  4703. })
  4704. ;
  4705. return self;
  4706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4707. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock})});
  4708. //>>excludeEnd("ctx");
  4709. }; }),
  4710. $globals.Array);
  4711. $core.addMethod(
  4712. $core.method({
  4713. selector: "sorted",
  4714. protocol: "enumerating",
  4715. //>>excludeStart("ide", pragmas.excludeIdeData);
  4716. args: [],
  4717. source: "sorted\x0a\x09^ self copy sort",
  4718. referencedClasses: [],
  4719. //>>excludeEnd("ide");
  4720. pragmas: [],
  4721. messageSends: ["sort", "copy"]
  4722. }, function ($methodClass){ return function (){
  4723. var self=this,$self=this;
  4724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4725. return $core.withContext(function($ctx1) {
  4726. //>>excludeEnd("ctx");
  4727. return $recv($self._copy())._sort();
  4728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4729. }, function($ctx1) {$ctx1.fill(self,"sorted",{})});
  4730. //>>excludeEnd("ctx");
  4731. }; }),
  4732. $globals.Array);
  4733. $core.addMethod(
  4734. $core.method({
  4735. selector: "sorted:",
  4736. protocol: "enumerating",
  4737. //>>excludeStart("ide", pragmas.excludeIdeData);
  4738. args: ["aBlock"],
  4739. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  4740. referencedClasses: [],
  4741. //>>excludeEnd("ide");
  4742. pragmas: [],
  4743. messageSends: ["sort:", "copy"]
  4744. }, function ($methodClass){ return function (aBlock){
  4745. var self=this,$self=this;
  4746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4747. return $core.withContext(function($ctx1) {
  4748. //>>excludeEnd("ctx");
  4749. return $recv($self._copy())._sort_(aBlock);
  4750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4751. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock})});
  4752. //>>excludeEnd("ctx");
  4753. }; }),
  4754. $globals.Array);
  4755. $core.addMethod(
  4756. $core.method({
  4757. selector: "new:",
  4758. protocol: "instance creation",
  4759. //>>excludeStart("ide", pragmas.excludeIdeData);
  4760. args: ["anInteger"],
  4761. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  4762. referencedClasses: [],
  4763. //>>excludeEnd("ide");
  4764. pragmas: [["inlineJS:", ["return new Array(anInteger)"]]],
  4765. messageSends: []
  4766. }, function ($methodClass){ return function (anInteger){
  4767. var self=this,$self=this;
  4768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4769. return $core.withContext(function($ctx1) {
  4770. //>>excludeEnd("ctx");
  4771. return new Array(anInteger);
  4772. return self;
  4773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4774. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger})});
  4775. //>>excludeEnd("ctx");
  4776. }; }),
  4777. $globals.Array.a$cls);
  4778. $core.addMethod(
  4779. $core.method({
  4780. selector: "with:",
  4781. protocol: "instance creation",
  4782. //>>excludeStart("ide", pragmas.excludeIdeData);
  4783. args: ["anObject"],
  4784. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  4785. referencedClasses: [],
  4786. //>>excludeEnd("ide");
  4787. pragmas: [],
  4788. messageSends: ["at:put:", "new:", "yourself"]
  4789. }, function ($methodClass){ return function (anObject){
  4790. var self=this,$self=this;
  4791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4792. return $core.withContext(function($ctx1) {
  4793. //>>excludeEnd("ctx");
  4794. var $1;
  4795. $1=$self._new_((1));
  4796. $recv($1)._at_put_((1),anObject);
  4797. return $recv($1)._yourself();
  4798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4799. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject})});
  4800. //>>excludeEnd("ctx");
  4801. }; }),
  4802. $globals.Array.a$cls);
  4803. $core.addMethod(
  4804. $core.method({
  4805. selector: "with:with:",
  4806. protocol: "instance creation",
  4807. //>>excludeStart("ide", pragmas.excludeIdeData);
  4808. args: ["anObject", "anObject2"],
  4809. 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",
  4810. referencedClasses: [],
  4811. //>>excludeEnd("ide");
  4812. pragmas: [],
  4813. messageSends: ["at:put:", "new:", "yourself"]
  4814. }, function ($methodClass){ return function (anObject,anObject2){
  4815. var self=this,$self=this;
  4816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4817. return $core.withContext(function($ctx1) {
  4818. //>>excludeEnd("ctx");
  4819. var $1;
  4820. $1=$self._new_((2));
  4821. [$recv($1)._at_put_((1),anObject)
  4822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4823. ,$ctx1.sendIdx["at:put:"]=1
  4824. //>>excludeEnd("ctx");
  4825. ][0];
  4826. $recv($1)._at_put_((2),anObject2);
  4827. return $recv($1)._yourself();
  4828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4829. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2})});
  4830. //>>excludeEnd("ctx");
  4831. }; }),
  4832. $globals.Array.a$cls);
  4833. $core.addMethod(
  4834. $core.method({
  4835. selector: "with:with:with:",
  4836. protocol: "instance creation",
  4837. //>>excludeStart("ide", pragmas.excludeIdeData);
  4838. args: ["anObject", "anObject2", "anObject3"],
  4839. 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",
  4840. referencedClasses: [],
  4841. //>>excludeEnd("ide");
  4842. pragmas: [],
  4843. messageSends: ["at:put:", "new:", "yourself"]
  4844. }, function ($methodClass){ return function (anObject,anObject2,anObject3){
  4845. var self=this,$self=this;
  4846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4847. return $core.withContext(function($ctx1) {
  4848. //>>excludeEnd("ctx");
  4849. var $1;
  4850. $1=$self._new_((3));
  4851. [$recv($1)._at_put_((1),anObject)
  4852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4853. ,$ctx1.sendIdx["at:put:"]=1
  4854. //>>excludeEnd("ctx");
  4855. ][0];
  4856. [$recv($1)._at_put_((2),anObject2)
  4857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4858. ,$ctx1.sendIdx["at:put:"]=2
  4859. //>>excludeEnd("ctx");
  4860. ][0];
  4861. $recv($1)._at_put_((3),anObject3);
  4862. return $recv($1)._yourself();
  4863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4864. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3})});
  4865. //>>excludeEnd("ctx");
  4866. }; }),
  4867. $globals.Array.a$cls);
  4868. $core.addMethod(
  4869. $core.method({
  4870. selector: "withAll:",
  4871. protocol: "instance creation",
  4872. //>>excludeStart("ide", pragmas.excludeIdeData);
  4873. args: ["aCollection"],
  4874. 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",
  4875. referencedClasses: [],
  4876. //>>excludeEnd("ide");
  4877. pragmas: [],
  4878. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  4879. }, function ($methodClass){ return function (aCollection){
  4880. var self=this,$self=this;
  4881. var instance,index;
  4882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4883. return $core.withContext(function($ctx1) {
  4884. //>>excludeEnd("ctx");
  4885. index=(1);
  4886. instance=$self._new_($recv(aCollection)._size());
  4887. $recv(aCollection)._do_((function(each){
  4888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4889. return $core.withContext(function($ctx2) {
  4890. //>>excludeEnd("ctx");
  4891. $recv(instance)._at_put_(index,each);
  4892. index=$recv(index).__plus((1));
  4893. return index;
  4894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4895. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4896. //>>excludeEnd("ctx");
  4897. }));
  4898. return instance;
  4899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4900. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index})});
  4901. //>>excludeEnd("ctx");
  4902. }; }),
  4903. $globals.Array.a$cls);
  4904. $core.addClass("String", $globals.SequenceableCollection, [], "Kernel-Collections");
  4905. //>>excludeStart("ide", pragmas.excludeIdeData);
  4906. $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 >> #,`";
  4907. //>>excludeEnd("ide");
  4908. $core.addMethod(
  4909. $core.method({
  4910. selector: ",",
  4911. protocol: "copying",
  4912. //>>excludeStart("ide", pragmas.excludeIdeData);
  4913. args: ["aString"],
  4914. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  4915. referencedClasses: [],
  4916. //>>excludeEnd("ide");
  4917. pragmas: [["inlineJS:", ["return String(self) + aString"]]],
  4918. messageSends: []
  4919. }, function ($methodClass){ return function (aString){
  4920. var self=this,$self=this;
  4921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4922. return $core.withContext(function($ctx1) {
  4923. //>>excludeEnd("ctx");
  4924. return String(self) + aString;
  4925. return self;
  4926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4927. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString})});
  4928. //>>excludeEnd("ctx");
  4929. }; }),
  4930. $globals.String);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "<",
  4934. protocol: "comparing",
  4935. //>>excludeStart("ide", pragmas.excludeIdeData);
  4936. args: ["aString"],
  4937. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  4938. referencedClasses: [],
  4939. //>>excludeEnd("ide");
  4940. pragmas: [["inlineJS:", ["return String(self) < aString._asString()"]]],
  4941. messageSends: []
  4942. }, function ($methodClass){ return function (aString){
  4943. var self=this,$self=this;
  4944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4945. return $core.withContext(function($ctx1) {
  4946. //>>excludeEnd("ctx");
  4947. return String(self) < aString._asString();
  4948. return self;
  4949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4950. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString})});
  4951. //>>excludeEnd("ctx");
  4952. }; }),
  4953. $globals.String);
  4954. $core.addMethod(
  4955. $core.method({
  4956. selector: "<=",
  4957. protocol: "comparing",
  4958. //>>excludeStart("ide", pragmas.excludeIdeData);
  4959. args: ["aString"],
  4960. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  4961. referencedClasses: [],
  4962. //>>excludeEnd("ide");
  4963. pragmas: [["inlineJS:", ["return String(self) <= aString._asString()"]]],
  4964. messageSends: []
  4965. }, function ($methodClass){ return function (aString){
  4966. var self=this,$self=this;
  4967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4968. return $core.withContext(function($ctx1) {
  4969. //>>excludeEnd("ctx");
  4970. return String(self) <= aString._asString();
  4971. return self;
  4972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4973. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString})});
  4974. //>>excludeEnd("ctx");
  4975. }; }),
  4976. $globals.String);
  4977. $core.addMethod(
  4978. $core.method({
  4979. selector: "=",
  4980. protocol: "comparing",
  4981. //>>excludeStart("ide", pragmas.excludeIdeData);
  4982. args: ["aString"],
  4983. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  4984. referencedClasses: [],
  4985. //>>excludeEnd("ide");
  4986. pragmas: [["inlineJS:", ["return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())"]]],
  4987. messageSends: []
  4988. }, function ($methodClass){ return function (aString){
  4989. var self=this,$self=this;
  4990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4991. return $core.withContext(function($ctx1) {
  4992. //>>excludeEnd("ctx");
  4993. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  4994. return self;
  4995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4996. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString})});
  4997. //>>excludeEnd("ctx");
  4998. }; }),
  4999. $globals.String);
  5000. $core.addMethod(
  5001. $core.method({
  5002. selector: "==",
  5003. protocol: "comparing",
  5004. //>>excludeStart("ide", pragmas.excludeIdeData);
  5005. args: ["aString"],
  5006. 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'>",
  5007. referencedClasses: [],
  5008. //>>excludeEnd("ide");
  5009. 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;"]]],
  5010. messageSends: []
  5011. }, function ($methodClass){ return function (aString){
  5012. var self=this,$self=this;
  5013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5014. return $core.withContext(function($ctx1) {
  5015. //>>excludeEnd("ctx");
  5016. if (typeof aString === "string") return String(self) === aString;
  5017. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5018. else return false;;
  5019. return self;
  5020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5021. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString})});
  5022. //>>excludeEnd("ctx");
  5023. }; }),
  5024. $globals.String);
  5025. $core.addMethod(
  5026. $core.method({
  5027. selector: ">",
  5028. protocol: "comparing",
  5029. //>>excludeStart("ide", pragmas.excludeIdeData);
  5030. args: ["aString"],
  5031. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5032. referencedClasses: [],
  5033. //>>excludeEnd("ide");
  5034. pragmas: [["inlineJS:", ["return String(self) > aString._asString()"]]],
  5035. messageSends: []
  5036. }, function ($methodClass){ return function (aString){
  5037. var self=this,$self=this;
  5038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5039. return $core.withContext(function($ctx1) {
  5040. //>>excludeEnd("ctx");
  5041. return String(self) > aString._asString();
  5042. return self;
  5043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5044. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString})});
  5045. //>>excludeEnd("ctx");
  5046. }; }),
  5047. $globals.String);
  5048. $core.addMethod(
  5049. $core.method({
  5050. selector: ">=",
  5051. protocol: "comparing",
  5052. //>>excludeStart("ide", pragmas.excludeIdeData);
  5053. args: ["aString"],
  5054. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5055. referencedClasses: [],
  5056. //>>excludeEnd("ide");
  5057. pragmas: [["inlineJS:", ["return String(self) >= aString._asString()"]]],
  5058. messageSends: []
  5059. }, function ($methodClass){ return function (aString){
  5060. var self=this,$self=this;
  5061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5062. return $core.withContext(function($ctx1) {
  5063. //>>excludeEnd("ctx");
  5064. return String(self) >= aString._asString();
  5065. return self;
  5066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5067. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString})});
  5068. //>>excludeEnd("ctx");
  5069. }; }),
  5070. $globals.String);
  5071. $core.addMethod(
  5072. $core.method({
  5073. selector: "add:",
  5074. protocol: "adding/removing",
  5075. //>>excludeStart("ide", pragmas.excludeIdeData);
  5076. args: ["anObject"],
  5077. source: "add: anObject\x0a\x09self errorReadOnly",
  5078. referencedClasses: [],
  5079. //>>excludeEnd("ide");
  5080. pragmas: [],
  5081. messageSends: ["errorReadOnly"]
  5082. }, function ($methodClass){ return function (anObject){
  5083. var self=this,$self=this;
  5084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5085. return $core.withContext(function($ctx1) {
  5086. //>>excludeEnd("ctx");
  5087. $self._errorReadOnly();
  5088. return self;
  5089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5090. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject})});
  5091. //>>excludeEnd("ctx");
  5092. }; }),
  5093. $globals.String);
  5094. $core.addMethod(
  5095. $core.method({
  5096. selector: "asJavaScriptMethodName",
  5097. protocol: "converting",
  5098. //>>excludeStart("ide", pragmas.excludeIdeData);
  5099. args: [],
  5100. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5101. referencedClasses: [],
  5102. //>>excludeEnd("ide");
  5103. pragmas: [["inlineJS:", ["return $core.st2js(self)"]]],
  5104. messageSends: []
  5105. }, function ($methodClass){ return function (){
  5106. var self=this,$self=this;
  5107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5108. return $core.withContext(function($ctx1) {
  5109. //>>excludeEnd("ctx");
  5110. return $core.st2js(self);
  5111. return self;
  5112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5113. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{})});
  5114. //>>excludeEnd("ctx");
  5115. }; }),
  5116. $globals.String);
  5117. $core.addMethod(
  5118. $core.method({
  5119. selector: "asJavaScriptObject",
  5120. protocol: "converting",
  5121. //>>excludeStart("ide", pragmas.excludeIdeData);
  5122. args: [],
  5123. source: "asJavaScriptObject\x0a\x09^ self",
  5124. referencedClasses: [],
  5125. //>>excludeEnd("ide");
  5126. pragmas: [],
  5127. messageSends: []
  5128. }, function ($methodClass){ return function (){
  5129. var self=this,$self=this;
  5130. return self;
  5131. }; }),
  5132. $globals.String);
  5133. $core.addMethod(
  5134. $core.method({
  5135. selector: "asJavaScriptSource",
  5136. protocol: "converting",
  5137. //>>excludeStart("ide", pragmas.excludeIdeData);
  5138. args: [],
  5139. 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'>",
  5140. referencedClasses: [],
  5141. //>>excludeEnd("ide");
  5142. 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"]]],
  5143. messageSends: []
  5144. }, function ($methodClass){ return function (){
  5145. var self=this,$self=this;
  5146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5147. return $core.withContext(function($ctx1) {
  5148. //>>excludeEnd("ctx");
  5149. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5150. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5151. else
  5152. return "\"" + self + "\"";
  5153. ;
  5154. return self;
  5155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5156. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{})});
  5157. //>>excludeEnd("ctx");
  5158. }; }),
  5159. $globals.String);
  5160. $core.addMethod(
  5161. $core.method({
  5162. selector: "asLowercase",
  5163. protocol: "converting",
  5164. //>>excludeStart("ide", pragmas.excludeIdeData);
  5165. args: [],
  5166. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5167. referencedClasses: [],
  5168. //>>excludeEnd("ide");
  5169. pragmas: [["inlineJS:", ["return self.toLowerCase()"]]],
  5170. messageSends: []
  5171. }, function ($methodClass){ return function (){
  5172. var self=this,$self=this;
  5173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5174. return $core.withContext(function($ctx1) {
  5175. //>>excludeEnd("ctx");
  5176. return self.toLowerCase();
  5177. return self;
  5178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5179. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{})});
  5180. //>>excludeEnd("ctx");
  5181. }; }),
  5182. $globals.String);
  5183. $core.addMethod(
  5184. $core.method({
  5185. selector: "asMutator",
  5186. protocol: "converting",
  5187. //>>excludeStart("ide", pragmas.excludeIdeData);
  5188. args: [],
  5189. 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",
  5190. referencedClasses: [],
  5191. //>>excludeEnd("ide");
  5192. pragmas: [],
  5193. messageSends: ["ifFalse:", "=", "last", ","]
  5194. }, function ($methodClass){ return function (){
  5195. var self=this,$self=this;
  5196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5197. return $core.withContext(function($ctx1) {
  5198. //>>excludeEnd("ctx");
  5199. if(!$core.assert($recv($self._last()).__eq(":"))){
  5200. return $self.__comma(":");
  5201. }
  5202. return self;
  5203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5204. }, function($ctx1) {$ctx1.fill(self,"asMutator",{})});
  5205. //>>excludeEnd("ctx");
  5206. }; }),
  5207. $globals.String);
  5208. $core.addMethod(
  5209. $core.method({
  5210. selector: "asNumber",
  5211. protocol: "converting",
  5212. //>>excludeStart("ide", pragmas.excludeIdeData);
  5213. args: [],
  5214. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5215. referencedClasses: [],
  5216. //>>excludeEnd("ide");
  5217. pragmas: [["inlineJS:", ["return Number(self)"]]],
  5218. messageSends: []
  5219. }, function ($methodClass){ return function (){
  5220. var self=this,$self=this;
  5221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5222. return $core.withContext(function($ctx1) {
  5223. //>>excludeEnd("ctx");
  5224. return Number(self);
  5225. return self;
  5226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5227. }, function($ctx1) {$ctx1.fill(self,"asNumber",{})});
  5228. //>>excludeEnd("ctx");
  5229. }; }),
  5230. $globals.String);
  5231. $core.addMethod(
  5232. $core.method({
  5233. selector: "asRegexp",
  5234. protocol: "converting",
  5235. //>>excludeStart("ide", pragmas.excludeIdeData);
  5236. args: [],
  5237. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5238. referencedClasses: ["RegularExpression"],
  5239. //>>excludeEnd("ide");
  5240. pragmas: [],
  5241. messageSends: ["fromString:"]
  5242. }, function ($methodClass){ return function (){
  5243. var self=this,$self=this;
  5244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5245. return $core.withContext(function($ctx1) {
  5246. //>>excludeEnd("ctx");
  5247. return $recv($globals.RegularExpression)._fromString_(self);
  5248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5249. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{})});
  5250. //>>excludeEnd("ctx");
  5251. }; }),
  5252. $globals.String);
  5253. $core.addMethod(
  5254. $core.method({
  5255. selector: "asString",
  5256. protocol: "converting",
  5257. //>>excludeStart("ide", pragmas.excludeIdeData);
  5258. args: [],
  5259. source: "asString\x0a\x09^ self",
  5260. referencedClasses: [],
  5261. //>>excludeEnd("ide");
  5262. pragmas: [],
  5263. messageSends: []
  5264. }, function ($methodClass){ return function (){
  5265. var self=this,$self=this;
  5266. return self;
  5267. }; }),
  5268. $globals.String);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "asSymbol",
  5272. protocol: "converting",
  5273. //>>excludeStart("ide", pragmas.excludeIdeData);
  5274. args: [],
  5275. source: "asSymbol\x0a\x09^ self",
  5276. referencedClasses: [],
  5277. //>>excludeEnd("ide");
  5278. pragmas: [],
  5279. messageSends: []
  5280. }, function ($methodClass){ return function (){
  5281. var self=this,$self=this;
  5282. return self;
  5283. }; }),
  5284. $globals.String);
  5285. $core.addMethod(
  5286. $core.method({
  5287. selector: "asSymbolPrintOn:",
  5288. protocol: "printing",
  5289. //>>excludeStart("ide", pragmas.excludeIdeData);
  5290. args: ["aStream"],
  5291. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5292. referencedClasses: [],
  5293. //>>excludeEnd("ide");
  5294. pragmas: [],
  5295. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5296. }, function ($methodClass){ return function (aStream){
  5297. var self=this,$self=this;
  5298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5299. return $core.withContext(function($ctx1) {
  5300. //>>excludeEnd("ctx");
  5301. $recv(aStream)._nextPutAll_("#");
  5302. if($core.assert($recv($self._asString())._isSelector())){
  5303. $recv(aStream)._nextPut_(self);
  5304. } else {
  5305. $self._printOn_(aStream);
  5306. }
  5307. return self;
  5308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5309. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream})});
  5310. //>>excludeEnd("ctx");
  5311. }; }),
  5312. $globals.String);
  5313. $core.addMethod(
  5314. $core.method({
  5315. selector: "asUppercase",
  5316. protocol: "converting",
  5317. //>>excludeStart("ide", pragmas.excludeIdeData);
  5318. args: [],
  5319. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5320. referencedClasses: [],
  5321. //>>excludeEnd("ide");
  5322. pragmas: [["inlineJS:", ["return self.toUpperCase()"]]],
  5323. messageSends: []
  5324. }, function ($methodClass){ return function (){
  5325. var self=this,$self=this;
  5326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5327. return $core.withContext(function($ctx1) {
  5328. //>>excludeEnd("ctx");
  5329. return self.toUpperCase();
  5330. return self;
  5331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5332. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{})});
  5333. //>>excludeEnd("ctx");
  5334. }; }),
  5335. $globals.String);
  5336. $core.addMethod(
  5337. $core.method({
  5338. selector: "asciiValue",
  5339. protocol: "accessing",
  5340. //>>excludeStart("ide", pragmas.excludeIdeData);
  5341. args: [],
  5342. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  5343. referencedClasses: [],
  5344. //>>excludeEnd("ide");
  5345. pragmas: [["inlineJS:", ["return self.charCodeAt(0);"]]],
  5346. messageSends: []
  5347. }, function ($methodClass){ return function (){
  5348. var self=this,$self=this;
  5349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5350. return $core.withContext(function($ctx1) {
  5351. //>>excludeEnd("ctx");
  5352. return self.charCodeAt(0);;
  5353. return self;
  5354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5355. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{})});
  5356. //>>excludeEnd("ctx");
  5357. }; }),
  5358. $globals.String);
  5359. $core.addMethod(
  5360. $core.method({
  5361. selector: "at:ifAbsent:",
  5362. protocol: "accessing",
  5363. //>>excludeStart("ide", pragmas.excludeIdeData);
  5364. args: ["anIndex", "aBlock"],
  5365. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  5366. referencedClasses: [],
  5367. //>>excludeEnd("ide");
  5368. pragmas: [["inlineJS:", ["return String(self)[anIndex - 1] || aBlock._value()"]]],
  5369. messageSends: []
  5370. }, function ($methodClass){ return function (anIndex,aBlock){
  5371. var self=this,$self=this;
  5372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5373. return $core.withContext(function($ctx1) {
  5374. //>>excludeEnd("ctx");
  5375. return String(self)[anIndex - 1] || aBlock._value();
  5376. return self;
  5377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5378. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  5379. //>>excludeEnd("ctx");
  5380. }; }),
  5381. $globals.String);
  5382. $core.addMethod(
  5383. $core.method({
  5384. selector: "at:ifPresent:ifAbsent:",
  5385. protocol: "accessing",
  5386. //>>excludeStart("ide", pragmas.excludeIdeData);
  5387. args: ["anIndex", "aBlock", "anotherBlock"],
  5388. 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'>",
  5389. referencedClasses: [],
  5390. //>>excludeEnd("ide");
  5391. pragmas: [["inlineJS:", ["\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09"]]],
  5392. messageSends: []
  5393. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  5394. var self=this,$self=this;
  5395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5396. return $core.withContext(function($ctx1) {
  5397. //>>excludeEnd("ctx");
  5398. var result = String(self)[anIndex - 1];
  5399. return result ? aBlock._value_(result) : anotherBlock._value();
  5400. ;
  5401. return self;
  5402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5403. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  5404. //>>excludeEnd("ctx");
  5405. }; }),
  5406. $globals.String);
  5407. $core.addMethod(
  5408. $core.method({
  5409. selector: "at:put:",
  5410. protocol: "accessing",
  5411. //>>excludeStart("ide", pragmas.excludeIdeData);
  5412. args: ["anIndex", "anObject"],
  5413. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5414. referencedClasses: [],
  5415. //>>excludeEnd("ide");
  5416. pragmas: [],
  5417. messageSends: ["errorReadOnly"]
  5418. }, function ($methodClass){ return function (anIndex,anObject){
  5419. var self=this,$self=this;
  5420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5421. return $core.withContext(function($ctx1) {
  5422. //>>excludeEnd("ctx");
  5423. $self._errorReadOnly();
  5424. return self;
  5425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5426. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  5427. //>>excludeEnd("ctx");
  5428. }; }),
  5429. $globals.String);
  5430. $core.addMethod(
  5431. $core.method({
  5432. selector: "capitalized",
  5433. protocol: "converting",
  5434. //>>excludeStart("ide", pragmas.excludeIdeData);
  5435. args: [],
  5436. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  5437. referencedClasses: [],
  5438. //>>excludeEnd("ide");
  5439. pragmas: [],
  5440. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  5441. }, function ($methodClass){ return function (){
  5442. var self=this,$self=this;
  5443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5444. return $core.withContext(function($ctx1) {
  5445. //>>excludeEnd("ctx");
  5446. return $self._ifNotEmpty_((function(){
  5447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5448. return $core.withContext(function($ctx2) {
  5449. //>>excludeEnd("ctx");
  5450. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  5451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5453. //>>excludeEnd("ctx");
  5454. }));
  5455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5456. }, function($ctx1) {$ctx1.fill(self,"capitalized",{})});
  5457. //>>excludeEnd("ctx");
  5458. }; }),
  5459. $globals.String);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "charCodeAt:",
  5463. protocol: "accessing",
  5464. //>>excludeStart("ide", pragmas.excludeIdeData);
  5465. args: ["anInteger"],
  5466. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  5467. referencedClasses: [],
  5468. //>>excludeEnd("ide");
  5469. pragmas: [["inlineJS:", ["return self.charCodeAt(anInteger - 1)"]]],
  5470. messageSends: []
  5471. }, function ($methodClass){ return function (anInteger){
  5472. var self=this,$self=this;
  5473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5474. return $core.withContext(function($ctx1) {
  5475. //>>excludeEnd("ctx");
  5476. return self.charCodeAt(anInteger - 1);
  5477. return self;
  5478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5479. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger})});
  5480. //>>excludeEnd("ctx");
  5481. }; }),
  5482. $globals.String);
  5483. $core.addMethod(
  5484. $core.method({
  5485. selector: "copyFrom:to:",
  5486. protocol: "copying",
  5487. //>>excludeStart("ide", pragmas.excludeIdeData);
  5488. args: ["anIndex", "anotherIndex"],
  5489. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  5490. referencedClasses: [],
  5491. //>>excludeEnd("ide");
  5492. pragmas: [["inlineJS:", ["return self.substring(anIndex - 1, anotherIndex)"]]],
  5493. messageSends: []
  5494. }, function ($methodClass){ return function (anIndex,anotherIndex){
  5495. var self=this,$self=this;
  5496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5497. return $core.withContext(function($ctx1) {
  5498. //>>excludeEnd("ctx");
  5499. return self.substring(anIndex - 1, anotherIndex);
  5500. return self;
  5501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5502. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex})});
  5503. //>>excludeEnd("ctx");
  5504. }; }),
  5505. $globals.String);
  5506. $core.addMethod(
  5507. $core.method({
  5508. selector: "copyWithFirst:",
  5509. protocol: "copying",
  5510. //>>excludeStart("ide", pragmas.excludeIdeData);
  5511. args: ["anObject"],
  5512. 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",
  5513. referencedClasses: [],
  5514. //>>excludeEnd("ide");
  5515. pragmas: [],
  5516. messageSends: ["ifFalse:", "and:", "isString", "=", "size", "error:", ",", "name", "class"]
  5517. }, function ($methodClass){ return function (anObject){
  5518. var self=this,$self=this;
  5519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5520. return $core.withContext(function($ctx1) {
  5521. //>>excludeEnd("ctx");
  5522. if(!$core.assert($recv($recv(anObject)._isString())._and_((function(){
  5523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5524. return $core.withContext(function($ctx2) {
  5525. //>>excludeEnd("ctx");
  5526. return $recv($recv(anObject)._size()).__eq((1));
  5527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5528. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5529. //>>excludeEnd("ctx");
  5530. })))){
  5531. $self._error_([$recv(["Cannot put ".__comma($recv($recv(anObject)._class())._name())
  5532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5533. ,$ctx1.sendIdx[","]=2
  5534. //>>excludeEnd("ctx");
  5535. ][0]).__comma(" in a String")
  5536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5537. ,$ctx1.sendIdx[","]=1
  5538. //>>excludeEnd("ctx");
  5539. ][0]);
  5540. }
  5541. return $recv(anObject).__comma(self);
  5542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5543. }, function($ctx1) {$ctx1.fill(self,"copyWithFirst:",{anObject:anObject})});
  5544. //>>excludeEnd("ctx");
  5545. }; }),
  5546. $globals.String);
  5547. $core.addMethod(
  5548. $core.method({
  5549. selector: "crlfSanitized",
  5550. protocol: "converting",
  5551. //>>excludeStart("ide", pragmas.excludeIdeData);
  5552. args: [],
  5553. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  5554. referencedClasses: ["String"],
  5555. //>>excludeEnd("ide");
  5556. pragmas: [],
  5557. messageSends: ["join:", "lines", "lf"]
  5558. }, function ($methodClass){ return function (){
  5559. var self=this,$self=this;
  5560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5561. return $core.withContext(function($ctx1) {
  5562. //>>excludeEnd("ctx");
  5563. return $recv($self._lines())._join_($recv($globals.String)._lf());
  5564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5565. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{})});
  5566. //>>excludeEnd("ctx");
  5567. }; }),
  5568. $globals.String);
  5569. $core.addMethod(
  5570. $core.method({
  5571. selector: "deepCopy",
  5572. protocol: "copying",
  5573. //>>excludeStart("ide", pragmas.excludeIdeData);
  5574. args: [],
  5575. source: "deepCopy\x0a\x09^ self shallowCopy",
  5576. referencedClasses: [],
  5577. //>>excludeEnd("ide");
  5578. pragmas: [],
  5579. messageSends: ["shallowCopy"]
  5580. }, function ($methodClass){ return function (){
  5581. var self=this,$self=this;
  5582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5583. return $core.withContext(function($ctx1) {
  5584. //>>excludeEnd("ctx");
  5585. return $self._shallowCopy();
  5586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5587. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{})});
  5588. //>>excludeEnd("ctx");
  5589. }; }),
  5590. $globals.String);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "errorReadOnly",
  5594. protocol: "error handling",
  5595. //>>excludeStart("ide", pragmas.excludeIdeData);
  5596. args: [],
  5597. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5598. referencedClasses: [],
  5599. //>>excludeEnd("ide");
  5600. pragmas: [],
  5601. messageSends: ["error:"]
  5602. }, function ($methodClass){ return function (){
  5603. var self=this,$self=this;
  5604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5605. return $core.withContext(function($ctx1) {
  5606. //>>excludeEnd("ctx");
  5607. $self._error_("Object is read-only");
  5608. return self;
  5609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5610. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{})});
  5611. //>>excludeEnd("ctx");
  5612. }; }),
  5613. $globals.String);
  5614. $core.addMethod(
  5615. $core.method({
  5616. selector: "escaped",
  5617. protocol: "converting",
  5618. //>>excludeStart("ide", pragmas.excludeIdeData);
  5619. args: [],
  5620. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  5621. referencedClasses: [],
  5622. //>>excludeEnd("ide");
  5623. pragmas: [["inlineJS:", ["return escape(self)"]]],
  5624. messageSends: []
  5625. }, function ($methodClass){ return function (){
  5626. var self=this,$self=this;
  5627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5628. return $core.withContext(function($ctx1) {
  5629. //>>excludeEnd("ctx");
  5630. return escape(self);
  5631. return self;
  5632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5633. }, function($ctx1) {$ctx1.fill(self,"escaped",{})});
  5634. //>>excludeEnd("ctx");
  5635. }; }),
  5636. $globals.String);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "includesSubString:",
  5640. protocol: "testing",
  5641. //>>excludeStart("ide", pragmas.excludeIdeData);
  5642. args: ["subString"],
  5643. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  5644. referencedClasses: [],
  5645. //>>excludeEnd("ide");
  5646. pragmas: [["inlineJS:", ["return self.indexOf(subString) != -1"]]],
  5647. messageSends: []
  5648. }, function ($methodClass){ return function (subString){
  5649. var self=this,$self=this;
  5650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5651. return $core.withContext(function($ctx1) {
  5652. //>>excludeEnd("ctx");
  5653. return self.indexOf(subString) != -1;
  5654. return self;
  5655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5656. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString})});
  5657. //>>excludeEnd("ctx");
  5658. }; }),
  5659. $globals.String);
  5660. $core.addMethod(
  5661. $core.method({
  5662. selector: "isCapitalized",
  5663. protocol: "testing",
  5664. //>>excludeStart("ide", pragmas.excludeIdeData);
  5665. args: [],
  5666. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  5667. referencedClasses: [],
  5668. //>>excludeEnd("ide");
  5669. pragmas: [],
  5670. messageSends: ["==", "asUppercase", "first"]
  5671. }, function ($methodClass){ return function (){
  5672. var self=this,$self=this;
  5673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5674. return $core.withContext(function($ctx1) {
  5675. //>>excludeEnd("ctx");
  5676. return $recv($recv([$self._first()
  5677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5678. ,$ctx1.sendIdx["first"]=1
  5679. //>>excludeEnd("ctx");
  5680. ][0])._asUppercase()).__eq_eq($self._first());
  5681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5682. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{})});
  5683. //>>excludeEnd("ctx");
  5684. }; }),
  5685. $globals.String);
  5686. $core.addMethod(
  5687. $core.method({
  5688. selector: "isImmutable",
  5689. protocol: "testing",
  5690. //>>excludeStart("ide", pragmas.excludeIdeData);
  5691. args: [],
  5692. source: "isImmutable\x0a\x09^ true",
  5693. referencedClasses: [],
  5694. //>>excludeEnd("ide");
  5695. pragmas: [],
  5696. messageSends: []
  5697. }, function ($methodClass){ return function (){
  5698. var self=this,$self=this;
  5699. return true;
  5700. }; }),
  5701. $globals.String);
  5702. $core.addMethod(
  5703. $core.method({
  5704. selector: "isSelector",
  5705. protocol: "testing",
  5706. //>>excludeStart("ide", pragmas.excludeIdeData);
  5707. args: [],
  5708. 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>",
  5709. referencedClasses: [],
  5710. //>>excludeEnd("ide");
  5711. pragmas: [["inlineJS:", ["return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\x5c\x5c+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\x5c:)+)$/)"]]],
  5712. messageSends: []
  5713. }, function ($methodClass){ return function (){
  5714. var self=this,$self=this;
  5715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5716. return $core.withContext(function($ctx1) {
  5717. //>>excludeEnd("ctx");
  5718. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  5719. return self;
  5720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5721. }, function($ctx1) {$ctx1.fill(self,"isSelector",{})});
  5722. //>>excludeEnd("ctx");
  5723. }; }),
  5724. $globals.String);
  5725. $core.addMethod(
  5726. $core.method({
  5727. selector: "isString",
  5728. protocol: "testing",
  5729. //>>excludeStart("ide", pragmas.excludeIdeData);
  5730. args: [],
  5731. source: "isString\x0a\x09^ true",
  5732. referencedClasses: [],
  5733. //>>excludeEnd("ide");
  5734. pragmas: [],
  5735. messageSends: []
  5736. }, function ($methodClass){ return function (){
  5737. var self=this,$self=this;
  5738. return true;
  5739. }; }),
  5740. $globals.String);
  5741. $core.addMethod(
  5742. $core.method({
  5743. selector: "isVowel",
  5744. protocol: "testing",
  5745. //>>excludeStart("ide", pragmas.excludeIdeData);
  5746. args: [],
  5747. 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 ]",
  5748. referencedClasses: [],
  5749. //>>excludeEnd("ide");
  5750. pragmas: [],
  5751. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  5752. }, function ($methodClass){ return function (){
  5753. var self=this,$self=this;
  5754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5755. return $core.withContext(function($ctx1) {
  5756. //>>excludeEnd("ctx");
  5757. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  5758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5759. return $core.withContext(function($ctx2) {
  5760. //>>excludeEnd("ctx");
  5761. return "aeiou"._includes_($self._asLowercase());
  5762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5764. //>>excludeEnd("ctx");
  5765. }));
  5766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5767. }, function($ctx1) {$ctx1.fill(self,"isVowel",{})});
  5768. //>>excludeEnd("ctx");
  5769. }; }),
  5770. $globals.String);
  5771. $core.addMethod(
  5772. $core.method({
  5773. selector: "join:",
  5774. protocol: "split join",
  5775. //>>excludeStart("ide", pragmas.excludeIdeData);
  5776. args: ["aCollection"],
  5777. 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 ]]",
  5778. referencedClasses: ["String"],
  5779. //>>excludeEnd("ide");
  5780. pragmas: [],
  5781. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  5782. }, function ($methodClass){ return function (aCollection){
  5783. var self=this,$self=this;
  5784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5785. return $core.withContext(function($ctx1) {
  5786. //>>excludeEnd("ctx");
  5787. return $recv($globals.String)._streamContents_((function(stream){
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. return $core.withContext(function($ctx2) {
  5790. //>>excludeEnd("ctx");
  5791. return $recv(aCollection)._do_separatedBy_((function(each){
  5792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5793. return $core.withContext(function($ctx3) {
  5794. //>>excludeEnd("ctx");
  5795. return [$recv(stream)._nextPutAll_($recv(each)._asString())
  5796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5797. ,$ctx3.sendIdx["nextPutAll:"]=1
  5798. //>>excludeEnd("ctx");
  5799. ][0];
  5800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5801. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  5802. //>>excludeEnd("ctx");
  5803. }),(function(){
  5804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5805. return $core.withContext(function($ctx3) {
  5806. //>>excludeEnd("ctx");
  5807. return $recv(stream)._nextPutAll_(self);
  5808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5809. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5810. //>>excludeEnd("ctx");
  5811. }));
  5812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5813. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  5814. //>>excludeEnd("ctx");
  5815. }));
  5816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5817. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection})});
  5818. //>>excludeEnd("ctx");
  5819. }; }),
  5820. $globals.String);
  5821. $core.addMethod(
  5822. $core.method({
  5823. selector: "lineIndicesDo:",
  5824. protocol: "split join",
  5825. //>>excludeStart("ide", pragmas.excludeIdeData);
  5826. args: ["aBlock"],
  5827. 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 ] ]]",
  5828. referencedClasses: ["String"],
  5829. //>>excludeEnd("ide");
  5830. pragmas: [],
  5831. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  5832. }, function ($methodClass){ return function (aBlock){
  5833. var self=this,$self=this;
  5834. var cr,lf,start,sz,nextLF,nextCR;
  5835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5836. return $core.withContext(function($ctx1) {
  5837. //>>excludeEnd("ctx");
  5838. var $early={};
  5839. try {
  5840. start=(1);
  5841. sz=$self._size();
  5842. cr=$recv($globals.String)._cr();
  5843. nextCR=[$self._indexOf_startingAt_(cr,(1))
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. ,$ctx1.sendIdx["indexOf:startingAt:"]=1
  5846. //>>excludeEnd("ctx");
  5847. ][0];
  5848. lf=$recv($globals.String)._lf();
  5849. nextLF=[$self._indexOf_startingAt_(lf,(1))
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. ,$ctx1.sendIdx["indexOf:startingAt:"]=2
  5852. //>>excludeEnd("ctx");
  5853. ][0];
  5854. $recv((function(){
  5855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5856. return $core.withContext(function($ctx2) {
  5857. //>>excludeEnd("ctx");
  5858. return $recv(start).__lt_eq(sz);
  5859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5860. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5861. //>>excludeEnd("ctx");
  5862. }))._whileTrue_((function(){
  5863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5864. return $core.withContext(function($ctx2) {
  5865. //>>excludeEnd("ctx");
  5866. if($core.assert([$recv([$recv(nextLF).__eq((0))
  5867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5868. ,$ctx2.sendIdx["="]=1
  5869. //>>excludeEnd("ctx");
  5870. ][0])._and_((function(){
  5871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5872. return $core.withContext(function($ctx3) {
  5873. //>>excludeEnd("ctx");
  5874. return [$recv(nextCR).__eq((0))
  5875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5876. ,$ctx3.sendIdx["="]=2
  5877. //>>excludeEnd("ctx");
  5878. ][0];
  5879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5880. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  5881. //>>excludeEnd("ctx");
  5882. }))
  5883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5884. ,$ctx2.sendIdx["and:"]=1
  5885. //>>excludeEnd("ctx");
  5886. ][0])){
  5887. [$recv(aBlock)._value_value_value_(start,sz,sz)
  5888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5889. ,$ctx2.sendIdx["value:value:value:"]=1
  5890. //>>excludeEnd("ctx");
  5891. ][0];
  5892. throw $early=[self];
  5893. }
  5894. if($core.assert($recv([$recv(nextCR).__eq((0))
  5895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5896. ,$ctx2.sendIdx["="]=3
  5897. //>>excludeEnd("ctx");
  5898. ][0])._or_((function(){
  5899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5900. return $core.withContext(function($ctx3) {
  5901. //>>excludeEnd("ctx");
  5902. return $recv([(0).__lt(nextLF)
  5903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5904. ,$ctx3.sendIdx["<"]=1
  5905. //>>excludeEnd("ctx");
  5906. ][0])._and_((function(){
  5907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5908. return $core.withContext(function($ctx4) {
  5909. //>>excludeEnd("ctx");
  5910. return $recv(nextLF).__lt(nextCR);
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  5913. //>>excludeEnd("ctx");
  5914. }));
  5915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5916. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  5917. //>>excludeEnd("ctx");
  5918. })))){
  5919. [$recv(aBlock)._value_value_value_(start,[$recv(nextLF).__minus((1))
  5920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5921. ,$ctx2.sendIdx["-"]=1
  5922. //>>excludeEnd("ctx");
  5923. ][0],nextLF)
  5924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5925. ,$ctx2.sendIdx["value:value:value:"]=2
  5926. //>>excludeEnd("ctx");
  5927. ][0];
  5928. start=[(1).__plus(nextLF)
  5929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5930. ,$ctx2.sendIdx["+"]=1
  5931. //>>excludeEnd("ctx");
  5932. ][0];
  5933. nextLF=[$self._indexOf_startingAt_(lf,start)
  5934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5935. ,$ctx2.sendIdx["indexOf:startingAt:"]=3
  5936. //>>excludeEnd("ctx");
  5937. ][0];
  5938. return nextLF;
  5939. } else {
  5940. if($core.assert($recv([(1).__plus(nextCR)
  5941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5942. ,$ctx2.sendIdx["+"]=2
  5943. //>>excludeEnd("ctx");
  5944. ][0]).__eq(nextLF))){
  5945. [$recv(aBlock)._value_value_value_(start,[$recv(nextCR).__minus((1))
  5946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5947. ,$ctx2.sendIdx["-"]=2
  5948. //>>excludeEnd("ctx");
  5949. ][0],nextLF)
  5950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5951. ,$ctx2.sendIdx["value:value:value:"]=3
  5952. //>>excludeEnd("ctx");
  5953. ][0];
  5954. start=[(1).__plus(nextLF)
  5955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5956. ,$ctx2.sendIdx["+"]=3
  5957. //>>excludeEnd("ctx");
  5958. ][0];
  5959. nextCR=[$self._indexOf_startingAt_(cr,start)
  5960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5961. ,$ctx2.sendIdx["indexOf:startingAt:"]=4
  5962. //>>excludeEnd("ctx");
  5963. ][0];
  5964. nextLF=[$self._indexOf_startingAt_(lf,start)
  5965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5966. ,$ctx2.sendIdx["indexOf:startingAt:"]=5
  5967. //>>excludeEnd("ctx");
  5968. ][0];
  5969. return nextLF;
  5970. } else {
  5971. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  5972. start=(1).__plus(nextCR);
  5973. nextCR=$self._indexOf_startingAt_(cr,start);
  5974. return nextCR;
  5975. }
  5976. }
  5977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5979. //>>excludeEnd("ctx");
  5980. }));
  5981. return self;
  5982. }
  5983. catch(e) {if(e===$early)return e[0]; throw e}
  5984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5985. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR})});
  5986. //>>excludeEnd("ctx");
  5987. }; }),
  5988. $globals.String);
  5989. $core.addMethod(
  5990. $core.method({
  5991. selector: "lineNumber:",
  5992. protocol: "split join",
  5993. //>>excludeStart("ide", pragmas.excludeIdeData);
  5994. args: ["anIndex"],
  5995. 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",
  5996. referencedClasses: [],
  5997. //>>excludeEnd("ide");
  5998. pragmas: [],
  5999. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6000. }, function ($methodClass){ return function (anIndex){
  6001. var self=this,$self=this;
  6002. var lineCount;
  6003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6004. return $core.withContext(function($ctx1) {
  6005. //>>excludeEnd("ctx");
  6006. var $early={};
  6007. try {
  6008. lineCount=(0);
  6009. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6011. return $core.withContext(function($ctx2) {
  6012. //>>excludeEnd("ctx");
  6013. lineCount=$recv(lineCount).__plus((1));
  6014. if($core.assert($recv(lineCount).__eq(anIndex))){
  6015. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  6016. }
  6017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6018. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6019. //>>excludeEnd("ctx");
  6020. }));
  6021. return nil;
  6022. }
  6023. catch(e) {if(e===$early)return e[0]; throw e}
  6024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6025. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount})});
  6026. //>>excludeEnd("ctx");
  6027. }; }),
  6028. $globals.String);
  6029. $core.addMethod(
  6030. $core.method({
  6031. selector: "lines",
  6032. protocol: "split join",
  6033. //>>excludeStart("ide", pragmas.excludeIdeData);
  6034. args: [],
  6035. 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'>",
  6036. referencedClasses: [],
  6037. //>>excludeEnd("ide");
  6038. pragmas: [["inlineJS:", ["\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;"]]],
  6039. messageSends: []
  6040. }, function ($methodClass){ return function (){
  6041. var self=this,$self=this;
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. return $core.withContext(function($ctx1) {
  6044. //>>excludeEnd("ctx");
  6045. var result = self.split(/\r\n|\r|\n/);
  6046. if (!result[result.length-1]) result.pop();
  6047. return result;;
  6048. return self;
  6049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6050. }, function($ctx1) {$ctx1.fill(self,"lines",{})});
  6051. //>>excludeEnd("ctx");
  6052. }; }),
  6053. $globals.String);
  6054. $core.addMethod(
  6055. $core.method({
  6056. selector: "linesDo:",
  6057. protocol: "split join",
  6058. //>>excludeStart("ide", pragmas.excludeIdeData);
  6059. args: ["aBlock"],
  6060. 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",
  6061. referencedClasses: [],
  6062. //>>excludeEnd("ide");
  6063. pragmas: [],
  6064. messageSends: ["do:", "lines"]
  6065. }, function ($methodClass){ return function (aBlock){
  6066. var self=this,$self=this;
  6067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6068. return $core.withContext(function($ctx1) {
  6069. //>>excludeEnd("ctx");
  6070. $recv($self._lines())._do_(aBlock);
  6071. return self;
  6072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6073. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock})});
  6074. //>>excludeEnd("ctx");
  6075. }; }),
  6076. $globals.String);
  6077. $core.addMethod(
  6078. $core.method({
  6079. selector: "match:",
  6080. protocol: "regular expressions",
  6081. //>>excludeStart("ide", pragmas.excludeIdeData);
  6082. args: ["aRegexp"],
  6083. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6084. referencedClasses: [],
  6085. //>>excludeEnd("ide");
  6086. pragmas: [["inlineJS:", ["return self.search(aRegexp) != -1"]]],
  6087. messageSends: []
  6088. }, function ($methodClass){ return function (aRegexp){
  6089. var self=this,$self=this;
  6090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6091. return $core.withContext(function($ctx1) {
  6092. //>>excludeEnd("ctx");
  6093. return self.search(aRegexp) != -1;
  6094. return self;
  6095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6096. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp})});
  6097. //>>excludeEnd("ctx");
  6098. }; }),
  6099. $globals.String);
  6100. $core.addMethod(
  6101. $core.method({
  6102. selector: "matchesOf:",
  6103. protocol: "regular expressions",
  6104. //>>excludeStart("ide", pragmas.excludeIdeData);
  6105. args: ["aRegularExpression"],
  6106. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6107. referencedClasses: [],
  6108. //>>excludeEnd("ide");
  6109. pragmas: [["inlineJS:", ["return self.match(aRegularExpression)"]]],
  6110. messageSends: []
  6111. }, function ($methodClass){ return function (aRegularExpression){
  6112. var self=this,$self=this;
  6113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6114. return $core.withContext(function($ctx1) {
  6115. //>>excludeEnd("ctx");
  6116. return self.match(aRegularExpression);
  6117. return self;
  6118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6119. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression})});
  6120. //>>excludeEnd("ctx");
  6121. }; }),
  6122. $globals.String);
  6123. $core.addMethod(
  6124. $core.method({
  6125. selector: "printNl",
  6126. protocol: "printing",
  6127. //>>excludeStart("ide", pragmas.excludeIdeData);
  6128. args: [],
  6129. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6130. referencedClasses: [],
  6131. //>>excludeEnd("ide");
  6132. pragmas: [["inlineJS:", ["console.log(self)"]]],
  6133. messageSends: []
  6134. }, function ($methodClass){ return function (){
  6135. var self=this,$self=this;
  6136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6137. return $core.withContext(function($ctx1) {
  6138. //>>excludeEnd("ctx");
  6139. console.log(self);
  6140. return self;
  6141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6142. }, function($ctx1) {$ctx1.fill(self,"printNl",{})});
  6143. //>>excludeEnd("ctx");
  6144. }; }),
  6145. $globals.String);
  6146. $core.addMethod(
  6147. $core.method({
  6148. selector: "printOn:",
  6149. protocol: "printing",
  6150. //>>excludeStart("ide", pragmas.excludeIdeData);
  6151. args: ["aStream"],
  6152. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6153. referencedClasses: [],
  6154. //>>excludeEnd("ide");
  6155. pragmas: [],
  6156. messageSends: ["nextPutAll:", "replace:with:"]
  6157. }, function ($methodClass){ return function (aStream){
  6158. var self=this,$self=this;
  6159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6160. return $core.withContext(function($ctx1) {
  6161. //>>excludeEnd("ctx");
  6162. [$recv(aStream)._nextPutAll_("'")
  6163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6164. ,$ctx1.sendIdx["nextPutAll:"]=1
  6165. //>>excludeEnd("ctx");
  6166. ][0];
  6167. [$recv(aStream)._nextPutAll_($self._replace_with_("'","''"))
  6168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6169. ,$ctx1.sendIdx["nextPutAll:"]=2
  6170. //>>excludeEnd("ctx");
  6171. ][0];
  6172. $recv(aStream)._nextPutAll_("'");
  6173. return self;
  6174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6175. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  6176. //>>excludeEnd("ctx");
  6177. }; }),
  6178. $globals.String);
  6179. $core.addMethod(
  6180. $core.method({
  6181. selector: "putOn:",
  6182. protocol: "streaming",
  6183. //>>excludeStart("ide", pragmas.excludeIdeData);
  6184. args: ["aStream"],
  6185. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  6186. referencedClasses: [],
  6187. //>>excludeEnd("ide");
  6188. pragmas: [],
  6189. messageSends: ["nextPutString:"]
  6190. }, function ($methodClass){ return function (aStream){
  6191. var self=this,$self=this;
  6192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6193. return $core.withContext(function($ctx1) {
  6194. //>>excludeEnd("ctx");
  6195. $recv(aStream)._nextPutString_(self);
  6196. return self;
  6197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6198. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream})});
  6199. //>>excludeEnd("ctx");
  6200. }; }),
  6201. $globals.String);
  6202. $core.addMethod(
  6203. $core.method({
  6204. selector: "remove:",
  6205. protocol: "adding/removing",
  6206. //>>excludeStart("ide", pragmas.excludeIdeData);
  6207. args: ["anObject"],
  6208. source: "remove: anObject\x0a\x09self errorReadOnly",
  6209. referencedClasses: [],
  6210. //>>excludeEnd("ide");
  6211. pragmas: [],
  6212. messageSends: ["errorReadOnly"]
  6213. }, function ($methodClass){ return function (anObject){
  6214. var self=this,$self=this;
  6215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6216. return $core.withContext(function($ctx1) {
  6217. //>>excludeEnd("ctx");
  6218. $self._errorReadOnly();
  6219. return self;
  6220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6221. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject})});
  6222. //>>excludeEnd("ctx");
  6223. }; }),
  6224. $globals.String);
  6225. $core.addMethod(
  6226. $core.method({
  6227. selector: "remove:ifAbsent:",
  6228. protocol: "adding/removing",
  6229. //>>excludeStart("ide", pragmas.excludeIdeData);
  6230. args: ["anObject", "aBlock"],
  6231. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  6232. referencedClasses: [],
  6233. //>>excludeEnd("ide");
  6234. pragmas: [],
  6235. messageSends: ["errorReadOnly"]
  6236. }, function ($methodClass){ return function (anObject,aBlock){
  6237. var self=this,$self=this;
  6238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6239. return $core.withContext(function($ctx1) {
  6240. //>>excludeEnd("ctx");
  6241. $self._errorReadOnly();
  6242. return self;
  6243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6244. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  6245. //>>excludeEnd("ctx");
  6246. }; }),
  6247. $globals.String);
  6248. $core.addMethod(
  6249. $core.method({
  6250. selector: "replace:with:",
  6251. protocol: "regular expressions",
  6252. //>>excludeStart("ide", pragmas.excludeIdeData);
  6253. args: ["aString", "anotherString"],
  6254. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6255. referencedClasses: ["RegularExpression"],
  6256. //>>excludeEnd("ide");
  6257. pragmas: [],
  6258. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6259. }, function ($methodClass){ return function (aString,anotherString){
  6260. var self=this,$self=this;
  6261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6262. return $core.withContext(function($ctx1) {
  6263. //>>excludeEnd("ctx");
  6264. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6266. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString})});
  6267. //>>excludeEnd("ctx");
  6268. }; }),
  6269. $globals.String);
  6270. $core.addMethod(
  6271. $core.method({
  6272. selector: "replaceRegexp:with:",
  6273. protocol: "regular expressions",
  6274. //>>excludeStart("ide", pragmas.excludeIdeData);
  6275. args: ["aRegexp", "aString"],
  6276. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6277. referencedClasses: [],
  6278. //>>excludeEnd("ide");
  6279. pragmas: [["inlineJS:", ["return self.replace(aRegexp, aString)"]]],
  6280. messageSends: []
  6281. }, function ($methodClass){ return function (aRegexp,aString){
  6282. var self=this,$self=this;
  6283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6284. return $core.withContext(function($ctx1) {
  6285. //>>excludeEnd("ctx");
  6286. return self.replace(aRegexp, aString);
  6287. return self;
  6288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6289. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString})});
  6290. //>>excludeEnd("ctx");
  6291. }; }),
  6292. $globals.String);
  6293. $core.addMethod(
  6294. $core.method({
  6295. selector: "reversed",
  6296. protocol: "converting",
  6297. //>>excludeStart("ide", pragmas.excludeIdeData);
  6298. args: [],
  6299. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6300. referencedClasses: [],
  6301. //>>excludeEnd("ide");
  6302. pragmas: [["inlineJS:", ["return self.split(\x22\x22).reverse().join(\x22\x22)"]]],
  6303. messageSends: []
  6304. }, function ($methodClass){ return function (){
  6305. var self=this,$self=this;
  6306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6307. return $core.withContext(function($ctx1) {
  6308. //>>excludeEnd("ctx");
  6309. return self.split("").reverse().join("");
  6310. return self;
  6311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6312. }, function($ctx1) {$ctx1.fill(self,"reversed",{})});
  6313. //>>excludeEnd("ctx");
  6314. }; }),
  6315. $globals.String);
  6316. $core.addMethod(
  6317. $core.method({
  6318. selector: "shallowCopy",
  6319. protocol: "copying",
  6320. //>>excludeStart("ide", pragmas.excludeIdeData);
  6321. args: [],
  6322. source: "shallowCopy\x0a\x09^ self",
  6323. referencedClasses: [],
  6324. //>>excludeEnd("ide");
  6325. pragmas: [],
  6326. messageSends: []
  6327. }, function ($methodClass){ return function (){
  6328. var self=this,$self=this;
  6329. return self;
  6330. }; }),
  6331. $globals.String);
  6332. $core.addMethod(
  6333. $core.method({
  6334. selector: "subStrings:",
  6335. protocol: "split join",
  6336. //>>excludeStart("ide", pragmas.excludeIdeData);
  6337. args: ["aString"],
  6338. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6339. referencedClasses: [],
  6340. //>>excludeEnd("ide");
  6341. pragmas: [],
  6342. messageSends: ["tokenize:"]
  6343. }, function ($methodClass){ return function (aString){
  6344. var self=this,$self=this;
  6345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6346. return $core.withContext(function($ctx1) {
  6347. //>>excludeEnd("ctx");
  6348. return $self._tokenize_(aString);
  6349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6350. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString})});
  6351. //>>excludeEnd("ctx");
  6352. }; }),
  6353. $globals.String);
  6354. $core.addMethod(
  6355. $core.method({
  6356. selector: "symbolPrintString",
  6357. protocol: "printing",
  6358. //>>excludeStart("ide", pragmas.excludeIdeData);
  6359. args: [],
  6360. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  6361. referencedClasses: ["String"],
  6362. //>>excludeEnd("ide");
  6363. pragmas: [],
  6364. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  6365. }, function ($methodClass){ return function (){
  6366. var self=this,$self=this;
  6367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6368. return $core.withContext(function($ctx1) {
  6369. //>>excludeEnd("ctx");
  6370. return $recv($globals.String)._streamContents_((function(str){
  6371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6372. return $core.withContext(function($ctx2) {
  6373. //>>excludeEnd("ctx");
  6374. return $self._asSymbolPrintOn_(str);
  6375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6376. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  6377. //>>excludeEnd("ctx");
  6378. }));
  6379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6380. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{})});
  6381. //>>excludeEnd("ctx");
  6382. }; }),
  6383. $globals.String);
  6384. $core.addMethod(
  6385. $core.method({
  6386. selector: "tokenize:",
  6387. protocol: "split join",
  6388. //>>excludeStart("ide", pragmas.excludeIdeData);
  6389. args: ["aString"],
  6390. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6391. referencedClasses: [],
  6392. //>>excludeEnd("ide");
  6393. pragmas: [["inlineJS:", ["return self.split(aString)"]]],
  6394. messageSends: []
  6395. }, function ($methodClass){ return function (aString){
  6396. var self=this,$self=this;
  6397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6398. return $core.withContext(function($ctx1) {
  6399. //>>excludeEnd("ctx");
  6400. return self.split(aString);
  6401. return self;
  6402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6403. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString})});
  6404. //>>excludeEnd("ctx");
  6405. }; }),
  6406. $globals.String);
  6407. $core.addMethod(
  6408. $core.method({
  6409. selector: "trimBoth",
  6410. protocol: "regular expressions",
  6411. //>>excludeStart("ide", pragmas.excludeIdeData);
  6412. args: [],
  6413. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6414. referencedClasses: [],
  6415. //>>excludeEnd("ide");
  6416. pragmas: [],
  6417. messageSends: ["trimBoth:"]
  6418. }, function ($methodClass){ return function (){
  6419. var self=this,$self=this;
  6420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6421. return $core.withContext(function($ctx1) {
  6422. //>>excludeEnd("ctx");
  6423. return $self._trimBoth_("\x5cs");
  6424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6425. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{})});
  6426. //>>excludeEnd("ctx");
  6427. }; }),
  6428. $globals.String);
  6429. $core.addMethod(
  6430. $core.method({
  6431. selector: "trimBoth:",
  6432. protocol: "regular expressions",
  6433. //>>excludeStart("ide", pragmas.excludeIdeData);
  6434. args: ["separators"],
  6435. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6436. referencedClasses: [],
  6437. //>>excludeEnd("ide");
  6438. pragmas: [],
  6439. messageSends: ["trimRight:", "trimLeft:"]
  6440. }, function ($methodClass){ return function (separators){
  6441. var self=this,$self=this;
  6442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6443. return $core.withContext(function($ctx1) {
  6444. //>>excludeEnd("ctx");
  6445. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  6446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6447. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators})});
  6448. //>>excludeEnd("ctx");
  6449. }; }),
  6450. $globals.String);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "trimLeft",
  6454. protocol: "regular expressions",
  6455. //>>excludeStart("ide", pragmas.excludeIdeData);
  6456. args: [],
  6457. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6458. referencedClasses: [],
  6459. //>>excludeEnd("ide");
  6460. pragmas: [],
  6461. messageSends: ["trimLeft:"]
  6462. }, function ($methodClass){ return function (){
  6463. var self=this,$self=this;
  6464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6465. return $core.withContext(function($ctx1) {
  6466. //>>excludeEnd("ctx");
  6467. return $self._trimLeft_("\x5cs");
  6468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6469. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{})});
  6470. //>>excludeEnd("ctx");
  6471. }; }),
  6472. $globals.String);
  6473. $core.addMethod(
  6474. $core.method({
  6475. selector: "trimLeft:",
  6476. protocol: "regular expressions",
  6477. //>>excludeStart("ide", pragmas.excludeIdeData);
  6478. args: ["separators"],
  6479. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6480. referencedClasses: ["RegularExpression"],
  6481. //>>excludeEnd("ide");
  6482. pragmas: [],
  6483. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6484. }, function ($methodClass){ return function (separators){
  6485. var self=this,$self=this;
  6486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6487. return $core.withContext(function($ctx1) {
  6488. //>>excludeEnd("ctx");
  6489. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("^[".__comma(separators)).__comma("]+")
  6490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6491. ,$ctx1.sendIdx[","]=1
  6492. //>>excludeEnd("ctx");
  6493. ][0],"g"),"");
  6494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6495. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators})});
  6496. //>>excludeEnd("ctx");
  6497. }; }),
  6498. $globals.String);
  6499. $core.addMethod(
  6500. $core.method({
  6501. selector: "trimRight",
  6502. protocol: "regular expressions",
  6503. //>>excludeStart("ide", pragmas.excludeIdeData);
  6504. args: [],
  6505. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6506. referencedClasses: [],
  6507. //>>excludeEnd("ide");
  6508. pragmas: [],
  6509. messageSends: ["trimRight:"]
  6510. }, function ($methodClass){ return function (){
  6511. var self=this,$self=this;
  6512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6513. return $core.withContext(function($ctx1) {
  6514. //>>excludeEnd("ctx");
  6515. return $self._trimRight_("\x5cs");
  6516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6517. }, function($ctx1) {$ctx1.fill(self,"trimRight",{})});
  6518. //>>excludeEnd("ctx");
  6519. }; }),
  6520. $globals.String);
  6521. $core.addMethod(
  6522. $core.method({
  6523. selector: "trimRight:",
  6524. protocol: "regular expressions",
  6525. //>>excludeStart("ide", pragmas.excludeIdeData);
  6526. args: ["separators"],
  6527. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6528. referencedClasses: ["RegularExpression"],
  6529. //>>excludeEnd("ide");
  6530. pragmas: [],
  6531. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6532. }, function ($methodClass){ return function (separators){
  6533. var self=this,$self=this;
  6534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6535. return $core.withContext(function($ctx1) {
  6536. //>>excludeEnd("ctx");
  6537. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_([$recv("[".__comma(separators)).__comma("]+$")
  6538. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6539. ,$ctx1.sendIdx[","]=1
  6540. //>>excludeEnd("ctx");
  6541. ][0],"g"),"");
  6542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6543. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators})});
  6544. //>>excludeEnd("ctx");
  6545. }; }),
  6546. $globals.String);
  6547. $core.addMethod(
  6548. $core.method({
  6549. selector: "unescaped",
  6550. protocol: "converting",
  6551. //>>excludeStart("ide", pragmas.excludeIdeData);
  6552. args: [],
  6553. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  6554. referencedClasses: [],
  6555. //>>excludeEnd("ide");
  6556. pragmas: [["inlineJS:", ["return unescape(self)"]]],
  6557. messageSends: []
  6558. }, function ($methodClass){ return function (){
  6559. var self=this,$self=this;
  6560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6561. return $core.withContext(function($ctx1) {
  6562. //>>excludeEnd("ctx");
  6563. return unescape(self);
  6564. return self;
  6565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6566. }, function($ctx1) {$ctx1.fill(self,"unescaped",{})});
  6567. //>>excludeEnd("ctx");
  6568. }; }),
  6569. $globals.String);
  6570. $core.addMethod(
  6571. $core.method({
  6572. selector: "uriComponentDecoded",
  6573. protocol: "converting",
  6574. //>>excludeStart("ide", pragmas.excludeIdeData);
  6575. args: [],
  6576. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  6577. referencedClasses: [],
  6578. //>>excludeEnd("ide");
  6579. pragmas: [["inlineJS:", ["return decodeURIComponent(self)"]]],
  6580. messageSends: []
  6581. }, function ($methodClass){ return function (){
  6582. var self=this,$self=this;
  6583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6584. return $core.withContext(function($ctx1) {
  6585. //>>excludeEnd("ctx");
  6586. return decodeURIComponent(self);
  6587. return self;
  6588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6589. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{})});
  6590. //>>excludeEnd("ctx");
  6591. }; }),
  6592. $globals.String);
  6593. $core.addMethod(
  6594. $core.method({
  6595. selector: "uriComponentEncoded",
  6596. protocol: "converting",
  6597. //>>excludeStart("ide", pragmas.excludeIdeData);
  6598. args: [],
  6599. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  6600. referencedClasses: [],
  6601. //>>excludeEnd("ide");
  6602. pragmas: [["inlineJS:", ["return encodeURIComponent(self)"]]],
  6603. messageSends: []
  6604. }, function ($methodClass){ return function (){
  6605. var self=this,$self=this;
  6606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6607. return $core.withContext(function($ctx1) {
  6608. //>>excludeEnd("ctx");
  6609. return encodeURIComponent(self);
  6610. return self;
  6611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6612. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{})});
  6613. //>>excludeEnd("ctx");
  6614. }; }),
  6615. $globals.String);
  6616. $core.addMethod(
  6617. $core.method({
  6618. selector: "uriDecoded",
  6619. protocol: "converting",
  6620. //>>excludeStart("ide", pragmas.excludeIdeData);
  6621. args: [],
  6622. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  6623. referencedClasses: [],
  6624. //>>excludeEnd("ide");
  6625. pragmas: [["inlineJS:", ["return decodeURI(self)"]]],
  6626. messageSends: []
  6627. }, function ($methodClass){ return function (){
  6628. var self=this,$self=this;
  6629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6630. return $core.withContext(function($ctx1) {
  6631. //>>excludeEnd("ctx");
  6632. return decodeURI(self);
  6633. return self;
  6634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6635. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{})});
  6636. //>>excludeEnd("ctx");
  6637. }; }),
  6638. $globals.String);
  6639. $core.addMethod(
  6640. $core.method({
  6641. selector: "uriEncoded",
  6642. protocol: "converting",
  6643. //>>excludeStart("ide", pragmas.excludeIdeData);
  6644. args: [],
  6645. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  6646. referencedClasses: [],
  6647. //>>excludeEnd("ide");
  6648. pragmas: [["inlineJS:", ["return encodeURI(self)"]]],
  6649. messageSends: []
  6650. }, function ($methodClass){ return function (){
  6651. var self=this,$self=this;
  6652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6653. return $core.withContext(function($ctx1) {
  6654. //>>excludeEnd("ctx");
  6655. return encodeURI(self);
  6656. return self;
  6657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6658. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{})});
  6659. //>>excludeEnd("ctx");
  6660. }; }),
  6661. $globals.String);
  6662. $core.addMethod(
  6663. $core.method({
  6664. selector: "value:",
  6665. protocol: "evaluating",
  6666. //>>excludeStart("ide", pragmas.excludeIdeData);
  6667. args: ["anObject"],
  6668. source: "value: anObject \x0a\x09^ anObject perform: self",
  6669. referencedClasses: [],
  6670. //>>excludeEnd("ide");
  6671. pragmas: [],
  6672. messageSends: ["perform:"]
  6673. }, function ($methodClass){ return function (anObject){
  6674. var self=this,$self=this;
  6675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6676. return $core.withContext(function($ctx1) {
  6677. //>>excludeEnd("ctx");
  6678. return $recv(anObject)._perform_(self);
  6679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6680. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject})});
  6681. //>>excludeEnd("ctx");
  6682. }; }),
  6683. $globals.String);
  6684. $core.addMethod(
  6685. $core.method({
  6686. selector: "cr",
  6687. protocol: "accessing",
  6688. //>>excludeStart("ide", pragmas.excludeIdeData);
  6689. args: [],
  6690. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  6691. referencedClasses: [],
  6692. //>>excludeEnd("ide");
  6693. pragmas: [["inlineJS:", ["return \x22\x5cr\x22"]]],
  6694. messageSends: []
  6695. }, function ($methodClass){ return function (){
  6696. var self=this,$self=this;
  6697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6698. return $core.withContext(function($ctx1) {
  6699. //>>excludeEnd("ctx");
  6700. return "\r";
  6701. return self;
  6702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6703. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  6704. //>>excludeEnd("ctx");
  6705. }; }),
  6706. $globals.String.a$cls);
  6707. $core.addMethod(
  6708. $core.method({
  6709. selector: "crlf",
  6710. protocol: "accessing",
  6711. //>>excludeStart("ide", pragmas.excludeIdeData);
  6712. args: [],
  6713. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  6714. referencedClasses: [],
  6715. //>>excludeEnd("ide");
  6716. pragmas: [["inlineJS:", ["return \x22\x5cr\x5cn\x22"]]],
  6717. messageSends: []
  6718. }, function ($methodClass){ return function (){
  6719. var self=this,$self=this;
  6720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6721. return $core.withContext(function($ctx1) {
  6722. //>>excludeEnd("ctx");
  6723. return "\r\n";
  6724. return self;
  6725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6726. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  6727. //>>excludeEnd("ctx");
  6728. }; }),
  6729. $globals.String.a$cls);
  6730. $core.addMethod(
  6731. $core.method({
  6732. selector: "esc",
  6733. protocol: "accessing",
  6734. //>>excludeStart("ide", pragmas.excludeIdeData);
  6735. args: [],
  6736. source: "esc\x0a\x09^ self fromCharCode: 27",
  6737. referencedClasses: [],
  6738. //>>excludeEnd("ide");
  6739. pragmas: [],
  6740. messageSends: ["fromCharCode:"]
  6741. }, function ($methodClass){ return function (){
  6742. var self=this,$self=this;
  6743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6744. return $core.withContext(function($ctx1) {
  6745. //>>excludeEnd("ctx");
  6746. return $self._fromCharCode_((27));
  6747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6748. }, function($ctx1) {$ctx1.fill(self,"esc",{})});
  6749. //>>excludeEnd("ctx");
  6750. }; }),
  6751. $globals.String.a$cls);
  6752. $core.addMethod(
  6753. $core.method({
  6754. selector: "fromCharCode:",
  6755. protocol: "instance creation",
  6756. //>>excludeStart("ide", pragmas.excludeIdeData);
  6757. args: ["anInteger"],
  6758. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  6759. referencedClasses: [],
  6760. //>>excludeEnd("ide");
  6761. pragmas: [["inlineJS:", ["return String.fromCharCode(anInteger)"]]],
  6762. messageSends: []
  6763. }, function ($methodClass){ return function (anInteger){
  6764. var self=this,$self=this;
  6765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6766. return $core.withContext(function($ctx1) {
  6767. //>>excludeEnd("ctx");
  6768. return String.fromCharCode(anInteger);
  6769. return self;
  6770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6771. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger})});
  6772. //>>excludeEnd("ctx");
  6773. }; }),
  6774. $globals.String.a$cls);
  6775. $core.addMethod(
  6776. $core.method({
  6777. selector: "fromString:",
  6778. protocol: "instance creation",
  6779. //>>excludeStart("ide", pragmas.excludeIdeData);
  6780. args: ["aString"],
  6781. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  6782. referencedClasses: [],
  6783. //>>excludeEnd("ide");
  6784. pragmas: [["inlineJS:", ["return String(aString)"]]],
  6785. messageSends: []
  6786. }, function ($methodClass){ return function (aString){
  6787. var self=this,$self=this;
  6788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6789. return $core.withContext(function($ctx1) {
  6790. //>>excludeEnd("ctx");
  6791. return String(aString);
  6792. return self;
  6793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6794. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  6795. //>>excludeEnd("ctx");
  6796. }; }),
  6797. $globals.String.a$cls);
  6798. $core.addMethod(
  6799. $core.method({
  6800. selector: "lf",
  6801. protocol: "accessing",
  6802. //>>excludeStart("ide", pragmas.excludeIdeData);
  6803. args: [],
  6804. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  6805. referencedClasses: [],
  6806. //>>excludeEnd("ide");
  6807. pragmas: [["inlineJS:", ["return \x22\x5cn\x22"]]],
  6808. messageSends: []
  6809. }, function ($methodClass){ return function (){
  6810. var self=this,$self=this;
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. return $core.withContext(function($ctx1) {
  6813. //>>excludeEnd("ctx");
  6814. return "\n";
  6815. return self;
  6816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6817. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  6818. //>>excludeEnd("ctx");
  6819. }; }),
  6820. $globals.String.a$cls);
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "random",
  6824. protocol: "random",
  6825. //>>excludeStart("ide", pragmas.excludeIdeData);
  6826. args: [],
  6827. 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);'>",
  6828. referencedClasses: [],
  6829. //>>excludeEnd("ide");
  6830. pragmas: [["inlineJS:", ["return ((10+22*Math.random())/32).toString(32).slice(2);"]]],
  6831. messageSends: []
  6832. }, function ($methodClass){ return function (){
  6833. var self=this,$self=this;
  6834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6835. return $core.withContext(function($ctx1) {
  6836. //>>excludeEnd("ctx");
  6837. return ((10+22*Math.random())/32).toString(32).slice(2);;
  6838. return self;
  6839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6840. }, function($ctx1) {$ctx1.fill(self,"random",{})});
  6841. //>>excludeEnd("ctx");
  6842. }; }),
  6843. $globals.String.a$cls);
  6844. $core.addMethod(
  6845. $core.method({
  6846. selector: "randomNotIn:",
  6847. protocol: "random",
  6848. //>>excludeStart("ide", pragmas.excludeIdeData);
  6849. args: ["aString"],
  6850. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  6851. referencedClasses: [],
  6852. //>>excludeEnd("ide");
  6853. pragmas: [],
  6854. messageSends: ["whileTrue", "random", "includesSubString:"]
  6855. }, function ($methodClass){ return function (aString){
  6856. var self=this,$self=this;
  6857. var result;
  6858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6859. return $core.withContext(function($ctx1) {
  6860. //>>excludeEnd("ctx");
  6861. $recv((function(){
  6862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6863. return $core.withContext(function($ctx2) {
  6864. //>>excludeEnd("ctx");
  6865. result=$self._random();
  6866. return $recv(aString)._includesSubString_(result);
  6867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6868. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6869. //>>excludeEnd("ctx");
  6870. }))._whileTrue();
  6871. return result;
  6872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6873. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result})});
  6874. //>>excludeEnd("ctx");
  6875. }; }),
  6876. $globals.String.a$cls);
  6877. $core.addMethod(
  6878. $core.method({
  6879. selector: "space",
  6880. protocol: "accessing",
  6881. //>>excludeStart("ide", pragmas.excludeIdeData);
  6882. args: [],
  6883. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  6884. referencedClasses: [],
  6885. //>>excludeEnd("ide");
  6886. pragmas: [["inlineJS:", ["return \x22 \x22"]]],
  6887. messageSends: []
  6888. }, function ($methodClass){ return function (){
  6889. var self=this,$self=this;
  6890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6891. return $core.withContext(function($ctx1) {
  6892. //>>excludeEnd("ctx");
  6893. return " ";
  6894. return self;
  6895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6896. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  6897. //>>excludeEnd("ctx");
  6898. }; }),
  6899. $globals.String.a$cls);
  6900. $core.addMethod(
  6901. $core.method({
  6902. selector: "streamClass",
  6903. protocol: "accessing",
  6904. //>>excludeStart("ide", pragmas.excludeIdeData);
  6905. args: [],
  6906. source: "streamClass\x0a\x09\x09^ StringStream",
  6907. referencedClasses: ["StringStream"],
  6908. //>>excludeEnd("ide");
  6909. pragmas: [],
  6910. messageSends: []
  6911. }, function ($methodClass){ return function (){
  6912. var self=this,$self=this;
  6913. return $globals.StringStream;
  6914. }; }),
  6915. $globals.String.a$cls);
  6916. $core.addMethod(
  6917. $core.method({
  6918. selector: "tab",
  6919. protocol: "accessing",
  6920. //>>excludeStart("ide", pragmas.excludeIdeData);
  6921. args: [],
  6922. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  6923. referencedClasses: [],
  6924. //>>excludeEnd("ide");
  6925. pragmas: [["inlineJS:", ["return \x22\x5ct\x22"]]],
  6926. messageSends: []
  6927. }, function ($methodClass){ return function (){
  6928. var self=this,$self=this;
  6929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6930. return $core.withContext(function($ctx1) {
  6931. //>>excludeEnd("ctx");
  6932. return "\t";
  6933. return self;
  6934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6935. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  6936. //>>excludeEnd("ctx");
  6937. }; }),
  6938. $globals.String.a$cls);
  6939. $core.addMethod(
  6940. $core.method({
  6941. selector: "value:",
  6942. protocol: "instance creation",
  6943. //>>excludeStart("ide", pragmas.excludeIdeData);
  6944. args: ["aUTFCharCode"],
  6945. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  6946. referencedClasses: [],
  6947. //>>excludeEnd("ide");
  6948. pragmas: [["inlineJS:", ["return String.fromCharCode(aUTFCharCode);"]]],
  6949. messageSends: []
  6950. }, function ($methodClass){ return function (aUTFCharCode){
  6951. var self=this,$self=this;
  6952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6953. return $core.withContext(function($ctx1) {
  6954. //>>excludeEnd("ctx");
  6955. return String.fromCharCode(aUTFCharCode);;
  6956. return self;
  6957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6958. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode})});
  6959. //>>excludeEnd("ctx");
  6960. }; }),
  6961. $globals.String.a$cls);
  6962. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  6963. //>>excludeStart("ide", pragmas.excludeIdeData);
  6964. $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`.";
  6965. //>>excludeEnd("ide");
  6966. $core.addMethod(
  6967. $core.method({
  6968. selector: "=",
  6969. protocol: "comparing",
  6970. //>>excludeStart("ide", pragmas.excludeIdeData);
  6971. args: ["aCollection"],
  6972. 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",
  6973. referencedClasses: [],
  6974. //>>excludeEnd("ide");
  6975. pragmas: [],
  6976. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  6977. }, function ($methodClass){ return function (aCollection){
  6978. var self=this,$self=this;
  6979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6980. return $core.withContext(function($ctx1) {
  6981. //>>excludeEnd("ctx");
  6982. var $early={};
  6983. try {
  6984. if(!$core.assert([$recv([$self._class()
  6985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6986. ,$ctx1.sendIdx["class"]=1
  6987. //>>excludeEnd("ctx");
  6988. ][0]).__eq($recv(aCollection)._class())
  6989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6990. ,$ctx1.sendIdx["="]=1
  6991. //>>excludeEnd("ctx");
  6992. ][0])){
  6993. return false;
  6994. }
  6995. if(!$core.assert($recv([$self._size()
  6996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6997. ,$ctx1.sendIdx["size"]=1
  6998. //>>excludeEnd("ctx");
  6999. ][0]).__eq($recv(aCollection)._size()))){
  7000. return false;
  7001. }
  7002. $self._do_((function(each){
  7003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7004. return $core.withContext(function($ctx2) {
  7005. //>>excludeEnd("ctx");
  7006. if(!$core.assert($recv(aCollection)._includes_(each))){
  7007. throw $early=[false];
  7008. }
  7009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7010. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7011. //>>excludeEnd("ctx");
  7012. }));
  7013. return true;
  7014. }
  7015. catch(e) {if(e===$early)return e[0]; throw e}
  7016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7017. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection})});
  7018. //>>excludeEnd("ctx");
  7019. }; }),
  7020. $globals.Set);
  7021. $core.addMethod(
  7022. $core.method({
  7023. selector: "add:",
  7024. protocol: "adding/removing",
  7025. //>>excludeStart("ide", pragmas.excludeIdeData);
  7026. args: ["anObject"],
  7027. 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 ]",
  7028. referencedClasses: [],
  7029. //>>excludeEnd("ide");
  7030. pragmas: [],
  7031. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7032. }, function ($methodClass){ return function (anObject){
  7033. var self=this,$self=this;
  7034. var bucket;
  7035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7036. return $core.withContext(function($ctx1) {
  7037. //>>excludeEnd("ctx");
  7038. var $1;
  7039. bucket=$self._bucketsOfElement_(anObject);
  7040. $1=$recv(bucket)._second();
  7041. if($1 == null || $1.a$nil){
  7042. var object,slowBucket;
  7043. object=[$recv(bucket)._first()
  7044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7045. ,$ctx1.sendIdx["first"]=1
  7046. //>>excludeEnd("ctx");
  7047. ][0];
  7048. slowBucket=$recv(bucket)._third();
  7049. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7051. return $core.withContext(function($ctx2) {
  7052. //>>excludeEnd("ctx");
  7053. $recv(slowBucket)._add_(object);
  7054. $self.size=$recv($self.size).__plus((1));
  7055. return $self.size;
  7056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7057. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7058. //>>excludeEnd("ctx");
  7059. }));
  7060. return object;
  7061. } else {
  7062. var primitiveBucket;
  7063. primitiveBucket=$1;
  7064. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  7065. }
  7066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7067. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket})});
  7068. //>>excludeEnd("ctx");
  7069. }; }),
  7070. $globals.Set);
  7071. $core.addMethod(
  7072. $core.method({
  7073. selector: "add:in:",
  7074. protocol: "private",
  7075. //>>excludeStart("ide", pragmas.excludeIdeData);
  7076. args: ["anObject", "anotherObject"],
  7077. 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'>",
  7078. referencedClasses: [],
  7079. //>>excludeEnd("ide");
  7080. 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"]]],
  7081. messageSends: []
  7082. }, function ($methodClass){ return function (anObject,anotherObject){
  7083. var self=this,$self=this;
  7084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7085. return $core.withContext(function($ctx1) {
  7086. //>>excludeEnd("ctx");
  7087. if (anObject in anotherObject.store) { return anObject; }
  7088. $self.size++;
  7089. anotherObject.store[anObject] = true;
  7090. return anObject;
  7091. ;
  7092. return self;
  7093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7094. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject})});
  7095. //>>excludeEnd("ctx");
  7096. }; }),
  7097. $globals.Set);
  7098. $core.addMethod(
  7099. $core.method({
  7100. selector: "bucketsOfElement:",
  7101. protocol: "private",
  7102. //>>excludeStart("ide", pragmas.excludeIdeData);
  7103. args: ["anObject"],
  7104. 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'>",
  7105. referencedClasses: [],
  7106. //>>excludeEnd("ide");
  7107. 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"]]],
  7108. messageSends: []
  7109. }, function ($methodClass){ return function (anObject){
  7110. var self=this,$self=this;
  7111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7112. return $core.withContext(function($ctx1) {
  7113. //>>excludeEnd("ctx");
  7114. // include nil to well-known objects under "boolean" fastBucket
  7115. if (anObject == null || anObject.a$nil) return [ null, $self.fastBuckets.boolean ];
  7116. var prim = anObject.valueOf();
  7117. if (typeof prim === "object" || typeof prim === "function" || !$self.fastBuckets[typeof prim]) {
  7118. var bucket = null;
  7119. $self.slowBucketStores.some(function (store) {
  7120. return bucket = store._bucketOfElement_(anObject);
  7121. });
  7122. return [ anObject, null, bucket || $self.defaultBucket ];
  7123. }
  7124. return [ prim, $self.fastBuckets[typeof prim] ];
  7125. ;
  7126. return self;
  7127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7128. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject})});
  7129. //>>excludeEnd("ctx");
  7130. }; }),
  7131. $globals.Set);
  7132. $core.addMethod(
  7133. $core.method({
  7134. selector: "classNameOf:",
  7135. protocol: "private",
  7136. //>>excludeStart("ide", pragmas.excludeIdeData);
  7137. args: ["anObject"],
  7138. 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'>",
  7139. referencedClasses: [],
  7140. //>>excludeEnd("ide");
  7141. pragmas: [["inlineJS:", ["return anObject.a$cls != null && anObject.a$cls.name"]]],
  7142. messageSends: []
  7143. }, function ($methodClass){ return function (anObject){
  7144. var self=this,$self=this;
  7145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7146. return $core.withContext(function($ctx1) {
  7147. //>>excludeEnd("ctx");
  7148. return anObject.a$cls != null && anObject.a$cls.name;
  7149. return self;
  7150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7151. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject})});
  7152. //>>excludeEnd("ctx");
  7153. }; }),
  7154. $globals.Set);
  7155. $core.addMethod(
  7156. $core.method({
  7157. selector: "collect:",
  7158. protocol: "enumerating",
  7159. //>>excludeStart("ide", pragmas.excludeIdeData);
  7160. args: ["aBlock"],
  7161. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7162. referencedClasses: [],
  7163. //>>excludeEnd("ide");
  7164. pragmas: [],
  7165. messageSends: ["new", "class", "do:", "add:", "value:"]
  7166. }, function ($methodClass){ return function (aBlock){
  7167. var self=this,$self=this;
  7168. var collection;
  7169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7170. return $core.withContext(function($ctx1) {
  7171. //>>excludeEnd("ctx");
  7172. collection=$recv($self._class())._new();
  7173. $self._do_((function(each){
  7174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7175. return $core.withContext(function($ctx2) {
  7176. //>>excludeEnd("ctx");
  7177. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7179. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7180. //>>excludeEnd("ctx");
  7181. }));
  7182. return collection;
  7183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7184. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection})});
  7185. //>>excludeEnd("ctx");
  7186. }; }),
  7187. $globals.Set);
  7188. $core.addMethod(
  7189. $core.method({
  7190. selector: "do:",
  7191. protocol: "enumerating",
  7192. //>>excludeStart("ide", pragmas.excludeIdeData);
  7193. args: ["aBlock"],
  7194. 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'>",
  7195. referencedClasses: [],
  7196. //>>excludeEnd("ide");
  7197. 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"]]],
  7198. messageSends: []
  7199. }, function ($methodClass){ return function (aBlock){
  7200. var self=this,$self=this;
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return $core.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. var el, keys, i;
  7205. el = $self.fastBuckets;
  7206. keys = Object.keys(el);
  7207. for (i = 0; i < keys.length; ++i) {
  7208. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7209. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7210. else { store._do_(aBlock); }
  7211. }
  7212. el = $self.slowBucketStores;
  7213. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7214. $self.defaultBucket._do_(aBlock);
  7215. ;
  7216. return self;
  7217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7218. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7219. //>>excludeEnd("ctx");
  7220. }; }),
  7221. $globals.Set);
  7222. $core.addMethod(
  7223. $core.method({
  7224. selector: "includes:",
  7225. protocol: "testing",
  7226. //>>excludeStart("ide", pragmas.excludeIdeData);
  7227. args: ["anObject"],
  7228. 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 ]",
  7229. referencedClasses: [],
  7230. //>>excludeEnd("ide");
  7231. pragmas: [],
  7232. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7233. }, function ($methodClass){ return function (anObject){
  7234. var self=this,$self=this;
  7235. var bucket;
  7236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7237. return $core.withContext(function($ctx1) {
  7238. //>>excludeEnd("ctx");
  7239. var $1;
  7240. bucket=$self._bucketsOfElement_(anObject);
  7241. $1=$recv(bucket)._second();
  7242. if($1 == null || $1.a$nil){
  7243. return $recv($recv(bucket)._third())._includes_([$recv(bucket)._first()
  7244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7245. ,$ctx1.sendIdx["first"]=1
  7246. //>>excludeEnd("ctx");
  7247. ][0]);
  7248. } else {
  7249. var primitiveBucket;
  7250. primitiveBucket=$1;
  7251. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7252. }
  7253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7254. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket})});
  7255. //>>excludeEnd("ctx");
  7256. }; }),
  7257. $globals.Set);
  7258. $core.addMethod(
  7259. $core.method({
  7260. selector: "includes:in:",
  7261. protocol: "private",
  7262. //>>excludeStart("ide", pragmas.excludeIdeData);
  7263. args: ["anObject", "anotherObject"],
  7264. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7265. referencedClasses: [],
  7266. //>>excludeEnd("ide");
  7267. pragmas: [["inlineJS:", ["return anObject in anotherObject.store"]]],
  7268. messageSends: []
  7269. }, function ($methodClass){ return function (anObject,anotherObject){
  7270. var self=this,$self=this;
  7271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7272. return $core.withContext(function($ctx1) {
  7273. //>>excludeEnd("ctx");
  7274. return anObject in anotherObject.store;
  7275. return self;
  7276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7277. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject})});
  7278. //>>excludeEnd("ctx");
  7279. }; }),
  7280. $globals.Set);
  7281. $core.addMethod(
  7282. $core.method({
  7283. selector: "initialize",
  7284. protocol: "initialization",
  7285. //>>excludeStart("ide", pragmas.excludeIdeData);
  7286. args: [],
  7287. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7288. referencedClasses: [],
  7289. //>>excludeEnd("ide");
  7290. pragmas: [],
  7291. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7292. }, function ($methodClass){ return function (){
  7293. var self=this,$self=this;
  7294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7295. return $core.withContext(function($ctx1) {
  7296. //>>excludeEnd("ctx");
  7297. [(
  7298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7299. $ctx1.supercall = true,
  7300. //>>excludeEnd("ctx");
  7301. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  7302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7303. ,$ctx1.supercall = false
  7304. //>>excludeEnd("ctx");
  7305. ][0];
  7306. $self.defaultBucket=[];
  7307. $self._initializeSlowBucketStores();
  7308. $self._removeAll();
  7309. return self;
  7310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7311. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  7312. //>>excludeEnd("ctx");
  7313. }; }),
  7314. $globals.Set);
  7315. $core.addMethod(
  7316. $core.method({
  7317. selector: "initializeSlowBucketStores",
  7318. protocol: "initialization",
  7319. //>>excludeStart("ide", pragmas.excludeIdeData);
  7320. args: [],
  7321. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7322. referencedClasses: ["ArrayBucketStore"],
  7323. //>>excludeEnd("ide");
  7324. pragmas: [],
  7325. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7326. }, function ($methodClass){ return function (){
  7327. var self=this,$self=this;
  7328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7329. return $core.withContext(function($ctx1) {
  7330. //>>excludeEnd("ctx");
  7331. $self.slowBucketStores=[[$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7333. return $core.withContext(function($ctx2) {
  7334. //>>excludeEnd("ctx");
  7335. return $self._classNameOf_(x);
  7336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7337. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7338. //>>excludeEnd("ctx");
  7339. }))
  7340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7341. ,$ctx1.sendIdx["hashBlock:"]=1
  7342. //>>excludeEnd("ctx");
  7343. ][0],$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7345. return $core.withContext(function($ctx2) {
  7346. //>>excludeEnd("ctx");
  7347. return $self._jsConstructorNameOf_(x);
  7348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7349. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7350. //>>excludeEnd("ctx");
  7351. }))];
  7352. return self;
  7353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7354. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{})});
  7355. //>>excludeEnd("ctx");
  7356. }; }),
  7357. $globals.Set);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "jsConstructorNameOf:",
  7361. protocol: "private",
  7362. //>>excludeStart("ide", pragmas.excludeIdeData);
  7363. args: ["anObject"],
  7364. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7365. referencedClasses: [],
  7366. //>>excludeEnd("ide");
  7367. pragmas: [["inlineJS:", ["return anObject.constructor && anObject.constructor.name"]]],
  7368. messageSends: []
  7369. }, function ($methodClass){ return function (anObject){
  7370. var self=this,$self=this;
  7371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7372. return $core.withContext(function($ctx1) {
  7373. //>>excludeEnd("ctx");
  7374. return anObject.constructor && anObject.constructor.name;
  7375. return self;
  7376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7377. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject})});
  7378. //>>excludeEnd("ctx");
  7379. }; }),
  7380. $globals.Set);
  7381. $core.addMethod(
  7382. $core.method({
  7383. selector: "printOn:",
  7384. protocol: "printing",
  7385. //>>excludeStart("ide", pragmas.excludeIdeData);
  7386. args: ["aStream"],
  7387. 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: ')'",
  7388. referencedClasses: [],
  7389. //>>excludeEnd("ide");
  7390. pragmas: [],
  7391. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7392. }, function ($methodClass){ return function (aStream){
  7393. var self=this,$self=this;
  7394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7395. return $core.withContext(function($ctx1) {
  7396. //>>excludeEnd("ctx");
  7397. [(
  7398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7399. $ctx1.supercall = true,
  7400. //>>excludeEnd("ctx");
  7401. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._printOn_.call($self,aStream))
  7402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7403. ,$ctx1.sendIdx["printOn:"]=1,$ctx1.supercall = false
  7404. //>>excludeEnd("ctx");
  7405. ][0];
  7406. [$recv(aStream)._nextPutAll_(" (")
  7407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7408. ,$ctx1.sendIdx["nextPutAll:"]=1
  7409. //>>excludeEnd("ctx");
  7410. ][0];
  7411. $self._do_separatedBy_((function(each){
  7412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7413. return $core.withContext(function($ctx2) {
  7414. //>>excludeEnd("ctx");
  7415. return $recv(each)._printOn_(aStream);
  7416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7417. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7418. //>>excludeEnd("ctx");
  7419. }),(function(){
  7420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7421. return $core.withContext(function($ctx2) {
  7422. //>>excludeEnd("ctx");
  7423. return [$recv(aStream)._nextPutAll_(" ")
  7424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7425. ,$ctx2.sendIdx["nextPutAll:"]=2
  7426. //>>excludeEnd("ctx");
  7427. ][0];
  7428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7430. //>>excludeEnd("ctx");
  7431. }));
  7432. $recv(aStream)._nextPutAll_(")");
  7433. return self;
  7434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7435. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream})});
  7436. //>>excludeEnd("ctx");
  7437. }; }),
  7438. $globals.Set);
  7439. $core.addMethod(
  7440. $core.method({
  7441. selector: "remove:ifAbsent:",
  7442. protocol: "adding/removing",
  7443. //>>excludeStart("ide", pragmas.excludeIdeData);
  7444. args: ["anObject", "aBlock"],
  7445. 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 ]",
  7446. referencedClasses: [],
  7447. //>>excludeEnd("ide");
  7448. pragmas: [],
  7449. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "remove:ifAbsent:", "third", "value", "-", "remove:in:ifAbsent:"]
  7450. }, function ($methodClass){ return function (anObject,aBlock){
  7451. var self=this,$self=this;
  7452. var bucket;
  7453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7454. return $core.withContext(function($ctx1) {
  7455. //>>excludeEnd("ctx");
  7456. var $1;
  7457. var $early={};
  7458. try {
  7459. bucket=$self._bucketsOfElement_(anObject);
  7460. $1=$recv(bucket)._second();
  7461. if($1 == null || $1.a$nil){
  7462. var obj;
  7463. obj=[$recv(bucket)._first()
  7464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7465. ,$ctx1.sendIdx["first"]=1
  7466. //>>excludeEnd("ctx");
  7467. ][0];
  7468. $recv($recv(bucket)._third())._remove_ifAbsent_(obj,(function(){
  7469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7470. return $core.withContext(function($ctx2) {
  7471. //>>excludeEnd("ctx");
  7472. throw $early=[$recv(aBlock)._value()];
  7473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7475. //>>excludeEnd("ctx");
  7476. }));
  7477. $self.size=$recv($self.size).__minus((1));
  7478. return obj;
  7479. } else {
  7480. var primitiveBucket;
  7481. primitiveBucket=$1;
  7482. return $self._remove_in_ifAbsent_($recv(bucket)._first(),primitiveBucket,aBlock);
  7483. }
  7484. }
  7485. catch(e) {if(e===$early)return e[0]; throw e}
  7486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7487. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket})});
  7488. //>>excludeEnd("ctx");
  7489. }; }),
  7490. $globals.Set);
  7491. $core.addMethod(
  7492. $core.method({
  7493. selector: "remove:in:ifAbsent:",
  7494. protocol: "private",
  7495. //>>excludeStart("ide", pragmas.excludeIdeData);
  7496. args: ["anObject", "anotherObject", "aBlock"],
  7497. 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}'>",
  7498. referencedClasses: [],
  7499. //>>excludeEnd("ide");
  7500. 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}"]]],
  7501. messageSends: []
  7502. }, function ($methodClass){ return function (anObject,anotherObject,aBlock){
  7503. var self=this,$self=this;
  7504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7505. return $core.withContext(function($ctx1) {
  7506. //>>excludeEnd("ctx");
  7507. if (anObject in anotherObject.store) {
  7508. delete anotherObject.store[anObject];
  7509. $self.size--;
  7510. return anObject;
  7511. } else {
  7512. return aBlock._value();
  7513. };
  7514. return self;
  7515. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7516. }, function($ctx1) {$ctx1.fill(self,"remove:in:ifAbsent:",{anObject:anObject,anotherObject:anotherObject,aBlock:aBlock})});
  7517. //>>excludeEnd("ctx");
  7518. }; }),
  7519. $globals.Set);
  7520. $core.addMethod(
  7521. $core.method({
  7522. selector: "removeAll",
  7523. protocol: "adding/removing",
  7524. //>>excludeStart("ide", pragmas.excludeIdeData);
  7525. args: [],
  7526. 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'>",
  7527. referencedClasses: [],
  7528. //>>excludeEnd("ide");
  7529. 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"]]],
  7530. messageSends: []
  7531. }, function ($methodClass){ return function (){
  7532. var self=this,$self=this;
  7533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7534. return $core.withContext(function($ctx1) {
  7535. //>>excludeEnd("ctx");
  7536. $self.fastBuckets = {
  7537. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  7538. "number": { store: Object.create(null), fn: Number },
  7539. "string": { store: Object.create(null) }
  7540. };
  7541. $self.slowBucketStores.forEach(function (x) { x._removeAll(); });
  7542. $self.defaultBucket._removeAll();
  7543. $self.size = 0;
  7544. ;
  7545. return self;
  7546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7547. }, function($ctx1) {$ctx1.fill(self,"removeAll",{})});
  7548. //>>excludeEnd("ctx");
  7549. }; }),
  7550. $globals.Set);
  7551. $core.addMethod(
  7552. $core.method({
  7553. selector: "select:",
  7554. protocol: "enumerating",
  7555. //>>excludeStart("ide", pragmas.excludeIdeData);
  7556. args: ["aBlock"],
  7557. 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",
  7558. referencedClasses: [],
  7559. //>>excludeEnd("ide");
  7560. pragmas: [],
  7561. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7562. }, function ($methodClass){ return function (aBlock){
  7563. var self=this,$self=this;
  7564. var collection;
  7565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7566. return $core.withContext(function($ctx1) {
  7567. //>>excludeEnd("ctx");
  7568. collection=$recv($self._class())._new();
  7569. $self._do_((function(each){
  7570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7571. return $core.withContext(function($ctx2) {
  7572. //>>excludeEnd("ctx");
  7573. if($core.assert($recv(aBlock)._value_(each))){
  7574. return $recv(collection)._add_(each);
  7575. }
  7576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7577. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7578. //>>excludeEnd("ctx");
  7579. }));
  7580. return collection;
  7581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7582. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection})});
  7583. //>>excludeEnd("ctx");
  7584. }; }),
  7585. $globals.Set);
  7586. $core.addMethod(
  7587. $core.method({
  7588. selector: "select:thenCollect:",
  7589. protocol: "enumerating",
  7590. //>>excludeStart("ide", pragmas.excludeIdeData);
  7591. args: ["selectBlock", "collectBlock"],
  7592. 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",
  7593. referencedClasses: [],
  7594. //>>excludeEnd("ide");
  7595. pragmas: [],
  7596. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  7597. }, function ($methodClass){ return function (selectBlock,collectBlock){
  7598. var self=this,$self=this;
  7599. var collection;
  7600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7601. return $core.withContext(function($ctx1) {
  7602. //>>excludeEnd("ctx");
  7603. collection=$recv($self._class())._new();
  7604. $self._do_((function(each){
  7605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7606. return $core.withContext(function($ctx2) {
  7607. //>>excludeEnd("ctx");
  7608. if($core.assert([$recv(selectBlock)._value_(each)
  7609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7610. ,$ctx2.sendIdx["value:"]=1
  7611. //>>excludeEnd("ctx");
  7612. ][0])){
  7613. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  7614. }
  7615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7616. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7617. //>>excludeEnd("ctx");
  7618. }));
  7619. return collection;
  7620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7621. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection})});
  7622. //>>excludeEnd("ctx");
  7623. }; }),
  7624. $globals.Set);
  7625. $core.addMethod(
  7626. $core.method({
  7627. selector: "size",
  7628. protocol: "accessing",
  7629. //>>excludeStart("ide", pragmas.excludeIdeData);
  7630. args: [],
  7631. source: "size\x0a\x09^ size",
  7632. referencedClasses: [],
  7633. //>>excludeEnd("ide");
  7634. pragmas: [],
  7635. messageSends: []
  7636. }, function ($methodClass){ return function (){
  7637. var self=this,$self=this;
  7638. return $self.size;
  7639. }; }),
  7640. $globals.Set);
  7641. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  7642. //>>excludeStart("ide", pragmas.excludeIdeData);
  7643. $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.";
  7644. //>>excludeEnd("ide");
  7645. $core.addMethod(
  7646. $core.method({
  7647. selector: "<<",
  7648. protocol: "writing",
  7649. //>>excludeStart("ide", pragmas.excludeIdeData);
  7650. args: ["anObject"],
  7651. source: "<< anObject\x0a\x09self write: anObject",
  7652. referencedClasses: [],
  7653. //>>excludeEnd("ide");
  7654. pragmas: [],
  7655. messageSends: ["write:"]
  7656. }, function ($methodClass){ return function (anObject){
  7657. var self=this,$self=this;
  7658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7659. return $core.withContext(function($ctx1) {
  7660. //>>excludeEnd("ctx");
  7661. $self._write_(anObject);
  7662. return self;
  7663. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7664. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject})});
  7665. //>>excludeEnd("ctx");
  7666. }; }),
  7667. $globals.ProtoStream);
  7668. $core.addMethod(
  7669. $core.method({
  7670. selector: "atEnd",
  7671. protocol: "testing",
  7672. //>>excludeStart("ide", pragmas.excludeIdeData);
  7673. args: [],
  7674. source: "atEnd\x0a\x09self subclassResponsibility",
  7675. referencedClasses: [],
  7676. //>>excludeEnd("ide");
  7677. pragmas: [],
  7678. messageSends: ["subclassResponsibility"]
  7679. }, function ($methodClass){ return function (){
  7680. var self=this,$self=this;
  7681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7682. return $core.withContext(function($ctx1) {
  7683. //>>excludeEnd("ctx");
  7684. $self._subclassResponsibility();
  7685. return self;
  7686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7687. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  7688. //>>excludeEnd("ctx");
  7689. }; }),
  7690. $globals.ProtoStream);
  7691. $core.addMethod(
  7692. $core.method({
  7693. selector: "atStart",
  7694. protocol: "testing",
  7695. //>>excludeStart("ide", pragmas.excludeIdeData);
  7696. args: [],
  7697. source: "atStart\x0a\x09self subclassResponsibility",
  7698. referencedClasses: [],
  7699. //>>excludeEnd("ide");
  7700. pragmas: [],
  7701. messageSends: ["subclassResponsibility"]
  7702. }, function ($methodClass){ return function (){
  7703. var self=this,$self=this;
  7704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7705. return $core.withContext(function($ctx1) {
  7706. //>>excludeEnd("ctx");
  7707. $self._subclassResponsibility();
  7708. return self;
  7709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7710. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  7711. //>>excludeEnd("ctx");
  7712. }; }),
  7713. $globals.ProtoStream);
  7714. $core.addMethod(
  7715. $core.method({
  7716. selector: "contents",
  7717. protocol: "accessing",
  7718. //>>excludeStart("ide", pragmas.excludeIdeData);
  7719. args: [],
  7720. source: "contents\x0a\x09self subclassResponsibility",
  7721. referencedClasses: [],
  7722. //>>excludeEnd("ide");
  7723. pragmas: [],
  7724. messageSends: ["subclassResponsibility"]
  7725. }, function ($methodClass){ return function (){
  7726. var self=this,$self=this;
  7727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7728. return $core.withContext(function($ctx1) {
  7729. //>>excludeEnd("ctx");
  7730. $self._subclassResponsibility();
  7731. return self;
  7732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7733. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  7734. //>>excludeEnd("ctx");
  7735. }; }),
  7736. $globals.ProtoStream);
  7737. $core.addMethod(
  7738. $core.method({
  7739. selector: "do:",
  7740. protocol: "enumerating",
  7741. //>>excludeStart("ide", pragmas.excludeIdeData);
  7742. args: ["aBlock"],
  7743. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  7744. referencedClasses: [],
  7745. //>>excludeEnd("ide");
  7746. pragmas: [],
  7747. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  7748. }, function ($methodClass){ return function (aBlock){
  7749. var self=this,$self=this;
  7750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7751. return $core.withContext(function($ctx1) {
  7752. //>>excludeEnd("ctx");
  7753. $recv((function(){
  7754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7755. return $core.withContext(function($ctx2) {
  7756. //>>excludeEnd("ctx");
  7757. return $self._atEnd();
  7758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7760. //>>excludeEnd("ctx");
  7761. }))._whileFalse_((function(){
  7762. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7763. return $core.withContext(function($ctx2) {
  7764. //>>excludeEnd("ctx");
  7765. return $recv(aBlock)._value_($self._next());
  7766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7768. //>>excludeEnd("ctx");
  7769. }));
  7770. return self;
  7771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7772. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  7773. //>>excludeEnd("ctx");
  7774. }; }),
  7775. $globals.ProtoStream);
  7776. $core.addMethod(
  7777. $core.method({
  7778. selector: "isEmpty",
  7779. protocol: "testing",
  7780. //>>excludeStart("ide", pragmas.excludeIdeData);
  7781. args: [],
  7782. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  7783. referencedClasses: [],
  7784. //>>excludeEnd("ide");
  7785. pragmas: [],
  7786. messageSends: ["and:", "atStart", "atEnd"]
  7787. }, function ($methodClass){ return function (){
  7788. var self=this,$self=this;
  7789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7790. return $core.withContext(function($ctx1) {
  7791. //>>excludeEnd("ctx");
  7792. return $recv($self._atStart())._and_((function(){
  7793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7794. return $core.withContext(function($ctx2) {
  7795. //>>excludeEnd("ctx");
  7796. return $self._atEnd();
  7797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7799. //>>excludeEnd("ctx");
  7800. }));
  7801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7802. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  7803. //>>excludeEnd("ctx");
  7804. }; }),
  7805. $globals.ProtoStream);
  7806. $core.addMethod(
  7807. $core.method({
  7808. selector: "next",
  7809. protocol: "reading",
  7810. //>>excludeStart("ide", pragmas.excludeIdeData);
  7811. args: [],
  7812. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7813. referencedClasses: [],
  7814. //>>excludeEnd("ide");
  7815. pragmas: [],
  7816. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7817. }, function ($methodClass){ return function (){
  7818. var self=this,$self=this;
  7819. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7820. return $core.withContext(function($ctx1) {
  7821. //>>excludeEnd("ctx");
  7822. if($core.assert($self._atEnd())){
  7823. return nil;
  7824. } else {
  7825. return $self._subclassResponsibility();
  7826. }
  7827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7828. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  7829. //>>excludeEnd("ctx");
  7830. }; }),
  7831. $globals.ProtoStream);
  7832. $core.addMethod(
  7833. $core.method({
  7834. selector: "nextPut:",
  7835. protocol: "writing",
  7836. //>>excludeStart("ide", pragmas.excludeIdeData);
  7837. args: ["anObject"],
  7838. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  7839. referencedClasses: [],
  7840. //>>excludeEnd("ide");
  7841. pragmas: [],
  7842. messageSends: ["subclassResponsibility"]
  7843. }, function ($methodClass){ return function (anObject){
  7844. var self=this,$self=this;
  7845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7846. return $core.withContext(function($ctx1) {
  7847. //>>excludeEnd("ctx");
  7848. $self._subclassResponsibility();
  7849. return self;
  7850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7851. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  7852. //>>excludeEnd("ctx");
  7853. }; }),
  7854. $globals.ProtoStream);
  7855. $core.addMethod(
  7856. $core.method({
  7857. selector: "nextPutAll:",
  7858. protocol: "writing",
  7859. //>>excludeStart("ide", pragmas.excludeIdeData);
  7860. args: ["aCollection"],
  7861. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  7862. referencedClasses: [],
  7863. //>>excludeEnd("ide");
  7864. pragmas: [],
  7865. messageSends: ["do:", "nextPut:"]
  7866. }, function ($methodClass){ return function (aCollection){
  7867. var self=this,$self=this;
  7868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7869. return $core.withContext(function($ctx1) {
  7870. //>>excludeEnd("ctx");
  7871. $recv(aCollection)._do_((function(each){
  7872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7873. return $core.withContext(function($ctx2) {
  7874. //>>excludeEnd("ctx");
  7875. return $self._nextPut_(each);
  7876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7878. //>>excludeEnd("ctx");
  7879. }));
  7880. return self;
  7881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7882. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection})});
  7883. //>>excludeEnd("ctx");
  7884. }; }),
  7885. $globals.ProtoStream);
  7886. $core.addMethod(
  7887. $core.method({
  7888. selector: "nextPutString:",
  7889. protocol: "writing",
  7890. //>>excludeStart("ide", pragmas.excludeIdeData);
  7891. args: ["aString"],
  7892. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  7893. referencedClasses: [],
  7894. //>>excludeEnd("ide");
  7895. pragmas: [],
  7896. messageSends: ["nextPut:"]
  7897. }, function ($methodClass){ return function (aString){
  7898. var self=this,$self=this;
  7899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7900. return $core.withContext(function($ctx1) {
  7901. //>>excludeEnd("ctx");
  7902. $self._nextPut_(aString);
  7903. return self;
  7904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7905. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  7906. //>>excludeEnd("ctx");
  7907. }; }),
  7908. $globals.ProtoStream);
  7909. $core.addMethod(
  7910. $core.method({
  7911. selector: "peek",
  7912. protocol: "reading",
  7913. //>>excludeStart("ide", pragmas.excludeIdeData);
  7914. args: [],
  7915. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  7916. referencedClasses: [],
  7917. //>>excludeEnd("ide");
  7918. pragmas: [],
  7919. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  7920. }, function ($methodClass){ return function (){
  7921. var self=this,$self=this;
  7922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7923. return $core.withContext(function($ctx1) {
  7924. //>>excludeEnd("ctx");
  7925. if($core.assert($self._atEnd())){
  7926. return nil;
  7927. } else {
  7928. return $self._subclassResponsibility();
  7929. }
  7930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7931. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  7932. //>>excludeEnd("ctx");
  7933. }; }),
  7934. $globals.ProtoStream);
  7935. $core.addMethod(
  7936. $core.method({
  7937. selector: "reset",
  7938. protocol: "actions",
  7939. //>>excludeStart("ide", pragmas.excludeIdeData);
  7940. args: [],
  7941. source: "reset\x0a\x09self subclassResponsibility",
  7942. referencedClasses: [],
  7943. //>>excludeEnd("ide");
  7944. pragmas: [],
  7945. messageSends: ["subclassResponsibility"]
  7946. }, function ($methodClass){ return function (){
  7947. var self=this,$self=this;
  7948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7949. return $core.withContext(function($ctx1) {
  7950. //>>excludeEnd("ctx");
  7951. $self._subclassResponsibility();
  7952. return self;
  7953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7954. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  7955. //>>excludeEnd("ctx");
  7956. }; }),
  7957. $globals.ProtoStream);
  7958. $core.addMethod(
  7959. $core.method({
  7960. selector: "resetContents",
  7961. protocol: "actions",
  7962. //>>excludeStart("ide", pragmas.excludeIdeData);
  7963. args: [],
  7964. source: "resetContents\x0a\x09self subclassResponsibility",
  7965. referencedClasses: [],
  7966. //>>excludeEnd("ide");
  7967. pragmas: [],
  7968. messageSends: ["subclassResponsibility"]
  7969. }, function ($methodClass){ return function (){
  7970. var self=this,$self=this;
  7971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7972. return $core.withContext(function($ctx1) {
  7973. //>>excludeEnd("ctx");
  7974. $self._subclassResponsibility();
  7975. return self;
  7976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7977. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  7978. //>>excludeEnd("ctx");
  7979. }; }),
  7980. $globals.ProtoStream);
  7981. $core.addMethod(
  7982. $core.method({
  7983. selector: "setToEnd",
  7984. protocol: "positioning",
  7985. //>>excludeStart("ide", pragmas.excludeIdeData);
  7986. args: [],
  7987. source: "setToEnd\x0a\x09self subclassResponsibility",
  7988. referencedClasses: [],
  7989. //>>excludeEnd("ide");
  7990. pragmas: [],
  7991. messageSends: ["subclassResponsibility"]
  7992. }, function ($methodClass){ return function (){
  7993. var self=this,$self=this;
  7994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7995. return $core.withContext(function($ctx1) {
  7996. //>>excludeEnd("ctx");
  7997. $self._subclassResponsibility();
  7998. return self;
  7999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8000. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8001. //>>excludeEnd("ctx");
  8002. }; }),
  8003. $globals.ProtoStream);
  8004. $core.addMethod(
  8005. $core.method({
  8006. selector: "setToStart",
  8007. protocol: "positioning",
  8008. //>>excludeStart("ide", pragmas.excludeIdeData);
  8009. args: [],
  8010. source: "setToStart\x0a\x09self reset",
  8011. referencedClasses: [],
  8012. //>>excludeEnd("ide");
  8013. pragmas: [],
  8014. messageSends: ["reset"]
  8015. }, function ($methodClass){ return function (){
  8016. var self=this,$self=this;
  8017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8018. return $core.withContext(function($ctx1) {
  8019. //>>excludeEnd("ctx");
  8020. $self._reset();
  8021. return self;
  8022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8023. }, function($ctx1) {$ctx1.fill(self,"setToStart",{})});
  8024. //>>excludeEnd("ctx");
  8025. }; }),
  8026. $globals.ProtoStream);
  8027. $core.addMethod(
  8028. $core.method({
  8029. selector: "write:",
  8030. protocol: "writing",
  8031. //>>excludeStart("ide", pragmas.excludeIdeData);
  8032. args: ["anObject"],
  8033. source: "write: anObject\x0a\x09anObject putOn: self",
  8034. referencedClasses: [],
  8035. //>>excludeEnd("ide");
  8036. pragmas: [],
  8037. messageSends: ["putOn:"]
  8038. }, function ($methodClass){ return function (anObject){
  8039. var self=this,$self=this;
  8040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8041. return $core.withContext(function($ctx1) {
  8042. //>>excludeEnd("ctx");
  8043. $recv(anObject)._putOn_(self);
  8044. return self;
  8045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8046. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject})});
  8047. //>>excludeEnd("ctx");
  8048. }; }),
  8049. $globals.ProtoStream);
  8050. $core.addMethod(
  8051. $core.method({
  8052. selector: "on:",
  8053. protocol: "instance creation",
  8054. //>>excludeStart("ide", pragmas.excludeIdeData);
  8055. args: ["aCollection"],
  8056. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8057. referencedClasses: [],
  8058. //>>excludeEnd("ide");
  8059. pragmas: [],
  8060. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8061. }, function ($methodClass){ return function (aCollection){
  8062. var self=this,$self=this;
  8063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8064. return $core.withContext(function($ctx1) {
  8065. //>>excludeEnd("ctx");
  8066. var $1;
  8067. $1=$self._new();
  8068. $recv($1)._setCollection_(aCollection);
  8069. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8070. return $recv($1)._yourself();
  8071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8072. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8073. //>>excludeEnd("ctx");
  8074. }; }),
  8075. $globals.ProtoStream.a$cls);
  8076. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8077. //>>excludeStart("ide", pragmas.excludeIdeData);
  8078. $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.";
  8079. //>>excludeEnd("ide");
  8080. $core.addMethod(
  8081. $core.method({
  8082. selector: "atEnd",
  8083. protocol: "testing",
  8084. //>>excludeStart("ide", pragmas.excludeIdeData);
  8085. args: [],
  8086. source: "atEnd\x0a\x09^ self position = self size",
  8087. referencedClasses: [],
  8088. //>>excludeEnd("ide");
  8089. pragmas: [],
  8090. messageSends: ["=", "position", "size"]
  8091. }, function ($methodClass){ return function (){
  8092. var self=this,$self=this;
  8093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8094. return $core.withContext(function($ctx1) {
  8095. //>>excludeEnd("ctx");
  8096. return $recv($self._position()).__eq($self._size());
  8097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8098. }, function($ctx1) {$ctx1.fill(self,"atEnd",{})});
  8099. //>>excludeEnd("ctx");
  8100. }; }),
  8101. $globals.Stream);
  8102. $core.addMethod(
  8103. $core.method({
  8104. selector: "atStart",
  8105. protocol: "testing",
  8106. //>>excludeStart("ide", pragmas.excludeIdeData);
  8107. args: [],
  8108. source: "atStart\x0a\x09^ self position = 0",
  8109. referencedClasses: [],
  8110. //>>excludeEnd("ide");
  8111. pragmas: [],
  8112. messageSends: ["=", "position"]
  8113. }, function ($methodClass){ return function (){
  8114. var self=this,$self=this;
  8115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8116. return $core.withContext(function($ctx1) {
  8117. //>>excludeEnd("ctx");
  8118. return $recv($self._position()).__eq((0));
  8119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8120. }, function($ctx1) {$ctx1.fill(self,"atStart",{})});
  8121. //>>excludeEnd("ctx");
  8122. }; }),
  8123. $globals.Stream);
  8124. $core.addMethod(
  8125. $core.method({
  8126. selector: "close",
  8127. protocol: "actions",
  8128. //>>excludeStart("ide", pragmas.excludeIdeData);
  8129. args: [],
  8130. source: "close",
  8131. referencedClasses: [],
  8132. //>>excludeEnd("ide");
  8133. pragmas: [],
  8134. messageSends: []
  8135. }, function ($methodClass){ return function (){
  8136. var self=this,$self=this;
  8137. return self;
  8138. }; }),
  8139. $globals.Stream);
  8140. $core.addMethod(
  8141. $core.method({
  8142. selector: "collection",
  8143. protocol: "accessing",
  8144. //>>excludeStart("ide", pragmas.excludeIdeData);
  8145. args: [],
  8146. source: "collection\x0a\x09^ collection",
  8147. referencedClasses: [],
  8148. //>>excludeEnd("ide");
  8149. pragmas: [],
  8150. messageSends: []
  8151. }, function ($methodClass){ return function (){
  8152. var self=this,$self=this;
  8153. return $self.collection;
  8154. }; }),
  8155. $globals.Stream);
  8156. $core.addMethod(
  8157. $core.method({
  8158. selector: "contents",
  8159. protocol: "accessing",
  8160. //>>excludeStart("ide", pragmas.excludeIdeData);
  8161. args: [],
  8162. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8163. referencedClasses: [],
  8164. //>>excludeEnd("ide");
  8165. pragmas: [],
  8166. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  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._collection())._copyFrom_to_((1),$self._streamSize());
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. }, function($ctx1) {$ctx1.fill(self,"contents",{})});
  8175. //>>excludeEnd("ctx");
  8176. }; }),
  8177. $globals.Stream);
  8178. $core.addMethod(
  8179. $core.method({
  8180. selector: "flush",
  8181. protocol: "actions",
  8182. //>>excludeStart("ide", pragmas.excludeIdeData);
  8183. args: [],
  8184. source: "flush",
  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: "isEmpty",
  8197. protocol: "testing",
  8198. //>>excludeStart("ide", pragmas.excludeIdeData);
  8199. args: [],
  8200. source: "isEmpty\x0a\x09^ self size = 0",
  8201. referencedClasses: [],
  8202. //>>excludeEnd("ide");
  8203. pragmas: [],
  8204. messageSends: ["=", "size"]
  8205. }, function ($methodClass){ return function (){
  8206. var self=this,$self=this;
  8207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8208. return $core.withContext(function($ctx1) {
  8209. //>>excludeEnd("ctx");
  8210. return $recv($self._size()).__eq((0));
  8211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8212. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{})});
  8213. //>>excludeEnd("ctx");
  8214. }; }),
  8215. $globals.Stream);
  8216. $core.addMethod(
  8217. $core.method({
  8218. selector: "next",
  8219. protocol: "reading",
  8220. //>>excludeStart("ide", pragmas.excludeIdeData);
  8221. args: [],
  8222. 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 ]",
  8223. referencedClasses: [],
  8224. //>>excludeEnd("ide");
  8225. pragmas: [],
  8226. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8227. }, function ($methodClass){ return function (){
  8228. var self=this,$self=this;
  8229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8230. return $core.withContext(function($ctx1) {
  8231. //>>excludeEnd("ctx");
  8232. if($core.assert($self._atEnd())){
  8233. return nil;
  8234. } else {
  8235. $self._position_($recv([$self._position()
  8236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8237. ,$ctx1.sendIdx["position"]=1
  8238. //>>excludeEnd("ctx");
  8239. ][0]).__plus((1)));
  8240. return $recv($self.collection)._at_($self._position());
  8241. }
  8242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8243. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8244. //>>excludeEnd("ctx");
  8245. }; }),
  8246. $globals.Stream);
  8247. $core.addMethod(
  8248. $core.method({
  8249. selector: "next:",
  8250. protocol: "reading",
  8251. //>>excludeStart("ide", pragmas.excludeIdeData);
  8252. args: ["anInteger"],
  8253. 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",
  8254. referencedClasses: [],
  8255. //>>excludeEnd("ide");
  8256. pragmas: [],
  8257. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8258. }, function ($methodClass){ return function (anInteger){
  8259. var self=this,$self=this;
  8260. var tempCollection;
  8261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8262. return $core.withContext(function($ctx1) {
  8263. //>>excludeEnd("ctx");
  8264. tempCollection=$recv($recv($self._collection())._class())._new();
  8265. $recv(anInteger)._timesRepeat_((function(){
  8266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8267. return $core.withContext(function($ctx2) {
  8268. //>>excludeEnd("ctx");
  8269. if(!$core.assert($self._atEnd())){
  8270. return $recv(tempCollection)._add_($self._next());
  8271. }
  8272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8274. //>>excludeEnd("ctx");
  8275. }));
  8276. return tempCollection;
  8277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8278. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8279. //>>excludeEnd("ctx");
  8280. }; }),
  8281. $globals.Stream);
  8282. $core.addMethod(
  8283. $core.method({
  8284. selector: "nextPut:",
  8285. protocol: "writing",
  8286. //>>excludeStart("ide", pragmas.excludeIdeData);
  8287. args: ["anObject"],
  8288. 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)",
  8289. referencedClasses: [],
  8290. //>>excludeEnd("ide");
  8291. pragmas: [],
  8292. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8293. }, function ($methodClass){ return function (anObject){
  8294. var self=this,$self=this;
  8295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8296. return $core.withContext(function($ctx1) {
  8297. //>>excludeEnd("ctx");
  8298. $self._position_($recv([$self._position()
  8299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8300. ,$ctx1.sendIdx["position"]=1
  8301. //>>excludeEnd("ctx");
  8302. ][0]).__plus((1)));
  8303. $recv($self._collection())._at_put_([$self._position()
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. ,$ctx1.sendIdx["position"]=2
  8306. //>>excludeEnd("ctx");
  8307. ][0],anObject);
  8308. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8309. return self;
  8310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8311. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  8312. //>>excludeEnd("ctx");
  8313. }; }),
  8314. $globals.Stream);
  8315. $core.addMethod(
  8316. $core.method({
  8317. selector: "peek",
  8318. protocol: "reading",
  8319. //>>excludeStart("ide", pragmas.excludeIdeData);
  8320. args: [],
  8321. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8322. referencedClasses: [],
  8323. //>>excludeEnd("ide");
  8324. pragmas: [],
  8325. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8326. }, function ($methodClass){ return function (){
  8327. var self=this,$self=this;
  8328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8329. return $core.withContext(function($ctx1) {
  8330. //>>excludeEnd("ctx");
  8331. if(!$core.assert($self._atEnd())){
  8332. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  8333. }
  8334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8335. }, function($ctx1) {$ctx1.fill(self,"peek",{})});
  8336. //>>excludeEnd("ctx");
  8337. }; }),
  8338. $globals.Stream);
  8339. $core.addMethod(
  8340. $core.method({
  8341. selector: "position",
  8342. protocol: "accessing",
  8343. //>>excludeStart("ide", pragmas.excludeIdeData);
  8344. args: [],
  8345. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8346. referencedClasses: [],
  8347. //>>excludeEnd("ide");
  8348. pragmas: [],
  8349. messageSends: ["ifNil:"]
  8350. }, function ($methodClass){ return function (){
  8351. var self=this,$self=this;
  8352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8353. return $core.withContext(function($ctx1) {
  8354. //>>excludeEnd("ctx");
  8355. var $1;
  8356. $1=$self.position;
  8357. if($1 == null || $1.a$nil){
  8358. $self.position=(0);
  8359. return $self.position;
  8360. } else {
  8361. return $1;
  8362. }
  8363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8364. }, function($ctx1) {$ctx1.fill(self,"position",{})});
  8365. //>>excludeEnd("ctx");
  8366. }; }),
  8367. $globals.Stream);
  8368. $core.addMethod(
  8369. $core.method({
  8370. selector: "position:",
  8371. protocol: "accessing",
  8372. //>>excludeStart("ide", pragmas.excludeIdeData);
  8373. args: ["anInteger"],
  8374. source: "position: anInteger\x0a\x09position := anInteger",
  8375. referencedClasses: [],
  8376. //>>excludeEnd("ide");
  8377. pragmas: [],
  8378. messageSends: []
  8379. }, function ($methodClass){ return function (anInteger){
  8380. var self=this,$self=this;
  8381. $self.position=anInteger;
  8382. return self;
  8383. }; }),
  8384. $globals.Stream);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "reset",
  8388. protocol: "actions",
  8389. //>>excludeStart("ide", pragmas.excludeIdeData);
  8390. args: [],
  8391. source: "reset\x0a\x09self position: 0",
  8392. referencedClasses: [],
  8393. //>>excludeEnd("ide");
  8394. pragmas: [],
  8395. messageSends: ["position:"]
  8396. }, function ($methodClass){ return function (){
  8397. var self=this,$self=this;
  8398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8399. return $core.withContext(function($ctx1) {
  8400. //>>excludeEnd("ctx");
  8401. $self._position_((0));
  8402. return self;
  8403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8404. }, function($ctx1) {$ctx1.fill(self,"reset",{})});
  8405. //>>excludeEnd("ctx");
  8406. }; }),
  8407. $globals.Stream);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "resetContents",
  8411. protocol: "actions",
  8412. //>>excludeStart("ide", pragmas.excludeIdeData);
  8413. args: [],
  8414. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8415. referencedClasses: [],
  8416. //>>excludeEnd("ide");
  8417. pragmas: [],
  8418. messageSends: ["reset", "setStreamSize:"]
  8419. }, function ($methodClass){ return function (){
  8420. var self=this,$self=this;
  8421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8422. return $core.withContext(function($ctx1) {
  8423. //>>excludeEnd("ctx");
  8424. $self._reset();
  8425. $self._setStreamSize_((0));
  8426. return self;
  8427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8428. }, function($ctx1) {$ctx1.fill(self,"resetContents",{})});
  8429. //>>excludeEnd("ctx");
  8430. }; }),
  8431. $globals.Stream);
  8432. $core.addMethod(
  8433. $core.method({
  8434. selector: "setCollection:",
  8435. protocol: "accessing",
  8436. //>>excludeStart("ide", pragmas.excludeIdeData);
  8437. args: ["aCollection"],
  8438. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8439. referencedClasses: [],
  8440. //>>excludeEnd("ide");
  8441. pragmas: [],
  8442. messageSends: []
  8443. }, function ($methodClass){ return function (aCollection){
  8444. var self=this,$self=this;
  8445. $self.collection=aCollection;
  8446. return self;
  8447. }; }),
  8448. $globals.Stream);
  8449. $core.addMethod(
  8450. $core.method({
  8451. selector: "setStreamSize:",
  8452. protocol: "accessing",
  8453. //>>excludeStart("ide", pragmas.excludeIdeData);
  8454. args: ["anInteger"],
  8455. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8456. referencedClasses: [],
  8457. //>>excludeEnd("ide");
  8458. pragmas: [],
  8459. messageSends: []
  8460. }, function ($methodClass){ return function (anInteger){
  8461. var self=this,$self=this;
  8462. $self.streamSize=anInteger;
  8463. return self;
  8464. }; }),
  8465. $globals.Stream);
  8466. $core.addMethod(
  8467. $core.method({
  8468. selector: "setToEnd",
  8469. protocol: "positioning",
  8470. //>>excludeStart("ide", pragmas.excludeIdeData);
  8471. args: [],
  8472. source: "setToEnd\x0a\x09self position: self size",
  8473. referencedClasses: [],
  8474. //>>excludeEnd("ide");
  8475. pragmas: [],
  8476. messageSends: ["position:", "size"]
  8477. }, function ($methodClass){ return function (){
  8478. var self=this,$self=this;
  8479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8480. return $core.withContext(function($ctx1) {
  8481. //>>excludeEnd("ctx");
  8482. $self._position_($self._size());
  8483. return self;
  8484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8485. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{})});
  8486. //>>excludeEnd("ctx");
  8487. }; }),
  8488. $globals.Stream);
  8489. $core.addMethod(
  8490. $core.method({
  8491. selector: "size",
  8492. protocol: "accessing",
  8493. //>>excludeStart("ide", pragmas.excludeIdeData);
  8494. args: [],
  8495. source: "size\x0a\x09^ self streamSize",
  8496. referencedClasses: [],
  8497. //>>excludeEnd("ide");
  8498. pragmas: [],
  8499. messageSends: ["streamSize"]
  8500. }, function ($methodClass){ return function (){
  8501. var self=this,$self=this;
  8502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8503. return $core.withContext(function($ctx1) {
  8504. //>>excludeEnd("ctx");
  8505. return $self._streamSize();
  8506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8507. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  8508. //>>excludeEnd("ctx");
  8509. }; }),
  8510. $globals.Stream);
  8511. $core.addMethod(
  8512. $core.method({
  8513. selector: "skip:",
  8514. protocol: "positioning",
  8515. //>>excludeStart("ide", pragmas.excludeIdeData);
  8516. args: ["anInteger"],
  8517. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8518. referencedClasses: [],
  8519. //>>excludeEnd("ide");
  8520. pragmas: [],
  8521. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8522. }, function ($methodClass){ return function (anInteger){
  8523. var self=this,$self=this;
  8524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8525. return $core.withContext(function($ctx1) {
  8526. //>>excludeEnd("ctx");
  8527. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  8528. return self;
  8529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8530. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger})});
  8531. //>>excludeEnd("ctx");
  8532. }; }),
  8533. $globals.Stream);
  8534. $core.addMethod(
  8535. $core.method({
  8536. selector: "streamSize",
  8537. protocol: "accessing",
  8538. //>>excludeStart("ide", pragmas.excludeIdeData);
  8539. args: [],
  8540. source: "streamSize\x0a\x09^ streamSize",
  8541. referencedClasses: [],
  8542. //>>excludeEnd("ide");
  8543. pragmas: [],
  8544. messageSends: []
  8545. }, function ($methodClass){ return function (){
  8546. var self=this,$self=this;
  8547. return $self.streamSize;
  8548. }; }),
  8549. $globals.Stream);
  8550. $core.addMethod(
  8551. $core.method({
  8552. selector: "on:",
  8553. protocol: "instance creation",
  8554. //>>excludeStart("ide", pragmas.excludeIdeData);
  8555. args: ["aCollection"],
  8556. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8557. referencedClasses: [],
  8558. //>>excludeEnd("ide");
  8559. pragmas: [],
  8560. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8561. }, function ($methodClass){ return function (aCollection){
  8562. var self=this,$self=this;
  8563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8564. return $core.withContext(function($ctx1) {
  8565. //>>excludeEnd("ctx");
  8566. var $1;
  8567. $1=$self._new();
  8568. $recv($1)._setCollection_(aCollection);
  8569. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8570. return $recv($1)._yourself();
  8571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8572. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection})});
  8573. //>>excludeEnd("ctx");
  8574. }; }),
  8575. $globals.Stream.a$cls);
  8576. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  8577. //>>excludeStart("ide", pragmas.excludeIdeData);
  8578. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  8579. //>>excludeEnd("ide");
  8580. $core.addMethod(
  8581. $core.method({
  8582. selector: "cr",
  8583. protocol: "writing",
  8584. //>>excludeStart("ide", pragmas.excludeIdeData);
  8585. args: [],
  8586. source: "cr\x0a\x09^ self nextPutAll: String cr",
  8587. referencedClasses: ["String"],
  8588. //>>excludeEnd("ide");
  8589. pragmas: [],
  8590. messageSends: ["nextPutAll:", "cr"]
  8591. }, function ($methodClass){ return function (){
  8592. var self=this,$self=this;
  8593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8594. return $core.withContext(function($ctx1) {
  8595. //>>excludeEnd("ctx");
  8596. return $self._nextPutAll_($recv($globals.String)._cr());
  8597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8598. }, function($ctx1) {$ctx1.fill(self,"cr",{})});
  8599. //>>excludeEnd("ctx");
  8600. }; }),
  8601. $globals.StringStream);
  8602. $core.addMethod(
  8603. $core.method({
  8604. selector: "crlf",
  8605. protocol: "writing",
  8606. //>>excludeStart("ide", pragmas.excludeIdeData);
  8607. args: [],
  8608. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  8609. referencedClasses: ["String"],
  8610. //>>excludeEnd("ide");
  8611. pragmas: [],
  8612. messageSends: ["nextPutAll:", "crlf"]
  8613. }, function ($methodClass){ return function (){
  8614. var self=this,$self=this;
  8615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8616. return $core.withContext(function($ctx1) {
  8617. //>>excludeEnd("ctx");
  8618. return $self._nextPutAll_($recv($globals.String)._crlf());
  8619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8620. }, function($ctx1) {$ctx1.fill(self,"crlf",{})});
  8621. //>>excludeEnd("ctx");
  8622. }; }),
  8623. $globals.StringStream);
  8624. $core.addMethod(
  8625. $core.method({
  8626. selector: "lf",
  8627. protocol: "writing",
  8628. //>>excludeStart("ide", pragmas.excludeIdeData);
  8629. args: [],
  8630. source: "lf\x0a\x09^ self nextPutAll: String lf",
  8631. referencedClasses: ["String"],
  8632. //>>excludeEnd("ide");
  8633. pragmas: [],
  8634. messageSends: ["nextPutAll:", "lf"]
  8635. }, function ($methodClass){ return function (){
  8636. var self=this,$self=this;
  8637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8638. return $core.withContext(function($ctx1) {
  8639. //>>excludeEnd("ctx");
  8640. return $self._nextPutAll_($recv($globals.String)._lf());
  8641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8642. }, function($ctx1) {$ctx1.fill(self,"lf",{})});
  8643. //>>excludeEnd("ctx");
  8644. }; }),
  8645. $globals.StringStream);
  8646. $core.addMethod(
  8647. $core.method({
  8648. selector: "next:",
  8649. protocol: "reading",
  8650. //>>excludeStart("ide", pragmas.excludeIdeData);
  8651. args: ["anInteger"],
  8652. 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",
  8653. referencedClasses: [],
  8654. //>>excludeEnd("ide");
  8655. pragmas: [],
  8656. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  8657. }, function ($methodClass){ return function (anInteger){
  8658. var self=this,$self=this;
  8659. var tempCollection;
  8660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8661. return $core.withContext(function($ctx1) {
  8662. //>>excludeEnd("ctx");
  8663. tempCollection=$recv($recv($self._collection())._class())._new();
  8664. $recv(anInteger)._timesRepeat_((function(){
  8665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8666. return $core.withContext(function($ctx2) {
  8667. //>>excludeEnd("ctx");
  8668. if(!$core.assert($self._atEnd())){
  8669. tempCollection=$recv(tempCollection).__comma($self._next());
  8670. return tempCollection;
  8671. }
  8672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8674. //>>excludeEnd("ctx");
  8675. }));
  8676. return tempCollection;
  8677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8678. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection})});
  8679. //>>excludeEnd("ctx");
  8680. }; }),
  8681. $globals.StringStream);
  8682. $core.addMethod(
  8683. $core.method({
  8684. selector: "nextPut:",
  8685. protocol: "writing",
  8686. //>>excludeStart("ide", pragmas.excludeIdeData);
  8687. args: ["aString"],
  8688. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  8689. referencedClasses: [],
  8690. //>>excludeEnd("ide");
  8691. pragmas: [],
  8692. messageSends: ["nextPutAll:"]
  8693. }, function ($methodClass){ return function (aString){
  8694. var self=this,$self=this;
  8695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8696. return $core.withContext(function($ctx1) {
  8697. //>>excludeEnd("ctx");
  8698. $self._nextPutAll_(aString);
  8699. return self;
  8700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8701. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString})});
  8702. //>>excludeEnd("ctx");
  8703. }; }),
  8704. $globals.StringStream);
  8705. $core.addMethod(
  8706. $core.method({
  8707. selector: "nextPutAll:",
  8708. protocol: "writing",
  8709. //>>excludeStart("ide", pragmas.excludeIdeData);
  8710. args: ["aString"],
  8711. 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)",
  8712. referencedClasses: [],
  8713. //>>excludeEnd("ide");
  8714. pragmas: [],
  8715. messageSends: ["ifTrue:ifFalse:", "=", "position", "size", "collection", "setCollection:", ",", "copyFrom:to:", "+", "position:", "setStreamSize:", "max:", "streamSize"]
  8716. }, function ($methodClass){ return function (aString){
  8717. var self=this,$self=this;
  8718. var pre,post;
  8719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8720. return $core.withContext(function($ctx1) {
  8721. //>>excludeEnd("ctx");
  8722. if($core.assert($recv([$self._position()
  8723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8724. ,$ctx1.sendIdx["position"]=1
  8725. //>>excludeEnd("ctx");
  8726. ][0]).__eq([$recv([$self._collection()
  8727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8728. ,$ctx1.sendIdx["collection"]=1
  8729. //>>excludeEnd("ctx");
  8730. ][0])._size()
  8731. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8732. ,$ctx1.sendIdx["size"]=1
  8733. //>>excludeEnd("ctx");
  8734. ][0]))){
  8735. [$self._setCollection_([$recv([$self._collection()
  8736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8737. ,$ctx1.sendIdx["collection"]=2
  8738. //>>excludeEnd("ctx");
  8739. ][0]).__comma(aString)
  8740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8741. ,$ctx1.sendIdx[","]=1
  8742. //>>excludeEnd("ctx");
  8743. ][0])
  8744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8745. ,$ctx1.sendIdx["setCollection:"]=1
  8746. //>>excludeEnd("ctx");
  8747. ][0];
  8748. } else {
  8749. pre=[$recv([$self._collection()
  8750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8751. ,$ctx1.sendIdx["collection"]=3
  8752. //>>excludeEnd("ctx");
  8753. ][0])._copyFrom_to_((1),[$self._position()
  8754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8755. ,$ctx1.sendIdx["position"]=2
  8756. //>>excludeEnd("ctx");
  8757. ][0])
  8758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8759. ,$ctx1.sendIdx["copyFrom:to:"]=1
  8760. //>>excludeEnd("ctx");
  8761. ][0];
  8762. post=$recv([$self._collection()
  8763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8764. ,$ctx1.sendIdx["collection"]=4
  8765. //>>excludeEnd("ctx");
  8766. ][0])._copyFrom_to_([$recv([$recv([$self._position()
  8767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8768. ,$ctx1.sendIdx["position"]=3
  8769. //>>excludeEnd("ctx");
  8770. ][0]).__plus((1))
  8771. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8772. ,$ctx1.sendIdx["+"]=2
  8773. //>>excludeEnd("ctx");
  8774. ][0]).__plus([$recv(aString)._size()
  8775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8776. ,$ctx1.sendIdx["size"]=2
  8777. //>>excludeEnd("ctx");
  8778. ][0])
  8779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8780. ,$ctx1.sendIdx["+"]=1
  8781. //>>excludeEnd("ctx");
  8782. ][0],[$recv($self._collection())._size()
  8783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8784. ,$ctx1.sendIdx["size"]=3
  8785. //>>excludeEnd("ctx");
  8786. ][0]);
  8787. $self._setCollection_([$recv($recv(pre).__comma(aString)).__comma(post)
  8788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8789. ,$ctx1.sendIdx[","]=2
  8790. //>>excludeEnd("ctx");
  8791. ][0]);
  8792. }
  8793. $self._position_($recv([$self._position()
  8794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8795. ,$ctx1.sendIdx["position"]=4
  8796. //>>excludeEnd("ctx");
  8797. ][0]).__plus($recv(aString)._size()));
  8798. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  8799. return self;
  8800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8801. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post})});
  8802. //>>excludeEnd("ctx");
  8803. }; }),
  8804. $globals.StringStream);
  8805. $core.addMethod(
  8806. $core.method({
  8807. selector: "nextPutString:",
  8808. protocol: "writing",
  8809. //>>excludeStart("ide", pragmas.excludeIdeData);
  8810. args: ["aString"],
  8811. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  8812. referencedClasses: [],
  8813. //>>excludeEnd("ide");
  8814. pragmas: [],
  8815. messageSends: ["nextPutAll:"]
  8816. }, function ($methodClass){ return function (aString){
  8817. var self=this,$self=this;
  8818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8819. return $core.withContext(function($ctx1) {
  8820. //>>excludeEnd("ctx");
  8821. $self._nextPutAll_(aString);
  8822. return self;
  8823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8824. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString})});
  8825. //>>excludeEnd("ctx");
  8826. }; }),
  8827. $globals.StringStream);
  8828. $core.addMethod(
  8829. $core.method({
  8830. selector: "print:",
  8831. protocol: "writing",
  8832. //>>excludeStart("ide", pragmas.excludeIdeData);
  8833. args: ["anObject"],
  8834. source: "print: anObject\x0a\x09anObject printOn: self",
  8835. referencedClasses: [],
  8836. //>>excludeEnd("ide");
  8837. pragmas: [],
  8838. messageSends: ["printOn:"]
  8839. }, function ($methodClass){ return function (anObject){
  8840. var self=this,$self=this;
  8841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8842. return $core.withContext(function($ctx1) {
  8843. //>>excludeEnd("ctx");
  8844. $recv(anObject)._printOn_(self);
  8845. return self;
  8846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8847. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject})});
  8848. //>>excludeEnd("ctx");
  8849. }; }),
  8850. $globals.StringStream);
  8851. $core.addMethod(
  8852. $core.method({
  8853. selector: "printSymbol:",
  8854. protocol: "writing",
  8855. //>>excludeStart("ide", pragmas.excludeIdeData);
  8856. args: ["anObject"],
  8857. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  8858. referencedClasses: [],
  8859. //>>excludeEnd("ide");
  8860. pragmas: [],
  8861. messageSends: ["asSymbolPrintOn:"]
  8862. }, function ($methodClass){ return function (anObject){
  8863. var self=this,$self=this;
  8864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8865. return $core.withContext(function($ctx1) {
  8866. //>>excludeEnd("ctx");
  8867. $recv(anObject)._asSymbolPrintOn_(self);
  8868. return self;
  8869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8870. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject})});
  8871. //>>excludeEnd("ctx");
  8872. }; }),
  8873. $globals.StringStream);
  8874. $core.addMethod(
  8875. $core.method({
  8876. selector: "space",
  8877. protocol: "writing",
  8878. //>>excludeStart("ide", pragmas.excludeIdeData);
  8879. args: [],
  8880. source: "space\x0a\x09self nextPut: ' '",
  8881. referencedClasses: [],
  8882. //>>excludeEnd("ide");
  8883. pragmas: [],
  8884. messageSends: ["nextPut:"]
  8885. }, function ($methodClass){ return function (){
  8886. var self=this,$self=this;
  8887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8888. return $core.withContext(function($ctx1) {
  8889. //>>excludeEnd("ctx");
  8890. $self._nextPut_(" ");
  8891. return self;
  8892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8893. }, function($ctx1) {$ctx1.fill(self,"space",{})});
  8894. //>>excludeEnd("ctx");
  8895. }; }),
  8896. $globals.StringStream);
  8897. $core.addMethod(
  8898. $core.method({
  8899. selector: "tab",
  8900. protocol: "writing",
  8901. //>>excludeStart("ide", pragmas.excludeIdeData);
  8902. args: [],
  8903. source: "tab\x0a\x09^ self nextPutAll: String tab",
  8904. referencedClasses: ["String"],
  8905. //>>excludeEnd("ide");
  8906. pragmas: [],
  8907. messageSends: ["nextPutAll:", "tab"]
  8908. }, function ($methodClass){ return function (){
  8909. var self=this,$self=this;
  8910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8911. return $core.withContext(function($ctx1) {
  8912. //>>excludeEnd("ctx");
  8913. return $self._nextPutAll_($recv($globals.String)._tab());
  8914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8915. }, function($ctx1) {$ctx1.fill(self,"tab",{})});
  8916. //>>excludeEnd("ctx");
  8917. }; }),
  8918. $globals.StringStream);
  8919. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  8920. //>>excludeStart("ide", pragmas.excludeIdeData);
  8921. $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.";
  8922. //>>excludeEnd("ide");
  8923. $core.addMethod(
  8924. $core.method({
  8925. selector: "initialize",
  8926. protocol: "initialization",
  8927. //>>excludeStart("ide", pragmas.excludeIdeData);
  8928. args: [],
  8929. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8930. referencedClasses: ["OrderedCollection"],
  8931. //>>excludeEnd("ide");
  8932. pragmas: [],
  8933. messageSends: ["initialize", "new"]
  8934. }, function ($methodClass){ return function (){
  8935. var self=this,$self=this;
  8936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8937. return $core.withContext(function($ctx1) {
  8938. //>>excludeEnd("ctx");
  8939. [(
  8940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8941. $ctx1.supercall = true,
  8942. //>>excludeEnd("ctx");
  8943. ($methodClass.superclass||$boot.nilAsClass).fn.prototype._initialize.call($self))
  8944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8945. ,$ctx1.supercall = false
  8946. //>>excludeEnd("ctx");
  8947. ][0];
  8948. $self.read=[$recv($globals.OrderedCollection)._new()
  8949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8950. ,$ctx1.sendIdx["new"]=1
  8951. //>>excludeEnd("ctx");
  8952. ][0];
  8953. $self.write=$recv($globals.OrderedCollection)._new();
  8954. $self.readIndex=(1);
  8955. return self;
  8956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8957. }, function($ctx1) {$ctx1.fill(self,"initialize",{})});
  8958. //>>excludeEnd("ctx");
  8959. }; }),
  8960. $globals.Queue);
  8961. $core.addMethod(
  8962. $core.method({
  8963. selector: "next",
  8964. protocol: "accessing",
  8965. //>>excludeStart("ide", pragmas.excludeIdeData);
  8966. args: [],
  8967. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8968. referencedClasses: [],
  8969. //>>excludeEnd("ide");
  8970. pragmas: [],
  8971. messageSends: ["nextIfAbsent:", "error:"]
  8972. }, function ($methodClass){ return function (){
  8973. var self=this,$self=this;
  8974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8975. return $core.withContext(function($ctx1) {
  8976. //>>excludeEnd("ctx");
  8977. return $self._nextIfAbsent_((function(){
  8978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8979. return $core.withContext(function($ctx2) {
  8980. //>>excludeEnd("ctx");
  8981. return $self._error_("Cannot read from empty Queue.");
  8982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8984. //>>excludeEnd("ctx");
  8985. }));
  8986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8987. }, function($ctx1) {$ctx1.fill(self,"next",{})});
  8988. //>>excludeEnd("ctx");
  8989. }; }),
  8990. $globals.Queue);
  8991. $core.addMethod(
  8992. $core.method({
  8993. selector: "nextIfAbsent:",
  8994. protocol: "accessing",
  8995. //>>excludeStart("ide", pragmas.excludeIdeData);
  8996. args: ["aBlock"],
  8997. 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",
  8998. referencedClasses: ["OrderedCollection"],
  8999. //>>excludeEnd("ide");
  9000. pragmas: [],
  9001. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9002. }, function ($methodClass){ return function (aBlock){
  9003. var self=this,$self=this;
  9004. var result;
  9005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9006. return $core.withContext(function($ctx1) {
  9007. //>>excludeEnd("ctx");
  9008. var $early={};
  9009. try {
  9010. result=$recv($self.read)._at_ifAbsent_($self.readIndex,(function(){
  9011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9012. return $core.withContext(function($ctx2) {
  9013. //>>excludeEnd("ctx");
  9014. $recv($self.write)._ifEmpty_((function(){
  9015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9016. return $core.withContext(function($ctx3) {
  9017. //>>excludeEnd("ctx");
  9018. if($core.assert($recv($self.readIndex).__gt((1)))){
  9019. $self.read=[];
  9020. $self.readIndex=(1);
  9021. $self.readIndex;
  9022. }
  9023. throw $early=[$recv(aBlock)._value()];
  9024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9025. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9026. //>>excludeEnd("ctx");
  9027. }));
  9028. $self.read=$self.write;
  9029. $self.readIndex=(1);
  9030. $self.write=$recv($globals.OrderedCollection)._new();
  9031. return $recv($self.read)._first();
  9032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9034. //>>excludeEnd("ctx");
  9035. }));
  9036. $recv($self.read)._at_put_($self.readIndex,nil);
  9037. $self.readIndex=$recv($self.readIndex).__plus((1));
  9038. return result;
  9039. }
  9040. catch(e) {if(e===$early)return e[0]; throw e}
  9041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9042. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result})});
  9043. //>>excludeEnd("ctx");
  9044. }; }),
  9045. $globals.Queue);
  9046. $core.addMethod(
  9047. $core.method({
  9048. selector: "nextPut:",
  9049. protocol: "accessing",
  9050. //>>excludeStart("ide", pragmas.excludeIdeData);
  9051. args: ["anObject"],
  9052. source: "nextPut: anObject\x0a\x09write add: anObject",
  9053. referencedClasses: [],
  9054. //>>excludeEnd("ide");
  9055. pragmas: [],
  9056. messageSends: ["add:"]
  9057. }, function ($methodClass){ return function (anObject){
  9058. var self=this,$self=this;
  9059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9060. return $core.withContext(function($ctx1) {
  9061. //>>excludeEnd("ctx");
  9062. $recv($self.write)._add_(anObject);
  9063. return self;
  9064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9065. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject})});
  9066. //>>excludeEnd("ctx");
  9067. }; }),
  9068. $globals.Queue);
  9069. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9070. //>>excludeStart("ide", pragmas.excludeIdeData);
  9071. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9072. //>>excludeEnd("ide");
  9073. $core.addMethod(
  9074. $core.method({
  9075. selector: "compile:",
  9076. protocol: "evaluating",
  9077. //>>excludeStart("ide", pragmas.excludeIdeData);
  9078. args: ["aString"],
  9079. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9080. referencedClasses: [],
  9081. //>>excludeEnd("ide");
  9082. pragmas: [["inlineJS:", ["return self.compile(aString)"]]],
  9083. messageSends: []
  9084. }, function ($methodClass){ return function (aString){
  9085. var self=this,$self=this;
  9086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9087. return $core.withContext(function($ctx1) {
  9088. //>>excludeEnd("ctx");
  9089. return self.compile(aString);
  9090. return self;
  9091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9092. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString})});
  9093. //>>excludeEnd("ctx");
  9094. }; }),
  9095. $globals.RegularExpression);
  9096. $core.addMethod(
  9097. $core.method({
  9098. selector: "exec:",
  9099. protocol: "evaluating",
  9100. //>>excludeStart("ide", pragmas.excludeIdeData);
  9101. args: ["aString"],
  9102. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9103. referencedClasses: [],
  9104. //>>excludeEnd("ide");
  9105. pragmas: [["inlineJS:", ["return self.exec(aString) || nil"]]],
  9106. messageSends: []
  9107. }, function ($methodClass){ return function (aString){
  9108. var self=this,$self=this;
  9109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9110. return $core.withContext(function($ctx1) {
  9111. //>>excludeEnd("ctx");
  9112. return self.exec(aString) || nil;
  9113. return self;
  9114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9115. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString})});
  9116. //>>excludeEnd("ctx");
  9117. }; }),
  9118. $globals.RegularExpression);
  9119. $core.addMethod(
  9120. $core.method({
  9121. selector: "test:",
  9122. protocol: "evaluating",
  9123. //>>excludeStart("ide", pragmas.excludeIdeData);
  9124. args: ["aString"],
  9125. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9126. referencedClasses: [],
  9127. //>>excludeEnd("ide");
  9128. pragmas: [["inlineJS:", ["return self.test(aString)"]]],
  9129. messageSends: []
  9130. }, function ($methodClass){ return function (aString){
  9131. var self=this,$self=this;
  9132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9133. return $core.withContext(function($ctx1) {
  9134. //>>excludeEnd("ctx");
  9135. return self.test(aString);
  9136. return self;
  9137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9138. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString})});
  9139. //>>excludeEnd("ctx");
  9140. }; }),
  9141. $globals.RegularExpression);
  9142. $core.addMethod(
  9143. $core.method({
  9144. selector: "fromString:",
  9145. protocol: "instance creation",
  9146. //>>excludeStart("ide", pragmas.excludeIdeData);
  9147. args: ["aString"],
  9148. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9149. referencedClasses: [],
  9150. //>>excludeEnd("ide");
  9151. pragmas: [],
  9152. messageSends: ["fromString:flag:"]
  9153. }, function ($methodClass){ return function (aString){
  9154. var self=this,$self=this;
  9155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9156. return $core.withContext(function($ctx1) {
  9157. //>>excludeEnd("ctx");
  9158. return $self._fromString_flag_(aString,"");
  9159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9160. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString})});
  9161. //>>excludeEnd("ctx");
  9162. }; }),
  9163. $globals.RegularExpression.a$cls);
  9164. $core.addMethod(
  9165. $core.method({
  9166. selector: "fromString:flag:",
  9167. protocol: "instance creation",
  9168. //>>excludeStart("ide", pragmas.excludeIdeData);
  9169. args: ["aString", "anotherString"],
  9170. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9171. referencedClasses: [],
  9172. //>>excludeEnd("ide");
  9173. pragmas: [["inlineJS:", ["return new RegExp(aString, anotherString)"]]],
  9174. messageSends: []
  9175. }, function ($methodClass){ return function (aString,anotherString){
  9176. var self=this,$self=this;
  9177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9178. return $core.withContext(function($ctx1) {
  9179. //>>excludeEnd("ctx");
  9180. return new RegExp(aString, anotherString);
  9181. return self;
  9182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9183. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString})});
  9184. //>>excludeEnd("ctx");
  9185. }; }),
  9186. $globals.RegularExpression.a$cls);
  9187. $core.addTrait("TKeyValueCollection", "Kernel-Collections");
  9188. $core.addMethod(
  9189. $core.method({
  9190. selector: "at:",
  9191. protocol: "accessing",
  9192. //>>excludeStart("ide", pragmas.excludeIdeData);
  9193. args: ["anIndex"],
  9194. 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 ]",
  9195. referencedClasses: [],
  9196. //>>excludeEnd("ide");
  9197. pragmas: [],
  9198. messageSends: ["at:ifAbsent:", "errorNotFound"]
  9199. }, function ($methodClass){ return function (anIndex){
  9200. var self=this,$self=this;
  9201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9202. return $core.withContext(function($ctx1) {
  9203. //>>excludeEnd("ctx");
  9204. return $self._at_ifAbsent_(anIndex,(function(){
  9205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9206. return $core.withContext(function($ctx2) {
  9207. //>>excludeEnd("ctx");
  9208. return $self._errorNotFound();
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9211. //>>excludeEnd("ctx");
  9212. }));
  9213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9214. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex})});
  9215. //>>excludeEnd("ctx");
  9216. }; }),
  9217. $globals.TKeyValueCollection);
  9218. $core.addMethod(
  9219. $core.method({
  9220. selector: "at:ifAbsent:",
  9221. protocol: "accessing",
  9222. //>>excludeStart("ide", pragmas.excludeIdeData);
  9223. args: ["anIndex", "aBlock"],
  9224. 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",
  9225. referencedClasses: [],
  9226. //>>excludeEnd("ide");
  9227. pragmas: [],
  9228. messageSends: ["subclassResponsibility"]
  9229. }, function ($methodClass){ return function (anIndex,aBlock){
  9230. var self=this,$self=this;
  9231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9232. return $core.withContext(function($ctx1) {
  9233. //>>excludeEnd("ctx");
  9234. $self._subclassResponsibility();
  9235. return self;
  9236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9237. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9238. //>>excludeEnd("ctx");
  9239. }; }),
  9240. $globals.TKeyValueCollection);
  9241. $core.addMethod(
  9242. $core.method({
  9243. selector: "at:ifAbsentPut:",
  9244. protocol: "accessing",
  9245. //>>excludeStart("ide", pragmas.excludeIdeData);
  9246. args: ["aKey", "aBlock"],
  9247. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  9248. referencedClasses: [],
  9249. //>>excludeEnd("ide");
  9250. pragmas: [],
  9251. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  9252. }, function ($methodClass){ return function (aKey,aBlock){
  9253. var self=this,$self=this;
  9254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9255. return $core.withContext(function($ctx1) {
  9256. //>>excludeEnd("ctx");
  9257. return $self._at_ifAbsent_(aKey,(function(){
  9258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9259. return $core.withContext(function($ctx2) {
  9260. //>>excludeEnd("ctx");
  9261. return $self._at_put_(aKey,$recv(aBlock)._value());
  9262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9263. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9264. //>>excludeEnd("ctx");
  9265. }));
  9266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9267. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock})});
  9268. //>>excludeEnd("ctx");
  9269. }; }),
  9270. $globals.TKeyValueCollection);
  9271. $core.addMethod(
  9272. $core.method({
  9273. selector: "at:ifPresent:",
  9274. protocol: "accessing",
  9275. //>>excludeStart("ide", pragmas.excludeIdeData);
  9276. args: ["anIndex", "aBlock"],
  9277. 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 ]",
  9278. referencedClasses: [],
  9279. //>>excludeEnd("ide");
  9280. pragmas: [],
  9281. messageSends: ["at:ifPresent:ifAbsent:"]
  9282. }, function ($methodClass){ return function (anIndex,aBlock){
  9283. var self=this,$self=this;
  9284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9285. return $core.withContext(function($ctx1) {
  9286. //>>excludeEnd("ctx");
  9287. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  9288. return nil;
  9289. }));
  9290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9291. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock})});
  9292. //>>excludeEnd("ctx");
  9293. }; }),
  9294. $globals.TKeyValueCollection);
  9295. $core.addMethod(
  9296. $core.method({
  9297. selector: "at:ifPresent:ifAbsent:",
  9298. protocol: "accessing",
  9299. //>>excludeStart("ide", pragmas.excludeIdeData);
  9300. args: ["anIndex", "aBlock", "anotherBlock"],
  9301. 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",
  9302. referencedClasses: [],
  9303. //>>excludeEnd("ide");
  9304. pragmas: [],
  9305. messageSends: ["subclassResponsibility"]
  9306. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9307. var self=this,$self=this;
  9308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9309. return $core.withContext(function($ctx1) {
  9310. //>>excludeEnd("ctx");
  9311. $self._subclassResponsibility();
  9312. return self;
  9313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9314. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9315. //>>excludeEnd("ctx");
  9316. }; }),
  9317. $globals.TKeyValueCollection);
  9318. $core.addMethod(
  9319. $core.method({
  9320. selector: "at:put:",
  9321. protocol: "accessing",
  9322. //>>excludeStart("ide", pragmas.excludeIdeData);
  9323. args: ["anIndex", "anObject"],
  9324. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  9325. referencedClasses: [],
  9326. //>>excludeEnd("ide");
  9327. pragmas: [],
  9328. messageSends: ["subclassResponsibility"]
  9329. }, function ($methodClass){ return function (anIndex,anObject){
  9330. var self=this,$self=this;
  9331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9332. return $core.withContext(function($ctx1) {
  9333. //>>excludeEnd("ctx");
  9334. $self._subclassResponsibility();
  9335. return self;
  9336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9337. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject})});
  9338. //>>excludeEnd("ctx");
  9339. }; }),
  9340. $globals.TKeyValueCollection);
  9341. $core.addMethod(
  9342. $core.method({
  9343. selector: "indexOf:",
  9344. protocol: "accessing",
  9345. //>>excludeStart("ide", pragmas.excludeIdeData);
  9346. args: ["anObject"],
  9347. 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 ]",
  9348. referencedClasses: [],
  9349. //>>excludeEnd("ide");
  9350. pragmas: [],
  9351. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  9352. }, function ($methodClass){ return function (anObject){
  9353. var self=this,$self=this;
  9354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9355. return $core.withContext(function($ctx1) {
  9356. //>>excludeEnd("ctx");
  9357. return $self._indexOf_ifAbsent_(anObject,(function(){
  9358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9359. return $core.withContext(function($ctx2) {
  9360. //>>excludeEnd("ctx");
  9361. return $self._errorNotFound();
  9362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9364. //>>excludeEnd("ctx");
  9365. }));
  9366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9367. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject})});
  9368. //>>excludeEnd("ctx");
  9369. }; }),
  9370. $globals.TKeyValueCollection);
  9371. $core.addMethod(
  9372. $core.method({
  9373. selector: "indexOf:ifAbsent:",
  9374. protocol: "accessing",
  9375. //>>excludeStart("ide", pragmas.excludeIdeData);
  9376. args: ["anObject", "aBlock"],
  9377. 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",
  9378. referencedClasses: [],
  9379. //>>excludeEnd("ide");
  9380. pragmas: [],
  9381. messageSends: ["subclassResponsibility"]
  9382. }, function ($methodClass){ return function (anObject,aBlock){
  9383. var self=this,$self=this;
  9384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9385. return $core.withContext(function($ctx1) {
  9386. //>>excludeEnd("ctx");
  9387. $self._subclassResponsibility();
  9388. return self;
  9389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9390. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9391. //>>excludeEnd("ctx");
  9392. }; }),
  9393. $globals.TKeyValueCollection);
  9394. $core.addMethod(
  9395. $core.method({
  9396. selector: "with:do:",
  9397. protocol: "enumerating",
  9398. //>>excludeStart("ide", pragmas.excludeIdeData);
  9399. args: ["anotherCollection", "aBlock"],
  9400. 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) ]",
  9401. referencedClasses: [],
  9402. //>>excludeEnd("ide");
  9403. pragmas: [],
  9404. messageSends: ["withIndexDo:", "value:value:", "at:"]
  9405. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9406. var self=this,$self=this;
  9407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9408. return $core.withContext(function($ctx1) {
  9409. //>>excludeEnd("ctx");
  9410. $self._withIndexDo_((function(each,index){
  9411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9412. return $core.withContext(function($ctx2) {
  9413. //>>excludeEnd("ctx");
  9414. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  9415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9416. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  9417. //>>excludeEnd("ctx");
  9418. }));
  9419. return self;
  9420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9421. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9422. //>>excludeEnd("ctx");
  9423. }; }),
  9424. $globals.TKeyValueCollection);
  9425. $core.addMethod(
  9426. $core.method({
  9427. selector: "withIndexDo:",
  9428. protocol: "enumerating",
  9429. //>>excludeStart("ide", pragmas.excludeIdeData);
  9430. args: ["aBlock"],
  9431. 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",
  9432. referencedClasses: [],
  9433. //>>excludeEnd("ide");
  9434. pragmas: [],
  9435. messageSends: ["subclassResponsibility"]
  9436. }, function ($methodClass){ return function (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,"withIndexDo:",{aBlock:aBlock})});
  9445. //>>excludeEnd("ctx");
  9446. }; }),
  9447. $globals.TKeyValueCollection);
  9448. $core.addTrait("TNativeZeroBasedCollection", "Kernel-Collections");
  9449. $core.addMethod(
  9450. $core.method({
  9451. selector: "at:ifAbsent:",
  9452. protocol: "accessing",
  9453. //>>excludeStart("ide", pragmas.excludeIdeData);
  9454. args: ["anIndex", "aBlock"],
  9455. 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'>",
  9456. referencedClasses: [],
  9457. //>>excludeEnd("ide");
  9458. 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"]]],
  9459. messageSends: []
  9460. }, function ($methodClass){ return function (anIndex,aBlock){
  9461. var self=this,$self=this;
  9462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9463. return $core.withContext(function($ctx1) {
  9464. //>>excludeEnd("ctx");
  9465. return anIndex >= 1 && anIndex <= self.length
  9466. ? self[anIndex - 1]
  9467. : aBlock._value()
  9468. ;
  9469. return self;
  9470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9471. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock})});
  9472. //>>excludeEnd("ctx");
  9473. }; }),
  9474. $globals.TNativeZeroBasedCollection);
  9475. $core.addMethod(
  9476. $core.method({
  9477. selector: "at:ifPresent:ifAbsent:",
  9478. protocol: "accessing",
  9479. //>>excludeStart("ide", pragmas.excludeIdeData);
  9480. args: ["anIndex", "aBlock", "anotherBlock"],
  9481. 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'>",
  9482. referencedClasses: [],
  9483. //>>excludeEnd("ide");
  9484. 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"]]],
  9485. messageSends: []
  9486. }, function ($methodClass){ return function (anIndex,aBlock,anotherBlock){
  9487. var self=this,$self=this;
  9488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9489. return $core.withContext(function($ctx1) {
  9490. //>>excludeEnd("ctx");
  9491. return anIndex >= 1 && anIndex <= self.length
  9492. ? aBlock._value_(self[anIndex - 1])
  9493. : anotherBlock._value()
  9494. ;
  9495. return self;
  9496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9497. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock})});
  9498. //>>excludeEnd("ctx");
  9499. }; }),
  9500. $globals.TNativeZeroBasedCollection);
  9501. $core.addMethod(
  9502. $core.method({
  9503. selector: "detect:ifNone:",
  9504. protocol: "enumerating",
  9505. //>>excludeStart("ide", pragmas.excludeIdeData);
  9506. args: ["aBlock", "anotherBlock"],
  9507. 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'>",
  9508. referencedClasses: [],
  9509. //>>excludeEnd("ide");
  9510. 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"]]],
  9511. messageSends: []
  9512. }, function ($methodClass){ return function (aBlock,anotherBlock){
  9513. var self=this,$self=this;
  9514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9515. return $core.withContext(function($ctx1) {
  9516. //>>excludeEnd("ctx");
  9517. for(var i = 0; i < self.length; i++)
  9518. if(aBlock._value_(self[i]))
  9519. return self[i];
  9520. return anotherBlock._value();
  9521. ;
  9522. return self;
  9523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9524. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock})});
  9525. //>>excludeEnd("ctx");
  9526. }; }),
  9527. $globals.TNativeZeroBasedCollection);
  9528. $core.addMethod(
  9529. $core.method({
  9530. selector: "do:",
  9531. protocol: "enumerating",
  9532. //>>excludeStart("ide", pragmas.excludeIdeData);
  9533. args: ["aBlock"],
  9534. 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'>",
  9535. referencedClasses: [],
  9536. //>>excludeEnd("ide");
  9537. pragmas: [["inlineJS:", ["\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09"]]],
  9538. messageSends: []
  9539. }, function ($methodClass){ return function (aBlock){
  9540. var self=this,$self=this;
  9541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9542. return $core.withContext(function($ctx1) {
  9543. //>>excludeEnd("ctx");
  9544. for(var i=0; i < self.length; i++) {
  9545. aBlock._value_(self[i]);
  9546. }
  9547. ;
  9548. return self;
  9549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9550. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock})});
  9551. //>>excludeEnd("ctx");
  9552. }; }),
  9553. $globals.TNativeZeroBasedCollection);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "indexOf:ifAbsent:",
  9557. protocol: "accessing",
  9558. //>>excludeStart("ide", pragmas.excludeIdeData);
  9559. args: ["anObject", "aBlock"],
  9560. 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'>",
  9561. referencedClasses: [],
  9562. //>>excludeEnd("ide");
  9563. 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"]]],
  9564. messageSends: []
  9565. }, function ($methodClass){ return function (anObject,aBlock){
  9566. var self=this,$self=this;
  9567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9568. return $core.withContext(function($ctx1) {
  9569. //>>excludeEnd("ctx");
  9570. for(var i=0; i < self.length; i++) {
  9571. if($recv(self[i]).__eq(anObject)) {return i+1}
  9572. };
  9573. return aBlock._value();
  9574. ;
  9575. return self;
  9576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9577. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock})});
  9578. //>>excludeEnd("ctx");
  9579. }; }),
  9580. $globals.TNativeZeroBasedCollection);
  9581. $core.addMethod(
  9582. $core.method({
  9583. selector: "indexOf:startingAt:ifAbsent:",
  9584. protocol: "accessing",
  9585. //>>excludeStart("ide", pragmas.excludeIdeData);
  9586. args: ["anObject", "start", "aBlock"],
  9587. 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'>",
  9588. referencedClasses: [],
  9589. //>>excludeEnd("ide");
  9590. 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"]]],
  9591. messageSends: []
  9592. }, function ($methodClass){ return function (anObject,start,aBlock){
  9593. var self=this,$self=this;
  9594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9595. return $core.withContext(function($ctx1) {
  9596. //>>excludeEnd("ctx");
  9597. for(var i=start - 1; i < self.length; i++){
  9598. if($recv(self[i]).__eq(anObject)) {return i+1}
  9599. }
  9600. return aBlock._value();
  9601. ;
  9602. return self;
  9603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9604. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock})});
  9605. //>>excludeEnd("ctx");
  9606. }; }),
  9607. $globals.TNativeZeroBasedCollection);
  9608. $core.addMethod(
  9609. $core.method({
  9610. selector: "single",
  9611. protocol: "accessing",
  9612. //>>excludeStart("ide", pragmas.excludeIdeData);
  9613. args: [],
  9614. 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'>",
  9615. referencedClasses: [],
  9616. //>>excludeEnd("ide");
  9617. 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];"]]],
  9618. messageSends: []
  9619. }, function ($methodClass){ return function (){
  9620. var self=this,$self=this;
  9621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9622. return $core.withContext(function($ctx1) {
  9623. //>>excludeEnd("ctx");
  9624. if (self.length == 0) throw new Error("Collection is empty");
  9625. if (self.length > 1) throw new Error("Collection holds more than one element.");
  9626. return self[0];;
  9627. return self;
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. }, function($ctx1) {$ctx1.fill(self,"single",{})});
  9630. //>>excludeEnd("ctx");
  9631. }; }),
  9632. $globals.TNativeZeroBasedCollection);
  9633. $core.addMethod(
  9634. $core.method({
  9635. selector: "size",
  9636. protocol: "accessing",
  9637. //>>excludeStart("ide", pragmas.excludeIdeData);
  9638. args: [],
  9639. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  9640. referencedClasses: [],
  9641. //>>excludeEnd("ide");
  9642. pragmas: [["inlineJS:", ["return self.length"]]],
  9643. messageSends: []
  9644. }, function ($methodClass){ return function (){
  9645. var self=this,$self=this;
  9646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9647. return $core.withContext(function($ctx1) {
  9648. //>>excludeEnd("ctx");
  9649. return self.length;
  9650. return self;
  9651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9652. }, function($ctx1) {$ctx1.fill(self,"size",{})});
  9653. //>>excludeEnd("ctx");
  9654. }; }),
  9655. $globals.TNativeZeroBasedCollection);
  9656. $core.addMethod(
  9657. $core.method({
  9658. selector: "with:do:",
  9659. protocol: "enumerating",
  9660. //>>excludeStart("ide", pragmas.excludeIdeData);
  9661. args: ["anotherCollection", "aBlock"],
  9662. 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'>",
  9663. referencedClasses: [],
  9664. //>>excludeEnd("ide");
  9665. 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"]]],
  9666. messageSends: []
  9667. }, function ($methodClass){ return function (anotherCollection,aBlock){
  9668. var self=this,$self=this;
  9669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9670. return $core.withContext(function($ctx1) {
  9671. //>>excludeEnd("ctx");
  9672. $recv(anotherCollection)._first_(0); // #guardSequenceableCollection
  9673. for(var i=0; i<self.length; i++) {
  9674. aBlock._value_value_(self[i], anotherCollection[i]);
  9675. }
  9676. ;
  9677. return self;
  9678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9679. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock})});
  9680. //>>excludeEnd("ctx");
  9681. }; }),
  9682. $globals.TNativeZeroBasedCollection);
  9683. $core.addMethod(
  9684. $core.method({
  9685. selector: "withIndexDo:",
  9686. protocol: "enumerating",
  9687. //>>excludeStart("ide", pragmas.excludeIdeData);
  9688. args: ["aBlock"],
  9689. 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'>",
  9690. referencedClasses: [],
  9691. //>>excludeEnd("ide");
  9692. 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"]]],
  9693. messageSends: []
  9694. }, function ($methodClass){ return function (aBlock){
  9695. var self=this,$self=this;
  9696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9697. return $core.withContext(function($ctx1) {
  9698. //>>excludeEnd("ctx");
  9699. for(var i=0; i < self.length; i++) {
  9700. aBlock._value_value_(self[i], i+1);
  9701. }
  9702. ;
  9703. return self;
  9704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9705. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock})});
  9706. //>>excludeEnd("ctx");
  9707. }; }),
  9708. $globals.TNativeZeroBasedCollection);
  9709. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.AssociativeCollection);
  9710. $core.setTraitComposition([{trait: $globals.TKeyValueCollection}], $globals.SequenceableCollection);
  9711. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.Array);
  9712. $core.setTraitComposition([{trait: $globals.TNativeZeroBasedCollection}], $globals.String);
  9713. });