Kernel-Collections.js 328 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282
  1. define(["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. if(!$boot.nilAsReceiver)$boot.nilAsReceiver=$boot.nil;
  3. var $core=$boot.api,nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  4. if(!$boot.nilAsClass)$boot.nilAsClass=$boot.dnu;
  5. $core.addPackage("Kernel-Collections");
  6. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  8. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  9. //>>excludeStart("ide", pragmas.excludeIdeData);
  10. $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:`";
  11. //>>excludeEnd("ide");
  12. $core.addMethod(
  13. $core.method({
  14. selector: "=",
  15. protocol: "comparing",
  16. fn: function (anAssociation){
  17. var self=this;
  18. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  19. return $core.withContext(function($ctx1) {
  20. //>>excludeEnd("ctx");
  21. var $3,$2,$5,$4,$6,$1;
  22. $3=self._class();
  23. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  24. $ctx1.sendIdx["class"]=1;
  25. //>>excludeEnd("ctx");
  26. $2=$recv($3).__eq($recv(anAssociation)._class());
  27. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  28. $ctx1.sendIdx["="]=1;
  29. //>>excludeEnd("ctx");
  30. $1=$recv($2)._and_((function(){
  31. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  32. return $core.withContext(function($ctx2) {
  33. //>>excludeEnd("ctx");
  34. $5=self._key();
  35. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  36. $ctx2.sendIdx["key"]=1;
  37. //>>excludeEnd("ctx");
  38. $4=$recv($5).__eq($recv(anAssociation)._key());
  39. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  40. $ctx2.sendIdx["="]=2;
  41. //>>excludeEnd("ctx");
  42. return $recv($4)._and_((function(){
  43. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  44. return $core.withContext(function($ctx3) {
  45. //>>excludeEnd("ctx");
  46. $6=self._value();
  47. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  48. $ctx3.sendIdx["value"]=1;
  49. //>>excludeEnd("ctx");
  50. return $recv($6).__eq($recv(anAssociation)._value());
  51. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  52. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53. //>>excludeEnd("ctx");
  54. }));
  55. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  56. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57. //>>excludeEnd("ctx");
  58. }));
  59. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  60. $ctx1.sendIdx["and:"]=1;
  61. //>>excludeEnd("ctx");
  62. return $1;
  63. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  64. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  65. //>>excludeEnd("ctx");
  66. },
  67. //>>excludeStart("ide", pragmas.excludeIdeData);
  68. args: ["anAssociation"],
  69. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  70. referencedClasses: [],
  71. //>>excludeEnd("ide");
  72. messageSends: ["and:", "=", "class", "key", "value"]
  73. }),
  74. $globals.Association);
  75. $core.addMethod(
  76. $core.method({
  77. selector: "key",
  78. protocol: "accessing",
  79. fn: function (){
  80. var self=this;
  81. return self["@key"];
  82. },
  83. //>>excludeStart("ide", pragmas.excludeIdeData);
  84. args: [],
  85. source: "key\x0a\x09^ key",
  86. referencedClasses: [],
  87. //>>excludeEnd("ide");
  88. messageSends: []
  89. }),
  90. $globals.Association);
  91. $core.addMethod(
  92. $core.method({
  93. selector: "key:",
  94. protocol: "accessing",
  95. fn: function (aKey){
  96. var self=this;
  97. self["@key"]=aKey;
  98. return self;
  99. },
  100. //>>excludeStart("ide", pragmas.excludeIdeData);
  101. args: ["aKey"],
  102. source: "key: aKey\x0a\x09key := aKey",
  103. referencedClasses: [],
  104. //>>excludeEnd("ide");
  105. messageSends: []
  106. }),
  107. $globals.Association);
  108. $core.addMethod(
  109. $core.method({
  110. selector: "printOn:",
  111. protocol: "printing",
  112. fn: function (aStream){
  113. var self=this;
  114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  115. return $core.withContext(function($ctx1) {
  116. //>>excludeEnd("ctx");
  117. $recv(self._key())._printOn_(aStream);
  118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  119. $ctx1.sendIdx["printOn:"]=1;
  120. //>>excludeEnd("ctx");
  121. $recv(aStream)._nextPutAll_(" -> ");
  122. $recv(self._value())._printOn_(aStream);
  123. return self;
  124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  125. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  126. //>>excludeEnd("ctx");
  127. },
  128. //>>excludeStart("ide", pragmas.excludeIdeData);
  129. args: ["aStream"],
  130. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  131. referencedClasses: [],
  132. //>>excludeEnd("ide");
  133. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  134. }),
  135. $globals.Association);
  136. $core.addMethod(
  137. $core.method({
  138. selector: "value",
  139. protocol: "accessing",
  140. fn: function (){
  141. var self=this;
  142. return self["@value"];
  143. },
  144. //>>excludeStart("ide", pragmas.excludeIdeData);
  145. args: [],
  146. source: "value\x0a\x09^ value",
  147. referencedClasses: [],
  148. //>>excludeEnd("ide");
  149. messageSends: []
  150. }),
  151. $globals.Association);
  152. $core.addMethod(
  153. $core.method({
  154. selector: "value:",
  155. protocol: "accessing",
  156. fn: function (aValue){
  157. var self=this;
  158. self["@value"]=aValue;
  159. return self;
  160. },
  161. //>>excludeStart("ide", pragmas.excludeIdeData);
  162. args: ["aValue"],
  163. source: "value: aValue\x0a\x09value := aValue",
  164. referencedClasses: [],
  165. //>>excludeEnd("ide");
  166. messageSends: []
  167. }),
  168. $globals.Association);
  169. $core.addMethod(
  170. $core.method({
  171. selector: "key:value:",
  172. protocol: "instance creation",
  173. fn: function (aKey,aValue){
  174. var self=this;
  175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  176. return $core.withContext(function($ctx1) {
  177. //>>excludeEnd("ctx");
  178. var $1;
  179. $1=self._new();
  180. $recv($1)._key_(aKey);
  181. $recv($1)._value_(aValue);
  182. return $recv($1)._yourself();
  183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  184. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  185. //>>excludeEnd("ctx");
  186. },
  187. //>>excludeStart("ide", pragmas.excludeIdeData);
  188. args: ["aKey", "aValue"],
  189. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  190. referencedClasses: [],
  191. //>>excludeEnd("ide");
  192. messageSends: ["key:", "new", "value:", "yourself"]
  193. }),
  194. $globals.Association.klass);
  195. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  196. //>>excludeStart("ide", pragmas.excludeIdeData);
  197. $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`.";
  198. //>>excludeEnd("ide");
  199. $core.addMethod(
  200. $core.method({
  201. selector: "bucketOfElement:",
  202. protocol: "accessing",
  203. fn: function (anObject){
  204. var self=this;
  205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  206. return $core.withContext(function($ctx1) {
  207. //>>excludeEnd("ctx");
  208. var hash = self['@hashBlock'](anObject);
  209. if (!hash) return null;
  210. var buckets = self['@buckets'],
  211. bucket = buckets[hash];
  212. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  213. return bucket;
  214. ;
  215. return self;
  216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  217. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  218. //>>excludeEnd("ctx");
  219. },
  220. //>>excludeStart("ide", pragmas.excludeIdeData);
  221. args: ["anObject"],
  222. 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'>",
  223. referencedClasses: [],
  224. //>>excludeEnd("ide");
  225. messageSends: []
  226. }),
  227. $globals.BucketStore);
  228. $core.addMethod(
  229. $core.method({
  230. selector: "do:",
  231. protocol: "enumerating",
  232. fn: function (aBlock){
  233. var self=this;
  234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  235. return $core.withContext(function($ctx1) {
  236. //>>excludeEnd("ctx");
  237. var buckets = self['@buckets'];
  238. var keys = Object.keys(buckets);
  239. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  240. ;
  241. return self;
  242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  243. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  244. //>>excludeEnd("ctx");
  245. },
  246. //>>excludeStart("ide", pragmas.excludeIdeData);
  247. args: ["aBlock"],
  248. 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'>",
  249. referencedClasses: [],
  250. //>>excludeEnd("ide");
  251. messageSends: []
  252. }),
  253. $globals.BucketStore);
  254. $core.addMethod(
  255. $core.method({
  256. selector: "hashBlock:",
  257. protocol: "accessing",
  258. fn: function (aBlock){
  259. var self=this;
  260. self["@hashBlock"]=aBlock;
  261. return self;
  262. },
  263. //>>excludeStart("ide", pragmas.excludeIdeData);
  264. args: ["aBlock"],
  265. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  266. referencedClasses: [],
  267. //>>excludeEnd("ide");
  268. messageSends: []
  269. }),
  270. $globals.BucketStore);
  271. $core.addMethod(
  272. $core.method({
  273. selector: "initialize",
  274. protocol: "initialization",
  275. fn: function (){
  276. var self=this;
  277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  278. return $core.withContext(function($ctx1) {
  279. //>>excludeEnd("ctx");
  280. (
  281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  282. $ctx1.supercall = true,
  283. //>>excludeEnd("ctx");
  284. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  286. $ctx1.supercall = false;
  287. //>>excludeEnd("ctx");;
  288. self._removeAll();
  289. return self;
  290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  291. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  292. //>>excludeEnd("ctx");
  293. },
  294. //>>excludeStart("ide", pragmas.excludeIdeData);
  295. args: [],
  296. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  297. referencedClasses: [],
  298. //>>excludeEnd("ide");
  299. messageSends: ["initialize", "removeAll"]
  300. }),
  301. $globals.BucketStore);
  302. $core.addMethod(
  303. $core.method({
  304. selector: "newBucket",
  305. protocol: "private",
  306. fn: function (){
  307. var self=this;
  308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  309. return $core.withContext(function($ctx1) {
  310. //>>excludeEnd("ctx");
  311. self._subclassResponsibility();
  312. return self;
  313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  314. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  315. //>>excludeEnd("ctx");
  316. },
  317. //>>excludeStart("ide", pragmas.excludeIdeData);
  318. args: [],
  319. source: "newBucket\x0a\x09self subclassResponsibility",
  320. referencedClasses: [],
  321. //>>excludeEnd("ide");
  322. messageSends: ["subclassResponsibility"]
  323. }),
  324. $globals.BucketStore);
  325. $core.addMethod(
  326. $core.method({
  327. selector: "removeAll",
  328. protocol: "adding/removing",
  329. fn: function (){
  330. var self=this;
  331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  332. return $core.withContext(function($ctx1) {
  333. //>>excludeEnd("ctx");
  334. self['@buckets'] = Object.create(null);;
  335. return self;
  336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  337. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  338. //>>excludeEnd("ctx");
  339. },
  340. //>>excludeStart("ide", pragmas.excludeIdeData);
  341. args: [],
  342. source: "removeAll\x0a\x09<inlineJS: 'self[''@buckets''] = Object.create(null);'>",
  343. referencedClasses: [],
  344. //>>excludeEnd("ide");
  345. messageSends: []
  346. }),
  347. $globals.BucketStore);
  348. $core.addMethod(
  349. $core.method({
  350. selector: "hashBlock:",
  351. protocol: "instance creation",
  352. fn: function (aBlock){
  353. var self=this;
  354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  355. return $core.withContext(function($ctx1) {
  356. //>>excludeEnd("ctx");
  357. var $1;
  358. $1=self._new();
  359. $recv($1)._hashBlock_(aBlock);
  360. return $recv($1)._yourself();
  361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  362. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  363. //>>excludeEnd("ctx");
  364. },
  365. //>>excludeStart("ide", pragmas.excludeIdeData);
  366. args: ["aBlock"],
  367. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  368. referencedClasses: [],
  369. //>>excludeEnd("ide");
  370. messageSends: ["hashBlock:", "new", "yourself"]
  371. }),
  372. $globals.BucketStore.klass);
  373. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  374. //>>excludeStart("ide", pragmas.excludeIdeData);
  375. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  376. //>>excludeEnd("ide");
  377. $core.addMethod(
  378. $core.method({
  379. selector: "newBucket",
  380. protocol: "private",
  381. fn: function (){
  382. var self=this;
  383. return [];
  384. },
  385. //>>excludeStart("ide", pragmas.excludeIdeData);
  386. args: [],
  387. source: "newBucket\x0a\x09^ #()",
  388. referencedClasses: [],
  389. //>>excludeEnd("ide");
  390. messageSends: []
  391. }),
  392. $globals.ArrayBucketStore);
  393. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  394. //>>excludeStart("ide", pragmas.excludeIdeData);
  395. $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.";
  396. //>>excludeEnd("ide");
  397. $core.addMethod(
  398. $core.method({
  399. selector: ",",
  400. protocol: "copying",
  401. fn: function (aCollection){
  402. var self=this;
  403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  404. return $core.withContext(function($ctx1) {
  405. //>>excludeEnd("ctx");
  406. var $1;
  407. $1=self._copy();
  408. $recv($1)._addAll_(aCollection);
  409. return $recv($1)._yourself();
  410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  411. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  412. //>>excludeEnd("ctx");
  413. },
  414. //>>excludeStart("ide", pragmas.excludeIdeData);
  415. args: ["aCollection"],
  416. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  417. referencedClasses: [],
  418. //>>excludeEnd("ide");
  419. messageSends: ["addAll:", "copy", "yourself"]
  420. }),
  421. $globals.Collection);
  422. $core.addMethod(
  423. $core.method({
  424. selector: "add:",
  425. protocol: "adding/removing",
  426. fn: function (anObject){
  427. var self=this;
  428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  429. return $core.withContext(function($ctx1) {
  430. //>>excludeEnd("ctx");
  431. self._subclassResponsibility();
  432. return self;
  433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  434. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  435. //>>excludeEnd("ctx");
  436. },
  437. //>>excludeStart("ide", pragmas.excludeIdeData);
  438. args: ["anObject"],
  439. source: "add: anObject\x0a\x09self subclassResponsibility",
  440. referencedClasses: [],
  441. //>>excludeEnd("ide");
  442. messageSends: ["subclassResponsibility"]
  443. }),
  444. $globals.Collection);
  445. $core.addMethod(
  446. $core.method({
  447. selector: "addAll:",
  448. protocol: "adding/removing",
  449. fn: function (aCollection){
  450. var self=this;
  451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  452. return $core.withContext(function($ctx1) {
  453. //>>excludeEnd("ctx");
  454. $recv(aCollection)._do_((function(each){
  455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  456. return $core.withContext(function($ctx2) {
  457. //>>excludeEnd("ctx");
  458. return self._add_(each);
  459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  460. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  461. //>>excludeEnd("ctx");
  462. }));
  463. return aCollection;
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  466. //>>excludeEnd("ctx");
  467. },
  468. //>>excludeStart("ide", pragmas.excludeIdeData);
  469. args: ["aCollection"],
  470. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  471. referencedClasses: [],
  472. //>>excludeEnd("ide");
  473. messageSends: ["do:", "add:"]
  474. }),
  475. $globals.Collection);
  476. $core.addMethod(
  477. $core.method({
  478. selector: "allSatisfy:",
  479. protocol: "enumerating",
  480. fn: function (aBlock){
  481. var self=this;
  482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  483. return $core.withContext(function($ctx1) {
  484. //>>excludeEnd("ctx");
  485. var $1;
  486. var $early={};
  487. try {
  488. self._do_((function(each){
  489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  490. return $core.withContext(function($ctx2) {
  491. //>>excludeEnd("ctx");
  492. $1=$recv(aBlock)._value_(each);
  493. if(!$core.assert($1)){
  494. throw $early=[false];
  495. }
  496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  497. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  498. //>>excludeEnd("ctx");
  499. }));
  500. return true;
  501. }
  502. catch(e) {if(e===$early)return e[0]; throw e}
  503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  504. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  505. //>>excludeEnd("ctx");
  506. },
  507. //>>excludeStart("ide", pragmas.excludeIdeData);
  508. args: ["aBlock"],
  509. 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",
  510. referencedClasses: [],
  511. //>>excludeEnd("ide");
  512. messageSends: ["do:", "ifFalse:", "value:"]
  513. }),
  514. $globals.Collection);
  515. $core.addMethod(
  516. $core.method({
  517. selector: "anyOne",
  518. protocol: "accessing",
  519. fn: function (){
  520. var self=this;
  521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  522. return $core.withContext(function($ctx1) {
  523. //>>excludeEnd("ctx");
  524. var $early={};
  525. try {
  526. self._ifEmpty_((function(){
  527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  528. return $core.withContext(function($ctx2) {
  529. //>>excludeEnd("ctx");
  530. return self._error_("Collection is empty");
  531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  533. //>>excludeEnd("ctx");
  534. }));
  535. self._do_((function(each){
  536. throw $early=[each];
  537. }));
  538. return self;
  539. }
  540. catch(e) {if(e===$early)return e[0]; throw e}
  541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  542. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  543. //>>excludeEnd("ctx");
  544. },
  545. //>>excludeStart("ide", pragmas.excludeIdeData);
  546. args: [],
  547. 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 ]",
  548. referencedClasses: [],
  549. //>>excludeEnd("ide");
  550. messageSends: ["ifEmpty:", "error:", "do:"]
  551. }),
  552. $globals.Collection);
  553. $core.addMethod(
  554. $core.method({
  555. selector: "anySatisfy:",
  556. protocol: "enumerating",
  557. fn: function (aBlock){
  558. var self=this;
  559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  560. return $core.withContext(function($ctx1) {
  561. //>>excludeEnd("ctx");
  562. var $1;
  563. var $early={};
  564. try {
  565. self._do_((function(each){
  566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  567. return $core.withContext(function($ctx2) {
  568. //>>excludeEnd("ctx");
  569. $1=$recv(aBlock)._value_(each);
  570. if($core.assert($1)){
  571. throw $early=[true];
  572. }
  573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  574. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  575. //>>excludeEnd("ctx");
  576. }));
  577. return false;
  578. }
  579. catch(e) {if(e===$early)return e[0]; throw e}
  580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  581. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  582. //>>excludeEnd("ctx");
  583. },
  584. //>>excludeStart("ide", pragmas.excludeIdeData);
  585. args: ["aBlock"],
  586. 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",
  587. referencedClasses: [],
  588. //>>excludeEnd("ide");
  589. messageSends: ["do:", "ifTrue:", "value:"]
  590. }),
  591. $globals.Collection);
  592. $core.addMethod(
  593. $core.method({
  594. selector: "asArray",
  595. protocol: "converting",
  596. fn: function (){
  597. var self=this;
  598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  599. return $core.withContext(function($ctx1) {
  600. //>>excludeEnd("ctx");
  601. return $recv($globals.Array)._withAll_(self);
  602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  603. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  604. //>>excludeEnd("ctx");
  605. },
  606. //>>excludeStart("ide", pragmas.excludeIdeData);
  607. args: [],
  608. source: "asArray\x0a\x09^ Array withAll: self",
  609. referencedClasses: ["Array"],
  610. //>>excludeEnd("ide");
  611. messageSends: ["withAll:"]
  612. }),
  613. $globals.Collection);
  614. $core.addMethod(
  615. $core.method({
  616. selector: "asJSON",
  617. protocol: "converting",
  618. fn: function (){
  619. var self=this;
  620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  621. return $core.withContext(function($ctx1) {
  622. //>>excludeEnd("ctx");
  623. return $recv(self._asArray())._collect_((function(each){
  624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  625. return $core.withContext(function($ctx2) {
  626. //>>excludeEnd("ctx");
  627. return $recv(each)._asJSON();
  628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  630. //>>excludeEnd("ctx");
  631. }));
  632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  633. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  634. //>>excludeEnd("ctx");
  635. },
  636. //>>excludeStart("ide", pragmas.excludeIdeData);
  637. args: [],
  638. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  639. referencedClasses: [],
  640. //>>excludeEnd("ide");
  641. messageSends: ["collect:", "asArray", "asJSON"]
  642. }),
  643. $globals.Collection);
  644. $core.addMethod(
  645. $core.method({
  646. selector: "asOrderedCollection",
  647. protocol: "converting",
  648. fn: function (){
  649. var self=this;
  650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  651. return $core.withContext(function($ctx1) {
  652. //>>excludeEnd("ctx");
  653. return self._asArray();
  654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  655. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  656. //>>excludeEnd("ctx");
  657. },
  658. //>>excludeStart("ide", pragmas.excludeIdeData);
  659. args: [],
  660. source: "asOrderedCollection\x0a\x09^ self asArray",
  661. referencedClasses: [],
  662. //>>excludeEnd("ide");
  663. messageSends: ["asArray"]
  664. }),
  665. $globals.Collection);
  666. $core.addMethod(
  667. $core.method({
  668. selector: "asSet",
  669. protocol: "converting",
  670. fn: function (){
  671. var self=this;
  672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  673. return $core.withContext(function($ctx1) {
  674. //>>excludeEnd("ctx");
  675. return $recv($globals.Set)._withAll_(self);
  676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  677. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  678. //>>excludeEnd("ctx");
  679. },
  680. //>>excludeStart("ide", pragmas.excludeIdeData);
  681. args: [],
  682. source: "asSet\x0a\x09^ Set withAll: self",
  683. referencedClasses: ["Set"],
  684. //>>excludeEnd("ide");
  685. messageSends: ["withAll:"]
  686. }),
  687. $globals.Collection);
  688. $core.addMethod(
  689. $core.method({
  690. selector: "collect:",
  691. protocol: "enumerating",
  692. fn: function (aBlock){
  693. var self=this;
  694. var stream;
  695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  696. return $core.withContext(function($ctx1) {
  697. //>>excludeEnd("ctx");
  698. stream=$recv($recv(self._class())._new())._writeStream();
  699. self._do_((function(each){
  700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  701. return $core.withContext(function($ctx2) {
  702. //>>excludeEnd("ctx");
  703. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  705. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  706. //>>excludeEnd("ctx");
  707. }));
  708. return $recv(stream)._contents();
  709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  710. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  711. //>>excludeEnd("ctx");
  712. },
  713. //>>excludeStart("ide", pragmas.excludeIdeData);
  714. args: ["aBlock"],
  715. 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",
  716. referencedClasses: [],
  717. //>>excludeEnd("ide");
  718. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  719. }),
  720. $globals.Collection);
  721. $core.addMethod(
  722. $core.method({
  723. selector: "copyWith:",
  724. protocol: "copying",
  725. fn: function (anObject){
  726. var self=this;
  727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  728. return $core.withContext(function($ctx1) {
  729. //>>excludeEnd("ctx");
  730. var $1;
  731. $1=self._copy();
  732. $recv($1)._add_(anObject);
  733. return $recv($1)._yourself();
  734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  735. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  736. //>>excludeEnd("ctx");
  737. },
  738. //>>excludeStart("ide", pragmas.excludeIdeData);
  739. args: ["anObject"],
  740. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  741. referencedClasses: [],
  742. //>>excludeEnd("ide");
  743. messageSends: ["add:", "copy", "yourself"]
  744. }),
  745. $globals.Collection);
  746. $core.addMethod(
  747. $core.method({
  748. selector: "copyWithAll:",
  749. protocol: "copying",
  750. fn: function (aCollection){
  751. var self=this;
  752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  753. return $core.withContext(function($ctx1) {
  754. //>>excludeEnd("ctx");
  755. var $1;
  756. $1=self._copy();
  757. $recv($1)._addAll_(aCollection);
  758. return $recv($1)._yourself();
  759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  760. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  761. //>>excludeEnd("ctx");
  762. },
  763. //>>excludeStart("ide", pragmas.excludeIdeData);
  764. args: ["aCollection"],
  765. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  766. referencedClasses: [],
  767. //>>excludeEnd("ide");
  768. messageSends: ["addAll:", "copy", "yourself"]
  769. }),
  770. $globals.Collection);
  771. $core.addMethod(
  772. $core.method({
  773. selector: "copyWithout:",
  774. protocol: "copying",
  775. fn: function (anObject){
  776. var 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},$globals.Collection)});
  791. //>>excludeEnd("ctx");
  792. },
  793. //>>excludeStart("ide", pragmas.excludeIdeData);
  794. args: ["anObject"],
  795. 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 ]",
  796. referencedClasses: [],
  797. //>>excludeEnd("ide");
  798. messageSends: ["reject:", "="]
  799. }),
  800. $globals.Collection);
  801. $core.addMethod(
  802. $core.method({
  803. selector: "copyWithoutAll:",
  804. protocol: "copying",
  805. fn: function (aCollection){
  806. var 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},$globals.Collection)});
  821. //>>excludeEnd("ctx");
  822. },
  823. //>>excludeStart("ide", pragmas.excludeIdeData);
  824. args: ["aCollection"],
  825. 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 ]",
  826. referencedClasses: [],
  827. //>>excludeEnd("ide");
  828. messageSends: ["reject:", "includes:"]
  829. }),
  830. $globals.Collection);
  831. $core.addMethod(
  832. $core.method({
  833. selector: "deepCopy",
  834. protocol: "copying",
  835. fn: function (){
  836. var 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",{},$globals.Collection)});
  851. //>>excludeEnd("ctx");
  852. },
  853. //>>excludeStart("ide", pragmas.excludeIdeData);
  854. args: [],
  855. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  856. referencedClasses: [],
  857. //>>excludeEnd("ide");
  858. messageSends: ["collect:", "deepCopy"]
  859. }),
  860. $globals.Collection);
  861. $core.addMethod(
  862. $core.method({
  863. selector: "detect:",
  864. protocol: "enumerating",
  865. fn: function (aBlock){
  866. var 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},$globals.Collection)});
  881. //>>excludeEnd("ctx");
  882. },
  883. //>>excludeStart("ide", pragmas.excludeIdeData);
  884. args: ["aBlock"],
  885. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  886. referencedClasses: [],
  887. //>>excludeEnd("ide");
  888. messageSends: ["detect:ifNone:", "errorNotFound"]
  889. }),
  890. $globals.Collection);
  891. $core.addMethod(
  892. $core.method({
  893. selector: "detect:ifNone:",
  894. protocol: "enumerating",
  895. fn: function (aBlock,anotherBlock){
  896. var self=this;
  897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  898. return $core.withContext(function($ctx1) {
  899. //>>excludeEnd("ctx");
  900. self._subclassResponsibility();
  901. return self;
  902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  903. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  904. //>>excludeEnd("ctx");
  905. },
  906. //>>excludeStart("ide", pragmas.excludeIdeData);
  907. args: ["aBlock", "anotherBlock"],
  908. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  909. referencedClasses: [],
  910. //>>excludeEnd("ide");
  911. messageSends: ["subclassResponsibility"]
  912. }),
  913. $globals.Collection);
  914. $core.addMethod(
  915. $core.method({
  916. selector: "do:",
  917. protocol: "enumerating",
  918. fn: function (aBlock){
  919. var self=this;
  920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  921. return $core.withContext(function($ctx1) {
  922. //>>excludeEnd("ctx");
  923. self._subclassResponsibility();
  924. return self;
  925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  926. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  927. //>>excludeEnd("ctx");
  928. },
  929. //>>excludeStart("ide", pragmas.excludeIdeData);
  930. args: ["aBlock"],
  931. source: "do: aBlock\x0a\x09self subclassResponsibility",
  932. referencedClasses: [],
  933. //>>excludeEnd("ide");
  934. messageSends: ["subclassResponsibility"]
  935. }),
  936. $globals.Collection);
  937. $core.addMethod(
  938. $core.method({
  939. selector: "do:separatedBy:",
  940. protocol: "enumerating",
  941. fn: function (aBlock,anotherBlock){
  942. var self=this;
  943. var actionBeforeElement;
  944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  945. return $core.withContext(function($ctx1) {
  946. //>>excludeEnd("ctx");
  947. actionBeforeElement=(function(){
  948. actionBeforeElement=anotherBlock;
  949. return actionBeforeElement;
  950. });
  951. self._do_((function(each){
  952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  953. return $core.withContext(function($ctx2) {
  954. //>>excludeEnd("ctx");
  955. $recv(actionBeforeElement)._value();
  956. return $recv(aBlock)._value_(each);
  957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  959. //>>excludeEnd("ctx");
  960. }));
  961. return self;
  962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  963. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  964. //>>excludeEnd("ctx");
  965. },
  966. //>>excludeStart("ide", pragmas.excludeIdeData);
  967. args: ["aBlock", "anotherBlock"],
  968. 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 ]",
  969. referencedClasses: [],
  970. //>>excludeEnd("ide");
  971. messageSends: ["do:", "value", "value:"]
  972. }),
  973. $globals.Collection);
  974. $core.addMethod(
  975. $core.method({
  976. selector: "errorNotFound",
  977. protocol: "error handling",
  978. fn: function (){
  979. var self=this;
  980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  981. return $core.withContext(function($ctx1) {
  982. //>>excludeEnd("ctx");
  983. self._error_("Object is not in the collection");
  984. return self;
  985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  986. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  987. //>>excludeEnd("ctx");
  988. },
  989. //>>excludeStart("ide", pragmas.excludeIdeData);
  990. args: [],
  991. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  992. referencedClasses: [],
  993. //>>excludeEnd("ide");
  994. messageSends: ["error:"]
  995. }),
  996. $globals.Collection);
  997. $core.addMethod(
  998. $core.method({
  999. selector: "ifEmpty:",
  1000. protocol: "testing",
  1001. fn: function (aBlock){
  1002. var self=this;
  1003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1004. return $core.withContext(function($ctx1) {
  1005. //>>excludeEnd("ctx");
  1006. var $1;
  1007. $1=self._isEmpty();
  1008. if($core.assert($1)){
  1009. return $recv(aBlock)._value();
  1010. } else {
  1011. return self;
  1012. }
  1013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1014. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  1015. //>>excludeEnd("ctx");
  1016. },
  1017. //>>excludeStart("ide", pragmas.excludeIdeData);
  1018. args: ["aBlock"],
  1019. 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 ]",
  1020. referencedClasses: [],
  1021. //>>excludeEnd("ide");
  1022. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  1023. }),
  1024. $globals.Collection);
  1025. $core.addMethod(
  1026. $core.method({
  1027. selector: "ifEmpty:ifNotEmpty:",
  1028. protocol: "testing",
  1029. fn: function (aBlock,anotherBlock){
  1030. var self=this;
  1031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1032. return $core.withContext(function($ctx1) {
  1033. //>>excludeEnd("ctx");
  1034. var $1;
  1035. $1=self._isEmpty();
  1036. if($core.assert($1)){
  1037. return $recv(aBlock)._value();
  1038. } else {
  1039. return $recv(anotherBlock)._value_(self);
  1040. }
  1041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1042. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1043. //>>excludeEnd("ctx");
  1044. },
  1045. //>>excludeStart("ide", pragmas.excludeIdeData);
  1046. args: ["aBlock", "anotherBlock"],
  1047. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1048. referencedClasses: [],
  1049. //>>excludeEnd("ide");
  1050. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1051. }),
  1052. $globals.Collection);
  1053. $core.addMethod(
  1054. $core.method({
  1055. selector: "ifNotEmpty:",
  1056. protocol: "testing",
  1057. fn: function (aBlock){
  1058. var self=this;
  1059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1060. return $core.withContext(function($ctx1) {
  1061. //>>excludeEnd("ctx");
  1062. var $1;
  1063. $1=self._notEmpty();
  1064. if($core.assert($1)){
  1065. return $recv(aBlock)._value_(self);
  1066. } else {
  1067. return self;
  1068. }
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1071. //>>excludeEnd("ctx");
  1072. },
  1073. //>>excludeStart("ide", pragmas.excludeIdeData);
  1074. args: ["aBlock"],
  1075. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1076. referencedClasses: [],
  1077. //>>excludeEnd("ide");
  1078. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1079. }),
  1080. $globals.Collection);
  1081. $core.addMethod(
  1082. $core.method({
  1083. selector: "ifNotEmpty:ifEmpty:",
  1084. protocol: "testing",
  1085. fn: function (aBlock,anotherBlock){
  1086. var self=this;
  1087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1088. return $core.withContext(function($ctx1) {
  1089. //>>excludeEnd("ctx");
  1090. var $1;
  1091. $1=self._notEmpty();
  1092. if($core.assert($1)){
  1093. return $recv(aBlock)._value_(self);
  1094. } else {
  1095. return $recv(anotherBlock)._value();
  1096. }
  1097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1098. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1099. //>>excludeEnd("ctx");
  1100. },
  1101. //>>excludeStart("ide", pragmas.excludeIdeData);
  1102. args: ["aBlock", "anotherBlock"],
  1103. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1104. referencedClasses: [],
  1105. //>>excludeEnd("ide");
  1106. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1107. }),
  1108. $globals.Collection);
  1109. $core.addMethod(
  1110. $core.method({
  1111. selector: "includes:",
  1112. protocol: "testing",
  1113. fn: function (anObject){
  1114. var self=this;
  1115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1116. return $core.withContext(function($ctx1) {
  1117. //>>excludeEnd("ctx");
  1118. return self._anySatisfy_((function(each){
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. return $core.withContext(function($ctx2) {
  1121. //>>excludeEnd("ctx");
  1122. return $recv(each).__eq(anObject);
  1123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1124. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1125. //>>excludeEnd("ctx");
  1126. }));
  1127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1128. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1129. //>>excludeEnd("ctx");
  1130. },
  1131. //>>excludeStart("ide", pragmas.excludeIdeData);
  1132. args: ["anObject"],
  1133. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1134. referencedClasses: [],
  1135. //>>excludeEnd("ide");
  1136. messageSends: ["anySatisfy:", "="]
  1137. }),
  1138. $globals.Collection);
  1139. $core.addMethod(
  1140. $core.method({
  1141. selector: "inject:into:",
  1142. protocol: "enumerating",
  1143. fn: function (anObject,aBlock){
  1144. var self=this;
  1145. var result;
  1146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1147. return $core.withContext(function($ctx1) {
  1148. //>>excludeEnd("ctx");
  1149. result=anObject;
  1150. self._do_((function(each){
  1151. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1152. return $core.withContext(function($ctx2) {
  1153. //>>excludeEnd("ctx");
  1154. result=$recv(aBlock)._value_value_(result,each);
  1155. return result;
  1156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1157. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1158. //>>excludeEnd("ctx");
  1159. }));
  1160. return result;
  1161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1162. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1163. //>>excludeEnd("ctx");
  1164. },
  1165. //>>excludeStart("ide", pragmas.excludeIdeData);
  1166. args: ["anObject", "aBlock"],
  1167. 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",
  1168. referencedClasses: [],
  1169. //>>excludeEnd("ide");
  1170. messageSends: ["do:", "value:value:"]
  1171. }),
  1172. $globals.Collection);
  1173. $core.addMethod(
  1174. $core.method({
  1175. selector: "intersection:",
  1176. protocol: "enumerating",
  1177. fn: function (aCollection){
  1178. var self=this;
  1179. var set,outputSet;
  1180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1181. return $core.withContext(function($ctx1) {
  1182. //>>excludeEnd("ctx");
  1183. var $2,$1;
  1184. set=self._asSet();
  1185. outputSet=$recv($globals.Set)._new();
  1186. $recv(aCollection)._do_((function(each){
  1187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1188. return $core.withContext(function($ctx2) {
  1189. //>>excludeEnd("ctx");
  1190. $2=$recv(set)._includes_(each);
  1191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1192. $ctx2.sendIdx["includes:"]=1;
  1193. //>>excludeEnd("ctx");
  1194. $1=$recv($2)._and_((function(){
  1195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1196. return $core.withContext(function($ctx3) {
  1197. //>>excludeEnd("ctx");
  1198. return $recv($recv(outputSet)._includes_(each))._not();
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1201. //>>excludeEnd("ctx");
  1202. }));
  1203. if($core.assert($1)){
  1204. return $recv(outputSet)._add_(each);
  1205. }
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1208. //>>excludeEnd("ctx");
  1209. }));
  1210. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  1211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1212. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1213. //>>excludeEnd("ctx");
  1214. },
  1215. //>>excludeStart("ide", pragmas.excludeIdeData);
  1216. args: ["aCollection"],
  1217. 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",
  1218. referencedClasses: ["Set"],
  1219. //>>excludeEnd("ide");
  1220. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1221. }),
  1222. $globals.Collection);
  1223. $core.addMethod(
  1224. $core.method({
  1225. selector: "isEmpty",
  1226. protocol: "testing",
  1227. fn: function (){
  1228. var self=this;
  1229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1230. return $core.withContext(function($ctx1) {
  1231. //>>excludeEnd("ctx");
  1232. return $recv(self._size()).__eq((0));
  1233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1234. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1235. //>>excludeEnd("ctx");
  1236. },
  1237. //>>excludeStart("ide", pragmas.excludeIdeData);
  1238. args: [],
  1239. source: "isEmpty\x0a\x09^ self size = 0",
  1240. referencedClasses: [],
  1241. //>>excludeEnd("ide");
  1242. messageSends: ["=", "size"]
  1243. }),
  1244. $globals.Collection);
  1245. $core.addMethod(
  1246. $core.method({
  1247. selector: "noneSatisfy:",
  1248. protocol: "enumerating",
  1249. fn: function (aBlock){
  1250. var self=this;
  1251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1252. return $core.withContext(function($ctx1) {
  1253. //>>excludeEnd("ctx");
  1254. var $1;
  1255. var $early={};
  1256. try {
  1257. self._do_((function(item){
  1258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1259. return $core.withContext(function($ctx2) {
  1260. //>>excludeEnd("ctx");
  1261. $1=$recv(aBlock)._value_(item);
  1262. if($core.assert($1)){
  1263. throw $early=[false];
  1264. }
  1265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1266. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1267. //>>excludeEnd("ctx");
  1268. }));
  1269. return true;
  1270. }
  1271. catch(e) {if(e===$early)return e[0]; throw e}
  1272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1273. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1274. //>>excludeEnd("ctx");
  1275. },
  1276. //>>excludeStart("ide", pragmas.excludeIdeData);
  1277. args: ["aBlock"],
  1278. 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",
  1279. referencedClasses: [],
  1280. //>>excludeEnd("ide");
  1281. messageSends: ["do:", "ifTrue:", "value:"]
  1282. }),
  1283. $globals.Collection);
  1284. $core.addMethod(
  1285. $core.method({
  1286. selector: "notEmpty",
  1287. protocol: "testing",
  1288. fn: function (){
  1289. var self=this;
  1290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1291. return $core.withContext(function($ctx1) {
  1292. //>>excludeEnd("ctx");
  1293. return $recv(self._isEmpty())._not();
  1294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1295. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1296. //>>excludeEnd("ctx");
  1297. },
  1298. //>>excludeStart("ide", pragmas.excludeIdeData);
  1299. args: [],
  1300. source: "notEmpty\x0a\x09^ self isEmpty not",
  1301. referencedClasses: [],
  1302. //>>excludeEnd("ide");
  1303. messageSends: ["not", "isEmpty"]
  1304. }),
  1305. $globals.Collection);
  1306. $core.addMethod(
  1307. $core.method({
  1308. selector: "occurrencesOf:",
  1309. protocol: "accessing",
  1310. fn: function (anObject){
  1311. var self=this;
  1312. var tally;
  1313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1314. return $core.withContext(function($ctx1) {
  1315. //>>excludeEnd("ctx");
  1316. var $1;
  1317. tally=(0);
  1318. self._do_((function(each){
  1319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1320. return $core.withContext(function($ctx2) {
  1321. //>>excludeEnd("ctx");
  1322. $1=$recv(anObject).__eq(each);
  1323. if($core.assert($1)){
  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},$globals.Collection)});
  1334. //>>excludeEnd("ctx");
  1335. },
  1336. //>>excludeStart("ide", pragmas.excludeIdeData);
  1337. args: ["anObject"],
  1338. 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",
  1339. referencedClasses: [],
  1340. //>>excludeEnd("ide");
  1341. messageSends: ["do:", "ifTrue:", "=", "+"]
  1342. }),
  1343. $globals.Collection);
  1344. $core.addMethod(
  1345. $core.method({
  1346. selector: "putOn:",
  1347. protocol: "streaming",
  1348. fn: function (aStream){
  1349. var 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},$globals.Collection)});
  1365. //>>excludeEnd("ctx");
  1366. },
  1367. //>>excludeStart("ide", pragmas.excludeIdeData);
  1368. args: ["aStream"],
  1369. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1370. referencedClasses: [],
  1371. //>>excludeEnd("ide");
  1372. messageSends: ["do:", "putOn:"]
  1373. }),
  1374. $globals.Collection);
  1375. $core.addMethod(
  1376. $core.method({
  1377. selector: "reject:",
  1378. protocol: "enumerating",
  1379. fn: function (aBlock){
  1380. var 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},$globals.Collection)});
  1395. //>>excludeEnd("ctx");
  1396. },
  1397. //>>excludeStart("ide", pragmas.excludeIdeData);
  1398. args: ["aBlock"],
  1399. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1400. referencedClasses: [],
  1401. //>>excludeEnd("ide");
  1402. messageSends: ["select:", "=", "value:"]
  1403. }),
  1404. $globals.Collection);
  1405. $core.addMethod(
  1406. $core.method({
  1407. selector: "remove:",
  1408. protocol: "adding/removing",
  1409. fn: function (anObject){
  1410. var 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},$globals.Collection)});
  1425. //>>excludeEnd("ctx");
  1426. },
  1427. //>>excludeStart("ide", pragmas.excludeIdeData);
  1428. args: ["anObject"],
  1429. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1430. referencedClasses: [],
  1431. //>>excludeEnd("ide");
  1432. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1433. }),
  1434. $globals.Collection);
  1435. $core.addMethod(
  1436. $core.method({
  1437. selector: "remove:ifAbsent:",
  1438. protocol: "adding/removing",
  1439. fn: function (anObject,aBlock){
  1440. var 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},$globals.Collection)});
  1448. //>>excludeEnd("ctx");
  1449. },
  1450. //>>excludeStart("ide", pragmas.excludeIdeData);
  1451. args: ["anObject", "aBlock"],
  1452. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1453. referencedClasses: [],
  1454. //>>excludeEnd("ide");
  1455. messageSends: ["subclassResponsibility"]
  1456. }),
  1457. $globals.Collection);
  1458. $core.addMethod(
  1459. $core.method({
  1460. selector: "removeAll",
  1461. protocol: "adding/removing",
  1462. fn: function (){
  1463. var 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",{},$globals.Collection)});
  1471. //>>excludeEnd("ctx");
  1472. },
  1473. //>>excludeStart("ide", pragmas.excludeIdeData);
  1474. args: [],
  1475. source: "removeAll\x0a\x09self subclassResponsibility",
  1476. referencedClasses: [],
  1477. //>>excludeEnd("ide");
  1478. messageSends: ["subclassResponsibility"]
  1479. }),
  1480. $globals.Collection);
  1481. $core.addMethod(
  1482. $core.method({
  1483. selector: "select:",
  1484. protocol: "enumerating",
  1485. fn: function (aBlock){
  1486. var self=this;
  1487. var stream;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. return $core.withContext(function($ctx1) {
  1490. //>>excludeEnd("ctx");
  1491. var $1;
  1492. stream=$recv($recv(self._class())._new())._writeStream();
  1493. self._do_((function(each){
  1494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1495. return $core.withContext(function($ctx2) {
  1496. //>>excludeEnd("ctx");
  1497. $1=$recv(aBlock)._value_(each);
  1498. if($core.assert($1)){
  1499. return $recv(stream)._nextPut_(each);
  1500. }
  1501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1502. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1503. //>>excludeEnd("ctx");
  1504. }));
  1505. return $recv(stream)._contents();
  1506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1507. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1508. //>>excludeEnd("ctx");
  1509. },
  1510. //>>excludeStart("ide", pragmas.excludeIdeData);
  1511. args: ["aBlock"],
  1512. 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",
  1513. referencedClasses: [],
  1514. //>>excludeEnd("ide");
  1515. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1516. }),
  1517. $globals.Collection);
  1518. $core.addMethod(
  1519. $core.method({
  1520. selector: "select:thenCollect:",
  1521. protocol: "enumerating",
  1522. fn: function (selectBlock,collectBlock){
  1523. var self=this;
  1524. var stream;
  1525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1526. return $core.withContext(function($ctx1) {
  1527. //>>excludeEnd("ctx");
  1528. var $1;
  1529. stream=$recv($recv(self._class())._new())._writeStream();
  1530. self._do_((function(each){
  1531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1532. return $core.withContext(function($ctx2) {
  1533. //>>excludeEnd("ctx");
  1534. $1=$recv(selectBlock)._value_(each);
  1535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1536. $ctx2.sendIdx["value:"]=1;
  1537. //>>excludeEnd("ctx");
  1538. if($core.assert($1)){
  1539. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1540. }
  1541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1542. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1543. //>>excludeEnd("ctx");
  1544. }));
  1545. return $recv(stream)._contents();
  1546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1547. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1548. //>>excludeEnd("ctx");
  1549. },
  1550. //>>excludeStart("ide", pragmas.excludeIdeData);
  1551. args: ["selectBlock", "collectBlock"],
  1552. 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",
  1553. referencedClasses: [],
  1554. //>>excludeEnd("ide");
  1555. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1556. }),
  1557. $globals.Collection);
  1558. $core.addMethod(
  1559. $core.method({
  1560. selector: "shallowCopy",
  1561. protocol: "copying",
  1562. fn: function (){
  1563. var self=this;
  1564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1565. return $core.withContext(function($ctx1) {
  1566. //>>excludeEnd("ctx");
  1567. return self._collect_((function(each){
  1568. return each;
  1569. }));
  1570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1571. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1572. //>>excludeEnd("ctx");
  1573. },
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: [],
  1576. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. messageSends: ["collect:"]
  1580. }),
  1581. $globals.Collection);
  1582. $core.addMethod(
  1583. $core.method({
  1584. selector: "single",
  1585. protocol: "accessing",
  1586. fn: function (){
  1587. var self=this;
  1588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1589. return $core.withContext(function($ctx1) {
  1590. //>>excludeEnd("ctx");
  1591. var $1;
  1592. self._ifEmpty_((function(){
  1593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1594. return $core.withContext(function($ctx2) {
  1595. //>>excludeEnd("ctx");
  1596. return self._error_("Collection is empty");
  1597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1598. $ctx2.sendIdx["error:"]=1;
  1599. //>>excludeEnd("ctx");
  1600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1601. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1602. //>>excludeEnd("ctx");
  1603. }));
  1604. $1=$recv(self._size()).__gt((1));
  1605. if($core.assert($1)){
  1606. self._error_("Collection holds more than one element");
  1607. }
  1608. return self._anyOne();
  1609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1610. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1611. //>>excludeEnd("ctx");
  1612. },
  1613. //>>excludeStart("ide", pragmas.excludeIdeData);
  1614. args: [],
  1615. 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",
  1616. referencedClasses: [],
  1617. //>>excludeEnd("ide");
  1618. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1619. }),
  1620. $globals.Collection);
  1621. $core.addMethod(
  1622. $core.method({
  1623. selector: "size",
  1624. protocol: "accessing",
  1625. fn: function (){
  1626. var self=this;
  1627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1628. return $core.withContext(function($ctx1) {
  1629. //>>excludeEnd("ctx");
  1630. self._subclassResponsibility();
  1631. return self;
  1632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1633. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1634. //>>excludeEnd("ctx");
  1635. },
  1636. //>>excludeStart("ide", pragmas.excludeIdeData);
  1637. args: [],
  1638. source: "size\x0a\x09self subclassResponsibility",
  1639. referencedClasses: [],
  1640. //>>excludeEnd("ide");
  1641. messageSends: ["subclassResponsibility"]
  1642. }),
  1643. $globals.Collection);
  1644. $core.addMethod(
  1645. $core.method({
  1646. selector: "classTag",
  1647. protocol: "accessing",
  1648. fn: function (){
  1649. var self=this;
  1650. return "collection";
  1651. },
  1652. //>>excludeStart("ide", pragmas.excludeIdeData);
  1653. args: [],
  1654. 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'",
  1655. referencedClasses: [],
  1656. //>>excludeEnd("ide");
  1657. messageSends: []
  1658. }),
  1659. $globals.Collection.klass);
  1660. $core.addMethod(
  1661. $core.method({
  1662. selector: "new:",
  1663. protocol: "instance creation",
  1664. fn: function (anInteger){
  1665. var self=this;
  1666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1667. return $core.withContext(function($ctx1) {
  1668. //>>excludeEnd("ctx");
  1669. return self._new();
  1670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1671. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  1672. //>>excludeEnd("ctx");
  1673. },
  1674. //>>excludeStart("ide", pragmas.excludeIdeData);
  1675. args: ["anInteger"],
  1676. source: "new: anInteger\x0a\x09^ self new",
  1677. referencedClasses: [],
  1678. //>>excludeEnd("ide");
  1679. messageSends: ["new"]
  1680. }),
  1681. $globals.Collection.klass);
  1682. $core.addMethod(
  1683. $core.method({
  1684. selector: "with:",
  1685. protocol: "instance creation",
  1686. fn: function (anObject){
  1687. var self=this;
  1688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1689. return $core.withContext(function($ctx1) {
  1690. //>>excludeEnd("ctx");
  1691. var $1;
  1692. $1=self._new();
  1693. $recv($1)._add_(anObject);
  1694. return $recv($1)._yourself();
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  1697. //>>excludeEnd("ctx");
  1698. },
  1699. //>>excludeStart("ide", pragmas.excludeIdeData);
  1700. args: ["anObject"],
  1701. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1702. referencedClasses: [],
  1703. //>>excludeEnd("ide");
  1704. messageSends: ["add:", "new", "yourself"]
  1705. }),
  1706. $globals.Collection.klass);
  1707. $core.addMethod(
  1708. $core.method({
  1709. selector: "with:with:",
  1710. protocol: "instance creation",
  1711. fn: function (anObject,anotherObject){
  1712. var self=this;
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. return $core.withContext(function($ctx1) {
  1715. //>>excludeEnd("ctx");
  1716. var $1;
  1717. $1=self._new();
  1718. $recv($1)._add_(anObject);
  1719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1720. $ctx1.sendIdx["add:"]=1;
  1721. //>>excludeEnd("ctx");
  1722. $recv($1)._add_(anotherObject);
  1723. return $recv($1)._yourself();
  1724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1725. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  1726. //>>excludeEnd("ctx");
  1727. },
  1728. //>>excludeStart("ide", pragmas.excludeIdeData);
  1729. args: ["anObject", "anotherObject"],
  1730. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1731. referencedClasses: [],
  1732. //>>excludeEnd("ide");
  1733. messageSends: ["add:", "new", "yourself"]
  1734. }),
  1735. $globals.Collection.klass);
  1736. $core.addMethod(
  1737. $core.method({
  1738. selector: "with:with:with:",
  1739. protocol: "instance creation",
  1740. fn: function (firstObject,secondObject,thirdObject){
  1741. var self=this;
  1742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1743. return $core.withContext(function($ctx1) {
  1744. //>>excludeEnd("ctx");
  1745. var $1;
  1746. $1=self._new();
  1747. $recv($1)._add_(firstObject);
  1748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1749. $ctx1.sendIdx["add:"]=1;
  1750. //>>excludeEnd("ctx");
  1751. $recv($1)._add_(secondObject);
  1752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1753. $ctx1.sendIdx["add:"]=2;
  1754. //>>excludeEnd("ctx");
  1755. $recv($1)._add_(thirdObject);
  1756. return $recv($1)._yourself();
  1757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1758. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  1759. //>>excludeEnd("ctx");
  1760. },
  1761. //>>excludeStart("ide", pragmas.excludeIdeData);
  1762. args: ["firstObject", "secondObject", "thirdObject"],
  1763. 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",
  1764. referencedClasses: [],
  1765. //>>excludeEnd("ide");
  1766. messageSends: ["add:", "new", "yourself"]
  1767. }),
  1768. $globals.Collection.klass);
  1769. $core.addMethod(
  1770. $core.method({
  1771. selector: "withAll:",
  1772. protocol: "instance creation",
  1773. fn: function (aCollection){
  1774. var self=this;
  1775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1776. return $core.withContext(function($ctx1) {
  1777. //>>excludeEnd("ctx");
  1778. var $1;
  1779. $1=self._new();
  1780. $recv($1)._addAll_(aCollection);
  1781. return $recv($1)._yourself();
  1782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1783. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  1784. //>>excludeEnd("ctx");
  1785. },
  1786. //>>excludeStart("ide", pragmas.excludeIdeData);
  1787. args: ["aCollection"],
  1788. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1789. referencedClasses: [],
  1790. //>>excludeEnd("ide");
  1791. messageSends: ["addAll:", "new", "yourself"]
  1792. }),
  1793. $globals.Collection.klass);
  1794. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  1795. //>>excludeStart("ide", pragmas.excludeIdeData);
  1796. $globals.IndexableCollection.comment="I am a key-value store collection, that is,\x0aI store values under indexes.\x0a\x0aAs a rule of thumb, if a collection has `#at:` and `#at:put:`,\x0ait is an IndexableCollection.";
  1797. //>>excludeEnd("ide");
  1798. $core.addMethod(
  1799. $core.method({
  1800. selector: "at:",
  1801. protocol: "accessing",
  1802. fn: function (anIndex){
  1803. var self=this;
  1804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1805. return $core.withContext(function($ctx1) {
  1806. //>>excludeEnd("ctx");
  1807. return self._at_ifAbsent_(anIndex,(function(){
  1808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1809. return $core.withContext(function($ctx2) {
  1810. //>>excludeEnd("ctx");
  1811. return self._errorNotFound();
  1812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1813. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1814. //>>excludeEnd("ctx");
  1815. }));
  1816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1817. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1818. //>>excludeEnd("ctx");
  1819. },
  1820. //>>excludeStart("ide", pragmas.excludeIdeData);
  1821. args: ["anIndex"],
  1822. 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 ]",
  1823. referencedClasses: [],
  1824. //>>excludeEnd("ide");
  1825. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1826. }),
  1827. $globals.IndexableCollection);
  1828. $core.addMethod(
  1829. $core.method({
  1830. selector: "at:ifAbsent:",
  1831. protocol: "accessing",
  1832. fn: function (anIndex,aBlock){
  1833. var self=this;
  1834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1835. return $core.withContext(function($ctx1) {
  1836. //>>excludeEnd("ctx");
  1837. self._subclassResponsibility();
  1838. return self;
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1841. //>>excludeEnd("ctx");
  1842. },
  1843. //>>excludeStart("ide", pragmas.excludeIdeData);
  1844. args: ["anIndex", "aBlock"],
  1845. 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",
  1846. referencedClasses: [],
  1847. //>>excludeEnd("ide");
  1848. messageSends: ["subclassResponsibility"]
  1849. }),
  1850. $globals.IndexableCollection);
  1851. $core.addMethod(
  1852. $core.method({
  1853. selector: "at:ifAbsentPut:",
  1854. protocol: "accessing",
  1855. fn: function (aKey,aBlock){
  1856. var self=this;
  1857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1858. return $core.withContext(function($ctx1) {
  1859. //>>excludeEnd("ctx");
  1860. return self._at_ifAbsent_(aKey,(function(){
  1861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1862. return $core.withContext(function($ctx2) {
  1863. //>>excludeEnd("ctx");
  1864. return self._at_put_(aKey,$recv(aBlock)._value());
  1865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1867. //>>excludeEnd("ctx");
  1868. }));
  1869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1870. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1871. //>>excludeEnd("ctx");
  1872. },
  1873. //>>excludeStart("ide", pragmas.excludeIdeData);
  1874. args: ["aKey", "aBlock"],
  1875. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1876. referencedClasses: [],
  1877. //>>excludeEnd("ide");
  1878. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1879. }),
  1880. $globals.IndexableCollection);
  1881. $core.addMethod(
  1882. $core.method({
  1883. selector: "at:ifPresent:",
  1884. protocol: "accessing",
  1885. fn: function (anIndex,aBlock){
  1886. var self=this;
  1887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1888. return $core.withContext(function($ctx1) {
  1889. //>>excludeEnd("ctx");
  1890. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1891. return nil;
  1892. }));
  1893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1894. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1895. //>>excludeEnd("ctx");
  1896. },
  1897. //>>excludeStart("ide", pragmas.excludeIdeData);
  1898. args: ["anIndex", "aBlock"],
  1899. 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 ]",
  1900. referencedClasses: [],
  1901. //>>excludeEnd("ide");
  1902. messageSends: ["at:ifPresent:ifAbsent:"]
  1903. }),
  1904. $globals.IndexableCollection);
  1905. $core.addMethod(
  1906. $core.method({
  1907. selector: "at:ifPresent:ifAbsent:",
  1908. protocol: "accessing",
  1909. fn: function (anIndex,aBlock,anotherBlock){
  1910. var self=this;
  1911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1912. return $core.withContext(function($ctx1) {
  1913. //>>excludeEnd("ctx");
  1914. self._subclassResponsibility();
  1915. return self;
  1916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1917. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1918. //>>excludeEnd("ctx");
  1919. },
  1920. //>>excludeStart("ide", pragmas.excludeIdeData);
  1921. args: ["anIndex", "aBlock", "anotherBlock"],
  1922. 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",
  1923. referencedClasses: [],
  1924. //>>excludeEnd("ide");
  1925. messageSends: ["subclassResponsibility"]
  1926. }),
  1927. $globals.IndexableCollection);
  1928. $core.addMethod(
  1929. $core.method({
  1930. selector: "at:put:",
  1931. protocol: "accessing",
  1932. fn: function (anIndex,anObject){
  1933. var self=this;
  1934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1935. return $core.withContext(function($ctx1) {
  1936. //>>excludeEnd("ctx");
  1937. self._subclassResponsibility();
  1938. return self;
  1939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1940. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1941. //>>excludeEnd("ctx");
  1942. },
  1943. //>>excludeStart("ide", pragmas.excludeIdeData);
  1944. args: ["anIndex", "anObject"],
  1945. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1946. referencedClasses: [],
  1947. //>>excludeEnd("ide");
  1948. messageSends: ["subclassResponsibility"]
  1949. }),
  1950. $globals.IndexableCollection);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "indexOf:",
  1954. protocol: "accessing",
  1955. fn: function (anObject){
  1956. var self=this;
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. return $core.withContext(function($ctx1) {
  1959. //>>excludeEnd("ctx");
  1960. return self._indexOf_ifAbsent_(anObject,(function(){
  1961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1962. return $core.withContext(function($ctx2) {
  1963. //>>excludeEnd("ctx");
  1964. return self._errorNotFound();
  1965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1967. //>>excludeEnd("ctx");
  1968. }));
  1969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1970. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1971. //>>excludeEnd("ctx");
  1972. },
  1973. //>>excludeStart("ide", pragmas.excludeIdeData);
  1974. args: ["anObject"],
  1975. 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 ]",
  1976. referencedClasses: [],
  1977. //>>excludeEnd("ide");
  1978. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1979. }),
  1980. $globals.IndexableCollection);
  1981. $core.addMethod(
  1982. $core.method({
  1983. selector: "indexOf:ifAbsent:",
  1984. protocol: "accessing",
  1985. fn: function (anObject,aBlock){
  1986. var self=this;
  1987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1988. return $core.withContext(function($ctx1) {
  1989. //>>excludeEnd("ctx");
  1990. self._subclassResponsibility();
  1991. return self;
  1992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1993. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1994. //>>excludeEnd("ctx");
  1995. },
  1996. //>>excludeStart("ide", pragmas.excludeIdeData);
  1997. args: ["anObject", "aBlock"],
  1998. 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",
  1999. referencedClasses: [],
  2000. //>>excludeEnd("ide");
  2001. messageSends: ["subclassResponsibility"]
  2002. }),
  2003. $globals.IndexableCollection);
  2004. $core.addMethod(
  2005. $core.method({
  2006. selector: "with:do:",
  2007. protocol: "enumerating",
  2008. fn: function (anotherCollection,aBlock){
  2009. var self=this;
  2010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2011. return $core.withContext(function($ctx1) {
  2012. //>>excludeEnd("ctx");
  2013. self._withIndexDo_((function(each,index){
  2014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2015. return $core.withContext(function($ctx2) {
  2016. //>>excludeEnd("ctx");
  2017. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  2018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2019. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  2020. //>>excludeEnd("ctx");
  2021. }));
  2022. return self;
  2023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2024. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  2025. //>>excludeEnd("ctx");
  2026. },
  2027. //>>excludeStart("ide", pragmas.excludeIdeData);
  2028. args: ["anotherCollection", "aBlock"],
  2029. 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) ]",
  2030. referencedClasses: [],
  2031. //>>excludeEnd("ide");
  2032. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2033. }),
  2034. $globals.IndexableCollection);
  2035. $core.addMethod(
  2036. $core.method({
  2037. selector: "withIndexDo:",
  2038. protocol: "enumerating",
  2039. fn: function (aBlock){
  2040. var self=this;
  2041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2042. return $core.withContext(function($ctx1) {
  2043. //>>excludeEnd("ctx");
  2044. self._subclassResponsibility();
  2045. return self;
  2046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2047. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  2048. //>>excludeEnd("ctx");
  2049. },
  2050. //>>excludeStart("ide", pragmas.excludeIdeData);
  2051. args: ["aBlock"],
  2052. 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",
  2053. referencedClasses: [],
  2054. //>>excludeEnd("ide");
  2055. messageSends: ["subclassResponsibility"]
  2056. }),
  2057. $globals.IndexableCollection);
  2058. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  2059. //>>excludeStart("ide", pragmas.excludeIdeData);
  2060. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2061. //>>excludeEnd("ide");
  2062. $core.addMethod(
  2063. $core.method({
  2064. selector: "=",
  2065. protocol: "comparing",
  2066. fn: function (anAssocitativeCollection){
  2067. var self=this;
  2068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2069. return $core.withContext(function($ctx1) {
  2070. //>>excludeEnd("ctx");
  2071. var $2,$1,$4,$3,$5;
  2072. $2=self._class();
  2073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2074. $ctx1.sendIdx["class"]=1;
  2075. //>>excludeEnd("ctx");
  2076. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2078. $ctx1.sendIdx["="]=1;
  2079. //>>excludeEnd("ctx");
  2080. if(!$core.assert($1)){
  2081. return false;
  2082. }
  2083. $4=self._size();
  2084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2085. $ctx1.sendIdx["size"]=1;
  2086. //>>excludeEnd("ctx");
  2087. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2089. $ctx1.sendIdx["="]=2;
  2090. //>>excludeEnd("ctx");
  2091. if(!$core.assert($3)){
  2092. return false;
  2093. }
  2094. $5=self._associations();
  2095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2096. $ctx1.sendIdx["associations"]=1;
  2097. //>>excludeEnd("ctx");
  2098. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2100. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2101. //>>excludeEnd("ctx");
  2102. },
  2103. //>>excludeStart("ide", pragmas.excludeIdeData);
  2104. args: ["anAssocitativeCollection"],
  2105. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2106. referencedClasses: [],
  2107. //>>excludeEnd("ide");
  2108. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2109. }),
  2110. $globals.AssociativeCollection);
  2111. $core.addMethod(
  2112. $core.method({
  2113. selector: "add:",
  2114. protocol: "adding/removing",
  2115. fn: function (anAssociation){
  2116. var self=this;
  2117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2118. return $core.withContext(function($ctx1) {
  2119. //>>excludeEnd("ctx");
  2120. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2121. return self;
  2122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2123. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2124. //>>excludeEnd("ctx");
  2125. },
  2126. //>>excludeStart("ide", pragmas.excludeIdeData);
  2127. args: ["anAssociation"],
  2128. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2129. referencedClasses: [],
  2130. //>>excludeEnd("ide");
  2131. messageSends: ["at:put:", "key", "value"]
  2132. }),
  2133. $globals.AssociativeCollection);
  2134. $core.addMethod(
  2135. $core.method({
  2136. selector: "addAll:",
  2137. protocol: "adding/removing",
  2138. fn: function (anAssociativeCollection){
  2139. var self=this;
  2140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2141. return $core.withContext(function($ctx1) {
  2142. //>>excludeEnd("ctx");
  2143. (
  2144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2145. $ctx1.supercall = true,
  2146. //>>excludeEnd("ctx");
  2147. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  2148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2149. $ctx1.supercall = false;
  2150. //>>excludeEnd("ctx");;
  2151. return anAssociativeCollection;
  2152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2153. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2154. //>>excludeEnd("ctx");
  2155. },
  2156. //>>excludeStart("ide", pragmas.excludeIdeData);
  2157. args: ["anAssociativeCollection"],
  2158. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2159. referencedClasses: [],
  2160. //>>excludeEnd("ide");
  2161. messageSends: ["addAll:", "associations"]
  2162. }),
  2163. $globals.AssociativeCollection);
  2164. $core.addMethod(
  2165. $core.method({
  2166. selector: "asDictionary",
  2167. protocol: "converting",
  2168. fn: function (){
  2169. var self=this;
  2170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2171. return $core.withContext(function($ctx1) {
  2172. //>>excludeEnd("ctx");
  2173. return $recv($globals.Dictionary)._from_(self._associations());
  2174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2175. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2176. //>>excludeEnd("ctx");
  2177. },
  2178. //>>excludeStart("ide", pragmas.excludeIdeData);
  2179. args: [],
  2180. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2181. referencedClasses: ["Dictionary"],
  2182. //>>excludeEnd("ide");
  2183. messageSends: ["from:", "associations"]
  2184. }),
  2185. $globals.AssociativeCollection);
  2186. $core.addMethod(
  2187. $core.method({
  2188. selector: "asHashedCollection",
  2189. protocol: "converting",
  2190. fn: function (){
  2191. var self=this;
  2192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2193. return $core.withContext(function($ctx1) {
  2194. //>>excludeEnd("ctx");
  2195. return $recv($globals.HashedCollection)._from_(self._associations());
  2196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2197. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2198. //>>excludeEnd("ctx");
  2199. },
  2200. //>>excludeStart("ide", pragmas.excludeIdeData);
  2201. args: [],
  2202. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2203. referencedClasses: ["HashedCollection"],
  2204. //>>excludeEnd("ide");
  2205. messageSends: ["from:", "associations"]
  2206. }),
  2207. $globals.AssociativeCollection);
  2208. $core.addMethod(
  2209. $core.method({
  2210. selector: "asJSON",
  2211. protocol: "converting",
  2212. fn: function (){
  2213. var self=this;
  2214. var hash;
  2215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2216. return $core.withContext(function($ctx1) {
  2217. //>>excludeEnd("ctx");
  2218. hash=$recv($globals.HashedCollection)._new();
  2219. self._keysAndValuesDo_((function(key,value){
  2220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2221. return $core.withContext(function($ctx2) {
  2222. //>>excludeEnd("ctx");
  2223. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  2224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2225. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2226. //>>excludeEnd("ctx");
  2227. }));
  2228. return hash;
  2229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2230. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  2231. //>>excludeEnd("ctx");
  2232. },
  2233. //>>excludeStart("ide", pragmas.excludeIdeData);
  2234. args: [],
  2235. source: "asJSON\x0a\x09| hash |\x0a\x09hash := HashedCollection new.\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09hash at: key put: value asJSON ].\x0a\x09^ hash",
  2236. referencedClasses: ["HashedCollection"],
  2237. //>>excludeEnd("ide");
  2238. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  2239. }),
  2240. $globals.AssociativeCollection);
  2241. $core.addMethod(
  2242. $core.method({
  2243. selector: "associations",
  2244. protocol: "accessing",
  2245. fn: function (){
  2246. var self=this;
  2247. var associations;
  2248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2249. return $core.withContext(function($ctx1) {
  2250. //>>excludeEnd("ctx");
  2251. associations=[];
  2252. self._associationsDo_((function(each){
  2253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2254. return $core.withContext(function($ctx2) {
  2255. //>>excludeEnd("ctx");
  2256. return $recv(associations)._add_(each);
  2257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2258. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2259. //>>excludeEnd("ctx");
  2260. }));
  2261. return associations;
  2262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2263. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2264. //>>excludeEnd("ctx");
  2265. },
  2266. //>>excludeStart("ide", pragmas.excludeIdeData);
  2267. args: [],
  2268. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2269. referencedClasses: [],
  2270. //>>excludeEnd("ide");
  2271. messageSends: ["associationsDo:", "add:"]
  2272. }),
  2273. $globals.AssociativeCollection);
  2274. $core.addMethod(
  2275. $core.method({
  2276. selector: "associationsDo:",
  2277. protocol: "enumerating",
  2278. fn: function (aBlock){
  2279. var self=this;
  2280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2281. return $core.withContext(function($ctx1) {
  2282. //>>excludeEnd("ctx");
  2283. self._keysAndValuesDo_((function(key,value){
  2284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2285. return $core.withContext(function($ctx2) {
  2286. //>>excludeEnd("ctx");
  2287. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2289. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2290. //>>excludeEnd("ctx");
  2291. }));
  2292. return self;
  2293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2294. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2295. //>>excludeEnd("ctx");
  2296. },
  2297. //>>excludeStart("ide", pragmas.excludeIdeData);
  2298. args: ["aBlock"],
  2299. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2300. referencedClasses: ["Association"],
  2301. //>>excludeEnd("ide");
  2302. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2303. }),
  2304. $globals.AssociativeCollection);
  2305. $core.addMethod(
  2306. $core.method({
  2307. selector: "at:ifPresent:ifAbsent:",
  2308. protocol: "accessing",
  2309. fn: function (aKey,aBlock,anotherBlock){
  2310. var self=this;
  2311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2312. return $core.withContext(function($ctx1) {
  2313. //>>excludeEnd("ctx");
  2314. var $1;
  2315. $1=self._includesKey_(aKey);
  2316. if($core.assert($1)){
  2317. return $recv(aBlock)._value_(self._at_(aKey));
  2318. } else {
  2319. return $recv(anotherBlock)._value();
  2320. }
  2321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2322. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2323. //>>excludeEnd("ctx");
  2324. },
  2325. //>>excludeStart("ide", pragmas.excludeIdeData);
  2326. args: ["aKey", "aBlock", "anotherBlock"],
  2327. 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 ]",
  2328. referencedClasses: [],
  2329. //>>excludeEnd("ide");
  2330. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2331. }),
  2332. $globals.AssociativeCollection);
  2333. $core.addMethod(
  2334. $core.method({
  2335. selector: "collect:",
  2336. protocol: "enumerating",
  2337. fn: function (aBlock){
  2338. var self=this;
  2339. var newDict;
  2340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2341. return $core.withContext(function($ctx1) {
  2342. //>>excludeEnd("ctx");
  2343. newDict=$recv(self._class())._new();
  2344. self._keysAndValuesDo_((function(key,value){
  2345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2346. return $core.withContext(function($ctx2) {
  2347. //>>excludeEnd("ctx");
  2348. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2350. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2351. //>>excludeEnd("ctx");
  2352. }));
  2353. return newDict;
  2354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2355. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2356. //>>excludeEnd("ctx");
  2357. },
  2358. //>>excludeStart("ide", pragmas.excludeIdeData);
  2359. args: ["aBlock"],
  2360. 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",
  2361. referencedClasses: [],
  2362. //>>excludeEnd("ide");
  2363. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2364. }),
  2365. $globals.AssociativeCollection);
  2366. $core.addMethod(
  2367. $core.method({
  2368. selector: "deepCopy",
  2369. protocol: "copying",
  2370. fn: function (){
  2371. var self=this;
  2372. var copy;
  2373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2374. return $core.withContext(function($ctx1) {
  2375. //>>excludeEnd("ctx");
  2376. copy=$recv(self._class())._new();
  2377. self._keysAndValuesDo_((function(key,value){
  2378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2379. return $core.withContext(function($ctx2) {
  2380. //>>excludeEnd("ctx");
  2381. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2383. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2384. //>>excludeEnd("ctx");
  2385. }));
  2386. return copy;
  2387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2388. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2389. //>>excludeEnd("ctx");
  2390. },
  2391. //>>excludeStart("ide", pragmas.excludeIdeData);
  2392. args: [],
  2393. 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",
  2394. referencedClasses: [],
  2395. //>>excludeEnd("ide");
  2396. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2397. }),
  2398. $globals.AssociativeCollection);
  2399. $core.addMethod(
  2400. $core.method({
  2401. selector: "detect:ifNone:",
  2402. protocol: "enumerating",
  2403. fn: function (aBlock,anotherBlock){
  2404. var self=this;
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. return $core.withContext(function($ctx1) {
  2407. //>>excludeEnd("ctx");
  2408. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  2409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2410. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2411. //>>excludeEnd("ctx");
  2412. },
  2413. //>>excludeStart("ide", pragmas.excludeIdeData);
  2414. args: ["aBlock", "anotherBlock"],
  2415. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2416. referencedClasses: [],
  2417. //>>excludeEnd("ide");
  2418. messageSends: ["detect:ifNone:", "values"]
  2419. }),
  2420. $globals.AssociativeCollection);
  2421. $core.addMethod(
  2422. $core.method({
  2423. selector: "do:",
  2424. protocol: "enumerating",
  2425. fn: function (aBlock){
  2426. var self=this;
  2427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2428. return $core.withContext(function($ctx1) {
  2429. //>>excludeEnd("ctx");
  2430. self._valuesDo_(aBlock);
  2431. return self;
  2432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2433. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2434. //>>excludeEnd("ctx");
  2435. },
  2436. //>>excludeStart("ide", pragmas.excludeIdeData);
  2437. args: ["aBlock"],
  2438. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2439. referencedClasses: [],
  2440. //>>excludeEnd("ide");
  2441. messageSends: ["valuesDo:"]
  2442. }),
  2443. $globals.AssociativeCollection);
  2444. $core.addMethod(
  2445. $core.method({
  2446. selector: "includes:",
  2447. protocol: "enumerating",
  2448. fn: function (anObject){
  2449. var self=this;
  2450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2451. return $core.withContext(function($ctx1) {
  2452. //>>excludeEnd("ctx");
  2453. return $recv(self._values())._includes_(anObject);
  2454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2455. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2456. //>>excludeEnd("ctx");
  2457. },
  2458. //>>excludeStart("ide", pragmas.excludeIdeData);
  2459. args: ["anObject"],
  2460. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2461. referencedClasses: [],
  2462. //>>excludeEnd("ide");
  2463. messageSends: ["includes:", "values"]
  2464. }),
  2465. $globals.AssociativeCollection);
  2466. $core.addMethod(
  2467. $core.method({
  2468. selector: "includesKey:",
  2469. protocol: "testing",
  2470. fn: function (aKey){
  2471. var self=this;
  2472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2473. return $core.withContext(function($ctx1) {
  2474. //>>excludeEnd("ctx");
  2475. self._subclassResponsibility();
  2476. return self;
  2477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2478. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2479. //>>excludeEnd("ctx");
  2480. },
  2481. //>>excludeStart("ide", pragmas.excludeIdeData);
  2482. args: ["aKey"],
  2483. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2484. referencedClasses: [],
  2485. //>>excludeEnd("ide");
  2486. messageSends: ["subclassResponsibility"]
  2487. }),
  2488. $globals.AssociativeCollection);
  2489. $core.addMethod(
  2490. $core.method({
  2491. selector: "indexOf:ifAbsent:",
  2492. protocol: "accessing",
  2493. fn: function (anObject,aBlock){
  2494. var self=this;
  2495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2496. return $core.withContext(function($ctx1) {
  2497. //>>excludeEnd("ctx");
  2498. return $recv(self._keys())._detect_ifNone_((function(each){
  2499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2500. return $core.withContext(function($ctx2) {
  2501. //>>excludeEnd("ctx");
  2502. return $recv(self._at_(each)).__eq(anObject);
  2503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2504. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2505. //>>excludeEnd("ctx");
  2506. }),aBlock);
  2507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2508. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2509. //>>excludeEnd("ctx");
  2510. },
  2511. //>>excludeStart("ide", pragmas.excludeIdeData);
  2512. args: ["anObject", "aBlock"],
  2513. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2514. referencedClasses: [],
  2515. //>>excludeEnd("ide");
  2516. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2517. }),
  2518. $globals.AssociativeCollection);
  2519. $core.addMethod(
  2520. $core.method({
  2521. selector: "keyAtValue:",
  2522. protocol: "accessing",
  2523. fn: function (anObject){
  2524. var self=this;
  2525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2526. return $core.withContext(function($ctx1) {
  2527. //>>excludeEnd("ctx");
  2528. return self._keyAtValue_ifAbsent_(anObject,(function(){
  2529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2530. return $core.withContext(function($ctx2) {
  2531. //>>excludeEnd("ctx");
  2532. return self._errorNotFound();
  2533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2534. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2535. //>>excludeEnd("ctx");
  2536. }));
  2537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2538. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2539. //>>excludeEnd("ctx");
  2540. },
  2541. //>>excludeStart("ide", pragmas.excludeIdeData);
  2542. args: ["anObject"],
  2543. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2544. referencedClasses: [],
  2545. //>>excludeEnd("ide");
  2546. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2547. }),
  2548. $globals.AssociativeCollection);
  2549. $core.addMethod(
  2550. $core.method({
  2551. selector: "keyAtValue:ifAbsent:",
  2552. protocol: "accessing",
  2553. fn: function (anObject,aBlock){
  2554. var self=this;
  2555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2556. return $core.withContext(function($ctx1) {
  2557. //>>excludeEnd("ctx");
  2558. return self._indexOf_ifAbsent_(anObject,aBlock);
  2559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2560. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2561. //>>excludeEnd("ctx");
  2562. },
  2563. //>>excludeStart("ide", pragmas.excludeIdeData);
  2564. args: ["anObject", "aBlock"],
  2565. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2566. referencedClasses: [],
  2567. //>>excludeEnd("ide");
  2568. messageSends: ["indexOf:ifAbsent:"]
  2569. }),
  2570. $globals.AssociativeCollection);
  2571. $core.addMethod(
  2572. $core.method({
  2573. selector: "keys",
  2574. protocol: "accessing",
  2575. fn: function (){
  2576. var self=this;
  2577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2578. return $core.withContext(function($ctx1) {
  2579. //>>excludeEnd("ctx");
  2580. self._subclassResponsibility();
  2581. return self;
  2582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2583. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2584. //>>excludeEnd("ctx");
  2585. },
  2586. //>>excludeStart("ide", pragmas.excludeIdeData);
  2587. args: [],
  2588. source: "keys\x0a\x09self subclassResponsibility",
  2589. referencedClasses: [],
  2590. //>>excludeEnd("ide");
  2591. messageSends: ["subclassResponsibility"]
  2592. }),
  2593. $globals.AssociativeCollection);
  2594. $core.addMethod(
  2595. $core.method({
  2596. selector: "keysAndValuesDo:",
  2597. protocol: "enumerating",
  2598. fn: function (aBlock){
  2599. var self=this;
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. return $core.withContext(function($ctx1) {
  2602. //>>excludeEnd("ctx");
  2603. self._keysDo_((function(each){
  2604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2605. return $core.withContext(function($ctx2) {
  2606. //>>excludeEnd("ctx");
  2607. return $recv(aBlock)._value_value_(each,self._at_(each));
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2610. //>>excludeEnd("ctx");
  2611. }));
  2612. return self;
  2613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2614. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2615. //>>excludeEnd("ctx");
  2616. },
  2617. //>>excludeStart("ide", pragmas.excludeIdeData);
  2618. args: ["aBlock"],
  2619. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2620. referencedClasses: [],
  2621. //>>excludeEnd("ide");
  2622. messageSends: ["keysDo:", "value:value:", "at:"]
  2623. }),
  2624. $globals.AssociativeCollection);
  2625. $core.addMethod(
  2626. $core.method({
  2627. selector: "keysDo:",
  2628. protocol: "enumerating",
  2629. fn: function (aBlock){
  2630. var self=this;
  2631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2632. return $core.withContext(function($ctx1) {
  2633. //>>excludeEnd("ctx");
  2634. self._subclassResponsibility();
  2635. return self;
  2636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2637. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2638. //>>excludeEnd("ctx");
  2639. },
  2640. //>>excludeStart("ide", pragmas.excludeIdeData);
  2641. args: ["aBlock"],
  2642. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2643. referencedClasses: [],
  2644. //>>excludeEnd("ide");
  2645. messageSends: ["subclassResponsibility"]
  2646. }),
  2647. $globals.AssociativeCollection);
  2648. $core.addMethod(
  2649. $core.method({
  2650. selector: "printOn:",
  2651. protocol: "printing",
  2652. fn: function (aStream){
  2653. var self=this;
  2654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2655. return $core.withContext(function($ctx1) {
  2656. //>>excludeEnd("ctx");
  2657. (
  2658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2659. $ctx1.supercall = true,
  2660. //>>excludeEnd("ctx");
  2661. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  2662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2663. $ctx1.supercall = false;
  2664. //>>excludeEnd("ctx");;
  2665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2666. $ctx1.sendIdx["printOn:"]=1;
  2667. //>>excludeEnd("ctx");
  2668. $recv(aStream)._nextPutAll_(" (");
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. $ctx1.sendIdx["nextPutAll:"]=1;
  2671. //>>excludeEnd("ctx");
  2672. $recv(self._associations())._do_separatedBy_((function(each){
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. return $core.withContext(function($ctx2) {
  2675. //>>excludeEnd("ctx");
  2676. return $recv(each)._printOn_(aStream);
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2679. //>>excludeEnd("ctx");
  2680. }),(function(){
  2681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2682. return $core.withContext(function($ctx2) {
  2683. //>>excludeEnd("ctx");
  2684. return $recv(aStream)._nextPutAll_(" , ");
  2685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2686. $ctx2.sendIdx["nextPutAll:"]=2;
  2687. //>>excludeEnd("ctx");
  2688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2690. //>>excludeEnd("ctx");
  2691. }));
  2692. $recv(aStream)._nextPutAll_(")");
  2693. return self;
  2694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2695. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2696. //>>excludeEnd("ctx");
  2697. },
  2698. //>>excludeStart("ide", pragmas.excludeIdeData);
  2699. args: ["aStream"],
  2700. 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: ')'",
  2701. referencedClasses: [],
  2702. //>>excludeEnd("ide");
  2703. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2704. }),
  2705. $globals.AssociativeCollection);
  2706. $core.addMethod(
  2707. $core.method({
  2708. selector: "remove:ifAbsent:",
  2709. protocol: "adding/removing",
  2710. fn: function (aKey,aBlock){
  2711. var self=this;
  2712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2713. return $core.withContext(function($ctx1) {
  2714. //>>excludeEnd("ctx");
  2715. return self._removeKey_ifAbsent_(aKey,aBlock);
  2716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2717. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2718. //>>excludeEnd("ctx");
  2719. },
  2720. //>>excludeStart("ide", pragmas.excludeIdeData);
  2721. args: ["aKey", "aBlock"],
  2722. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2723. referencedClasses: [],
  2724. //>>excludeEnd("ide");
  2725. messageSends: ["removeKey:ifAbsent:"]
  2726. }),
  2727. $globals.AssociativeCollection);
  2728. $core.addMethod(
  2729. $core.method({
  2730. selector: "removeAll",
  2731. protocol: "adding/removing",
  2732. fn: function (){
  2733. var self=this;
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. return $core.withContext(function($ctx1) {
  2736. //>>excludeEnd("ctx");
  2737. return $recv(self._keys())._do_((function(each){
  2738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2739. return $core.withContext(function($ctx2) {
  2740. //>>excludeEnd("ctx");
  2741. return self._removeKey_(each);
  2742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2743. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2744. //>>excludeEnd("ctx");
  2745. }));
  2746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2747. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2748. //>>excludeEnd("ctx");
  2749. },
  2750. //>>excludeStart("ide", pragmas.excludeIdeData);
  2751. args: [],
  2752. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2753. referencedClasses: [],
  2754. //>>excludeEnd("ide");
  2755. messageSends: ["do:", "keys", "removeKey:"]
  2756. }),
  2757. $globals.AssociativeCollection);
  2758. $core.addMethod(
  2759. $core.method({
  2760. selector: "removeKey:",
  2761. protocol: "adding/removing",
  2762. fn: function (aKey){
  2763. var self=this;
  2764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2765. return $core.withContext(function($ctx1) {
  2766. //>>excludeEnd("ctx");
  2767. return self._remove_(aKey);
  2768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2769. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2770. //>>excludeEnd("ctx");
  2771. },
  2772. //>>excludeStart("ide", pragmas.excludeIdeData);
  2773. args: ["aKey"],
  2774. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2775. referencedClasses: [],
  2776. //>>excludeEnd("ide");
  2777. messageSends: ["remove:"]
  2778. }),
  2779. $globals.AssociativeCollection);
  2780. $core.addMethod(
  2781. $core.method({
  2782. selector: "removeKey:ifAbsent:",
  2783. protocol: "adding/removing",
  2784. fn: function (aKey,aBlock){
  2785. var self=this;
  2786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2787. return $core.withContext(function($ctx1) {
  2788. //>>excludeEnd("ctx");
  2789. self._subclassResponsibility();
  2790. return self;
  2791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2792. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2793. //>>excludeEnd("ctx");
  2794. },
  2795. //>>excludeStart("ide", pragmas.excludeIdeData);
  2796. args: ["aKey", "aBlock"],
  2797. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2798. referencedClasses: [],
  2799. //>>excludeEnd("ide");
  2800. messageSends: ["subclassResponsibility"]
  2801. }),
  2802. $globals.AssociativeCollection);
  2803. $core.addMethod(
  2804. $core.method({
  2805. selector: "select:",
  2806. protocol: "enumerating",
  2807. fn: function (aBlock){
  2808. var self=this;
  2809. var newDict;
  2810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2811. return $core.withContext(function($ctx1) {
  2812. //>>excludeEnd("ctx");
  2813. var $1;
  2814. newDict=$recv(self._class())._new();
  2815. self._keysAndValuesDo_((function(key,value){
  2816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2817. return $core.withContext(function($ctx2) {
  2818. //>>excludeEnd("ctx");
  2819. $1=$recv(aBlock)._value_(value);
  2820. if($core.assert($1)){
  2821. return $recv(newDict)._at_put_(key,value);
  2822. }
  2823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2824. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2825. //>>excludeEnd("ctx");
  2826. }));
  2827. return newDict;
  2828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2829. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2830. //>>excludeEnd("ctx");
  2831. },
  2832. //>>excludeStart("ide", pragmas.excludeIdeData);
  2833. args: ["aBlock"],
  2834. 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",
  2835. referencedClasses: [],
  2836. //>>excludeEnd("ide");
  2837. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2838. }),
  2839. $globals.AssociativeCollection);
  2840. $core.addMethod(
  2841. $core.method({
  2842. selector: "shallowCopy",
  2843. protocol: "copying",
  2844. fn: function (){
  2845. var self=this;
  2846. var copy;
  2847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2848. return $core.withContext(function($ctx1) {
  2849. //>>excludeEnd("ctx");
  2850. copy=$recv(self._class())._new();
  2851. self._keysAndValuesDo_((function(key,value){
  2852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2853. return $core.withContext(function($ctx2) {
  2854. //>>excludeEnd("ctx");
  2855. return $recv(copy)._at_put_(key,value);
  2856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2857. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2858. //>>excludeEnd("ctx");
  2859. }));
  2860. return copy;
  2861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2862. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2863. //>>excludeEnd("ctx");
  2864. },
  2865. //>>excludeStart("ide", pragmas.excludeIdeData);
  2866. args: [],
  2867. 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",
  2868. referencedClasses: [],
  2869. //>>excludeEnd("ide");
  2870. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2871. }),
  2872. $globals.AssociativeCollection);
  2873. $core.addMethod(
  2874. $core.method({
  2875. selector: "size",
  2876. protocol: "accessing",
  2877. fn: function (){
  2878. var self=this;
  2879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2880. return $core.withContext(function($ctx1) {
  2881. //>>excludeEnd("ctx");
  2882. return $recv(self._keys())._size();
  2883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2884. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2885. //>>excludeEnd("ctx");
  2886. },
  2887. //>>excludeStart("ide", pragmas.excludeIdeData);
  2888. args: [],
  2889. source: "size\x0a\x09^ self keys size",
  2890. referencedClasses: [],
  2891. //>>excludeEnd("ide");
  2892. messageSends: ["size", "keys"]
  2893. }),
  2894. $globals.AssociativeCollection);
  2895. $core.addMethod(
  2896. $core.method({
  2897. selector: "values",
  2898. protocol: "accessing",
  2899. fn: function (){
  2900. var self=this;
  2901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2902. return $core.withContext(function($ctx1) {
  2903. //>>excludeEnd("ctx");
  2904. self._subclassResponsibility();
  2905. return self;
  2906. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2907. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2908. //>>excludeEnd("ctx");
  2909. },
  2910. //>>excludeStart("ide", pragmas.excludeIdeData);
  2911. args: [],
  2912. source: "values\x0a\x09self subclassResponsibility",
  2913. referencedClasses: [],
  2914. //>>excludeEnd("ide");
  2915. messageSends: ["subclassResponsibility"]
  2916. }),
  2917. $globals.AssociativeCollection);
  2918. $core.addMethod(
  2919. $core.method({
  2920. selector: "valuesDo:",
  2921. protocol: "enumerating",
  2922. fn: function (aBlock){
  2923. var self=this;
  2924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2925. return $core.withContext(function($ctx1) {
  2926. //>>excludeEnd("ctx");
  2927. self._subclassResponsibility();
  2928. return self;
  2929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2930. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2931. //>>excludeEnd("ctx");
  2932. },
  2933. //>>excludeStart("ide", pragmas.excludeIdeData);
  2934. args: ["aBlock"],
  2935. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2936. referencedClasses: [],
  2937. //>>excludeEnd("ide");
  2938. messageSends: ["subclassResponsibility"]
  2939. }),
  2940. $globals.AssociativeCollection);
  2941. $core.addMethod(
  2942. $core.method({
  2943. selector: "withIndexDo:",
  2944. protocol: "enumerating",
  2945. fn: function (aBlock){
  2946. var self=this;
  2947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2948. return $core.withContext(function($ctx1) {
  2949. //>>excludeEnd("ctx");
  2950. self._keysAndValuesDo_((function(key,value){
  2951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2952. return $core.withContext(function($ctx2) {
  2953. //>>excludeEnd("ctx");
  2954. return $recv(aBlock)._value_value_(value,key);
  2955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2956. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2957. //>>excludeEnd("ctx");
  2958. }));
  2959. return self;
  2960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2961. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2962. //>>excludeEnd("ctx");
  2963. },
  2964. //>>excludeStart("ide", pragmas.excludeIdeData);
  2965. args: ["aBlock"],
  2966. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2967. referencedClasses: [],
  2968. //>>excludeEnd("ide");
  2969. messageSends: ["keysAndValuesDo:", "value:value:"]
  2970. }),
  2971. $globals.AssociativeCollection);
  2972. $core.addMethod(
  2973. $core.method({
  2974. selector: "from:",
  2975. protocol: "instance creation",
  2976. fn: function (aCollection){
  2977. var self=this;
  2978. var newCollection;
  2979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2980. return $core.withContext(function($ctx1) {
  2981. //>>excludeEnd("ctx");
  2982. newCollection=self._new();
  2983. $recv(aCollection)._do_((function(each){
  2984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2985. return $core.withContext(function($ctx2) {
  2986. //>>excludeEnd("ctx");
  2987. return $recv(newCollection)._add_(each);
  2988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2989. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2990. //>>excludeEnd("ctx");
  2991. }));
  2992. return newCollection;
  2993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2994. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  2995. //>>excludeEnd("ctx");
  2996. },
  2997. //>>excludeStart("ide", pragmas.excludeIdeData);
  2998. args: ["aCollection"],
  2999. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  3000. referencedClasses: [],
  3001. //>>excludeEnd("ide");
  3002. messageSends: ["new", "do:", "add:"]
  3003. }),
  3004. $globals.AssociativeCollection.klass);
  3005. $core.addMethod(
  3006. $core.method({
  3007. selector: "fromPairs:",
  3008. protocol: "instance creation",
  3009. fn: function (aCollection){
  3010. var self=this;
  3011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3012. return $core.withContext(function($ctx1) {
  3013. //>>excludeEnd("ctx");
  3014. return self._from_(aCollection);
  3015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3016. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  3017. //>>excludeEnd("ctx");
  3018. },
  3019. //>>excludeStart("ide", pragmas.excludeIdeData);
  3020. args: ["aCollection"],
  3021. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  3022. referencedClasses: [],
  3023. //>>excludeEnd("ide");
  3024. messageSends: ["from:"]
  3025. }),
  3026. $globals.AssociativeCollection.klass);
  3027. $core.addMethod(
  3028. $core.method({
  3029. selector: "newFromPairs:",
  3030. protocol: "instance creation",
  3031. fn: function (aCollection){
  3032. var self=this;
  3033. var newCollection;
  3034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3035. return $core.withContext(function($ctx1) {
  3036. //>>excludeEnd("ctx");
  3037. var $2,$1,$3,$4;
  3038. $2=$recv(aCollection)._size();
  3039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3040. $ctx1.sendIdx["size"]=1;
  3041. //>>excludeEnd("ctx");
  3042. $1=$recv($2)._even();
  3043. if(!$core.assert($1)){
  3044. self._error_("#newFromPairs only accepts arrays of an even length");
  3045. }
  3046. newCollection=self._new();
  3047. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  3048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3049. return $core.withContext(function($ctx2) {
  3050. //>>excludeEnd("ctx");
  3051. $3=newCollection;
  3052. $4=$recv(aCollection)._at_(each);
  3053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3054. $ctx2.sendIdx["at:"]=1;
  3055. //>>excludeEnd("ctx");
  3056. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  3057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3058. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3059. //>>excludeEnd("ctx");
  3060. }));
  3061. return newCollection;
  3062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3063. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  3064. //>>excludeEnd("ctx");
  3065. },
  3066. //>>excludeStart("ide", pragmas.excludeIdeData);
  3067. args: ["aCollection"],
  3068. 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",
  3069. referencedClasses: [],
  3070. //>>excludeEnd("ide");
  3071. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3072. }),
  3073. $globals.AssociativeCollection.klass);
  3074. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  3075. //>>excludeStart("ide", pragmas.excludeIdeData);
  3076. $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.";
  3077. //>>excludeEnd("ide");
  3078. $core.addMethod(
  3079. $core.method({
  3080. selector: "at:ifAbsent:",
  3081. protocol: "accessing",
  3082. fn: function (aKey,aBlock){
  3083. var self=this;
  3084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3085. return $core.withContext(function($ctx1) {
  3086. //>>excludeEnd("ctx");
  3087. var index = self._positionOfKey_(aKey);
  3088. return index >=0 ? self['@values'][index] : aBlock._value();
  3089. ;
  3090. return self;
  3091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3092. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3093. //>>excludeEnd("ctx");
  3094. },
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. args: ["aKey", "aBlock"],
  3097. 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'>",
  3098. referencedClasses: [],
  3099. //>>excludeEnd("ide");
  3100. messageSends: []
  3101. }),
  3102. $globals.Dictionary);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "at:put:",
  3106. protocol: "accessing",
  3107. fn: function (aKey,aValue){
  3108. var self=this;
  3109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3110. return $core.withContext(function($ctx1) {
  3111. //>>excludeEnd("ctx");
  3112. var index = self._positionOfKey_(aKey);
  3113. if(index === -1) {
  3114. var keys = self['@keys'];
  3115. index = keys.length;
  3116. keys.push(aKey);
  3117. }
  3118. return self['@values'][index] = aValue;
  3119. ;
  3120. return self;
  3121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3122. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3123. //>>excludeEnd("ctx");
  3124. },
  3125. //>>excludeStart("ide", pragmas.excludeIdeData);
  3126. args: ["aKey", "aValue"],
  3127. 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'>",
  3128. referencedClasses: [],
  3129. //>>excludeEnd("ide");
  3130. messageSends: []
  3131. }),
  3132. $globals.Dictionary);
  3133. $core.addMethod(
  3134. $core.method({
  3135. selector: "includesKey:",
  3136. protocol: "testing",
  3137. fn: function (aKey){
  3138. var self=this;
  3139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3140. return $core.withContext(function($ctx1) {
  3141. //>>excludeEnd("ctx");
  3142. return self._positionOfKey_(aKey) >= 0;;
  3143. return self;
  3144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3145. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3146. //>>excludeEnd("ctx");
  3147. },
  3148. //>>excludeStart("ide", pragmas.excludeIdeData);
  3149. args: ["aKey"],
  3150. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self._positionOfKey_(aKey) >= 0;'>",
  3151. referencedClasses: [],
  3152. //>>excludeEnd("ide");
  3153. messageSends: []
  3154. }),
  3155. $globals.Dictionary);
  3156. $core.addMethod(
  3157. $core.method({
  3158. selector: "indexOf:ifAbsent:",
  3159. protocol: "accessing",
  3160. fn: function (anObject,aBlock){
  3161. var self=this;
  3162. var index;
  3163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3164. return $core.withContext(function($ctx1) {
  3165. //>>excludeEnd("ctx");
  3166. var $1;
  3167. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3168. return (0);
  3169. }));
  3170. $1=$recv(index).__eq((0));
  3171. if($core.assert($1)){
  3172. return $recv(aBlock)._value();
  3173. } else {
  3174. return $recv(self["@keys"])._at_(index);
  3175. }
  3176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3177. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3178. //>>excludeEnd("ctx");
  3179. },
  3180. //>>excludeStart("ide", pragmas.excludeIdeData);
  3181. args: ["anObject", "aBlock"],
  3182. 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 ]",
  3183. referencedClasses: [],
  3184. //>>excludeEnd("ide");
  3185. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3186. }),
  3187. $globals.Dictionary);
  3188. $core.addMethod(
  3189. $core.method({
  3190. selector: "initialize",
  3191. protocol: "initialization",
  3192. fn: function (){
  3193. var self=this;
  3194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3195. return $core.withContext(function($ctx1) {
  3196. //>>excludeEnd("ctx");
  3197. (
  3198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3199. $ctx1.supercall = true,
  3200. //>>excludeEnd("ctx");
  3201. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  3202. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3203. $ctx1.supercall = false;
  3204. //>>excludeEnd("ctx");;
  3205. self["@keys"]=[];
  3206. self["@values"]=[];
  3207. return self;
  3208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3209. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3210. //>>excludeEnd("ctx");
  3211. },
  3212. //>>excludeStart("ide", pragmas.excludeIdeData);
  3213. args: [],
  3214. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3215. referencedClasses: [],
  3216. //>>excludeEnd("ide");
  3217. messageSends: ["initialize"]
  3218. }),
  3219. $globals.Dictionary);
  3220. $core.addMethod(
  3221. $core.method({
  3222. selector: "keys",
  3223. protocol: "accessing",
  3224. fn: function (){
  3225. var self=this;
  3226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3227. return $core.withContext(function($ctx1) {
  3228. //>>excludeEnd("ctx");
  3229. return $recv(self["@keys"])._copy();
  3230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3231. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3232. //>>excludeEnd("ctx");
  3233. },
  3234. //>>excludeStart("ide", pragmas.excludeIdeData);
  3235. args: [],
  3236. source: "keys\x0a\x09^ keys copy",
  3237. referencedClasses: [],
  3238. //>>excludeEnd("ide");
  3239. messageSends: ["copy"]
  3240. }),
  3241. $globals.Dictionary);
  3242. $core.addMethod(
  3243. $core.method({
  3244. selector: "keysAndValuesDo:",
  3245. protocol: "enumerating",
  3246. fn: function (aBlock){
  3247. var self=this;
  3248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3249. return $core.withContext(function($ctx1) {
  3250. //>>excludeEnd("ctx");
  3251. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  3252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3253. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3254. //>>excludeEnd("ctx");
  3255. },
  3256. //>>excludeStart("ide", pragmas.excludeIdeData);
  3257. args: ["aBlock"],
  3258. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3259. referencedClasses: [],
  3260. //>>excludeEnd("ide");
  3261. messageSends: ["with:do:"]
  3262. }),
  3263. $globals.Dictionary);
  3264. $core.addMethod(
  3265. $core.method({
  3266. selector: "keysDo:",
  3267. protocol: "enumerating",
  3268. fn: function (aBlock){
  3269. var self=this;
  3270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3271. return $core.withContext(function($ctx1) {
  3272. //>>excludeEnd("ctx");
  3273. return $recv(self["@keys"])._do_(aBlock);
  3274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3275. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3276. //>>excludeEnd("ctx");
  3277. },
  3278. //>>excludeStart("ide", pragmas.excludeIdeData);
  3279. args: ["aBlock"],
  3280. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3281. referencedClasses: [],
  3282. //>>excludeEnd("ide");
  3283. messageSends: ["do:"]
  3284. }),
  3285. $globals.Dictionary);
  3286. $core.addMethod(
  3287. $core.method({
  3288. selector: "positionOfKey:",
  3289. protocol: "private",
  3290. fn: function (anObject){
  3291. var self=this;
  3292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3293. return $core.withContext(function($ctx1) {
  3294. //>>excludeEnd("ctx");
  3295. var keys = self['@keys'];
  3296. for(var i=0;i<keys.length;i++){
  3297. if(keys[i].__eq(anObject)) { return i;}
  3298. }
  3299. return -1;
  3300. ;
  3301. return self;
  3302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3303. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3304. //>>excludeEnd("ctx");
  3305. },
  3306. //>>excludeStart("ide", pragmas.excludeIdeData);
  3307. args: ["anObject"],
  3308. 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'>",
  3309. referencedClasses: [],
  3310. //>>excludeEnd("ide");
  3311. messageSends: []
  3312. }),
  3313. $globals.Dictionary);
  3314. $core.addMethod(
  3315. $core.method({
  3316. selector: "removeAll",
  3317. protocol: "adding/removing",
  3318. fn: function (){
  3319. var self=this;
  3320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3321. return $core.withContext(function($ctx1) {
  3322. //>>excludeEnd("ctx");
  3323. $recv(self["@keys"])._removeAll();
  3324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3325. $ctx1.sendIdx["removeAll"]=1;
  3326. //>>excludeEnd("ctx");
  3327. $recv(self["@values"])._removeAll();
  3328. return self;
  3329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3330. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3331. //>>excludeEnd("ctx");
  3332. },
  3333. //>>excludeStart("ide", pragmas.excludeIdeData);
  3334. args: [],
  3335. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3336. referencedClasses: [],
  3337. //>>excludeEnd("ide");
  3338. messageSends: ["removeAll"]
  3339. }),
  3340. $globals.Dictionary);
  3341. $core.addMethod(
  3342. $core.method({
  3343. selector: "removeKey:ifAbsent:",
  3344. protocol: "adding/removing",
  3345. fn: function (aKey,aBlock){
  3346. var self=this;
  3347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3348. return $core.withContext(function($ctx1) {
  3349. //>>excludeEnd("ctx");
  3350. var index = self._positionOfKey_(aKey);
  3351. if(index === -1) {
  3352. return aBlock._value()
  3353. } else {
  3354. var keys = self['@keys'], values = self['@values'];
  3355. var value = values[index], l = keys.length;
  3356. keys[index] = keys[l-1];
  3357. keys.pop();
  3358. values[index] = values[l-1];
  3359. values.pop();
  3360. return value;
  3361. }
  3362. ;
  3363. return self;
  3364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3365. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3366. //>>excludeEnd("ctx");
  3367. },
  3368. //>>excludeStart("ide", pragmas.excludeIdeData);
  3369. args: ["aKey", "aBlock"],
  3370. 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'>",
  3371. referencedClasses: [],
  3372. //>>excludeEnd("ide");
  3373. messageSends: []
  3374. }),
  3375. $globals.Dictionary);
  3376. $core.addMethod(
  3377. $core.method({
  3378. selector: "values",
  3379. protocol: "accessing",
  3380. fn: function (){
  3381. var self=this;
  3382. return self["@values"];
  3383. },
  3384. //>>excludeStart("ide", pragmas.excludeIdeData);
  3385. args: [],
  3386. source: "values\x0a\x09^ values",
  3387. referencedClasses: [],
  3388. //>>excludeEnd("ide");
  3389. messageSends: []
  3390. }),
  3391. $globals.Dictionary);
  3392. $core.addMethod(
  3393. $core.method({
  3394. selector: "valuesDo:",
  3395. protocol: "enumerating",
  3396. fn: function (aBlock){
  3397. var self=this;
  3398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3399. return $core.withContext(function($ctx1) {
  3400. //>>excludeEnd("ctx");
  3401. return $recv(self["@values"])._do_(aBlock);
  3402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3403. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3404. //>>excludeEnd("ctx");
  3405. },
  3406. //>>excludeStart("ide", pragmas.excludeIdeData);
  3407. args: ["aBlock"],
  3408. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3409. referencedClasses: [],
  3410. //>>excludeEnd("ide");
  3411. messageSends: ["do:"]
  3412. }),
  3413. $globals.Dictionary);
  3414. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  3415. //>>excludeStart("ide", pragmas.excludeIdeData);
  3416. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3417. //>>excludeEnd("ide");
  3418. $core.addMethod(
  3419. $core.method({
  3420. selector: "at:ifAbsent:",
  3421. protocol: "accessing",
  3422. fn: function (aKey,aBlock){
  3423. var self=this;
  3424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3425. return $core.withContext(function($ctx1) {
  3426. //>>excludeEnd("ctx");
  3427. var $1;
  3428. $1=self._includesKey_(aKey);
  3429. if($core.assert($1)){
  3430. return self._basicAt_(aKey);
  3431. } else {
  3432. return $recv(aBlock)._value();
  3433. }
  3434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3435. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3436. //>>excludeEnd("ctx");
  3437. },
  3438. //>>excludeStart("ide", pragmas.excludeIdeData);
  3439. args: ["aKey", "aBlock"],
  3440. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3441. referencedClasses: [],
  3442. //>>excludeEnd("ide");
  3443. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3444. }),
  3445. $globals.HashedCollection);
  3446. $core.addMethod(
  3447. $core.method({
  3448. selector: "at:put:",
  3449. protocol: "accessing",
  3450. fn: function (aKey,aValue){
  3451. var self=this;
  3452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3453. return $core.withContext(function($ctx1) {
  3454. //>>excludeEnd("ctx");
  3455. return self._basicAt_put_(aKey,aValue);
  3456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3457. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3458. //>>excludeEnd("ctx");
  3459. },
  3460. //>>excludeStart("ide", pragmas.excludeIdeData);
  3461. args: ["aKey", "aValue"],
  3462. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3463. referencedClasses: [],
  3464. //>>excludeEnd("ide");
  3465. messageSends: ["basicAt:put:"]
  3466. }),
  3467. $globals.HashedCollection);
  3468. $core.addMethod(
  3469. $core.method({
  3470. selector: "includesKey:",
  3471. protocol: "testing",
  3472. fn: function (aKey){
  3473. var self=this;
  3474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3475. return $core.withContext(function($ctx1) {
  3476. //>>excludeEnd("ctx");
  3477. return self.hasOwnProperty(aKey);
  3478. return self;
  3479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3480. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3481. //>>excludeEnd("ctx");
  3482. },
  3483. //>>excludeStart("ide", pragmas.excludeIdeData);
  3484. args: ["aKey"],
  3485. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3486. referencedClasses: [],
  3487. //>>excludeEnd("ide");
  3488. messageSends: []
  3489. }),
  3490. $globals.HashedCollection);
  3491. $core.addMethod(
  3492. $core.method({
  3493. selector: "keys",
  3494. protocol: "accessing",
  3495. fn: function (){
  3496. var self=this;
  3497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3498. return $core.withContext(function($ctx1) {
  3499. //>>excludeEnd("ctx");
  3500. return Object.keys(self);
  3501. return self;
  3502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3503. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3504. //>>excludeEnd("ctx");
  3505. },
  3506. //>>excludeStart("ide", pragmas.excludeIdeData);
  3507. args: [],
  3508. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3509. referencedClasses: [],
  3510. //>>excludeEnd("ide");
  3511. messageSends: []
  3512. }),
  3513. $globals.HashedCollection);
  3514. $core.addMethod(
  3515. $core.method({
  3516. selector: "keysDo:",
  3517. protocol: "enumerating",
  3518. fn: function (aBlock){
  3519. var self=this;
  3520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3521. return $core.withContext(function($ctx1) {
  3522. //>>excludeEnd("ctx");
  3523. $recv(self._keys())._do_(aBlock);
  3524. return self;
  3525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3526. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3527. //>>excludeEnd("ctx");
  3528. },
  3529. //>>excludeStart("ide", pragmas.excludeIdeData);
  3530. args: ["aBlock"],
  3531. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3532. referencedClasses: [],
  3533. //>>excludeEnd("ide");
  3534. messageSends: ["do:", "keys"]
  3535. }),
  3536. $globals.HashedCollection);
  3537. $core.addMethod(
  3538. $core.method({
  3539. selector: "removeKey:ifAbsent:",
  3540. protocol: "adding/removing",
  3541. fn: function (aKey,aBlock){
  3542. var self=this;
  3543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3544. return $core.withContext(function($ctx1) {
  3545. //>>excludeEnd("ctx");
  3546. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3548. return $core.withContext(function($ctx2) {
  3549. //>>excludeEnd("ctx");
  3550. self._basicDelete_(aKey);
  3551. return removed;
  3552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3553. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3554. //>>excludeEnd("ctx");
  3555. }),(function(){
  3556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3557. return $core.withContext(function($ctx2) {
  3558. //>>excludeEnd("ctx");
  3559. return $recv(aBlock)._value();
  3560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3561. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3562. //>>excludeEnd("ctx");
  3563. }));
  3564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3565. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3566. //>>excludeEnd("ctx");
  3567. },
  3568. //>>excludeStart("ide", pragmas.excludeIdeData);
  3569. args: ["aKey", "aBlock"],
  3570. 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 ]",
  3571. referencedClasses: [],
  3572. //>>excludeEnd("ide");
  3573. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3574. }),
  3575. $globals.HashedCollection);
  3576. $core.addMethod(
  3577. $core.method({
  3578. selector: "values",
  3579. protocol: "accessing",
  3580. fn: function (){
  3581. var self=this;
  3582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3583. return $core.withContext(function($ctx1) {
  3584. //>>excludeEnd("ctx");
  3585. return self._keys().map(function(key){
  3586. return self._at_(key);
  3587. });
  3588. ;
  3589. return self;
  3590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3591. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3592. //>>excludeEnd("ctx");
  3593. },
  3594. //>>excludeStart("ide", pragmas.excludeIdeData);
  3595. args: [],
  3596. 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'>",
  3597. referencedClasses: [],
  3598. //>>excludeEnd("ide");
  3599. messageSends: []
  3600. }),
  3601. $globals.HashedCollection);
  3602. $core.addMethod(
  3603. $core.method({
  3604. selector: "valuesDo:",
  3605. protocol: "enumerating",
  3606. fn: function (aBlock){
  3607. var self=this;
  3608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3609. return $core.withContext(function($ctx1) {
  3610. //>>excludeEnd("ctx");
  3611. $recv(self._values())._do_(aBlock);
  3612. return self;
  3613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3614. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3615. //>>excludeEnd("ctx");
  3616. },
  3617. //>>excludeStart("ide", pragmas.excludeIdeData);
  3618. args: ["aBlock"],
  3619. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3620. referencedClasses: [],
  3621. //>>excludeEnd("ide");
  3622. messageSends: ["do:", "values"]
  3623. }),
  3624. $globals.HashedCollection);
  3625. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  3626. //>>excludeStart("ide", pragmas.excludeIdeData);
  3627. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3628. //>>excludeEnd("ide");
  3629. $core.addMethod(
  3630. $core.method({
  3631. selector: "=",
  3632. protocol: "comparing",
  3633. fn: function (aCollection){
  3634. var self=this;
  3635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3636. return $core.withContext(function($ctx1) {
  3637. //>>excludeEnd("ctx");
  3638. var $3,$2,$4,$1,$5;
  3639. var $early={};
  3640. try {
  3641. $3=self._class();
  3642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3643. $ctx1.sendIdx["class"]=1;
  3644. //>>excludeEnd("ctx");
  3645. $2=$recv($3).__eq($recv(aCollection)._class());
  3646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3647. $ctx1.sendIdx["="]=1;
  3648. //>>excludeEnd("ctx");
  3649. $1=$recv($2)._and_((function(){
  3650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3651. return $core.withContext(function($ctx2) {
  3652. //>>excludeEnd("ctx");
  3653. $4=self._size();
  3654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3655. $ctx2.sendIdx["size"]=1;
  3656. //>>excludeEnd("ctx");
  3657. return $recv($4).__eq($recv(aCollection)._size());
  3658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3659. $ctx2.sendIdx["="]=2;
  3660. //>>excludeEnd("ctx");
  3661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3663. //>>excludeEnd("ctx");
  3664. }));
  3665. if(!$core.assert($1)){
  3666. return false;
  3667. }
  3668. self._withIndexDo_((function(each,i){
  3669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3670. return $core.withContext(function($ctx2) {
  3671. //>>excludeEnd("ctx");
  3672. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3673. if(!$core.assert($5)){
  3674. throw $early=[false];
  3675. }
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3678. //>>excludeEnd("ctx");
  3679. }));
  3680. return true;
  3681. }
  3682. catch(e) {if(e===$early)return e[0]; throw e}
  3683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3684. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3685. //>>excludeEnd("ctx");
  3686. },
  3687. //>>excludeStart("ide", pragmas.excludeIdeData);
  3688. args: ["aCollection"],
  3689. 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",
  3690. referencedClasses: [],
  3691. //>>excludeEnd("ide");
  3692. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3693. }),
  3694. $globals.SequenceableCollection);
  3695. $core.addMethod(
  3696. $core.method({
  3697. selector: "addLast:",
  3698. protocol: "adding/removing",
  3699. fn: function (anObject){
  3700. var self=this;
  3701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3702. return $core.withContext(function($ctx1) {
  3703. //>>excludeEnd("ctx");
  3704. self._add_(anObject);
  3705. return self;
  3706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3707. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3708. //>>excludeEnd("ctx");
  3709. },
  3710. //>>excludeStart("ide", pragmas.excludeIdeData);
  3711. args: ["anObject"],
  3712. source: "addLast: anObject\x0a\x09self add: anObject",
  3713. referencedClasses: [],
  3714. //>>excludeEnd("ide");
  3715. messageSends: ["add:"]
  3716. }),
  3717. $globals.SequenceableCollection);
  3718. $core.addMethod(
  3719. $core.method({
  3720. selector: "allButFirst",
  3721. protocol: "accessing",
  3722. fn: function (){
  3723. var self=this;
  3724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3725. return $core.withContext(function($ctx1) {
  3726. //>>excludeEnd("ctx");
  3727. return self._copyFrom_to_((2),self._size());
  3728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3729. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3730. //>>excludeEnd("ctx");
  3731. },
  3732. //>>excludeStart("ide", pragmas.excludeIdeData);
  3733. args: [],
  3734. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3735. referencedClasses: [],
  3736. //>>excludeEnd("ide");
  3737. messageSends: ["copyFrom:to:", "size"]
  3738. }),
  3739. $globals.SequenceableCollection);
  3740. $core.addMethod(
  3741. $core.method({
  3742. selector: "allButLast",
  3743. protocol: "accessing",
  3744. fn: function (){
  3745. var self=this;
  3746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3747. return $core.withContext(function($ctx1) {
  3748. //>>excludeEnd("ctx");
  3749. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  3750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3751. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3752. //>>excludeEnd("ctx");
  3753. },
  3754. //>>excludeStart("ide", pragmas.excludeIdeData);
  3755. args: [],
  3756. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3757. referencedClasses: [],
  3758. //>>excludeEnd("ide");
  3759. messageSends: ["copyFrom:to:", "-", "size"]
  3760. }),
  3761. $globals.SequenceableCollection);
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "anyOne",
  3765. protocol: "accessing",
  3766. fn: function (){
  3767. var self=this;
  3768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3769. return $core.withContext(function($ctx1) {
  3770. //>>excludeEnd("ctx");
  3771. return self._at_((1));
  3772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3773. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3774. //>>excludeEnd("ctx");
  3775. },
  3776. //>>excludeStart("ide", pragmas.excludeIdeData);
  3777. args: [],
  3778. source: "anyOne\x0a\x09^ self at: 1",
  3779. referencedClasses: [],
  3780. //>>excludeEnd("ide");
  3781. messageSends: ["at:"]
  3782. }),
  3783. $globals.SequenceableCollection);
  3784. $core.addMethod(
  3785. $core.method({
  3786. selector: "atRandom",
  3787. protocol: "accessing",
  3788. fn: function (){
  3789. var self=this;
  3790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3791. return $core.withContext(function($ctx1) {
  3792. //>>excludeEnd("ctx");
  3793. return self._at_($recv(self._size())._atRandom());
  3794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3795. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3796. //>>excludeEnd("ctx");
  3797. },
  3798. //>>excludeStart("ide", pragmas.excludeIdeData);
  3799. args: [],
  3800. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3801. referencedClasses: [],
  3802. //>>excludeEnd("ide");
  3803. messageSends: ["at:", "atRandom", "size"]
  3804. }),
  3805. $globals.SequenceableCollection);
  3806. $core.addMethod(
  3807. $core.method({
  3808. selector: "beginsWith:",
  3809. protocol: "testing",
  3810. fn: function (prefix){
  3811. var self=this;
  3812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3813. return $core.withContext(function($ctx1) {
  3814. //>>excludeEnd("ctx");
  3815. var $2,$3,$1;
  3816. $2=self._size();
  3817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3818. $ctx1.sendIdx["size"]=1;
  3819. //>>excludeEnd("ctx");
  3820. $3=$recv(prefix)._size();
  3821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3822. $ctx1.sendIdx["size"]=2;
  3823. //>>excludeEnd("ctx");
  3824. $1=$recv($2).__lt($3);
  3825. if($core.assert($1)){
  3826. return false;
  3827. }
  3828. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  3829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3830. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3831. //>>excludeEnd("ctx");
  3832. },
  3833. //>>excludeStart("ide", pragmas.excludeIdeData);
  3834. args: ["prefix"],
  3835. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3836. referencedClasses: [],
  3837. //>>excludeEnd("ide");
  3838. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3839. }),
  3840. $globals.SequenceableCollection);
  3841. $core.addMethod(
  3842. $core.method({
  3843. selector: "copyFrom:to:",
  3844. protocol: "copying",
  3845. fn: function (anIndex,anotherIndex){
  3846. var self=this;
  3847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3848. return $core.withContext(function($ctx1) {
  3849. //>>excludeEnd("ctx");
  3850. self._subclassResponsibility();
  3851. return self;
  3852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3853. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3854. //>>excludeEnd("ctx");
  3855. },
  3856. //>>excludeStart("ide", pragmas.excludeIdeData);
  3857. args: ["anIndex", "anotherIndex"],
  3858. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3859. referencedClasses: [],
  3860. //>>excludeEnd("ide");
  3861. messageSends: ["subclassResponsibility"]
  3862. }),
  3863. $globals.SequenceableCollection);
  3864. $core.addMethod(
  3865. $core.method({
  3866. selector: "detect:ifNone:",
  3867. protocol: "enumerating",
  3868. fn: function (aBlock,anotherBlock){
  3869. var self=this;
  3870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3871. return $core.withContext(function($ctx1) {
  3872. //>>excludeEnd("ctx");
  3873. self = self._numericallyIndexable();
  3874. for(var i = 0; i < self.length; i++)
  3875. if(aBlock._value_(self[i]))
  3876. return self[i];
  3877. return anotherBlock._value();
  3878. ;
  3879. return self;
  3880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3881. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3882. //>>excludeEnd("ctx");
  3883. },
  3884. //>>excludeStart("ide", pragmas.excludeIdeData);
  3885. args: ["aBlock", "anotherBlock"],
  3886. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  3887. referencedClasses: [],
  3888. //>>excludeEnd("ide");
  3889. messageSends: []
  3890. }),
  3891. $globals.SequenceableCollection);
  3892. $core.addMethod(
  3893. $core.method({
  3894. selector: "do:",
  3895. protocol: "enumerating",
  3896. fn: function (aBlock){
  3897. var self=this;
  3898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3899. return $core.withContext(function($ctx1) {
  3900. //>>excludeEnd("ctx");
  3901. self = self._numericallyIndexable();
  3902. for(var i=0; i < self.length; i++) {
  3903. aBlock._value_(self[i]);
  3904. }
  3905. ;
  3906. return self;
  3907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3908. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3909. //>>excludeEnd("ctx");
  3910. },
  3911. //>>excludeStart("ide", pragmas.excludeIdeData);
  3912. args: ["aBlock"],
  3913. source: "do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09for(var i=0; i < self.length; i++) {\x0a\x09\x09\x09aBlock._value_(self[i]);\x0a\x09\x09}\x0a\x09'>",
  3914. referencedClasses: [],
  3915. //>>excludeEnd("ide");
  3916. messageSends: []
  3917. }),
  3918. $globals.SequenceableCollection);
  3919. $core.addMethod(
  3920. $core.method({
  3921. selector: "endsWith:",
  3922. protocol: "testing",
  3923. fn: function (suffix){
  3924. var self=this;
  3925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3926. return $core.withContext(function($ctx1) {
  3927. //>>excludeEnd("ctx");
  3928. var $2,$3,$1;
  3929. $2=self._size();
  3930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3931. $ctx1.sendIdx["size"]=1;
  3932. //>>excludeEnd("ctx");
  3933. $3=$recv(suffix)._size();
  3934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3935. $ctx1.sendIdx["size"]=2;
  3936. //>>excludeEnd("ctx");
  3937. $1=$recv($2).__lt($3);
  3938. if($core.assert($1)){
  3939. return false;
  3940. }
  3941. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  3942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3943. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3944. //>>excludeEnd("ctx");
  3945. },
  3946. //>>excludeStart("ide", pragmas.excludeIdeData);
  3947. args: ["suffix"],
  3948. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3949. referencedClasses: [],
  3950. //>>excludeEnd("ide");
  3951. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3952. }),
  3953. $globals.SequenceableCollection);
  3954. $core.addMethod(
  3955. $core.method({
  3956. selector: "first",
  3957. protocol: "accessing",
  3958. fn: function (){
  3959. var self=this;
  3960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3961. return $core.withContext(function($ctx1) {
  3962. //>>excludeEnd("ctx");
  3963. return self._at_((1));
  3964. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3965. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3966. //>>excludeEnd("ctx");
  3967. },
  3968. //>>excludeStart("ide", pragmas.excludeIdeData);
  3969. args: [],
  3970. source: "first\x0a\x09^ self at: 1",
  3971. referencedClasses: [],
  3972. //>>excludeEnd("ide");
  3973. messageSends: ["at:"]
  3974. }),
  3975. $globals.SequenceableCollection);
  3976. $core.addMethod(
  3977. $core.method({
  3978. selector: "first:",
  3979. protocol: "accessing",
  3980. fn: function (aNumber){
  3981. var self=this;
  3982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3983. return $core.withContext(function($ctx1) {
  3984. //>>excludeEnd("ctx");
  3985. var $1;
  3986. $1=$recv(self._size()).__lt(aNumber);
  3987. if($core.assert($1)){
  3988. self._error_("Invalid number of elements");
  3989. }
  3990. return self._copyFrom_to_((1),aNumber);
  3991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3992. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3993. //>>excludeEnd("ctx");
  3994. },
  3995. //>>excludeStart("ide", pragmas.excludeIdeData);
  3996. args: ["aNumber"],
  3997. 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",
  3998. referencedClasses: [],
  3999. //>>excludeEnd("ide");
  4000. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  4001. }),
  4002. $globals.SequenceableCollection);
  4003. $core.addMethod(
  4004. $core.method({
  4005. selector: "fourth",
  4006. protocol: "accessing",
  4007. fn: function (){
  4008. var self=this;
  4009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4010. return $core.withContext(function($ctx1) {
  4011. //>>excludeEnd("ctx");
  4012. return self._at_((4));
  4013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4014. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  4015. //>>excludeEnd("ctx");
  4016. },
  4017. //>>excludeStart("ide", pragmas.excludeIdeData);
  4018. args: [],
  4019. source: "fourth\x0a\x09^ self at: 4",
  4020. referencedClasses: [],
  4021. //>>excludeEnd("ide");
  4022. messageSends: ["at:"]
  4023. }),
  4024. $globals.SequenceableCollection);
  4025. $core.addMethod(
  4026. $core.method({
  4027. selector: "includes:",
  4028. protocol: "testing",
  4029. fn: function (anObject){
  4030. var self=this;
  4031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4032. return $core.withContext(function($ctx1) {
  4033. //>>excludeEnd("ctx");
  4034. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  4035. return nil;
  4036. })))._notNil();
  4037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4038. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  4039. //>>excludeEnd("ctx");
  4040. },
  4041. //>>excludeStart("ide", pragmas.excludeIdeData);
  4042. args: ["anObject"],
  4043. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4044. referencedClasses: [],
  4045. //>>excludeEnd("ide");
  4046. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4047. }),
  4048. $globals.SequenceableCollection);
  4049. $core.addMethod(
  4050. $core.method({
  4051. selector: "indexOf:ifAbsent:",
  4052. protocol: "accessing",
  4053. fn: function (anObject,aBlock){
  4054. var self=this;
  4055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4056. return $core.withContext(function($ctx1) {
  4057. //>>excludeEnd("ctx");
  4058. self = self._numericallyIndexable();
  4059. for(var i=0; i < self.length; i++) {
  4060. if($recv(self[i]).__eq(anObject)) {return i+1}
  4061. };
  4062. return aBlock._value();
  4063. ;
  4064. return self;
  4065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4066. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  4067. //>>excludeEnd("ctx");
  4068. },
  4069. //>>excludeStart("ide", pragmas.excludeIdeData);
  4070. args: ["anObject", "aBlock"],
  4071. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  4072. referencedClasses: [],
  4073. //>>excludeEnd("ide");
  4074. messageSends: []
  4075. }),
  4076. $globals.SequenceableCollection);
  4077. $core.addMethod(
  4078. $core.method({
  4079. selector: "indexOf:startingAt:",
  4080. protocol: "accessing",
  4081. fn: function (anObject,start){
  4082. var self=this;
  4083. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4084. return $core.withContext(function($ctx1) {
  4085. //>>excludeEnd("ctx");
  4086. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4087. return (0);
  4088. }));
  4089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4090. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4091. //>>excludeEnd("ctx");
  4092. },
  4093. //>>excludeStart("ide", pragmas.excludeIdeData);
  4094. args: ["anObject", "start"],
  4095. 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 ]",
  4096. referencedClasses: [],
  4097. //>>excludeEnd("ide");
  4098. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4099. }),
  4100. $globals.SequenceableCollection);
  4101. $core.addMethod(
  4102. $core.method({
  4103. selector: "indexOf:startingAt:ifAbsent:",
  4104. protocol: "accessing",
  4105. fn: function (anObject,start,aBlock){
  4106. var self=this;
  4107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4108. return $core.withContext(function($ctx1) {
  4109. //>>excludeEnd("ctx");
  4110. self = self._numericallyIndexable();
  4111. for(var i=start - 1; i < self.length; i++){
  4112. if($recv(self[i]).__eq(anObject)) {return i+1}
  4113. }
  4114. return aBlock._value();
  4115. ;
  4116. return self;
  4117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4118. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4119. //>>excludeEnd("ctx");
  4120. },
  4121. //>>excludeStart("ide", pragmas.excludeIdeData);
  4122. args: ["anObject", "start", "aBlock"],
  4123. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  4124. referencedClasses: [],
  4125. //>>excludeEnd("ide");
  4126. messageSends: []
  4127. }),
  4128. $globals.SequenceableCollection);
  4129. $core.addMethod(
  4130. $core.method({
  4131. selector: "last",
  4132. protocol: "accessing",
  4133. fn: function (){
  4134. var self=this;
  4135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4136. return $core.withContext(function($ctx1) {
  4137. //>>excludeEnd("ctx");
  4138. return self._at_(self._size());
  4139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4140. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4141. //>>excludeEnd("ctx");
  4142. },
  4143. //>>excludeStart("ide", pragmas.excludeIdeData);
  4144. args: [],
  4145. source: "last\x0a\x09^ self at: self size",
  4146. referencedClasses: [],
  4147. //>>excludeEnd("ide");
  4148. messageSends: ["at:", "size"]
  4149. }),
  4150. $globals.SequenceableCollection);
  4151. $core.addMethod(
  4152. $core.method({
  4153. selector: "last:",
  4154. protocol: "accessing",
  4155. fn: function (aNumber){
  4156. var self=this;
  4157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4158. return $core.withContext(function($ctx1) {
  4159. //>>excludeEnd("ctx");
  4160. var $2,$1,$5,$4,$3;
  4161. $2=self._size();
  4162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4163. $ctx1.sendIdx["size"]=1;
  4164. //>>excludeEnd("ctx");
  4165. $1=$recv($2).__lt(aNumber);
  4166. if($core.assert($1)){
  4167. self._error_("Invalid number of elements");
  4168. }
  4169. $5=self._size();
  4170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4171. $ctx1.sendIdx["size"]=2;
  4172. //>>excludeEnd("ctx");
  4173. $4=$recv($5).__minus(aNumber);
  4174. $3=$recv($4).__plus((1));
  4175. return self._copyFrom_to_($3,self._size());
  4176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4177. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4178. //>>excludeEnd("ctx");
  4179. },
  4180. //>>excludeStart("ide", pragmas.excludeIdeData);
  4181. args: ["aNumber"],
  4182. 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",
  4183. referencedClasses: [],
  4184. //>>excludeEnd("ide");
  4185. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4186. }),
  4187. $globals.SequenceableCollection);
  4188. $core.addMethod(
  4189. $core.method({
  4190. selector: "newStream",
  4191. protocol: "streaming",
  4192. fn: function (){
  4193. var self=this;
  4194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4195. return $core.withContext(function($ctx1) {
  4196. //>>excludeEnd("ctx");
  4197. return $recv(self._streamClass())._on_(self);
  4198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4199. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4200. //>>excludeEnd("ctx");
  4201. },
  4202. //>>excludeStart("ide", pragmas.excludeIdeData);
  4203. args: [],
  4204. source: "newStream\x0a\x09^ self streamClass on: self",
  4205. referencedClasses: [],
  4206. //>>excludeEnd("ide");
  4207. messageSends: ["on:", "streamClass"]
  4208. }),
  4209. $globals.SequenceableCollection);
  4210. $core.addMethod(
  4211. $core.method({
  4212. selector: "numericallyIndexable",
  4213. protocol: "private",
  4214. fn: function (){
  4215. var self=this;
  4216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4217. return $core.withContext(function($ctx1) {
  4218. //>>excludeEnd("ctx");
  4219. self._subclassResponsibility();
  4220. return self;
  4221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4222. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  4223. //>>excludeEnd("ctx");
  4224. },
  4225. //>>excludeStart("ide", pragmas.excludeIdeData);
  4226. args: [],
  4227. source: "numericallyIndexable\x0a\x09\x22This is an internal converting message.\x0a\x09It answeres a representation of the receiver\x0a\x09that can use foo[i] in JavaScript code.\x0a\x09\x0a\x09It fixes IE8, where boxed String is unable\x0a\x09to numerically index its characters,\x0a\x09but primitive string can.\x22\x0a\x09\x0a\x09self subclassResponsibility",
  4228. referencedClasses: [],
  4229. //>>excludeEnd("ide");
  4230. messageSends: ["subclassResponsibility"]
  4231. }),
  4232. $globals.SequenceableCollection);
  4233. $core.addMethod(
  4234. $core.method({
  4235. selector: "readStream",
  4236. protocol: "streaming",
  4237. fn: function (){
  4238. var self=this;
  4239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4240. return $core.withContext(function($ctx1) {
  4241. //>>excludeEnd("ctx");
  4242. return self._stream();
  4243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4244. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4245. //>>excludeEnd("ctx");
  4246. },
  4247. //>>excludeStart("ide", pragmas.excludeIdeData);
  4248. args: [],
  4249. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4250. referencedClasses: [],
  4251. //>>excludeEnd("ide");
  4252. messageSends: ["stream"]
  4253. }),
  4254. $globals.SequenceableCollection);
  4255. $core.addMethod(
  4256. $core.method({
  4257. selector: "removeLast",
  4258. protocol: "adding/removing",
  4259. fn: function (){
  4260. var self=this;
  4261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4262. return $core.withContext(function($ctx1) {
  4263. //>>excludeEnd("ctx");
  4264. return self._remove_(self._last());
  4265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4266. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4267. //>>excludeEnd("ctx");
  4268. },
  4269. //>>excludeStart("ide", pragmas.excludeIdeData);
  4270. args: [],
  4271. source: "removeLast\x0a\x09^ self remove: self last",
  4272. referencedClasses: [],
  4273. //>>excludeEnd("ide");
  4274. messageSends: ["remove:", "last"]
  4275. }),
  4276. $globals.SequenceableCollection);
  4277. $core.addMethod(
  4278. $core.method({
  4279. selector: "reversed",
  4280. protocol: "converting",
  4281. fn: function (){
  4282. var self=this;
  4283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4284. return $core.withContext(function($ctx1) {
  4285. //>>excludeEnd("ctx");
  4286. self._subclassResponsibility();
  4287. return self;
  4288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4289. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4290. //>>excludeEnd("ctx");
  4291. },
  4292. //>>excludeStart("ide", pragmas.excludeIdeData);
  4293. args: [],
  4294. source: "reversed\x0a\x09self subclassResponsibility",
  4295. referencedClasses: [],
  4296. //>>excludeEnd("ide");
  4297. messageSends: ["subclassResponsibility"]
  4298. }),
  4299. $globals.SequenceableCollection);
  4300. $core.addMethod(
  4301. $core.method({
  4302. selector: "second",
  4303. protocol: "accessing",
  4304. fn: function (){
  4305. var self=this;
  4306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4307. return $core.withContext(function($ctx1) {
  4308. //>>excludeEnd("ctx");
  4309. return self._at_((2));
  4310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4311. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4312. //>>excludeEnd("ctx");
  4313. },
  4314. //>>excludeStart("ide", pragmas.excludeIdeData);
  4315. args: [],
  4316. source: "second\x0a\x09^ self at: 2",
  4317. referencedClasses: [],
  4318. //>>excludeEnd("ide");
  4319. messageSends: ["at:"]
  4320. }),
  4321. $globals.SequenceableCollection);
  4322. $core.addMethod(
  4323. $core.method({
  4324. selector: "single",
  4325. protocol: "accessing",
  4326. fn: function (){
  4327. var self=this;
  4328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4329. return $core.withContext(function($ctx1) {
  4330. //>>excludeEnd("ctx");
  4331. if (self.length == 0) throw new Error("Collection is empty");
  4332. if (self.length > 1) throw new Error("Collection holds more than one element.");
  4333. return self[0];;
  4334. return self;
  4335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4336. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  4337. //>>excludeEnd("ctx");
  4338. },
  4339. //>>excludeStart("ide", pragmas.excludeIdeData);
  4340. args: [],
  4341. 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'>",
  4342. referencedClasses: [],
  4343. //>>excludeEnd("ide");
  4344. messageSends: []
  4345. }),
  4346. $globals.SequenceableCollection);
  4347. $core.addMethod(
  4348. $core.method({
  4349. selector: "stream",
  4350. protocol: "streaming",
  4351. fn: function (){
  4352. var self=this;
  4353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4354. return $core.withContext(function($ctx1) {
  4355. //>>excludeEnd("ctx");
  4356. return self._newStream();
  4357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4358. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4359. //>>excludeEnd("ctx");
  4360. },
  4361. //>>excludeStart("ide", pragmas.excludeIdeData);
  4362. args: [],
  4363. source: "stream\x0a\x09^ self newStream",
  4364. referencedClasses: [],
  4365. //>>excludeEnd("ide");
  4366. messageSends: ["newStream"]
  4367. }),
  4368. $globals.SequenceableCollection);
  4369. $core.addMethod(
  4370. $core.method({
  4371. selector: "streamClass",
  4372. protocol: "streaming",
  4373. fn: function (){
  4374. var self=this;
  4375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4376. return $core.withContext(function($ctx1) {
  4377. //>>excludeEnd("ctx");
  4378. return $recv(self._class())._streamClass();
  4379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4380. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4381. //>>excludeEnd("ctx");
  4382. },
  4383. //>>excludeStart("ide", pragmas.excludeIdeData);
  4384. args: [],
  4385. source: "streamClass\x0a\x09^ self class streamClass",
  4386. referencedClasses: [],
  4387. //>>excludeEnd("ide");
  4388. messageSends: ["streamClass", "class"]
  4389. }),
  4390. $globals.SequenceableCollection);
  4391. $core.addMethod(
  4392. $core.method({
  4393. selector: "third",
  4394. protocol: "accessing",
  4395. fn: function (){
  4396. var self=this;
  4397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4398. return $core.withContext(function($ctx1) {
  4399. //>>excludeEnd("ctx");
  4400. return self._at_((3));
  4401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4402. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4403. //>>excludeEnd("ctx");
  4404. },
  4405. //>>excludeStart("ide", pragmas.excludeIdeData);
  4406. args: [],
  4407. source: "third\x0a\x09^ self at: 3",
  4408. referencedClasses: [],
  4409. //>>excludeEnd("ide");
  4410. messageSends: ["at:"]
  4411. }),
  4412. $globals.SequenceableCollection);
  4413. $core.addMethod(
  4414. $core.method({
  4415. selector: "with:do:",
  4416. protocol: "enumerating",
  4417. fn: function (anotherCollection,aBlock){
  4418. var self=this;
  4419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4420. return $core.withContext(function($ctx1) {
  4421. //>>excludeEnd("ctx");
  4422. self = self._numericallyIndexable();
  4423. anotherCollection = anotherCollection._numericallyIndexable();
  4424. for(var i=0; i<self.length; i++) {
  4425. aBlock._value_value_(self[i], anotherCollection[i]);
  4426. }
  4427. ;
  4428. return self;
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4431. //>>excludeEnd("ctx");
  4432. },
  4433. //>>excludeStart("ide", pragmas.excludeIdeData);
  4434. args: ["anotherCollection", "aBlock"],
  4435. source: "with: anotherCollection do: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\x0a\x09\x09anotherCollection = anotherCollection._numericallyIndexable();\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'>",
  4436. referencedClasses: [],
  4437. //>>excludeEnd("ide");
  4438. messageSends: []
  4439. }),
  4440. $globals.SequenceableCollection);
  4441. $core.addMethod(
  4442. $core.method({
  4443. selector: "withIndexDo:",
  4444. protocol: "enumerating",
  4445. fn: function (aBlock){
  4446. var self=this;
  4447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4448. return $core.withContext(function($ctx1) {
  4449. //>>excludeEnd("ctx");
  4450. self = self._numericallyIndexable();
  4451. for(var i=0; i < self.length; i++) {
  4452. aBlock._value_value_(self[i], i+1);
  4453. }
  4454. ;
  4455. return self;
  4456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4457. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4458. //>>excludeEnd("ctx");
  4459. },
  4460. //>>excludeStart("ide", pragmas.excludeIdeData);
  4461. args: ["aBlock"],
  4462. source: "withIndexDo: aBlock\x0a\x09<inlineJS: '\x0a\x09\x09self = self._numericallyIndexable();\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'>",
  4463. referencedClasses: [],
  4464. //>>excludeEnd("ide");
  4465. messageSends: []
  4466. }),
  4467. $globals.SequenceableCollection);
  4468. $core.addMethod(
  4469. $core.method({
  4470. selector: "writeStream",
  4471. protocol: "streaming",
  4472. fn: function (){
  4473. var self=this;
  4474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4475. return $core.withContext(function($ctx1) {
  4476. //>>excludeEnd("ctx");
  4477. return self._stream();
  4478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4479. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4480. //>>excludeEnd("ctx");
  4481. },
  4482. //>>excludeStart("ide", pragmas.excludeIdeData);
  4483. args: [],
  4484. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4485. referencedClasses: [],
  4486. //>>excludeEnd("ide");
  4487. messageSends: ["stream"]
  4488. }),
  4489. $globals.SequenceableCollection);
  4490. $core.addMethod(
  4491. $core.method({
  4492. selector: "streamClass",
  4493. protocol: "accessing",
  4494. fn: function (){
  4495. var self=this;
  4496. return $globals.Stream;
  4497. },
  4498. //>>excludeStart("ide", pragmas.excludeIdeData);
  4499. args: [],
  4500. source: "streamClass\x0a\x09\x09^ Stream",
  4501. referencedClasses: ["Stream"],
  4502. //>>excludeEnd("ide");
  4503. messageSends: []
  4504. }),
  4505. $globals.SequenceableCollection.klass);
  4506. $core.addMethod(
  4507. $core.method({
  4508. selector: "streamContents:",
  4509. protocol: "streaming",
  4510. fn: function (aBlock){
  4511. var self=this;
  4512. var stream;
  4513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4514. return $core.withContext(function($ctx1) {
  4515. //>>excludeEnd("ctx");
  4516. stream=$recv(self._streamClass())._on_(self._new());
  4517. $recv(aBlock)._value_(stream);
  4518. return $recv(stream)._contents();
  4519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4520. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  4521. //>>excludeEnd("ctx");
  4522. },
  4523. //>>excludeStart("ide", pragmas.excludeIdeData);
  4524. args: ["aBlock"],
  4525. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4526. referencedClasses: [],
  4527. //>>excludeEnd("ide");
  4528. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4529. }),
  4530. $globals.SequenceableCollection.klass);
  4531. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  4532. //>>excludeStart("ide", pragmas.excludeIdeData);
  4533. $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`.";
  4534. //>>excludeEnd("ide");
  4535. $core.addMethod(
  4536. $core.method({
  4537. selector: "add:",
  4538. protocol: "adding/removing",
  4539. fn: function (anObject){
  4540. var self=this;
  4541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4542. return $core.withContext(function($ctx1) {
  4543. //>>excludeEnd("ctx");
  4544. self.push(anObject); return anObject;;
  4545. return self;
  4546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4547. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4548. //>>excludeEnd("ctx");
  4549. },
  4550. //>>excludeStart("ide", pragmas.excludeIdeData);
  4551. args: ["anObject"],
  4552. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4553. referencedClasses: [],
  4554. //>>excludeEnd("ide");
  4555. messageSends: []
  4556. }),
  4557. $globals.Array);
  4558. $core.addMethod(
  4559. $core.method({
  4560. selector: "addAll:",
  4561. protocol: "adding/removing",
  4562. fn: function (aCollection){
  4563. var self=this;
  4564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4565. return $core.withContext(function($ctx1) {
  4566. //>>excludeEnd("ctx");
  4567. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4568. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  4569. return aCollection;;
  4570. return self;
  4571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4572. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4573. //>>excludeEnd("ctx");
  4574. },
  4575. //>>excludeStart("ide", pragmas.excludeIdeData);
  4576. args: ["aCollection"],
  4577. 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'>",
  4578. referencedClasses: [],
  4579. //>>excludeEnd("ide");
  4580. messageSends: []
  4581. }),
  4582. $globals.Array);
  4583. $core.addMethod(
  4584. $core.method({
  4585. selector: "addFirst:",
  4586. protocol: "adding/removing",
  4587. fn: function (anObject){
  4588. var self=this;
  4589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4590. return $core.withContext(function($ctx1) {
  4591. //>>excludeEnd("ctx");
  4592. self.unshift(anObject); return anObject;;
  4593. return self;
  4594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4595. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4596. //>>excludeEnd("ctx");
  4597. },
  4598. //>>excludeStart("ide", pragmas.excludeIdeData);
  4599. args: ["anObject"],
  4600. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4601. referencedClasses: [],
  4602. //>>excludeEnd("ide");
  4603. messageSends: []
  4604. }),
  4605. $globals.Array);
  4606. $core.addMethod(
  4607. $core.method({
  4608. selector: "asJavascript",
  4609. protocol: "converting",
  4610. fn: function (){
  4611. var self=this;
  4612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4613. return $core.withContext(function($ctx1) {
  4614. //>>excludeEnd("ctx");
  4615. var $1;
  4616. $1=$recv("[".__comma($recv(self._collect_((function(each){
  4617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4618. return $core.withContext(function($ctx2) {
  4619. //>>excludeEnd("ctx");
  4620. return $recv(each)._asJavascript();
  4621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4623. //>>excludeEnd("ctx");
  4624. })))._join_(", "))).__comma("]");
  4625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4626. $ctx1.sendIdx[","]=1;
  4627. //>>excludeEnd("ctx");
  4628. return $1;
  4629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4630. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  4631. //>>excludeEnd("ctx");
  4632. },
  4633. //>>excludeStart("ide", pragmas.excludeIdeData);
  4634. args: [],
  4635. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  4636. referencedClasses: [],
  4637. //>>excludeEnd("ide");
  4638. messageSends: [",", "join:", "collect:", "asJavascript"]
  4639. }),
  4640. $globals.Array);
  4641. $core.addMethod(
  4642. $core.method({
  4643. selector: "at:ifAbsent:",
  4644. protocol: "accessing",
  4645. fn: function (anIndex,aBlock){
  4646. var self=this;
  4647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4648. return $core.withContext(function($ctx1) {
  4649. //>>excludeEnd("ctx");
  4650. return anIndex >= 1 && anIndex <= self.length
  4651. ? self[anIndex - 1]
  4652. : aBlock._value()
  4653. ;
  4654. return self;
  4655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4656. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4657. //>>excludeEnd("ctx");
  4658. },
  4659. //>>excludeStart("ide", pragmas.excludeIdeData);
  4660. args: ["anIndex", "aBlock"],
  4661. 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'>",
  4662. referencedClasses: [],
  4663. //>>excludeEnd("ide");
  4664. messageSends: []
  4665. }),
  4666. $globals.Array);
  4667. $core.addMethod(
  4668. $core.method({
  4669. selector: "at:ifPresent:ifAbsent:",
  4670. protocol: "accessing",
  4671. fn: function (anIndex,aBlock,anotherBlock){
  4672. var self=this;
  4673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4674. return $core.withContext(function($ctx1) {
  4675. //>>excludeEnd("ctx");
  4676. return anIndex >= 1 && anIndex <= self.length
  4677. ? aBlock._value_(self[anIndex - 1])
  4678. : anotherBlock._value()
  4679. ;
  4680. return self;
  4681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4682. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4683. //>>excludeEnd("ctx");
  4684. },
  4685. //>>excludeStart("ide", pragmas.excludeIdeData);
  4686. args: ["anIndex", "aBlock", "anotherBlock"],
  4687. 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'>",
  4688. referencedClasses: [],
  4689. //>>excludeEnd("ide");
  4690. messageSends: []
  4691. }),
  4692. $globals.Array);
  4693. $core.addMethod(
  4694. $core.method({
  4695. selector: "at:put:",
  4696. protocol: "accessing",
  4697. fn: function (anIndex,anObject){
  4698. var self=this;
  4699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4700. return $core.withContext(function($ctx1) {
  4701. //>>excludeEnd("ctx");
  4702. return self[anIndex - 1] = anObject;
  4703. return self;
  4704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4705. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4706. //>>excludeEnd("ctx");
  4707. },
  4708. //>>excludeStart("ide", pragmas.excludeIdeData);
  4709. args: ["anIndex", "anObject"],
  4710. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4711. referencedClasses: [],
  4712. //>>excludeEnd("ide");
  4713. messageSends: []
  4714. }),
  4715. $globals.Array);
  4716. $core.addMethod(
  4717. $core.method({
  4718. selector: "collect:",
  4719. protocol: "enumerating",
  4720. fn: function (aBlock){
  4721. var self=this;
  4722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4723. return $core.withContext(function($ctx1) {
  4724. //>>excludeEnd("ctx");
  4725. return self.map(function(each) {return aBlock._value_(each)});
  4726. return self;
  4727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4728. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4729. //>>excludeEnd("ctx");
  4730. },
  4731. //>>excludeStart("ide", pragmas.excludeIdeData);
  4732. args: ["aBlock"],
  4733. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4734. referencedClasses: [],
  4735. //>>excludeEnd("ide");
  4736. messageSends: []
  4737. }),
  4738. $globals.Array);
  4739. $core.addMethod(
  4740. $core.method({
  4741. selector: "copyFrom:to:",
  4742. protocol: "copying",
  4743. fn: function (anIndex,anotherIndex){
  4744. var self=this;
  4745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4746. return $core.withContext(function($ctx1) {
  4747. //>>excludeEnd("ctx");
  4748. if (anIndex >= 1 && anotherIndex <= self.length) {
  4749. return self.slice(anIndex - 1, anotherIndex);
  4750. } else {
  4751. self._at_(anIndex);
  4752. self._at_(self.length + 1);
  4753. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4754. };
  4755. return self;
  4756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4757. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4758. //>>excludeEnd("ctx");
  4759. },
  4760. //>>excludeStart("ide", pragmas.excludeIdeData);
  4761. args: ["anIndex", "anotherIndex"],
  4762. 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'>",
  4763. referencedClasses: [],
  4764. //>>excludeEnd("ide");
  4765. messageSends: []
  4766. }),
  4767. $globals.Array);
  4768. $core.addMethod(
  4769. $core.method({
  4770. selector: "join:",
  4771. protocol: "enumerating",
  4772. fn: function (aString){
  4773. var self=this;
  4774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4775. return $core.withContext(function($ctx1) {
  4776. //>>excludeEnd("ctx");
  4777. return self.join(aString);
  4778. return self;
  4779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4780. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4781. //>>excludeEnd("ctx");
  4782. },
  4783. //>>excludeStart("ide", pragmas.excludeIdeData);
  4784. args: ["aString"],
  4785. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4786. referencedClasses: [],
  4787. //>>excludeEnd("ide");
  4788. messageSends: []
  4789. }),
  4790. $globals.Array);
  4791. $core.addMethod(
  4792. $core.method({
  4793. selector: "numericallyIndexable",
  4794. protocol: "private",
  4795. fn: function (){
  4796. var self=this;
  4797. return self;
  4798. },
  4799. //>>excludeStart("ide", pragmas.excludeIdeData);
  4800. args: [],
  4801. source: "numericallyIndexable\x0a\x09^ self",
  4802. referencedClasses: [],
  4803. //>>excludeEnd("ide");
  4804. messageSends: []
  4805. }),
  4806. $globals.Array);
  4807. $core.addMethod(
  4808. $core.method({
  4809. selector: "printOn:",
  4810. protocol: "printing",
  4811. fn: function (aStream){
  4812. var self=this;
  4813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4814. return $core.withContext(function($ctx1) {
  4815. //>>excludeEnd("ctx");
  4816. (
  4817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4818. $ctx1.supercall = true,
  4819. //>>excludeEnd("ctx");
  4820. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  4821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4822. $ctx1.supercall = false;
  4823. //>>excludeEnd("ctx");;
  4824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4825. $ctx1.sendIdx["printOn:"]=1;
  4826. //>>excludeEnd("ctx");
  4827. $recv(aStream)._nextPutAll_(" (");
  4828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4829. $ctx1.sendIdx["nextPutAll:"]=1;
  4830. //>>excludeEnd("ctx");
  4831. self._do_separatedBy_((function(each){
  4832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4833. return $core.withContext(function($ctx2) {
  4834. //>>excludeEnd("ctx");
  4835. return $recv(each)._printOn_(aStream);
  4836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4838. //>>excludeEnd("ctx");
  4839. }),(function(){
  4840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4841. return $core.withContext(function($ctx2) {
  4842. //>>excludeEnd("ctx");
  4843. return $recv(aStream)._nextPutAll_(" ");
  4844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4845. $ctx2.sendIdx["nextPutAll:"]=2;
  4846. //>>excludeEnd("ctx");
  4847. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4848. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4849. //>>excludeEnd("ctx");
  4850. }));
  4851. $recv(aStream)._nextPutAll_(")");
  4852. return self;
  4853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4854. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4855. //>>excludeEnd("ctx");
  4856. },
  4857. //>>excludeStart("ide", pragmas.excludeIdeData);
  4858. args: ["aStream"],
  4859. 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: ')'",
  4860. referencedClasses: [],
  4861. //>>excludeEnd("ide");
  4862. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4863. }),
  4864. $globals.Array);
  4865. $core.addMethod(
  4866. $core.method({
  4867. selector: "remove:ifAbsent:",
  4868. protocol: "adding/removing",
  4869. fn: function (anObject,aBlock){
  4870. var self=this;
  4871. var index;
  4872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4873. return $core.withContext(function($ctx1) {
  4874. //>>excludeEnd("ctx");
  4875. var $1;
  4876. index=self._indexOf_ifAbsent_(anObject,(function(){
  4877. return (0);
  4878. }));
  4879. $1=$recv(index).__eq((0));
  4880. if($core.assert($1)){
  4881. return $recv(aBlock)._value();
  4882. } else {
  4883. self._removeIndex_(index);
  4884. return anObject;
  4885. }
  4886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4887. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4888. //>>excludeEnd("ctx");
  4889. },
  4890. //>>excludeStart("ide", pragmas.excludeIdeData);
  4891. args: ["anObject", "aBlock"],
  4892. 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 ]",
  4893. referencedClasses: [],
  4894. //>>excludeEnd("ide");
  4895. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4896. }),
  4897. $globals.Array);
  4898. $core.addMethod(
  4899. $core.method({
  4900. selector: "removeAll",
  4901. protocol: "adding/removing",
  4902. fn: function (){
  4903. var self=this;
  4904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4905. return $core.withContext(function($ctx1) {
  4906. //>>excludeEnd("ctx");
  4907. self.length = 0;
  4908. return self;
  4909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4910. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4911. //>>excludeEnd("ctx");
  4912. },
  4913. //>>excludeStart("ide", pragmas.excludeIdeData);
  4914. args: [],
  4915. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4916. referencedClasses: [],
  4917. //>>excludeEnd("ide");
  4918. messageSends: []
  4919. }),
  4920. $globals.Array);
  4921. $core.addMethod(
  4922. $core.method({
  4923. selector: "removeFrom:to:",
  4924. protocol: "adding/removing",
  4925. fn: function (aNumber,anotherNumber){
  4926. var self=this;
  4927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4928. return $core.withContext(function($ctx1) {
  4929. //>>excludeEnd("ctx");
  4930. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4931. return self;
  4932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4933. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4934. //>>excludeEnd("ctx");
  4935. },
  4936. //>>excludeStart("ide", pragmas.excludeIdeData);
  4937. args: ["aNumber", "anotherNumber"],
  4938. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4939. referencedClasses: [],
  4940. //>>excludeEnd("ide");
  4941. messageSends: []
  4942. }),
  4943. $globals.Array);
  4944. $core.addMethod(
  4945. $core.method({
  4946. selector: "removeIndex:",
  4947. protocol: "adding/removing",
  4948. fn: function (anInteger){
  4949. var self=this;
  4950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4951. return $core.withContext(function($ctx1) {
  4952. //>>excludeEnd("ctx");
  4953. self.splice(anInteger - 1, 1);
  4954. return self;
  4955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4956. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4957. //>>excludeEnd("ctx");
  4958. },
  4959. //>>excludeStart("ide", pragmas.excludeIdeData);
  4960. args: ["anInteger"],
  4961. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4962. referencedClasses: [],
  4963. //>>excludeEnd("ide");
  4964. messageSends: []
  4965. }),
  4966. $globals.Array);
  4967. $core.addMethod(
  4968. $core.method({
  4969. selector: "removeLast",
  4970. protocol: "adding/removing",
  4971. fn: function (){
  4972. var self=this;
  4973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4974. return $core.withContext(function($ctx1) {
  4975. //>>excludeEnd("ctx");
  4976. return self.pop();;
  4977. return self;
  4978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4979. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4980. //>>excludeEnd("ctx");
  4981. },
  4982. //>>excludeStart("ide", pragmas.excludeIdeData);
  4983. args: [],
  4984. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4985. referencedClasses: [],
  4986. //>>excludeEnd("ide");
  4987. messageSends: []
  4988. }),
  4989. $globals.Array);
  4990. $core.addMethod(
  4991. $core.method({
  4992. selector: "reversed",
  4993. protocol: "converting",
  4994. fn: function (){
  4995. var self=this;
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. return $core.withContext(function($ctx1) {
  4998. //>>excludeEnd("ctx");
  4999. return self.slice().reverse();
  5000. return self;
  5001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5002. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  5003. //>>excludeEnd("ctx");
  5004. },
  5005. //>>excludeStart("ide", pragmas.excludeIdeData);
  5006. args: [],
  5007. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  5008. referencedClasses: [],
  5009. //>>excludeEnd("ide");
  5010. messageSends: []
  5011. }),
  5012. $globals.Array);
  5013. $core.addMethod(
  5014. $core.method({
  5015. selector: "select:",
  5016. protocol: "enumerating",
  5017. fn: function (aBlock){
  5018. var self=this;
  5019. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5020. return $core.withContext(function($ctx1) {
  5021. //>>excludeEnd("ctx");
  5022. return self.filter(function(each) {return aBlock._value_(each)});
  5023. return self;
  5024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5025. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  5026. //>>excludeEnd("ctx");
  5027. },
  5028. //>>excludeStart("ide", pragmas.excludeIdeData);
  5029. args: ["aBlock"],
  5030. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  5031. referencedClasses: [],
  5032. //>>excludeEnd("ide");
  5033. messageSends: []
  5034. }),
  5035. $globals.Array);
  5036. $core.addMethod(
  5037. $core.method({
  5038. selector: "shallowCopy",
  5039. protocol: "copying",
  5040. fn: function (){
  5041. var self=this;
  5042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5043. return $core.withContext(function($ctx1) {
  5044. //>>excludeEnd("ctx");
  5045. return self.slice();
  5046. return self;
  5047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5048. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  5049. //>>excludeEnd("ctx");
  5050. },
  5051. //>>excludeStart("ide", pragmas.excludeIdeData);
  5052. args: [],
  5053. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  5054. referencedClasses: [],
  5055. //>>excludeEnd("ide");
  5056. messageSends: []
  5057. }),
  5058. $globals.Array);
  5059. $core.addMethod(
  5060. $core.method({
  5061. selector: "size",
  5062. protocol: "accessing",
  5063. fn: function (){
  5064. var self=this;
  5065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5066. return $core.withContext(function($ctx1) {
  5067. //>>excludeEnd("ctx");
  5068. return self.length;
  5069. return self;
  5070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5071. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  5072. //>>excludeEnd("ctx");
  5073. },
  5074. //>>excludeStart("ide", pragmas.excludeIdeData);
  5075. args: [],
  5076. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  5077. referencedClasses: [],
  5078. //>>excludeEnd("ide");
  5079. messageSends: []
  5080. }),
  5081. $globals.Array);
  5082. $core.addMethod(
  5083. $core.method({
  5084. selector: "sort",
  5085. protocol: "enumerating",
  5086. fn: function (){
  5087. var self=this;
  5088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5089. return $core.withContext(function($ctx1) {
  5090. //>>excludeEnd("ctx");
  5091. return self._sort_((function(a,b){
  5092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5093. return $core.withContext(function($ctx2) {
  5094. //>>excludeEnd("ctx");
  5095. return $recv(a).__lt(b);
  5096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5097. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5098. //>>excludeEnd("ctx");
  5099. }));
  5100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5101. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  5102. //>>excludeEnd("ctx");
  5103. },
  5104. //>>excludeStart("ide", pragmas.excludeIdeData);
  5105. args: [],
  5106. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5107. referencedClasses: [],
  5108. //>>excludeEnd("ide");
  5109. messageSends: ["sort:", "<"]
  5110. }),
  5111. $globals.Array);
  5112. $core.addMethod(
  5113. $core.method({
  5114. selector: "sort:",
  5115. protocol: "enumerating",
  5116. fn: function (aBlock){
  5117. var self=this;
  5118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5119. return $core.withContext(function($ctx1) {
  5120. //>>excludeEnd("ctx");
  5121. return self.sort(function(a, b) {
  5122. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5123. })
  5124. ;
  5125. return self;
  5126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5127. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5128. //>>excludeEnd("ctx");
  5129. },
  5130. //>>excludeStart("ide", pragmas.excludeIdeData);
  5131. args: ["aBlock"],
  5132. 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'>",
  5133. referencedClasses: [],
  5134. //>>excludeEnd("ide");
  5135. messageSends: []
  5136. }),
  5137. $globals.Array);
  5138. $core.addMethod(
  5139. $core.method({
  5140. selector: "sorted",
  5141. protocol: "enumerating",
  5142. fn: function (){
  5143. var self=this;
  5144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5145. return $core.withContext(function($ctx1) {
  5146. //>>excludeEnd("ctx");
  5147. return $recv(self._copy())._sort();
  5148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5149. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5150. //>>excludeEnd("ctx");
  5151. },
  5152. //>>excludeStart("ide", pragmas.excludeIdeData);
  5153. args: [],
  5154. source: "sorted\x0a\x09^ self copy sort",
  5155. referencedClasses: [],
  5156. //>>excludeEnd("ide");
  5157. messageSends: ["sort", "copy"]
  5158. }),
  5159. $globals.Array);
  5160. $core.addMethod(
  5161. $core.method({
  5162. selector: "sorted:",
  5163. protocol: "enumerating",
  5164. fn: function (aBlock){
  5165. var self=this;
  5166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5167. return $core.withContext(function($ctx1) {
  5168. //>>excludeEnd("ctx");
  5169. return $recv(self._copy())._sort_(aBlock);
  5170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5171. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5172. //>>excludeEnd("ctx");
  5173. },
  5174. //>>excludeStart("ide", pragmas.excludeIdeData);
  5175. args: ["aBlock"],
  5176. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5177. referencedClasses: [],
  5178. //>>excludeEnd("ide");
  5179. messageSends: ["sort:", "copy"]
  5180. }),
  5181. $globals.Array);
  5182. $core.addMethod(
  5183. $core.method({
  5184. selector: "new:",
  5185. protocol: "instance creation",
  5186. fn: function (anInteger){
  5187. var self=this;
  5188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5189. return $core.withContext(function($ctx1) {
  5190. //>>excludeEnd("ctx");
  5191. return new Array(anInteger);
  5192. return self;
  5193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5194. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  5195. //>>excludeEnd("ctx");
  5196. },
  5197. //>>excludeStart("ide", pragmas.excludeIdeData);
  5198. args: ["anInteger"],
  5199. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5200. referencedClasses: [],
  5201. //>>excludeEnd("ide");
  5202. messageSends: []
  5203. }),
  5204. $globals.Array.klass);
  5205. $core.addMethod(
  5206. $core.method({
  5207. selector: "with:",
  5208. protocol: "instance creation",
  5209. fn: function (anObject){
  5210. var self=this;
  5211. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5212. return $core.withContext(function($ctx1) {
  5213. //>>excludeEnd("ctx");
  5214. var $1;
  5215. $1=self._new_((1));
  5216. $recv($1)._at_put_((1),anObject);
  5217. return $recv($1)._yourself();
  5218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5219. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  5220. //>>excludeEnd("ctx");
  5221. },
  5222. //>>excludeStart("ide", pragmas.excludeIdeData);
  5223. args: ["anObject"],
  5224. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5225. referencedClasses: [],
  5226. //>>excludeEnd("ide");
  5227. messageSends: ["at:put:", "new:", "yourself"]
  5228. }),
  5229. $globals.Array.klass);
  5230. $core.addMethod(
  5231. $core.method({
  5232. selector: "with:with:",
  5233. protocol: "instance creation",
  5234. fn: function (anObject,anObject2){
  5235. var self=this;
  5236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5237. return $core.withContext(function($ctx1) {
  5238. //>>excludeEnd("ctx");
  5239. var $1;
  5240. $1=self._new_((2));
  5241. $recv($1)._at_put_((1),anObject);
  5242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5243. $ctx1.sendIdx["at:put:"]=1;
  5244. //>>excludeEnd("ctx");
  5245. $recv($1)._at_put_((2),anObject2);
  5246. return $recv($1)._yourself();
  5247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5248. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  5249. //>>excludeEnd("ctx");
  5250. },
  5251. //>>excludeStart("ide", pragmas.excludeIdeData);
  5252. args: ["anObject", "anObject2"],
  5253. 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",
  5254. referencedClasses: [],
  5255. //>>excludeEnd("ide");
  5256. messageSends: ["at:put:", "new:", "yourself"]
  5257. }),
  5258. $globals.Array.klass);
  5259. $core.addMethod(
  5260. $core.method({
  5261. selector: "with:with:with:",
  5262. protocol: "instance creation",
  5263. fn: function (anObject,anObject2,anObject3){
  5264. var self=this;
  5265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5266. return $core.withContext(function($ctx1) {
  5267. //>>excludeEnd("ctx");
  5268. var $1;
  5269. $1=self._new_((3));
  5270. $recv($1)._at_put_((1),anObject);
  5271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5272. $ctx1.sendIdx["at:put:"]=1;
  5273. //>>excludeEnd("ctx");
  5274. $recv($1)._at_put_((2),anObject2);
  5275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5276. $ctx1.sendIdx["at:put:"]=2;
  5277. //>>excludeEnd("ctx");
  5278. $recv($1)._at_put_((3),anObject3);
  5279. return $recv($1)._yourself();
  5280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5281. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  5282. //>>excludeEnd("ctx");
  5283. },
  5284. //>>excludeStart("ide", pragmas.excludeIdeData);
  5285. args: ["anObject", "anObject2", "anObject3"],
  5286. 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",
  5287. referencedClasses: [],
  5288. //>>excludeEnd("ide");
  5289. messageSends: ["at:put:", "new:", "yourself"]
  5290. }),
  5291. $globals.Array.klass);
  5292. $core.addMethod(
  5293. $core.method({
  5294. selector: "withAll:",
  5295. protocol: "instance creation",
  5296. fn: function (aCollection){
  5297. var self=this;
  5298. var instance,index;
  5299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5300. return $core.withContext(function($ctx1) {
  5301. //>>excludeEnd("ctx");
  5302. index=(1);
  5303. instance=self._new_($recv(aCollection)._size());
  5304. $recv(aCollection)._do_((function(each){
  5305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5306. return $core.withContext(function($ctx2) {
  5307. //>>excludeEnd("ctx");
  5308. $recv(instance)._at_put_(index,each);
  5309. index=$recv(index).__plus((1));
  5310. return index;
  5311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5312. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5313. //>>excludeEnd("ctx");
  5314. }));
  5315. return instance;
  5316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5317. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  5318. //>>excludeEnd("ctx");
  5319. },
  5320. //>>excludeStart("ide", pragmas.excludeIdeData);
  5321. args: ["aCollection"],
  5322. 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",
  5323. referencedClasses: [],
  5324. //>>excludeEnd("ide");
  5325. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5326. }),
  5327. $globals.Array.klass);
  5328. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  5329. //>>excludeStart("ide", pragmas.excludeIdeData);
  5330. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5331. //>>excludeEnd("ide");
  5332. $core.addMethod(
  5333. $core.method({
  5334. selector: ",",
  5335. protocol: "copying",
  5336. fn: function (aString){
  5337. var self=this;
  5338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5339. return $core.withContext(function($ctx1) {
  5340. //>>excludeEnd("ctx");
  5341. var $1;
  5342. $1=self._asString();
  5343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5344. $ctx1.sendIdx["asString"]=1;
  5345. //>>excludeEnd("ctx");
  5346. return $recv($1).__comma($recv(aString)._asString());
  5347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5348. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  5349. //>>excludeEnd("ctx");
  5350. },
  5351. //>>excludeStart("ide", pragmas.excludeIdeData);
  5352. args: ["aString"],
  5353. source: ", aString\x0a\x09^ self asString, aString asString",
  5354. referencedClasses: [],
  5355. //>>excludeEnd("ide");
  5356. messageSends: [",", "asString"]
  5357. }),
  5358. $globals.CharacterArray);
  5359. $core.addMethod(
  5360. $core.method({
  5361. selector: "add:",
  5362. protocol: "adding/removing",
  5363. fn: function (anObject){
  5364. var self=this;
  5365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5366. return $core.withContext(function($ctx1) {
  5367. //>>excludeEnd("ctx");
  5368. self._errorReadOnly();
  5369. return self;
  5370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5371. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  5372. //>>excludeEnd("ctx");
  5373. },
  5374. //>>excludeStart("ide", pragmas.excludeIdeData);
  5375. args: ["anObject"],
  5376. source: "add: anObject\x0a\x09self errorReadOnly",
  5377. referencedClasses: [],
  5378. //>>excludeEnd("ide");
  5379. messageSends: ["errorReadOnly"]
  5380. }),
  5381. $globals.CharacterArray);
  5382. $core.addMethod(
  5383. $core.method({
  5384. selector: "asLowercase",
  5385. protocol: "converting",
  5386. fn: function (){
  5387. var self=this;
  5388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5389. return $core.withContext(function($ctx1) {
  5390. //>>excludeEnd("ctx");
  5391. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  5392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5393. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  5394. //>>excludeEnd("ctx");
  5395. },
  5396. //>>excludeStart("ide", pragmas.excludeIdeData);
  5397. args: [],
  5398. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5399. referencedClasses: [],
  5400. //>>excludeEnd("ide");
  5401. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5402. }),
  5403. $globals.CharacterArray);
  5404. $core.addMethod(
  5405. $core.method({
  5406. selector: "asNumber",
  5407. protocol: "converting",
  5408. fn: function (){
  5409. var self=this;
  5410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5411. return $core.withContext(function($ctx1) {
  5412. //>>excludeEnd("ctx");
  5413. return $recv(self._asString())._asNumber();
  5414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5415. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  5416. //>>excludeEnd("ctx");
  5417. },
  5418. //>>excludeStart("ide", pragmas.excludeIdeData);
  5419. args: [],
  5420. source: "asNumber\x0a\x09^ self asString asNumber",
  5421. referencedClasses: [],
  5422. //>>excludeEnd("ide");
  5423. messageSends: ["asNumber", "asString"]
  5424. }),
  5425. $globals.CharacterArray);
  5426. $core.addMethod(
  5427. $core.method({
  5428. selector: "asString",
  5429. protocol: "converting",
  5430. fn: function (){
  5431. var self=this;
  5432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5433. return $core.withContext(function($ctx1) {
  5434. //>>excludeEnd("ctx");
  5435. return self._subclassResponsibility();
  5436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5437. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  5438. //>>excludeEnd("ctx");
  5439. },
  5440. //>>excludeStart("ide", pragmas.excludeIdeData);
  5441. args: [],
  5442. source: "asString\x0a\x09^ self subclassResponsibility",
  5443. referencedClasses: [],
  5444. //>>excludeEnd("ide");
  5445. messageSends: ["subclassResponsibility"]
  5446. }),
  5447. $globals.CharacterArray);
  5448. $core.addMethod(
  5449. $core.method({
  5450. selector: "asSymbol",
  5451. protocol: "converting",
  5452. fn: function (){
  5453. var self=this;
  5454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5455. return $core.withContext(function($ctx1) {
  5456. //>>excludeEnd("ctx");
  5457. return self._asString();
  5458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5459. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  5460. //>>excludeEnd("ctx");
  5461. },
  5462. //>>excludeStart("ide", pragmas.excludeIdeData);
  5463. args: [],
  5464. source: "asSymbol\x0a\x09^ self asString",
  5465. referencedClasses: [],
  5466. //>>excludeEnd("ide");
  5467. messageSends: ["asString"]
  5468. }),
  5469. $globals.CharacterArray);
  5470. $core.addMethod(
  5471. $core.method({
  5472. selector: "asSymbolPrintOn:",
  5473. protocol: "printing",
  5474. fn: function (aStream){
  5475. var self=this;
  5476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5477. return $core.withContext(function($ctx1) {
  5478. //>>excludeEnd("ctx");
  5479. var $1;
  5480. $recv(aStream)._nextPutAll_("#");
  5481. $1=$recv(self._asString())._isSelector();
  5482. if($core.assert($1)){
  5483. $recv(aStream)._nextPut_(self);
  5484. } else {
  5485. self._printOn_(aStream);
  5486. }
  5487. return self;
  5488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5489. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  5490. //>>excludeEnd("ctx");
  5491. },
  5492. //>>excludeStart("ide", pragmas.excludeIdeData);
  5493. args: ["aStream"],
  5494. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  5495. referencedClasses: [],
  5496. //>>excludeEnd("ide");
  5497. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  5498. }),
  5499. $globals.CharacterArray);
  5500. $core.addMethod(
  5501. $core.method({
  5502. selector: "asUppercase",
  5503. protocol: "converting",
  5504. fn: function (){
  5505. var self=this;
  5506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5507. return $core.withContext(function($ctx1) {
  5508. //>>excludeEnd("ctx");
  5509. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  5510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5511. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  5512. //>>excludeEnd("ctx");
  5513. },
  5514. //>>excludeStart("ide", pragmas.excludeIdeData);
  5515. args: [],
  5516. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5517. referencedClasses: [],
  5518. //>>excludeEnd("ide");
  5519. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5520. }),
  5521. $globals.CharacterArray);
  5522. $core.addMethod(
  5523. $core.method({
  5524. selector: "at:put:",
  5525. protocol: "accessing",
  5526. fn: function (anIndex,anObject){
  5527. var self=this;
  5528. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5529. return $core.withContext(function($ctx1) {
  5530. //>>excludeEnd("ctx");
  5531. self._errorReadOnly();
  5532. return self;
  5533. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5534. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  5535. //>>excludeEnd("ctx");
  5536. },
  5537. //>>excludeStart("ide", pragmas.excludeIdeData);
  5538. args: ["anIndex", "anObject"],
  5539. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5540. referencedClasses: [],
  5541. //>>excludeEnd("ide");
  5542. messageSends: ["errorReadOnly"]
  5543. }),
  5544. $globals.CharacterArray);
  5545. $core.addMethod(
  5546. $core.method({
  5547. selector: "errorReadOnly",
  5548. protocol: "error handling",
  5549. fn: function (){
  5550. var self=this;
  5551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5552. return $core.withContext(function($ctx1) {
  5553. //>>excludeEnd("ctx");
  5554. self._error_("Object is read-only");
  5555. return self;
  5556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5557. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  5558. //>>excludeEnd("ctx");
  5559. },
  5560. //>>excludeStart("ide", pragmas.excludeIdeData);
  5561. args: [],
  5562. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5563. referencedClasses: [],
  5564. //>>excludeEnd("ide");
  5565. messageSends: ["error:"]
  5566. }),
  5567. $globals.CharacterArray);
  5568. $core.addMethod(
  5569. $core.method({
  5570. selector: "printOn:",
  5571. protocol: "printing",
  5572. fn: function (aStream){
  5573. var self=this;
  5574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5575. return $core.withContext(function($ctx1) {
  5576. //>>excludeEnd("ctx");
  5577. $recv(self._asString())._printOn_(aStream);
  5578. return self;
  5579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5580. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  5581. //>>excludeEnd("ctx");
  5582. },
  5583. //>>excludeStart("ide", pragmas.excludeIdeData);
  5584. args: ["aStream"],
  5585. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5586. referencedClasses: [],
  5587. //>>excludeEnd("ide");
  5588. messageSends: ["printOn:", "asString"]
  5589. }),
  5590. $globals.CharacterArray);
  5591. $core.addMethod(
  5592. $core.method({
  5593. selector: "putOn:",
  5594. protocol: "streaming",
  5595. fn: function (aStream){
  5596. var self=this;
  5597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5598. return $core.withContext(function($ctx1) {
  5599. //>>excludeEnd("ctx");
  5600. $recv(aStream)._nextPutString_(self);
  5601. return self;
  5602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5603. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  5604. //>>excludeEnd("ctx");
  5605. },
  5606. //>>excludeStart("ide", pragmas.excludeIdeData);
  5607. args: ["aStream"],
  5608. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5609. referencedClasses: [],
  5610. //>>excludeEnd("ide");
  5611. messageSends: ["nextPutString:"]
  5612. }),
  5613. $globals.CharacterArray);
  5614. $core.addMethod(
  5615. $core.method({
  5616. selector: "remove:",
  5617. protocol: "adding/removing",
  5618. fn: function (anObject){
  5619. var self=this;
  5620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5621. return $core.withContext(function($ctx1) {
  5622. //>>excludeEnd("ctx");
  5623. self._errorReadOnly();
  5624. return self;
  5625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5626. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  5627. //>>excludeEnd("ctx");
  5628. },
  5629. //>>excludeStart("ide", pragmas.excludeIdeData);
  5630. args: ["anObject"],
  5631. source: "remove: anObject\x0a\x09self errorReadOnly",
  5632. referencedClasses: [],
  5633. //>>excludeEnd("ide");
  5634. messageSends: ["errorReadOnly"]
  5635. }),
  5636. $globals.CharacterArray);
  5637. $core.addMethod(
  5638. $core.method({
  5639. selector: "symbolPrintString",
  5640. protocol: "printing",
  5641. fn: function (){
  5642. var self=this;
  5643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5644. return $core.withContext(function($ctx1) {
  5645. //>>excludeEnd("ctx");
  5646. return $recv($globals.String)._streamContents_((function(str){
  5647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5648. return $core.withContext(function($ctx2) {
  5649. //>>excludeEnd("ctx");
  5650. return self._asSymbolPrintOn_(str);
  5651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5652. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  5653. //>>excludeEnd("ctx");
  5654. }));
  5655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5656. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  5657. //>>excludeEnd("ctx");
  5658. },
  5659. //>>excludeStart("ide", pragmas.excludeIdeData);
  5660. args: [],
  5661. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  5662. referencedClasses: ["String"],
  5663. //>>excludeEnd("ide");
  5664. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  5665. }),
  5666. $globals.CharacterArray);
  5667. $core.addMethod(
  5668. $core.method({
  5669. selector: "fromString:",
  5670. protocol: "instance creation",
  5671. fn: function (aString){
  5672. var self=this;
  5673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5674. return $core.withContext(function($ctx1) {
  5675. //>>excludeEnd("ctx");
  5676. self._subclassResponsibility();
  5677. return self;
  5678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5679. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  5680. //>>excludeEnd("ctx");
  5681. },
  5682. //>>excludeStart("ide", pragmas.excludeIdeData);
  5683. args: ["aString"],
  5684. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5685. referencedClasses: [],
  5686. //>>excludeEnd("ide");
  5687. messageSends: ["subclassResponsibility"]
  5688. }),
  5689. $globals.CharacterArray.klass);
  5690. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  5691. //>>excludeStart("ide", pragmas.excludeIdeData);
  5692. $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 >> #,`";
  5693. //>>excludeEnd("ide");
  5694. $core.addMethod(
  5695. $core.method({
  5696. selector: ",",
  5697. protocol: "copying",
  5698. fn: function (aString){
  5699. var self=this;
  5700. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5701. return $core.withContext(function($ctx1) {
  5702. //>>excludeEnd("ctx");
  5703. return String(self) + aString;
  5704. return self;
  5705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5706. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5707. //>>excludeEnd("ctx");
  5708. },
  5709. //>>excludeStart("ide", pragmas.excludeIdeData);
  5710. args: ["aString"],
  5711. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5712. referencedClasses: [],
  5713. //>>excludeEnd("ide");
  5714. messageSends: []
  5715. }),
  5716. $globals.String);
  5717. $core.addMethod(
  5718. $core.method({
  5719. selector: "<",
  5720. protocol: "comparing",
  5721. fn: function (aString){
  5722. var self=this;
  5723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5724. return $core.withContext(function($ctx1) {
  5725. //>>excludeEnd("ctx");
  5726. return String(self) < aString._asString();
  5727. return self;
  5728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5729. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5730. //>>excludeEnd("ctx");
  5731. },
  5732. //>>excludeStart("ide", pragmas.excludeIdeData);
  5733. args: ["aString"],
  5734. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5735. referencedClasses: [],
  5736. //>>excludeEnd("ide");
  5737. messageSends: []
  5738. }),
  5739. $globals.String);
  5740. $core.addMethod(
  5741. $core.method({
  5742. selector: "<=",
  5743. protocol: "comparing",
  5744. fn: function (aString){
  5745. var self=this;
  5746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5747. return $core.withContext(function($ctx1) {
  5748. //>>excludeEnd("ctx");
  5749. return String(self) <= aString._asString();
  5750. return self;
  5751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5752. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5753. //>>excludeEnd("ctx");
  5754. },
  5755. //>>excludeStart("ide", pragmas.excludeIdeData);
  5756. args: ["aString"],
  5757. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5758. referencedClasses: [],
  5759. //>>excludeEnd("ide");
  5760. messageSends: []
  5761. }),
  5762. $globals.String);
  5763. $core.addMethod(
  5764. $core.method({
  5765. selector: "=",
  5766. protocol: "comparing",
  5767. fn: function (aString){
  5768. var self=this;
  5769. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5770. return $core.withContext(function($ctx1) {
  5771. //>>excludeEnd("ctx");
  5772. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5773. return self;
  5774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5775. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5776. //>>excludeEnd("ctx");
  5777. },
  5778. //>>excludeStart("ide", pragmas.excludeIdeData);
  5779. args: ["aString"],
  5780. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5781. referencedClasses: [],
  5782. //>>excludeEnd("ide");
  5783. messageSends: []
  5784. }),
  5785. $globals.String);
  5786. $core.addMethod(
  5787. $core.method({
  5788. selector: "==",
  5789. protocol: "comparing",
  5790. fn: function (aString){
  5791. var self=this;
  5792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5793. return $core.withContext(function($ctx1) {
  5794. //>>excludeEnd("ctx");
  5795. if (typeof aString === "string") return String(self) === aString;
  5796. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5797. else return false;;
  5798. return self;
  5799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5800. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5801. //>>excludeEnd("ctx");
  5802. },
  5803. //>>excludeStart("ide", pragmas.excludeIdeData);
  5804. args: ["aString"],
  5805. 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'>",
  5806. referencedClasses: [],
  5807. //>>excludeEnd("ide");
  5808. messageSends: []
  5809. }),
  5810. $globals.String);
  5811. $core.addMethod(
  5812. $core.method({
  5813. selector: ">",
  5814. protocol: "comparing",
  5815. fn: function (aString){
  5816. var self=this;
  5817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5818. return $core.withContext(function($ctx1) {
  5819. //>>excludeEnd("ctx");
  5820. return String(self) > aString._asString();
  5821. return self;
  5822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5823. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5824. //>>excludeEnd("ctx");
  5825. },
  5826. //>>excludeStart("ide", pragmas.excludeIdeData);
  5827. args: ["aString"],
  5828. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5829. referencedClasses: [],
  5830. //>>excludeEnd("ide");
  5831. messageSends: []
  5832. }),
  5833. $globals.String);
  5834. $core.addMethod(
  5835. $core.method({
  5836. selector: ">=",
  5837. protocol: "comparing",
  5838. fn: function (aString){
  5839. var self=this;
  5840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5841. return $core.withContext(function($ctx1) {
  5842. //>>excludeEnd("ctx");
  5843. return String(self) >= aString._asString();
  5844. return self;
  5845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5846. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5847. //>>excludeEnd("ctx");
  5848. },
  5849. //>>excludeStart("ide", pragmas.excludeIdeData);
  5850. args: ["aString"],
  5851. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5852. referencedClasses: [],
  5853. //>>excludeEnd("ide");
  5854. messageSends: []
  5855. }),
  5856. $globals.String);
  5857. $core.addMethod(
  5858. $core.method({
  5859. selector: "asJSON",
  5860. protocol: "converting",
  5861. fn: function (){
  5862. var self=this;
  5863. return self;
  5864. },
  5865. //>>excludeStart("ide", pragmas.excludeIdeData);
  5866. args: [],
  5867. source: "asJSON\x0a\x09^ self",
  5868. referencedClasses: [],
  5869. //>>excludeEnd("ide");
  5870. messageSends: []
  5871. }),
  5872. $globals.String);
  5873. $core.addMethod(
  5874. $core.method({
  5875. selector: "asJavaScriptMethodName",
  5876. protocol: "converting",
  5877. fn: function (){
  5878. var self=this;
  5879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5880. return $core.withContext(function($ctx1) {
  5881. //>>excludeEnd("ctx");
  5882. return $core.st2js(self);
  5883. return self;
  5884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5885. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5886. //>>excludeEnd("ctx");
  5887. },
  5888. //>>excludeStart("ide", pragmas.excludeIdeData);
  5889. args: [],
  5890. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5891. referencedClasses: [],
  5892. //>>excludeEnd("ide");
  5893. messageSends: []
  5894. }),
  5895. $globals.String);
  5896. $core.addMethod(
  5897. $core.method({
  5898. selector: "asJavascript",
  5899. protocol: "converting",
  5900. fn: function (){
  5901. var self=this;
  5902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5903. return $core.withContext(function($ctx1) {
  5904. //>>excludeEnd("ctx");
  5905. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5906. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5907. else
  5908. return "\"" + self + "\"";
  5909. ;
  5910. return self;
  5911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5912. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  5913. //>>excludeEnd("ctx");
  5914. },
  5915. //>>excludeStart("ide", pragmas.excludeIdeData);
  5916. args: [],
  5917. source: "asJavascript\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'>",
  5918. referencedClasses: [],
  5919. //>>excludeEnd("ide");
  5920. messageSends: []
  5921. }),
  5922. $globals.String);
  5923. $core.addMethod(
  5924. $core.method({
  5925. selector: "asLowercase",
  5926. protocol: "converting",
  5927. fn: function (){
  5928. var self=this;
  5929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5930. return $core.withContext(function($ctx1) {
  5931. //>>excludeEnd("ctx");
  5932. return self.toLowerCase();
  5933. return self;
  5934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5935. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5936. //>>excludeEnd("ctx");
  5937. },
  5938. //>>excludeStart("ide", pragmas.excludeIdeData);
  5939. args: [],
  5940. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5941. referencedClasses: [],
  5942. //>>excludeEnd("ide");
  5943. messageSends: []
  5944. }),
  5945. $globals.String);
  5946. $core.addMethod(
  5947. $core.method({
  5948. selector: "asMutator",
  5949. protocol: "converting",
  5950. fn: function (){
  5951. var self=this;
  5952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5953. return $core.withContext(function($ctx1) {
  5954. //>>excludeEnd("ctx");
  5955. var $1;
  5956. $1=$recv(self._last()).__eq(":");
  5957. if(!$core.assert($1)){
  5958. return self.__comma(":");
  5959. }
  5960. return self;
  5961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5962. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5963. //>>excludeEnd("ctx");
  5964. },
  5965. //>>excludeStart("ide", pragmas.excludeIdeData);
  5966. args: [],
  5967. 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",
  5968. referencedClasses: [],
  5969. //>>excludeEnd("ide");
  5970. messageSends: ["ifFalse:", "=", "last", ","]
  5971. }),
  5972. $globals.String);
  5973. $core.addMethod(
  5974. $core.method({
  5975. selector: "asNumber",
  5976. protocol: "converting",
  5977. fn: function (){
  5978. var self=this;
  5979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5980. return $core.withContext(function($ctx1) {
  5981. //>>excludeEnd("ctx");
  5982. return Number(self);
  5983. return self;
  5984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5985. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5986. //>>excludeEnd("ctx");
  5987. },
  5988. //>>excludeStart("ide", pragmas.excludeIdeData);
  5989. args: [],
  5990. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5991. referencedClasses: [],
  5992. //>>excludeEnd("ide");
  5993. messageSends: []
  5994. }),
  5995. $globals.String);
  5996. $core.addMethod(
  5997. $core.method({
  5998. selector: "asRegexp",
  5999. protocol: "converting",
  6000. fn: function (){
  6001. var self=this;
  6002. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6003. return $core.withContext(function($ctx1) {
  6004. //>>excludeEnd("ctx");
  6005. return $recv($globals.RegularExpression)._fromString_(self);
  6006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6007. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  6008. //>>excludeEnd("ctx");
  6009. },
  6010. //>>excludeStart("ide", pragmas.excludeIdeData);
  6011. args: [],
  6012. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  6013. referencedClasses: ["RegularExpression"],
  6014. //>>excludeEnd("ide");
  6015. messageSends: ["fromString:"]
  6016. }),
  6017. $globals.String);
  6018. $core.addMethod(
  6019. $core.method({
  6020. selector: "asString",
  6021. protocol: "converting",
  6022. fn: function (){
  6023. var self=this;
  6024. return self;
  6025. },
  6026. //>>excludeStart("ide", pragmas.excludeIdeData);
  6027. args: [],
  6028. source: "asString\x0a\x09^ self",
  6029. referencedClasses: [],
  6030. //>>excludeEnd("ide");
  6031. messageSends: []
  6032. }),
  6033. $globals.String);
  6034. $core.addMethod(
  6035. $core.method({
  6036. selector: "asSymbol",
  6037. protocol: "converting",
  6038. fn: function (){
  6039. var self=this;
  6040. return self;
  6041. },
  6042. //>>excludeStart("ide", pragmas.excludeIdeData);
  6043. args: [],
  6044. source: "asSymbol\x0a\x09^ self",
  6045. referencedClasses: [],
  6046. //>>excludeEnd("ide");
  6047. messageSends: []
  6048. }),
  6049. $globals.String);
  6050. $core.addMethod(
  6051. $core.method({
  6052. selector: "asUppercase",
  6053. protocol: "converting",
  6054. fn: function (){
  6055. var self=this;
  6056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6057. return $core.withContext(function($ctx1) {
  6058. //>>excludeEnd("ctx");
  6059. return self.toUpperCase();
  6060. return self;
  6061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6062. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  6063. //>>excludeEnd("ctx");
  6064. },
  6065. //>>excludeStart("ide", pragmas.excludeIdeData);
  6066. args: [],
  6067. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  6068. referencedClasses: [],
  6069. //>>excludeEnd("ide");
  6070. messageSends: []
  6071. }),
  6072. $globals.String);
  6073. $core.addMethod(
  6074. $core.method({
  6075. selector: "asciiValue",
  6076. protocol: "accessing",
  6077. fn: function (){
  6078. var self=this;
  6079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6080. return $core.withContext(function($ctx1) {
  6081. //>>excludeEnd("ctx");
  6082. return self.charCodeAt(0);;
  6083. return self;
  6084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6085. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  6086. //>>excludeEnd("ctx");
  6087. },
  6088. //>>excludeStart("ide", pragmas.excludeIdeData);
  6089. args: [],
  6090. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  6091. referencedClasses: [],
  6092. //>>excludeEnd("ide");
  6093. messageSends: []
  6094. }),
  6095. $globals.String);
  6096. $core.addMethod(
  6097. $core.method({
  6098. selector: "at:ifAbsent:",
  6099. protocol: "accessing",
  6100. fn: function (anIndex,aBlock){
  6101. var self=this;
  6102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6103. return $core.withContext(function($ctx1) {
  6104. //>>excludeEnd("ctx");
  6105. return String(self)[anIndex - 1] || aBlock._value();
  6106. return self;
  6107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6108. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  6109. //>>excludeEnd("ctx");
  6110. },
  6111. //>>excludeStart("ide", pragmas.excludeIdeData);
  6112. args: ["anIndex", "aBlock"],
  6113. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  6114. referencedClasses: [],
  6115. //>>excludeEnd("ide");
  6116. messageSends: []
  6117. }),
  6118. $globals.String);
  6119. $core.addMethod(
  6120. $core.method({
  6121. selector: "at:ifPresent:ifAbsent:",
  6122. protocol: "accessing",
  6123. fn: function (anIndex,aBlock,anotherBlock){
  6124. var self=this;
  6125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6126. return $core.withContext(function($ctx1) {
  6127. //>>excludeEnd("ctx");
  6128. var result = String(self)[anIndex - 1];
  6129. return result ? aBlock._value_(result) : anotherBlock._value();
  6130. ;
  6131. return self;
  6132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6133. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  6134. //>>excludeEnd("ctx");
  6135. },
  6136. //>>excludeStart("ide", pragmas.excludeIdeData);
  6137. args: ["anIndex", "aBlock", "anotherBlock"],
  6138. 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'>",
  6139. referencedClasses: [],
  6140. //>>excludeEnd("ide");
  6141. messageSends: []
  6142. }),
  6143. $globals.String);
  6144. $core.addMethod(
  6145. $core.method({
  6146. selector: "capitalized",
  6147. protocol: "converting",
  6148. fn: function (){
  6149. var self=this;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. return $core.withContext(function($ctx1) {
  6152. //>>excludeEnd("ctx");
  6153. return self._ifNotEmpty_((function(){
  6154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6155. return $core.withContext(function($ctx2) {
  6156. //>>excludeEnd("ctx");
  6157. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  6158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6159. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6160. //>>excludeEnd("ctx");
  6161. }));
  6162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6163. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  6164. //>>excludeEnd("ctx");
  6165. },
  6166. //>>excludeStart("ide", pragmas.excludeIdeData);
  6167. args: [],
  6168. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  6169. referencedClasses: [],
  6170. //>>excludeEnd("ide");
  6171. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  6172. }),
  6173. $globals.String);
  6174. $core.addMethod(
  6175. $core.method({
  6176. selector: "charCodeAt:",
  6177. protocol: "accessing",
  6178. fn: function (anInteger){
  6179. var self=this;
  6180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6181. return $core.withContext(function($ctx1) {
  6182. //>>excludeEnd("ctx");
  6183. return self.charCodeAt(anInteger - 1);
  6184. return self;
  6185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6186. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6187. //>>excludeEnd("ctx");
  6188. },
  6189. //>>excludeStart("ide", pragmas.excludeIdeData);
  6190. args: ["anInteger"],
  6191. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  6192. referencedClasses: [],
  6193. //>>excludeEnd("ide");
  6194. messageSends: []
  6195. }),
  6196. $globals.String);
  6197. $core.addMethod(
  6198. $core.method({
  6199. selector: "copyFrom:to:",
  6200. protocol: "copying",
  6201. fn: function (anIndex,anotherIndex){
  6202. var self=this;
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. return $core.withContext(function($ctx1) {
  6205. //>>excludeEnd("ctx");
  6206. return self.substring(anIndex - 1, anotherIndex);
  6207. return self;
  6208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6209. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6210. //>>excludeEnd("ctx");
  6211. },
  6212. //>>excludeStart("ide", pragmas.excludeIdeData);
  6213. args: ["anIndex", "anotherIndex"],
  6214. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  6215. referencedClasses: [],
  6216. //>>excludeEnd("ide");
  6217. messageSends: []
  6218. }),
  6219. $globals.String);
  6220. $core.addMethod(
  6221. $core.method({
  6222. selector: "crlfSanitized",
  6223. protocol: "converting",
  6224. fn: function (){
  6225. var self=this;
  6226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6227. return $core.withContext(function($ctx1) {
  6228. //>>excludeEnd("ctx");
  6229. return $recv(self._lines())._join_($recv($globals.String)._lf());
  6230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6231. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6232. //>>excludeEnd("ctx");
  6233. },
  6234. //>>excludeStart("ide", pragmas.excludeIdeData);
  6235. args: [],
  6236. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6237. referencedClasses: ["String"],
  6238. //>>excludeEnd("ide");
  6239. messageSends: ["join:", "lines", "lf"]
  6240. }),
  6241. $globals.String);
  6242. $core.addMethod(
  6243. $core.method({
  6244. selector: "deepCopy",
  6245. protocol: "copying",
  6246. fn: function (){
  6247. var self=this;
  6248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6249. return $core.withContext(function($ctx1) {
  6250. //>>excludeEnd("ctx");
  6251. return self._shallowCopy();
  6252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6253. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6254. //>>excludeEnd("ctx");
  6255. },
  6256. //>>excludeStart("ide", pragmas.excludeIdeData);
  6257. args: [],
  6258. source: "deepCopy\x0a\x09^ self shallowCopy",
  6259. referencedClasses: [],
  6260. //>>excludeEnd("ide");
  6261. messageSends: ["shallowCopy"]
  6262. }),
  6263. $globals.String);
  6264. $core.addMethod(
  6265. $core.method({
  6266. selector: "escaped",
  6267. protocol: "converting",
  6268. fn: function (){
  6269. var self=this;
  6270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6271. return $core.withContext(function($ctx1) {
  6272. //>>excludeEnd("ctx");
  6273. return escape(self);
  6274. return self;
  6275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6276. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6277. //>>excludeEnd("ctx");
  6278. },
  6279. //>>excludeStart("ide", pragmas.excludeIdeData);
  6280. args: [],
  6281. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  6282. referencedClasses: [],
  6283. //>>excludeEnd("ide");
  6284. messageSends: []
  6285. }),
  6286. $globals.String);
  6287. $core.addMethod(
  6288. $core.method({
  6289. selector: "includesSubString:",
  6290. protocol: "testing",
  6291. fn: function (subString){
  6292. var self=this;
  6293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6294. return $core.withContext(function($ctx1) {
  6295. //>>excludeEnd("ctx");
  6296. return self.indexOf(subString) != -1;
  6297. return self;
  6298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6299. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6300. //>>excludeEnd("ctx");
  6301. },
  6302. //>>excludeStart("ide", pragmas.excludeIdeData);
  6303. args: ["subString"],
  6304. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  6305. referencedClasses: [],
  6306. //>>excludeEnd("ide");
  6307. messageSends: []
  6308. }),
  6309. $globals.String);
  6310. $core.addMethod(
  6311. $core.method({
  6312. selector: "isCapitalized",
  6313. protocol: "testing",
  6314. fn: function (){
  6315. var self=this;
  6316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6317. return $core.withContext(function($ctx1) {
  6318. //>>excludeEnd("ctx");
  6319. var $2,$1;
  6320. $2=self._first();
  6321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6322. $ctx1.sendIdx["first"]=1;
  6323. //>>excludeEnd("ctx");
  6324. $1=$recv($2)._asUppercase();
  6325. return $recv($1).__eq_eq(self._first());
  6326. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6327. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6328. //>>excludeEnd("ctx");
  6329. },
  6330. //>>excludeStart("ide", pragmas.excludeIdeData);
  6331. args: [],
  6332. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6333. referencedClasses: [],
  6334. //>>excludeEnd("ide");
  6335. messageSends: ["==", "asUppercase", "first"]
  6336. }),
  6337. $globals.String);
  6338. $core.addMethod(
  6339. $core.method({
  6340. selector: "isImmutable",
  6341. protocol: "testing",
  6342. fn: function (){
  6343. var self=this;
  6344. return true;
  6345. },
  6346. //>>excludeStart("ide", pragmas.excludeIdeData);
  6347. args: [],
  6348. source: "isImmutable\x0a\x09^ true",
  6349. referencedClasses: [],
  6350. //>>excludeEnd("ide");
  6351. messageSends: []
  6352. }),
  6353. $globals.String);
  6354. $core.addMethod(
  6355. $core.method({
  6356. selector: "isSelector",
  6357. protocol: "testing",
  6358. fn: function (){
  6359. var self=this;
  6360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6361. return $core.withContext(function($ctx1) {
  6362. //>>excludeEnd("ctx");
  6363. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  6364. return self;
  6365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6366. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  6367. //>>excludeEnd("ctx");
  6368. },
  6369. //>>excludeStart("ide", pragmas.excludeIdeData);
  6370. args: [],
  6371. 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>",
  6372. referencedClasses: [],
  6373. //>>excludeEnd("ide");
  6374. messageSends: []
  6375. }),
  6376. $globals.String);
  6377. $core.addMethod(
  6378. $core.method({
  6379. selector: "isString",
  6380. protocol: "testing",
  6381. fn: function (){
  6382. var self=this;
  6383. return true;
  6384. },
  6385. //>>excludeStart("ide", pragmas.excludeIdeData);
  6386. args: [],
  6387. source: "isString\x0a\x09^ true",
  6388. referencedClasses: [],
  6389. //>>excludeEnd("ide");
  6390. messageSends: []
  6391. }),
  6392. $globals.String);
  6393. $core.addMethod(
  6394. $core.method({
  6395. selector: "isVowel",
  6396. protocol: "testing",
  6397. fn: function (){
  6398. var self=this;
  6399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6400. return $core.withContext(function($ctx1) {
  6401. //>>excludeEnd("ctx");
  6402. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  6403. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6404. return $core.withContext(function($ctx2) {
  6405. //>>excludeEnd("ctx");
  6406. return "aeiou"._includes_(self._asLowercase());
  6407. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6408. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6409. //>>excludeEnd("ctx");
  6410. }));
  6411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6412. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6413. //>>excludeEnd("ctx");
  6414. },
  6415. //>>excludeStart("ide", pragmas.excludeIdeData);
  6416. args: [],
  6417. 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 ]",
  6418. referencedClasses: [],
  6419. //>>excludeEnd("ide");
  6420. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6421. }),
  6422. $globals.String);
  6423. $core.addMethod(
  6424. $core.method({
  6425. selector: "join:",
  6426. protocol: "split join",
  6427. fn: function (aCollection){
  6428. var self=this;
  6429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6430. return $core.withContext(function($ctx1) {
  6431. //>>excludeEnd("ctx");
  6432. return $recv($globals.String)._streamContents_((function(stream){
  6433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6434. return $core.withContext(function($ctx2) {
  6435. //>>excludeEnd("ctx");
  6436. return $recv(aCollection)._do_separatedBy_((function(each){
  6437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6438. return $core.withContext(function($ctx3) {
  6439. //>>excludeEnd("ctx");
  6440. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6442. $ctx3.sendIdx["nextPutAll:"]=1;
  6443. //>>excludeEnd("ctx");
  6444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6445. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6446. //>>excludeEnd("ctx");
  6447. }),(function(){
  6448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6449. return $core.withContext(function($ctx3) {
  6450. //>>excludeEnd("ctx");
  6451. return $recv(stream)._nextPutAll_(self);
  6452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6453. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6454. //>>excludeEnd("ctx");
  6455. }));
  6456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6457. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6458. //>>excludeEnd("ctx");
  6459. }));
  6460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6461. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6462. //>>excludeEnd("ctx");
  6463. },
  6464. //>>excludeStart("ide", pragmas.excludeIdeData);
  6465. args: ["aCollection"],
  6466. 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 ]]",
  6467. referencedClasses: ["String"],
  6468. //>>excludeEnd("ide");
  6469. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6470. }),
  6471. $globals.String);
  6472. $core.addMethod(
  6473. $core.method({
  6474. selector: "lineIndicesDo:",
  6475. protocol: "split join",
  6476. fn: function (aBlock){
  6477. var self=this;
  6478. var cr,lf,start,sz,nextLF,nextCR;
  6479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6480. return $core.withContext(function($ctx1) {
  6481. //>>excludeEnd("ctx");
  6482. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6483. var $early={};
  6484. try {
  6485. start=(1);
  6486. sz=self._size();
  6487. cr=$recv($globals.String)._cr();
  6488. nextCR=self._indexOf_startingAt_(cr,(1));
  6489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6490. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6491. //>>excludeEnd("ctx");
  6492. lf=$recv($globals.String)._lf();
  6493. nextLF=self._indexOf_startingAt_(lf,(1));
  6494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6495. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6496. //>>excludeEnd("ctx");
  6497. $recv((function(){
  6498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6499. return $core.withContext(function($ctx2) {
  6500. //>>excludeEnd("ctx");
  6501. return $recv(start).__lt_eq(sz);
  6502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6504. //>>excludeEnd("ctx");
  6505. }))._whileTrue_((function(){
  6506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6507. return $core.withContext(function($ctx2) {
  6508. //>>excludeEnd("ctx");
  6509. $2=$recv(nextLF).__eq((0));
  6510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6511. $ctx2.sendIdx["="]=1;
  6512. //>>excludeEnd("ctx");
  6513. $1=$recv($2)._and_((function(){
  6514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6515. return $core.withContext(function($ctx3) {
  6516. //>>excludeEnd("ctx");
  6517. return $recv(nextCR).__eq((0));
  6518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6519. $ctx3.sendIdx["="]=2;
  6520. //>>excludeEnd("ctx");
  6521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6522. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6523. //>>excludeEnd("ctx");
  6524. }));
  6525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6526. $ctx2.sendIdx["and:"]=1;
  6527. //>>excludeEnd("ctx");
  6528. if($core.assert($1)){
  6529. $recv(aBlock)._value_value_value_(start,sz,sz);
  6530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6531. $ctx2.sendIdx["value:value:value:"]=1;
  6532. //>>excludeEnd("ctx");
  6533. throw $early=[self];
  6534. }
  6535. $4=$recv(nextCR).__eq((0));
  6536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6537. $ctx2.sendIdx["="]=3;
  6538. //>>excludeEnd("ctx");
  6539. $3=$recv($4)._or_((function(){
  6540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6541. return $core.withContext(function($ctx3) {
  6542. //>>excludeEnd("ctx");
  6543. $5=(0).__lt(nextLF);
  6544. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6545. $ctx3.sendIdx["<"]=1;
  6546. //>>excludeEnd("ctx");
  6547. return $recv($5)._and_((function(){
  6548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6549. return $core.withContext(function($ctx4) {
  6550. //>>excludeEnd("ctx");
  6551. return $recv(nextLF).__lt(nextCR);
  6552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6553. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6554. //>>excludeEnd("ctx");
  6555. }));
  6556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6557. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6558. //>>excludeEnd("ctx");
  6559. }));
  6560. if($core.assert($3)){
  6561. $6=start;
  6562. $7=$recv(nextLF).__minus((1));
  6563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6564. $ctx2.sendIdx["-"]=1;
  6565. //>>excludeEnd("ctx");
  6566. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6568. $ctx2.sendIdx["value:value:value:"]=2;
  6569. //>>excludeEnd("ctx");
  6570. start=(1).__plus(nextLF);
  6571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6572. $ctx2.sendIdx["+"]=1;
  6573. //>>excludeEnd("ctx");
  6574. start;
  6575. nextLF=self._indexOf_startingAt_(lf,start);
  6576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6577. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6578. //>>excludeEnd("ctx");
  6579. return nextLF;
  6580. } else {
  6581. $9=(1).__plus(nextCR);
  6582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6583. $ctx2.sendIdx["+"]=2;
  6584. //>>excludeEnd("ctx");
  6585. $8=$recv($9).__eq(nextLF);
  6586. if($core.assert($8)){
  6587. $10=start;
  6588. $11=$recv(nextCR).__minus((1));
  6589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6590. $ctx2.sendIdx["-"]=2;
  6591. //>>excludeEnd("ctx");
  6592. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6594. $ctx2.sendIdx["value:value:value:"]=3;
  6595. //>>excludeEnd("ctx");
  6596. start=(1).__plus(nextLF);
  6597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6598. $ctx2.sendIdx["+"]=3;
  6599. //>>excludeEnd("ctx");
  6600. start;
  6601. nextCR=self._indexOf_startingAt_(cr,start);
  6602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6603. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6604. //>>excludeEnd("ctx");
  6605. nextCR;
  6606. nextLF=self._indexOf_startingAt_(lf,start);
  6607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6608. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6609. //>>excludeEnd("ctx");
  6610. return nextLF;
  6611. } else {
  6612. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6613. start=(1).__plus(nextCR);
  6614. start;
  6615. nextCR=self._indexOf_startingAt_(cr,start);
  6616. return nextCR;
  6617. }
  6618. }
  6619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6621. //>>excludeEnd("ctx");
  6622. }));
  6623. return self;
  6624. }
  6625. catch(e) {if(e===$early)return e[0]; throw e}
  6626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6627. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6628. //>>excludeEnd("ctx");
  6629. },
  6630. //>>excludeStart("ide", pragmas.excludeIdeData);
  6631. args: ["aBlock"],
  6632. 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 ] ]]",
  6633. referencedClasses: ["String"],
  6634. //>>excludeEnd("ide");
  6635. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6636. }),
  6637. $globals.String);
  6638. $core.addMethod(
  6639. $core.method({
  6640. selector: "lineNumber:",
  6641. protocol: "split join",
  6642. fn: function (anIndex){
  6643. var self=this;
  6644. var lineCount;
  6645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6646. return $core.withContext(function($ctx1) {
  6647. //>>excludeEnd("ctx");
  6648. var $2,$1;
  6649. var $early={};
  6650. try {
  6651. lineCount=(0);
  6652. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6654. return $core.withContext(function($ctx2) {
  6655. //>>excludeEnd("ctx");
  6656. lineCount=$recv(lineCount).__plus((1));
  6657. $2=lineCount;
  6658. $1=$recv($2).__eq(anIndex);
  6659. if($core.assert($1)){
  6660. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  6661. }
  6662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6663. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6664. //>>excludeEnd("ctx");
  6665. }));
  6666. return nil;
  6667. }
  6668. catch(e) {if(e===$early)return e[0]; throw e}
  6669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6670. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6671. //>>excludeEnd("ctx");
  6672. },
  6673. //>>excludeStart("ide", pragmas.excludeIdeData);
  6674. args: ["anIndex"],
  6675. 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",
  6676. referencedClasses: [],
  6677. //>>excludeEnd("ide");
  6678. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6679. }),
  6680. $globals.String);
  6681. $core.addMethod(
  6682. $core.method({
  6683. selector: "lines",
  6684. protocol: "split join",
  6685. fn: function (){
  6686. var self=this;
  6687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6688. return $core.withContext(function($ctx1) {
  6689. //>>excludeEnd("ctx");
  6690. var result = self.split(/\r\n|\r|\n/);
  6691. if (!result[result.length-1]) result.pop();
  6692. return result;;
  6693. return self;
  6694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6695. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6696. //>>excludeEnd("ctx");
  6697. },
  6698. //>>excludeStart("ide", pragmas.excludeIdeData);
  6699. args: [],
  6700. 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'>",
  6701. referencedClasses: [],
  6702. //>>excludeEnd("ide");
  6703. messageSends: []
  6704. }),
  6705. $globals.String);
  6706. $core.addMethod(
  6707. $core.method({
  6708. selector: "linesDo:",
  6709. protocol: "split join",
  6710. fn: function (aBlock){
  6711. var self=this;
  6712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6713. return $core.withContext(function($ctx1) {
  6714. //>>excludeEnd("ctx");
  6715. $recv(self._lines())._do_(aBlock);
  6716. return self;
  6717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6718. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6719. //>>excludeEnd("ctx");
  6720. },
  6721. //>>excludeStart("ide", pragmas.excludeIdeData);
  6722. args: ["aBlock"],
  6723. 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",
  6724. referencedClasses: [],
  6725. //>>excludeEnd("ide");
  6726. messageSends: ["do:", "lines"]
  6727. }),
  6728. $globals.String);
  6729. $core.addMethod(
  6730. $core.method({
  6731. selector: "match:",
  6732. protocol: "regular expressions",
  6733. fn: function (aRegexp){
  6734. var self=this;
  6735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6736. return $core.withContext(function($ctx1) {
  6737. //>>excludeEnd("ctx");
  6738. return self.search(aRegexp) != -1;
  6739. return self;
  6740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6741. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6742. //>>excludeEnd("ctx");
  6743. },
  6744. //>>excludeStart("ide", pragmas.excludeIdeData);
  6745. args: ["aRegexp"],
  6746. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6747. referencedClasses: [],
  6748. //>>excludeEnd("ide");
  6749. messageSends: []
  6750. }),
  6751. $globals.String);
  6752. $core.addMethod(
  6753. $core.method({
  6754. selector: "matchesOf:",
  6755. protocol: "regular expressions",
  6756. fn: function (aRegularExpression){
  6757. var self=this;
  6758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6759. return $core.withContext(function($ctx1) {
  6760. //>>excludeEnd("ctx");
  6761. return self.match(aRegularExpression);
  6762. return self;
  6763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6764. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6765. //>>excludeEnd("ctx");
  6766. },
  6767. //>>excludeStart("ide", pragmas.excludeIdeData);
  6768. args: ["aRegularExpression"],
  6769. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6770. referencedClasses: [],
  6771. //>>excludeEnd("ide");
  6772. messageSends: []
  6773. }),
  6774. $globals.String);
  6775. $core.addMethod(
  6776. $core.method({
  6777. selector: "numericallyIndexable",
  6778. protocol: "private",
  6779. fn: function (){
  6780. var self=this;
  6781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6782. return $core.withContext(function($ctx1) {
  6783. //>>excludeEnd("ctx");
  6784. return String(self);
  6785. return self;
  6786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6787. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6788. //>>excludeEnd("ctx");
  6789. },
  6790. //>>excludeStart("ide", pragmas.excludeIdeData);
  6791. args: [],
  6792. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  6793. referencedClasses: [],
  6794. //>>excludeEnd("ide");
  6795. messageSends: []
  6796. }),
  6797. $globals.String);
  6798. $core.addMethod(
  6799. $core.method({
  6800. selector: "printNl",
  6801. protocol: "printing",
  6802. fn: function (){
  6803. var self=this;
  6804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6805. return $core.withContext(function($ctx1) {
  6806. //>>excludeEnd("ctx");
  6807. console.log(self);
  6808. return self;
  6809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6810. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6811. //>>excludeEnd("ctx");
  6812. },
  6813. //>>excludeStart("ide", pragmas.excludeIdeData);
  6814. args: [],
  6815. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6816. referencedClasses: [],
  6817. //>>excludeEnd("ide");
  6818. messageSends: []
  6819. }),
  6820. $globals.String);
  6821. $core.addMethod(
  6822. $core.method({
  6823. selector: "printOn:",
  6824. protocol: "printing",
  6825. fn: function (aStream){
  6826. var self=this;
  6827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6828. return $core.withContext(function($ctx1) {
  6829. //>>excludeEnd("ctx");
  6830. $recv(aStream)._nextPutAll_("'");
  6831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6832. $ctx1.sendIdx["nextPutAll:"]=1;
  6833. //>>excludeEnd("ctx");
  6834. $recv(aStream)._nextPutAll_(self._replace_with_("'","''"));
  6835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6836. $ctx1.sendIdx["nextPutAll:"]=2;
  6837. //>>excludeEnd("ctx");
  6838. $recv(aStream)._nextPutAll_("'");
  6839. return self;
  6840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6841. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6842. //>>excludeEnd("ctx");
  6843. },
  6844. //>>excludeStart("ide", pragmas.excludeIdeData);
  6845. args: ["aStream"],
  6846. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  6847. referencedClasses: [],
  6848. //>>excludeEnd("ide");
  6849. messageSends: ["nextPutAll:", "replace:with:"]
  6850. }),
  6851. $globals.String);
  6852. $core.addMethod(
  6853. $core.method({
  6854. selector: "replace:with:",
  6855. protocol: "regular expressions",
  6856. fn: function (aString,anotherString){
  6857. var self=this;
  6858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6859. return $core.withContext(function($ctx1) {
  6860. //>>excludeEnd("ctx");
  6861. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6863. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6864. //>>excludeEnd("ctx");
  6865. },
  6866. //>>excludeStart("ide", pragmas.excludeIdeData);
  6867. args: ["aString", "anotherString"],
  6868. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6869. referencedClasses: ["RegularExpression"],
  6870. //>>excludeEnd("ide");
  6871. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6872. }),
  6873. $globals.String);
  6874. $core.addMethod(
  6875. $core.method({
  6876. selector: "replaceRegexp:with:",
  6877. protocol: "regular expressions",
  6878. fn: function (aRegexp,aString){
  6879. var self=this;
  6880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6881. return $core.withContext(function($ctx1) {
  6882. //>>excludeEnd("ctx");
  6883. return self.replace(aRegexp, aString);
  6884. return self;
  6885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6886. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6887. //>>excludeEnd("ctx");
  6888. },
  6889. //>>excludeStart("ide", pragmas.excludeIdeData);
  6890. args: ["aRegexp", "aString"],
  6891. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6892. referencedClasses: [],
  6893. //>>excludeEnd("ide");
  6894. messageSends: []
  6895. }),
  6896. $globals.String);
  6897. $core.addMethod(
  6898. $core.method({
  6899. selector: "reversed",
  6900. protocol: "converting",
  6901. fn: function (){
  6902. var self=this;
  6903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6904. return $core.withContext(function($ctx1) {
  6905. //>>excludeEnd("ctx");
  6906. return self.split("").reverse().join("");
  6907. return self;
  6908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6909. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6910. //>>excludeEnd("ctx");
  6911. },
  6912. //>>excludeStart("ide", pragmas.excludeIdeData);
  6913. args: [],
  6914. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6915. referencedClasses: [],
  6916. //>>excludeEnd("ide");
  6917. messageSends: []
  6918. }),
  6919. $globals.String);
  6920. $core.addMethod(
  6921. $core.method({
  6922. selector: "shallowCopy",
  6923. protocol: "copying",
  6924. fn: function (){
  6925. var self=this;
  6926. return self;
  6927. },
  6928. //>>excludeStart("ide", pragmas.excludeIdeData);
  6929. args: [],
  6930. source: "shallowCopy\x0a\x09^ self",
  6931. referencedClasses: [],
  6932. //>>excludeEnd("ide");
  6933. messageSends: []
  6934. }),
  6935. $globals.String);
  6936. $core.addMethod(
  6937. $core.method({
  6938. selector: "size",
  6939. protocol: "accessing",
  6940. fn: function (){
  6941. var self=this;
  6942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6943. return $core.withContext(function($ctx1) {
  6944. //>>excludeEnd("ctx");
  6945. return self.length;
  6946. return self;
  6947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6948. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6949. //>>excludeEnd("ctx");
  6950. },
  6951. //>>excludeStart("ide", pragmas.excludeIdeData);
  6952. args: [],
  6953. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  6954. referencedClasses: [],
  6955. //>>excludeEnd("ide");
  6956. messageSends: []
  6957. }),
  6958. $globals.String);
  6959. $core.addMethod(
  6960. $core.method({
  6961. selector: "subStrings:",
  6962. protocol: "split join",
  6963. fn: function (aString){
  6964. var self=this;
  6965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6966. return $core.withContext(function($ctx1) {
  6967. //>>excludeEnd("ctx");
  6968. return self._tokenize_(aString);
  6969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6970. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6971. //>>excludeEnd("ctx");
  6972. },
  6973. //>>excludeStart("ide", pragmas.excludeIdeData);
  6974. args: ["aString"],
  6975. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6976. referencedClasses: [],
  6977. //>>excludeEnd("ide");
  6978. messageSends: ["tokenize:"]
  6979. }),
  6980. $globals.String);
  6981. $core.addMethod(
  6982. $core.method({
  6983. selector: "tokenize:",
  6984. protocol: "split join",
  6985. fn: function (aString){
  6986. var self=this;
  6987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6988. return $core.withContext(function($ctx1) {
  6989. //>>excludeEnd("ctx");
  6990. return self.split(aString);
  6991. return self;
  6992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6993. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6994. //>>excludeEnd("ctx");
  6995. },
  6996. //>>excludeStart("ide", pragmas.excludeIdeData);
  6997. args: ["aString"],
  6998. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6999. referencedClasses: [],
  7000. //>>excludeEnd("ide");
  7001. messageSends: []
  7002. }),
  7003. $globals.String);
  7004. $core.addMethod(
  7005. $core.method({
  7006. selector: "trimBoth",
  7007. protocol: "regular expressions",
  7008. fn: function (){
  7009. var self=this;
  7010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7011. return $core.withContext(function($ctx1) {
  7012. //>>excludeEnd("ctx");
  7013. return self._trimBoth_("\x5cs");
  7014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7015. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  7016. //>>excludeEnd("ctx");
  7017. },
  7018. //>>excludeStart("ide", pragmas.excludeIdeData);
  7019. args: [],
  7020. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  7021. referencedClasses: [],
  7022. //>>excludeEnd("ide");
  7023. messageSends: ["trimBoth:"]
  7024. }),
  7025. $globals.String);
  7026. $core.addMethod(
  7027. $core.method({
  7028. selector: "trimBoth:",
  7029. protocol: "regular expressions",
  7030. fn: function (separators){
  7031. var self=this;
  7032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7033. return $core.withContext(function($ctx1) {
  7034. //>>excludeEnd("ctx");
  7035. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  7036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7037. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  7038. //>>excludeEnd("ctx");
  7039. },
  7040. //>>excludeStart("ide", pragmas.excludeIdeData);
  7041. args: ["separators"],
  7042. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  7043. referencedClasses: [],
  7044. //>>excludeEnd("ide");
  7045. messageSends: ["trimRight:", "trimLeft:"]
  7046. }),
  7047. $globals.String);
  7048. $core.addMethod(
  7049. $core.method({
  7050. selector: "trimLeft",
  7051. protocol: "regular expressions",
  7052. fn: function (){
  7053. var self=this;
  7054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7055. return $core.withContext(function($ctx1) {
  7056. //>>excludeEnd("ctx");
  7057. return self._trimLeft_("\x5cs");
  7058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7059. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  7060. //>>excludeEnd("ctx");
  7061. },
  7062. //>>excludeStart("ide", pragmas.excludeIdeData);
  7063. args: [],
  7064. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  7065. referencedClasses: [],
  7066. //>>excludeEnd("ide");
  7067. messageSends: ["trimLeft:"]
  7068. }),
  7069. $globals.String);
  7070. $core.addMethod(
  7071. $core.method({
  7072. selector: "trimLeft:",
  7073. protocol: "regular expressions",
  7074. fn: function (separators){
  7075. var self=this;
  7076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7077. return $core.withContext(function($ctx1) {
  7078. //>>excludeEnd("ctx");
  7079. var $2,$1;
  7080. $2=$recv("^[".__comma(separators)).__comma("]+");
  7081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7082. $ctx1.sendIdx[","]=1;
  7083. //>>excludeEnd("ctx");
  7084. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7085. return self._replaceRegexp_with_($1,"");
  7086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7087. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  7088. //>>excludeEnd("ctx");
  7089. },
  7090. //>>excludeStart("ide", pragmas.excludeIdeData);
  7091. args: ["separators"],
  7092. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  7093. referencedClasses: ["RegularExpression"],
  7094. //>>excludeEnd("ide");
  7095. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7096. }),
  7097. $globals.String);
  7098. $core.addMethod(
  7099. $core.method({
  7100. selector: "trimRight",
  7101. protocol: "regular expressions",
  7102. fn: function (){
  7103. var self=this;
  7104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7105. return $core.withContext(function($ctx1) {
  7106. //>>excludeEnd("ctx");
  7107. return self._trimRight_("\x5cs");
  7108. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7109. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  7110. //>>excludeEnd("ctx");
  7111. },
  7112. //>>excludeStart("ide", pragmas.excludeIdeData);
  7113. args: [],
  7114. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  7115. referencedClasses: [],
  7116. //>>excludeEnd("ide");
  7117. messageSends: ["trimRight:"]
  7118. }),
  7119. $globals.String);
  7120. $core.addMethod(
  7121. $core.method({
  7122. selector: "trimRight:",
  7123. protocol: "regular expressions",
  7124. fn: function (separators){
  7125. var self=this;
  7126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7127. return $core.withContext(function($ctx1) {
  7128. //>>excludeEnd("ctx");
  7129. var $2,$1;
  7130. $2=$recv("[".__comma(separators)).__comma("]+$");
  7131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7132. $ctx1.sendIdx[","]=1;
  7133. //>>excludeEnd("ctx");
  7134. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7135. return self._replaceRegexp_with_($1,"");
  7136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7137. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  7138. //>>excludeEnd("ctx");
  7139. },
  7140. //>>excludeStart("ide", pragmas.excludeIdeData);
  7141. args: ["separators"],
  7142. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  7143. referencedClasses: ["RegularExpression"],
  7144. //>>excludeEnd("ide");
  7145. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7146. }),
  7147. $globals.String);
  7148. $core.addMethod(
  7149. $core.method({
  7150. selector: "unescaped",
  7151. protocol: "converting",
  7152. fn: function (){
  7153. var self=this;
  7154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7155. return $core.withContext(function($ctx1) {
  7156. //>>excludeEnd("ctx");
  7157. return unescape(self);
  7158. return self;
  7159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7160. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  7161. //>>excludeEnd("ctx");
  7162. },
  7163. //>>excludeStart("ide", pragmas.excludeIdeData);
  7164. args: [],
  7165. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  7166. referencedClasses: [],
  7167. //>>excludeEnd("ide");
  7168. messageSends: []
  7169. }),
  7170. $globals.String);
  7171. $core.addMethod(
  7172. $core.method({
  7173. selector: "uriComponentDecoded",
  7174. protocol: "converting",
  7175. fn: function (){
  7176. var self=this;
  7177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7178. return $core.withContext(function($ctx1) {
  7179. //>>excludeEnd("ctx");
  7180. return decodeURIComponent(self);
  7181. return self;
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7184. //>>excludeEnd("ctx");
  7185. },
  7186. //>>excludeStart("ide", pragmas.excludeIdeData);
  7187. args: [],
  7188. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7189. referencedClasses: [],
  7190. //>>excludeEnd("ide");
  7191. messageSends: []
  7192. }),
  7193. $globals.String);
  7194. $core.addMethod(
  7195. $core.method({
  7196. selector: "uriComponentEncoded",
  7197. protocol: "converting",
  7198. fn: function (){
  7199. var self=this;
  7200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7201. return $core.withContext(function($ctx1) {
  7202. //>>excludeEnd("ctx");
  7203. return encodeURIComponent(self);
  7204. return self;
  7205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7206. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7207. //>>excludeEnd("ctx");
  7208. },
  7209. //>>excludeStart("ide", pragmas.excludeIdeData);
  7210. args: [],
  7211. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7212. referencedClasses: [],
  7213. //>>excludeEnd("ide");
  7214. messageSends: []
  7215. }),
  7216. $globals.String);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "uriDecoded",
  7220. protocol: "converting",
  7221. fn: function (){
  7222. var self=this;
  7223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7224. return $core.withContext(function($ctx1) {
  7225. //>>excludeEnd("ctx");
  7226. return decodeURI(self);
  7227. return self;
  7228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7229. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7230. //>>excludeEnd("ctx");
  7231. },
  7232. //>>excludeStart("ide", pragmas.excludeIdeData);
  7233. args: [],
  7234. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7235. referencedClasses: [],
  7236. //>>excludeEnd("ide");
  7237. messageSends: []
  7238. }),
  7239. $globals.String);
  7240. $core.addMethod(
  7241. $core.method({
  7242. selector: "uriEncoded",
  7243. protocol: "converting",
  7244. fn: function (){
  7245. var self=this;
  7246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7247. return $core.withContext(function($ctx1) {
  7248. //>>excludeEnd("ctx");
  7249. return encodeURI(self);
  7250. return self;
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7253. //>>excludeEnd("ctx");
  7254. },
  7255. //>>excludeStart("ide", pragmas.excludeIdeData);
  7256. args: [],
  7257. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7258. referencedClasses: [],
  7259. //>>excludeEnd("ide");
  7260. messageSends: []
  7261. }),
  7262. $globals.String);
  7263. $core.addMethod(
  7264. $core.method({
  7265. selector: "value:",
  7266. protocol: "evaluating",
  7267. fn: function (anObject){
  7268. var self=this;
  7269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7270. return $core.withContext(function($ctx1) {
  7271. //>>excludeEnd("ctx");
  7272. return $recv(anObject)._perform_(self);
  7273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7274. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7275. //>>excludeEnd("ctx");
  7276. },
  7277. //>>excludeStart("ide", pragmas.excludeIdeData);
  7278. args: ["anObject"],
  7279. source: "value: anObject \x0a\x09^ anObject perform: self",
  7280. referencedClasses: [],
  7281. //>>excludeEnd("ide");
  7282. messageSends: ["perform:"]
  7283. }),
  7284. $globals.String);
  7285. $core.addMethod(
  7286. $core.method({
  7287. selector: "cr",
  7288. protocol: "accessing",
  7289. fn: function (){
  7290. var self=this;
  7291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7292. return $core.withContext(function($ctx1) {
  7293. //>>excludeEnd("ctx");
  7294. return "\r";
  7295. return self;
  7296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7297. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  7298. //>>excludeEnd("ctx");
  7299. },
  7300. //>>excludeStart("ide", pragmas.excludeIdeData);
  7301. args: [],
  7302. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7303. referencedClasses: [],
  7304. //>>excludeEnd("ide");
  7305. messageSends: []
  7306. }),
  7307. $globals.String.klass);
  7308. $core.addMethod(
  7309. $core.method({
  7310. selector: "crlf",
  7311. protocol: "accessing",
  7312. fn: function (){
  7313. var self=this;
  7314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7315. return $core.withContext(function($ctx1) {
  7316. //>>excludeEnd("ctx");
  7317. return "\r\n";
  7318. return self;
  7319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7320. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  7321. //>>excludeEnd("ctx");
  7322. },
  7323. //>>excludeStart("ide", pragmas.excludeIdeData);
  7324. args: [],
  7325. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7326. referencedClasses: [],
  7327. //>>excludeEnd("ide");
  7328. messageSends: []
  7329. }),
  7330. $globals.String.klass);
  7331. $core.addMethod(
  7332. $core.method({
  7333. selector: "esc",
  7334. protocol: "accessing",
  7335. fn: function (){
  7336. var self=this;
  7337. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7338. return $core.withContext(function($ctx1) {
  7339. //>>excludeEnd("ctx");
  7340. return self._fromCharCode_((27));
  7341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7342. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  7343. //>>excludeEnd("ctx");
  7344. },
  7345. //>>excludeStart("ide", pragmas.excludeIdeData);
  7346. args: [],
  7347. source: "esc\x0a\x09^ self fromCharCode: 27",
  7348. referencedClasses: [],
  7349. //>>excludeEnd("ide");
  7350. messageSends: ["fromCharCode:"]
  7351. }),
  7352. $globals.String.klass);
  7353. $core.addMethod(
  7354. $core.method({
  7355. selector: "fromCharCode:",
  7356. protocol: "instance creation",
  7357. fn: function (anInteger){
  7358. var self=this;
  7359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7360. return $core.withContext(function($ctx1) {
  7361. //>>excludeEnd("ctx");
  7362. return String.fromCharCode(anInteger);
  7363. return self;
  7364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7365. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  7366. //>>excludeEnd("ctx");
  7367. },
  7368. //>>excludeStart("ide", pragmas.excludeIdeData);
  7369. args: ["anInteger"],
  7370. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7371. referencedClasses: [],
  7372. //>>excludeEnd("ide");
  7373. messageSends: []
  7374. }),
  7375. $globals.String.klass);
  7376. $core.addMethod(
  7377. $core.method({
  7378. selector: "fromString:",
  7379. protocol: "instance creation",
  7380. fn: function (aString){
  7381. var self=this;
  7382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7383. return $core.withContext(function($ctx1) {
  7384. //>>excludeEnd("ctx");
  7385. return String(aString);
  7386. return self;
  7387. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7388. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  7389. //>>excludeEnd("ctx");
  7390. },
  7391. //>>excludeStart("ide", pragmas.excludeIdeData);
  7392. args: ["aString"],
  7393. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7394. referencedClasses: [],
  7395. //>>excludeEnd("ide");
  7396. messageSends: []
  7397. }),
  7398. $globals.String.klass);
  7399. $core.addMethod(
  7400. $core.method({
  7401. selector: "lf",
  7402. protocol: "accessing",
  7403. fn: function (){
  7404. var self=this;
  7405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7406. return $core.withContext(function($ctx1) {
  7407. //>>excludeEnd("ctx");
  7408. return "\n";
  7409. return self;
  7410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7411. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  7412. //>>excludeEnd("ctx");
  7413. },
  7414. //>>excludeStart("ide", pragmas.excludeIdeData);
  7415. args: [],
  7416. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7417. referencedClasses: [],
  7418. //>>excludeEnd("ide");
  7419. messageSends: []
  7420. }),
  7421. $globals.String.klass);
  7422. $core.addMethod(
  7423. $core.method({
  7424. selector: "random",
  7425. protocol: "random",
  7426. fn: function (){
  7427. var self=this;
  7428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7429. return $core.withContext(function($ctx1) {
  7430. //>>excludeEnd("ctx");
  7431. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7432. return self;
  7433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7434. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  7435. //>>excludeEnd("ctx");
  7436. },
  7437. //>>excludeStart("ide", pragmas.excludeIdeData);
  7438. args: [],
  7439. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<inlineJS: 'return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);'>",
  7440. referencedClasses: [],
  7441. //>>excludeEnd("ide");
  7442. messageSends: []
  7443. }),
  7444. $globals.String.klass);
  7445. $core.addMethod(
  7446. $core.method({
  7447. selector: "randomNotIn:",
  7448. protocol: "random",
  7449. fn: function (aString){
  7450. var self=this;
  7451. var result;
  7452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7453. return $core.withContext(function($ctx1) {
  7454. //>>excludeEnd("ctx");
  7455. $recv((function(){
  7456. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7457. return $core.withContext(function($ctx2) {
  7458. //>>excludeEnd("ctx");
  7459. result=self._random();
  7460. result;
  7461. return $recv(aString)._includesSubString_(result);
  7462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7464. //>>excludeEnd("ctx");
  7465. }))._whileTrue();
  7466. return result;
  7467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7468. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  7469. //>>excludeEnd("ctx");
  7470. },
  7471. //>>excludeStart("ide", pragmas.excludeIdeData);
  7472. args: ["aString"],
  7473. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7474. referencedClasses: [],
  7475. //>>excludeEnd("ide");
  7476. messageSends: ["whileTrue", "random", "includesSubString:"]
  7477. }),
  7478. $globals.String.klass);
  7479. $core.addMethod(
  7480. $core.method({
  7481. selector: "space",
  7482. protocol: "accessing",
  7483. fn: function (){
  7484. var self=this;
  7485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7486. return $core.withContext(function($ctx1) {
  7487. //>>excludeEnd("ctx");
  7488. return " ";
  7489. return self;
  7490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7491. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  7492. //>>excludeEnd("ctx");
  7493. },
  7494. //>>excludeStart("ide", pragmas.excludeIdeData);
  7495. args: [],
  7496. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7497. referencedClasses: [],
  7498. //>>excludeEnd("ide");
  7499. messageSends: []
  7500. }),
  7501. $globals.String.klass);
  7502. $core.addMethod(
  7503. $core.method({
  7504. selector: "streamClass",
  7505. protocol: "accessing",
  7506. fn: function (){
  7507. var self=this;
  7508. return $globals.StringStream;
  7509. },
  7510. //>>excludeStart("ide", pragmas.excludeIdeData);
  7511. args: [],
  7512. source: "streamClass\x0a\x09\x09^ StringStream",
  7513. referencedClasses: ["StringStream"],
  7514. //>>excludeEnd("ide");
  7515. messageSends: []
  7516. }),
  7517. $globals.String.klass);
  7518. $core.addMethod(
  7519. $core.method({
  7520. selector: "tab",
  7521. protocol: "accessing",
  7522. fn: function (){
  7523. var self=this;
  7524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7525. return $core.withContext(function($ctx1) {
  7526. //>>excludeEnd("ctx");
  7527. return "\t";
  7528. return self;
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  7531. //>>excludeEnd("ctx");
  7532. },
  7533. //>>excludeStart("ide", pragmas.excludeIdeData);
  7534. args: [],
  7535. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7536. referencedClasses: [],
  7537. //>>excludeEnd("ide");
  7538. messageSends: []
  7539. }),
  7540. $globals.String.klass);
  7541. $core.addMethod(
  7542. $core.method({
  7543. selector: "value:",
  7544. protocol: "instance creation",
  7545. fn: function (aUTFCharCode){
  7546. var self=this;
  7547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7548. return $core.withContext(function($ctx1) {
  7549. //>>excludeEnd("ctx");
  7550. return String.fromCharCode(aUTFCharCode);;
  7551. return self;
  7552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7553. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  7554. //>>excludeEnd("ctx");
  7555. },
  7556. //>>excludeStart("ide", pragmas.excludeIdeData);
  7557. args: ["aUTFCharCode"],
  7558. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7559. referencedClasses: [],
  7560. //>>excludeEnd("ide");
  7561. messageSends: []
  7562. }),
  7563. $globals.String.klass);
  7564. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  7565. //>>excludeStart("ide", pragmas.excludeIdeData);
  7566. $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`.";
  7567. //>>excludeEnd("ide");
  7568. $core.addMethod(
  7569. $core.method({
  7570. selector: "=",
  7571. protocol: "comparing",
  7572. fn: function (aCollection){
  7573. var self=this;
  7574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7575. return $core.withContext(function($ctx1) {
  7576. //>>excludeEnd("ctx");
  7577. var $2,$1,$4,$3,$5;
  7578. var $early={};
  7579. try {
  7580. $2=self._class();
  7581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7582. $ctx1.sendIdx["class"]=1;
  7583. //>>excludeEnd("ctx");
  7584. $1=$recv($2).__eq($recv(aCollection)._class());
  7585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7586. $ctx1.sendIdx["="]=1;
  7587. //>>excludeEnd("ctx");
  7588. if(!$core.assert($1)){
  7589. return false;
  7590. }
  7591. $4=self._size();
  7592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7593. $ctx1.sendIdx["size"]=1;
  7594. //>>excludeEnd("ctx");
  7595. $3=$recv($4).__eq($recv(aCollection)._size());
  7596. if(!$core.assert($3)){
  7597. return false;
  7598. }
  7599. self._do_((function(each){
  7600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7601. return $core.withContext(function($ctx2) {
  7602. //>>excludeEnd("ctx");
  7603. $5=$recv(aCollection)._includes_(each);
  7604. if(!$core.assert($5)){
  7605. throw $early=[false];
  7606. }
  7607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7608. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7609. //>>excludeEnd("ctx");
  7610. }));
  7611. return true;
  7612. }
  7613. catch(e) {if(e===$early)return e[0]; throw e}
  7614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7615. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7616. //>>excludeEnd("ctx");
  7617. },
  7618. //>>excludeStart("ide", pragmas.excludeIdeData);
  7619. args: ["aCollection"],
  7620. 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",
  7621. referencedClasses: [],
  7622. //>>excludeEnd("ide");
  7623. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7624. }),
  7625. $globals.Set);
  7626. $core.addMethod(
  7627. $core.method({
  7628. selector: "add:",
  7629. protocol: "adding/removing",
  7630. fn: function (anObject){
  7631. var self=this;
  7632. var bucket;
  7633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7634. return $core.withContext(function($ctx1) {
  7635. //>>excludeEnd("ctx");
  7636. var $1,$receiver;
  7637. bucket=self._bucketsOfElement_(anObject);
  7638. $1=$recv(bucket)._second();
  7639. if(($receiver = $1) == null || $receiver.isNil){
  7640. var object,slowBucket;
  7641. object=$recv(bucket)._first();
  7642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7643. $ctx1.sendIdx["first"]=1;
  7644. //>>excludeEnd("ctx");
  7645. object;
  7646. slowBucket=$recv(bucket)._third();
  7647. slowBucket;
  7648. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7650. return $core.withContext(function($ctx2) {
  7651. //>>excludeEnd("ctx");
  7652. $recv(slowBucket)._add_(object);
  7653. self["@size"]=$recv(self["@size"]).__plus((1));
  7654. return self["@size"];
  7655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7657. //>>excludeEnd("ctx");
  7658. }));
  7659. return object;
  7660. } else {
  7661. var primitiveBucket;
  7662. primitiveBucket=$receiver;
  7663. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  7664. }
  7665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7666. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7667. //>>excludeEnd("ctx");
  7668. },
  7669. //>>excludeStart("ide", pragmas.excludeIdeData);
  7670. args: ["anObject"],
  7671. 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 ]",
  7672. referencedClasses: [],
  7673. //>>excludeEnd("ide");
  7674. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7675. }),
  7676. $globals.Set);
  7677. $core.addMethod(
  7678. $core.method({
  7679. selector: "add:in:",
  7680. protocol: "private",
  7681. fn: function (anObject,anotherObject){
  7682. var self=this;
  7683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7684. return $core.withContext(function($ctx1) {
  7685. //>>excludeEnd("ctx");
  7686. if (anObject in anotherObject.store) { return false; }
  7687. self['@size']++;
  7688. anotherObject.store[anObject] = true;
  7689. return anObject;
  7690. ;
  7691. return self;
  7692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7693. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7694. //>>excludeEnd("ctx");
  7695. },
  7696. //>>excludeStart("ide", pragmas.excludeIdeData);
  7697. args: ["anObject", "anotherObject"],
  7698. source: "add: anObject in: anotherObject\x0a\x09<inlineJS: '\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self[''@size'']++;\x0a\x09\x09anotherObject.store[anObject] = true;\x0a\x09\x09return anObject;\x0a\x09'>",
  7699. referencedClasses: [],
  7700. //>>excludeEnd("ide");
  7701. messageSends: []
  7702. }),
  7703. $globals.Set);
  7704. $core.addMethod(
  7705. $core.method({
  7706. selector: "bucketsOfElement:",
  7707. protocol: "private",
  7708. fn: function (anObject){
  7709. var self=this;
  7710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7711. return $core.withContext(function($ctx1) {
  7712. //>>excludeEnd("ctx");
  7713. // include nil to well-known objects under "boolean" fastBucket
  7714. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  7715. var prim = anObject.valueOf();
  7716. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  7717. var bucket = null;
  7718. self['@slowBucketStores'].some(function (store) {
  7719. return bucket = store._bucketOfElement_(anObject);
  7720. });
  7721. return [ anObject, null, bucket || self['@defaultBucket'] ];
  7722. }
  7723. return [ prim, self['@fastBuckets'][typeof prim] ];
  7724. ;
  7725. return self;
  7726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7727. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7728. //>>excludeEnd("ctx");
  7729. },
  7730. //>>excludeStart("ide", pragmas.excludeIdeData);
  7731. args: ["anObject"],
  7732. 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.isNil) 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\x09self[''@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'>",
  7733. referencedClasses: [],
  7734. //>>excludeEnd("ide");
  7735. messageSends: []
  7736. }),
  7737. $globals.Set);
  7738. $core.addMethod(
  7739. $core.method({
  7740. selector: "classNameOf:",
  7741. protocol: "private",
  7742. fn: function (anObject){
  7743. var self=this;
  7744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7745. return $core.withContext(function($ctx1) {
  7746. //>>excludeEnd("ctx");
  7747. return anObject.klass != null && anObject.klass.className;
  7748. return self;
  7749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7750. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7751. //>>excludeEnd("ctx");
  7752. },
  7753. //>>excludeStart("ide", pragmas.excludeIdeData);
  7754. args: ["anObject"],
  7755. 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.klass != null && anObject.klass.className'>",
  7756. referencedClasses: [],
  7757. //>>excludeEnd("ide");
  7758. messageSends: []
  7759. }),
  7760. $globals.Set);
  7761. $core.addMethod(
  7762. $core.method({
  7763. selector: "collect:",
  7764. protocol: "enumerating",
  7765. fn: function (aBlock){
  7766. var self=this;
  7767. var collection;
  7768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7769. return $core.withContext(function($ctx1) {
  7770. //>>excludeEnd("ctx");
  7771. collection=$recv(self._class())._new();
  7772. self._do_((function(each){
  7773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7774. return $core.withContext(function($ctx2) {
  7775. //>>excludeEnd("ctx");
  7776. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7779. //>>excludeEnd("ctx");
  7780. }));
  7781. return collection;
  7782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7783. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7784. //>>excludeEnd("ctx");
  7785. },
  7786. //>>excludeStart("ide", pragmas.excludeIdeData);
  7787. args: ["aBlock"],
  7788. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7789. referencedClasses: [],
  7790. //>>excludeEnd("ide");
  7791. messageSends: ["new", "class", "do:", "add:", "value:"]
  7792. }),
  7793. $globals.Set);
  7794. $core.addMethod(
  7795. $core.method({
  7796. selector: "detect:ifNone:",
  7797. protocol: "enumerating",
  7798. fn: function (aBlock,anotherBlock){
  7799. var self=this;
  7800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7801. return $core.withContext(function($ctx1) {
  7802. //>>excludeEnd("ctx");
  7803. var $1;
  7804. var $early={};
  7805. try {
  7806. self._do_((function(each){
  7807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7808. return $core.withContext(function($ctx2) {
  7809. //>>excludeEnd("ctx");
  7810. $1=$recv(aBlock)._value_(each);
  7811. if($core.assert($1)){
  7812. throw $early=[each];
  7813. }
  7814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7815. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7816. //>>excludeEnd("ctx");
  7817. }));
  7818. return $recv(anotherBlock)._value();
  7819. }
  7820. catch(e) {if(e===$early)return e[0]; throw e}
  7821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7822. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7823. //>>excludeEnd("ctx");
  7824. },
  7825. //>>excludeStart("ide", pragmas.excludeIdeData);
  7826. args: ["aBlock", "anotherBlock"],
  7827. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7828. referencedClasses: [],
  7829. //>>excludeEnd("ide");
  7830. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7831. }),
  7832. $globals.Set);
  7833. $core.addMethod(
  7834. $core.method({
  7835. selector: "do:",
  7836. protocol: "enumerating",
  7837. fn: function (aBlock){
  7838. var self=this;
  7839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7840. return $core.withContext(function($ctx1) {
  7841. //>>excludeEnd("ctx");
  7842. var el, keys, i;
  7843. el = self['@fastBuckets'];
  7844. keys = Object.keys(el);
  7845. for (i = 0; i < keys.length; ++i) {
  7846. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7847. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7848. else { store._do_(aBlock); }
  7849. }
  7850. el = self['@slowBucketStores'];
  7851. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7852. self['@defaultBucket']._do_(aBlock);
  7853. ;
  7854. return self;
  7855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7856. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7857. //>>excludeEnd("ctx");
  7858. },
  7859. //>>excludeStart("ide", pragmas.excludeIdeData);
  7860. args: ["aBlock"],
  7861. 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\x09self[''@defaultBucket'']._do_(aBlock);\x0a\x09'>",
  7862. referencedClasses: [],
  7863. //>>excludeEnd("ide");
  7864. messageSends: []
  7865. }),
  7866. $globals.Set);
  7867. $core.addMethod(
  7868. $core.method({
  7869. selector: "includes:",
  7870. protocol: "testing",
  7871. fn: function (anObject){
  7872. var self=this;
  7873. var bucket;
  7874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7875. return $core.withContext(function($ctx1) {
  7876. //>>excludeEnd("ctx");
  7877. var $1,$2,$3,$receiver;
  7878. bucket=self._bucketsOfElement_(anObject);
  7879. $1=$recv(bucket)._second();
  7880. if(($receiver = $1) == null || $receiver.isNil){
  7881. $2=$recv(bucket)._third();
  7882. $3=$recv(bucket)._first();
  7883. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7884. $ctx1.sendIdx["first"]=1;
  7885. //>>excludeEnd("ctx");
  7886. return $recv($2)._includes_($3);
  7887. } else {
  7888. var primitiveBucket;
  7889. primitiveBucket=$receiver;
  7890. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7891. }
  7892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7893. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7894. //>>excludeEnd("ctx");
  7895. },
  7896. //>>excludeStart("ide", pragmas.excludeIdeData);
  7897. args: ["anObject"],
  7898. 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 ]",
  7899. referencedClasses: [],
  7900. //>>excludeEnd("ide");
  7901. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7902. }),
  7903. $globals.Set);
  7904. $core.addMethod(
  7905. $core.method({
  7906. selector: "includes:in:",
  7907. protocol: "private",
  7908. fn: function (anObject,anotherObject){
  7909. var self=this;
  7910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7911. return $core.withContext(function($ctx1) {
  7912. //>>excludeEnd("ctx");
  7913. return anObject in anotherObject.store;
  7914. return self;
  7915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7916. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7917. //>>excludeEnd("ctx");
  7918. },
  7919. //>>excludeStart("ide", pragmas.excludeIdeData);
  7920. args: ["anObject", "anotherObject"],
  7921. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7922. referencedClasses: [],
  7923. //>>excludeEnd("ide");
  7924. messageSends: []
  7925. }),
  7926. $globals.Set);
  7927. $core.addMethod(
  7928. $core.method({
  7929. selector: "initialize",
  7930. protocol: "initialization",
  7931. fn: function (){
  7932. var self=this;
  7933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7934. return $core.withContext(function($ctx1) {
  7935. //>>excludeEnd("ctx");
  7936. (
  7937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7938. $ctx1.supercall = true,
  7939. //>>excludeEnd("ctx");
  7940. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  7941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7942. $ctx1.supercall = false;
  7943. //>>excludeEnd("ctx");;
  7944. self["@defaultBucket"]=[];
  7945. self._initializeSlowBucketStores();
  7946. self._removeAll();
  7947. return self;
  7948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7949. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7950. //>>excludeEnd("ctx");
  7951. },
  7952. //>>excludeStart("ide", pragmas.excludeIdeData);
  7953. args: [],
  7954. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7955. referencedClasses: [],
  7956. //>>excludeEnd("ide");
  7957. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7958. }),
  7959. $globals.Set);
  7960. $core.addMethod(
  7961. $core.method({
  7962. selector: "initializeSlowBucketStores",
  7963. protocol: "initialization",
  7964. fn: function (){
  7965. var self=this;
  7966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7967. return $core.withContext(function($ctx1) {
  7968. //>>excludeEnd("ctx");
  7969. var $1;
  7970. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7972. return $core.withContext(function($ctx2) {
  7973. //>>excludeEnd("ctx");
  7974. return self._classNameOf_(x);
  7975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7976. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7977. //>>excludeEnd("ctx");
  7978. }));
  7979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7980. $ctx1.sendIdx["hashBlock:"]=1;
  7981. //>>excludeEnd("ctx");
  7982. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7984. return $core.withContext(function($ctx2) {
  7985. //>>excludeEnd("ctx");
  7986. return self._jsConstructorNameOf_(x);
  7987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7988. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7989. //>>excludeEnd("ctx");
  7990. }))];
  7991. return self;
  7992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7993. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7994. //>>excludeEnd("ctx");
  7995. },
  7996. //>>excludeStart("ide", pragmas.excludeIdeData);
  7997. args: [],
  7998. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7999. referencedClasses: ["ArrayBucketStore"],
  8000. //>>excludeEnd("ide");
  8001. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  8002. }),
  8003. $globals.Set);
  8004. $core.addMethod(
  8005. $core.method({
  8006. selector: "jsConstructorNameOf:",
  8007. protocol: "private",
  8008. fn: function (anObject){
  8009. var self=this;
  8010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8011. return $core.withContext(function($ctx1) {
  8012. //>>excludeEnd("ctx");
  8013. return anObject.constructor && anObject.constructor.name;
  8014. return self;
  8015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8016. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  8017. //>>excludeEnd("ctx");
  8018. },
  8019. //>>excludeStart("ide", pragmas.excludeIdeData);
  8020. args: ["anObject"],
  8021. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  8022. referencedClasses: [],
  8023. //>>excludeEnd("ide");
  8024. messageSends: []
  8025. }),
  8026. $globals.Set);
  8027. $core.addMethod(
  8028. $core.method({
  8029. selector: "printOn:",
  8030. protocol: "printing",
  8031. fn: function (aStream){
  8032. var self=this;
  8033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8034. return $core.withContext(function($ctx1) {
  8035. //>>excludeEnd("ctx");
  8036. (
  8037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8038. $ctx1.supercall = true,
  8039. //>>excludeEnd("ctx");
  8040. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  8041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8042. $ctx1.supercall = false;
  8043. //>>excludeEnd("ctx");;
  8044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8045. $ctx1.sendIdx["printOn:"]=1;
  8046. //>>excludeEnd("ctx");
  8047. $recv(aStream)._nextPutAll_(" (");
  8048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8049. $ctx1.sendIdx["nextPutAll:"]=1;
  8050. //>>excludeEnd("ctx");
  8051. self._do_separatedBy_((function(each){
  8052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8053. return $core.withContext(function($ctx2) {
  8054. //>>excludeEnd("ctx");
  8055. return $recv(each)._printOn_(aStream);
  8056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8057. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8058. //>>excludeEnd("ctx");
  8059. }),(function(){
  8060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8061. return $core.withContext(function($ctx2) {
  8062. //>>excludeEnd("ctx");
  8063. return $recv(aStream)._nextPutAll_(" ");
  8064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8065. $ctx2.sendIdx["nextPutAll:"]=2;
  8066. //>>excludeEnd("ctx");
  8067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8069. //>>excludeEnd("ctx");
  8070. }));
  8071. $recv(aStream)._nextPutAll_(")");
  8072. return self;
  8073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8074. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  8075. //>>excludeEnd("ctx");
  8076. },
  8077. //>>excludeStart("ide", pragmas.excludeIdeData);
  8078. args: ["aStream"],
  8079. 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: ')'",
  8080. referencedClasses: [],
  8081. //>>excludeEnd("ide");
  8082. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  8083. }),
  8084. $globals.Set);
  8085. $core.addMethod(
  8086. $core.method({
  8087. selector: "remove:ifAbsent:",
  8088. protocol: "adding/removing",
  8089. fn: function (anObject,aBlock){
  8090. var self=this;
  8091. var bucket;
  8092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8093. return $core.withContext(function($ctx1) {
  8094. //>>excludeEnd("ctx");
  8095. var $1,$2,$3,$receiver;
  8096. var $early={};
  8097. try {
  8098. bucket=self._bucketsOfElement_(anObject);
  8099. $1=$recv(bucket)._second();
  8100. if(($receiver = $1) == null || $receiver.isNil){
  8101. $2=$recv(bucket)._third();
  8102. $3=$recv(bucket)._first();
  8103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8104. $ctx1.sendIdx["first"]=1;
  8105. //>>excludeEnd("ctx");
  8106. $recv($2)._remove_ifAbsent_($3,(function(){
  8107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8108. return $core.withContext(function($ctx2) {
  8109. //>>excludeEnd("ctx");
  8110. throw $early=[$recv(aBlock)._value()];
  8111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8113. //>>excludeEnd("ctx");
  8114. }));
  8115. self["@size"]=$recv(self["@size"]).__minus((1));
  8116. return self["@size"];
  8117. } else {
  8118. var primitiveBucket;
  8119. primitiveBucket=$receiver;
  8120. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  8121. }
  8122. }
  8123. catch(e) {if(e===$early)return e[0]; throw e}
  8124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8125. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  8126. //>>excludeEnd("ctx");
  8127. },
  8128. //>>excludeStart("ide", pragmas.excludeIdeData);
  8129. args: ["anObject", "aBlock"],
  8130. source: "remove: anObject ifAbsent: aBlock\x0a\x09| bucket |\x0a\x09bucket := self bucketsOfElement: anObject.\x0a\x09^ bucket second\x0a\x09\x09ifNil: [ bucket third remove: bucket first ifAbsent: [ ^aBlock value ]. size := size - 1 ]\x0a\x09\x09ifNotNil: [ :primitiveBucket | self remove: bucket first in: primitiveBucket ]",
  8131. referencedClasses: [],
  8132. //>>excludeEnd("ide");
  8133. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  8134. }),
  8135. $globals.Set);
  8136. $core.addMethod(
  8137. $core.method({
  8138. selector: "remove:in:",
  8139. protocol: "private",
  8140. fn: function (anObject,anotherObject){
  8141. var self=this;
  8142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8143. return $core.withContext(function($ctx1) {
  8144. //>>excludeEnd("ctx");
  8145. if (delete anotherObject.store[anObject]) self['@size']--;
  8146. return self;
  8147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8148. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  8149. //>>excludeEnd("ctx");
  8150. },
  8151. //>>excludeStart("ide", pragmas.excludeIdeData);
  8152. args: ["anObject", "anotherObject"],
  8153. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) self[''@size'']--'>",
  8154. referencedClasses: [],
  8155. //>>excludeEnd("ide");
  8156. messageSends: []
  8157. }),
  8158. $globals.Set);
  8159. $core.addMethod(
  8160. $core.method({
  8161. selector: "removeAll",
  8162. protocol: "adding/removing",
  8163. fn: function (){
  8164. var self=this;
  8165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8166. return $core.withContext(function($ctx1) {
  8167. //>>excludeEnd("ctx");
  8168. self['@fastBuckets'] = {
  8169. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  8170. "number": { store: Object.create(null), fn: Number },
  8171. "string": { store: Object.create(null) }
  8172. };
  8173. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  8174. self['@defaultBucket']._removeAll();
  8175. self['@size'] = 0;
  8176. ;
  8177. return self;
  8178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8179. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8180. //>>excludeEnd("ctx");
  8181. },
  8182. //>>excludeStart("ide", pragmas.excludeIdeData);
  8183. args: [],
  8184. source: "removeAll\x0a\x09<inlineJS: '\x0a\x09\x09self[''@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\x09self[''@slowBucketStores''].forEach(function (x) { x._removeAll(); });\x0a\x09\x09self[''@defaultBucket'']._removeAll();\x0a\x09\x09self[''@size''] = 0;\x0a\x09'>",
  8185. referencedClasses: [],
  8186. //>>excludeEnd("ide");
  8187. messageSends: []
  8188. }),
  8189. $globals.Set);
  8190. $core.addMethod(
  8191. $core.method({
  8192. selector: "select:",
  8193. protocol: "enumerating",
  8194. fn: function (aBlock){
  8195. var self=this;
  8196. var collection;
  8197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8198. return $core.withContext(function($ctx1) {
  8199. //>>excludeEnd("ctx");
  8200. var $1;
  8201. collection=$recv(self._class())._new();
  8202. self._do_((function(each){
  8203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8204. return $core.withContext(function($ctx2) {
  8205. //>>excludeEnd("ctx");
  8206. $1=$recv(aBlock)._value_(each);
  8207. if($core.assert($1)){
  8208. return $recv(collection)._add_(each);
  8209. }
  8210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8211. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8212. //>>excludeEnd("ctx");
  8213. }));
  8214. return collection;
  8215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8216. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8217. //>>excludeEnd("ctx");
  8218. },
  8219. //>>excludeStart("ide", pragmas.excludeIdeData);
  8220. args: ["aBlock"],
  8221. 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",
  8222. referencedClasses: [],
  8223. //>>excludeEnd("ide");
  8224. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8225. }),
  8226. $globals.Set);
  8227. $core.addMethod(
  8228. $core.method({
  8229. selector: "size",
  8230. protocol: "accessing",
  8231. fn: function (){
  8232. var self=this;
  8233. return self["@size"];
  8234. },
  8235. //>>excludeStart("ide", pragmas.excludeIdeData);
  8236. args: [],
  8237. source: "size\x0a\x09^ size",
  8238. referencedClasses: [],
  8239. //>>excludeEnd("ide");
  8240. messageSends: []
  8241. }),
  8242. $globals.Set);
  8243. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  8244. //>>excludeStart("ide", pragmas.excludeIdeData);
  8245. $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.";
  8246. //>>excludeEnd("ide");
  8247. $core.addMethod(
  8248. $core.method({
  8249. selector: "<<",
  8250. protocol: "writing",
  8251. fn: function (anObject){
  8252. var self=this;
  8253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8254. return $core.withContext(function($ctx1) {
  8255. //>>excludeEnd("ctx");
  8256. self._write_(anObject);
  8257. return self;
  8258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8259. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8260. //>>excludeEnd("ctx");
  8261. },
  8262. //>>excludeStart("ide", pragmas.excludeIdeData);
  8263. args: ["anObject"],
  8264. source: "<< anObject\x0a\x09self write: anObject",
  8265. referencedClasses: [],
  8266. //>>excludeEnd("ide");
  8267. messageSends: ["write:"]
  8268. }),
  8269. $globals.ProtoStream);
  8270. $core.addMethod(
  8271. $core.method({
  8272. selector: "atEnd",
  8273. protocol: "testing",
  8274. fn: function (){
  8275. var self=this;
  8276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8277. return $core.withContext(function($ctx1) {
  8278. //>>excludeEnd("ctx");
  8279. self._subclassResponsibility();
  8280. return self;
  8281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8282. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8283. //>>excludeEnd("ctx");
  8284. },
  8285. //>>excludeStart("ide", pragmas.excludeIdeData);
  8286. args: [],
  8287. source: "atEnd\x0a\x09self subclassResponsibility",
  8288. referencedClasses: [],
  8289. //>>excludeEnd("ide");
  8290. messageSends: ["subclassResponsibility"]
  8291. }),
  8292. $globals.ProtoStream);
  8293. $core.addMethod(
  8294. $core.method({
  8295. selector: "atStart",
  8296. protocol: "testing",
  8297. fn: function (){
  8298. var self=this;
  8299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8300. return $core.withContext(function($ctx1) {
  8301. //>>excludeEnd("ctx");
  8302. self._subclassResponsibility();
  8303. return self;
  8304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8305. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8306. //>>excludeEnd("ctx");
  8307. },
  8308. //>>excludeStart("ide", pragmas.excludeIdeData);
  8309. args: [],
  8310. source: "atStart\x0a\x09self subclassResponsibility",
  8311. referencedClasses: [],
  8312. //>>excludeEnd("ide");
  8313. messageSends: ["subclassResponsibility"]
  8314. }),
  8315. $globals.ProtoStream);
  8316. $core.addMethod(
  8317. $core.method({
  8318. selector: "contents",
  8319. protocol: "accessing",
  8320. fn: function (){
  8321. var self=this;
  8322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8323. return $core.withContext(function($ctx1) {
  8324. //>>excludeEnd("ctx");
  8325. self._subclassResponsibility();
  8326. return self;
  8327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8328. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8329. //>>excludeEnd("ctx");
  8330. },
  8331. //>>excludeStart("ide", pragmas.excludeIdeData);
  8332. args: [],
  8333. source: "contents\x0a\x09self subclassResponsibility",
  8334. referencedClasses: [],
  8335. //>>excludeEnd("ide");
  8336. messageSends: ["subclassResponsibility"]
  8337. }),
  8338. $globals.ProtoStream);
  8339. $core.addMethod(
  8340. $core.method({
  8341. selector: "do:",
  8342. protocol: "enumerating",
  8343. fn: function (aBlock){
  8344. var self=this;
  8345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8346. return $core.withContext(function($ctx1) {
  8347. //>>excludeEnd("ctx");
  8348. $recv((function(){
  8349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8350. return $core.withContext(function($ctx2) {
  8351. //>>excludeEnd("ctx");
  8352. return self._atEnd();
  8353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8355. //>>excludeEnd("ctx");
  8356. }))._whileFalse_((function(){
  8357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8358. return $core.withContext(function($ctx2) {
  8359. //>>excludeEnd("ctx");
  8360. return $recv(aBlock)._value_(self._next());
  8361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8362. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8363. //>>excludeEnd("ctx");
  8364. }));
  8365. return self;
  8366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8367. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8368. //>>excludeEnd("ctx");
  8369. },
  8370. //>>excludeStart("ide", pragmas.excludeIdeData);
  8371. args: ["aBlock"],
  8372. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8373. referencedClasses: [],
  8374. //>>excludeEnd("ide");
  8375. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8376. }),
  8377. $globals.ProtoStream);
  8378. $core.addMethod(
  8379. $core.method({
  8380. selector: "isEmpty",
  8381. protocol: "testing",
  8382. fn: function (){
  8383. var self=this;
  8384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8385. return $core.withContext(function($ctx1) {
  8386. //>>excludeEnd("ctx");
  8387. return $recv(self._atStart())._and_((function(){
  8388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8389. return $core.withContext(function($ctx2) {
  8390. //>>excludeEnd("ctx");
  8391. return self._atEnd();
  8392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8394. //>>excludeEnd("ctx");
  8395. }));
  8396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8397. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8398. //>>excludeEnd("ctx");
  8399. },
  8400. //>>excludeStart("ide", pragmas.excludeIdeData);
  8401. args: [],
  8402. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8403. referencedClasses: [],
  8404. //>>excludeEnd("ide");
  8405. messageSends: ["and:", "atStart", "atEnd"]
  8406. }),
  8407. $globals.ProtoStream);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "next",
  8411. protocol: "reading",
  8412. fn: function (){
  8413. var self=this;
  8414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8415. return $core.withContext(function($ctx1) {
  8416. //>>excludeEnd("ctx");
  8417. var $1;
  8418. $1=self._atEnd();
  8419. if($core.assert($1)){
  8420. return nil;
  8421. } else {
  8422. return self._subclassResponsibility();
  8423. }
  8424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8425. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8426. //>>excludeEnd("ctx");
  8427. },
  8428. //>>excludeStart("ide", pragmas.excludeIdeData);
  8429. args: [],
  8430. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8431. referencedClasses: [],
  8432. //>>excludeEnd("ide");
  8433. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8434. }),
  8435. $globals.ProtoStream);
  8436. $core.addMethod(
  8437. $core.method({
  8438. selector: "nextPut:",
  8439. protocol: "writing",
  8440. fn: function (anObject){
  8441. var self=this;
  8442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8443. return $core.withContext(function($ctx1) {
  8444. //>>excludeEnd("ctx");
  8445. self._subclassResponsibility();
  8446. return self;
  8447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8448. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8449. //>>excludeEnd("ctx");
  8450. },
  8451. //>>excludeStart("ide", pragmas.excludeIdeData);
  8452. args: ["anObject"],
  8453. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8454. referencedClasses: [],
  8455. //>>excludeEnd("ide");
  8456. messageSends: ["subclassResponsibility"]
  8457. }),
  8458. $globals.ProtoStream);
  8459. $core.addMethod(
  8460. $core.method({
  8461. selector: "nextPutAll:",
  8462. protocol: "writing",
  8463. fn: function (aCollection){
  8464. var self=this;
  8465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8466. return $core.withContext(function($ctx1) {
  8467. //>>excludeEnd("ctx");
  8468. $recv(aCollection)._do_((function(each){
  8469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8470. return $core.withContext(function($ctx2) {
  8471. //>>excludeEnd("ctx");
  8472. return self._nextPut_(each);
  8473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8475. //>>excludeEnd("ctx");
  8476. }));
  8477. return self;
  8478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8479. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8480. //>>excludeEnd("ctx");
  8481. },
  8482. //>>excludeStart("ide", pragmas.excludeIdeData);
  8483. args: ["aCollection"],
  8484. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8485. referencedClasses: [],
  8486. //>>excludeEnd("ide");
  8487. messageSends: ["do:", "nextPut:"]
  8488. }),
  8489. $globals.ProtoStream);
  8490. $core.addMethod(
  8491. $core.method({
  8492. selector: "nextPutJSObject:",
  8493. protocol: "writing",
  8494. fn: function (aJSObject){
  8495. var self=this;
  8496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8497. return $core.withContext(function($ctx1) {
  8498. //>>excludeEnd("ctx");
  8499. self._nextPut_(aJSObject);
  8500. return self;
  8501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8502. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  8503. //>>excludeEnd("ctx");
  8504. },
  8505. //>>excludeStart("ide", pragmas.excludeIdeData);
  8506. args: ["aJSObject"],
  8507. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  8508. referencedClasses: [],
  8509. //>>excludeEnd("ide");
  8510. messageSends: ["nextPut:"]
  8511. }),
  8512. $globals.ProtoStream);
  8513. $core.addMethod(
  8514. $core.method({
  8515. selector: "nextPutString:",
  8516. protocol: "writing",
  8517. fn: function (aString){
  8518. var self=this;
  8519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8520. return $core.withContext(function($ctx1) {
  8521. //>>excludeEnd("ctx");
  8522. self._nextPut_(aString);
  8523. return self;
  8524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8525. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8526. //>>excludeEnd("ctx");
  8527. },
  8528. //>>excludeStart("ide", pragmas.excludeIdeData);
  8529. args: ["aString"],
  8530. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8531. referencedClasses: [],
  8532. //>>excludeEnd("ide");
  8533. messageSends: ["nextPut:"]
  8534. }),
  8535. $globals.ProtoStream);
  8536. $core.addMethod(
  8537. $core.method({
  8538. selector: "peek",
  8539. protocol: "reading",
  8540. fn: function (){
  8541. var self=this;
  8542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8543. return $core.withContext(function($ctx1) {
  8544. //>>excludeEnd("ctx");
  8545. var $1;
  8546. $1=self._atEnd();
  8547. if($core.assert($1)){
  8548. return nil;
  8549. } else {
  8550. return self._subclassResponsibility();
  8551. }
  8552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8553. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8554. //>>excludeEnd("ctx");
  8555. },
  8556. //>>excludeStart("ide", pragmas.excludeIdeData);
  8557. args: [],
  8558. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8559. referencedClasses: [],
  8560. //>>excludeEnd("ide");
  8561. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8562. }),
  8563. $globals.ProtoStream);
  8564. $core.addMethod(
  8565. $core.method({
  8566. selector: "reset",
  8567. protocol: "actions",
  8568. fn: function (){
  8569. var self=this;
  8570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8571. return $core.withContext(function($ctx1) {
  8572. //>>excludeEnd("ctx");
  8573. self._subclassResponsibility();
  8574. return self;
  8575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8576. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8577. //>>excludeEnd("ctx");
  8578. },
  8579. //>>excludeStart("ide", pragmas.excludeIdeData);
  8580. args: [],
  8581. source: "reset\x0a\x09self subclassResponsibility",
  8582. referencedClasses: [],
  8583. //>>excludeEnd("ide");
  8584. messageSends: ["subclassResponsibility"]
  8585. }),
  8586. $globals.ProtoStream);
  8587. $core.addMethod(
  8588. $core.method({
  8589. selector: "resetContents",
  8590. protocol: "actions",
  8591. fn: function (){
  8592. var self=this;
  8593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8594. return $core.withContext(function($ctx1) {
  8595. //>>excludeEnd("ctx");
  8596. self._subclassResponsibility();
  8597. return self;
  8598. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8599. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8600. //>>excludeEnd("ctx");
  8601. },
  8602. //>>excludeStart("ide", pragmas.excludeIdeData);
  8603. args: [],
  8604. source: "resetContents\x0a\x09self subclassResponsibility",
  8605. referencedClasses: [],
  8606. //>>excludeEnd("ide");
  8607. messageSends: ["subclassResponsibility"]
  8608. }),
  8609. $globals.ProtoStream);
  8610. $core.addMethod(
  8611. $core.method({
  8612. selector: "setToEnd",
  8613. protocol: "positioning",
  8614. fn: function (){
  8615. var self=this;
  8616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8617. return $core.withContext(function($ctx1) {
  8618. //>>excludeEnd("ctx");
  8619. self._subclassResponsibility();
  8620. return self;
  8621. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8622. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8623. //>>excludeEnd("ctx");
  8624. },
  8625. //>>excludeStart("ide", pragmas.excludeIdeData);
  8626. args: [],
  8627. source: "setToEnd\x0a\x09self subclassResponsibility",
  8628. referencedClasses: [],
  8629. //>>excludeEnd("ide");
  8630. messageSends: ["subclassResponsibility"]
  8631. }),
  8632. $globals.ProtoStream);
  8633. $core.addMethod(
  8634. $core.method({
  8635. selector: "setToStart",
  8636. protocol: "positioning",
  8637. fn: function (){
  8638. var self=this;
  8639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8640. return $core.withContext(function($ctx1) {
  8641. //>>excludeEnd("ctx");
  8642. self._reset();
  8643. return self;
  8644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8645. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8646. //>>excludeEnd("ctx");
  8647. },
  8648. //>>excludeStart("ide", pragmas.excludeIdeData);
  8649. args: [],
  8650. source: "setToStart\x0a\x09self reset",
  8651. referencedClasses: [],
  8652. //>>excludeEnd("ide");
  8653. messageSends: ["reset"]
  8654. }),
  8655. $globals.ProtoStream);
  8656. $core.addMethod(
  8657. $core.method({
  8658. selector: "write:",
  8659. protocol: "writing",
  8660. fn: function (anObject){
  8661. var self=this;
  8662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8663. return $core.withContext(function($ctx1) {
  8664. //>>excludeEnd("ctx");
  8665. $recv(anObject)._putOn_(self);
  8666. return self;
  8667. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8668. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8669. //>>excludeEnd("ctx");
  8670. },
  8671. //>>excludeStart("ide", pragmas.excludeIdeData);
  8672. args: ["anObject"],
  8673. source: "write: anObject\x0a\x09anObject putOn: self",
  8674. referencedClasses: [],
  8675. //>>excludeEnd("ide");
  8676. messageSends: ["putOn:"]
  8677. }),
  8678. $globals.ProtoStream);
  8679. $core.addMethod(
  8680. $core.method({
  8681. selector: "on:",
  8682. protocol: "instance creation",
  8683. fn: function (aCollection){
  8684. var self=this;
  8685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8686. return $core.withContext(function($ctx1) {
  8687. //>>excludeEnd("ctx");
  8688. var $1;
  8689. $1=self._new();
  8690. $recv($1)._setCollection_(aCollection);
  8691. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8692. return $recv($1)._yourself();
  8693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8694. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  8695. //>>excludeEnd("ctx");
  8696. },
  8697. //>>excludeStart("ide", pragmas.excludeIdeData);
  8698. args: ["aCollection"],
  8699. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8700. referencedClasses: [],
  8701. //>>excludeEnd("ide");
  8702. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8703. }),
  8704. $globals.ProtoStream.klass);
  8705. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  8706. //>>excludeStart("ide", pragmas.excludeIdeData);
  8707. $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.";
  8708. //>>excludeEnd("ide");
  8709. $core.addMethod(
  8710. $core.method({
  8711. selector: "atEnd",
  8712. protocol: "testing",
  8713. fn: function (){
  8714. var self=this;
  8715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8716. return $core.withContext(function($ctx1) {
  8717. //>>excludeEnd("ctx");
  8718. return $recv(self._position()).__eq(self._size());
  8719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8720. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8721. //>>excludeEnd("ctx");
  8722. },
  8723. //>>excludeStart("ide", pragmas.excludeIdeData);
  8724. args: [],
  8725. source: "atEnd\x0a\x09^ self position = self size",
  8726. referencedClasses: [],
  8727. //>>excludeEnd("ide");
  8728. messageSends: ["=", "position", "size"]
  8729. }),
  8730. $globals.Stream);
  8731. $core.addMethod(
  8732. $core.method({
  8733. selector: "atStart",
  8734. protocol: "testing",
  8735. fn: function (){
  8736. var self=this;
  8737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8738. return $core.withContext(function($ctx1) {
  8739. //>>excludeEnd("ctx");
  8740. return $recv(self._position()).__eq((0));
  8741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8742. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8743. //>>excludeEnd("ctx");
  8744. },
  8745. //>>excludeStart("ide", pragmas.excludeIdeData);
  8746. args: [],
  8747. source: "atStart\x0a\x09^ self position = 0",
  8748. referencedClasses: [],
  8749. //>>excludeEnd("ide");
  8750. messageSends: ["=", "position"]
  8751. }),
  8752. $globals.Stream);
  8753. $core.addMethod(
  8754. $core.method({
  8755. selector: "close",
  8756. protocol: "actions",
  8757. fn: function (){
  8758. var self=this;
  8759. return self;
  8760. },
  8761. //>>excludeStart("ide", pragmas.excludeIdeData);
  8762. args: [],
  8763. source: "close",
  8764. referencedClasses: [],
  8765. //>>excludeEnd("ide");
  8766. messageSends: []
  8767. }),
  8768. $globals.Stream);
  8769. $core.addMethod(
  8770. $core.method({
  8771. selector: "collection",
  8772. protocol: "accessing",
  8773. fn: function (){
  8774. var self=this;
  8775. return self["@collection"];
  8776. },
  8777. //>>excludeStart("ide", pragmas.excludeIdeData);
  8778. args: [],
  8779. source: "collection\x0a\x09^ collection",
  8780. referencedClasses: [],
  8781. //>>excludeEnd("ide");
  8782. messageSends: []
  8783. }),
  8784. $globals.Stream);
  8785. $core.addMethod(
  8786. $core.method({
  8787. selector: "contents",
  8788. protocol: "accessing",
  8789. fn: function (){
  8790. var self=this;
  8791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8792. return $core.withContext(function($ctx1) {
  8793. //>>excludeEnd("ctx");
  8794. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  8795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8796. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8797. //>>excludeEnd("ctx");
  8798. },
  8799. //>>excludeStart("ide", pragmas.excludeIdeData);
  8800. args: [],
  8801. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8802. referencedClasses: [],
  8803. //>>excludeEnd("ide");
  8804. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8805. }),
  8806. $globals.Stream);
  8807. $core.addMethod(
  8808. $core.method({
  8809. selector: "flush",
  8810. protocol: "actions",
  8811. fn: function (){
  8812. var self=this;
  8813. return self;
  8814. },
  8815. //>>excludeStart("ide", pragmas.excludeIdeData);
  8816. args: [],
  8817. source: "flush",
  8818. referencedClasses: [],
  8819. //>>excludeEnd("ide");
  8820. messageSends: []
  8821. }),
  8822. $globals.Stream);
  8823. $core.addMethod(
  8824. $core.method({
  8825. selector: "isEmpty",
  8826. protocol: "testing",
  8827. fn: function (){
  8828. var self=this;
  8829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8830. return $core.withContext(function($ctx1) {
  8831. //>>excludeEnd("ctx");
  8832. return $recv(self._size()).__eq((0));
  8833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8834. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8835. //>>excludeEnd("ctx");
  8836. },
  8837. //>>excludeStart("ide", pragmas.excludeIdeData);
  8838. args: [],
  8839. source: "isEmpty\x0a\x09^ self size = 0",
  8840. referencedClasses: [],
  8841. //>>excludeEnd("ide");
  8842. messageSends: ["=", "size"]
  8843. }),
  8844. $globals.Stream);
  8845. $core.addMethod(
  8846. $core.method({
  8847. selector: "next",
  8848. protocol: "reading",
  8849. fn: function (){
  8850. var self=this;
  8851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8852. return $core.withContext(function($ctx1) {
  8853. //>>excludeEnd("ctx");
  8854. var $1,$3,$2;
  8855. $1=self._atEnd();
  8856. if($core.assert($1)){
  8857. return nil;
  8858. } else {
  8859. $3=self._position();
  8860. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8861. $ctx1.sendIdx["position"]=1;
  8862. //>>excludeEnd("ctx");
  8863. $2=$recv($3).__plus((1));
  8864. self._position_($2);
  8865. return $recv(self["@collection"])._at_(self._position());
  8866. }
  8867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8868. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8869. //>>excludeEnd("ctx");
  8870. },
  8871. //>>excludeStart("ide", pragmas.excludeIdeData);
  8872. args: [],
  8873. 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 ]",
  8874. referencedClasses: [],
  8875. //>>excludeEnd("ide");
  8876. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8877. }),
  8878. $globals.Stream);
  8879. $core.addMethod(
  8880. $core.method({
  8881. selector: "next:",
  8882. protocol: "reading",
  8883. fn: function (anInteger){
  8884. var self=this;
  8885. var tempCollection;
  8886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8887. return $core.withContext(function($ctx1) {
  8888. //>>excludeEnd("ctx");
  8889. var $1;
  8890. tempCollection=$recv($recv(self._collection())._class())._new();
  8891. $recv(anInteger)._timesRepeat_((function(){
  8892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8893. return $core.withContext(function($ctx2) {
  8894. //>>excludeEnd("ctx");
  8895. $1=self._atEnd();
  8896. if(!$core.assert($1)){
  8897. return $recv(tempCollection)._add_(self._next());
  8898. }
  8899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8900. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8901. //>>excludeEnd("ctx");
  8902. }));
  8903. return tempCollection;
  8904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8905. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8906. //>>excludeEnd("ctx");
  8907. },
  8908. //>>excludeStart("ide", pragmas.excludeIdeData);
  8909. args: ["anInteger"],
  8910. 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",
  8911. referencedClasses: [],
  8912. //>>excludeEnd("ide");
  8913. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8914. }),
  8915. $globals.Stream);
  8916. $core.addMethod(
  8917. $core.method({
  8918. selector: "nextPut:",
  8919. protocol: "writing",
  8920. fn: function (anObject){
  8921. var self=this;
  8922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8923. return $core.withContext(function($ctx1) {
  8924. //>>excludeEnd("ctx");
  8925. var $2,$1,$3,$4;
  8926. $2=self._position();
  8927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8928. $ctx1.sendIdx["position"]=1;
  8929. //>>excludeEnd("ctx");
  8930. $1=$recv($2).__plus((1));
  8931. self._position_($1);
  8932. $3=self._collection();
  8933. $4=self._position();
  8934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8935. $ctx1.sendIdx["position"]=2;
  8936. //>>excludeEnd("ctx");
  8937. $recv($3)._at_put_($4,anObject);
  8938. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  8939. return self;
  8940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8941. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8942. //>>excludeEnd("ctx");
  8943. },
  8944. //>>excludeStart("ide", pragmas.excludeIdeData);
  8945. args: ["anObject"],
  8946. 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)",
  8947. referencedClasses: [],
  8948. //>>excludeEnd("ide");
  8949. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8950. }),
  8951. $globals.Stream);
  8952. $core.addMethod(
  8953. $core.method({
  8954. selector: "peek",
  8955. protocol: "reading",
  8956. fn: function (){
  8957. var self=this;
  8958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8959. return $core.withContext(function($ctx1) {
  8960. //>>excludeEnd("ctx");
  8961. var $1;
  8962. $1=self._atEnd();
  8963. if(!$core.assert($1)){
  8964. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  8965. }
  8966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8967. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8968. //>>excludeEnd("ctx");
  8969. },
  8970. //>>excludeStart("ide", pragmas.excludeIdeData);
  8971. args: [],
  8972. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8973. referencedClasses: [],
  8974. //>>excludeEnd("ide");
  8975. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8976. }),
  8977. $globals.Stream);
  8978. $core.addMethod(
  8979. $core.method({
  8980. selector: "position",
  8981. protocol: "accessing",
  8982. fn: function (){
  8983. var self=this;
  8984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8985. return $core.withContext(function($ctx1) {
  8986. //>>excludeEnd("ctx");
  8987. var $1,$receiver;
  8988. $1=self["@position"];
  8989. if(($receiver = $1) == null || $receiver.isNil){
  8990. self["@position"]=(0);
  8991. return self["@position"];
  8992. } else {
  8993. return $1;
  8994. }
  8995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8996. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8997. //>>excludeEnd("ctx");
  8998. },
  8999. //>>excludeStart("ide", pragmas.excludeIdeData);
  9000. args: [],
  9001. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  9002. referencedClasses: [],
  9003. //>>excludeEnd("ide");
  9004. messageSends: ["ifNil:"]
  9005. }),
  9006. $globals.Stream);
  9007. $core.addMethod(
  9008. $core.method({
  9009. selector: "position:",
  9010. protocol: "accessing",
  9011. fn: function (anInteger){
  9012. var self=this;
  9013. self["@position"]=anInteger;
  9014. return self;
  9015. },
  9016. //>>excludeStart("ide", pragmas.excludeIdeData);
  9017. args: ["anInteger"],
  9018. source: "position: anInteger\x0a\x09position := anInteger",
  9019. referencedClasses: [],
  9020. //>>excludeEnd("ide");
  9021. messageSends: []
  9022. }),
  9023. $globals.Stream);
  9024. $core.addMethod(
  9025. $core.method({
  9026. selector: "reset",
  9027. protocol: "actions",
  9028. fn: function (){
  9029. var self=this;
  9030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9031. return $core.withContext(function($ctx1) {
  9032. //>>excludeEnd("ctx");
  9033. self._position_((0));
  9034. return self;
  9035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9036. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  9037. //>>excludeEnd("ctx");
  9038. },
  9039. //>>excludeStart("ide", pragmas.excludeIdeData);
  9040. args: [],
  9041. source: "reset\x0a\x09self position: 0",
  9042. referencedClasses: [],
  9043. //>>excludeEnd("ide");
  9044. messageSends: ["position:"]
  9045. }),
  9046. $globals.Stream);
  9047. $core.addMethod(
  9048. $core.method({
  9049. selector: "resetContents",
  9050. protocol: "actions",
  9051. fn: function (){
  9052. var self=this;
  9053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9054. return $core.withContext(function($ctx1) {
  9055. //>>excludeEnd("ctx");
  9056. self._reset();
  9057. self._setStreamSize_((0));
  9058. return self;
  9059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9060. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  9061. //>>excludeEnd("ctx");
  9062. },
  9063. //>>excludeStart("ide", pragmas.excludeIdeData);
  9064. args: [],
  9065. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  9066. referencedClasses: [],
  9067. //>>excludeEnd("ide");
  9068. messageSends: ["reset", "setStreamSize:"]
  9069. }),
  9070. $globals.Stream);
  9071. $core.addMethod(
  9072. $core.method({
  9073. selector: "setCollection:",
  9074. protocol: "accessing",
  9075. fn: function (aCollection){
  9076. var self=this;
  9077. self["@collection"]=aCollection;
  9078. return self;
  9079. },
  9080. //>>excludeStart("ide", pragmas.excludeIdeData);
  9081. args: ["aCollection"],
  9082. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  9083. referencedClasses: [],
  9084. //>>excludeEnd("ide");
  9085. messageSends: []
  9086. }),
  9087. $globals.Stream);
  9088. $core.addMethod(
  9089. $core.method({
  9090. selector: "setStreamSize:",
  9091. protocol: "accessing",
  9092. fn: function (anInteger){
  9093. var self=this;
  9094. self["@streamSize"]=anInteger;
  9095. return self;
  9096. },
  9097. //>>excludeStart("ide", pragmas.excludeIdeData);
  9098. args: ["anInteger"],
  9099. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  9100. referencedClasses: [],
  9101. //>>excludeEnd("ide");
  9102. messageSends: []
  9103. }),
  9104. $globals.Stream);
  9105. $core.addMethod(
  9106. $core.method({
  9107. selector: "setToEnd",
  9108. protocol: "positioning",
  9109. fn: function (){
  9110. var self=this;
  9111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9112. return $core.withContext(function($ctx1) {
  9113. //>>excludeEnd("ctx");
  9114. self._position_(self._size());
  9115. return self;
  9116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9117. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  9118. //>>excludeEnd("ctx");
  9119. },
  9120. //>>excludeStart("ide", pragmas.excludeIdeData);
  9121. args: [],
  9122. source: "setToEnd\x0a\x09self position: self size",
  9123. referencedClasses: [],
  9124. //>>excludeEnd("ide");
  9125. messageSends: ["position:", "size"]
  9126. }),
  9127. $globals.Stream);
  9128. $core.addMethod(
  9129. $core.method({
  9130. selector: "size",
  9131. protocol: "accessing",
  9132. fn: function (){
  9133. var self=this;
  9134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9135. return $core.withContext(function($ctx1) {
  9136. //>>excludeEnd("ctx");
  9137. return self._streamSize();
  9138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9139. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  9140. //>>excludeEnd("ctx");
  9141. },
  9142. //>>excludeStart("ide", pragmas.excludeIdeData);
  9143. args: [],
  9144. source: "size\x0a\x09^ self streamSize",
  9145. referencedClasses: [],
  9146. //>>excludeEnd("ide");
  9147. messageSends: ["streamSize"]
  9148. }),
  9149. $globals.Stream);
  9150. $core.addMethod(
  9151. $core.method({
  9152. selector: "skip:",
  9153. protocol: "positioning",
  9154. fn: function (anInteger){
  9155. var self=this;
  9156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9157. return $core.withContext(function($ctx1) {
  9158. //>>excludeEnd("ctx");
  9159. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  9160. return self;
  9161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9162. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  9163. //>>excludeEnd("ctx");
  9164. },
  9165. //>>excludeStart("ide", pragmas.excludeIdeData);
  9166. args: ["anInteger"],
  9167. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9168. referencedClasses: [],
  9169. //>>excludeEnd("ide");
  9170. messageSends: ["position:", "min:max:", "+", "position", "size"]
  9171. }),
  9172. $globals.Stream);
  9173. $core.addMethod(
  9174. $core.method({
  9175. selector: "streamSize",
  9176. protocol: "accessing",
  9177. fn: function (){
  9178. var self=this;
  9179. return self["@streamSize"];
  9180. },
  9181. //>>excludeStart("ide", pragmas.excludeIdeData);
  9182. args: [],
  9183. source: "streamSize\x0a\x09^ streamSize",
  9184. referencedClasses: [],
  9185. //>>excludeEnd("ide");
  9186. messageSends: []
  9187. }),
  9188. $globals.Stream);
  9189. $core.addMethod(
  9190. $core.method({
  9191. selector: "on:",
  9192. protocol: "instance creation",
  9193. fn: function (aCollection){
  9194. var self=this;
  9195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9196. return $core.withContext(function($ctx1) {
  9197. //>>excludeEnd("ctx");
  9198. var $1;
  9199. $1=self._new();
  9200. $recv($1)._setCollection_(aCollection);
  9201. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9202. return $recv($1)._yourself();
  9203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9204. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  9205. //>>excludeEnd("ctx");
  9206. },
  9207. //>>excludeStart("ide", pragmas.excludeIdeData);
  9208. args: ["aCollection"],
  9209. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9210. referencedClasses: [],
  9211. //>>excludeEnd("ide");
  9212. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9213. }),
  9214. $globals.Stream.klass);
  9215. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  9216. //>>excludeStart("ide", pragmas.excludeIdeData);
  9217. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9218. //>>excludeEnd("ide");
  9219. $core.addMethod(
  9220. $core.method({
  9221. selector: "cr",
  9222. protocol: "writing",
  9223. fn: function (){
  9224. var self=this;
  9225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9226. return $core.withContext(function($ctx1) {
  9227. //>>excludeEnd("ctx");
  9228. return self._nextPutAll_($recv($globals.String)._cr());
  9229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9230. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9231. //>>excludeEnd("ctx");
  9232. },
  9233. //>>excludeStart("ide", pragmas.excludeIdeData);
  9234. args: [],
  9235. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9236. referencedClasses: ["String"],
  9237. //>>excludeEnd("ide");
  9238. messageSends: ["nextPutAll:", "cr"]
  9239. }),
  9240. $globals.StringStream);
  9241. $core.addMethod(
  9242. $core.method({
  9243. selector: "crlf",
  9244. protocol: "writing",
  9245. fn: function (){
  9246. var self=this;
  9247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9248. return $core.withContext(function($ctx1) {
  9249. //>>excludeEnd("ctx");
  9250. return self._nextPutAll_($recv($globals.String)._crlf());
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9253. //>>excludeEnd("ctx");
  9254. },
  9255. //>>excludeStart("ide", pragmas.excludeIdeData);
  9256. args: [],
  9257. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9258. referencedClasses: ["String"],
  9259. //>>excludeEnd("ide");
  9260. messageSends: ["nextPutAll:", "crlf"]
  9261. }),
  9262. $globals.StringStream);
  9263. $core.addMethod(
  9264. $core.method({
  9265. selector: "lf",
  9266. protocol: "writing",
  9267. fn: function (){
  9268. var self=this;
  9269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9270. return $core.withContext(function($ctx1) {
  9271. //>>excludeEnd("ctx");
  9272. return self._nextPutAll_($recv($globals.String)._lf());
  9273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9274. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9275. //>>excludeEnd("ctx");
  9276. },
  9277. //>>excludeStart("ide", pragmas.excludeIdeData);
  9278. args: [],
  9279. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9280. referencedClasses: ["String"],
  9281. //>>excludeEnd("ide");
  9282. messageSends: ["nextPutAll:", "lf"]
  9283. }),
  9284. $globals.StringStream);
  9285. $core.addMethod(
  9286. $core.method({
  9287. selector: "next:",
  9288. protocol: "reading",
  9289. fn: function (anInteger){
  9290. var self=this;
  9291. var tempCollection;
  9292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9293. return $core.withContext(function($ctx1) {
  9294. //>>excludeEnd("ctx");
  9295. var $1;
  9296. tempCollection=$recv($recv(self._collection())._class())._new();
  9297. $recv(anInteger)._timesRepeat_((function(){
  9298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9299. return $core.withContext(function($ctx2) {
  9300. //>>excludeEnd("ctx");
  9301. $1=self._atEnd();
  9302. if(!$core.assert($1)){
  9303. tempCollection=$recv(tempCollection).__comma(self._next());
  9304. return tempCollection;
  9305. }
  9306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9308. //>>excludeEnd("ctx");
  9309. }));
  9310. return tempCollection;
  9311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9312. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9313. //>>excludeEnd("ctx");
  9314. },
  9315. //>>excludeStart("ide", pragmas.excludeIdeData);
  9316. args: ["anInteger"],
  9317. 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",
  9318. referencedClasses: [],
  9319. //>>excludeEnd("ide");
  9320. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9321. }),
  9322. $globals.StringStream);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "nextPut:",
  9326. protocol: "writing",
  9327. fn: function (aString){
  9328. var self=this;
  9329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9330. return $core.withContext(function($ctx1) {
  9331. //>>excludeEnd("ctx");
  9332. self._nextPutAll_(aString);
  9333. return self;
  9334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9335. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9336. //>>excludeEnd("ctx");
  9337. },
  9338. //>>excludeStart("ide", pragmas.excludeIdeData);
  9339. args: ["aString"],
  9340. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9341. referencedClasses: [],
  9342. //>>excludeEnd("ide");
  9343. messageSends: ["nextPutAll:"]
  9344. }),
  9345. $globals.StringStream);
  9346. $core.addMethod(
  9347. $core.method({
  9348. selector: "nextPutAll:",
  9349. protocol: "writing",
  9350. fn: function (aString){
  9351. var self=this;
  9352. var pre,post;
  9353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9354. return $core.withContext(function($ctx1) {
  9355. //>>excludeEnd("ctx");
  9356. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9357. $1=self._atEnd();
  9358. if($core.assert($1)){
  9359. $3=self._collection();
  9360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9361. $ctx1.sendIdx["collection"]=1;
  9362. //>>excludeEnd("ctx");
  9363. $2=$recv($3).__comma(aString);
  9364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9365. $ctx1.sendIdx[","]=1;
  9366. //>>excludeEnd("ctx");
  9367. self._setCollection_($2);
  9368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9369. $ctx1.sendIdx["setCollection:"]=1;
  9370. //>>excludeEnd("ctx");
  9371. } else {
  9372. $4=self._collection();
  9373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9374. $ctx1.sendIdx["collection"]=2;
  9375. //>>excludeEnd("ctx");
  9376. $5=self._position();
  9377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9378. $ctx1.sendIdx["position"]=1;
  9379. //>>excludeEnd("ctx");
  9380. pre=$recv($4)._copyFrom_to_((1),$5);
  9381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9382. $ctx1.sendIdx["copyFrom:to:"]=1;
  9383. //>>excludeEnd("ctx");
  9384. pre;
  9385. $6=self._collection();
  9386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9387. $ctx1.sendIdx["collection"]=3;
  9388. //>>excludeEnd("ctx");
  9389. $9=self._position();
  9390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9391. $ctx1.sendIdx["position"]=2;
  9392. //>>excludeEnd("ctx");
  9393. $8=$recv($9).__plus((1));
  9394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9395. $ctx1.sendIdx["+"]=2;
  9396. //>>excludeEnd("ctx");
  9397. $10=$recv(aString)._size();
  9398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9399. $ctx1.sendIdx["size"]=1;
  9400. //>>excludeEnd("ctx");
  9401. $7=$recv($8).__plus($10);
  9402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9403. $ctx1.sendIdx["+"]=1;
  9404. //>>excludeEnd("ctx");
  9405. $11=$recv(self._collection())._size();
  9406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9407. $ctx1.sendIdx["size"]=2;
  9408. //>>excludeEnd("ctx");
  9409. post=$recv($6)._copyFrom_to_($7,$11);
  9410. post;
  9411. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9413. $ctx1.sendIdx[","]=2;
  9414. //>>excludeEnd("ctx");
  9415. self._setCollection_($12);
  9416. }
  9417. $14=self._position();
  9418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9419. $ctx1.sendIdx["position"]=3;
  9420. //>>excludeEnd("ctx");
  9421. $13=$recv($14).__plus($recv(aString)._size());
  9422. self._position_($13);
  9423. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  9424. return self;
  9425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9426. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9427. //>>excludeEnd("ctx");
  9428. },
  9429. //>>excludeStart("ide", pragmas.excludeIdeData);
  9430. args: ["aString"],
  9431. source: "nextPutAll: aString\x0a\x09| pre post |\x0a\x09self atEnd ifTrue: [ self setCollection: self collection, aString ] ifFalse: [\x0a\x09\x09pre := self collection copyFrom: 1 to: self position.\x0a\x09\x09post := self collection copyFrom: (self position + 1 + aString size) to: self collection size.\x0a\x09\x09self setCollection: pre, aString, post\x0a\x09].\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  9432. referencedClasses: [],
  9433. //>>excludeEnd("ide");
  9434. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9435. }),
  9436. $globals.StringStream);
  9437. $core.addMethod(
  9438. $core.method({
  9439. selector: "nextPutString:",
  9440. protocol: "writing",
  9441. fn: function (aString){
  9442. var self=this;
  9443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9444. return $core.withContext(function($ctx1) {
  9445. //>>excludeEnd("ctx");
  9446. self._nextPutAll_(aString);
  9447. return self;
  9448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9449. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9450. //>>excludeEnd("ctx");
  9451. },
  9452. //>>excludeStart("ide", pragmas.excludeIdeData);
  9453. args: ["aString"],
  9454. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9455. referencedClasses: [],
  9456. //>>excludeEnd("ide");
  9457. messageSends: ["nextPutAll:"]
  9458. }),
  9459. $globals.StringStream);
  9460. $core.addMethod(
  9461. $core.method({
  9462. selector: "print:",
  9463. protocol: "writing",
  9464. fn: function (anObject){
  9465. var self=this;
  9466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9467. return $core.withContext(function($ctx1) {
  9468. //>>excludeEnd("ctx");
  9469. $recv(anObject)._printOn_(self);
  9470. return self;
  9471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9472. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  9473. //>>excludeEnd("ctx");
  9474. },
  9475. //>>excludeStart("ide", pragmas.excludeIdeData);
  9476. args: ["anObject"],
  9477. source: "print: anObject\x0a\x09anObject printOn: self",
  9478. referencedClasses: [],
  9479. //>>excludeEnd("ide");
  9480. messageSends: ["printOn:"]
  9481. }),
  9482. $globals.StringStream);
  9483. $core.addMethod(
  9484. $core.method({
  9485. selector: "printSymbol:",
  9486. protocol: "writing",
  9487. fn: function (anObject){
  9488. var self=this;
  9489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9490. return $core.withContext(function($ctx1) {
  9491. //>>excludeEnd("ctx");
  9492. $recv(anObject)._asSymbolPrintOn_(self);
  9493. return self;
  9494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9495. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  9496. //>>excludeEnd("ctx");
  9497. },
  9498. //>>excludeStart("ide", pragmas.excludeIdeData);
  9499. args: ["anObject"],
  9500. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  9501. referencedClasses: [],
  9502. //>>excludeEnd("ide");
  9503. messageSends: ["asSymbolPrintOn:"]
  9504. }),
  9505. $globals.StringStream);
  9506. $core.addMethod(
  9507. $core.method({
  9508. selector: "space",
  9509. protocol: "writing",
  9510. fn: function (){
  9511. var self=this;
  9512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9513. return $core.withContext(function($ctx1) {
  9514. //>>excludeEnd("ctx");
  9515. self._nextPut_(" ");
  9516. return self;
  9517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9518. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9519. //>>excludeEnd("ctx");
  9520. },
  9521. //>>excludeStart("ide", pragmas.excludeIdeData);
  9522. args: [],
  9523. source: "space\x0a\x09self nextPut: ' '",
  9524. referencedClasses: [],
  9525. //>>excludeEnd("ide");
  9526. messageSends: ["nextPut:"]
  9527. }),
  9528. $globals.StringStream);
  9529. $core.addMethod(
  9530. $core.method({
  9531. selector: "tab",
  9532. protocol: "writing",
  9533. fn: function (){
  9534. var self=this;
  9535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9536. return $core.withContext(function($ctx1) {
  9537. //>>excludeEnd("ctx");
  9538. return self._nextPutAll_($recv($globals.String)._tab());
  9539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9540. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9541. //>>excludeEnd("ctx");
  9542. },
  9543. //>>excludeStart("ide", pragmas.excludeIdeData);
  9544. args: [],
  9545. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9546. referencedClasses: ["String"],
  9547. //>>excludeEnd("ide");
  9548. messageSends: ["nextPutAll:", "tab"]
  9549. }),
  9550. $globals.StringStream);
  9551. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  9552. //>>excludeStart("ide", pragmas.excludeIdeData);
  9553. $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.";
  9554. //>>excludeEnd("ide");
  9555. $core.addMethod(
  9556. $core.method({
  9557. selector: "initialize",
  9558. protocol: "initialization",
  9559. fn: function (){
  9560. var self=this;
  9561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9562. return $core.withContext(function($ctx1) {
  9563. //>>excludeEnd("ctx");
  9564. (
  9565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9566. $ctx1.supercall = true,
  9567. //>>excludeEnd("ctx");
  9568. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9570. $ctx1.supercall = false;
  9571. //>>excludeEnd("ctx");;
  9572. self["@read"]=$recv($globals.OrderedCollection)._new();
  9573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9574. $ctx1.sendIdx["new"]=1;
  9575. //>>excludeEnd("ctx");
  9576. self["@write"]=$recv($globals.OrderedCollection)._new();
  9577. self["@readIndex"]=(1);
  9578. return self;
  9579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9580. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9581. //>>excludeEnd("ctx");
  9582. },
  9583. //>>excludeStart("ide", pragmas.excludeIdeData);
  9584. args: [],
  9585. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9586. referencedClasses: ["OrderedCollection"],
  9587. //>>excludeEnd("ide");
  9588. messageSends: ["initialize", "new"]
  9589. }),
  9590. $globals.Queue);
  9591. $core.addMethod(
  9592. $core.method({
  9593. selector: "next",
  9594. protocol: "accessing",
  9595. fn: function (){
  9596. var self=this;
  9597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9598. return $core.withContext(function($ctx1) {
  9599. //>>excludeEnd("ctx");
  9600. return self._nextIfAbsent_((function(){
  9601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9602. return $core.withContext(function($ctx2) {
  9603. //>>excludeEnd("ctx");
  9604. return self._error_("Cannot read from empty Queue.");
  9605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9607. //>>excludeEnd("ctx");
  9608. }));
  9609. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9610. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9611. //>>excludeEnd("ctx");
  9612. },
  9613. //>>excludeStart("ide", pragmas.excludeIdeData);
  9614. args: [],
  9615. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9616. referencedClasses: [],
  9617. //>>excludeEnd("ide");
  9618. messageSends: ["nextIfAbsent:", "error:"]
  9619. }),
  9620. $globals.Queue);
  9621. $core.addMethod(
  9622. $core.method({
  9623. selector: "nextIfAbsent:",
  9624. protocol: "accessing",
  9625. fn: function (aBlock){
  9626. var self=this;
  9627. var result;
  9628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9629. return $core.withContext(function($ctx1) {
  9630. //>>excludeEnd("ctx");
  9631. var $1;
  9632. var $early={};
  9633. try {
  9634. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  9635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9636. return $core.withContext(function($ctx2) {
  9637. //>>excludeEnd("ctx");
  9638. $recv(self["@write"])._ifEmpty_((function(){
  9639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9640. return $core.withContext(function($ctx3) {
  9641. //>>excludeEnd("ctx");
  9642. $1=$recv(self["@readIndex"]).__gt((1));
  9643. if($core.assert($1)){
  9644. self["@read"]=[];
  9645. self["@read"];
  9646. self["@readIndex"]=(1);
  9647. self["@readIndex"];
  9648. }
  9649. throw $early=[$recv(aBlock)._value()];
  9650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9651. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9652. //>>excludeEnd("ctx");
  9653. }));
  9654. self["@read"]=self["@write"];
  9655. self["@read"];
  9656. self["@readIndex"]=(1);
  9657. self["@readIndex"];
  9658. self["@write"]=$recv($globals.OrderedCollection)._new();
  9659. self["@write"];
  9660. return $recv(self["@read"])._first();
  9661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9663. //>>excludeEnd("ctx");
  9664. }));
  9665. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  9666. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  9667. return result;
  9668. }
  9669. catch(e) {if(e===$early)return e[0]; throw e}
  9670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9671. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9672. //>>excludeEnd("ctx");
  9673. },
  9674. //>>excludeStart("ide", pragmas.excludeIdeData);
  9675. args: ["aBlock"],
  9676. 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",
  9677. referencedClasses: ["OrderedCollection"],
  9678. //>>excludeEnd("ide");
  9679. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9680. }),
  9681. $globals.Queue);
  9682. $core.addMethod(
  9683. $core.method({
  9684. selector: "nextPut:",
  9685. protocol: "accessing",
  9686. fn: function (anObject){
  9687. var self=this;
  9688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9689. return $core.withContext(function($ctx1) {
  9690. //>>excludeEnd("ctx");
  9691. $recv(self["@write"])._add_(anObject);
  9692. return self;
  9693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9694. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9695. //>>excludeEnd("ctx");
  9696. },
  9697. //>>excludeStart("ide", pragmas.excludeIdeData);
  9698. args: ["anObject"],
  9699. source: "nextPut: anObject\x0a\x09write add: anObject",
  9700. referencedClasses: [],
  9701. //>>excludeEnd("ide");
  9702. messageSends: ["add:"]
  9703. }),
  9704. $globals.Queue);
  9705. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  9706. //>>excludeStart("ide", pragmas.excludeIdeData);
  9707. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9708. //>>excludeEnd("ide");
  9709. $core.addMethod(
  9710. $core.method({
  9711. selector: "compile:",
  9712. protocol: "evaluating",
  9713. fn: function (aString){
  9714. var self=this;
  9715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9716. return $core.withContext(function($ctx1) {
  9717. //>>excludeEnd("ctx");
  9718. return self.compile(aString);
  9719. return self;
  9720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9721. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9722. //>>excludeEnd("ctx");
  9723. },
  9724. //>>excludeStart("ide", pragmas.excludeIdeData);
  9725. args: ["aString"],
  9726. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9727. referencedClasses: [],
  9728. //>>excludeEnd("ide");
  9729. messageSends: []
  9730. }),
  9731. $globals.RegularExpression);
  9732. $core.addMethod(
  9733. $core.method({
  9734. selector: "exec:",
  9735. protocol: "evaluating",
  9736. fn: function (aString){
  9737. var self=this;
  9738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9739. return $core.withContext(function($ctx1) {
  9740. //>>excludeEnd("ctx");
  9741. return self.exec(aString) || nil;
  9742. return self;
  9743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9744. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9745. //>>excludeEnd("ctx");
  9746. },
  9747. //>>excludeStart("ide", pragmas.excludeIdeData);
  9748. args: ["aString"],
  9749. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9750. referencedClasses: [],
  9751. //>>excludeEnd("ide");
  9752. messageSends: []
  9753. }),
  9754. $globals.RegularExpression);
  9755. $core.addMethod(
  9756. $core.method({
  9757. selector: "test:",
  9758. protocol: "evaluating",
  9759. fn: function (aString){
  9760. var self=this;
  9761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9762. return $core.withContext(function($ctx1) {
  9763. //>>excludeEnd("ctx");
  9764. return self.test(aString);
  9765. return self;
  9766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9767. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9768. //>>excludeEnd("ctx");
  9769. },
  9770. //>>excludeStart("ide", pragmas.excludeIdeData);
  9771. args: ["aString"],
  9772. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9773. referencedClasses: [],
  9774. //>>excludeEnd("ide");
  9775. messageSends: []
  9776. }),
  9777. $globals.RegularExpression);
  9778. $core.addMethod(
  9779. $core.method({
  9780. selector: "fromString:",
  9781. protocol: "instance creation",
  9782. fn: function (aString){
  9783. var self=this;
  9784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9785. return $core.withContext(function($ctx1) {
  9786. //>>excludeEnd("ctx");
  9787. return self._fromString_flag_(aString,"");
  9788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9789. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  9790. //>>excludeEnd("ctx");
  9791. },
  9792. //>>excludeStart("ide", pragmas.excludeIdeData);
  9793. args: ["aString"],
  9794. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9795. referencedClasses: [],
  9796. //>>excludeEnd("ide");
  9797. messageSends: ["fromString:flag:"]
  9798. }),
  9799. $globals.RegularExpression.klass);
  9800. $core.addMethod(
  9801. $core.method({
  9802. selector: "fromString:flag:",
  9803. protocol: "instance creation",
  9804. fn: function (aString,anotherString){
  9805. var self=this;
  9806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9807. return $core.withContext(function($ctx1) {
  9808. //>>excludeEnd("ctx");
  9809. return new RegExp(aString, anotherString);
  9810. return self;
  9811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9812. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  9813. //>>excludeEnd("ctx");
  9814. },
  9815. //>>excludeStart("ide", pragmas.excludeIdeData);
  9816. args: ["aString", "anotherString"],
  9817. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9818. referencedClasses: [],
  9819. //>>excludeEnd("ide");
  9820. messageSends: []
  9821. }),
  9822. $globals.RegularExpression.klass);
  9823. });