Kernel-Collections.js 323 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117
  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: "copyWithoutAll:",
  774. protocol: 'copying',
  775. fn: function (aCollection){
  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(aCollection)._includes_(each);
  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,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  791. //>>excludeEnd("ctx");
  792. },
  793. //>>excludeStart("ide", pragmas.excludeIdeData);
  794. args: ["aCollection"],
  795. 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 ]",
  796. referencedClasses: [],
  797. //>>excludeEnd("ide");
  798. messageSends: ["reject:", "includes:"]
  799. }),
  800. $globals.Collection);
  801. $core.addMethod(
  802. $core.method({
  803. selector: "deepCopy",
  804. protocol: 'copying',
  805. fn: function (){
  806. var self=this;
  807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  808. return $core.withContext(function($ctx1) {
  809. //>>excludeEnd("ctx");
  810. return self._collect_((function(each){
  811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  812. return $core.withContext(function($ctx2) {
  813. //>>excludeEnd("ctx");
  814. return $recv(each)._deepCopy();
  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,"deepCopy",{},$globals.Collection)});
  821. //>>excludeEnd("ctx");
  822. },
  823. //>>excludeStart("ide", pragmas.excludeIdeData);
  824. args: [],
  825. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  826. referencedClasses: [],
  827. //>>excludeEnd("ide");
  828. messageSends: ["collect:", "deepCopy"]
  829. }),
  830. $globals.Collection);
  831. $core.addMethod(
  832. $core.method({
  833. selector: "detect:",
  834. protocol: 'enumerating',
  835. fn: function (aBlock){
  836. var self=this;
  837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  838. return $core.withContext(function($ctx1) {
  839. //>>excludeEnd("ctx");
  840. return self._detect_ifNone_(aBlock,(function(){
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. return $core.withContext(function($ctx2) {
  843. //>>excludeEnd("ctx");
  844. return self._errorNotFound();
  845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  846. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  847. //>>excludeEnd("ctx");
  848. }));
  849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  850. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  851. //>>excludeEnd("ctx");
  852. },
  853. //>>excludeStart("ide", pragmas.excludeIdeData);
  854. args: ["aBlock"],
  855. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  856. referencedClasses: [],
  857. //>>excludeEnd("ide");
  858. messageSends: ["detect:ifNone:", "errorNotFound"]
  859. }),
  860. $globals.Collection);
  861. $core.addMethod(
  862. $core.method({
  863. selector: "detect:ifNone:",
  864. protocol: 'enumerating',
  865. fn: function (aBlock,anotherBlock){
  866. var self=this;
  867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  868. return $core.withContext(function($ctx1) {
  869. //>>excludeEnd("ctx");
  870. self._subclassResponsibility();
  871. return self;
  872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  873. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  874. //>>excludeEnd("ctx");
  875. },
  876. //>>excludeStart("ide", pragmas.excludeIdeData);
  877. args: ["aBlock", "anotherBlock"],
  878. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  879. referencedClasses: [],
  880. //>>excludeEnd("ide");
  881. messageSends: ["subclassResponsibility"]
  882. }),
  883. $globals.Collection);
  884. $core.addMethod(
  885. $core.method({
  886. selector: "do:",
  887. protocol: 'enumerating',
  888. fn: function (aBlock){
  889. var self=this;
  890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  891. return $core.withContext(function($ctx1) {
  892. //>>excludeEnd("ctx");
  893. self._subclassResponsibility();
  894. return self;
  895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  896. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  897. //>>excludeEnd("ctx");
  898. },
  899. //>>excludeStart("ide", pragmas.excludeIdeData);
  900. args: ["aBlock"],
  901. source: "do: aBlock\x0a\x09self subclassResponsibility",
  902. referencedClasses: [],
  903. //>>excludeEnd("ide");
  904. messageSends: ["subclassResponsibility"]
  905. }),
  906. $globals.Collection);
  907. $core.addMethod(
  908. $core.method({
  909. selector: "do:separatedBy:",
  910. protocol: 'enumerating',
  911. fn: function (aBlock,anotherBlock){
  912. var self=this;
  913. var actionBeforeElement;
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. return $core.withContext(function($ctx1) {
  916. //>>excludeEnd("ctx");
  917. actionBeforeElement=(function(){
  918. actionBeforeElement=anotherBlock;
  919. return actionBeforeElement;
  920. });
  921. self._do_((function(each){
  922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  923. return $core.withContext(function($ctx2) {
  924. //>>excludeEnd("ctx");
  925. $recv(actionBeforeElement)._value();
  926. return $recv(aBlock)._value_(each);
  927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  928. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  929. //>>excludeEnd("ctx");
  930. }));
  931. return self;
  932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  933. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  934. //>>excludeEnd("ctx");
  935. },
  936. //>>excludeStart("ide", pragmas.excludeIdeData);
  937. args: ["aBlock", "anotherBlock"],
  938. 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 ]",
  939. referencedClasses: [],
  940. //>>excludeEnd("ide");
  941. messageSends: ["do:", "value", "value:"]
  942. }),
  943. $globals.Collection);
  944. $core.addMethod(
  945. $core.method({
  946. selector: "errorNotFound",
  947. protocol: 'error handling',
  948. fn: function (){
  949. var self=this;
  950. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  951. return $core.withContext(function($ctx1) {
  952. //>>excludeEnd("ctx");
  953. self._error_("Object is not in the collection");
  954. return self;
  955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  956. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  957. //>>excludeEnd("ctx");
  958. },
  959. //>>excludeStart("ide", pragmas.excludeIdeData);
  960. args: [],
  961. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  962. referencedClasses: [],
  963. //>>excludeEnd("ide");
  964. messageSends: ["error:"]
  965. }),
  966. $globals.Collection);
  967. $core.addMethod(
  968. $core.method({
  969. selector: "ifEmpty:",
  970. protocol: 'testing',
  971. fn: function (aBlock){
  972. var self=this;
  973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  974. return $core.withContext(function($ctx1) {
  975. //>>excludeEnd("ctx");
  976. var $1;
  977. $1=self._isEmpty();
  978. if($core.assert($1)){
  979. return $recv(aBlock)._value();
  980. } else {
  981. return self;
  982. }
  983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  984. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  985. //>>excludeEnd("ctx");
  986. },
  987. //>>excludeStart("ide", pragmas.excludeIdeData);
  988. args: ["aBlock"],
  989. 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 ]",
  990. referencedClasses: [],
  991. //>>excludeEnd("ide");
  992. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  993. }),
  994. $globals.Collection);
  995. $core.addMethod(
  996. $core.method({
  997. selector: "ifEmpty:ifNotEmpty:",
  998. protocol: 'testing',
  999. fn: function (aBlock,anotherBlock){
  1000. var self=this;
  1001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1002. return $core.withContext(function($ctx1) {
  1003. //>>excludeEnd("ctx");
  1004. var $1;
  1005. $1=self._isEmpty();
  1006. if($core.assert($1)){
  1007. return $recv(aBlock)._value();
  1008. } else {
  1009. return $recv(anotherBlock)._value_(self);
  1010. }
  1011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1012. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1013. //>>excludeEnd("ctx");
  1014. },
  1015. //>>excludeStart("ide", pragmas.excludeIdeData);
  1016. args: ["aBlock", "anotherBlock"],
  1017. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1018. referencedClasses: [],
  1019. //>>excludeEnd("ide");
  1020. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  1021. }),
  1022. $globals.Collection);
  1023. $core.addMethod(
  1024. $core.method({
  1025. selector: "ifNotEmpty:",
  1026. protocol: 'testing',
  1027. fn: function (aBlock){
  1028. var self=this;
  1029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1030. return $core.withContext(function($ctx1) {
  1031. //>>excludeEnd("ctx");
  1032. var $1;
  1033. $1=self._notEmpty();
  1034. if($core.assert($1)){
  1035. return $recv(aBlock)._value_(self);
  1036. } else {
  1037. return self;
  1038. }
  1039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1040. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1041. //>>excludeEnd("ctx");
  1042. },
  1043. //>>excludeStart("ide", pragmas.excludeIdeData);
  1044. args: ["aBlock"],
  1045. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1046. referencedClasses: [],
  1047. //>>excludeEnd("ide");
  1048. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1049. }),
  1050. $globals.Collection);
  1051. $core.addMethod(
  1052. $core.method({
  1053. selector: "ifNotEmpty:ifEmpty:",
  1054. protocol: 'testing',
  1055. fn: function (aBlock,anotherBlock){
  1056. var self=this;
  1057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1058. return $core.withContext(function($ctx1) {
  1059. //>>excludeEnd("ctx");
  1060. var $1;
  1061. $1=self._notEmpty();
  1062. if($core.assert($1)){
  1063. return $recv(aBlock)._value_(self);
  1064. } else {
  1065. return $recv(anotherBlock)._value();
  1066. }
  1067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1068. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1069. //>>excludeEnd("ctx");
  1070. },
  1071. //>>excludeStart("ide", pragmas.excludeIdeData);
  1072. args: ["aBlock", "anotherBlock"],
  1073. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  1074. referencedClasses: [],
  1075. //>>excludeEnd("ide");
  1076. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  1077. }),
  1078. $globals.Collection);
  1079. $core.addMethod(
  1080. $core.method({
  1081. selector: "includes:",
  1082. protocol: 'testing',
  1083. fn: function (anObject){
  1084. var self=this;
  1085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1086. return $core.withContext(function($ctx1) {
  1087. //>>excludeEnd("ctx");
  1088. return self._anySatisfy_((function(each){
  1089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1090. return $core.withContext(function($ctx2) {
  1091. //>>excludeEnd("ctx");
  1092. return $recv(each).__eq(anObject);
  1093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1094. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1095. //>>excludeEnd("ctx");
  1096. }));
  1097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1098. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1099. //>>excludeEnd("ctx");
  1100. },
  1101. //>>excludeStart("ide", pragmas.excludeIdeData);
  1102. args: ["anObject"],
  1103. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1104. referencedClasses: [],
  1105. //>>excludeEnd("ide");
  1106. messageSends: ["anySatisfy:", "="]
  1107. }),
  1108. $globals.Collection);
  1109. $core.addMethod(
  1110. $core.method({
  1111. selector: "inject:into:",
  1112. protocol: 'enumerating',
  1113. fn: function (anObject,aBlock){
  1114. var self=this;
  1115. var result;
  1116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1117. return $core.withContext(function($ctx1) {
  1118. //>>excludeEnd("ctx");
  1119. result=anObject;
  1120. self._do_((function(each){
  1121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1122. return $core.withContext(function($ctx2) {
  1123. //>>excludeEnd("ctx");
  1124. result=$recv(aBlock)._value_value_(result,each);
  1125. return result;
  1126. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1127. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1128. //>>excludeEnd("ctx");
  1129. }));
  1130. return result;
  1131. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1132. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1133. //>>excludeEnd("ctx");
  1134. },
  1135. //>>excludeStart("ide", pragmas.excludeIdeData);
  1136. args: ["anObject", "aBlock"],
  1137. 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",
  1138. referencedClasses: [],
  1139. //>>excludeEnd("ide");
  1140. messageSends: ["do:", "value:value:"]
  1141. }),
  1142. $globals.Collection);
  1143. $core.addMethod(
  1144. $core.method({
  1145. selector: "intersection:",
  1146. protocol: 'enumerating',
  1147. fn: function (aCollection){
  1148. var self=this;
  1149. var set,outputSet;
  1150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1151. return $core.withContext(function($ctx1) {
  1152. //>>excludeEnd("ctx");
  1153. var $2,$1;
  1154. set=self._asSet();
  1155. outputSet=$recv($globals.Set)._new();
  1156. $recv(aCollection)._do_((function(each){
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. return $core.withContext(function($ctx2) {
  1159. //>>excludeEnd("ctx");
  1160. $2=$recv(set)._includes_(each);
  1161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1162. $ctx2.sendIdx["includes:"]=1;
  1163. //>>excludeEnd("ctx");
  1164. $1=$recv($2)._and_((function(){
  1165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1166. return $core.withContext(function($ctx3) {
  1167. //>>excludeEnd("ctx");
  1168. return $recv($recv(outputSet)._includes_(each))._not();
  1169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1170. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1171. //>>excludeEnd("ctx");
  1172. }));
  1173. if($core.assert($1)){
  1174. return $recv(outputSet)._add_(each);
  1175. }
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1178. //>>excludeEnd("ctx");
  1179. }));
  1180. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  1181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1182. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1183. //>>excludeEnd("ctx");
  1184. },
  1185. //>>excludeStart("ide", pragmas.excludeIdeData);
  1186. args: ["aCollection"],
  1187. 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",
  1188. referencedClasses: ["Set"],
  1189. //>>excludeEnd("ide");
  1190. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1191. }),
  1192. $globals.Collection);
  1193. $core.addMethod(
  1194. $core.method({
  1195. selector: "isEmpty",
  1196. protocol: 'testing',
  1197. fn: function (){
  1198. var self=this;
  1199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1200. return $core.withContext(function($ctx1) {
  1201. //>>excludeEnd("ctx");
  1202. return $recv(self._size()).__eq((0));
  1203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1204. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1205. //>>excludeEnd("ctx");
  1206. },
  1207. //>>excludeStart("ide", pragmas.excludeIdeData);
  1208. args: [],
  1209. source: "isEmpty\x0a\x09^ self size = 0",
  1210. referencedClasses: [],
  1211. //>>excludeEnd("ide");
  1212. messageSends: ["=", "size"]
  1213. }),
  1214. $globals.Collection);
  1215. $core.addMethod(
  1216. $core.method({
  1217. selector: "noneSatisfy:",
  1218. protocol: 'enumerating',
  1219. fn: function (aBlock){
  1220. var self=this;
  1221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1222. return $core.withContext(function($ctx1) {
  1223. //>>excludeEnd("ctx");
  1224. var $1;
  1225. var $early={};
  1226. try {
  1227. self._do_((function(item){
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. return $core.withContext(function($ctx2) {
  1230. //>>excludeEnd("ctx");
  1231. $1=$recv(aBlock)._value_(item);
  1232. if($core.assert($1)){
  1233. throw $early=[false];
  1234. }
  1235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1236. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1237. //>>excludeEnd("ctx");
  1238. }));
  1239. return true;
  1240. }
  1241. catch(e) {if(e===$early)return e[0]; throw e}
  1242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1243. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1244. //>>excludeEnd("ctx");
  1245. },
  1246. //>>excludeStart("ide", pragmas.excludeIdeData);
  1247. args: ["aBlock"],
  1248. source: "noneSatisfy: aBlock\x0a\x09\x22Evaluate aBlock with the elements of the receiver.\x0a\x09If aBlock returns false for all elements return true.\x0a\x09Otherwise return false\x22\x0a\x0a\x09self do: [ :item | (aBlock value: item) ifTrue: [ ^ false ] ].\x0a\x09^ true",
  1249. referencedClasses: [],
  1250. //>>excludeEnd("ide");
  1251. messageSends: ["do:", "ifTrue:", "value:"]
  1252. }),
  1253. $globals.Collection);
  1254. $core.addMethod(
  1255. $core.method({
  1256. selector: "notEmpty",
  1257. protocol: 'testing',
  1258. fn: function (){
  1259. var self=this;
  1260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1261. return $core.withContext(function($ctx1) {
  1262. //>>excludeEnd("ctx");
  1263. return $recv(self._isEmpty())._not();
  1264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1265. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1266. //>>excludeEnd("ctx");
  1267. },
  1268. //>>excludeStart("ide", pragmas.excludeIdeData);
  1269. args: [],
  1270. source: "notEmpty\x0a\x09^ self isEmpty not",
  1271. referencedClasses: [],
  1272. //>>excludeEnd("ide");
  1273. messageSends: ["not", "isEmpty"]
  1274. }),
  1275. $globals.Collection);
  1276. $core.addMethod(
  1277. $core.method({
  1278. selector: "occurrencesOf:",
  1279. protocol: 'accessing',
  1280. fn: function (anObject){
  1281. var self=this;
  1282. var tally;
  1283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1284. return $core.withContext(function($ctx1) {
  1285. //>>excludeEnd("ctx");
  1286. var $1;
  1287. tally=(0);
  1288. self._do_((function(each){
  1289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1290. return $core.withContext(function($ctx2) {
  1291. //>>excludeEnd("ctx");
  1292. $1=$recv(anObject).__eq(each);
  1293. if($core.assert($1)){
  1294. tally=$recv(tally).__plus((1));
  1295. return tally;
  1296. }
  1297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1298. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1299. //>>excludeEnd("ctx");
  1300. }));
  1301. return tally;
  1302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1303. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1304. //>>excludeEnd("ctx");
  1305. },
  1306. //>>excludeStart("ide", pragmas.excludeIdeData);
  1307. args: ["anObject"],
  1308. 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",
  1309. referencedClasses: [],
  1310. //>>excludeEnd("ide");
  1311. messageSends: ["do:", "ifTrue:", "=", "+"]
  1312. }),
  1313. $globals.Collection);
  1314. $core.addMethod(
  1315. $core.method({
  1316. selector: "putOn:",
  1317. protocol: 'streaming',
  1318. fn: function (aStream){
  1319. var self=this;
  1320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1321. return $core.withContext(function($ctx1) {
  1322. //>>excludeEnd("ctx");
  1323. self._do_((function(each){
  1324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1325. return $core.withContext(function($ctx2) {
  1326. //>>excludeEnd("ctx");
  1327. return $recv(each)._putOn_(aStream);
  1328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1329. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1330. //>>excludeEnd("ctx");
  1331. }));
  1332. return self;
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1335. //>>excludeEnd("ctx");
  1336. },
  1337. //>>excludeStart("ide", pragmas.excludeIdeData);
  1338. args: ["aStream"],
  1339. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1340. referencedClasses: [],
  1341. //>>excludeEnd("ide");
  1342. messageSends: ["do:", "putOn:"]
  1343. }),
  1344. $globals.Collection);
  1345. $core.addMethod(
  1346. $core.method({
  1347. selector: "reject:",
  1348. protocol: 'enumerating',
  1349. fn: function (aBlock){
  1350. var self=this;
  1351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1352. return $core.withContext(function($ctx1) {
  1353. //>>excludeEnd("ctx");
  1354. return self._select_((function(each){
  1355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1356. return $core.withContext(function($ctx2) {
  1357. //>>excludeEnd("ctx");
  1358. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1360. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1361. //>>excludeEnd("ctx");
  1362. }));
  1363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1364. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1365. //>>excludeEnd("ctx");
  1366. },
  1367. //>>excludeStart("ide", pragmas.excludeIdeData);
  1368. args: ["aBlock"],
  1369. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1370. referencedClasses: [],
  1371. //>>excludeEnd("ide");
  1372. messageSends: ["select:", "=", "value:"]
  1373. }),
  1374. $globals.Collection);
  1375. $core.addMethod(
  1376. $core.method({
  1377. selector: "remove:",
  1378. protocol: 'adding/removing',
  1379. fn: function (anObject){
  1380. var self=this;
  1381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1382. return $core.withContext(function($ctx1) {
  1383. //>>excludeEnd("ctx");
  1384. return self._remove_ifAbsent_(anObject,(function(){
  1385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1386. return $core.withContext(function($ctx2) {
  1387. //>>excludeEnd("ctx");
  1388. return self._errorNotFound();
  1389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1391. //>>excludeEnd("ctx");
  1392. }));
  1393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1394. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1395. //>>excludeEnd("ctx");
  1396. },
  1397. //>>excludeStart("ide", pragmas.excludeIdeData);
  1398. args: ["anObject"],
  1399. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1400. referencedClasses: [],
  1401. //>>excludeEnd("ide");
  1402. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1403. }),
  1404. $globals.Collection);
  1405. $core.addMethod(
  1406. $core.method({
  1407. selector: "remove:ifAbsent:",
  1408. protocol: 'adding/removing',
  1409. fn: function (anObject,aBlock){
  1410. var self=this;
  1411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1412. return $core.withContext(function($ctx1) {
  1413. //>>excludeEnd("ctx");
  1414. self._subclassResponsibility();
  1415. return self;
  1416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1417. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1418. //>>excludeEnd("ctx");
  1419. },
  1420. //>>excludeStart("ide", pragmas.excludeIdeData);
  1421. args: ["anObject", "aBlock"],
  1422. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1423. referencedClasses: [],
  1424. //>>excludeEnd("ide");
  1425. messageSends: ["subclassResponsibility"]
  1426. }),
  1427. $globals.Collection);
  1428. $core.addMethod(
  1429. $core.method({
  1430. selector: "removeAll",
  1431. protocol: 'adding/removing',
  1432. fn: function (){
  1433. var self=this;
  1434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1435. return $core.withContext(function($ctx1) {
  1436. //>>excludeEnd("ctx");
  1437. self._subclassResponsibility();
  1438. return self;
  1439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1440. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1441. //>>excludeEnd("ctx");
  1442. },
  1443. //>>excludeStart("ide", pragmas.excludeIdeData);
  1444. args: [],
  1445. source: "removeAll\x0a\x09self subclassResponsibility",
  1446. referencedClasses: [],
  1447. //>>excludeEnd("ide");
  1448. messageSends: ["subclassResponsibility"]
  1449. }),
  1450. $globals.Collection);
  1451. $core.addMethod(
  1452. $core.method({
  1453. selector: "select:",
  1454. protocol: 'enumerating',
  1455. fn: function (aBlock){
  1456. var self=this;
  1457. var stream;
  1458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1459. return $core.withContext(function($ctx1) {
  1460. //>>excludeEnd("ctx");
  1461. var $1;
  1462. stream=$recv($recv(self._class())._new())._writeStream();
  1463. self._do_((function(each){
  1464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1465. return $core.withContext(function($ctx2) {
  1466. //>>excludeEnd("ctx");
  1467. $1=$recv(aBlock)._value_(each);
  1468. if($core.assert($1)){
  1469. return $recv(stream)._nextPut_(each);
  1470. }
  1471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1472. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1473. //>>excludeEnd("ctx");
  1474. }));
  1475. return $recv(stream)._contents();
  1476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1477. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1478. //>>excludeEnd("ctx");
  1479. },
  1480. //>>excludeStart("ide", pragmas.excludeIdeData);
  1481. args: ["aBlock"],
  1482. 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",
  1483. referencedClasses: [],
  1484. //>>excludeEnd("ide");
  1485. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1486. }),
  1487. $globals.Collection);
  1488. $core.addMethod(
  1489. $core.method({
  1490. selector: "select:thenCollect:",
  1491. protocol: 'enumerating',
  1492. fn: function (selectBlock,collectBlock){
  1493. var self=this;
  1494. var stream;
  1495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1496. return $core.withContext(function($ctx1) {
  1497. //>>excludeEnd("ctx");
  1498. var $1;
  1499. stream=$recv($recv(self._class())._new())._writeStream();
  1500. self._do_((function(each){
  1501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1502. return $core.withContext(function($ctx2) {
  1503. //>>excludeEnd("ctx");
  1504. $1=$recv(selectBlock)._value_(each);
  1505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1506. $ctx2.sendIdx["value:"]=1;
  1507. //>>excludeEnd("ctx");
  1508. if($core.assert($1)){
  1509. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1510. }
  1511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1513. //>>excludeEnd("ctx");
  1514. }));
  1515. return $recv(stream)._contents();
  1516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1517. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1518. //>>excludeEnd("ctx");
  1519. },
  1520. //>>excludeStart("ide", pragmas.excludeIdeData);
  1521. args: ["selectBlock", "collectBlock"],
  1522. 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",
  1523. referencedClasses: [],
  1524. //>>excludeEnd("ide");
  1525. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1526. }),
  1527. $globals.Collection);
  1528. $core.addMethod(
  1529. $core.method({
  1530. selector: "shallowCopy",
  1531. protocol: 'copying',
  1532. fn: function (){
  1533. var self=this;
  1534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1535. return $core.withContext(function($ctx1) {
  1536. //>>excludeEnd("ctx");
  1537. return self._collect_((function(each){
  1538. return each;
  1539. }));
  1540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1541. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1542. //>>excludeEnd("ctx");
  1543. },
  1544. //>>excludeStart("ide", pragmas.excludeIdeData);
  1545. args: [],
  1546. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1547. referencedClasses: [],
  1548. //>>excludeEnd("ide");
  1549. messageSends: ["collect:"]
  1550. }),
  1551. $globals.Collection);
  1552. $core.addMethod(
  1553. $core.method({
  1554. selector: "single",
  1555. protocol: 'accessing',
  1556. fn: function (){
  1557. var self=this;
  1558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1559. return $core.withContext(function($ctx1) {
  1560. //>>excludeEnd("ctx");
  1561. var $1;
  1562. self._ifEmpty_((function(){
  1563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1564. return $core.withContext(function($ctx2) {
  1565. //>>excludeEnd("ctx");
  1566. return self._error_("Collection is empty");
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. $ctx2.sendIdx["error:"]=1;
  1569. //>>excludeEnd("ctx");
  1570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1572. //>>excludeEnd("ctx");
  1573. }));
  1574. $1=$recv(self._size()).__gt((1));
  1575. if($core.assert($1)){
  1576. self._error_("Collection holds more than one element");
  1577. }
  1578. return self._anyOne();
  1579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1580. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  1581. //>>excludeEnd("ctx");
  1582. },
  1583. //>>excludeStart("ide", pragmas.excludeIdeData);
  1584. args: [],
  1585. 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",
  1586. referencedClasses: [],
  1587. //>>excludeEnd("ide");
  1588. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  1589. }),
  1590. $globals.Collection);
  1591. $core.addMethod(
  1592. $core.method({
  1593. selector: "size",
  1594. protocol: 'accessing',
  1595. fn: function (){
  1596. var self=this;
  1597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1598. return $core.withContext(function($ctx1) {
  1599. //>>excludeEnd("ctx");
  1600. self._subclassResponsibility();
  1601. return self;
  1602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1603. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1604. //>>excludeEnd("ctx");
  1605. },
  1606. //>>excludeStart("ide", pragmas.excludeIdeData);
  1607. args: [],
  1608. source: "size\x0a\x09self subclassResponsibility",
  1609. referencedClasses: [],
  1610. //>>excludeEnd("ide");
  1611. messageSends: ["subclassResponsibility"]
  1612. }),
  1613. $globals.Collection);
  1614. $core.addMethod(
  1615. $core.method({
  1616. selector: "classTag",
  1617. protocol: 'accessing',
  1618. fn: function (){
  1619. var self=this;
  1620. return "collection";
  1621. },
  1622. //>>excludeStart("ide", pragmas.excludeIdeData);
  1623. args: [],
  1624. 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'",
  1625. referencedClasses: [],
  1626. //>>excludeEnd("ide");
  1627. messageSends: []
  1628. }),
  1629. $globals.Collection.klass);
  1630. $core.addMethod(
  1631. $core.method({
  1632. selector: "new:",
  1633. protocol: 'instance creation',
  1634. fn: function (anInteger){
  1635. var self=this;
  1636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1637. return $core.withContext(function($ctx1) {
  1638. //>>excludeEnd("ctx");
  1639. return self._new();
  1640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1641. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  1642. //>>excludeEnd("ctx");
  1643. },
  1644. //>>excludeStart("ide", pragmas.excludeIdeData);
  1645. args: ["anInteger"],
  1646. source: "new: anInteger\x0a\x09^ self new",
  1647. referencedClasses: [],
  1648. //>>excludeEnd("ide");
  1649. messageSends: ["new"]
  1650. }),
  1651. $globals.Collection.klass);
  1652. $core.addMethod(
  1653. $core.method({
  1654. selector: "with:",
  1655. protocol: 'instance creation',
  1656. fn: function (anObject){
  1657. var self=this;
  1658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1659. return $core.withContext(function($ctx1) {
  1660. //>>excludeEnd("ctx");
  1661. var $1;
  1662. $1=self._new();
  1663. $recv($1)._add_(anObject);
  1664. return $recv($1)._yourself();
  1665. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1666. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  1667. //>>excludeEnd("ctx");
  1668. },
  1669. //>>excludeStart("ide", pragmas.excludeIdeData);
  1670. args: ["anObject"],
  1671. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1672. referencedClasses: [],
  1673. //>>excludeEnd("ide");
  1674. messageSends: ["add:", "new", "yourself"]
  1675. }),
  1676. $globals.Collection.klass);
  1677. $core.addMethod(
  1678. $core.method({
  1679. selector: "with:with:",
  1680. protocol: 'instance creation',
  1681. fn: function (anObject,anotherObject){
  1682. var self=this;
  1683. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1684. return $core.withContext(function($ctx1) {
  1685. //>>excludeEnd("ctx");
  1686. var $1;
  1687. $1=self._new();
  1688. $recv($1)._add_(anObject);
  1689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1690. $ctx1.sendIdx["add:"]=1;
  1691. //>>excludeEnd("ctx");
  1692. $recv($1)._add_(anotherObject);
  1693. return $recv($1)._yourself();
  1694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1695. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  1696. //>>excludeEnd("ctx");
  1697. },
  1698. //>>excludeStart("ide", pragmas.excludeIdeData);
  1699. args: ["anObject", "anotherObject"],
  1700. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1701. referencedClasses: [],
  1702. //>>excludeEnd("ide");
  1703. messageSends: ["add:", "new", "yourself"]
  1704. }),
  1705. $globals.Collection.klass);
  1706. $core.addMethod(
  1707. $core.method({
  1708. selector: "with:with:with:",
  1709. protocol: 'instance creation',
  1710. fn: function (firstObject,secondObject,thirdObject){
  1711. var self=this;
  1712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1713. return $core.withContext(function($ctx1) {
  1714. //>>excludeEnd("ctx");
  1715. var $1;
  1716. $1=self._new();
  1717. $recv($1)._add_(firstObject);
  1718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1719. $ctx1.sendIdx["add:"]=1;
  1720. //>>excludeEnd("ctx");
  1721. $recv($1)._add_(secondObject);
  1722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1723. $ctx1.sendIdx["add:"]=2;
  1724. //>>excludeEnd("ctx");
  1725. $recv($1)._add_(thirdObject);
  1726. return $recv($1)._yourself();
  1727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1728. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  1729. //>>excludeEnd("ctx");
  1730. },
  1731. //>>excludeStart("ide", pragmas.excludeIdeData);
  1732. args: ["firstObject", "secondObject", "thirdObject"],
  1733. 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",
  1734. referencedClasses: [],
  1735. //>>excludeEnd("ide");
  1736. messageSends: ["add:", "new", "yourself"]
  1737. }),
  1738. $globals.Collection.klass);
  1739. $core.addMethod(
  1740. $core.method({
  1741. selector: "withAll:",
  1742. protocol: 'instance creation',
  1743. fn: function (aCollection){
  1744. var self=this;
  1745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1746. return $core.withContext(function($ctx1) {
  1747. //>>excludeEnd("ctx");
  1748. var $1;
  1749. $1=self._new();
  1750. $recv($1)._addAll_(aCollection);
  1751. return $recv($1)._yourself();
  1752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1753. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  1754. //>>excludeEnd("ctx");
  1755. },
  1756. //>>excludeStart("ide", pragmas.excludeIdeData);
  1757. args: ["aCollection"],
  1758. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1759. referencedClasses: [],
  1760. //>>excludeEnd("ide");
  1761. messageSends: ["addAll:", "new", "yourself"]
  1762. }),
  1763. $globals.Collection.klass);
  1764. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  1765. //>>excludeStart("ide", pragmas.excludeIdeData);
  1766. $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.";
  1767. //>>excludeEnd("ide");
  1768. $core.addMethod(
  1769. $core.method({
  1770. selector: "at:",
  1771. protocol: 'accessing',
  1772. fn: function (anIndex){
  1773. var self=this;
  1774. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1775. return $core.withContext(function($ctx1) {
  1776. //>>excludeEnd("ctx");
  1777. return self._at_ifAbsent_(anIndex,(function(){
  1778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1779. return $core.withContext(function($ctx2) {
  1780. //>>excludeEnd("ctx");
  1781. return self._errorNotFound();
  1782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1783. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1784. //>>excludeEnd("ctx");
  1785. }));
  1786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1787. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1788. //>>excludeEnd("ctx");
  1789. },
  1790. //>>excludeStart("ide", pragmas.excludeIdeData);
  1791. args: ["anIndex"],
  1792. 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 ]",
  1793. referencedClasses: [],
  1794. //>>excludeEnd("ide");
  1795. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1796. }),
  1797. $globals.IndexableCollection);
  1798. $core.addMethod(
  1799. $core.method({
  1800. selector: "at:ifAbsent:",
  1801. protocol: 'accessing',
  1802. fn: function (anIndex,aBlock){
  1803. var self=this;
  1804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1805. return $core.withContext(function($ctx1) {
  1806. //>>excludeEnd("ctx");
  1807. self._subclassResponsibility();
  1808. return self;
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1811. //>>excludeEnd("ctx");
  1812. },
  1813. //>>excludeStart("ide", pragmas.excludeIdeData);
  1814. args: ["anIndex", "aBlock"],
  1815. 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",
  1816. referencedClasses: [],
  1817. //>>excludeEnd("ide");
  1818. messageSends: ["subclassResponsibility"]
  1819. }),
  1820. $globals.IndexableCollection);
  1821. $core.addMethod(
  1822. $core.method({
  1823. selector: "at:ifAbsentPut:",
  1824. protocol: 'accessing',
  1825. fn: function (aKey,aBlock){
  1826. var self=this;
  1827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1828. return $core.withContext(function($ctx1) {
  1829. //>>excludeEnd("ctx");
  1830. return self._at_ifAbsent_(aKey,(function(){
  1831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1832. return $core.withContext(function($ctx2) {
  1833. //>>excludeEnd("ctx");
  1834. return self._at_put_(aKey,$recv(aBlock)._value());
  1835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1837. //>>excludeEnd("ctx");
  1838. }));
  1839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1840. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1841. //>>excludeEnd("ctx");
  1842. },
  1843. //>>excludeStart("ide", pragmas.excludeIdeData);
  1844. args: ["aKey", "aBlock"],
  1845. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1846. referencedClasses: [],
  1847. //>>excludeEnd("ide");
  1848. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1849. }),
  1850. $globals.IndexableCollection);
  1851. $core.addMethod(
  1852. $core.method({
  1853. selector: "at:ifPresent:",
  1854. protocol: 'accessing',
  1855. fn: function (anIndex,aBlock){
  1856. var self=this;
  1857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1858. return $core.withContext(function($ctx1) {
  1859. //>>excludeEnd("ctx");
  1860. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1861. return nil;
  1862. }));
  1863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1864. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1865. //>>excludeEnd("ctx");
  1866. },
  1867. //>>excludeStart("ide", pragmas.excludeIdeData);
  1868. args: ["anIndex", "aBlock"],
  1869. 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 ]",
  1870. referencedClasses: [],
  1871. //>>excludeEnd("ide");
  1872. messageSends: ["at:ifPresent:ifAbsent:"]
  1873. }),
  1874. $globals.IndexableCollection);
  1875. $core.addMethod(
  1876. $core.method({
  1877. selector: "at:ifPresent:ifAbsent:",
  1878. protocol: 'accessing',
  1879. fn: function (anIndex,aBlock,anotherBlock){
  1880. var self=this;
  1881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1882. return $core.withContext(function($ctx1) {
  1883. //>>excludeEnd("ctx");
  1884. self._subclassResponsibility();
  1885. return self;
  1886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1887. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1888. //>>excludeEnd("ctx");
  1889. },
  1890. //>>excludeStart("ide", pragmas.excludeIdeData);
  1891. args: ["anIndex", "aBlock", "anotherBlock"],
  1892. 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",
  1893. referencedClasses: [],
  1894. //>>excludeEnd("ide");
  1895. messageSends: ["subclassResponsibility"]
  1896. }),
  1897. $globals.IndexableCollection);
  1898. $core.addMethod(
  1899. $core.method({
  1900. selector: "at:put:",
  1901. protocol: 'accessing',
  1902. fn: function (anIndex,anObject){
  1903. var self=this;
  1904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1905. return $core.withContext(function($ctx1) {
  1906. //>>excludeEnd("ctx");
  1907. self._subclassResponsibility();
  1908. return self;
  1909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1910. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1911. //>>excludeEnd("ctx");
  1912. },
  1913. //>>excludeStart("ide", pragmas.excludeIdeData);
  1914. args: ["anIndex", "anObject"],
  1915. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1916. referencedClasses: [],
  1917. //>>excludeEnd("ide");
  1918. messageSends: ["subclassResponsibility"]
  1919. }),
  1920. $globals.IndexableCollection);
  1921. $core.addMethod(
  1922. $core.method({
  1923. selector: "indexOf:",
  1924. protocol: 'accessing',
  1925. fn: function (anObject){
  1926. var self=this;
  1927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1928. return $core.withContext(function($ctx1) {
  1929. //>>excludeEnd("ctx");
  1930. return self._indexOf_ifAbsent_(anObject,(function(){
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. return $core.withContext(function($ctx2) {
  1933. //>>excludeEnd("ctx");
  1934. return self._errorNotFound();
  1935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1937. //>>excludeEnd("ctx");
  1938. }));
  1939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1940. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1941. //>>excludeEnd("ctx");
  1942. },
  1943. //>>excludeStart("ide", pragmas.excludeIdeData);
  1944. args: ["anObject"],
  1945. 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 ]",
  1946. referencedClasses: [],
  1947. //>>excludeEnd("ide");
  1948. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1949. }),
  1950. $globals.IndexableCollection);
  1951. $core.addMethod(
  1952. $core.method({
  1953. selector: "indexOf:ifAbsent:",
  1954. protocol: 'accessing',
  1955. fn: function (anObject,aBlock){
  1956. var self=this;
  1957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1958. return $core.withContext(function($ctx1) {
  1959. //>>excludeEnd("ctx");
  1960. self._subclassResponsibility();
  1961. return self;
  1962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1963. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1964. //>>excludeEnd("ctx");
  1965. },
  1966. //>>excludeStart("ide", pragmas.excludeIdeData);
  1967. args: ["anObject", "aBlock"],
  1968. 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",
  1969. referencedClasses: [],
  1970. //>>excludeEnd("ide");
  1971. messageSends: ["subclassResponsibility"]
  1972. }),
  1973. $globals.IndexableCollection);
  1974. $core.addMethod(
  1975. $core.method({
  1976. selector: "with:do:",
  1977. protocol: 'enumerating',
  1978. fn: function (anotherCollection,aBlock){
  1979. var self=this;
  1980. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1981. return $core.withContext(function($ctx1) {
  1982. //>>excludeEnd("ctx");
  1983. self._withIndexDo_((function(each,index){
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. return $core.withContext(function($ctx2) {
  1986. //>>excludeEnd("ctx");
  1987. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  1988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1989. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  1990. //>>excludeEnd("ctx");
  1991. }));
  1992. return self;
  1993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1994. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  1995. //>>excludeEnd("ctx");
  1996. },
  1997. //>>excludeStart("ide", pragmas.excludeIdeData);
  1998. args: ["anotherCollection", "aBlock"],
  1999. 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) ]",
  2000. referencedClasses: [],
  2001. //>>excludeEnd("ide");
  2002. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2003. }),
  2004. $globals.IndexableCollection);
  2005. $core.addMethod(
  2006. $core.method({
  2007. selector: "withIndexDo:",
  2008. protocol: 'enumerating',
  2009. fn: function (aBlock){
  2010. var self=this;
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. return $core.withContext(function($ctx1) {
  2013. //>>excludeEnd("ctx");
  2014. self._subclassResponsibility();
  2015. return self;
  2016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2017. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  2018. //>>excludeEnd("ctx");
  2019. },
  2020. //>>excludeStart("ide", pragmas.excludeIdeData);
  2021. args: ["aBlock"],
  2022. 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",
  2023. referencedClasses: [],
  2024. //>>excludeEnd("ide");
  2025. messageSends: ["subclassResponsibility"]
  2026. }),
  2027. $globals.IndexableCollection);
  2028. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  2029. //>>excludeStart("ide", pragmas.excludeIdeData);
  2030. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2031. //>>excludeEnd("ide");
  2032. $core.addMethod(
  2033. $core.method({
  2034. selector: "=",
  2035. protocol: 'comparing',
  2036. fn: function (anAssocitativeCollection){
  2037. var self=this;
  2038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2039. return $core.withContext(function($ctx1) {
  2040. //>>excludeEnd("ctx");
  2041. var $2,$1,$4,$3,$5;
  2042. $2=self._class();
  2043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2044. $ctx1.sendIdx["class"]=1;
  2045. //>>excludeEnd("ctx");
  2046. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2048. $ctx1.sendIdx["="]=1;
  2049. //>>excludeEnd("ctx");
  2050. if(!$core.assert($1)){
  2051. return false;
  2052. }
  2053. $4=self._size();
  2054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2055. $ctx1.sendIdx["size"]=1;
  2056. //>>excludeEnd("ctx");
  2057. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2059. $ctx1.sendIdx["="]=2;
  2060. //>>excludeEnd("ctx");
  2061. if(!$core.assert($3)){
  2062. return false;
  2063. }
  2064. $5=self._associations();
  2065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2066. $ctx1.sendIdx["associations"]=1;
  2067. //>>excludeEnd("ctx");
  2068. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2070. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2071. //>>excludeEnd("ctx");
  2072. },
  2073. //>>excludeStart("ide", pragmas.excludeIdeData);
  2074. args: ["anAssocitativeCollection"],
  2075. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2076. referencedClasses: [],
  2077. //>>excludeEnd("ide");
  2078. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2079. }),
  2080. $globals.AssociativeCollection);
  2081. $core.addMethod(
  2082. $core.method({
  2083. selector: "add:",
  2084. protocol: 'adding/removing',
  2085. fn: function (anAssociation){
  2086. var self=this;
  2087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2088. return $core.withContext(function($ctx1) {
  2089. //>>excludeEnd("ctx");
  2090. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2091. return self;
  2092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2093. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2094. //>>excludeEnd("ctx");
  2095. },
  2096. //>>excludeStart("ide", pragmas.excludeIdeData);
  2097. args: ["anAssociation"],
  2098. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2099. referencedClasses: [],
  2100. //>>excludeEnd("ide");
  2101. messageSends: ["at:put:", "key", "value"]
  2102. }),
  2103. $globals.AssociativeCollection);
  2104. $core.addMethod(
  2105. $core.method({
  2106. selector: "addAll:",
  2107. protocol: 'adding/removing',
  2108. fn: function (anAssociativeCollection){
  2109. var self=this;
  2110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2111. return $core.withContext(function($ctx1) {
  2112. //>>excludeEnd("ctx");
  2113. (
  2114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2115. $ctx1.supercall = true,
  2116. //>>excludeEnd("ctx");
  2117. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  2118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2119. $ctx1.supercall = false;
  2120. //>>excludeEnd("ctx");;
  2121. return anAssociativeCollection;
  2122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2123. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2124. //>>excludeEnd("ctx");
  2125. },
  2126. //>>excludeStart("ide", pragmas.excludeIdeData);
  2127. args: ["anAssociativeCollection"],
  2128. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2129. referencedClasses: [],
  2130. //>>excludeEnd("ide");
  2131. messageSends: ["addAll:", "associations"]
  2132. }),
  2133. $globals.AssociativeCollection);
  2134. $core.addMethod(
  2135. $core.method({
  2136. selector: "asDictionary",
  2137. protocol: 'converting',
  2138. fn: function (){
  2139. var self=this;
  2140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2141. return $core.withContext(function($ctx1) {
  2142. //>>excludeEnd("ctx");
  2143. return $recv($globals.Dictionary)._from_(self._associations());
  2144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2145. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2146. //>>excludeEnd("ctx");
  2147. },
  2148. //>>excludeStart("ide", pragmas.excludeIdeData);
  2149. args: [],
  2150. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2151. referencedClasses: ["Dictionary"],
  2152. //>>excludeEnd("ide");
  2153. messageSends: ["from:", "associations"]
  2154. }),
  2155. $globals.AssociativeCollection);
  2156. $core.addMethod(
  2157. $core.method({
  2158. selector: "asHashedCollection",
  2159. protocol: 'converting',
  2160. fn: function (){
  2161. var self=this;
  2162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2163. return $core.withContext(function($ctx1) {
  2164. //>>excludeEnd("ctx");
  2165. return $recv($globals.HashedCollection)._from_(self._associations());
  2166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2167. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2168. //>>excludeEnd("ctx");
  2169. },
  2170. //>>excludeStart("ide", pragmas.excludeIdeData);
  2171. args: [],
  2172. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2173. referencedClasses: ["HashedCollection"],
  2174. //>>excludeEnd("ide");
  2175. messageSends: ["from:", "associations"]
  2176. }),
  2177. $globals.AssociativeCollection);
  2178. $core.addMethod(
  2179. $core.method({
  2180. selector: "asJSON",
  2181. protocol: 'converting',
  2182. fn: function (){
  2183. var self=this;
  2184. var hash;
  2185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2186. return $core.withContext(function($ctx1) {
  2187. //>>excludeEnd("ctx");
  2188. hash=$recv($globals.HashedCollection)._new();
  2189. self._keysAndValuesDo_((function(key,value){
  2190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2191. return $core.withContext(function($ctx2) {
  2192. //>>excludeEnd("ctx");
  2193. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  2194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2195. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2196. //>>excludeEnd("ctx");
  2197. }));
  2198. return hash;
  2199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2200. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  2201. //>>excludeEnd("ctx");
  2202. },
  2203. //>>excludeStart("ide", pragmas.excludeIdeData);
  2204. args: [],
  2205. 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",
  2206. referencedClasses: ["HashedCollection"],
  2207. //>>excludeEnd("ide");
  2208. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  2209. }),
  2210. $globals.AssociativeCollection);
  2211. $core.addMethod(
  2212. $core.method({
  2213. selector: "associations",
  2214. protocol: 'accessing',
  2215. fn: function (){
  2216. var self=this;
  2217. var associations;
  2218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2219. return $core.withContext(function($ctx1) {
  2220. //>>excludeEnd("ctx");
  2221. associations=[];
  2222. self._associationsDo_((function(each){
  2223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2224. return $core.withContext(function($ctx2) {
  2225. //>>excludeEnd("ctx");
  2226. return $recv(associations)._add_(each);
  2227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2229. //>>excludeEnd("ctx");
  2230. }));
  2231. return associations;
  2232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2233. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2234. //>>excludeEnd("ctx");
  2235. },
  2236. //>>excludeStart("ide", pragmas.excludeIdeData);
  2237. args: [],
  2238. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2239. referencedClasses: [],
  2240. //>>excludeEnd("ide");
  2241. messageSends: ["associationsDo:", "add:"]
  2242. }),
  2243. $globals.AssociativeCollection);
  2244. $core.addMethod(
  2245. $core.method({
  2246. selector: "associationsDo:",
  2247. protocol: 'enumerating',
  2248. fn: function (aBlock){
  2249. var self=this;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. return $core.withContext(function($ctx1) {
  2252. //>>excludeEnd("ctx");
  2253. self._keysAndValuesDo_((function(key,value){
  2254. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2255. return $core.withContext(function($ctx2) {
  2256. //>>excludeEnd("ctx");
  2257. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  2258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2259. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2260. //>>excludeEnd("ctx");
  2261. }));
  2262. return self;
  2263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2264. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2265. //>>excludeEnd("ctx");
  2266. },
  2267. //>>excludeStart("ide", pragmas.excludeIdeData);
  2268. args: ["aBlock"],
  2269. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2270. referencedClasses: ["Association"],
  2271. //>>excludeEnd("ide");
  2272. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2273. }),
  2274. $globals.AssociativeCollection);
  2275. $core.addMethod(
  2276. $core.method({
  2277. selector: "at:ifPresent:ifAbsent:",
  2278. protocol: 'accessing',
  2279. fn: function (aKey,aBlock,anotherBlock){
  2280. var self=this;
  2281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2282. return $core.withContext(function($ctx1) {
  2283. //>>excludeEnd("ctx");
  2284. var $1;
  2285. $1=self._includesKey_(aKey);
  2286. if($core.assert($1)){
  2287. return $recv(aBlock)._value_(self._at_(aKey));
  2288. } else {
  2289. return $recv(anotherBlock)._value();
  2290. }
  2291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2292. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2293. //>>excludeEnd("ctx");
  2294. },
  2295. //>>excludeStart("ide", pragmas.excludeIdeData);
  2296. args: ["aKey", "aBlock", "anotherBlock"],
  2297. 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 ]",
  2298. referencedClasses: [],
  2299. //>>excludeEnd("ide");
  2300. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2301. }),
  2302. $globals.AssociativeCollection);
  2303. $core.addMethod(
  2304. $core.method({
  2305. selector: "collect:",
  2306. protocol: 'enumerating',
  2307. fn: function (aBlock){
  2308. var self=this;
  2309. var newDict;
  2310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2311. return $core.withContext(function($ctx1) {
  2312. //>>excludeEnd("ctx");
  2313. newDict=$recv(self._class())._new();
  2314. self._keysAndValuesDo_((function(key,value){
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. return $core.withContext(function($ctx2) {
  2317. //>>excludeEnd("ctx");
  2318. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2320. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2321. //>>excludeEnd("ctx");
  2322. }));
  2323. return newDict;
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2326. //>>excludeEnd("ctx");
  2327. },
  2328. //>>excludeStart("ide", pragmas.excludeIdeData);
  2329. args: ["aBlock"],
  2330. 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",
  2331. referencedClasses: [],
  2332. //>>excludeEnd("ide");
  2333. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2334. }),
  2335. $globals.AssociativeCollection);
  2336. $core.addMethod(
  2337. $core.method({
  2338. selector: "deepCopy",
  2339. protocol: 'copying',
  2340. fn: function (){
  2341. var self=this;
  2342. var copy;
  2343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2344. return $core.withContext(function($ctx1) {
  2345. //>>excludeEnd("ctx");
  2346. copy=$recv(self._class())._new();
  2347. self._keysAndValuesDo_((function(key,value){
  2348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2349. return $core.withContext(function($ctx2) {
  2350. //>>excludeEnd("ctx");
  2351. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2353. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2354. //>>excludeEnd("ctx");
  2355. }));
  2356. return copy;
  2357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2358. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2359. //>>excludeEnd("ctx");
  2360. },
  2361. //>>excludeStart("ide", pragmas.excludeIdeData);
  2362. args: [],
  2363. 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",
  2364. referencedClasses: [],
  2365. //>>excludeEnd("ide");
  2366. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2367. }),
  2368. $globals.AssociativeCollection);
  2369. $core.addMethod(
  2370. $core.method({
  2371. selector: "detect:ifNone:",
  2372. protocol: 'enumerating',
  2373. fn: function (aBlock,anotherBlock){
  2374. var self=this;
  2375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2376. return $core.withContext(function($ctx1) {
  2377. //>>excludeEnd("ctx");
  2378. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  2379. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2380. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2381. //>>excludeEnd("ctx");
  2382. },
  2383. //>>excludeStart("ide", pragmas.excludeIdeData);
  2384. args: ["aBlock", "anotherBlock"],
  2385. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2386. referencedClasses: [],
  2387. //>>excludeEnd("ide");
  2388. messageSends: ["detect:ifNone:", "values"]
  2389. }),
  2390. $globals.AssociativeCollection);
  2391. $core.addMethod(
  2392. $core.method({
  2393. selector: "do:",
  2394. protocol: 'enumerating',
  2395. fn: function (aBlock){
  2396. var self=this;
  2397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2398. return $core.withContext(function($ctx1) {
  2399. //>>excludeEnd("ctx");
  2400. self._valuesDo_(aBlock);
  2401. return self;
  2402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2403. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2404. //>>excludeEnd("ctx");
  2405. },
  2406. //>>excludeStart("ide", pragmas.excludeIdeData);
  2407. args: ["aBlock"],
  2408. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2409. referencedClasses: [],
  2410. //>>excludeEnd("ide");
  2411. messageSends: ["valuesDo:"]
  2412. }),
  2413. $globals.AssociativeCollection);
  2414. $core.addMethod(
  2415. $core.method({
  2416. selector: "includes:",
  2417. protocol: 'enumerating',
  2418. fn: function (anObject){
  2419. var self=this;
  2420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2421. return $core.withContext(function($ctx1) {
  2422. //>>excludeEnd("ctx");
  2423. return $recv(self._values())._includes_(anObject);
  2424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2425. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2426. //>>excludeEnd("ctx");
  2427. },
  2428. //>>excludeStart("ide", pragmas.excludeIdeData);
  2429. args: ["anObject"],
  2430. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2431. referencedClasses: [],
  2432. //>>excludeEnd("ide");
  2433. messageSends: ["includes:", "values"]
  2434. }),
  2435. $globals.AssociativeCollection);
  2436. $core.addMethod(
  2437. $core.method({
  2438. selector: "includesKey:",
  2439. protocol: 'testing',
  2440. fn: function (aKey){
  2441. var self=this;
  2442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2443. return $core.withContext(function($ctx1) {
  2444. //>>excludeEnd("ctx");
  2445. self._subclassResponsibility();
  2446. return self;
  2447. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2448. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2449. //>>excludeEnd("ctx");
  2450. },
  2451. //>>excludeStart("ide", pragmas.excludeIdeData);
  2452. args: ["aKey"],
  2453. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2454. referencedClasses: [],
  2455. //>>excludeEnd("ide");
  2456. messageSends: ["subclassResponsibility"]
  2457. }),
  2458. $globals.AssociativeCollection);
  2459. $core.addMethod(
  2460. $core.method({
  2461. selector: "indexOf:ifAbsent:",
  2462. protocol: 'accessing',
  2463. fn: function (anObject,aBlock){
  2464. var self=this;
  2465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2466. return $core.withContext(function($ctx1) {
  2467. //>>excludeEnd("ctx");
  2468. return $recv(self._keys())._detect_ifNone_((function(each){
  2469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2470. return $core.withContext(function($ctx2) {
  2471. //>>excludeEnd("ctx");
  2472. return $recv(self._at_(each)).__eq(anObject);
  2473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2474. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2475. //>>excludeEnd("ctx");
  2476. }),aBlock);
  2477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2478. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2479. //>>excludeEnd("ctx");
  2480. },
  2481. //>>excludeStart("ide", pragmas.excludeIdeData);
  2482. args: ["anObject", "aBlock"],
  2483. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2484. referencedClasses: [],
  2485. //>>excludeEnd("ide");
  2486. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2487. }),
  2488. $globals.AssociativeCollection);
  2489. $core.addMethod(
  2490. $core.method({
  2491. selector: "keyAtValue:",
  2492. protocol: 'accessing',
  2493. fn: function (anObject){
  2494. var self=this;
  2495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2496. return $core.withContext(function($ctx1) {
  2497. //>>excludeEnd("ctx");
  2498. return self._keyAtValue_ifAbsent_(anObject,(function(){
  2499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2500. return $core.withContext(function($ctx2) {
  2501. //>>excludeEnd("ctx");
  2502. return self._errorNotFound();
  2503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2505. //>>excludeEnd("ctx");
  2506. }));
  2507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2508. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2509. //>>excludeEnd("ctx");
  2510. },
  2511. //>>excludeStart("ide", pragmas.excludeIdeData);
  2512. args: ["anObject"],
  2513. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2514. referencedClasses: [],
  2515. //>>excludeEnd("ide");
  2516. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2517. }),
  2518. $globals.AssociativeCollection);
  2519. $core.addMethod(
  2520. $core.method({
  2521. selector: "keyAtValue:ifAbsent:",
  2522. protocol: 'accessing',
  2523. fn: function (anObject,aBlock){
  2524. var self=this;
  2525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2526. return $core.withContext(function($ctx1) {
  2527. //>>excludeEnd("ctx");
  2528. return self._indexOf_ifAbsent_(anObject,aBlock);
  2529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2530. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2531. //>>excludeEnd("ctx");
  2532. },
  2533. //>>excludeStart("ide", pragmas.excludeIdeData);
  2534. args: ["anObject", "aBlock"],
  2535. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2536. referencedClasses: [],
  2537. //>>excludeEnd("ide");
  2538. messageSends: ["indexOf:ifAbsent:"]
  2539. }),
  2540. $globals.AssociativeCollection);
  2541. $core.addMethod(
  2542. $core.method({
  2543. selector: "keys",
  2544. protocol: 'accessing',
  2545. fn: function (){
  2546. var self=this;
  2547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2548. return $core.withContext(function($ctx1) {
  2549. //>>excludeEnd("ctx");
  2550. self._subclassResponsibility();
  2551. return self;
  2552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2553. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2554. //>>excludeEnd("ctx");
  2555. },
  2556. //>>excludeStart("ide", pragmas.excludeIdeData);
  2557. args: [],
  2558. source: "keys\x0a\x09self subclassResponsibility",
  2559. referencedClasses: [],
  2560. //>>excludeEnd("ide");
  2561. messageSends: ["subclassResponsibility"]
  2562. }),
  2563. $globals.AssociativeCollection);
  2564. $core.addMethod(
  2565. $core.method({
  2566. selector: "keysAndValuesDo:",
  2567. protocol: 'enumerating',
  2568. fn: function (aBlock){
  2569. var self=this;
  2570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2571. return $core.withContext(function($ctx1) {
  2572. //>>excludeEnd("ctx");
  2573. self._keysDo_((function(each){
  2574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2575. return $core.withContext(function($ctx2) {
  2576. //>>excludeEnd("ctx");
  2577. return $recv(aBlock)._value_value_(each,self._at_(each));
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2580. //>>excludeEnd("ctx");
  2581. }));
  2582. return self;
  2583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2584. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2585. //>>excludeEnd("ctx");
  2586. },
  2587. //>>excludeStart("ide", pragmas.excludeIdeData);
  2588. args: ["aBlock"],
  2589. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2590. referencedClasses: [],
  2591. //>>excludeEnd("ide");
  2592. messageSends: ["keysDo:", "value:value:", "at:"]
  2593. }),
  2594. $globals.AssociativeCollection);
  2595. $core.addMethod(
  2596. $core.method({
  2597. selector: "keysDo:",
  2598. protocol: 'enumerating',
  2599. fn: function (aBlock){
  2600. var self=this;
  2601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2602. return $core.withContext(function($ctx1) {
  2603. //>>excludeEnd("ctx");
  2604. self._subclassResponsibility();
  2605. return self;
  2606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2607. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2608. //>>excludeEnd("ctx");
  2609. },
  2610. //>>excludeStart("ide", pragmas.excludeIdeData);
  2611. args: ["aBlock"],
  2612. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2613. referencedClasses: [],
  2614. //>>excludeEnd("ide");
  2615. messageSends: ["subclassResponsibility"]
  2616. }),
  2617. $globals.AssociativeCollection);
  2618. $core.addMethod(
  2619. $core.method({
  2620. selector: "printOn:",
  2621. protocol: 'printing',
  2622. fn: function (aStream){
  2623. var self=this;
  2624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2625. return $core.withContext(function($ctx1) {
  2626. //>>excludeEnd("ctx");
  2627. (
  2628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2629. $ctx1.supercall = true,
  2630. //>>excludeEnd("ctx");
  2631. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  2632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2633. $ctx1.supercall = false;
  2634. //>>excludeEnd("ctx");;
  2635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2636. $ctx1.sendIdx["printOn:"]=1;
  2637. //>>excludeEnd("ctx");
  2638. $recv(aStream)._nextPutAll_(" (");
  2639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2640. $ctx1.sendIdx["nextPutAll:"]=1;
  2641. //>>excludeEnd("ctx");
  2642. $recv(self._associations())._do_separatedBy_((function(each){
  2643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2644. return $core.withContext(function($ctx2) {
  2645. //>>excludeEnd("ctx");
  2646. return $recv(each)._printOn_(aStream);
  2647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2649. //>>excludeEnd("ctx");
  2650. }),(function(){
  2651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2652. return $core.withContext(function($ctx2) {
  2653. //>>excludeEnd("ctx");
  2654. return $recv(aStream)._nextPutAll_(" , ");
  2655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2656. $ctx2.sendIdx["nextPutAll:"]=2;
  2657. //>>excludeEnd("ctx");
  2658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2659. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2660. //>>excludeEnd("ctx");
  2661. }));
  2662. $recv(aStream)._nextPutAll_(")");
  2663. return self;
  2664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2665. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2666. //>>excludeEnd("ctx");
  2667. },
  2668. //>>excludeStart("ide", pragmas.excludeIdeData);
  2669. args: ["aStream"],
  2670. 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: ')'",
  2671. referencedClasses: [],
  2672. //>>excludeEnd("ide");
  2673. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2674. }),
  2675. $globals.AssociativeCollection);
  2676. $core.addMethod(
  2677. $core.method({
  2678. selector: "remove:ifAbsent:",
  2679. protocol: 'adding/removing',
  2680. fn: function (aKey,aBlock){
  2681. var self=this;
  2682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2683. return $core.withContext(function($ctx1) {
  2684. //>>excludeEnd("ctx");
  2685. return self._removeKey_ifAbsent_(aKey,aBlock);
  2686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2687. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2688. //>>excludeEnd("ctx");
  2689. },
  2690. //>>excludeStart("ide", pragmas.excludeIdeData);
  2691. args: ["aKey", "aBlock"],
  2692. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2693. referencedClasses: [],
  2694. //>>excludeEnd("ide");
  2695. messageSends: ["removeKey:ifAbsent:"]
  2696. }),
  2697. $globals.AssociativeCollection);
  2698. $core.addMethod(
  2699. $core.method({
  2700. selector: "removeAll",
  2701. protocol: 'adding/removing',
  2702. fn: function (){
  2703. var self=this;
  2704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2705. return $core.withContext(function($ctx1) {
  2706. //>>excludeEnd("ctx");
  2707. return $recv(self._keys())._do_((function(each){
  2708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2709. return $core.withContext(function($ctx2) {
  2710. //>>excludeEnd("ctx");
  2711. return self._removeKey_(each);
  2712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2713. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2714. //>>excludeEnd("ctx");
  2715. }));
  2716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2717. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2718. //>>excludeEnd("ctx");
  2719. },
  2720. //>>excludeStart("ide", pragmas.excludeIdeData);
  2721. args: [],
  2722. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2723. referencedClasses: [],
  2724. //>>excludeEnd("ide");
  2725. messageSends: ["do:", "keys", "removeKey:"]
  2726. }),
  2727. $globals.AssociativeCollection);
  2728. $core.addMethod(
  2729. $core.method({
  2730. selector: "removeKey:",
  2731. protocol: 'adding/removing',
  2732. fn: function (aKey){
  2733. var self=this;
  2734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2735. return $core.withContext(function($ctx1) {
  2736. //>>excludeEnd("ctx");
  2737. return self._remove_(aKey);
  2738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2739. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2740. //>>excludeEnd("ctx");
  2741. },
  2742. //>>excludeStart("ide", pragmas.excludeIdeData);
  2743. args: ["aKey"],
  2744. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2745. referencedClasses: [],
  2746. //>>excludeEnd("ide");
  2747. messageSends: ["remove:"]
  2748. }),
  2749. $globals.AssociativeCollection);
  2750. $core.addMethod(
  2751. $core.method({
  2752. selector: "removeKey:ifAbsent:",
  2753. protocol: 'adding/removing',
  2754. fn: function (aKey,aBlock){
  2755. var self=this;
  2756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2757. return $core.withContext(function($ctx1) {
  2758. //>>excludeEnd("ctx");
  2759. self._subclassResponsibility();
  2760. return self;
  2761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2762. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2763. //>>excludeEnd("ctx");
  2764. },
  2765. //>>excludeStart("ide", pragmas.excludeIdeData);
  2766. args: ["aKey", "aBlock"],
  2767. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2768. referencedClasses: [],
  2769. //>>excludeEnd("ide");
  2770. messageSends: ["subclassResponsibility"]
  2771. }),
  2772. $globals.AssociativeCollection);
  2773. $core.addMethod(
  2774. $core.method({
  2775. selector: "select:",
  2776. protocol: 'enumerating',
  2777. fn: function (aBlock){
  2778. var self=this;
  2779. var newDict;
  2780. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2781. return $core.withContext(function($ctx1) {
  2782. //>>excludeEnd("ctx");
  2783. var $1;
  2784. newDict=$recv(self._class())._new();
  2785. self._keysAndValuesDo_((function(key,value){
  2786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2787. return $core.withContext(function($ctx2) {
  2788. //>>excludeEnd("ctx");
  2789. $1=$recv(aBlock)._value_(value);
  2790. if($core.assert($1)){
  2791. return $recv(newDict)._at_put_(key,value);
  2792. }
  2793. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2794. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2795. //>>excludeEnd("ctx");
  2796. }));
  2797. return newDict;
  2798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2799. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2800. //>>excludeEnd("ctx");
  2801. },
  2802. //>>excludeStart("ide", pragmas.excludeIdeData);
  2803. args: ["aBlock"],
  2804. 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",
  2805. referencedClasses: [],
  2806. //>>excludeEnd("ide");
  2807. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2808. }),
  2809. $globals.AssociativeCollection);
  2810. $core.addMethod(
  2811. $core.method({
  2812. selector: "shallowCopy",
  2813. protocol: 'copying',
  2814. fn: function (){
  2815. var self=this;
  2816. var copy;
  2817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2818. return $core.withContext(function($ctx1) {
  2819. //>>excludeEnd("ctx");
  2820. copy=$recv(self._class())._new();
  2821. self._keysAndValuesDo_((function(key,value){
  2822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2823. return $core.withContext(function($ctx2) {
  2824. //>>excludeEnd("ctx");
  2825. return $recv(copy)._at_put_(key,value);
  2826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2827. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2828. //>>excludeEnd("ctx");
  2829. }));
  2830. return copy;
  2831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2832. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2833. //>>excludeEnd("ctx");
  2834. },
  2835. //>>excludeStart("ide", pragmas.excludeIdeData);
  2836. args: [],
  2837. 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",
  2838. referencedClasses: [],
  2839. //>>excludeEnd("ide");
  2840. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2841. }),
  2842. $globals.AssociativeCollection);
  2843. $core.addMethod(
  2844. $core.method({
  2845. selector: "size",
  2846. protocol: 'accessing',
  2847. fn: function (){
  2848. var self=this;
  2849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2850. return $core.withContext(function($ctx1) {
  2851. //>>excludeEnd("ctx");
  2852. return $recv(self._keys())._size();
  2853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2854. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2855. //>>excludeEnd("ctx");
  2856. },
  2857. //>>excludeStart("ide", pragmas.excludeIdeData);
  2858. args: [],
  2859. source: "size\x0a\x09^ self keys size",
  2860. referencedClasses: [],
  2861. //>>excludeEnd("ide");
  2862. messageSends: ["size", "keys"]
  2863. }),
  2864. $globals.AssociativeCollection);
  2865. $core.addMethod(
  2866. $core.method({
  2867. selector: "values",
  2868. protocol: 'accessing',
  2869. fn: function (){
  2870. var self=this;
  2871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2872. return $core.withContext(function($ctx1) {
  2873. //>>excludeEnd("ctx");
  2874. self._subclassResponsibility();
  2875. return self;
  2876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2877. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2878. //>>excludeEnd("ctx");
  2879. },
  2880. //>>excludeStart("ide", pragmas.excludeIdeData);
  2881. args: [],
  2882. source: "values\x0a\x09self subclassResponsibility",
  2883. referencedClasses: [],
  2884. //>>excludeEnd("ide");
  2885. messageSends: ["subclassResponsibility"]
  2886. }),
  2887. $globals.AssociativeCollection);
  2888. $core.addMethod(
  2889. $core.method({
  2890. selector: "valuesDo:",
  2891. protocol: 'enumerating',
  2892. fn: function (aBlock){
  2893. var self=this;
  2894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2895. return $core.withContext(function($ctx1) {
  2896. //>>excludeEnd("ctx");
  2897. self._subclassResponsibility();
  2898. return self;
  2899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2900. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2901. //>>excludeEnd("ctx");
  2902. },
  2903. //>>excludeStart("ide", pragmas.excludeIdeData);
  2904. args: ["aBlock"],
  2905. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2906. referencedClasses: [],
  2907. //>>excludeEnd("ide");
  2908. messageSends: ["subclassResponsibility"]
  2909. }),
  2910. $globals.AssociativeCollection);
  2911. $core.addMethod(
  2912. $core.method({
  2913. selector: "withIndexDo:",
  2914. protocol: 'enumerating',
  2915. fn: function (aBlock){
  2916. var self=this;
  2917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2918. return $core.withContext(function($ctx1) {
  2919. //>>excludeEnd("ctx");
  2920. self._keysAndValuesDo_((function(key,value){
  2921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2922. return $core.withContext(function($ctx2) {
  2923. //>>excludeEnd("ctx");
  2924. return $recv(aBlock)._value_value_(value,key);
  2925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2926. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2927. //>>excludeEnd("ctx");
  2928. }));
  2929. return self;
  2930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2931. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2932. //>>excludeEnd("ctx");
  2933. },
  2934. //>>excludeStart("ide", pragmas.excludeIdeData);
  2935. args: ["aBlock"],
  2936. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2937. referencedClasses: [],
  2938. //>>excludeEnd("ide");
  2939. messageSends: ["keysAndValuesDo:", "value:value:"]
  2940. }),
  2941. $globals.AssociativeCollection);
  2942. $core.addMethod(
  2943. $core.method({
  2944. selector: "from:",
  2945. protocol: 'instance creation',
  2946. fn: function (aCollection){
  2947. var self=this;
  2948. var newCollection;
  2949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2950. return $core.withContext(function($ctx1) {
  2951. //>>excludeEnd("ctx");
  2952. newCollection=self._new();
  2953. $recv(aCollection)._do_((function(each){
  2954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2955. return $core.withContext(function($ctx2) {
  2956. //>>excludeEnd("ctx");
  2957. return $recv(newCollection)._add_(each);
  2958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2959. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2960. //>>excludeEnd("ctx");
  2961. }));
  2962. return newCollection;
  2963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2964. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  2965. //>>excludeEnd("ctx");
  2966. },
  2967. //>>excludeStart("ide", pragmas.excludeIdeData);
  2968. args: ["aCollection"],
  2969. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2970. referencedClasses: [],
  2971. //>>excludeEnd("ide");
  2972. messageSends: ["new", "do:", "add:"]
  2973. }),
  2974. $globals.AssociativeCollection.klass);
  2975. $core.addMethod(
  2976. $core.method({
  2977. selector: "fromPairs:",
  2978. protocol: 'instance creation',
  2979. fn: function (aCollection){
  2980. var self=this;
  2981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2982. return $core.withContext(function($ctx1) {
  2983. //>>excludeEnd("ctx");
  2984. return self._from_(aCollection);
  2985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2986. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  2987. //>>excludeEnd("ctx");
  2988. },
  2989. //>>excludeStart("ide", pragmas.excludeIdeData);
  2990. args: ["aCollection"],
  2991. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2992. referencedClasses: [],
  2993. //>>excludeEnd("ide");
  2994. messageSends: ["from:"]
  2995. }),
  2996. $globals.AssociativeCollection.klass);
  2997. $core.addMethod(
  2998. $core.method({
  2999. selector: "newFromPairs:",
  3000. protocol: 'instance creation',
  3001. fn: function (aCollection){
  3002. var self=this;
  3003. var newCollection;
  3004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3005. return $core.withContext(function($ctx1) {
  3006. //>>excludeEnd("ctx");
  3007. var $2,$1,$3,$4;
  3008. $2=$recv(aCollection)._size();
  3009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3010. $ctx1.sendIdx["size"]=1;
  3011. //>>excludeEnd("ctx");
  3012. $1=$recv($2)._even();
  3013. if(!$core.assert($1)){
  3014. self._error_("#newFromPairs only accepts arrays of an even length");
  3015. }
  3016. newCollection=self._new();
  3017. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  3018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3019. return $core.withContext(function($ctx2) {
  3020. //>>excludeEnd("ctx");
  3021. $3=newCollection;
  3022. $4=$recv(aCollection)._at_(each);
  3023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3024. $ctx2.sendIdx["at:"]=1;
  3025. //>>excludeEnd("ctx");
  3026. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  3027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3029. //>>excludeEnd("ctx");
  3030. }));
  3031. return newCollection;
  3032. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3033. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  3034. //>>excludeEnd("ctx");
  3035. },
  3036. //>>excludeStart("ide", pragmas.excludeIdeData);
  3037. args: ["aCollection"],
  3038. 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",
  3039. referencedClasses: [],
  3040. //>>excludeEnd("ide");
  3041. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3042. }),
  3043. $globals.AssociativeCollection.klass);
  3044. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  3045. //>>excludeStart("ide", pragmas.excludeIdeData);
  3046. $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.";
  3047. //>>excludeEnd("ide");
  3048. $core.addMethod(
  3049. $core.method({
  3050. selector: "at:ifAbsent:",
  3051. protocol: 'accessing',
  3052. fn: function (aKey,aBlock){
  3053. var self=this;
  3054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3055. return $core.withContext(function($ctx1) {
  3056. //>>excludeEnd("ctx");
  3057. var index = self._positionOfKey_(aKey);
  3058. return index >=0 ? self['@values'][index] : aBlock._value();
  3059. ;
  3060. return self;
  3061. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3062. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3063. //>>excludeEnd("ctx");
  3064. },
  3065. //>>excludeStart("ide", pragmas.excludeIdeData);
  3066. args: ["aKey", "aBlock"],
  3067. 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'>",
  3068. referencedClasses: [],
  3069. //>>excludeEnd("ide");
  3070. messageSends: []
  3071. }),
  3072. $globals.Dictionary);
  3073. $core.addMethod(
  3074. $core.method({
  3075. selector: "at:put:",
  3076. protocol: 'accessing',
  3077. fn: function (aKey,aValue){
  3078. var self=this;
  3079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3080. return $core.withContext(function($ctx1) {
  3081. //>>excludeEnd("ctx");
  3082. var index = self._positionOfKey_(aKey);
  3083. if(index === -1) {
  3084. var keys = self['@keys'];
  3085. index = keys.length;
  3086. keys.push(aKey);
  3087. }
  3088. return self['@values'][index] = aValue;
  3089. ;
  3090. return self;
  3091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3092. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3093. //>>excludeEnd("ctx");
  3094. },
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. args: ["aKey", "aValue"],
  3097. 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'>",
  3098. referencedClasses: [],
  3099. //>>excludeEnd("ide");
  3100. messageSends: []
  3101. }),
  3102. $globals.Dictionary);
  3103. $core.addMethod(
  3104. $core.method({
  3105. selector: "includesKey:",
  3106. protocol: 'testing',
  3107. fn: function (aKey){
  3108. var self=this;
  3109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3110. return $core.withContext(function($ctx1) {
  3111. //>>excludeEnd("ctx");
  3112. return self._positionOfKey_(aKey) >= 0;;
  3113. return self;
  3114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3115. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3116. //>>excludeEnd("ctx");
  3117. },
  3118. //>>excludeStart("ide", pragmas.excludeIdeData);
  3119. args: ["aKey"],
  3120. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self._positionOfKey_(aKey) >= 0;'>",
  3121. referencedClasses: [],
  3122. //>>excludeEnd("ide");
  3123. messageSends: []
  3124. }),
  3125. $globals.Dictionary);
  3126. $core.addMethod(
  3127. $core.method({
  3128. selector: "indexOf:ifAbsent:",
  3129. protocol: 'accessing',
  3130. fn: function (anObject,aBlock){
  3131. var self=this;
  3132. var index;
  3133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3134. return $core.withContext(function($ctx1) {
  3135. //>>excludeEnd("ctx");
  3136. var $1;
  3137. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3138. return (0);
  3139. }));
  3140. $1=$recv(index).__eq((0));
  3141. if($core.assert($1)){
  3142. return $recv(aBlock)._value();
  3143. } else {
  3144. return $recv(self["@keys"])._at_(index);
  3145. }
  3146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3147. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3148. //>>excludeEnd("ctx");
  3149. },
  3150. //>>excludeStart("ide", pragmas.excludeIdeData);
  3151. args: ["anObject", "aBlock"],
  3152. 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 ]",
  3153. referencedClasses: [],
  3154. //>>excludeEnd("ide");
  3155. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3156. }),
  3157. $globals.Dictionary);
  3158. $core.addMethod(
  3159. $core.method({
  3160. selector: "initialize",
  3161. protocol: 'initialization',
  3162. fn: function (){
  3163. var self=this;
  3164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3165. return $core.withContext(function($ctx1) {
  3166. //>>excludeEnd("ctx");
  3167. (
  3168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3169. $ctx1.supercall = true,
  3170. //>>excludeEnd("ctx");
  3171. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  3172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3173. $ctx1.supercall = false;
  3174. //>>excludeEnd("ctx");;
  3175. self["@keys"]=[];
  3176. self["@values"]=[];
  3177. return self;
  3178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3179. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3180. //>>excludeEnd("ctx");
  3181. },
  3182. //>>excludeStart("ide", pragmas.excludeIdeData);
  3183. args: [],
  3184. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3185. referencedClasses: [],
  3186. //>>excludeEnd("ide");
  3187. messageSends: ["initialize"]
  3188. }),
  3189. $globals.Dictionary);
  3190. $core.addMethod(
  3191. $core.method({
  3192. selector: "keys",
  3193. protocol: 'accessing',
  3194. fn: function (){
  3195. var self=this;
  3196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3197. return $core.withContext(function($ctx1) {
  3198. //>>excludeEnd("ctx");
  3199. return $recv(self["@keys"])._copy();
  3200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3201. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3202. //>>excludeEnd("ctx");
  3203. },
  3204. //>>excludeStart("ide", pragmas.excludeIdeData);
  3205. args: [],
  3206. source: "keys\x0a\x09^ keys copy",
  3207. referencedClasses: [],
  3208. //>>excludeEnd("ide");
  3209. messageSends: ["copy"]
  3210. }),
  3211. $globals.Dictionary);
  3212. $core.addMethod(
  3213. $core.method({
  3214. selector: "keysAndValuesDo:",
  3215. protocol: 'enumerating',
  3216. fn: function (aBlock){
  3217. var self=this;
  3218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3219. return $core.withContext(function($ctx1) {
  3220. //>>excludeEnd("ctx");
  3221. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  3222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3223. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3224. //>>excludeEnd("ctx");
  3225. },
  3226. //>>excludeStart("ide", pragmas.excludeIdeData);
  3227. args: ["aBlock"],
  3228. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3229. referencedClasses: [],
  3230. //>>excludeEnd("ide");
  3231. messageSends: ["with:do:"]
  3232. }),
  3233. $globals.Dictionary);
  3234. $core.addMethod(
  3235. $core.method({
  3236. selector: "keysDo:",
  3237. protocol: 'enumerating',
  3238. fn: function (aBlock){
  3239. var self=this;
  3240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3241. return $core.withContext(function($ctx1) {
  3242. //>>excludeEnd("ctx");
  3243. return $recv(self["@keys"])._do_(aBlock);
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3246. //>>excludeEnd("ctx");
  3247. },
  3248. //>>excludeStart("ide", pragmas.excludeIdeData);
  3249. args: ["aBlock"],
  3250. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3251. referencedClasses: [],
  3252. //>>excludeEnd("ide");
  3253. messageSends: ["do:"]
  3254. }),
  3255. $globals.Dictionary);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "positionOfKey:",
  3259. protocol: 'private',
  3260. fn: function (anObject){
  3261. var self=this;
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. return $core.withContext(function($ctx1) {
  3264. //>>excludeEnd("ctx");
  3265. var keys = self['@keys'];
  3266. for(var i=0;i<keys.length;i++){
  3267. if(keys[i].__eq(anObject)) { return i;}
  3268. }
  3269. return -1;
  3270. ;
  3271. return self;
  3272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3273. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3274. //>>excludeEnd("ctx");
  3275. },
  3276. //>>excludeStart("ide", pragmas.excludeIdeData);
  3277. args: ["anObject"],
  3278. 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'>",
  3279. referencedClasses: [],
  3280. //>>excludeEnd("ide");
  3281. messageSends: []
  3282. }),
  3283. $globals.Dictionary);
  3284. $core.addMethod(
  3285. $core.method({
  3286. selector: "removeAll",
  3287. protocol: 'adding/removing',
  3288. fn: function (){
  3289. var self=this;
  3290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3291. return $core.withContext(function($ctx1) {
  3292. //>>excludeEnd("ctx");
  3293. $recv(self["@keys"])._removeAll();
  3294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3295. $ctx1.sendIdx["removeAll"]=1;
  3296. //>>excludeEnd("ctx");
  3297. $recv(self["@values"])._removeAll();
  3298. return self;
  3299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3300. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3301. //>>excludeEnd("ctx");
  3302. },
  3303. //>>excludeStart("ide", pragmas.excludeIdeData);
  3304. args: [],
  3305. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3306. referencedClasses: [],
  3307. //>>excludeEnd("ide");
  3308. messageSends: ["removeAll"]
  3309. }),
  3310. $globals.Dictionary);
  3311. $core.addMethod(
  3312. $core.method({
  3313. selector: "removeKey:ifAbsent:",
  3314. protocol: 'adding/removing',
  3315. fn: function (aKey,aBlock){
  3316. var self=this;
  3317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3318. return $core.withContext(function($ctx1) {
  3319. //>>excludeEnd("ctx");
  3320. var index = self._positionOfKey_(aKey);
  3321. if(index === -1) {
  3322. return aBlock._value()
  3323. } else {
  3324. var keys = self['@keys'], values = self['@values'];
  3325. var value = values[index], l = keys.length;
  3326. keys[index] = keys[l-1];
  3327. keys.pop();
  3328. values[index] = values[l-1];
  3329. values.pop();
  3330. return value;
  3331. }
  3332. ;
  3333. return self;
  3334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3335. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3336. //>>excludeEnd("ctx");
  3337. },
  3338. //>>excludeStart("ide", pragmas.excludeIdeData);
  3339. args: ["aKey", "aBlock"],
  3340. 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'>",
  3341. referencedClasses: [],
  3342. //>>excludeEnd("ide");
  3343. messageSends: []
  3344. }),
  3345. $globals.Dictionary);
  3346. $core.addMethod(
  3347. $core.method({
  3348. selector: "values",
  3349. protocol: 'accessing',
  3350. fn: function (){
  3351. var self=this;
  3352. return self["@values"];
  3353. },
  3354. //>>excludeStart("ide", pragmas.excludeIdeData);
  3355. args: [],
  3356. source: "values\x0a\x09^ values",
  3357. referencedClasses: [],
  3358. //>>excludeEnd("ide");
  3359. messageSends: []
  3360. }),
  3361. $globals.Dictionary);
  3362. $core.addMethod(
  3363. $core.method({
  3364. selector: "valuesDo:",
  3365. protocol: 'enumerating',
  3366. fn: function (aBlock){
  3367. var self=this;
  3368. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3369. return $core.withContext(function($ctx1) {
  3370. //>>excludeEnd("ctx");
  3371. return $recv(self["@values"])._do_(aBlock);
  3372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3373. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3374. //>>excludeEnd("ctx");
  3375. },
  3376. //>>excludeStart("ide", pragmas.excludeIdeData);
  3377. args: ["aBlock"],
  3378. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3379. referencedClasses: [],
  3380. //>>excludeEnd("ide");
  3381. messageSends: ["do:"]
  3382. }),
  3383. $globals.Dictionary);
  3384. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  3385. //>>excludeStart("ide", pragmas.excludeIdeData);
  3386. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3387. //>>excludeEnd("ide");
  3388. $core.addMethod(
  3389. $core.method({
  3390. selector: "at:ifAbsent:",
  3391. protocol: 'accessing',
  3392. fn: function (aKey,aBlock){
  3393. var self=this;
  3394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3395. return $core.withContext(function($ctx1) {
  3396. //>>excludeEnd("ctx");
  3397. var $1;
  3398. $1=self._includesKey_(aKey);
  3399. if($core.assert($1)){
  3400. return self._basicAt_(aKey);
  3401. } else {
  3402. return $recv(aBlock)._value();
  3403. }
  3404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3405. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3406. //>>excludeEnd("ctx");
  3407. },
  3408. //>>excludeStart("ide", pragmas.excludeIdeData);
  3409. args: ["aKey", "aBlock"],
  3410. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3411. referencedClasses: [],
  3412. //>>excludeEnd("ide");
  3413. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3414. }),
  3415. $globals.HashedCollection);
  3416. $core.addMethod(
  3417. $core.method({
  3418. selector: "at:put:",
  3419. protocol: 'accessing',
  3420. fn: function (aKey,aValue){
  3421. var self=this;
  3422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3423. return $core.withContext(function($ctx1) {
  3424. //>>excludeEnd("ctx");
  3425. return self._basicAt_put_(aKey,aValue);
  3426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3427. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3428. //>>excludeEnd("ctx");
  3429. },
  3430. //>>excludeStart("ide", pragmas.excludeIdeData);
  3431. args: ["aKey", "aValue"],
  3432. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3433. referencedClasses: [],
  3434. //>>excludeEnd("ide");
  3435. messageSends: ["basicAt:put:"]
  3436. }),
  3437. $globals.HashedCollection);
  3438. $core.addMethod(
  3439. $core.method({
  3440. selector: "includesKey:",
  3441. protocol: 'testing',
  3442. fn: function (aKey){
  3443. var self=this;
  3444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3445. return $core.withContext(function($ctx1) {
  3446. //>>excludeEnd("ctx");
  3447. return self.hasOwnProperty(aKey);
  3448. return self;
  3449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3450. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3451. //>>excludeEnd("ctx");
  3452. },
  3453. //>>excludeStart("ide", pragmas.excludeIdeData);
  3454. args: ["aKey"],
  3455. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  3456. referencedClasses: [],
  3457. //>>excludeEnd("ide");
  3458. messageSends: []
  3459. }),
  3460. $globals.HashedCollection);
  3461. $core.addMethod(
  3462. $core.method({
  3463. selector: "keys",
  3464. protocol: 'accessing',
  3465. fn: function (){
  3466. var self=this;
  3467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3468. return $core.withContext(function($ctx1) {
  3469. //>>excludeEnd("ctx");
  3470. return Object.keys(self);
  3471. return self;
  3472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3473. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3474. //>>excludeEnd("ctx");
  3475. },
  3476. //>>excludeStart("ide", pragmas.excludeIdeData);
  3477. args: [],
  3478. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  3479. referencedClasses: [],
  3480. //>>excludeEnd("ide");
  3481. messageSends: []
  3482. }),
  3483. $globals.HashedCollection);
  3484. $core.addMethod(
  3485. $core.method({
  3486. selector: "keysDo:",
  3487. protocol: 'enumerating',
  3488. fn: function (aBlock){
  3489. var self=this;
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. return $core.withContext(function($ctx1) {
  3492. //>>excludeEnd("ctx");
  3493. $recv(self._keys())._do_(aBlock);
  3494. return self;
  3495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3496. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3497. //>>excludeEnd("ctx");
  3498. },
  3499. //>>excludeStart("ide", pragmas.excludeIdeData);
  3500. args: ["aBlock"],
  3501. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3502. referencedClasses: [],
  3503. //>>excludeEnd("ide");
  3504. messageSends: ["do:", "keys"]
  3505. }),
  3506. $globals.HashedCollection);
  3507. $core.addMethod(
  3508. $core.method({
  3509. selector: "removeKey:ifAbsent:",
  3510. protocol: 'adding/removing',
  3511. fn: function (aKey,aBlock){
  3512. var self=this;
  3513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3514. return $core.withContext(function($ctx1) {
  3515. //>>excludeEnd("ctx");
  3516. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3518. return $core.withContext(function($ctx2) {
  3519. //>>excludeEnd("ctx");
  3520. self._basicDelete_(aKey);
  3521. return removed;
  3522. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3523. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3524. //>>excludeEnd("ctx");
  3525. }),(function(){
  3526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3527. return $core.withContext(function($ctx2) {
  3528. //>>excludeEnd("ctx");
  3529. return $recv(aBlock)._value();
  3530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3532. //>>excludeEnd("ctx");
  3533. }));
  3534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3535. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3536. //>>excludeEnd("ctx");
  3537. },
  3538. //>>excludeStart("ide", pragmas.excludeIdeData);
  3539. args: ["aKey", "aBlock"],
  3540. 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 ]",
  3541. referencedClasses: [],
  3542. //>>excludeEnd("ide");
  3543. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3544. }),
  3545. $globals.HashedCollection);
  3546. $core.addMethod(
  3547. $core.method({
  3548. selector: "values",
  3549. protocol: 'accessing',
  3550. fn: function (){
  3551. var self=this;
  3552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3553. return $core.withContext(function($ctx1) {
  3554. //>>excludeEnd("ctx");
  3555. return self._keys().map(function(key){
  3556. return self._at_(key);
  3557. });
  3558. ;
  3559. return self;
  3560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3561. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3562. //>>excludeEnd("ctx");
  3563. },
  3564. //>>excludeStart("ide", pragmas.excludeIdeData);
  3565. args: [],
  3566. 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'>",
  3567. referencedClasses: [],
  3568. //>>excludeEnd("ide");
  3569. messageSends: []
  3570. }),
  3571. $globals.HashedCollection);
  3572. $core.addMethod(
  3573. $core.method({
  3574. selector: "valuesDo:",
  3575. protocol: 'enumerating',
  3576. fn: function (aBlock){
  3577. var self=this;
  3578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3579. return $core.withContext(function($ctx1) {
  3580. //>>excludeEnd("ctx");
  3581. $recv(self._values())._do_(aBlock);
  3582. return self;
  3583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3584. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3585. //>>excludeEnd("ctx");
  3586. },
  3587. //>>excludeStart("ide", pragmas.excludeIdeData);
  3588. args: ["aBlock"],
  3589. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3590. referencedClasses: [],
  3591. //>>excludeEnd("ide");
  3592. messageSends: ["do:", "values"]
  3593. }),
  3594. $globals.HashedCollection);
  3595. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  3596. //>>excludeStart("ide", pragmas.excludeIdeData);
  3597. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3598. //>>excludeEnd("ide");
  3599. $core.addMethod(
  3600. $core.method({
  3601. selector: "=",
  3602. protocol: 'comparing',
  3603. fn: function (aCollection){
  3604. var self=this;
  3605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3606. return $core.withContext(function($ctx1) {
  3607. //>>excludeEnd("ctx");
  3608. var $3,$2,$4,$1,$5;
  3609. var $early={};
  3610. try {
  3611. $3=self._class();
  3612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3613. $ctx1.sendIdx["class"]=1;
  3614. //>>excludeEnd("ctx");
  3615. $2=$recv($3).__eq($recv(aCollection)._class());
  3616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3617. $ctx1.sendIdx["="]=1;
  3618. //>>excludeEnd("ctx");
  3619. $1=$recv($2)._and_((function(){
  3620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3621. return $core.withContext(function($ctx2) {
  3622. //>>excludeEnd("ctx");
  3623. $4=self._size();
  3624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3625. $ctx2.sendIdx["size"]=1;
  3626. //>>excludeEnd("ctx");
  3627. return $recv($4).__eq($recv(aCollection)._size());
  3628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3629. $ctx2.sendIdx["="]=2;
  3630. //>>excludeEnd("ctx");
  3631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3632. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3633. //>>excludeEnd("ctx");
  3634. }));
  3635. if(!$core.assert($1)){
  3636. return false;
  3637. }
  3638. self._withIndexDo_((function(each,i){
  3639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3640. return $core.withContext(function($ctx2) {
  3641. //>>excludeEnd("ctx");
  3642. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3643. if(!$core.assert($5)){
  3644. throw $early=[false];
  3645. }
  3646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3647. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3648. //>>excludeEnd("ctx");
  3649. }));
  3650. return true;
  3651. }
  3652. catch(e) {if(e===$early)return e[0]; throw e}
  3653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3654. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3655. //>>excludeEnd("ctx");
  3656. },
  3657. //>>excludeStart("ide", pragmas.excludeIdeData);
  3658. args: ["aCollection"],
  3659. 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",
  3660. referencedClasses: [],
  3661. //>>excludeEnd("ide");
  3662. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3663. }),
  3664. $globals.SequenceableCollection);
  3665. $core.addMethod(
  3666. $core.method({
  3667. selector: "addLast:",
  3668. protocol: 'adding/removing',
  3669. fn: function (anObject){
  3670. var self=this;
  3671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3672. return $core.withContext(function($ctx1) {
  3673. //>>excludeEnd("ctx");
  3674. self._add_(anObject);
  3675. return self;
  3676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3677. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3678. //>>excludeEnd("ctx");
  3679. },
  3680. //>>excludeStart("ide", pragmas.excludeIdeData);
  3681. args: ["anObject"],
  3682. source: "addLast: anObject\x0a\x09self add: anObject",
  3683. referencedClasses: [],
  3684. //>>excludeEnd("ide");
  3685. messageSends: ["add:"]
  3686. }),
  3687. $globals.SequenceableCollection);
  3688. $core.addMethod(
  3689. $core.method({
  3690. selector: "allButFirst",
  3691. protocol: 'accessing',
  3692. fn: function (){
  3693. var self=this;
  3694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3695. return $core.withContext(function($ctx1) {
  3696. //>>excludeEnd("ctx");
  3697. return self._copyFrom_to_((2),self._size());
  3698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3699. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3700. //>>excludeEnd("ctx");
  3701. },
  3702. //>>excludeStart("ide", pragmas.excludeIdeData);
  3703. args: [],
  3704. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3705. referencedClasses: [],
  3706. //>>excludeEnd("ide");
  3707. messageSends: ["copyFrom:to:", "size"]
  3708. }),
  3709. $globals.SequenceableCollection);
  3710. $core.addMethod(
  3711. $core.method({
  3712. selector: "allButLast",
  3713. protocol: 'accessing',
  3714. fn: function (){
  3715. var self=this;
  3716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3717. return $core.withContext(function($ctx1) {
  3718. //>>excludeEnd("ctx");
  3719. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  3720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3721. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3722. //>>excludeEnd("ctx");
  3723. },
  3724. //>>excludeStart("ide", pragmas.excludeIdeData);
  3725. args: [],
  3726. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3727. referencedClasses: [],
  3728. //>>excludeEnd("ide");
  3729. messageSends: ["copyFrom:to:", "-", "size"]
  3730. }),
  3731. $globals.SequenceableCollection);
  3732. $core.addMethod(
  3733. $core.method({
  3734. selector: "anyOne",
  3735. protocol: 'accessing',
  3736. fn: function (){
  3737. var self=this;
  3738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3739. return $core.withContext(function($ctx1) {
  3740. //>>excludeEnd("ctx");
  3741. return self._at_((1));
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  3744. //>>excludeEnd("ctx");
  3745. },
  3746. //>>excludeStart("ide", pragmas.excludeIdeData);
  3747. args: [],
  3748. source: "anyOne\x0a\x09^ self at: 1",
  3749. referencedClasses: [],
  3750. //>>excludeEnd("ide");
  3751. messageSends: ["at:"]
  3752. }),
  3753. $globals.SequenceableCollection);
  3754. $core.addMethod(
  3755. $core.method({
  3756. selector: "atRandom",
  3757. protocol: 'accessing',
  3758. fn: function (){
  3759. var self=this;
  3760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3761. return $core.withContext(function($ctx1) {
  3762. //>>excludeEnd("ctx");
  3763. return self._at_($recv(self._size())._atRandom());
  3764. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3765. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3766. //>>excludeEnd("ctx");
  3767. },
  3768. //>>excludeStart("ide", pragmas.excludeIdeData);
  3769. args: [],
  3770. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3771. referencedClasses: [],
  3772. //>>excludeEnd("ide");
  3773. messageSends: ["at:", "atRandom", "size"]
  3774. }),
  3775. $globals.SequenceableCollection);
  3776. $core.addMethod(
  3777. $core.method({
  3778. selector: "beginsWith:",
  3779. protocol: 'testing',
  3780. fn: function (prefix){
  3781. var self=this;
  3782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3783. return $core.withContext(function($ctx1) {
  3784. //>>excludeEnd("ctx");
  3785. var $2,$3,$1;
  3786. $2=self._size();
  3787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3788. $ctx1.sendIdx["size"]=1;
  3789. //>>excludeEnd("ctx");
  3790. $3=$recv(prefix)._size();
  3791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3792. $ctx1.sendIdx["size"]=2;
  3793. //>>excludeEnd("ctx");
  3794. $1=$recv($2).__lt($3);
  3795. if($core.assert($1)){
  3796. return false;
  3797. }
  3798. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  3799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3800. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3801. //>>excludeEnd("ctx");
  3802. },
  3803. //>>excludeStart("ide", pragmas.excludeIdeData);
  3804. args: ["prefix"],
  3805. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3806. referencedClasses: [],
  3807. //>>excludeEnd("ide");
  3808. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3809. }),
  3810. $globals.SequenceableCollection);
  3811. $core.addMethod(
  3812. $core.method({
  3813. selector: "copyFrom:to:",
  3814. protocol: 'copying',
  3815. fn: function (anIndex,anotherIndex){
  3816. var self=this;
  3817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3818. return $core.withContext(function($ctx1) {
  3819. //>>excludeEnd("ctx");
  3820. self._subclassResponsibility();
  3821. return self;
  3822. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3823. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3824. //>>excludeEnd("ctx");
  3825. },
  3826. //>>excludeStart("ide", pragmas.excludeIdeData);
  3827. args: ["anIndex", "anotherIndex"],
  3828. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3829. referencedClasses: [],
  3830. //>>excludeEnd("ide");
  3831. messageSends: ["subclassResponsibility"]
  3832. }),
  3833. $globals.SequenceableCollection);
  3834. $core.addMethod(
  3835. $core.method({
  3836. selector: "detect:ifNone:",
  3837. protocol: 'enumerating',
  3838. fn: function (aBlock,anotherBlock){
  3839. var self=this;
  3840. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3841. return $core.withContext(function($ctx1) {
  3842. //>>excludeEnd("ctx");
  3843. self = self._numericallyIndexable();
  3844. for(var i = 0; i < self.length; i++)
  3845. if(aBlock._value_(self[i]))
  3846. return self[i];
  3847. return anotherBlock._value();
  3848. ;
  3849. return self;
  3850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3851. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3852. //>>excludeEnd("ctx");
  3853. },
  3854. //>>excludeStart("ide", pragmas.excludeIdeData);
  3855. args: ["aBlock", "anotherBlock"],
  3856. 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'>",
  3857. referencedClasses: [],
  3858. //>>excludeEnd("ide");
  3859. messageSends: []
  3860. }),
  3861. $globals.SequenceableCollection);
  3862. $core.addMethod(
  3863. $core.method({
  3864. selector: "do:",
  3865. protocol: 'enumerating',
  3866. fn: function (aBlock){
  3867. var self=this;
  3868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3869. return $core.withContext(function($ctx1) {
  3870. //>>excludeEnd("ctx");
  3871. self = self._numericallyIndexable();
  3872. for(var i=0; i < self.length; i++) {
  3873. aBlock._value_(self[i]);
  3874. }
  3875. ;
  3876. return self;
  3877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3878. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3879. //>>excludeEnd("ctx");
  3880. },
  3881. //>>excludeStart("ide", pragmas.excludeIdeData);
  3882. args: ["aBlock"],
  3883. 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'>",
  3884. referencedClasses: [],
  3885. //>>excludeEnd("ide");
  3886. messageSends: []
  3887. }),
  3888. $globals.SequenceableCollection);
  3889. $core.addMethod(
  3890. $core.method({
  3891. selector: "endsWith:",
  3892. protocol: 'testing',
  3893. fn: function (suffix){
  3894. var self=this;
  3895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3896. return $core.withContext(function($ctx1) {
  3897. //>>excludeEnd("ctx");
  3898. var $2,$3,$1;
  3899. $2=self._size();
  3900. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3901. $ctx1.sendIdx["size"]=1;
  3902. //>>excludeEnd("ctx");
  3903. $3=$recv(suffix)._size();
  3904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3905. $ctx1.sendIdx["size"]=2;
  3906. //>>excludeEnd("ctx");
  3907. $1=$recv($2).__lt($3);
  3908. if($core.assert($1)){
  3909. return false;
  3910. }
  3911. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  3912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3913. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3914. //>>excludeEnd("ctx");
  3915. },
  3916. //>>excludeStart("ide", pragmas.excludeIdeData);
  3917. args: ["suffix"],
  3918. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3919. referencedClasses: [],
  3920. //>>excludeEnd("ide");
  3921. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3922. }),
  3923. $globals.SequenceableCollection);
  3924. $core.addMethod(
  3925. $core.method({
  3926. selector: "first",
  3927. protocol: 'accessing',
  3928. fn: function (){
  3929. var self=this;
  3930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3931. return $core.withContext(function($ctx1) {
  3932. //>>excludeEnd("ctx");
  3933. return self._at_((1));
  3934. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3935. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3936. //>>excludeEnd("ctx");
  3937. },
  3938. //>>excludeStart("ide", pragmas.excludeIdeData);
  3939. args: [],
  3940. source: "first\x0a\x09^ self at: 1",
  3941. referencedClasses: [],
  3942. //>>excludeEnd("ide");
  3943. messageSends: ["at:"]
  3944. }),
  3945. $globals.SequenceableCollection);
  3946. $core.addMethod(
  3947. $core.method({
  3948. selector: "first:",
  3949. protocol: 'accessing',
  3950. fn: function (aNumber){
  3951. var self=this;
  3952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3953. return $core.withContext(function($ctx1) {
  3954. //>>excludeEnd("ctx");
  3955. var $1;
  3956. $1=$recv(self._size()).__lt(aNumber);
  3957. if($core.assert($1)){
  3958. self._error_("Invalid number of elements");
  3959. }
  3960. return self._copyFrom_to_((1),aNumber);
  3961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3962. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3963. //>>excludeEnd("ctx");
  3964. },
  3965. //>>excludeStart("ide", pragmas.excludeIdeData);
  3966. args: ["aNumber"],
  3967. 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",
  3968. referencedClasses: [],
  3969. //>>excludeEnd("ide");
  3970. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3971. }),
  3972. $globals.SequenceableCollection);
  3973. $core.addMethod(
  3974. $core.method({
  3975. selector: "fourth",
  3976. protocol: 'accessing',
  3977. fn: function (){
  3978. var self=this;
  3979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3980. return $core.withContext(function($ctx1) {
  3981. //>>excludeEnd("ctx");
  3982. return self._at_((4));
  3983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3984. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  3985. //>>excludeEnd("ctx");
  3986. },
  3987. //>>excludeStart("ide", pragmas.excludeIdeData);
  3988. args: [],
  3989. source: "fourth\x0a\x09^ self at: 4",
  3990. referencedClasses: [],
  3991. //>>excludeEnd("ide");
  3992. messageSends: ["at:"]
  3993. }),
  3994. $globals.SequenceableCollection);
  3995. $core.addMethod(
  3996. $core.method({
  3997. selector: "includes:",
  3998. protocol: 'testing',
  3999. fn: function (anObject){
  4000. var self=this;
  4001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4002. return $core.withContext(function($ctx1) {
  4003. //>>excludeEnd("ctx");
  4004. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  4005. return nil;
  4006. })))._notNil();
  4007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4008. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  4009. //>>excludeEnd("ctx");
  4010. },
  4011. //>>excludeStart("ide", pragmas.excludeIdeData);
  4012. args: ["anObject"],
  4013. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4014. referencedClasses: [],
  4015. //>>excludeEnd("ide");
  4016. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4017. }),
  4018. $globals.SequenceableCollection);
  4019. $core.addMethod(
  4020. $core.method({
  4021. selector: "indexOf:ifAbsent:",
  4022. protocol: 'accessing',
  4023. fn: function (anObject,aBlock){
  4024. var self=this;
  4025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4026. return $core.withContext(function($ctx1) {
  4027. //>>excludeEnd("ctx");
  4028. self = self._numericallyIndexable();
  4029. for(var i=0; i < self.length; i++) {
  4030. if($recv(self[i]).__eq(anObject)) {return i+1}
  4031. };
  4032. return aBlock._value();
  4033. ;
  4034. return self;
  4035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4036. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  4037. //>>excludeEnd("ctx");
  4038. },
  4039. //>>excludeStart("ide", pragmas.excludeIdeData);
  4040. args: ["anObject", "aBlock"],
  4041. 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'>",
  4042. referencedClasses: [],
  4043. //>>excludeEnd("ide");
  4044. messageSends: []
  4045. }),
  4046. $globals.SequenceableCollection);
  4047. $core.addMethod(
  4048. $core.method({
  4049. selector: "indexOf:startingAt:",
  4050. protocol: 'accessing',
  4051. fn: function (anObject,start){
  4052. var self=this;
  4053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4054. return $core.withContext(function($ctx1) {
  4055. //>>excludeEnd("ctx");
  4056. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4057. return (0);
  4058. }));
  4059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4060. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4061. //>>excludeEnd("ctx");
  4062. },
  4063. //>>excludeStart("ide", pragmas.excludeIdeData);
  4064. args: ["anObject", "start"],
  4065. 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 ]",
  4066. referencedClasses: [],
  4067. //>>excludeEnd("ide");
  4068. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4069. }),
  4070. $globals.SequenceableCollection);
  4071. $core.addMethod(
  4072. $core.method({
  4073. selector: "indexOf:startingAt:ifAbsent:",
  4074. protocol: 'accessing',
  4075. fn: function (anObject,start,aBlock){
  4076. var self=this;
  4077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4078. return $core.withContext(function($ctx1) {
  4079. //>>excludeEnd("ctx");
  4080. self = self._numericallyIndexable();
  4081. for(var i=start - 1; i < self.length; i++){
  4082. if($recv(self[i]).__eq(anObject)) {return i+1}
  4083. }
  4084. return aBlock._value();
  4085. ;
  4086. return self;
  4087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4088. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4089. //>>excludeEnd("ctx");
  4090. },
  4091. //>>excludeStart("ide", pragmas.excludeIdeData);
  4092. args: ["anObject", "start", "aBlock"],
  4093. 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'>",
  4094. referencedClasses: [],
  4095. //>>excludeEnd("ide");
  4096. messageSends: []
  4097. }),
  4098. $globals.SequenceableCollection);
  4099. $core.addMethod(
  4100. $core.method({
  4101. selector: "last",
  4102. protocol: 'accessing',
  4103. fn: function (){
  4104. var self=this;
  4105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4106. return $core.withContext(function($ctx1) {
  4107. //>>excludeEnd("ctx");
  4108. return self._at_(self._size());
  4109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4110. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4111. //>>excludeEnd("ctx");
  4112. },
  4113. //>>excludeStart("ide", pragmas.excludeIdeData);
  4114. args: [],
  4115. source: "last\x0a\x09^ self at: self size",
  4116. referencedClasses: [],
  4117. //>>excludeEnd("ide");
  4118. messageSends: ["at:", "size"]
  4119. }),
  4120. $globals.SequenceableCollection);
  4121. $core.addMethod(
  4122. $core.method({
  4123. selector: "last:",
  4124. protocol: 'accessing',
  4125. fn: function (aNumber){
  4126. var self=this;
  4127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4128. return $core.withContext(function($ctx1) {
  4129. //>>excludeEnd("ctx");
  4130. var $2,$1,$5,$4,$3;
  4131. $2=self._size();
  4132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4133. $ctx1.sendIdx["size"]=1;
  4134. //>>excludeEnd("ctx");
  4135. $1=$recv($2).__lt(aNumber);
  4136. if($core.assert($1)){
  4137. self._error_("Invalid number of elements");
  4138. }
  4139. $5=self._size();
  4140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4141. $ctx1.sendIdx["size"]=2;
  4142. //>>excludeEnd("ctx");
  4143. $4=$recv($5).__minus(aNumber);
  4144. $3=$recv($4).__plus((1));
  4145. return self._copyFrom_to_($3,self._size());
  4146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4147. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4148. //>>excludeEnd("ctx");
  4149. },
  4150. //>>excludeStart("ide", pragmas.excludeIdeData);
  4151. args: ["aNumber"],
  4152. 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",
  4153. referencedClasses: [],
  4154. //>>excludeEnd("ide");
  4155. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4156. }),
  4157. $globals.SequenceableCollection);
  4158. $core.addMethod(
  4159. $core.method({
  4160. selector: "newStream",
  4161. protocol: 'streaming',
  4162. fn: function (){
  4163. var self=this;
  4164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4165. return $core.withContext(function($ctx1) {
  4166. //>>excludeEnd("ctx");
  4167. return $recv(self._streamClass())._on_(self);
  4168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4169. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4170. //>>excludeEnd("ctx");
  4171. },
  4172. //>>excludeStart("ide", pragmas.excludeIdeData);
  4173. args: [],
  4174. source: "newStream\x0a\x09^ self streamClass on: self",
  4175. referencedClasses: [],
  4176. //>>excludeEnd("ide");
  4177. messageSends: ["on:", "streamClass"]
  4178. }),
  4179. $globals.SequenceableCollection);
  4180. $core.addMethod(
  4181. $core.method({
  4182. selector: "numericallyIndexable",
  4183. protocol: 'private',
  4184. fn: function (){
  4185. var self=this;
  4186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4187. return $core.withContext(function($ctx1) {
  4188. //>>excludeEnd("ctx");
  4189. self._subclassResponsibility();
  4190. return self;
  4191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4192. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  4193. //>>excludeEnd("ctx");
  4194. },
  4195. //>>excludeStart("ide", pragmas.excludeIdeData);
  4196. args: [],
  4197. 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",
  4198. referencedClasses: [],
  4199. //>>excludeEnd("ide");
  4200. messageSends: ["subclassResponsibility"]
  4201. }),
  4202. $globals.SequenceableCollection);
  4203. $core.addMethod(
  4204. $core.method({
  4205. selector: "readStream",
  4206. protocol: 'streaming',
  4207. fn: function (){
  4208. var self=this;
  4209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4210. return $core.withContext(function($ctx1) {
  4211. //>>excludeEnd("ctx");
  4212. return self._stream();
  4213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4214. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4215. //>>excludeEnd("ctx");
  4216. },
  4217. //>>excludeStart("ide", pragmas.excludeIdeData);
  4218. args: [],
  4219. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4220. referencedClasses: [],
  4221. //>>excludeEnd("ide");
  4222. messageSends: ["stream"]
  4223. }),
  4224. $globals.SequenceableCollection);
  4225. $core.addMethod(
  4226. $core.method({
  4227. selector: "removeLast",
  4228. protocol: 'adding/removing',
  4229. fn: function (){
  4230. var self=this;
  4231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4232. return $core.withContext(function($ctx1) {
  4233. //>>excludeEnd("ctx");
  4234. return self._remove_(self._last());
  4235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4236. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4237. //>>excludeEnd("ctx");
  4238. },
  4239. //>>excludeStart("ide", pragmas.excludeIdeData);
  4240. args: [],
  4241. source: "removeLast\x0a\x09^ self remove: self last",
  4242. referencedClasses: [],
  4243. //>>excludeEnd("ide");
  4244. messageSends: ["remove:", "last"]
  4245. }),
  4246. $globals.SequenceableCollection);
  4247. $core.addMethod(
  4248. $core.method({
  4249. selector: "reversed",
  4250. protocol: 'converting',
  4251. fn: function (){
  4252. var self=this;
  4253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4254. return $core.withContext(function($ctx1) {
  4255. //>>excludeEnd("ctx");
  4256. self._subclassResponsibility();
  4257. return self;
  4258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4259. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4260. //>>excludeEnd("ctx");
  4261. },
  4262. //>>excludeStart("ide", pragmas.excludeIdeData);
  4263. args: [],
  4264. source: "reversed\x0a\x09self subclassResponsibility",
  4265. referencedClasses: [],
  4266. //>>excludeEnd("ide");
  4267. messageSends: ["subclassResponsibility"]
  4268. }),
  4269. $globals.SequenceableCollection);
  4270. $core.addMethod(
  4271. $core.method({
  4272. selector: "second",
  4273. protocol: 'accessing',
  4274. fn: function (){
  4275. var self=this;
  4276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4277. return $core.withContext(function($ctx1) {
  4278. //>>excludeEnd("ctx");
  4279. return self._at_((2));
  4280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4281. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4282. //>>excludeEnd("ctx");
  4283. },
  4284. //>>excludeStart("ide", pragmas.excludeIdeData);
  4285. args: [],
  4286. source: "second\x0a\x09^ self at: 2",
  4287. referencedClasses: [],
  4288. //>>excludeEnd("ide");
  4289. messageSends: ["at:"]
  4290. }),
  4291. $globals.SequenceableCollection);
  4292. $core.addMethod(
  4293. $core.method({
  4294. selector: "single",
  4295. protocol: 'accessing',
  4296. fn: function (){
  4297. var self=this;
  4298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4299. return $core.withContext(function($ctx1) {
  4300. //>>excludeEnd("ctx");
  4301. if (self.length == 0) throw new Error("Collection is empty");
  4302. if (self.length > 1) throw new Error("Collection holds more than one element.");
  4303. return self[0];;
  4304. return self;
  4305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4306. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  4307. //>>excludeEnd("ctx");
  4308. },
  4309. //>>excludeStart("ide", pragmas.excludeIdeData);
  4310. args: [],
  4311. 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'>",
  4312. referencedClasses: [],
  4313. //>>excludeEnd("ide");
  4314. messageSends: []
  4315. }),
  4316. $globals.SequenceableCollection);
  4317. $core.addMethod(
  4318. $core.method({
  4319. selector: "stream",
  4320. protocol: 'streaming',
  4321. fn: function (){
  4322. var self=this;
  4323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4324. return $core.withContext(function($ctx1) {
  4325. //>>excludeEnd("ctx");
  4326. return self._newStream();
  4327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4328. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4329. //>>excludeEnd("ctx");
  4330. },
  4331. //>>excludeStart("ide", pragmas.excludeIdeData);
  4332. args: [],
  4333. source: "stream\x0a\x09^ self newStream",
  4334. referencedClasses: [],
  4335. //>>excludeEnd("ide");
  4336. messageSends: ["newStream"]
  4337. }),
  4338. $globals.SequenceableCollection);
  4339. $core.addMethod(
  4340. $core.method({
  4341. selector: "streamClass",
  4342. protocol: 'streaming',
  4343. fn: function (){
  4344. var self=this;
  4345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4346. return $core.withContext(function($ctx1) {
  4347. //>>excludeEnd("ctx");
  4348. return $recv(self._class())._streamClass();
  4349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4350. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4351. //>>excludeEnd("ctx");
  4352. },
  4353. //>>excludeStart("ide", pragmas.excludeIdeData);
  4354. args: [],
  4355. source: "streamClass\x0a\x09^ self class streamClass",
  4356. referencedClasses: [],
  4357. //>>excludeEnd("ide");
  4358. messageSends: ["streamClass", "class"]
  4359. }),
  4360. $globals.SequenceableCollection);
  4361. $core.addMethod(
  4362. $core.method({
  4363. selector: "third",
  4364. protocol: 'accessing',
  4365. fn: function (){
  4366. var self=this;
  4367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4368. return $core.withContext(function($ctx1) {
  4369. //>>excludeEnd("ctx");
  4370. return self._at_((3));
  4371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4372. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4373. //>>excludeEnd("ctx");
  4374. },
  4375. //>>excludeStart("ide", pragmas.excludeIdeData);
  4376. args: [],
  4377. source: "third\x0a\x09^ self at: 3",
  4378. referencedClasses: [],
  4379. //>>excludeEnd("ide");
  4380. messageSends: ["at:"]
  4381. }),
  4382. $globals.SequenceableCollection);
  4383. $core.addMethod(
  4384. $core.method({
  4385. selector: "with:do:",
  4386. protocol: 'enumerating',
  4387. fn: function (anotherCollection,aBlock){
  4388. var self=this;
  4389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4390. return $core.withContext(function($ctx1) {
  4391. //>>excludeEnd("ctx");
  4392. self = self._numericallyIndexable();
  4393. anotherCollection = anotherCollection._numericallyIndexable();
  4394. for(var i=0; i<self.length; i++) {
  4395. aBlock._value_value_(self[i], anotherCollection[i]);
  4396. }
  4397. ;
  4398. return self;
  4399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4400. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4401. //>>excludeEnd("ctx");
  4402. },
  4403. //>>excludeStart("ide", pragmas.excludeIdeData);
  4404. args: ["anotherCollection", "aBlock"],
  4405. 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'>",
  4406. referencedClasses: [],
  4407. //>>excludeEnd("ide");
  4408. messageSends: []
  4409. }),
  4410. $globals.SequenceableCollection);
  4411. $core.addMethod(
  4412. $core.method({
  4413. selector: "withIndexDo:",
  4414. protocol: 'enumerating',
  4415. fn: function (aBlock){
  4416. var self=this;
  4417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4418. return $core.withContext(function($ctx1) {
  4419. //>>excludeEnd("ctx");
  4420. self = self._numericallyIndexable();
  4421. for(var i=0; i < self.length; i++) {
  4422. aBlock._value_value_(self[i], i+1);
  4423. }
  4424. ;
  4425. return self;
  4426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4427. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4428. //>>excludeEnd("ctx");
  4429. },
  4430. //>>excludeStart("ide", pragmas.excludeIdeData);
  4431. args: ["aBlock"],
  4432. 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'>",
  4433. referencedClasses: [],
  4434. //>>excludeEnd("ide");
  4435. messageSends: []
  4436. }),
  4437. $globals.SequenceableCollection);
  4438. $core.addMethod(
  4439. $core.method({
  4440. selector: "writeStream",
  4441. protocol: 'streaming',
  4442. fn: function (){
  4443. var self=this;
  4444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4445. return $core.withContext(function($ctx1) {
  4446. //>>excludeEnd("ctx");
  4447. return self._stream();
  4448. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4449. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4450. //>>excludeEnd("ctx");
  4451. },
  4452. //>>excludeStart("ide", pragmas.excludeIdeData);
  4453. args: [],
  4454. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4455. referencedClasses: [],
  4456. //>>excludeEnd("ide");
  4457. messageSends: ["stream"]
  4458. }),
  4459. $globals.SequenceableCollection);
  4460. $core.addMethod(
  4461. $core.method({
  4462. selector: "streamClass",
  4463. protocol: 'accessing',
  4464. fn: function (){
  4465. var self=this;
  4466. return $globals.Stream;
  4467. },
  4468. //>>excludeStart("ide", pragmas.excludeIdeData);
  4469. args: [],
  4470. source: "streamClass\x0a\x09\x09^ Stream",
  4471. referencedClasses: ["Stream"],
  4472. //>>excludeEnd("ide");
  4473. messageSends: []
  4474. }),
  4475. $globals.SequenceableCollection.klass);
  4476. $core.addMethod(
  4477. $core.method({
  4478. selector: "streamContents:",
  4479. protocol: 'streaming',
  4480. fn: function (aBlock){
  4481. var self=this;
  4482. var stream;
  4483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4484. return $core.withContext(function($ctx1) {
  4485. //>>excludeEnd("ctx");
  4486. stream=$recv(self._streamClass())._on_(self._new());
  4487. $recv(aBlock)._value_(stream);
  4488. return $recv(stream)._contents();
  4489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4490. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  4491. //>>excludeEnd("ctx");
  4492. },
  4493. //>>excludeStart("ide", pragmas.excludeIdeData);
  4494. args: ["aBlock"],
  4495. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4496. referencedClasses: [],
  4497. //>>excludeEnd("ide");
  4498. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4499. }),
  4500. $globals.SequenceableCollection.klass);
  4501. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  4502. //>>excludeStart("ide", pragmas.excludeIdeData);
  4503. $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`.";
  4504. //>>excludeEnd("ide");
  4505. $core.addMethod(
  4506. $core.method({
  4507. selector: "add:",
  4508. protocol: 'adding/removing',
  4509. fn: function (anObject){
  4510. var self=this;
  4511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4512. return $core.withContext(function($ctx1) {
  4513. //>>excludeEnd("ctx");
  4514. self.push(anObject); return anObject;;
  4515. return self;
  4516. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4517. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4518. //>>excludeEnd("ctx");
  4519. },
  4520. //>>excludeStart("ide", pragmas.excludeIdeData);
  4521. args: ["anObject"],
  4522. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  4523. referencedClasses: [],
  4524. //>>excludeEnd("ide");
  4525. messageSends: []
  4526. }),
  4527. $globals.Array);
  4528. $core.addMethod(
  4529. $core.method({
  4530. selector: "addAll:",
  4531. protocol: 'adding/removing',
  4532. fn: function (aCollection){
  4533. var self=this;
  4534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4535. return $core.withContext(function($ctx1) {
  4536. //>>excludeEnd("ctx");
  4537. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4538. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  4539. return aCollection;;
  4540. return self;
  4541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4542. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4543. //>>excludeEnd("ctx");
  4544. },
  4545. //>>excludeStart("ide", pragmas.excludeIdeData);
  4546. args: ["aCollection"],
  4547. 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'>",
  4548. referencedClasses: [],
  4549. //>>excludeEnd("ide");
  4550. messageSends: []
  4551. }),
  4552. $globals.Array);
  4553. $core.addMethod(
  4554. $core.method({
  4555. selector: "addFirst:",
  4556. protocol: 'adding/removing',
  4557. fn: function (anObject){
  4558. var self=this;
  4559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4560. return $core.withContext(function($ctx1) {
  4561. //>>excludeEnd("ctx");
  4562. self.unshift(anObject); return anObject;;
  4563. return self;
  4564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4565. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4566. //>>excludeEnd("ctx");
  4567. },
  4568. //>>excludeStart("ide", pragmas.excludeIdeData);
  4569. args: ["anObject"],
  4570. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  4571. referencedClasses: [],
  4572. //>>excludeEnd("ide");
  4573. messageSends: []
  4574. }),
  4575. $globals.Array);
  4576. $core.addMethod(
  4577. $core.method({
  4578. selector: "asJavascript",
  4579. protocol: 'converting',
  4580. fn: function (){
  4581. var self=this;
  4582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4583. return $core.withContext(function($ctx1) {
  4584. //>>excludeEnd("ctx");
  4585. var $1;
  4586. $1=$recv("[".__comma($recv(self._collect_((function(each){
  4587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4588. return $core.withContext(function($ctx2) {
  4589. //>>excludeEnd("ctx");
  4590. return $recv(each)._asJavascript();
  4591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4592. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4593. //>>excludeEnd("ctx");
  4594. })))._join_(", "))).__comma("]");
  4595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4596. $ctx1.sendIdx[","]=1;
  4597. //>>excludeEnd("ctx");
  4598. return $1;
  4599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4600. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  4601. //>>excludeEnd("ctx");
  4602. },
  4603. //>>excludeStart("ide", pragmas.excludeIdeData);
  4604. args: [],
  4605. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  4606. referencedClasses: [],
  4607. //>>excludeEnd("ide");
  4608. messageSends: [",", "join:", "collect:", "asJavascript"]
  4609. }),
  4610. $globals.Array);
  4611. $core.addMethod(
  4612. $core.method({
  4613. selector: "at:ifAbsent:",
  4614. protocol: 'accessing',
  4615. fn: function (anIndex,aBlock){
  4616. var self=this;
  4617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4618. return $core.withContext(function($ctx1) {
  4619. //>>excludeEnd("ctx");
  4620. return anIndex >= 1 && anIndex <= self.length
  4621. ? self[anIndex - 1]
  4622. : aBlock._value()
  4623. ;
  4624. return self;
  4625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4626. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4627. //>>excludeEnd("ctx");
  4628. },
  4629. //>>excludeStart("ide", pragmas.excludeIdeData);
  4630. args: ["anIndex", "aBlock"],
  4631. 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'>",
  4632. referencedClasses: [],
  4633. //>>excludeEnd("ide");
  4634. messageSends: []
  4635. }),
  4636. $globals.Array);
  4637. $core.addMethod(
  4638. $core.method({
  4639. selector: "at:ifPresent:ifAbsent:",
  4640. protocol: 'accessing',
  4641. fn: function (anIndex,aBlock,anotherBlock){
  4642. var self=this;
  4643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4644. return $core.withContext(function($ctx1) {
  4645. //>>excludeEnd("ctx");
  4646. return anIndex >= 1 && anIndex <= self.length
  4647. ? aBlock._value_(self[anIndex - 1])
  4648. : anotherBlock._value()
  4649. ;
  4650. return self;
  4651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4652. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4653. //>>excludeEnd("ctx");
  4654. },
  4655. //>>excludeStart("ide", pragmas.excludeIdeData);
  4656. args: ["anIndex", "aBlock", "anotherBlock"],
  4657. 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'>",
  4658. referencedClasses: [],
  4659. //>>excludeEnd("ide");
  4660. messageSends: []
  4661. }),
  4662. $globals.Array);
  4663. $core.addMethod(
  4664. $core.method({
  4665. selector: "at:put:",
  4666. protocol: 'accessing',
  4667. fn: function (anIndex,anObject){
  4668. var self=this;
  4669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4670. return $core.withContext(function($ctx1) {
  4671. //>>excludeEnd("ctx");
  4672. return self[anIndex - 1] = anObject;
  4673. return self;
  4674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4675. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4676. //>>excludeEnd("ctx");
  4677. },
  4678. //>>excludeStart("ide", pragmas.excludeIdeData);
  4679. args: ["anIndex", "anObject"],
  4680. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  4681. referencedClasses: [],
  4682. //>>excludeEnd("ide");
  4683. messageSends: []
  4684. }),
  4685. $globals.Array);
  4686. $core.addMethod(
  4687. $core.method({
  4688. selector: "collect:",
  4689. protocol: 'enumerating',
  4690. fn: function (aBlock){
  4691. var self=this;
  4692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4693. return $core.withContext(function($ctx1) {
  4694. //>>excludeEnd("ctx");
  4695. return self.map(function(each) {return aBlock._value_(each)});
  4696. return self;
  4697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4698. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4699. //>>excludeEnd("ctx");
  4700. },
  4701. //>>excludeStart("ide", pragmas.excludeIdeData);
  4702. args: ["aBlock"],
  4703. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  4704. referencedClasses: [],
  4705. //>>excludeEnd("ide");
  4706. messageSends: []
  4707. }),
  4708. $globals.Array);
  4709. $core.addMethod(
  4710. $core.method({
  4711. selector: "copyFrom:to:",
  4712. protocol: 'copying',
  4713. fn: function (anIndex,anotherIndex){
  4714. var self=this;
  4715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4716. return $core.withContext(function($ctx1) {
  4717. //>>excludeEnd("ctx");
  4718. if (anIndex >= 1 && anotherIndex <= self.length) {
  4719. return self.slice(anIndex - 1, anotherIndex);
  4720. } else {
  4721. self._at_(anIndex);
  4722. self._at_(self.length + 1);
  4723. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4724. };
  4725. return self;
  4726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4727. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4728. //>>excludeEnd("ctx");
  4729. },
  4730. //>>excludeStart("ide", pragmas.excludeIdeData);
  4731. args: ["anIndex", "anotherIndex"],
  4732. 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'>",
  4733. referencedClasses: [],
  4734. //>>excludeEnd("ide");
  4735. messageSends: []
  4736. }),
  4737. $globals.Array);
  4738. $core.addMethod(
  4739. $core.method({
  4740. selector: "join:",
  4741. protocol: 'enumerating',
  4742. fn: function (aString){
  4743. var self=this;
  4744. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4745. return $core.withContext(function($ctx1) {
  4746. //>>excludeEnd("ctx");
  4747. return self.join(aString);
  4748. return self;
  4749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4750. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4751. //>>excludeEnd("ctx");
  4752. },
  4753. //>>excludeStart("ide", pragmas.excludeIdeData);
  4754. args: ["aString"],
  4755. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  4756. referencedClasses: [],
  4757. //>>excludeEnd("ide");
  4758. messageSends: []
  4759. }),
  4760. $globals.Array);
  4761. $core.addMethod(
  4762. $core.method({
  4763. selector: "numericallyIndexable",
  4764. protocol: 'private',
  4765. fn: function (){
  4766. var self=this;
  4767. return self;
  4768. },
  4769. //>>excludeStart("ide", pragmas.excludeIdeData);
  4770. args: [],
  4771. source: "numericallyIndexable\x0a\x09^ self",
  4772. referencedClasses: [],
  4773. //>>excludeEnd("ide");
  4774. messageSends: []
  4775. }),
  4776. $globals.Array);
  4777. $core.addMethod(
  4778. $core.method({
  4779. selector: "printOn:",
  4780. protocol: 'printing',
  4781. fn: function (aStream){
  4782. var self=this;
  4783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4784. return $core.withContext(function($ctx1) {
  4785. //>>excludeEnd("ctx");
  4786. (
  4787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4788. $ctx1.supercall = true,
  4789. //>>excludeEnd("ctx");
  4790. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  4791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4792. $ctx1.supercall = false;
  4793. //>>excludeEnd("ctx");;
  4794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4795. $ctx1.sendIdx["printOn:"]=1;
  4796. //>>excludeEnd("ctx");
  4797. $recv(aStream)._nextPutAll_(" (");
  4798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4799. $ctx1.sendIdx["nextPutAll:"]=1;
  4800. //>>excludeEnd("ctx");
  4801. self._do_separatedBy_((function(each){
  4802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4803. return $core.withContext(function($ctx2) {
  4804. //>>excludeEnd("ctx");
  4805. return $recv(each)._printOn_(aStream);
  4806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4807. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4808. //>>excludeEnd("ctx");
  4809. }),(function(){
  4810. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4811. return $core.withContext(function($ctx2) {
  4812. //>>excludeEnd("ctx");
  4813. return $recv(aStream)._nextPutAll_(" ");
  4814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4815. $ctx2.sendIdx["nextPutAll:"]=2;
  4816. //>>excludeEnd("ctx");
  4817. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4819. //>>excludeEnd("ctx");
  4820. }));
  4821. $recv(aStream)._nextPutAll_(")");
  4822. return self;
  4823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4824. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4825. //>>excludeEnd("ctx");
  4826. },
  4827. //>>excludeStart("ide", pragmas.excludeIdeData);
  4828. args: ["aStream"],
  4829. 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: ')'",
  4830. referencedClasses: [],
  4831. //>>excludeEnd("ide");
  4832. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4833. }),
  4834. $globals.Array);
  4835. $core.addMethod(
  4836. $core.method({
  4837. selector: "remove:ifAbsent:",
  4838. protocol: 'adding/removing',
  4839. fn: function (anObject,aBlock){
  4840. var self=this;
  4841. var index;
  4842. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4843. return $core.withContext(function($ctx1) {
  4844. //>>excludeEnd("ctx");
  4845. var $1;
  4846. index=self._indexOf_ifAbsent_(anObject,(function(){
  4847. return (0);
  4848. }));
  4849. $1=$recv(index).__eq((0));
  4850. if($core.assert($1)){
  4851. return $recv(aBlock)._value();
  4852. } else {
  4853. self._removeIndex_(index);
  4854. return anObject;
  4855. }
  4856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4857. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4858. //>>excludeEnd("ctx");
  4859. },
  4860. //>>excludeStart("ide", pragmas.excludeIdeData);
  4861. args: ["anObject", "aBlock"],
  4862. 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 ]",
  4863. referencedClasses: [],
  4864. //>>excludeEnd("ide");
  4865. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4866. }),
  4867. $globals.Array);
  4868. $core.addMethod(
  4869. $core.method({
  4870. selector: "removeAll",
  4871. protocol: 'adding/removing',
  4872. fn: function (){
  4873. var self=this;
  4874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4875. return $core.withContext(function($ctx1) {
  4876. //>>excludeEnd("ctx");
  4877. self.length = 0;
  4878. return self;
  4879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4880. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4881. //>>excludeEnd("ctx");
  4882. },
  4883. //>>excludeStart("ide", pragmas.excludeIdeData);
  4884. args: [],
  4885. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  4886. referencedClasses: [],
  4887. //>>excludeEnd("ide");
  4888. messageSends: []
  4889. }),
  4890. $globals.Array);
  4891. $core.addMethod(
  4892. $core.method({
  4893. selector: "removeFrom:to:",
  4894. protocol: 'adding/removing',
  4895. fn: function (aNumber,anotherNumber){
  4896. var self=this;
  4897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4898. return $core.withContext(function($ctx1) {
  4899. //>>excludeEnd("ctx");
  4900. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4901. return self;
  4902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4903. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4904. //>>excludeEnd("ctx");
  4905. },
  4906. //>>excludeStart("ide", pragmas.excludeIdeData);
  4907. args: ["aNumber", "anotherNumber"],
  4908. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  4909. referencedClasses: [],
  4910. //>>excludeEnd("ide");
  4911. messageSends: []
  4912. }),
  4913. $globals.Array);
  4914. $core.addMethod(
  4915. $core.method({
  4916. selector: "removeIndex:",
  4917. protocol: 'adding/removing',
  4918. fn: function (anInteger){
  4919. var self=this;
  4920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4921. return $core.withContext(function($ctx1) {
  4922. //>>excludeEnd("ctx");
  4923. self.splice(anInteger - 1, 1);
  4924. return self;
  4925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4926. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4927. //>>excludeEnd("ctx");
  4928. },
  4929. //>>excludeStart("ide", pragmas.excludeIdeData);
  4930. args: ["anInteger"],
  4931. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  4932. referencedClasses: [],
  4933. //>>excludeEnd("ide");
  4934. messageSends: []
  4935. }),
  4936. $globals.Array);
  4937. $core.addMethod(
  4938. $core.method({
  4939. selector: "removeLast",
  4940. protocol: 'adding/removing',
  4941. fn: function (){
  4942. var self=this;
  4943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4944. return $core.withContext(function($ctx1) {
  4945. //>>excludeEnd("ctx");
  4946. return self.pop();;
  4947. return self;
  4948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4949. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4950. //>>excludeEnd("ctx");
  4951. },
  4952. //>>excludeStart("ide", pragmas.excludeIdeData);
  4953. args: [],
  4954. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  4955. referencedClasses: [],
  4956. //>>excludeEnd("ide");
  4957. messageSends: []
  4958. }),
  4959. $globals.Array);
  4960. $core.addMethod(
  4961. $core.method({
  4962. selector: "reversed",
  4963. protocol: 'converting',
  4964. fn: function (){
  4965. var self=this;
  4966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4967. return $core.withContext(function($ctx1) {
  4968. //>>excludeEnd("ctx");
  4969. return self.slice().reverse();
  4970. return self;
  4971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4972. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4973. //>>excludeEnd("ctx");
  4974. },
  4975. //>>excludeStart("ide", pragmas.excludeIdeData);
  4976. args: [],
  4977. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  4978. referencedClasses: [],
  4979. //>>excludeEnd("ide");
  4980. messageSends: []
  4981. }),
  4982. $globals.Array);
  4983. $core.addMethod(
  4984. $core.method({
  4985. selector: "select:",
  4986. protocol: 'enumerating',
  4987. fn: function (aBlock){
  4988. var self=this;
  4989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4990. return $core.withContext(function($ctx1) {
  4991. //>>excludeEnd("ctx");
  4992. return self.filter(function(each) {return aBlock._value_(each)});
  4993. return self;
  4994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4995. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4996. //>>excludeEnd("ctx");
  4997. },
  4998. //>>excludeStart("ide", pragmas.excludeIdeData);
  4999. args: ["aBlock"],
  5000. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  5001. referencedClasses: [],
  5002. //>>excludeEnd("ide");
  5003. messageSends: []
  5004. }),
  5005. $globals.Array);
  5006. $core.addMethod(
  5007. $core.method({
  5008. selector: "shallowCopy",
  5009. protocol: 'copying',
  5010. fn: function (){
  5011. var self=this;
  5012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5013. return $core.withContext(function($ctx1) {
  5014. //>>excludeEnd("ctx");
  5015. return self.slice();
  5016. return self;
  5017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5018. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  5019. //>>excludeEnd("ctx");
  5020. },
  5021. //>>excludeStart("ide", pragmas.excludeIdeData);
  5022. args: [],
  5023. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  5024. referencedClasses: [],
  5025. //>>excludeEnd("ide");
  5026. messageSends: []
  5027. }),
  5028. $globals.Array);
  5029. $core.addMethod(
  5030. $core.method({
  5031. selector: "size",
  5032. protocol: 'accessing',
  5033. fn: function (){
  5034. var self=this;
  5035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5036. return $core.withContext(function($ctx1) {
  5037. //>>excludeEnd("ctx");
  5038. return self.length;
  5039. return self;
  5040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5041. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  5042. //>>excludeEnd("ctx");
  5043. },
  5044. //>>excludeStart("ide", pragmas.excludeIdeData);
  5045. args: [],
  5046. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  5047. referencedClasses: [],
  5048. //>>excludeEnd("ide");
  5049. messageSends: []
  5050. }),
  5051. $globals.Array);
  5052. $core.addMethod(
  5053. $core.method({
  5054. selector: "sort",
  5055. protocol: 'enumerating',
  5056. fn: function (){
  5057. var self=this;
  5058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5059. return $core.withContext(function($ctx1) {
  5060. //>>excludeEnd("ctx");
  5061. return self._sort_((function(a,b){
  5062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5063. return $core.withContext(function($ctx2) {
  5064. //>>excludeEnd("ctx");
  5065. return $recv(a).__lt(b);
  5066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5067. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5068. //>>excludeEnd("ctx");
  5069. }));
  5070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5071. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  5072. //>>excludeEnd("ctx");
  5073. },
  5074. //>>excludeStart("ide", pragmas.excludeIdeData);
  5075. args: [],
  5076. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5077. referencedClasses: [],
  5078. //>>excludeEnd("ide");
  5079. messageSends: ["sort:", "<"]
  5080. }),
  5081. $globals.Array);
  5082. $core.addMethod(
  5083. $core.method({
  5084. selector: "sort:",
  5085. protocol: 'enumerating',
  5086. fn: function (aBlock){
  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. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5093. })
  5094. ;
  5095. return self;
  5096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5097. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5098. //>>excludeEnd("ctx");
  5099. },
  5100. //>>excludeStart("ide", pragmas.excludeIdeData);
  5101. args: ["aBlock"],
  5102. 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'>",
  5103. referencedClasses: [],
  5104. //>>excludeEnd("ide");
  5105. messageSends: []
  5106. }),
  5107. $globals.Array);
  5108. $core.addMethod(
  5109. $core.method({
  5110. selector: "sorted",
  5111. protocol: 'enumerating',
  5112. fn: function (){
  5113. var self=this;
  5114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5115. return $core.withContext(function($ctx1) {
  5116. //>>excludeEnd("ctx");
  5117. return $recv(self._copy())._sort();
  5118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5119. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5120. //>>excludeEnd("ctx");
  5121. },
  5122. //>>excludeStart("ide", pragmas.excludeIdeData);
  5123. args: [],
  5124. source: "sorted\x0a\x09^ self copy sort",
  5125. referencedClasses: [],
  5126. //>>excludeEnd("ide");
  5127. messageSends: ["sort", "copy"]
  5128. }),
  5129. $globals.Array);
  5130. $core.addMethod(
  5131. $core.method({
  5132. selector: "sorted:",
  5133. protocol: 'enumerating',
  5134. fn: function (aBlock){
  5135. var self=this;
  5136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5137. return $core.withContext(function($ctx1) {
  5138. //>>excludeEnd("ctx");
  5139. return $recv(self._copy())._sort_(aBlock);
  5140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5141. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5142. //>>excludeEnd("ctx");
  5143. },
  5144. //>>excludeStart("ide", pragmas.excludeIdeData);
  5145. args: ["aBlock"],
  5146. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5147. referencedClasses: [],
  5148. //>>excludeEnd("ide");
  5149. messageSends: ["sort:", "copy"]
  5150. }),
  5151. $globals.Array);
  5152. $core.addMethod(
  5153. $core.method({
  5154. selector: "new:",
  5155. protocol: 'instance creation',
  5156. fn: function (anInteger){
  5157. var self=this;
  5158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5159. return $core.withContext(function($ctx1) {
  5160. //>>excludeEnd("ctx");
  5161. return new Array(anInteger);
  5162. return self;
  5163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5164. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  5165. //>>excludeEnd("ctx");
  5166. },
  5167. //>>excludeStart("ide", pragmas.excludeIdeData);
  5168. args: ["anInteger"],
  5169. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  5170. referencedClasses: [],
  5171. //>>excludeEnd("ide");
  5172. messageSends: []
  5173. }),
  5174. $globals.Array.klass);
  5175. $core.addMethod(
  5176. $core.method({
  5177. selector: "with:",
  5178. protocol: 'instance creation',
  5179. fn: function (anObject){
  5180. var self=this;
  5181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5182. return $core.withContext(function($ctx1) {
  5183. //>>excludeEnd("ctx");
  5184. var $1;
  5185. $1=self._new_((1));
  5186. $recv($1)._at_put_((1),anObject);
  5187. return $recv($1)._yourself();
  5188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5189. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  5190. //>>excludeEnd("ctx");
  5191. },
  5192. //>>excludeStart("ide", pragmas.excludeIdeData);
  5193. args: ["anObject"],
  5194. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5195. referencedClasses: [],
  5196. //>>excludeEnd("ide");
  5197. messageSends: ["at:put:", "new:", "yourself"]
  5198. }),
  5199. $globals.Array.klass);
  5200. $core.addMethod(
  5201. $core.method({
  5202. selector: "with:with:",
  5203. protocol: 'instance creation',
  5204. fn: function (anObject,anObject2){
  5205. var self=this;
  5206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5207. return $core.withContext(function($ctx1) {
  5208. //>>excludeEnd("ctx");
  5209. var $1;
  5210. $1=self._new_((2));
  5211. $recv($1)._at_put_((1),anObject);
  5212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5213. $ctx1.sendIdx["at:put:"]=1;
  5214. //>>excludeEnd("ctx");
  5215. $recv($1)._at_put_((2),anObject2);
  5216. return $recv($1)._yourself();
  5217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5218. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  5219. //>>excludeEnd("ctx");
  5220. },
  5221. //>>excludeStart("ide", pragmas.excludeIdeData);
  5222. args: ["anObject", "anObject2"],
  5223. 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",
  5224. referencedClasses: [],
  5225. //>>excludeEnd("ide");
  5226. messageSends: ["at:put:", "new:", "yourself"]
  5227. }),
  5228. $globals.Array.klass);
  5229. $core.addMethod(
  5230. $core.method({
  5231. selector: "with:with:with:",
  5232. protocol: 'instance creation',
  5233. fn: function (anObject,anObject2,anObject3){
  5234. var self=this;
  5235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5236. return $core.withContext(function($ctx1) {
  5237. //>>excludeEnd("ctx");
  5238. var $1;
  5239. $1=self._new_((3));
  5240. $recv($1)._at_put_((1),anObject);
  5241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5242. $ctx1.sendIdx["at:put:"]=1;
  5243. //>>excludeEnd("ctx");
  5244. $recv($1)._at_put_((2),anObject2);
  5245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5246. $ctx1.sendIdx["at:put:"]=2;
  5247. //>>excludeEnd("ctx");
  5248. $recv($1)._at_put_((3),anObject3);
  5249. return $recv($1)._yourself();
  5250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5251. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  5252. //>>excludeEnd("ctx");
  5253. },
  5254. //>>excludeStart("ide", pragmas.excludeIdeData);
  5255. args: ["anObject", "anObject2", "anObject3"],
  5256. 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",
  5257. referencedClasses: [],
  5258. //>>excludeEnd("ide");
  5259. messageSends: ["at:put:", "new:", "yourself"]
  5260. }),
  5261. $globals.Array.klass);
  5262. $core.addMethod(
  5263. $core.method({
  5264. selector: "withAll:",
  5265. protocol: 'instance creation',
  5266. fn: function (aCollection){
  5267. var self=this;
  5268. var instance,index;
  5269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5270. return $core.withContext(function($ctx1) {
  5271. //>>excludeEnd("ctx");
  5272. index=(1);
  5273. instance=self._new_($recv(aCollection)._size());
  5274. $recv(aCollection)._do_((function(each){
  5275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5276. return $core.withContext(function($ctx2) {
  5277. //>>excludeEnd("ctx");
  5278. $recv(instance)._at_put_(index,each);
  5279. index=$recv(index).__plus((1));
  5280. return index;
  5281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5282. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5283. //>>excludeEnd("ctx");
  5284. }));
  5285. return instance;
  5286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5287. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  5288. //>>excludeEnd("ctx");
  5289. },
  5290. //>>excludeStart("ide", pragmas.excludeIdeData);
  5291. args: ["aCollection"],
  5292. 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",
  5293. referencedClasses: [],
  5294. //>>excludeEnd("ide");
  5295. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5296. }),
  5297. $globals.Array.klass);
  5298. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  5299. //>>excludeStart("ide", pragmas.excludeIdeData);
  5300. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5301. //>>excludeEnd("ide");
  5302. $core.addMethod(
  5303. $core.method({
  5304. selector: ",",
  5305. protocol: 'copying',
  5306. fn: function (aString){
  5307. var self=this;
  5308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5309. return $core.withContext(function($ctx1) {
  5310. //>>excludeEnd("ctx");
  5311. var $1;
  5312. $1=self._asString();
  5313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5314. $ctx1.sendIdx["asString"]=1;
  5315. //>>excludeEnd("ctx");
  5316. return $recv($1).__comma($recv(aString)._asString());
  5317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5318. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  5319. //>>excludeEnd("ctx");
  5320. },
  5321. //>>excludeStart("ide", pragmas.excludeIdeData);
  5322. args: ["aString"],
  5323. source: ", aString\x0a\x09^ self asString, aString asString",
  5324. referencedClasses: [],
  5325. //>>excludeEnd("ide");
  5326. messageSends: [",", "asString"]
  5327. }),
  5328. $globals.CharacterArray);
  5329. $core.addMethod(
  5330. $core.method({
  5331. selector: "add:",
  5332. protocol: 'adding/removing',
  5333. fn: function (anObject){
  5334. var self=this;
  5335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5336. return $core.withContext(function($ctx1) {
  5337. //>>excludeEnd("ctx");
  5338. self._errorReadOnly();
  5339. return self;
  5340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5341. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  5342. //>>excludeEnd("ctx");
  5343. },
  5344. //>>excludeStart("ide", pragmas.excludeIdeData);
  5345. args: ["anObject"],
  5346. source: "add: anObject\x0a\x09self errorReadOnly",
  5347. referencedClasses: [],
  5348. //>>excludeEnd("ide");
  5349. messageSends: ["errorReadOnly"]
  5350. }),
  5351. $globals.CharacterArray);
  5352. $core.addMethod(
  5353. $core.method({
  5354. selector: "asLowercase",
  5355. protocol: 'converting',
  5356. fn: function (){
  5357. var self=this;
  5358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5359. return $core.withContext(function($ctx1) {
  5360. //>>excludeEnd("ctx");
  5361. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  5362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5363. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  5364. //>>excludeEnd("ctx");
  5365. },
  5366. //>>excludeStart("ide", pragmas.excludeIdeData);
  5367. args: [],
  5368. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5369. referencedClasses: [],
  5370. //>>excludeEnd("ide");
  5371. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5372. }),
  5373. $globals.CharacterArray);
  5374. $core.addMethod(
  5375. $core.method({
  5376. selector: "asNumber",
  5377. protocol: 'converting',
  5378. fn: function (){
  5379. var self=this;
  5380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5381. return $core.withContext(function($ctx1) {
  5382. //>>excludeEnd("ctx");
  5383. return $recv(self._asString())._asNumber();
  5384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5385. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  5386. //>>excludeEnd("ctx");
  5387. },
  5388. //>>excludeStart("ide", pragmas.excludeIdeData);
  5389. args: [],
  5390. source: "asNumber\x0a\x09^ self asString asNumber",
  5391. referencedClasses: [],
  5392. //>>excludeEnd("ide");
  5393. messageSends: ["asNumber", "asString"]
  5394. }),
  5395. $globals.CharacterArray);
  5396. $core.addMethod(
  5397. $core.method({
  5398. selector: "asString",
  5399. protocol: 'converting',
  5400. fn: function (){
  5401. var self=this;
  5402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5403. return $core.withContext(function($ctx1) {
  5404. //>>excludeEnd("ctx");
  5405. return self._subclassResponsibility();
  5406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5407. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  5408. //>>excludeEnd("ctx");
  5409. },
  5410. //>>excludeStart("ide", pragmas.excludeIdeData);
  5411. args: [],
  5412. source: "asString\x0a\x09^ self subclassResponsibility",
  5413. referencedClasses: [],
  5414. //>>excludeEnd("ide");
  5415. messageSends: ["subclassResponsibility"]
  5416. }),
  5417. $globals.CharacterArray);
  5418. $core.addMethod(
  5419. $core.method({
  5420. selector: "asSymbol",
  5421. protocol: 'converting',
  5422. fn: function (){
  5423. var self=this;
  5424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5425. return $core.withContext(function($ctx1) {
  5426. //>>excludeEnd("ctx");
  5427. return self._asString();
  5428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5429. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  5430. //>>excludeEnd("ctx");
  5431. },
  5432. //>>excludeStart("ide", pragmas.excludeIdeData);
  5433. args: [],
  5434. source: "asSymbol\x0a\x09^ self asString",
  5435. referencedClasses: [],
  5436. //>>excludeEnd("ide");
  5437. messageSends: ["asString"]
  5438. }),
  5439. $globals.CharacterArray);
  5440. $core.addMethod(
  5441. $core.method({
  5442. selector: "asUppercase",
  5443. protocol: 'converting',
  5444. fn: function (){
  5445. var self=this;
  5446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5447. return $core.withContext(function($ctx1) {
  5448. //>>excludeEnd("ctx");
  5449. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  5450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5451. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  5452. //>>excludeEnd("ctx");
  5453. },
  5454. //>>excludeStart("ide", pragmas.excludeIdeData);
  5455. args: [],
  5456. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5457. referencedClasses: [],
  5458. //>>excludeEnd("ide");
  5459. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5460. }),
  5461. $globals.CharacterArray);
  5462. $core.addMethod(
  5463. $core.method({
  5464. selector: "at:put:",
  5465. protocol: 'accessing',
  5466. fn: function (anIndex,anObject){
  5467. var self=this;
  5468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5469. return $core.withContext(function($ctx1) {
  5470. //>>excludeEnd("ctx");
  5471. self._errorReadOnly();
  5472. return self;
  5473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5474. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  5475. //>>excludeEnd("ctx");
  5476. },
  5477. //>>excludeStart("ide", pragmas.excludeIdeData);
  5478. args: ["anIndex", "anObject"],
  5479. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5480. referencedClasses: [],
  5481. //>>excludeEnd("ide");
  5482. messageSends: ["errorReadOnly"]
  5483. }),
  5484. $globals.CharacterArray);
  5485. $core.addMethod(
  5486. $core.method({
  5487. selector: "errorReadOnly",
  5488. protocol: 'error handling',
  5489. fn: function (){
  5490. var self=this;
  5491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5492. return $core.withContext(function($ctx1) {
  5493. //>>excludeEnd("ctx");
  5494. self._error_("Object is read-only");
  5495. return self;
  5496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5497. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  5498. //>>excludeEnd("ctx");
  5499. },
  5500. //>>excludeStart("ide", pragmas.excludeIdeData);
  5501. args: [],
  5502. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5503. referencedClasses: [],
  5504. //>>excludeEnd("ide");
  5505. messageSends: ["error:"]
  5506. }),
  5507. $globals.CharacterArray);
  5508. $core.addMethod(
  5509. $core.method({
  5510. selector: "printOn:",
  5511. protocol: 'printing',
  5512. fn: function (aStream){
  5513. var self=this;
  5514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5515. return $core.withContext(function($ctx1) {
  5516. //>>excludeEnd("ctx");
  5517. $recv(self._asString())._printOn_(aStream);
  5518. return self;
  5519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5520. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  5521. //>>excludeEnd("ctx");
  5522. },
  5523. //>>excludeStart("ide", pragmas.excludeIdeData);
  5524. args: ["aStream"],
  5525. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5526. referencedClasses: [],
  5527. //>>excludeEnd("ide");
  5528. messageSends: ["printOn:", "asString"]
  5529. }),
  5530. $globals.CharacterArray);
  5531. $core.addMethod(
  5532. $core.method({
  5533. selector: "putOn:",
  5534. protocol: 'streaming',
  5535. fn: function (aStream){
  5536. var self=this;
  5537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5538. return $core.withContext(function($ctx1) {
  5539. //>>excludeEnd("ctx");
  5540. $recv(aStream)._nextPutString_(self);
  5541. return self;
  5542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5543. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  5544. //>>excludeEnd("ctx");
  5545. },
  5546. //>>excludeStart("ide", pragmas.excludeIdeData);
  5547. args: ["aStream"],
  5548. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5549. referencedClasses: [],
  5550. //>>excludeEnd("ide");
  5551. messageSends: ["nextPutString:"]
  5552. }),
  5553. $globals.CharacterArray);
  5554. $core.addMethod(
  5555. $core.method({
  5556. selector: "remove:",
  5557. protocol: 'adding/removing',
  5558. fn: function (anObject){
  5559. var self=this;
  5560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5561. return $core.withContext(function($ctx1) {
  5562. //>>excludeEnd("ctx");
  5563. self._errorReadOnly();
  5564. return self;
  5565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5566. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  5567. //>>excludeEnd("ctx");
  5568. },
  5569. //>>excludeStart("ide", pragmas.excludeIdeData);
  5570. args: ["anObject"],
  5571. source: "remove: anObject\x0a\x09self errorReadOnly",
  5572. referencedClasses: [],
  5573. //>>excludeEnd("ide");
  5574. messageSends: ["errorReadOnly"]
  5575. }),
  5576. $globals.CharacterArray);
  5577. $core.addMethod(
  5578. $core.method({
  5579. selector: "fromString:",
  5580. protocol: 'instance creation',
  5581. fn: function (aString){
  5582. var self=this;
  5583. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5584. return $core.withContext(function($ctx1) {
  5585. //>>excludeEnd("ctx");
  5586. self._subclassResponsibility();
  5587. return self;
  5588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5589. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  5590. //>>excludeEnd("ctx");
  5591. },
  5592. //>>excludeStart("ide", pragmas.excludeIdeData);
  5593. args: ["aString"],
  5594. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5595. referencedClasses: [],
  5596. //>>excludeEnd("ide");
  5597. messageSends: ["subclassResponsibility"]
  5598. }),
  5599. $globals.CharacterArray.klass);
  5600. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  5601. //>>excludeStart("ide", pragmas.excludeIdeData);
  5602. $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 >> #,`";
  5603. //>>excludeEnd("ide");
  5604. $core.addMethod(
  5605. $core.method({
  5606. selector: ",",
  5607. protocol: 'copying',
  5608. fn: function (aString){
  5609. var self=this;
  5610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5611. return $core.withContext(function($ctx1) {
  5612. //>>excludeEnd("ctx");
  5613. return String(self) + aString;
  5614. return self;
  5615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5616. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5617. //>>excludeEnd("ctx");
  5618. },
  5619. //>>excludeStart("ide", pragmas.excludeIdeData);
  5620. args: ["aString"],
  5621. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  5622. referencedClasses: [],
  5623. //>>excludeEnd("ide");
  5624. messageSends: []
  5625. }),
  5626. $globals.String);
  5627. $core.addMethod(
  5628. $core.method({
  5629. selector: "<",
  5630. protocol: 'comparing',
  5631. fn: function (aString){
  5632. var self=this;
  5633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5634. return $core.withContext(function($ctx1) {
  5635. //>>excludeEnd("ctx");
  5636. return String(self) < aString._asString();
  5637. return self;
  5638. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5639. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5640. //>>excludeEnd("ctx");
  5641. },
  5642. //>>excludeStart("ide", pragmas.excludeIdeData);
  5643. args: ["aString"],
  5644. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  5645. referencedClasses: [],
  5646. //>>excludeEnd("ide");
  5647. messageSends: []
  5648. }),
  5649. $globals.String);
  5650. $core.addMethod(
  5651. $core.method({
  5652. selector: "<=",
  5653. protocol: 'comparing',
  5654. fn: function (aString){
  5655. var self=this;
  5656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5657. return $core.withContext(function($ctx1) {
  5658. //>>excludeEnd("ctx");
  5659. return String(self) <= aString._asString();
  5660. return self;
  5661. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5662. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5663. //>>excludeEnd("ctx");
  5664. },
  5665. //>>excludeStart("ide", pragmas.excludeIdeData);
  5666. args: ["aString"],
  5667. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  5668. referencedClasses: [],
  5669. //>>excludeEnd("ide");
  5670. messageSends: []
  5671. }),
  5672. $globals.String);
  5673. $core.addMethod(
  5674. $core.method({
  5675. selector: "=",
  5676. protocol: 'comparing',
  5677. fn: function (aString){
  5678. var self=this;
  5679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5680. return $core.withContext(function($ctx1) {
  5681. //>>excludeEnd("ctx");
  5682. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5683. return self;
  5684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5685. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5686. //>>excludeEnd("ctx");
  5687. },
  5688. //>>excludeStart("ide", pragmas.excludeIdeData);
  5689. args: ["aString"],
  5690. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  5691. referencedClasses: [],
  5692. //>>excludeEnd("ide");
  5693. messageSends: []
  5694. }),
  5695. $globals.String);
  5696. $core.addMethod(
  5697. $core.method({
  5698. selector: "==",
  5699. protocol: 'comparing',
  5700. fn: function (aString){
  5701. var self=this;
  5702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5703. return $core.withContext(function($ctx1) {
  5704. //>>excludeEnd("ctx");
  5705. if (typeof aString === "string") return String(self) === aString;
  5706. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5707. else return false;;
  5708. return self;
  5709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5710. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5711. //>>excludeEnd("ctx");
  5712. },
  5713. //>>excludeStart("ide", pragmas.excludeIdeData);
  5714. args: ["aString"],
  5715. 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'>",
  5716. referencedClasses: [],
  5717. //>>excludeEnd("ide");
  5718. messageSends: []
  5719. }),
  5720. $globals.String);
  5721. $core.addMethod(
  5722. $core.method({
  5723. selector: ">",
  5724. protocol: 'comparing',
  5725. fn: function (aString){
  5726. var self=this;
  5727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5728. return $core.withContext(function($ctx1) {
  5729. //>>excludeEnd("ctx");
  5730. return String(self) > aString._asString();
  5731. return self;
  5732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5733. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5734. //>>excludeEnd("ctx");
  5735. },
  5736. //>>excludeStart("ide", pragmas.excludeIdeData);
  5737. args: ["aString"],
  5738. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  5739. referencedClasses: [],
  5740. //>>excludeEnd("ide");
  5741. messageSends: []
  5742. }),
  5743. $globals.String);
  5744. $core.addMethod(
  5745. $core.method({
  5746. selector: ">=",
  5747. protocol: 'comparing',
  5748. fn: function (aString){
  5749. var self=this;
  5750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5751. return $core.withContext(function($ctx1) {
  5752. //>>excludeEnd("ctx");
  5753. return String(self) >= aString._asString();
  5754. return self;
  5755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5756. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5757. //>>excludeEnd("ctx");
  5758. },
  5759. //>>excludeStart("ide", pragmas.excludeIdeData);
  5760. args: ["aString"],
  5761. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  5762. referencedClasses: [],
  5763. //>>excludeEnd("ide");
  5764. messageSends: []
  5765. }),
  5766. $globals.String);
  5767. $core.addMethod(
  5768. $core.method({
  5769. selector: "asJSON",
  5770. protocol: 'converting',
  5771. fn: function (){
  5772. var self=this;
  5773. return self;
  5774. },
  5775. //>>excludeStart("ide", pragmas.excludeIdeData);
  5776. args: [],
  5777. source: "asJSON\x0a\x09^ self",
  5778. referencedClasses: [],
  5779. //>>excludeEnd("ide");
  5780. messageSends: []
  5781. }),
  5782. $globals.String);
  5783. $core.addMethod(
  5784. $core.method({
  5785. selector: "asJavaScriptMethodName",
  5786. protocol: 'converting',
  5787. fn: function (){
  5788. var self=this;
  5789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5790. return $core.withContext(function($ctx1) {
  5791. //>>excludeEnd("ctx");
  5792. return $core.st2js(self);
  5793. return self;
  5794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5795. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5796. //>>excludeEnd("ctx");
  5797. },
  5798. //>>excludeStart("ide", pragmas.excludeIdeData);
  5799. args: [],
  5800. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  5801. referencedClasses: [],
  5802. //>>excludeEnd("ide");
  5803. messageSends: []
  5804. }),
  5805. $globals.String);
  5806. $core.addMethod(
  5807. $core.method({
  5808. selector: "asJavascript",
  5809. protocol: 'converting',
  5810. fn: function (){
  5811. var self=this;
  5812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5813. return $core.withContext(function($ctx1) {
  5814. //>>excludeEnd("ctx");
  5815. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5816. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5817. else
  5818. return "\"" + self + "\"";
  5819. ;
  5820. return self;
  5821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5822. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  5823. //>>excludeEnd("ctx");
  5824. },
  5825. //>>excludeStart("ide", pragmas.excludeIdeData);
  5826. args: [],
  5827. 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'>",
  5828. referencedClasses: [],
  5829. //>>excludeEnd("ide");
  5830. messageSends: []
  5831. }),
  5832. $globals.String);
  5833. $core.addMethod(
  5834. $core.method({
  5835. selector: "asLowercase",
  5836. protocol: 'converting',
  5837. fn: function (){
  5838. var self=this;
  5839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5840. return $core.withContext(function($ctx1) {
  5841. //>>excludeEnd("ctx");
  5842. return self.toLowerCase();
  5843. return self;
  5844. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5845. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5846. //>>excludeEnd("ctx");
  5847. },
  5848. //>>excludeStart("ide", pragmas.excludeIdeData);
  5849. args: [],
  5850. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  5851. referencedClasses: [],
  5852. //>>excludeEnd("ide");
  5853. messageSends: []
  5854. }),
  5855. $globals.String);
  5856. $core.addMethod(
  5857. $core.method({
  5858. selector: "asMutator",
  5859. protocol: 'converting',
  5860. fn: function (){
  5861. var self=this;
  5862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5863. return $core.withContext(function($ctx1) {
  5864. //>>excludeEnd("ctx");
  5865. var $1;
  5866. $1=$recv(self._last()).__eq(":");
  5867. if(!$core.assert($1)){
  5868. return self.__comma(":");
  5869. }
  5870. return self;
  5871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5872. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5873. //>>excludeEnd("ctx");
  5874. },
  5875. //>>excludeStart("ide", pragmas.excludeIdeData);
  5876. args: [],
  5877. 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",
  5878. referencedClasses: [],
  5879. //>>excludeEnd("ide");
  5880. messageSends: ["ifFalse:", "=", "last", ","]
  5881. }),
  5882. $globals.String);
  5883. $core.addMethod(
  5884. $core.method({
  5885. selector: "asNumber",
  5886. protocol: 'converting',
  5887. fn: function (){
  5888. var self=this;
  5889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5890. return $core.withContext(function($ctx1) {
  5891. //>>excludeEnd("ctx");
  5892. return Number(self);
  5893. return self;
  5894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5895. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5896. //>>excludeEnd("ctx");
  5897. },
  5898. //>>excludeStart("ide", pragmas.excludeIdeData);
  5899. args: [],
  5900. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  5901. referencedClasses: [],
  5902. //>>excludeEnd("ide");
  5903. messageSends: []
  5904. }),
  5905. $globals.String);
  5906. $core.addMethod(
  5907. $core.method({
  5908. selector: "asRegexp",
  5909. protocol: 'converting',
  5910. fn: function (){
  5911. var self=this;
  5912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5913. return $core.withContext(function($ctx1) {
  5914. //>>excludeEnd("ctx");
  5915. return $recv($globals.RegularExpression)._fromString_(self);
  5916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5917. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5918. //>>excludeEnd("ctx");
  5919. },
  5920. //>>excludeStart("ide", pragmas.excludeIdeData);
  5921. args: [],
  5922. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5923. referencedClasses: ["RegularExpression"],
  5924. //>>excludeEnd("ide");
  5925. messageSends: ["fromString:"]
  5926. }),
  5927. $globals.String);
  5928. $core.addMethod(
  5929. $core.method({
  5930. selector: "asString",
  5931. protocol: 'converting',
  5932. fn: function (){
  5933. var self=this;
  5934. return self;
  5935. },
  5936. //>>excludeStart("ide", pragmas.excludeIdeData);
  5937. args: [],
  5938. source: "asString\x0a\x09^ self",
  5939. referencedClasses: [],
  5940. //>>excludeEnd("ide");
  5941. messageSends: []
  5942. }),
  5943. $globals.String);
  5944. $core.addMethod(
  5945. $core.method({
  5946. selector: "asSymbol",
  5947. protocol: 'converting',
  5948. fn: function (){
  5949. var self=this;
  5950. return self;
  5951. },
  5952. //>>excludeStart("ide", pragmas.excludeIdeData);
  5953. args: [],
  5954. source: "asSymbol\x0a\x09^ self",
  5955. referencedClasses: [],
  5956. //>>excludeEnd("ide");
  5957. messageSends: []
  5958. }),
  5959. $globals.String);
  5960. $core.addMethod(
  5961. $core.method({
  5962. selector: "asUppercase",
  5963. protocol: 'converting',
  5964. fn: function (){
  5965. var self=this;
  5966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5967. return $core.withContext(function($ctx1) {
  5968. //>>excludeEnd("ctx");
  5969. return self.toUpperCase();
  5970. return self;
  5971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5972. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5973. //>>excludeEnd("ctx");
  5974. },
  5975. //>>excludeStart("ide", pragmas.excludeIdeData);
  5976. args: [],
  5977. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  5978. referencedClasses: [],
  5979. //>>excludeEnd("ide");
  5980. messageSends: []
  5981. }),
  5982. $globals.String);
  5983. $core.addMethod(
  5984. $core.method({
  5985. selector: "asciiValue",
  5986. protocol: 'accessing',
  5987. fn: function (){
  5988. var self=this;
  5989. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5990. return $core.withContext(function($ctx1) {
  5991. //>>excludeEnd("ctx");
  5992. return self.charCodeAt(0);;
  5993. return self;
  5994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5995. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5996. //>>excludeEnd("ctx");
  5997. },
  5998. //>>excludeStart("ide", pragmas.excludeIdeData);
  5999. args: [],
  6000. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  6001. referencedClasses: [],
  6002. //>>excludeEnd("ide");
  6003. messageSends: []
  6004. }),
  6005. $globals.String);
  6006. $core.addMethod(
  6007. $core.method({
  6008. selector: "at:ifAbsent:",
  6009. protocol: 'accessing',
  6010. fn: function (anIndex,aBlock){
  6011. var self=this;
  6012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6013. return $core.withContext(function($ctx1) {
  6014. //>>excludeEnd("ctx");
  6015. return String(self)[anIndex - 1] || aBlock._value();
  6016. return self;
  6017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6018. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  6019. //>>excludeEnd("ctx");
  6020. },
  6021. //>>excludeStart("ide", pragmas.excludeIdeData);
  6022. args: ["anIndex", "aBlock"],
  6023. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  6024. referencedClasses: [],
  6025. //>>excludeEnd("ide");
  6026. messageSends: []
  6027. }),
  6028. $globals.String);
  6029. $core.addMethod(
  6030. $core.method({
  6031. selector: "at:ifPresent:ifAbsent:",
  6032. protocol: 'accessing',
  6033. fn: function (anIndex,aBlock,anotherBlock){
  6034. var self=this;
  6035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6036. return $core.withContext(function($ctx1) {
  6037. //>>excludeEnd("ctx");
  6038. var result = String(self)[anIndex - 1];
  6039. return result ? aBlock._value_(result) : anotherBlock._value();
  6040. ;
  6041. return self;
  6042. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6043. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  6044. //>>excludeEnd("ctx");
  6045. },
  6046. //>>excludeStart("ide", pragmas.excludeIdeData);
  6047. args: ["anIndex", "aBlock", "anotherBlock"],
  6048. 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'>",
  6049. referencedClasses: [],
  6050. //>>excludeEnd("ide");
  6051. messageSends: []
  6052. }),
  6053. $globals.String);
  6054. $core.addMethod(
  6055. $core.method({
  6056. selector: "capitalized",
  6057. protocol: 'converting',
  6058. fn: function (){
  6059. var self=this;
  6060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6061. return $core.withContext(function($ctx1) {
  6062. //>>excludeEnd("ctx");
  6063. return self._ifNotEmpty_((function(){
  6064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6065. return $core.withContext(function($ctx2) {
  6066. //>>excludeEnd("ctx");
  6067. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  6068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6070. //>>excludeEnd("ctx");
  6071. }));
  6072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6073. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  6074. //>>excludeEnd("ctx");
  6075. },
  6076. //>>excludeStart("ide", pragmas.excludeIdeData);
  6077. args: [],
  6078. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  6079. referencedClasses: [],
  6080. //>>excludeEnd("ide");
  6081. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  6082. }),
  6083. $globals.String);
  6084. $core.addMethod(
  6085. $core.method({
  6086. selector: "charCodeAt:",
  6087. protocol: 'accessing',
  6088. fn: function (anInteger){
  6089. var self=this;
  6090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6091. return $core.withContext(function($ctx1) {
  6092. //>>excludeEnd("ctx");
  6093. return self.charCodeAt(anInteger - 1);
  6094. return self;
  6095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6096. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6097. //>>excludeEnd("ctx");
  6098. },
  6099. //>>excludeStart("ide", pragmas.excludeIdeData);
  6100. args: ["anInteger"],
  6101. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  6102. referencedClasses: [],
  6103. //>>excludeEnd("ide");
  6104. messageSends: []
  6105. }),
  6106. $globals.String);
  6107. $core.addMethod(
  6108. $core.method({
  6109. selector: "copyFrom:to:",
  6110. protocol: 'copying',
  6111. fn: function (anIndex,anotherIndex){
  6112. var self=this;
  6113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6114. return $core.withContext(function($ctx1) {
  6115. //>>excludeEnd("ctx");
  6116. return self.substring(anIndex - 1, anotherIndex);
  6117. return self;
  6118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6119. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6120. //>>excludeEnd("ctx");
  6121. },
  6122. //>>excludeStart("ide", pragmas.excludeIdeData);
  6123. args: ["anIndex", "anotherIndex"],
  6124. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  6125. referencedClasses: [],
  6126. //>>excludeEnd("ide");
  6127. messageSends: []
  6128. }),
  6129. $globals.String);
  6130. $core.addMethod(
  6131. $core.method({
  6132. selector: "crlfSanitized",
  6133. protocol: 'converting',
  6134. fn: function (){
  6135. var self=this;
  6136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6137. return $core.withContext(function($ctx1) {
  6138. //>>excludeEnd("ctx");
  6139. return $recv(self._lines())._join_($recv($globals.String)._lf());
  6140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6141. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6142. //>>excludeEnd("ctx");
  6143. },
  6144. //>>excludeStart("ide", pragmas.excludeIdeData);
  6145. args: [],
  6146. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6147. referencedClasses: ["String"],
  6148. //>>excludeEnd("ide");
  6149. messageSends: ["join:", "lines", "lf"]
  6150. }),
  6151. $globals.String);
  6152. $core.addMethod(
  6153. $core.method({
  6154. selector: "deepCopy",
  6155. protocol: 'copying',
  6156. fn: function (){
  6157. var self=this;
  6158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6159. return $core.withContext(function($ctx1) {
  6160. //>>excludeEnd("ctx");
  6161. return self._shallowCopy();
  6162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6163. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6164. //>>excludeEnd("ctx");
  6165. },
  6166. //>>excludeStart("ide", pragmas.excludeIdeData);
  6167. args: [],
  6168. source: "deepCopy\x0a\x09^ self shallowCopy",
  6169. referencedClasses: [],
  6170. //>>excludeEnd("ide");
  6171. messageSends: ["shallowCopy"]
  6172. }),
  6173. $globals.String);
  6174. $core.addMethod(
  6175. $core.method({
  6176. selector: "escaped",
  6177. protocol: 'converting',
  6178. fn: function (){
  6179. var self=this;
  6180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6181. return $core.withContext(function($ctx1) {
  6182. //>>excludeEnd("ctx");
  6183. return escape(self);
  6184. return self;
  6185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6186. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6187. //>>excludeEnd("ctx");
  6188. },
  6189. //>>excludeStart("ide", pragmas.excludeIdeData);
  6190. args: [],
  6191. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  6192. referencedClasses: [],
  6193. //>>excludeEnd("ide");
  6194. messageSends: []
  6195. }),
  6196. $globals.String);
  6197. $core.addMethod(
  6198. $core.method({
  6199. selector: "includesSubString:",
  6200. protocol: 'testing',
  6201. fn: function (subString){
  6202. var self=this;
  6203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6204. return $core.withContext(function($ctx1) {
  6205. //>>excludeEnd("ctx");
  6206. return self.indexOf(subString) != -1;
  6207. return self;
  6208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6209. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6210. //>>excludeEnd("ctx");
  6211. },
  6212. //>>excludeStart("ide", pragmas.excludeIdeData);
  6213. args: ["subString"],
  6214. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  6215. referencedClasses: [],
  6216. //>>excludeEnd("ide");
  6217. messageSends: []
  6218. }),
  6219. $globals.String);
  6220. $core.addMethod(
  6221. $core.method({
  6222. selector: "isCapitalized",
  6223. protocol: 'testing',
  6224. fn: function (){
  6225. var self=this;
  6226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6227. return $core.withContext(function($ctx1) {
  6228. //>>excludeEnd("ctx");
  6229. var $2,$1;
  6230. $2=self._first();
  6231. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6232. $ctx1.sendIdx["first"]=1;
  6233. //>>excludeEnd("ctx");
  6234. $1=$recv($2)._asUppercase();
  6235. return $recv($1).__eq_eq(self._first());
  6236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6237. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6238. //>>excludeEnd("ctx");
  6239. },
  6240. //>>excludeStart("ide", pragmas.excludeIdeData);
  6241. args: [],
  6242. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6243. referencedClasses: [],
  6244. //>>excludeEnd("ide");
  6245. messageSends: ["==", "asUppercase", "first"]
  6246. }),
  6247. $globals.String);
  6248. $core.addMethod(
  6249. $core.method({
  6250. selector: "isImmutable",
  6251. protocol: 'testing',
  6252. fn: function (){
  6253. var self=this;
  6254. return true;
  6255. },
  6256. //>>excludeStart("ide", pragmas.excludeIdeData);
  6257. args: [],
  6258. source: "isImmutable\x0a\x09^ true",
  6259. referencedClasses: [],
  6260. //>>excludeEnd("ide");
  6261. messageSends: []
  6262. }),
  6263. $globals.String);
  6264. $core.addMethod(
  6265. $core.method({
  6266. selector: "isString",
  6267. protocol: 'testing',
  6268. fn: function (){
  6269. var self=this;
  6270. return true;
  6271. },
  6272. //>>excludeStart("ide", pragmas.excludeIdeData);
  6273. args: [],
  6274. source: "isString\x0a\x09^ true",
  6275. referencedClasses: [],
  6276. //>>excludeEnd("ide");
  6277. messageSends: []
  6278. }),
  6279. $globals.String);
  6280. $core.addMethod(
  6281. $core.method({
  6282. selector: "isVowel",
  6283. protocol: 'testing',
  6284. fn: function (){
  6285. var self=this;
  6286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6287. return $core.withContext(function($ctx1) {
  6288. //>>excludeEnd("ctx");
  6289. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  6290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6291. return $core.withContext(function($ctx2) {
  6292. //>>excludeEnd("ctx");
  6293. return "aeiou"._includes_(self._asLowercase());
  6294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6295. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6296. //>>excludeEnd("ctx");
  6297. }));
  6298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6299. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6300. //>>excludeEnd("ctx");
  6301. },
  6302. //>>excludeStart("ide", pragmas.excludeIdeData);
  6303. args: [],
  6304. 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 ]",
  6305. referencedClasses: [],
  6306. //>>excludeEnd("ide");
  6307. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6308. }),
  6309. $globals.String);
  6310. $core.addMethod(
  6311. $core.method({
  6312. selector: "join:",
  6313. protocol: 'split join',
  6314. fn: function (aCollection){
  6315. var self=this;
  6316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6317. return $core.withContext(function($ctx1) {
  6318. //>>excludeEnd("ctx");
  6319. return $recv($globals.String)._streamContents_((function(stream){
  6320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6321. return $core.withContext(function($ctx2) {
  6322. //>>excludeEnd("ctx");
  6323. return $recv(aCollection)._do_separatedBy_((function(each){
  6324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6325. return $core.withContext(function($ctx3) {
  6326. //>>excludeEnd("ctx");
  6327. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6329. $ctx3.sendIdx["nextPutAll:"]=1;
  6330. //>>excludeEnd("ctx");
  6331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6332. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6333. //>>excludeEnd("ctx");
  6334. }),(function(){
  6335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6336. return $core.withContext(function($ctx3) {
  6337. //>>excludeEnd("ctx");
  6338. return $recv(stream)._nextPutAll_(self);
  6339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6340. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6341. //>>excludeEnd("ctx");
  6342. }));
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6345. //>>excludeEnd("ctx");
  6346. }));
  6347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6348. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6349. //>>excludeEnd("ctx");
  6350. },
  6351. //>>excludeStart("ide", pragmas.excludeIdeData);
  6352. args: ["aCollection"],
  6353. 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 ]]",
  6354. referencedClasses: ["String"],
  6355. //>>excludeEnd("ide");
  6356. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6357. }),
  6358. $globals.String);
  6359. $core.addMethod(
  6360. $core.method({
  6361. selector: "lineIndicesDo:",
  6362. protocol: 'split join',
  6363. fn: function (aBlock){
  6364. var self=this;
  6365. var cr,lf,start,sz,nextLF,nextCR;
  6366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6367. return $core.withContext(function($ctx1) {
  6368. //>>excludeEnd("ctx");
  6369. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6370. var $early={};
  6371. try {
  6372. start=(1);
  6373. sz=self._size();
  6374. cr=$recv($globals.String)._cr();
  6375. nextCR=self._indexOf_startingAt_(cr,(1));
  6376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6377. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6378. //>>excludeEnd("ctx");
  6379. lf=$recv($globals.String)._lf();
  6380. nextLF=self._indexOf_startingAt_(lf,(1));
  6381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6382. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6383. //>>excludeEnd("ctx");
  6384. $recv((function(){
  6385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6386. return $core.withContext(function($ctx2) {
  6387. //>>excludeEnd("ctx");
  6388. return $recv(start).__lt_eq(sz);
  6389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6391. //>>excludeEnd("ctx");
  6392. }))._whileTrue_((function(){
  6393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6394. return $core.withContext(function($ctx2) {
  6395. //>>excludeEnd("ctx");
  6396. $2=$recv(nextLF).__eq((0));
  6397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6398. $ctx2.sendIdx["="]=1;
  6399. //>>excludeEnd("ctx");
  6400. $1=$recv($2)._and_((function(){
  6401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6402. return $core.withContext(function($ctx3) {
  6403. //>>excludeEnd("ctx");
  6404. return $recv(nextCR).__eq((0));
  6405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6406. $ctx3.sendIdx["="]=2;
  6407. //>>excludeEnd("ctx");
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6410. //>>excludeEnd("ctx");
  6411. }));
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. $ctx2.sendIdx["and:"]=1;
  6414. //>>excludeEnd("ctx");
  6415. if($core.assert($1)){
  6416. $recv(aBlock)._value_value_value_(start,sz,sz);
  6417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6418. $ctx2.sendIdx["value:value:value:"]=1;
  6419. //>>excludeEnd("ctx");
  6420. throw $early=[self];
  6421. }
  6422. $4=$recv(nextCR).__eq((0));
  6423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6424. $ctx2.sendIdx["="]=3;
  6425. //>>excludeEnd("ctx");
  6426. $3=$recv($4)._or_((function(){
  6427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6428. return $core.withContext(function($ctx3) {
  6429. //>>excludeEnd("ctx");
  6430. $5=(0).__lt(nextLF);
  6431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6432. $ctx3.sendIdx["<"]=1;
  6433. //>>excludeEnd("ctx");
  6434. return $recv($5)._and_((function(){
  6435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6436. return $core.withContext(function($ctx4) {
  6437. //>>excludeEnd("ctx");
  6438. return $recv(nextLF).__lt(nextCR);
  6439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6440. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6441. //>>excludeEnd("ctx");
  6442. }));
  6443. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6444. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6445. //>>excludeEnd("ctx");
  6446. }));
  6447. if($core.assert($3)){
  6448. $6=start;
  6449. $7=$recv(nextLF).__minus((1));
  6450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6451. $ctx2.sendIdx["-"]=1;
  6452. //>>excludeEnd("ctx");
  6453. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6454. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6455. $ctx2.sendIdx["value:value:value:"]=2;
  6456. //>>excludeEnd("ctx");
  6457. start=(1).__plus(nextLF);
  6458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6459. $ctx2.sendIdx["+"]=1;
  6460. //>>excludeEnd("ctx");
  6461. start;
  6462. nextLF=self._indexOf_startingAt_(lf,start);
  6463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6464. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6465. //>>excludeEnd("ctx");
  6466. return nextLF;
  6467. } else {
  6468. $9=(1).__plus(nextCR);
  6469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6470. $ctx2.sendIdx["+"]=2;
  6471. //>>excludeEnd("ctx");
  6472. $8=$recv($9).__eq(nextLF);
  6473. if($core.assert($8)){
  6474. $10=start;
  6475. $11=$recv(nextCR).__minus((1));
  6476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6477. $ctx2.sendIdx["-"]=2;
  6478. //>>excludeEnd("ctx");
  6479. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6481. $ctx2.sendIdx["value:value:value:"]=3;
  6482. //>>excludeEnd("ctx");
  6483. start=(1).__plus(nextLF);
  6484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6485. $ctx2.sendIdx["+"]=3;
  6486. //>>excludeEnd("ctx");
  6487. start;
  6488. nextCR=self._indexOf_startingAt_(cr,start);
  6489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6490. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6491. //>>excludeEnd("ctx");
  6492. nextCR;
  6493. nextLF=self._indexOf_startingAt_(lf,start);
  6494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6495. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6496. //>>excludeEnd("ctx");
  6497. return nextLF;
  6498. } else {
  6499. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6500. start=(1).__plus(nextCR);
  6501. start;
  6502. nextCR=self._indexOf_startingAt_(cr,start);
  6503. return nextCR;
  6504. }
  6505. }
  6506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6508. //>>excludeEnd("ctx");
  6509. }));
  6510. return self;
  6511. }
  6512. catch(e) {if(e===$early)return e[0]; throw e}
  6513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6514. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6515. //>>excludeEnd("ctx");
  6516. },
  6517. //>>excludeStart("ide", pragmas.excludeIdeData);
  6518. args: ["aBlock"],
  6519. 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 ] ]]",
  6520. referencedClasses: ["String"],
  6521. //>>excludeEnd("ide");
  6522. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6523. }),
  6524. $globals.String);
  6525. $core.addMethod(
  6526. $core.method({
  6527. selector: "lineNumber:",
  6528. protocol: 'split join',
  6529. fn: function (anIndex){
  6530. var self=this;
  6531. var lineCount;
  6532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6533. return $core.withContext(function($ctx1) {
  6534. //>>excludeEnd("ctx");
  6535. var $2,$1;
  6536. var $early={};
  6537. try {
  6538. lineCount=(0);
  6539. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6541. return $core.withContext(function($ctx2) {
  6542. //>>excludeEnd("ctx");
  6543. lineCount=$recv(lineCount).__plus((1));
  6544. $2=lineCount;
  6545. $1=$recv($2).__eq(anIndex);
  6546. if($core.assert($1)){
  6547. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  6548. }
  6549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6550. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6551. //>>excludeEnd("ctx");
  6552. }));
  6553. return nil;
  6554. }
  6555. catch(e) {if(e===$early)return e[0]; throw e}
  6556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6557. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6558. //>>excludeEnd("ctx");
  6559. },
  6560. //>>excludeStart("ide", pragmas.excludeIdeData);
  6561. args: ["anIndex"],
  6562. 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",
  6563. referencedClasses: [],
  6564. //>>excludeEnd("ide");
  6565. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6566. }),
  6567. $globals.String);
  6568. $core.addMethod(
  6569. $core.method({
  6570. selector: "lines",
  6571. protocol: 'split join',
  6572. fn: function (){
  6573. var self=this;
  6574. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6575. return $core.withContext(function($ctx1) {
  6576. //>>excludeEnd("ctx");
  6577. var result = self.split(/\r\n|\r|\n/);
  6578. if (!result[result.length-1]) result.pop();
  6579. return result;;
  6580. return self;
  6581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6582. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6583. //>>excludeEnd("ctx");
  6584. },
  6585. //>>excludeStart("ide", pragmas.excludeIdeData);
  6586. args: [],
  6587. 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'>",
  6588. referencedClasses: [],
  6589. //>>excludeEnd("ide");
  6590. messageSends: []
  6591. }),
  6592. $globals.String);
  6593. $core.addMethod(
  6594. $core.method({
  6595. selector: "linesDo:",
  6596. protocol: 'split join',
  6597. fn: function (aBlock){
  6598. var self=this;
  6599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6600. return $core.withContext(function($ctx1) {
  6601. //>>excludeEnd("ctx");
  6602. $recv(self._lines())._do_(aBlock);
  6603. return self;
  6604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6605. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6606. //>>excludeEnd("ctx");
  6607. },
  6608. //>>excludeStart("ide", pragmas.excludeIdeData);
  6609. args: ["aBlock"],
  6610. 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",
  6611. referencedClasses: [],
  6612. //>>excludeEnd("ide");
  6613. messageSends: ["do:", "lines"]
  6614. }),
  6615. $globals.String);
  6616. $core.addMethod(
  6617. $core.method({
  6618. selector: "match:",
  6619. protocol: 'regular expressions',
  6620. fn: function (aRegexp){
  6621. var self=this;
  6622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6623. return $core.withContext(function($ctx1) {
  6624. //>>excludeEnd("ctx");
  6625. return self.search(aRegexp) != -1;
  6626. return self;
  6627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6628. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6629. //>>excludeEnd("ctx");
  6630. },
  6631. //>>excludeStart("ide", pragmas.excludeIdeData);
  6632. args: ["aRegexp"],
  6633. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  6634. referencedClasses: [],
  6635. //>>excludeEnd("ide");
  6636. messageSends: []
  6637. }),
  6638. $globals.String);
  6639. $core.addMethod(
  6640. $core.method({
  6641. selector: "matchesOf:",
  6642. protocol: 'regular expressions',
  6643. fn: function (aRegularExpression){
  6644. var self=this;
  6645. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6646. return $core.withContext(function($ctx1) {
  6647. //>>excludeEnd("ctx");
  6648. return self.match(aRegularExpression);
  6649. return self;
  6650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6651. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6652. //>>excludeEnd("ctx");
  6653. },
  6654. //>>excludeStart("ide", pragmas.excludeIdeData);
  6655. args: ["aRegularExpression"],
  6656. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  6657. referencedClasses: [],
  6658. //>>excludeEnd("ide");
  6659. messageSends: []
  6660. }),
  6661. $globals.String);
  6662. $core.addMethod(
  6663. $core.method({
  6664. selector: "numericallyIndexable",
  6665. protocol: 'private',
  6666. fn: function (){
  6667. var self=this;
  6668. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6669. return $core.withContext(function($ctx1) {
  6670. //>>excludeEnd("ctx");
  6671. return String(self);
  6672. return self;
  6673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6674. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6675. //>>excludeEnd("ctx");
  6676. },
  6677. //>>excludeStart("ide", pragmas.excludeIdeData);
  6678. args: [],
  6679. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  6680. referencedClasses: [],
  6681. //>>excludeEnd("ide");
  6682. messageSends: []
  6683. }),
  6684. $globals.String);
  6685. $core.addMethod(
  6686. $core.method({
  6687. selector: "printNl",
  6688. protocol: 'printing',
  6689. fn: function (){
  6690. var self=this;
  6691. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6692. return $core.withContext(function($ctx1) {
  6693. //>>excludeEnd("ctx");
  6694. console.log(self);
  6695. return self;
  6696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6697. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6698. //>>excludeEnd("ctx");
  6699. },
  6700. //>>excludeStart("ide", pragmas.excludeIdeData);
  6701. args: [],
  6702. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  6703. referencedClasses: [],
  6704. //>>excludeEnd("ide");
  6705. messageSends: []
  6706. }),
  6707. $globals.String);
  6708. $core.addMethod(
  6709. $core.method({
  6710. selector: "printOn:",
  6711. protocol: 'printing',
  6712. fn: function (aStream){
  6713. var self=this;
  6714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6715. return $core.withContext(function($ctx1) {
  6716. //>>excludeEnd("ctx");
  6717. $recv(aStream)._nextPutAll_("'");
  6718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6719. $ctx1.sendIdx["nextPutAll:"]=1;
  6720. //>>excludeEnd("ctx");
  6721. $recv(aStream)._nextPutAll_(self);
  6722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6723. $ctx1.sendIdx["nextPutAll:"]=2;
  6724. //>>excludeEnd("ctx");
  6725. $recv(aStream)._nextPutAll_("'");
  6726. return self;
  6727. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6728. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6729. //>>excludeEnd("ctx");
  6730. },
  6731. //>>excludeStart("ide", pragmas.excludeIdeData);
  6732. args: ["aStream"],
  6733. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  6734. referencedClasses: [],
  6735. //>>excludeEnd("ide");
  6736. messageSends: ["nextPutAll:"]
  6737. }),
  6738. $globals.String);
  6739. $core.addMethod(
  6740. $core.method({
  6741. selector: "replace:with:",
  6742. protocol: 'regular expressions',
  6743. fn: function (aString,anotherString){
  6744. var self=this;
  6745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6746. return $core.withContext(function($ctx1) {
  6747. //>>excludeEnd("ctx");
  6748. return self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  6749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6750. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6751. //>>excludeEnd("ctx");
  6752. },
  6753. //>>excludeStart("ide", pragmas.excludeIdeData);
  6754. args: ["aString", "anotherString"],
  6755. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6756. referencedClasses: ["RegularExpression"],
  6757. //>>excludeEnd("ide");
  6758. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6759. }),
  6760. $globals.String);
  6761. $core.addMethod(
  6762. $core.method({
  6763. selector: "replaceRegexp:with:",
  6764. protocol: 'regular expressions',
  6765. fn: function (aRegexp,aString){
  6766. var self=this;
  6767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6768. return $core.withContext(function($ctx1) {
  6769. //>>excludeEnd("ctx");
  6770. return self.replace(aRegexp, aString);
  6771. return self;
  6772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6773. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6774. //>>excludeEnd("ctx");
  6775. },
  6776. //>>excludeStart("ide", pragmas.excludeIdeData);
  6777. args: ["aRegexp", "aString"],
  6778. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  6779. referencedClasses: [],
  6780. //>>excludeEnd("ide");
  6781. messageSends: []
  6782. }),
  6783. $globals.String);
  6784. $core.addMethod(
  6785. $core.method({
  6786. selector: "reversed",
  6787. protocol: 'converting',
  6788. fn: function (){
  6789. var self=this;
  6790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6791. return $core.withContext(function($ctx1) {
  6792. //>>excludeEnd("ctx");
  6793. return self.split("").reverse().join("");
  6794. return self;
  6795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6796. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6797. //>>excludeEnd("ctx");
  6798. },
  6799. //>>excludeStart("ide", pragmas.excludeIdeData);
  6800. args: [],
  6801. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  6802. referencedClasses: [],
  6803. //>>excludeEnd("ide");
  6804. messageSends: []
  6805. }),
  6806. $globals.String);
  6807. $core.addMethod(
  6808. $core.method({
  6809. selector: "shallowCopy",
  6810. protocol: 'copying',
  6811. fn: function (){
  6812. var self=this;
  6813. return self;
  6814. },
  6815. //>>excludeStart("ide", pragmas.excludeIdeData);
  6816. args: [],
  6817. source: "shallowCopy\x0a\x09^ self",
  6818. referencedClasses: [],
  6819. //>>excludeEnd("ide");
  6820. messageSends: []
  6821. }),
  6822. $globals.String);
  6823. $core.addMethod(
  6824. $core.method({
  6825. selector: "size",
  6826. protocol: 'accessing',
  6827. fn: function (){
  6828. var self=this;
  6829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6830. return $core.withContext(function($ctx1) {
  6831. //>>excludeEnd("ctx");
  6832. return self.length;
  6833. return self;
  6834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6835. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6836. //>>excludeEnd("ctx");
  6837. },
  6838. //>>excludeStart("ide", pragmas.excludeIdeData);
  6839. args: [],
  6840. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  6841. referencedClasses: [],
  6842. //>>excludeEnd("ide");
  6843. messageSends: []
  6844. }),
  6845. $globals.String);
  6846. $core.addMethod(
  6847. $core.method({
  6848. selector: "subStrings:",
  6849. protocol: 'split join',
  6850. fn: function (aString){
  6851. var self=this;
  6852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6853. return $core.withContext(function($ctx1) {
  6854. //>>excludeEnd("ctx");
  6855. return self._tokenize_(aString);
  6856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6857. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6858. //>>excludeEnd("ctx");
  6859. },
  6860. //>>excludeStart("ide", pragmas.excludeIdeData);
  6861. args: ["aString"],
  6862. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6863. referencedClasses: [],
  6864. //>>excludeEnd("ide");
  6865. messageSends: ["tokenize:"]
  6866. }),
  6867. $globals.String);
  6868. $core.addMethod(
  6869. $core.method({
  6870. selector: "tokenize:",
  6871. protocol: 'split join',
  6872. fn: function (aString){
  6873. var self=this;
  6874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6875. return $core.withContext(function($ctx1) {
  6876. //>>excludeEnd("ctx");
  6877. return self.split(aString);
  6878. return self;
  6879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6880. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6881. //>>excludeEnd("ctx");
  6882. },
  6883. //>>excludeStart("ide", pragmas.excludeIdeData);
  6884. args: ["aString"],
  6885. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  6886. referencedClasses: [],
  6887. //>>excludeEnd("ide");
  6888. messageSends: []
  6889. }),
  6890. $globals.String);
  6891. $core.addMethod(
  6892. $core.method({
  6893. selector: "trimBoth",
  6894. protocol: 'regular expressions',
  6895. fn: function (){
  6896. var self=this;
  6897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6898. return $core.withContext(function($ctx1) {
  6899. //>>excludeEnd("ctx");
  6900. return self._trimBoth_("\x5cs");
  6901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6902. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6903. //>>excludeEnd("ctx");
  6904. },
  6905. //>>excludeStart("ide", pragmas.excludeIdeData);
  6906. args: [],
  6907. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6908. referencedClasses: [],
  6909. //>>excludeEnd("ide");
  6910. messageSends: ["trimBoth:"]
  6911. }),
  6912. $globals.String);
  6913. $core.addMethod(
  6914. $core.method({
  6915. selector: "trimBoth:",
  6916. protocol: 'regular expressions',
  6917. fn: function (separators){
  6918. var self=this;
  6919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6920. return $core.withContext(function($ctx1) {
  6921. //>>excludeEnd("ctx");
  6922. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  6923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6924. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6925. //>>excludeEnd("ctx");
  6926. },
  6927. //>>excludeStart("ide", pragmas.excludeIdeData);
  6928. args: ["separators"],
  6929. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6930. referencedClasses: [],
  6931. //>>excludeEnd("ide");
  6932. messageSends: ["trimRight:", "trimLeft:"]
  6933. }),
  6934. $globals.String);
  6935. $core.addMethod(
  6936. $core.method({
  6937. selector: "trimLeft",
  6938. protocol: 'regular expressions',
  6939. fn: function (){
  6940. var self=this;
  6941. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6942. return $core.withContext(function($ctx1) {
  6943. //>>excludeEnd("ctx");
  6944. return self._trimLeft_("\x5cs");
  6945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6946. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6947. //>>excludeEnd("ctx");
  6948. },
  6949. //>>excludeStart("ide", pragmas.excludeIdeData);
  6950. args: [],
  6951. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6952. referencedClasses: [],
  6953. //>>excludeEnd("ide");
  6954. messageSends: ["trimLeft:"]
  6955. }),
  6956. $globals.String);
  6957. $core.addMethod(
  6958. $core.method({
  6959. selector: "trimLeft:",
  6960. protocol: 'regular expressions',
  6961. fn: function (separators){
  6962. var self=this;
  6963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6964. return $core.withContext(function($ctx1) {
  6965. //>>excludeEnd("ctx");
  6966. var $2,$1;
  6967. $2=$recv("^[".__comma(separators)).__comma("]+");
  6968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6969. $ctx1.sendIdx[","]=1;
  6970. //>>excludeEnd("ctx");
  6971. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  6972. return self._replaceRegexp_with_($1,"");
  6973. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6974. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6975. //>>excludeEnd("ctx");
  6976. },
  6977. //>>excludeStart("ide", pragmas.excludeIdeData);
  6978. args: ["separators"],
  6979. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6980. referencedClasses: ["RegularExpression"],
  6981. //>>excludeEnd("ide");
  6982. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6983. }),
  6984. $globals.String);
  6985. $core.addMethod(
  6986. $core.method({
  6987. selector: "trimRight",
  6988. protocol: 'regular expressions',
  6989. fn: function (){
  6990. var self=this;
  6991. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6992. return $core.withContext(function($ctx1) {
  6993. //>>excludeEnd("ctx");
  6994. return self._trimRight_("\x5cs");
  6995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6996. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6997. //>>excludeEnd("ctx");
  6998. },
  6999. //>>excludeStart("ide", pragmas.excludeIdeData);
  7000. args: [],
  7001. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  7002. referencedClasses: [],
  7003. //>>excludeEnd("ide");
  7004. messageSends: ["trimRight:"]
  7005. }),
  7006. $globals.String);
  7007. $core.addMethod(
  7008. $core.method({
  7009. selector: "trimRight:",
  7010. protocol: 'regular expressions',
  7011. fn: function (separators){
  7012. var self=this;
  7013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7014. return $core.withContext(function($ctx1) {
  7015. //>>excludeEnd("ctx");
  7016. var $2,$1;
  7017. $2=$recv("[".__comma(separators)).__comma("]+$");
  7018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7019. $ctx1.sendIdx[","]=1;
  7020. //>>excludeEnd("ctx");
  7021. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  7022. return self._replaceRegexp_with_($1,"");
  7023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7024. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  7025. //>>excludeEnd("ctx");
  7026. },
  7027. //>>excludeStart("ide", pragmas.excludeIdeData);
  7028. args: ["separators"],
  7029. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  7030. referencedClasses: ["RegularExpression"],
  7031. //>>excludeEnd("ide");
  7032. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7033. }),
  7034. $globals.String);
  7035. $core.addMethod(
  7036. $core.method({
  7037. selector: "unescaped",
  7038. protocol: 'converting',
  7039. fn: function (){
  7040. var self=this;
  7041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7042. return $core.withContext(function($ctx1) {
  7043. //>>excludeEnd("ctx");
  7044. return unescape(self);
  7045. return self;
  7046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7047. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  7048. //>>excludeEnd("ctx");
  7049. },
  7050. //>>excludeStart("ide", pragmas.excludeIdeData);
  7051. args: [],
  7052. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  7053. referencedClasses: [],
  7054. //>>excludeEnd("ide");
  7055. messageSends: []
  7056. }),
  7057. $globals.String);
  7058. $core.addMethod(
  7059. $core.method({
  7060. selector: "uriComponentDecoded",
  7061. protocol: 'converting',
  7062. fn: function (){
  7063. var self=this;
  7064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7065. return $core.withContext(function($ctx1) {
  7066. //>>excludeEnd("ctx");
  7067. return decodeURIComponent(self);
  7068. return self;
  7069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7070. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7071. //>>excludeEnd("ctx");
  7072. },
  7073. //>>excludeStart("ide", pragmas.excludeIdeData);
  7074. args: [],
  7075. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  7076. referencedClasses: [],
  7077. //>>excludeEnd("ide");
  7078. messageSends: []
  7079. }),
  7080. $globals.String);
  7081. $core.addMethod(
  7082. $core.method({
  7083. selector: "uriComponentEncoded",
  7084. protocol: 'converting',
  7085. fn: function (){
  7086. var self=this;
  7087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7088. return $core.withContext(function($ctx1) {
  7089. //>>excludeEnd("ctx");
  7090. return encodeURIComponent(self);
  7091. return self;
  7092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7093. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7094. //>>excludeEnd("ctx");
  7095. },
  7096. //>>excludeStart("ide", pragmas.excludeIdeData);
  7097. args: [],
  7098. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  7099. referencedClasses: [],
  7100. //>>excludeEnd("ide");
  7101. messageSends: []
  7102. }),
  7103. $globals.String);
  7104. $core.addMethod(
  7105. $core.method({
  7106. selector: "uriDecoded",
  7107. protocol: 'converting',
  7108. fn: function (){
  7109. var self=this;
  7110. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7111. return $core.withContext(function($ctx1) {
  7112. //>>excludeEnd("ctx");
  7113. return decodeURI(self);
  7114. return self;
  7115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7116. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7117. //>>excludeEnd("ctx");
  7118. },
  7119. //>>excludeStart("ide", pragmas.excludeIdeData);
  7120. args: [],
  7121. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  7122. referencedClasses: [],
  7123. //>>excludeEnd("ide");
  7124. messageSends: []
  7125. }),
  7126. $globals.String);
  7127. $core.addMethod(
  7128. $core.method({
  7129. selector: "uriEncoded",
  7130. protocol: 'converting',
  7131. fn: function (){
  7132. var self=this;
  7133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7134. return $core.withContext(function($ctx1) {
  7135. //>>excludeEnd("ctx");
  7136. return encodeURI(self);
  7137. return self;
  7138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7139. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7140. //>>excludeEnd("ctx");
  7141. },
  7142. //>>excludeStart("ide", pragmas.excludeIdeData);
  7143. args: [],
  7144. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  7145. referencedClasses: [],
  7146. //>>excludeEnd("ide");
  7147. messageSends: []
  7148. }),
  7149. $globals.String);
  7150. $core.addMethod(
  7151. $core.method({
  7152. selector: "value:",
  7153. protocol: 'evaluating',
  7154. fn: function (anObject){
  7155. var self=this;
  7156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7157. return $core.withContext(function($ctx1) {
  7158. //>>excludeEnd("ctx");
  7159. return $recv(anObject)._perform_(self);
  7160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7161. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7162. //>>excludeEnd("ctx");
  7163. },
  7164. //>>excludeStart("ide", pragmas.excludeIdeData);
  7165. args: ["anObject"],
  7166. source: "value: anObject \x0a\x09^ anObject perform: self",
  7167. referencedClasses: [],
  7168. //>>excludeEnd("ide");
  7169. messageSends: ["perform:"]
  7170. }),
  7171. $globals.String);
  7172. $core.addMethod(
  7173. $core.method({
  7174. selector: "cr",
  7175. protocol: 'accessing',
  7176. fn: function (){
  7177. var self=this;
  7178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7179. return $core.withContext(function($ctx1) {
  7180. //>>excludeEnd("ctx");
  7181. return "\r";
  7182. return self;
  7183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7184. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  7185. //>>excludeEnd("ctx");
  7186. },
  7187. //>>excludeStart("ide", pragmas.excludeIdeData);
  7188. args: [],
  7189. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  7190. referencedClasses: [],
  7191. //>>excludeEnd("ide");
  7192. messageSends: []
  7193. }),
  7194. $globals.String.klass);
  7195. $core.addMethod(
  7196. $core.method({
  7197. selector: "crlf",
  7198. protocol: 'accessing',
  7199. fn: function (){
  7200. var self=this;
  7201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7202. return $core.withContext(function($ctx1) {
  7203. //>>excludeEnd("ctx");
  7204. return "\r\n";
  7205. return self;
  7206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7207. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  7208. //>>excludeEnd("ctx");
  7209. },
  7210. //>>excludeStart("ide", pragmas.excludeIdeData);
  7211. args: [],
  7212. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  7213. referencedClasses: [],
  7214. //>>excludeEnd("ide");
  7215. messageSends: []
  7216. }),
  7217. $globals.String.klass);
  7218. $core.addMethod(
  7219. $core.method({
  7220. selector: "esc",
  7221. protocol: 'accessing',
  7222. fn: function (){
  7223. var self=this;
  7224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7225. return $core.withContext(function($ctx1) {
  7226. //>>excludeEnd("ctx");
  7227. return self._fromCharCode_((27));
  7228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7229. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  7230. //>>excludeEnd("ctx");
  7231. },
  7232. //>>excludeStart("ide", pragmas.excludeIdeData);
  7233. args: [],
  7234. source: "esc\x0a\x09^ self fromCharCode: 27",
  7235. referencedClasses: [],
  7236. //>>excludeEnd("ide");
  7237. messageSends: ["fromCharCode:"]
  7238. }),
  7239. $globals.String.klass);
  7240. $core.addMethod(
  7241. $core.method({
  7242. selector: "fromCharCode:",
  7243. protocol: 'instance creation',
  7244. fn: function (anInteger){
  7245. var self=this;
  7246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7247. return $core.withContext(function($ctx1) {
  7248. //>>excludeEnd("ctx");
  7249. return String.fromCharCode(anInteger);
  7250. return self;
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  7253. //>>excludeEnd("ctx");
  7254. },
  7255. //>>excludeStart("ide", pragmas.excludeIdeData);
  7256. args: ["anInteger"],
  7257. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  7258. referencedClasses: [],
  7259. //>>excludeEnd("ide");
  7260. messageSends: []
  7261. }),
  7262. $globals.String.klass);
  7263. $core.addMethod(
  7264. $core.method({
  7265. selector: "fromString:",
  7266. protocol: 'instance creation',
  7267. fn: function (aString){
  7268. var self=this;
  7269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7270. return $core.withContext(function($ctx1) {
  7271. //>>excludeEnd("ctx");
  7272. return String(aString);
  7273. return self;
  7274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7275. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  7276. //>>excludeEnd("ctx");
  7277. },
  7278. //>>excludeStart("ide", pragmas.excludeIdeData);
  7279. args: ["aString"],
  7280. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  7281. referencedClasses: [],
  7282. //>>excludeEnd("ide");
  7283. messageSends: []
  7284. }),
  7285. $globals.String.klass);
  7286. $core.addMethod(
  7287. $core.method({
  7288. selector: "lf",
  7289. protocol: 'accessing',
  7290. fn: function (){
  7291. var self=this;
  7292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7293. return $core.withContext(function($ctx1) {
  7294. //>>excludeEnd("ctx");
  7295. return "\n";
  7296. return self;
  7297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7298. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  7299. //>>excludeEnd("ctx");
  7300. },
  7301. //>>excludeStart("ide", pragmas.excludeIdeData);
  7302. args: [],
  7303. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  7304. referencedClasses: [],
  7305. //>>excludeEnd("ide");
  7306. messageSends: []
  7307. }),
  7308. $globals.String.klass);
  7309. $core.addMethod(
  7310. $core.method({
  7311. selector: "random",
  7312. protocol: 'random',
  7313. fn: function (){
  7314. var self=this;
  7315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7316. return $core.withContext(function($ctx1) {
  7317. //>>excludeEnd("ctx");
  7318. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7319. return self;
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  7322. //>>excludeEnd("ctx");
  7323. },
  7324. //>>excludeStart("ide", pragmas.excludeIdeData);
  7325. args: [],
  7326. 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);'>",
  7327. referencedClasses: [],
  7328. //>>excludeEnd("ide");
  7329. messageSends: []
  7330. }),
  7331. $globals.String.klass);
  7332. $core.addMethod(
  7333. $core.method({
  7334. selector: "randomNotIn:",
  7335. protocol: 'random',
  7336. fn: function (aString){
  7337. var self=this;
  7338. var result;
  7339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7340. return $core.withContext(function($ctx1) {
  7341. //>>excludeEnd("ctx");
  7342. $recv((function(){
  7343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7344. return $core.withContext(function($ctx2) {
  7345. //>>excludeEnd("ctx");
  7346. result=self._random();
  7347. result;
  7348. return $recv(aString)._includesSubString_(result);
  7349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7351. //>>excludeEnd("ctx");
  7352. }))._whileTrue();
  7353. return result;
  7354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7355. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  7356. //>>excludeEnd("ctx");
  7357. },
  7358. //>>excludeStart("ide", pragmas.excludeIdeData);
  7359. args: ["aString"],
  7360. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7361. referencedClasses: [],
  7362. //>>excludeEnd("ide");
  7363. messageSends: ["whileTrue", "random", "includesSubString:"]
  7364. }),
  7365. $globals.String.klass);
  7366. $core.addMethod(
  7367. $core.method({
  7368. selector: "space",
  7369. protocol: 'accessing',
  7370. fn: function (){
  7371. var self=this;
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. return $core.withContext(function($ctx1) {
  7374. //>>excludeEnd("ctx");
  7375. return " ";
  7376. return self;
  7377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7378. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  7379. //>>excludeEnd("ctx");
  7380. },
  7381. //>>excludeStart("ide", pragmas.excludeIdeData);
  7382. args: [],
  7383. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  7384. referencedClasses: [],
  7385. //>>excludeEnd("ide");
  7386. messageSends: []
  7387. }),
  7388. $globals.String.klass);
  7389. $core.addMethod(
  7390. $core.method({
  7391. selector: "streamClass",
  7392. protocol: 'accessing',
  7393. fn: function (){
  7394. var self=this;
  7395. return $globals.StringStream;
  7396. },
  7397. //>>excludeStart("ide", pragmas.excludeIdeData);
  7398. args: [],
  7399. source: "streamClass\x0a\x09\x09^ StringStream",
  7400. referencedClasses: ["StringStream"],
  7401. //>>excludeEnd("ide");
  7402. messageSends: []
  7403. }),
  7404. $globals.String.klass);
  7405. $core.addMethod(
  7406. $core.method({
  7407. selector: "tab",
  7408. protocol: 'accessing',
  7409. fn: function (){
  7410. var self=this;
  7411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7412. return $core.withContext(function($ctx1) {
  7413. //>>excludeEnd("ctx");
  7414. return "\t";
  7415. return self;
  7416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7417. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  7418. //>>excludeEnd("ctx");
  7419. },
  7420. //>>excludeStart("ide", pragmas.excludeIdeData);
  7421. args: [],
  7422. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  7423. referencedClasses: [],
  7424. //>>excludeEnd("ide");
  7425. messageSends: []
  7426. }),
  7427. $globals.String.klass);
  7428. $core.addMethod(
  7429. $core.method({
  7430. selector: "value:",
  7431. protocol: 'instance creation',
  7432. fn: function (aUTFCharCode){
  7433. var self=this;
  7434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7435. return $core.withContext(function($ctx1) {
  7436. //>>excludeEnd("ctx");
  7437. return String.fromCharCode(aUTFCharCode);;
  7438. return self;
  7439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7440. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  7441. //>>excludeEnd("ctx");
  7442. },
  7443. //>>excludeStart("ide", pragmas.excludeIdeData);
  7444. args: ["aUTFCharCode"],
  7445. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  7446. referencedClasses: [],
  7447. //>>excludeEnd("ide");
  7448. messageSends: []
  7449. }),
  7450. $globals.String.klass);
  7451. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  7452. //>>excludeStart("ide", pragmas.excludeIdeData);
  7453. $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`.";
  7454. //>>excludeEnd("ide");
  7455. $core.addMethod(
  7456. $core.method({
  7457. selector: "=",
  7458. protocol: 'comparing',
  7459. fn: function (aCollection){
  7460. var self=this;
  7461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7462. return $core.withContext(function($ctx1) {
  7463. //>>excludeEnd("ctx");
  7464. var $2,$1,$4,$3,$5;
  7465. var $early={};
  7466. try {
  7467. $2=self._class();
  7468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7469. $ctx1.sendIdx["class"]=1;
  7470. //>>excludeEnd("ctx");
  7471. $1=$recv($2).__eq($recv(aCollection)._class());
  7472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7473. $ctx1.sendIdx["="]=1;
  7474. //>>excludeEnd("ctx");
  7475. if(!$core.assert($1)){
  7476. return false;
  7477. }
  7478. $4=self._size();
  7479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7480. $ctx1.sendIdx["size"]=1;
  7481. //>>excludeEnd("ctx");
  7482. $3=$recv($4).__eq($recv(aCollection)._size());
  7483. if(!$core.assert($3)){
  7484. return false;
  7485. }
  7486. self._do_((function(each){
  7487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7488. return $core.withContext(function($ctx2) {
  7489. //>>excludeEnd("ctx");
  7490. $5=$recv(aCollection)._includes_(each);
  7491. if(!$core.assert($5)){
  7492. throw $early=[false];
  7493. }
  7494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7496. //>>excludeEnd("ctx");
  7497. }));
  7498. return true;
  7499. }
  7500. catch(e) {if(e===$early)return e[0]; throw e}
  7501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7502. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7503. //>>excludeEnd("ctx");
  7504. },
  7505. //>>excludeStart("ide", pragmas.excludeIdeData);
  7506. args: ["aCollection"],
  7507. 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",
  7508. referencedClasses: [],
  7509. //>>excludeEnd("ide");
  7510. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7511. }),
  7512. $globals.Set);
  7513. $core.addMethod(
  7514. $core.method({
  7515. selector: "add:",
  7516. protocol: 'adding/removing',
  7517. fn: function (anObject){
  7518. var self=this;
  7519. var bucket;
  7520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7521. return $core.withContext(function($ctx1) {
  7522. //>>excludeEnd("ctx");
  7523. var $1,$receiver;
  7524. bucket=self._bucketsOfElement_(anObject);
  7525. $1=$recv(bucket)._second();
  7526. if(($receiver = $1) == null || $receiver.isNil){
  7527. var object,slowBucket;
  7528. object=$recv(bucket)._first();
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. $ctx1.sendIdx["first"]=1;
  7531. //>>excludeEnd("ctx");
  7532. object;
  7533. slowBucket=$recv(bucket)._third();
  7534. slowBucket;
  7535. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7537. return $core.withContext(function($ctx2) {
  7538. //>>excludeEnd("ctx");
  7539. $recv(slowBucket)._add_(object);
  7540. self["@size"]=$recv(self["@size"]).__plus((1));
  7541. return self["@size"];
  7542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7543. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7544. //>>excludeEnd("ctx");
  7545. }));
  7546. return object;
  7547. } else {
  7548. var primitiveBucket;
  7549. primitiveBucket=$receiver;
  7550. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  7551. }
  7552. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7553. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7554. //>>excludeEnd("ctx");
  7555. },
  7556. //>>excludeStart("ide", pragmas.excludeIdeData);
  7557. args: ["anObject"],
  7558. 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 ]",
  7559. referencedClasses: [],
  7560. //>>excludeEnd("ide");
  7561. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7562. }),
  7563. $globals.Set);
  7564. $core.addMethod(
  7565. $core.method({
  7566. selector: "add:in:",
  7567. protocol: 'private',
  7568. fn: function (anObject,anotherObject){
  7569. var self=this;
  7570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7571. return $core.withContext(function($ctx1) {
  7572. //>>excludeEnd("ctx");
  7573. if (anObject in anotherObject.store) { return false; }
  7574. self['@size']++;
  7575. anotherObject.store[anObject] = true;
  7576. return anObject;
  7577. ;
  7578. return self;
  7579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7580. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7581. //>>excludeEnd("ctx");
  7582. },
  7583. //>>excludeStart("ide", pragmas.excludeIdeData);
  7584. args: ["anObject", "anotherObject"],
  7585. 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'>",
  7586. referencedClasses: [],
  7587. //>>excludeEnd("ide");
  7588. messageSends: []
  7589. }),
  7590. $globals.Set);
  7591. $core.addMethod(
  7592. $core.method({
  7593. selector: "bucketsOfElement:",
  7594. protocol: 'private',
  7595. fn: function (anObject){
  7596. var self=this;
  7597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7598. return $core.withContext(function($ctx1) {
  7599. //>>excludeEnd("ctx");
  7600. // include nil to well-known objects under "boolean" fastBucket
  7601. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  7602. var prim = anObject.valueOf();
  7603. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  7604. var bucket = null;
  7605. self['@slowBucketStores'].some(function (store) {
  7606. return bucket = store._bucketOfElement_(anObject);
  7607. });
  7608. return [ anObject, null, bucket || self['@defaultBucket'] ];
  7609. }
  7610. return [ prim, self['@fastBuckets'][typeof prim] ];
  7611. ;
  7612. return self;
  7613. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7614. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7615. //>>excludeEnd("ctx");
  7616. },
  7617. //>>excludeStart("ide", pragmas.excludeIdeData);
  7618. args: ["anObject"],
  7619. 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'>",
  7620. referencedClasses: [],
  7621. //>>excludeEnd("ide");
  7622. messageSends: []
  7623. }),
  7624. $globals.Set);
  7625. $core.addMethod(
  7626. $core.method({
  7627. selector: "classNameOf:",
  7628. protocol: 'private',
  7629. fn: function (anObject){
  7630. var self=this;
  7631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7632. return $core.withContext(function($ctx1) {
  7633. //>>excludeEnd("ctx");
  7634. return anObject.klass != null && anObject.klass.className;
  7635. return self;
  7636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7637. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7638. //>>excludeEnd("ctx");
  7639. },
  7640. //>>excludeStart("ide", pragmas.excludeIdeData);
  7641. args: ["anObject"],
  7642. 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'>",
  7643. referencedClasses: [],
  7644. //>>excludeEnd("ide");
  7645. messageSends: []
  7646. }),
  7647. $globals.Set);
  7648. $core.addMethod(
  7649. $core.method({
  7650. selector: "collect:",
  7651. protocol: 'enumerating',
  7652. fn: function (aBlock){
  7653. var self=this;
  7654. var collection;
  7655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7656. return $core.withContext(function($ctx1) {
  7657. //>>excludeEnd("ctx");
  7658. collection=$recv(self._class())._new();
  7659. self._do_((function(each){
  7660. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7661. return $core.withContext(function($ctx2) {
  7662. //>>excludeEnd("ctx");
  7663. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7665. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7666. //>>excludeEnd("ctx");
  7667. }));
  7668. return collection;
  7669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7670. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7671. //>>excludeEnd("ctx");
  7672. },
  7673. //>>excludeStart("ide", pragmas.excludeIdeData);
  7674. args: ["aBlock"],
  7675. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7676. referencedClasses: [],
  7677. //>>excludeEnd("ide");
  7678. messageSends: ["new", "class", "do:", "add:", "value:"]
  7679. }),
  7680. $globals.Set);
  7681. $core.addMethod(
  7682. $core.method({
  7683. selector: "detect:ifNone:",
  7684. protocol: 'enumerating',
  7685. fn: function (aBlock,anotherBlock){
  7686. var self=this;
  7687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7688. return $core.withContext(function($ctx1) {
  7689. //>>excludeEnd("ctx");
  7690. var $1;
  7691. var $early={};
  7692. try {
  7693. self._do_((function(each){
  7694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7695. return $core.withContext(function($ctx2) {
  7696. //>>excludeEnd("ctx");
  7697. $1=$recv(aBlock)._value_(each);
  7698. if($core.assert($1)){
  7699. throw $early=[each];
  7700. }
  7701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7702. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7703. //>>excludeEnd("ctx");
  7704. }));
  7705. return $recv(anotherBlock)._value();
  7706. }
  7707. catch(e) {if(e===$early)return e[0]; throw e}
  7708. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7709. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7710. //>>excludeEnd("ctx");
  7711. },
  7712. //>>excludeStart("ide", pragmas.excludeIdeData);
  7713. args: ["aBlock", "anotherBlock"],
  7714. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7715. referencedClasses: [],
  7716. //>>excludeEnd("ide");
  7717. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7718. }),
  7719. $globals.Set);
  7720. $core.addMethod(
  7721. $core.method({
  7722. selector: "do:",
  7723. protocol: 'enumerating',
  7724. fn: function (aBlock){
  7725. var self=this;
  7726. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7727. return $core.withContext(function($ctx1) {
  7728. //>>excludeEnd("ctx");
  7729. var el, keys, i;
  7730. el = self['@fastBuckets'];
  7731. keys = Object.keys(el);
  7732. for (i = 0; i < keys.length; ++i) {
  7733. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7734. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7735. else { store._do_(aBlock); }
  7736. }
  7737. el = self['@slowBucketStores'];
  7738. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7739. self['@defaultBucket']._do_(aBlock);
  7740. ;
  7741. return self;
  7742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7743. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7744. //>>excludeEnd("ctx");
  7745. },
  7746. //>>excludeStart("ide", pragmas.excludeIdeData);
  7747. args: ["aBlock"],
  7748. 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'>",
  7749. referencedClasses: [],
  7750. //>>excludeEnd("ide");
  7751. messageSends: []
  7752. }),
  7753. $globals.Set);
  7754. $core.addMethod(
  7755. $core.method({
  7756. selector: "includes:",
  7757. protocol: 'testing',
  7758. fn: function (anObject){
  7759. var self=this;
  7760. var bucket;
  7761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7762. return $core.withContext(function($ctx1) {
  7763. //>>excludeEnd("ctx");
  7764. var $1,$2,$3,$receiver;
  7765. bucket=self._bucketsOfElement_(anObject);
  7766. $1=$recv(bucket)._second();
  7767. if(($receiver = $1) == null || $receiver.isNil){
  7768. $2=$recv(bucket)._third();
  7769. $3=$recv(bucket)._first();
  7770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7771. $ctx1.sendIdx["first"]=1;
  7772. //>>excludeEnd("ctx");
  7773. return $recv($2)._includes_($3);
  7774. } else {
  7775. var primitiveBucket;
  7776. primitiveBucket=$receiver;
  7777. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7778. }
  7779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7780. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7781. //>>excludeEnd("ctx");
  7782. },
  7783. //>>excludeStart("ide", pragmas.excludeIdeData);
  7784. args: ["anObject"],
  7785. 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 ]",
  7786. referencedClasses: [],
  7787. //>>excludeEnd("ide");
  7788. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7789. }),
  7790. $globals.Set);
  7791. $core.addMethod(
  7792. $core.method({
  7793. selector: "includes:in:",
  7794. protocol: 'private',
  7795. fn: function (anObject,anotherObject){
  7796. var self=this;
  7797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7798. return $core.withContext(function($ctx1) {
  7799. //>>excludeEnd("ctx");
  7800. return anObject in anotherObject.store;
  7801. return self;
  7802. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7803. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7804. //>>excludeEnd("ctx");
  7805. },
  7806. //>>excludeStart("ide", pragmas.excludeIdeData);
  7807. args: ["anObject", "anotherObject"],
  7808. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  7809. referencedClasses: [],
  7810. //>>excludeEnd("ide");
  7811. messageSends: []
  7812. }),
  7813. $globals.Set);
  7814. $core.addMethod(
  7815. $core.method({
  7816. selector: "initialize",
  7817. protocol: 'initialization',
  7818. fn: function (){
  7819. var self=this;
  7820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7821. return $core.withContext(function($ctx1) {
  7822. //>>excludeEnd("ctx");
  7823. (
  7824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7825. $ctx1.supercall = true,
  7826. //>>excludeEnd("ctx");
  7827. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  7828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7829. $ctx1.supercall = false;
  7830. //>>excludeEnd("ctx");;
  7831. self["@defaultBucket"]=[];
  7832. self._initializeSlowBucketStores();
  7833. self._removeAll();
  7834. return self;
  7835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7836. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7837. //>>excludeEnd("ctx");
  7838. },
  7839. //>>excludeStart("ide", pragmas.excludeIdeData);
  7840. args: [],
  7841. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7842. referencedClasses: [],
  7843. //>>excludeEnd("ide");
  7844. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7845. }),
  7846. $globals.Set);
  7847. $core.addMethod(
  7848. $core.method({
  7849. selector: "initializeSlowBucketStores",
  7850. protocol: 'initialization',
  7851. fn: function (){
  7852. var self=this;
  7853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7854. return $core.withContext(function($ctx1) {
  7855. //>>excludeEnd("ctx");
  7856. var $1;
  7857. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7859. return $core.withContext(function($ctx2) {
  7860. //>>excludeEnd("ctx");
  7861. return self._classNameOf_(x);
  7862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7863. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7864. //>>excludeEnd("ctx");
  7865. }));
  7866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7867. $ctx1.sendIdx["hashBlock:"]=1;
  7868. //>>excludeEnd("ctx");
  7869. self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  7870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7871. return $core.withContext(function($ctx2) {
  7872. //>>excludeEnd("ctx");
  7873. return self._jsConstructorNameOf_(x);
  7874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7875. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7876. //>>excludeEnd("ctx");
  7877. }))];
  7878. return self;
  7879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7880. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7881. //>>excludeEnd("ctx");
  7882. },
  7883. //>>excludeStart("ide", pragmas.excludeIdeData);
  7884. args: [],
  7885. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7886. referencedClasses: ["ArrayBucketStore"],
  7887. //>>excludeEnd("ide");
  7888. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7889. }),
  7890. $globals.Set);
  7891. $core.addMethod(
  7892. $core.method({
  7893. selector: "jsConstructorNameOf:",
  7894. protocol: 'private',
  7895. fn: function (anObject){
  7896. var self=this;
  7897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7898. return $core.withContext(function($ctx1) {
  7899. //>>excludeEnd("ctx");
  7900. return anObject.constructor && anObject.constructor.name;
  7901. return self;
  7902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7903. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7904. //>>excludeEnd("ctx");
  7905. },
  7906. //>>excludeStart("ide", pragmas.excludeIdeData);
  7907. args: ["anObject"],
  7908. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  7909. referencedClasses: [],
  7910. //>>excludeEnd("ide");
  7911. messageSends: []
  7912. }),
  7913. $globals.Set);
  7914. $core.addMethod(
  7915. $core.method({
  7916. selector: "printOn:",
  7917. protocol: 'printing',
  7918. fn: function (aStream){
  7919. var self=this;
  7920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7921. return $core.withContext(function($ctx1) {
  7922. //>>excludeEnd("ctx");
  7923. (
  7924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7925. $ctx1.supercall = true,
  7926. //>>excludeEnd("ctx");
  7927. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($recv(self), [aStream]));
  7928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7929. $ctx1.supercall = false;
  7930. //>>excludeEnd("ctx");;
  7931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7932. $ctx1.sendIdx["printOn:"]=1;
  7933. //>>excludeEnd("ctx");
  7934. $recv(aStream)._nextPutAll_(" (");
  7935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7936. $ctx1.sendIdx["nextPutAll:"]=1;
  7937. //>>excludeEnd("ctx");
  7938. self._do_separatedBy_((function(each){
  7939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7940. return $core.withContext(function($ctx2) {
  7941. //>>excludeEnd("ctx");
  7942. return $recv(each)._printOn_(aStream);
  7943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7945. //>>excludeEnd("ctx");
  7946. }),(function(){
  7947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7948. return $core.withContext(function($ctx2) {
  7949. //>>excludeEnd("ctx");
  7950. return $recv(aStream)._nextPutAll_(" ");
  7951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7952. $ctx2.sendIdx["nextPutAll:"]=2;
  7953. //>>excludeEnd("ctx");
  7954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7955. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7956. //>>excludeEnd("ctx");
  7957. }));
  7958. $recv(aStream)._nextPutAll_(")");
  7959. return self;
  7960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7961. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7962. //>>excludeEnd("ctx");
  7963. },
  7964. //>>excludeStart("ide", pragmas.excludeIdeData);
  7965. args: ["aStream"],
  7966. 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: ')'",
  7967. referencedClasses: [],
  7968. //>>excludeEnd("ide");
  7969. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7970. }),
  7971. $globals.Set);
  7972. $core.addMethod(
  7973. $core.method({
  7974. selector: "remove:ifAbsent:",
  7975. protocol: 'adding/removing',
  7976. fn: function (anObject,aBlock){
  7977. var self=this;
  7978. var bucket;
  7979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7980. return $core.withContext(function($ctx1) {
  7981. //>>excludeEnd("ctx");
  7982. var $1,$2,$3,$receiver;
  7983. var $early={};
  7984. try {
  7985. bucket=self._bucketsOfElement_(anObject);
  7986. $1=$recv(bucket)._second();
  7987. if(($receiver = $1) == null || $receiver.isNil){
  7988. $2=$recv(bucket)._third();
  7989. $3=$recv(bucket)._first();
  7990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7991. $ctx1.sendIdx["first"]=1;
  7992. //>>excludeEnd("ctx");
  7993. $recv($2)._remove_ifAbsent_($3,(function(){
  7994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7995. return $core.withContext(function($ctx2) {
  7996. //>>excludeEnd("ctx");
  7997. throw $early=[$recv(aBlock)._value()];
  7998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7999. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8000. //>>excludeEnd("ctx");
  8001. }));
  8002. self["@size"]=$recv(self["@size"]).__minus((1));
  8003. return self["@size"];
  8004. } else {
  8005. var primitiveBucket;
  8006. primitiveBucket=$receiver;
  8007. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  8008. }
  8009. }
  8010. catch(e) {if(e===$early)return e[0]; throw e}
  8011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8012. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  8013. //>>excludeEnd("ctx");
  8014. },
  8015. //>>excludeStart("ide", pragmas.excludeIdeData);
  8016. args: ["anObject", "aBlock"],
  8017. 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 ]",
  8018. referencedClasses: [],
  8019. //>>excludeEnd("ide");
  8020. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  8021. }),
  8022. $globals.Set);
  8023. $core.addMethod(
  8024. $core.method({
  8025. selector: "remove:in:",
  8026. protocol: 'private',
  8027. fn: function (anObject,anotherObject){
  8028. var self=this;
  8029. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8030. return $core.withContext(function($ctx1) {
  8031. //>>excludeEnd("ctx");
  8032. if (delete anotherObject.store[anObject]) self['@size']--;
  8033. return self;
  8034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8035. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  8036. //>>excludeEnd("ctx");
  8037. },
  8038. //>>excludeStart("ide", pragmas.excludeIdeData);
  8039. args: ["anObject", "anotherObject"],
  8040. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (delete anotherObject.store[anObject]) self[''@size'']--'>",
  8041. referencedClasses: [],
  8042. //>>excludeEnd("ide");
  8043. messageSends: []
  8044. }),
  8045. $globals.Set);
  8046. $core.addMethod(
  8047. $core.method({
  8048. selector: "removeAll",
  8049. protocol: 'adding/removing',
  8050. fn: function (){
  8051. var self=this;
  8052. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8053. return $core.withContext(function($ctx1) {
  8054. //>>excludeEnd("ctx");
  8055. self['@fastBuckets'] = {
  8056. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  8057. "number": { store: Object.create(null), fn: Number },
  8058. "string": { store: Object.create(null) }
  8059. };
  8060. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  8061. self['@defaultBucket']._removeAll();
  8062. self['@size'] = 0;
  8063. ;
  8064. return self;
  8065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8066. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8067. //>>excludeEnd("ctx");
  8068. },
  8069. //>>excludeStart("ide", pragmas.excludeIdeData);
  8070. args: [],
  8071. 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'>",
  8072. referencedClasses: [],
  8073. //>>excludeEnd("ide");
  8074. messageSends: []
  8075. }),
  8076. $globals.Set);
  8077. $core.addMethod(
  8078. $core.method({
  8079. selector: "select:",
  8080. protocol: 'enumerating',
  8081. fn: function (aBlock){
  8082. var self=this;
  8083. var collection;
  8084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8085. return $core.withContext(function($ctx1) {
  8086. //>>excludeEnd("ctx");
  8087. var $1;
  8088. collection=$recv(self._class())._new();
  8089. self._do_((function(each){
  8090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8091. return $core.withContext(function($ctx2) {
  8092. //>>excludeEnd("ctx");
  8093. $1=$recv(aBlock)._value_(each);
  8094. if($core.assert($1)){
  8095. return $recv(collection)._add_(each);
  8096. }
  8097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8099. //>>excludeEnd("ctx");
  8100. }));
  8101. return collection;
  8102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8103. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8104. //>>excludeEnd("ctx");
  8105. },
  8106. //>>excludeStart("ide", pragmas.excludeIdeData);
  8107. args: ["aBlock"],
  8108. 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",
  8109. referencedClasses: [],
  8110. //>>excludeEnd("ide");
  8111. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8112. }),
  8113. $globals.Set);
  8114. $core.addMethod(
  8115. $core.method({
  8116. selector: "size",
  8117. protocol: 'accessing',
  8118. fn: function (){
  8119. var self=this;
  8120. return self["@size"];
  8121. },
  8122. //>>excludeStart("ide", pragmas.excludeIdeData);
  8123. args: [],
  8124. source: "size\x0a\x09^ size",
  8125. referencedClasses: [],
  8126. //>>excludeEnd("ide");
  8127. messageSends: []
  8128. }),
  8129. $globals.Set);
  8130. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  8131. //>>excludeStart("ide", pragmas.excludeIdeData);
  8132. $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.";
  8133. //>>excludeEnd("ide");
  8134. $core.addMethod(
  8135. $core.method({
  8136. selector: "<<",
  8137. protocol: 'writing',
  8138. fn: function (anObject){
  8139. var self=this;
  8140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8141. return $core.withContext(function($ctx1) {
  8142. //>>excludeEnd("ctx");
  8143. self._write_(anObject);
  8144. return self;
  8145. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8146. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8147. //>>excludeEnd("ctx");
  8148. },
  8149. //>>excludeStart("ide", pragmas.excludeIdeData);
  8150. args: ["anObject"],
  8151. source: "<< anObject\x0a\x09self write: anObject",
  8152. referencedClasses: [],
  8153. //>>excludeEnd("ide");
  8154. messageSends: ["write:"]
  8155. }),
  8156. $globals.ProtoStream);
  8157. $core.addMethod(
  8158. $core.method({
  8159. selector: "atEnd",
  8160. protocol: 'testing',
  8161. fn: function (){
  8162. var self=this;
  8163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8164. return $core.withContext(function($ctx1) {
  8165. //>>excludeEnd("ctx");
  8166. self._subclassResponsibility();
  8167. return self;
  8168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8169. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8170. //>>excludeEnd("ctx");
  8171. },
  8172. //>>excludeStart("ide", pragmas.excludeIdeData);
  8173. args: [],
  8174. source: "atEnd\x0a\x09self subclassResponsibility",
  8175. referencedClasses: [],
  8176. //>>excludeEnd("ide");
  8177. messageSends: ["subclassResponsibility"]
  8178. }),
  8179. $globals.ProtoStream);
  8180. $core.addMethod(
  8181. $core.method({
  8182. selector: "atStart",
  8183. protocol: 'testing',
  8184. fn: function (){
  8185. var self=this;
  8186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8187. return $core.withContext(function($ctx1) {
  8188. //>>excludeEnd("ctx");
  8189. self._subclassResponsibility();
  8190. return self;
  8191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8192. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8193. //>>excludeEnd("ctx");
  8194. },
  8195. //>>excludeStart("ide", pragmas.excludeIdeData);
  8196. args: [],
  8197. source: "atStart\x0a\x09self subclassResponsibility",
  8198. referencedClasses: [],
  8199. //>>excludeEnd("ide");
  8200. messageSends: ["subclassResponsibility"]
  8201. }),
  8202. $globals.ProtoStream);
  8203. $core.addMethod(
  8204. $core.method({
  8205. selector: "contents",
  8206. protocol: 'accessing',
  8207. fn: function (){
  8208. var self=this;
  8209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8210. return $core.withContext(function($ctx1) {
  8211. //>>excludeEnd("ctx");
  8212. self._subclassResponsibility();
  8213. return self;
  8214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8215. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8216. //>>excludeEnd("ctx");
  8217. },
  8218. //>>excludeStart("ide", pragmas.excludeIdeData);
  8219. args: [],
  8220. source: "contents\x0a\x09self subclassResponsibility",
  8221. referencedClasses: [],
  8222. //>>excludeEnd("ide");
  8223. messageSends: ["subclassResponsibility"]
  8224. }),
  8225. $globals.ProtoStream);
  8226. $core.addMethod(
  8227. $core.method({
  8228. selector: "do:",
  8229. protocol: 'enumerating',
  8230. fn: function (aBlock){
  8231. var self=this;
  8232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8233. return $core.withContext(function($ctx1) {
  8234. //>>excludeEnd("ctx");
  8235. $recv((function(){
  8236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8237. return $core.withContext(function($ctx2) {
  8238. //>>excludeEnd("ctx");
  8239. return self._atEnd();
  8240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8242. //>>excludeEnd("ctx");
  8243. }))._whileFalse_((function(){
  8244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8245. return $core.withContext(function($ctx2) {
  8246. //>>excludeEnd("ctx");
  8247. return $recv(aBlock)._value_(self._next());
  8248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8250. //>>excludeEnd("ctx");
  8251. }));
  8252. return self;
  8253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8254. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8255. //>>excludeEnd("ctx");
  8256. },
  8257. //>>excludeStart("ide", pragmas.excludeIdeData);
  8258. args: ["aBlock"],
  8259. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8260. referencedClasses: [],
  8261. //>>excludeEnd("ide");
  8262. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8263. }),
  8264. $globals.ProtoStream);
  8265. $core.addMethod(
  8266. $core.method({
  8267. selector: "isEmpty",
  8268. protocol: 'testing',
  8269. fn: function (){
  8270. var self=this;
  8271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8272. return $core.withContext(function($ctx1) {
  8273. //>>excludeEnd("ctx");
  8274. return $recv(self._atStart())._and_((function(){
  8275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8276. return $core.withContext(function($ctx2) {
  8277. //>>excludeEnd("ctx");
  8278. return self._atEnd();
  8279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8281. //>>excludeEnd("ctx");
  8282. }));
  8283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8284. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8285. //>>excludeEnd("ctx");
  8286. },
  8287. //>>excludeStart("ide", pragmas.excludeIdeData);
  8288. args: [],
  8289. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8290. referencedClasses: [],
  8291. //>>excludeEnd("ide");
  8292. messageSends: ["and:", "atStart", "atEnd"]
  8293. }),
  8294. $globals.ProtoStream);
  8295. $core.addMethod(
  8296. $core.method({
  8297. selector: "next",
  8298. protocol: 'reading',
  8299. fn: function (){
  8300. var self=this;
  8301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8302. return $core.withContext(function($ctx1) {
  8303. //>>excludeEnd("ctx");
  8304. var $1;
  8305. $1=self._atEnd();
  8306. if($core.assert($1)){
  8307. return nil;
  8308. } else {
  8309. return self._subclassResponsibility();
  8310. }
  8311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8312. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8313. //>>excludeEnd("ctx");
  8314. },
  8315. //>>excludeStart("ide", pragmas.excludeIdeData);
  8316. args: [],
  8317. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8318. referencedClasses: [],
  8319. //>>excludeEnd("ide");
  8320. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8321. }),
  8322. $globals.ProtoStream);
  8323. $core.addMethod(
  8324. $core.method({
  8325. selector: "nextPut:",
  8326. protocol: 'writing',
  8327. fn: function (anObject){
  8328. var self=this;
  8329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8330. return $core.withContext(function($ctx1) {
  8331. //>>excludeEnd("ctx");
  8332. self._subclassResponsibility();
  8333. return self;
  8334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8335. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8336. //>>excludeEnd("ctx");
  8337. },
  8338. //>>excludeStart("ide", pragmas.excludeIdeData);
  8339. args: ["anObject"],
  8340. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8341. referencedClasses: [],
  8342. //>>excludeEnd("ide");
  8343. messageSends: ["subclassResponsibility"]
  8344. }),
  8345. $globals.ProtoStream);
  8346. $core.addMethod(
  8347. $core.method({
  8348. selector: "nextPutAll:",
  8349. protocol: 'writing',
  8350. fn: function (aCollection){
  8351. var self=this;
  8352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8353. return $core.withContext(function($ctx1) {
  8354. //>>excludeEnd("ctx");
  8355. $recv(aCollection)._do_((function(each){
  8356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8357. return $core.withContext(function($ctx2) {
  8358. //>>excludeEnd("ctx");
  8359. return self._nextPut_(each);
  8360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8361. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8362. //>>excludeEnd("ctx");
  8363. }));
  8364. return self;
  8365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8366. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8367. //>>excludeEnd("ctx");
  8368. },
  8369. //>>excludeStart("ide", pragmas.excludeIdeData);
  8370. args: ["aCollection"],
  8371. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8372. referencedClasses: [],
  8373. //>>excludeEnd("ide");
  8374. messageSends: ["do:", "nextPut:"]
  8375. }),
  8376. $globals.ProtoStream);
  8377. $core.addMethod(
  8378. $core.method({
  8379. selector: "nextPutJSObject:",
  8380. protocol: 'writing',
  8381. fn: function (aJSObject){
  8382. var self=this;
  8383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8384. return $core.withContext(function($ctx1) {
  8385. //>>excludeEnd("ctx");
  8386. self._nextPut_(aJSObject);
  8387. return self;
  8388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8389. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  8390. //>>excludeEnd("ctx");
  8391. },
  8392. //>>excludeStart("ide", pragmas.excludeIdeData);
  8393. args: ["aJSObject"],
  8394. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  8395. referencedClasses: [],
  8396. //>>excludeEnd("ide");
  8397. messageSends: ["nextPut:"]
  8398. }),
  8399. $globals.ProtoStream);
  8400. $core.addMethod(
  8401. $core.method({
  8402. selector: "nextPutString:",
  8403. protocol: 'writing',
  8404. fn: function (aString){
  8405. var self=this;
  8406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8407. return $core.withContext(function($ctx1) {
  8408. //>>excludeEnd("ctx");
  8409. self._nextPut_(aString);
  8410. return self;
  8411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8412. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8413. //>>excludeEnd("ctx");
  8414. },
  8415. //>>excludeStart("ide", pragmas.excludeIdeData);
  8416. args: ["aString"],
  8417. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8418. referencedClasses: [],
  8419. //>>excludeEnd("ide");
  8420. messageSends: ["nextPut:"]
  8421. }),
  8422. $globals.ProtoStream);
  8423. $core.addMethod(
  8424. $core.method({
  8425. selector: "peek",
  8426. protocol: 'reading',
  8427. fn: function (){
  8428. var self=this;
  8429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8430. return $core.withContext(function($ctx1) {
  8431. //>>excludeEnd("ctx");
  8432. var $1;
  8433. $1=self._atEnd();
  8434. if($core.assert($1)){
  8435. return nil;
  8436. } else {
  8437. return self._subclassResponsibility();
  8438. }
  8439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8440. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8441. //>>excludeEnd("ctx");
  8442. },
  8443. //>>excludeStart("ide", pragmas.excludeIdeData);
  8444. args: [],
  8445. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8446. referencedClasses: [],
  8447. //>>excludeEnd("ide");
  8448. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8449. }),
  8450. $globals.ProtoStream);
  8451. $core.addMethod(
  8452. $core.method({
  8453. selector: "reset",
  8454. protocol: 'actions',
  8455. fn: function (){
  8456. var self=this;
  8457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8458. return $core.withContext(function($ctx1) {
  8459. //>>excludeEnd("ctx");
  8460. self._subclassResponsibility();
  8461. return self;
  8462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8463. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8464. //>>excludeEnd("ctx");
  8465. },
  8466. //>>excludeStart("ide", pragmas.excludeIdeData);
  8467. args: [],
  8468. source: "reset\x0a\x09self subclassResponsibility",
  8469. referencedClasses: [],
  8470. //>>excludeEnd("ide");
  8471. messageSends: ["subclassResponsibility"]
  8472. }),
  8473. $globals.ProtoStream);
  8474. $core.addMethod(
  8475. $core.method({
  8476. selector: "resetContents",
  8477. protocol: 'actions',
  8478. fn: function (){
  8479. var self=this;
  8480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8481. return $core.withContext(function($ctx1) {
  8482. //>>excludeEnd("ctx");
  8483. self._subclassResponsibility();
  8484. return self;
  8485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8486. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8487. //>>excludeEnd("ctx");
  8488. },
  8489. //>>excludeStart("ide", pragmas.excludeIdeData);
  8490. args: [],
  8491. source: "resetContents\x0a\x09self subclassResponsibility",
  8492. referencedClasses: [],
  8493. //>>excludeEnd("ide");
  8494. messageSends: ["subclassResponsibility"]
  8495. }),
  8496. $globals.ProtoStream);
  8497. $core.addMethod(
  8498. $core.method({
  8499. selector: "setToEnd",
  8500. protocol: 'positioning',
  8501. fn: function (){
  8502. var self=this;
  8503. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8504. return $core.withContext(function($ctx1) {
  8505. //>>excludeEnd("ctx");
  8506. self._subclassResponsibility();
  8507. return self;
  8508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8509. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8510. //>>excludeEnd("ctx");
  8511. },
  8512. //>>excludeStart("ide", pragmas.excludeIdeData);
  8513. args: [],
  8514. source: "setToEnd\x0a\x09self subclassResponsibility",
  8515. referencedClasses: [],
  8516. //>>excludeEnd("ide");
  8517. messageSends: ["subclassResponsibility"]
  8518. }),
  8519. $globals.ProtoStream);
  8520. $core.addMethod(
  8521. $core.method({
  8522. selector: "setToStart",
  8523. protocol: 'positioning',
  8524. fn: function (){
  8525. var self=this;
  8526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8527. return $core.withContext(function($ctx1) {
  8528. //>>excludeEnd("ctx");
  8529. self._reset();
  8530. return self;
  8531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8532. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8533. //>>excludeEnd("ctx");
  8534. },
  8535. //>>excludeStart("ide", pragmas.excludeIdeData);
  8536. args: [],
  8537. source: "setToStart\x0a\x09self reset",
  8538. referencedClasses: [],
  8539. //>>excludeEnd("ide");
  8540. messageSends: ["reset"]
  8541. }),
  8542. $globals.ProtoStream);
  8543. $core.addMethod(
  8544. $core.method({
  8545. selector: "write:",
  8546. protocol: 'writing',
  8547. fn: function (anObject){
  8548. var self=this;
  8549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8550. return $core.withContext(function($ctx1) {
  8551. //>>excludeEnd("ctx");
  8552. $recv(anObject)._putOn_(self);
  8553. return self;
  8554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8555. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8556. //>>excludeEnd("ctx");
  8557. },
  8558. //>>excludeStart("ide", pragmas.excludeIdeData);
  8559. args: ["anObject"],
  8560. source: "write: anObject\x0a\x09anObject putOn: self",
  8561. referencedClasses: [],
  8562. //>>excludeEnd("ide");
  8563. messageSends: ["putOn:"]
  8564. }),
  8565. $globals.ProtoStream);
  8566. $core.addMethod(
  8567. $core.method({
  8568. selector: "on:",
  8569. protocol: 'instance creation',
  8570. fn: function (aCollection){
  8571. var self=this;
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. return $core.withContext(function($ctx1) {
  8574. //>>excludeEnd("ctx");
  8575. var $1;
  8576. $1=self._new();
  8577. $recv($1)._setCollection_(aCollection);
  8578. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8579. return $recv($1)._yourself();
  8580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8581. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  8582. //>>excludeEnd("ctx");
  8583. },
  8584. //>>excludeStart("ide", pragmas.excludeIdeData);
  8585. args: ["aCollection"],
  8586. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8587. referencedClasses: [],
  8588. //>>excludeEnd("ide");
  8589. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8590. }),
  8591. $globals.ProtoStream.klass);
  8592. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  8593. //>>excludeStart("ide", pragmas.excludeIdeData);
  8594. $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.";
  8595. //>>excludeEnd("ide");
  8596. $core.addMethod(
  8597. $core.method({
  8598. selector: "atEnd",
  8599. protocol: 'testing',
  8600. fn: function (){
  8601. var self=this;
  8602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8603. return $core.withContext(function($ctx1) {
  8604. //>>excludeEnd("ctx");
  8605. return $recv(self._position()).__eq(self._size());
  8606. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8607. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8608. //>>excludeEnd("ctx");
  8609. },
  8610. //>>excludeStart("ide", pragmas.excludeIdeData);
  8611. args: [],
  8612. source: "atEnd\x0a\x09^ self position = self size",
  8613. referencedClasses: [],
  8614. //>>excludeEnd("ide");
  8615. messageSends: ["=", "position", "size"]
  8616. }),
  8617. $globals.Stream);
  8618. $core.addMethod(
  8619. $core.method({
  8620. selector: "atStart",
  8621. protocol: 'testing',
  8622. fn: function (){
  8623. var self=this;
  8624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8625. return $core.withContext(function($ctx1) {
  8626. //>>excludeEnd("ctx");
  8627. return $recv(self._position()).__eq((0));
  8628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8629. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8630. //>>excludeEnd("ctx");
  8631. },
  8632. //>>excludeStart("ide", pragmas.excludeIdeData);
  8633. args: [],
  8634. source: "atStart\x0a\x09^ self position = 0",
  8635. referencedClasses: [],
  8636. //>>excludeEnd("ide");
  8637. messageSends: ["=", "position"]
  8638. }),
  8639. $globals.Stream);
  8640. $core.addMethod(
  8641. $core.method({
  8642. selector: "close",
  8643. protocol: 'actions',
  8644. fn: function (){
  8645. var self=this;
  8646. return self;
  8647. },
  8648. //>>excludeStart("ide", pragmas.excludeIdeData);
  8649. args: [],
  8650. source: "close",
  8651. referencedClasses: [],
  8652. //>>excludeEnd("ide");
  8653. messageSends: []
  8654. }),
  8655. $globals.Stream);
  8656. $core.addMethod(
  8657. $core.method({
  8658. selector: "collection",
  8659. protocol: 'accessing',
  8660. fn: function (){
  8661. var self=this;
  8662. return self["@collection"];
  8663. },
  8664. //>>excludeStart("ide", pragmas.excludeIdeData);
  8665. args: [],
  8666. source: "collection\x0a\x09^ collection",
  8667. referencedClasses: [],
  8668. //>>excludeEnd("ide");
  8669. messageSends: []
  8670. }),
  8671. $globals.Stream);
  8672. $core.addMethod(
  8673. $core.method({
  8674. selector: "contents",
  8675. protocol: 'accessing',
  8676. fn: function (){
  8677. var self=this;
  8678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8679. return $core.withContext(function($ctx1) {
  8680. //>>excludeEnd("ctx");
  8681. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  8682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8683. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8684. //>>excludeEnd("ctx");
  8685. },
  8686. //>>excludeStart("ide", pragmas.excludeIdeData);
  8687. args: [],
  8688. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8689. referencedClasses: [],
  8690. //>>excludeEnd("ide");
  8691. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8692. }),
  8693. $globals.Stream);
  8694. $core.addMethod(
  8695. $core.method({
  8696. selector: "flush",
  8697. protocol: 'actions',
  8698. fn: function (){
  8699. var self=this;
  8700. return self;
  8701. },
  8702. //>>excludeStart("ide", pragmas.excludeIdeData);
  8703. args: [],
  8704. source: "flush",
  8705. referencedClasses: [],
  8706. //>>excludeEnd("ide");
  8707. messageSends: []
  8708. }),
  8709. $globals.Stream);
  8710. $core.addMethod(
  8711. $core.method({
  8712. selector: "isEmpty",
  8713. protocol: 'testing',
  8714. fn: function (){
  8715. var self=this;
  8716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8717. return $core.withContext(function($ctx1) {
  8718. //>>excludeEnd("ctx");
  8719. return $recv(self._size()).__eq((0));
  8720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8721. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8722. //>>excludeEnd("ctx");
  8723. },
  8724. //>>excludeStart("ide", pragmas.excludeIdeData);
  8725. args: [],
  8726. source: "isEmpty\x0a\x09^ self size = 0",
  8727. referencedClasses: [],
  8728. //>>excludeEnd("ide");
  8729. messageSends: ["=", "size"]
  8730. }),
  8731. $globals.Stream);
  8732. $core.addMethod(
  8733. $core.method({
  8734. selector: "next",
  8735. protocol: 'reading',
  8736. fn: function (){
  8737. var self=this;
  8738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8739. return $core.withContext(function($ctx1) {
  8740. //>>excludeEnd("ctx");
  8741. var $1,$3,$2;
  8742. $1=self._atEnd();
  8743. if($core.assert($1)){
  8744. return nil;
  8745. } else {
  8746. $3=self._position();
  8747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8748. $ctx1.sendIdx["position"]=1;
  8749. //>>excludeEnd("ctx");
  8750. $2=$recv($3).__plus((1));
  8751. self._position_($2);
  8752. return $recv(self["@collection"])._at_(self._position());
  8753. }
  8754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8755. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8756. //>>excludeEnd("ctx");
  8757. },
  8758. //>>excludeStart("ide", pragmas.excludeIdeData);
  8759. args: [],
  8760. 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 ]",
  8761. referencedClasses: [],
  8762. //>>excludeEnd("ide");
  8763. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8764. }),
  8765. $globals.Stream);
  8766. $core.addMethod(
  8767. $core.method({
  8768. selector: "next:",
  8769. protocol: 'reading',
  8770. fn: function (anInteger){
  8771. var self=this;
  8772. var tempCollection;
  8773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8774. return $core.withContext(function($ctx1) {
  8775. //>>excludeEnd("ctx");
  8776. var $1;
  8777. tempCollection=$recv($recv(self._collection())._class())._new();
  8778. $recv(anInteger)._timesRepeat_((function(){
  8779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8780. return $core.withContext(function($ctx2) {
  8781. //>>excludeEnd("ctx");
  8782. $1=self._atEnd();
  8783. if(!$core.assert($1)){
  8784. return $recv(tempCollection)._add_(self._next());
  8785. }
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8788. //>>excludeEnd("ctx");
  8789. }));
  8790. return tempCollection;
  8791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8792. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8793. //>>excludeEnd("ctx");
  8794. },
  8795. //>>excludeStart("ide", pragmas.excludeIdeData);
  8796. args: ["anInteger"],
  8797. 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",
  8798. referencedClasses: [],
  8799. //>>excludeEnd("ide");
  8800. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8801. }),
  8802. $globals.Stream);
  8803. $core.addMethod(
  8804. $core.method({
  8805. selector: "nextPut:",
  8806. protocol: 'writing',
  8807. fn: function (anObject){
  8808. var self=this;
  8809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8810. return $core.withContext(function($ctx1) {
  8811. //>>excludeEnd("ctx");
  8812. var $2,$1,$3,$4;
  8813. $2=self._position();
  8814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8815. $ctx1.sendIdx["position"]=1;
  8816. //>>excludeEnd("ctx");
  8817. $1=$recv($2).__plus((1));
  8818. self._position_($1);
  8819. $3=self._collection();
  8820. $4=self._position();
  8821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8822. $ctx1.sendIdx["position"]=2;
  8823. //>>excludeEnd("ctx");
  8824. $recv($3)._at_put_($4,anObject);
  8825. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  8826. return self;
  8827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8828. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8829. //>>excludeEnd("ctx");
  8830. },
  8831. //>>excludeStart("ide", pragmas.excludeIdeData);
  8832. args: ["anObject"],
  8833. 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)",
  8834. referencedClasses: [],
  8835. //>>excludeEnd("ide");
  8836. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8837. }),
  8838. $globals.Stream);
  8839. $core.addMethod(
  8840. $core.method({
  8841. selector: "peek",
  8842. protocol: 'reading',
  8843. fn: function (){
  8844. var self=this;
  8845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8846. return $core.withContext(function($ctx1) {
  8847. //>>excludeEnd("ctx");
  8848. var $1;
  8849. $1=self._atEnd();
  8850. if(!$core.assert($1)){
  8851. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  8852. }
  8853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8854. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8855. //>>excludeEnd("ctx");
  8856. },
  8857. //>>excludeStart("ide", pragmas.excludeIdeData);
  8858. args: [],
  8859. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8860. referencedClasses: [],
  8861. //>>excludeEnd("ide");
  8862. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8863. }),
  8864. $globals.Stream);
  8865. $core.addMethod(
  8866. $core.method({
  8867. selector: "position",
  8868. protocol: 'accessing',
  8869. fn: function (){
  8870. var self=this;
  8871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8872. return $core.withContext(function($ctx1) {
  8873. //>>excludeEnd("ctx");
  8874. var $1,$receiver;
  8875. $1=self["@position"];
  8876. if(($receiver = $1) == null || $receiver.isNil){
  8877. self["@position"]=(0);
  8878. return self["@position"];
  8879. } else {
  8880. return $1;
  8881. }
  8882. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8883. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8884. //>>excludeEnd("ctx");
  8885. },
  8886. //>>excludeStart("ide", pragmas.excludeIdeData);
  8887. args: [],
  8888. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8889. referencedClasses: [],
  8890. //>>excludeEnd("ide");
  8891. messageSends: ["ifNil:"]
  8892. }),
  8893. $globals.Stream);
  8894. $core.addMethod(
  8895. $core.method({
  8896. selector: "position:",
  8897. protocol: 'accessing',
  8898. fn: function (anInteger){
  8899. var self=this;
  8900. self["@position"]=anInteger;
  8901. return self;
  8902. },
  8903. //>>excludeStart("ide", pragmas.excludeIdeData);
  8904. args: ["anInteger"],
  8905. source: "position: anInteger\x0a\x09position := anInteger",
  8906. referencedClasses: [],
  8907. //>>excludeEnd("ide");
  8908. messageSends: []
  8909. }),
  8910. $globals.Stream);
  8911. $core.addMethod(
  8912. $core.method({
  8913. selector: "reset",
  8914. protocol: 'actions',
  8915. fn: function (){
  8916. var self=this;
  8917. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8918. return $core.withContext(function($ctx1) {
  8919. //>>excludeEnd("ctx");
  8920. self._position_((0));
  8921. return self;
  8922. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8923. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8924. //>>excludeEnd("ctx");
  8925. },
  8926. //>>excludeStart("ide", pragmas.excludeIdeData);
  8927. args: [],
  8928. source: "reset\x0a\x09self position: 0",
  8929. referencedClasses: [],
  8930. //>>excludeEnd("ide");
  8931. messageSends: ["position:"]
  8932. }),
  8933. $globals.Stream);
  8934. $core.addMethod(
  8935. $core.method({
  8936. selector: "resetContents",
  8937. protocol: 'actions',
  8938. fn: function (){
  8939. var self=this;
  8940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8941. return $core.withContext(function($ctx1) {
  8942. //>>excludeEnd("ctx");
  8943. self._reset();
  8944. self._setStreamSize_((0));
  8945. return self;
  8946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8947. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8948. //>>excludeEnd("ctx");
  8949. },
  8950. //>>excludeStart("ide", pragmas.excludeIdeData);
  8951. args: [],
  8952. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8953. referencedClasses: [],
  8954. //>>excludeEnd("ide");
  8955. messageSends: ["reset", "setStreamSize:"]
  8956. }),
  8957. $globals.Stream);
  8958. $core.addMethod(
  8959. $core.method({
  8960. selector: "setCollection:",
  8961. protocol: 'accessing',
  8962. fn: function (aCollection){
  8963. var self=this;
  8964. self["@collection"]=aCollection;
  8965. return self;
  8966. },
  8967. //>>excludeStart("ide", pragmas.excludeIdeData);
  8968. args: ["aCollection"],
  8969. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8970. referencedClasses: [],
  8971. //>>excludeEnd("ide");
  8972. messageSends: []
  8973. }),
  8974. $globals.Stream);
  8975. $core.addMethod(
  8976. $core.method({
  8977. selector: "setStreamSize:",
  8978. protocol: 'accessing',
  8979. fn: function (anInteger){
  8980. var self=this;
  8981. self["@streamSize"]=anInteger;
  8982. return self;
  8983. },
  8984. //>>excludeStart("ide", pragmas.excludeIdeData);
  8985. args: ["anInteger"],
  8986. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8987. referencedClasses: [],
  8988. //>>excludeEnd("ide");
  8989. messageSends: []
  8990. }),
  8991. $globals.Stream);
  8992. $core.addMethod(
  8993. $core.method({
  8994. selector: "setToEnd",
  8995. protocol: 'positioning',
  8996. fn: function (){
  8997. var self=this;
  8998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8999. return $core.withContext(function($ctx1) {
  9000. //>>excludeEnd("ctx");
  9001. self._position_(self._size());
  9002. return self;
  9003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9004. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  9005. //>>excludeEnd("ctx");
  9006. },
  9007. //>>excludeStart("ide", pragmas.excludeIdeData);
  9008. args: [],
  9009. source: "setToEnd\x0a\x09self position: self size",
  9010. referencedClasses: [],
  9011. //>>excludeEnd("ide");
  9012. messageSends: ["position:", "size"]
  9013. }),
  9014. $globals.Stream);
  9015. $core.addMethod(
  9016. $core.method({
  9017. selector: "size",
  9018. protocol: 'accessing',
  9019. fn: function (){
  9020. var self=this;
  9021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9022. return $core.withContext(function($ctx1) {
  9023. //>>excludeEnd("ctx");
  9024. return self._streamSize();
  9025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9026. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  9027. //>>excludeEnd("ctx");
  9028. },
  9029. //>>excludeStart("ide", pragmas.excludeIdeData);
  9030. args: [],
  9031. source: "size\x0a\x09^ self streamSize",
  9032. referencedClasses: [],
  9033. //>>excludeEnd("ide");
  9034. messageSends: ["streamSize"]
  9035. }),
  9036. $globals.Stream);
  9037. $core.addMethod(
  9038. $core.method({
  9039. selector: "skip:",
  9040. protocol: 'positioning',
  9041. fn: function (anInteger){
  9042. var self=this;
  9043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9044. return $core.withContext(function($ctx1) {
  9045. //>>excludeEnd("ctx");
  9046. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  9047. return self;
  9048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9049. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  9050. //>>excludeEnd("ctx");
  9051. },
  9052. //>>excludeStart("ide", pragmas.excludeIdeData);
  9053. args: ["anInteger"],
  9054. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9055. referencedClasses: [],
  9056. //>>excludeEnd("ide");
  9057. messageSends: ["position:", "min:max:", "+", "position", "size"]
  9058. }),
  9059. $globals.Stream);
  9060. $core.addMethod(
  9061. $core.method({
  9062. selector: "streamSize",
  9063. protocol: 'accessing',
  9064. fn: function (){
  9065. var self=this;
  9066. return self["@streamSize"];
  9067. },
  9068. //>>excludeStart("ide", pragmas.excludeIdeData);
  9069. args: [],
  9070. source: "streamSize\x0a\x09^ streamSize",
  9071. referencedClasses: [],
  9072. //>>excludeEnd("ide");
  9073. messageSends: []
  9074. }),
  9075. $globals.Stream);
  9076. $core.addMethod(
  9077. $core.method({
  9078. selector: "on:",
  9079. protocol: 'instance creation',
  9080. fn: function (aCollection){
  9081. var self=this;
  9082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9083. return $core.withContext(function($ctx1) {
  9084. //>>excludeEnd("ctx");
  9085. var $1;
  9086. $1=self._new();
  9087. $recv($1)._setCollection_(aCollection);
  9088. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9089. return $recv($1)._yourself();
  9090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9091. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  9092. //>>excludeEnd("ctx");
  9093. },
  9094. //>>excludeStart("ide", pragmas.excludeIdeData);
  9095. args: ["aCollection"],
  9096. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9097. referencedClasses: [],
  9098. //>>excludeEnd("ide");
  9099. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9100. }),
  9101. $globals.Stream.klass);
  9102. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  9103. //>>excludeStart("ide", pragmas.excludeIdeData);
  9104. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9105. //>>excludeEnd("ide");
  9106. $core.addMethod(
  9107. $core.method({
  9108. selector: "cr",
  9109. protocol: 'writing',
  9110. fn: function (){
  9111. var self=this;
  9112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9113. return $core.withContext(function($ctx1) {
  9114. //>>excludeEnd("ctx");
  9115. return self._nextPutAll_($recv($globals.String)._cr());
  9116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9117. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9118. //>>excludeEnd("ctx");
  9119. },
  9120. //>>excludeStart("ide", pragmas.excludeIdeData);
  9121. args: [],
  9122. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9123. referencedClasses: ["String"],
  9124. //>>excludeEnd("ide");
  9125. messageSends: ["nextPutAll:", "cr"]
  9126. }),
  9127. $globals.StringStream);
  9128. $core.addMethod(
  9129. $core.method({
  9130. selector: "crlf",
  9131. protocol: 'writing',
  9132. fn: function (){
  9133. var self=this;
  9134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9135. return $core.withContext(function($ctx1) {
  9136. //>>excludeEnd("ctx");
  9137. return self._nextPutAll_($recv($globals.String)._crlf());
  9138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9139. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9140. //>>excludeEnd("ctx");
  9141. },
  9142. //>>excludeStart("ide", pragmas.excludeIdeData);
  9143. args: [],
  9144. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9145. referencedClasses: ["String"],
  9146. //>>excludeEnd("ide");
  9147. messageSends: ["nextPutAll:", "crlf"]
  9148. }),
  9149. $globals.StringStream);
  9150. $core.addMethod(
  9151. $core.method({
  9152. selector: "lf",
  9153. protocol: 'writing',
  9154. fn: function (){
  9155. var self=this;
  9156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9157. return $core.withContext(function($ctx1) {
  9158. //>>excludeEnd("ctx");
  9159. return self._nextPutAll_($recv($globals.String)._lf());
  9160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9161. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9162. //>>excludeEnd("ctx");
  9163. },
  9164. //>>excludeStart("ide", pragmas.excludeIdeData);
  9165. args: [],
  9166. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9167. referencedClasses: ["String"],
  9168. //>>excludeEnd("ide");
  9169. messageSends: ["nextPutAll:", "lf"]
  9170. }),
  9171. $globals.StringStream);
  9172. $core.addMethod(
  9173. $core.method({
  9174. selector: "next:",
  9175. protocol: 'reading',
  9176. fn: function (anInteger){
  9177. var self=this;
  9178. var tempCollection;
  9179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9180. return $core.withContext(function($ctx1) {
  9181. //>>excludeEnd("ctx");
  9182. var $1;
  9183. tempCollection=$recv($recv(self._collection())._class())._new();
  9184. $recv(anInteger)._timesRepeat_((function(){
  9185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9186. return $core.withContext(function($ctx2) {
  9187. //>>excludeEnd("ctx");
  9188. $1=self._atEnd();
  9189. if(!$core.assert($1)){
  9190. tempCollection=$recv(tempCollection).__comma(self._next());
  9191. return tempCollection;
  9192. }
  9193. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9194. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9195. //>>excludeEnd("ctx");
  9196. }));
  9197. return tempCollection;
  9198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9199. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9200. //>>excludeEnd("ctx");
  9201. },
  9202. //>>excludeStart("ide", pragmas.excludeIdeData);
  9203. args: ["anInteger"],
  9204. 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",
  9205. referencedClasses: [],
  9206. //>>excludeEnd("ide");
  9207. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9208. }),
  9209. $globals.StringStream);
  9210. $core.addMethod(
  9211. $core.method({
  9212. selector: "nextPut:",
  9213. protocol: 'writing',
  9214. fn: function (aString){
  9215. var self=this;
  9216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9217. return $core.withContext(function($ctx1) {
  9218. //>>excludeEnd("ctx");
  9219. self._nextPutAll_(aString);
  9220. return self;
  9221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9222. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9223. //>>excludeEnd("ctx");
  9224. },
  9225. //>>excludeStart("ide", pragmas.excludeIdeData);
  9226. args: ["aString"],
  9227. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9228. referencedClasses: [],
  9229. //>>excludeEnd("ide");
  9230. messageSends: ["nextPutAll:"]
  9231. }),
  9232. $globals.StringStream);
  9233. $core.addMethod(
  9234. $core.method({
  9235. selector: "nextPutAll:",
  9236. protocol: 'writing',
  9237. fn: function (aString){
  9238. var self=this;
  9239. var pre,post;
  9240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9241. return $core.withContext(function($ctx1) {
  9242. //>>excludeEnd("ctx");
  9243. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9244. $1=self._atEnd();
  9245. if($core.assert($1)){
  9246. $3=self._collection();
  9247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9248. $ctx1.sendIdx["collection"]=1;
  9249. //>>excludeEnd("ctx");
  9250. $2=$recv($3).__comma(aString);
  9251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9252. $ctx1.sendIdx[","]=1;
  9253. //>>excludeEnd("ctx");
  9254. self._setCollection_($2);
  9255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9256. $ctx1.sendIdx["setCollection:"]=1;
  9257. //>>excludeEnd("ctx");
  9258. } else {
  9259. $4=self._collection();
  9260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9261. $ctx1.sendIdx["collection"]=2;
  9262. //>>excludeEnd("ctx");
  9263. $5=self._position();
  9264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9265. $ctx1.sendIdx["position"]=1;
  9266. //>>excludeEnd("ctx");
  9267. pre=$recv($4)._copyFrom_to_((1),$5);
  9268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9269. $ctx1.sendIdx["copyFrom:to:"]=1;
  9270. //>>excludeEnd("ctx");
  9271. pre;
  9272. $6=self._collection();
  9273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9274. $ctx1.sendIdx["collection"]=3;
  9275. //>>excludeEnd("ctx");
  9276. $9=self._position();
  9277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9278. $ctx1.sendIdx["position"]=2;
  9279. //>>excludeEnd("ctx");
  9280. $8=$recv($9).__plus((1));
  9281. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9282. $ctx1.sendIdx["+"]=2;
  9283. //>>excludeEnd("ctx");
  9284. $10=$recv(aString)._size();
  9285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9286. $ctx1.sendIdx["size"]=1;
  9287. //>>excludeEnd("ctx");
  9288. $7=$recv($8).__plus($10);
  9289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9290. $ctx1.sendIdx["+"]=1;
  9291. //>>excludeEnd("ctx");
  9292. $11=$recv(self._collection())._size();
  9293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9294. $ctx1.sendIdx["size"]=2;
  9295. //>>excludeEnd("ctx");
  9296. post=$recv($6)._copyFrom_to_($7,$11);
  9297. post;
  9298. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9300. $ctx1.sendIdx[","]=2;
  9301. //>>excludeEnd("ctx");
  9302. self._setCollection_($12);
  9303. }
  9304. $14=self._position();
  9305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9306. $ctx1.sendIdx["position"]=3;
  9307. //>>excludeEnd("ctx");
  9308. $13=$recv($14).__plus($recv(aString)._size());
  9309. self._position_($13);
  9310. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  9311. return self;
  9312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9313. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9314. //>>excludeEnd("ctx");
  9315. },
  9316. //>>excludeStart("ide", pragmas.excludeIdeData);
  9317. args: ["aString"],
  9318. 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)",
  9319. referencedClasses: [],
  9320. //>>excludeEnd("ide");
  9321. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9322. }),
  9323. $globals.StringStream);
  9324. $core.addMethod(
  9325. $core.method({
  9326. selector: "nextPutString:",
  9327. protocol: 'writing',
  9328. fn: function (aString){
  9329. var self=this;
  9330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9331. return $core.withContext(function($ctx1) {
  9332. //>>excludeEnd("ctx");
  9333. self._nextPutAll_(aString);
  9334. return self;
  9335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9336. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9337. //>>excludeEnd("ctx");
  9338. },
  9339. //>>excludeStart("ide", pragmas.excludeIdeData);
  9340. args: ["aString"],
  9341. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9342. referencedClasses: [],
  9343. //>>excludeEnd("ide");
  9344. messageSends: ["nextPutAll:"]
  9345. }),
  9346. $globals.StringStream);
  9347. $core.addMethod(
  9348. $core.method({
  9349. selector: "space",
  9350. protocol: 'writing',
  9351. fn: function (){
  9352. var self=this;
  9353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9354. return $core.withContext(function($ctx1) {
  9355. //>>excludeEnd("ctx");
  9356. self._nextPut_(" ");
  9357. return self;
  9358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9359. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9360. //>>excludeEnd("ctx");
  9361. },
  9362. //>>excludeStart("ide", pragmas.excludeIdeData);
  9363. args: [],
  9364. source: "space\x0a\x09self nextPut: ' '",
  9365. referencedClasses: [],
  9366. //>>excludeEnd("ide");
  9367. messageSends: ["nextPut:"]
  9368. }),
  9369. $globals.StringStream);
  9370. $core.addMethod(
  9371. $core.method({
  9372. selector: "tab",
  9373. protocol: 'writing',
  9374. fn: function (){
  9375. var self=this;
  9376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9377. return $core.withContext(function($ctx1) {
  9378. //>>excludeEnd("ctx");
  9379. return self._nextPutAll_($recv($globals.String)._tab());
  9380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9381. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9382. //>>excludeEnd("ctx");
  9383. },
  9384. //>>excludeStart("ide", pragmas.excludeIdeData);
  9385. args: [],
  9386. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9387. referencedClasses: ["String"],
  9388. //>>excludeEnd("ide");
  9389. messageSends: ["nextPutAll:", "tab"]
  9390. }),
  9391. $globals.StringStream);
  9392. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  9393. //>>excludeStart("ide", pragmas.excludeIdeData);
  9394. $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.";
  9395. //>>excludeEnd("ide");
  9396. $core.addMethod(
  9397. $core.method({
  9398. selector: "initialize",
  9399. protocol: 'initialization',
  9400. fn: function (){
  9401. var self=this;
  9402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9403. return $core.withContext(function($ctx1) {
  9404. //>>excludeEnd("ctx");
  9405. (
  9406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9407. $ctx1.supercall = true,
  9408. //>>excludeEnd("ctx");
  9409. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($recv(self), []));
  9410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9411. $ctx1.supercall = false;
  9412. //>>excludeEnd("ctx");;
  9413. self["@read"]=$recv($globals.OrderedCollection)._new();
  9414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9415. $ctx1.sendIdx["new"]=1;
  9416. //>>excludeEnd("ctx");
  9417. self["@write"]=$recv($globals.OrderedCollection)._new();
  9418. self["@readIndex"]=(1);
  9419. return self;
  9420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9421. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9422. //>>excludeEnd("ctx");
  9423. },
  9424. //>>excludeStart("ide", pragmas.excludeIdeData);
  9425. args: [],
  9426. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9427. referencedClasses: ["OrderedCollection"],
  9428. //>>excludeEnd("ide");
  9429. messageSends: ["initialize", "new"]
  9430. }),
  9431. $globals.Queue);
  9432. $core.addMethod(
  9433. $core.method({
  9434. selector: "next",
  9435. protocol: 'accessing',
  9436. fn: function (){
  9437. var self=this;
  9438. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9439. return $core.withContext(function($ctx1) {
  9440. //>>excludeEnd("ctx");
  9441. return self._nextIfAbsent_((function(){
  9442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9443. return $core.withContext(function($ctx2) {
  9444. //>>excludeEnd("ctx");
  9445. return self._error_("Cannot read from empty Queue.");
  9446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9447. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9448. //>>excludeEnd("ctx");
  9449. }));
  9450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9451. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9452. //>>excludeEnd("ctx");
  9453. },
  9454. //>>excludeStart("ide", pragmas.excludeIdeData);
  9455. args: [],
  9456. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9457. referencedClasses: [],
  9458. //>>excludeEnd("ide");
  9459. messageSends: ["nextIfAbsent:", "error:"]
  9460. }),
  9461. $globals.Queue);
  9462. $core.addMethod(
  9463. $core.method({
  9464. selector: "nextIfAbsent:",
  9465. protocol: 'accessing',
  9466. fn: function (aBlock){
  9467. var self=this;
  9468. var result;
  9469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9470. return $core.withContext(function($ctx1) {
  9471. //>>excludeEnd("ctx");
  9472. var $1;
  9473. var $early={};
  9474. try {
  9475. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  9476. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9477. return $core.withContext(function($ctx2) {
  9478. //>>excludeEnd("ctx");
  9479. $recv(self["@write"])._ifEmpty_((function(){
  9480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9481. return $core.withContext(function($ctx3) {
  9482. //>>excludeEnd("ctx");
  9483. $1=$recv(self["@readIndex"]).__gt((1));
  9484. if($core.assert($1)){
  9485. self["@read"]=[];
  9486. self["@read"];
  9487. self["@readIndex"]=(1);
  9488. self["@readIndex"];
  9489. }
  9490. throw $early=[$recv(aBlock)._value()];
  9491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9492. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  9493. //>>excludeEnd("ctx");
  9494. }));
  9495. self["@read"]=self["@write"];
  9496. self["@read"];
  9497. self["@readIndex"]=(1);
  9498. self["@readIndex"];
  9499. self["@write"]=$recv($globals.OrderedCollection)._new();
  9500. self["@write"];
  9501. return $recv(self["@read"])._first();
  9502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9504. //>>excludeEnd("ctx");
  9505. }));
  9506. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  9507. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  9508. return result;
  9509. }
  9510. catch(e) {if(e===$early)return e[0]; throw e}
  9511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9512. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9513. //>>excludeEnd("ctx");
  9514. },
  9515. //>>excludeStart("ide", pragmas.excludeIdeData);
  9516. args: ["aBlock"],
  9517. 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",
  9518. referencedClasses: ["OrderedCollection"],
  9519. //>>excludeEnd("ide");
  9520. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  9521. }),
  9522. $globals.Queue);
  9523. $core.addMethod(
  9524. $core.method({
  9525. selector: "nextPut:",
  9526. protocol: 'accessing',
  9527. fn: function (anObject){
  9528. var self=this;
  9529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9530. return $core.withContext(function($ctx1) {
  9531. //>>excludeEnd("ctx");
  9532. $recv(self["@write"])._add_(anObject);
  9533. return self;
  9534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9535. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9536. //>>excludeEnd("ctx");
  9537. },
  9538. //>>excludeStart("ide", pragmas.excludeIdeData);
  9539. args: ["anObject"],
  9540. source: "nextPut: anObject\x0a\x09write add: anObject",
  9541. referencedClasses: [],
  9542. //>>excludeEnd("ide");
  9543. messageSends: ["add:"]
  9544. }),
  9545. $globals.Queue);
  9546. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  9547. //>>excludeStart("ide", pragmas.excludeIdeData);
  9548. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9549. //>>excludeEnd("ide");
  9550. $core.addMethod(
  9551. $core.method({
  9552. selector: "compile:",
  9553. protocol: 'evaluating',
  9554. fn: function (aString){
  9555. var self=this;
  9556. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9557. return $core.withContext(function($ctx1) {
  9558. //>>excludeEnd("ctx");
  9559. return self.compile(aString);
  9560. return self;
  9561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9562. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9563. //>>excludeEnd("ctx");
  9564. },
  9565. //>>excludeStart("ide", pragmas.excludeIdeData);
  9566. args: ["aString"],
  9567. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  9568. referencedClasses: [],
  9569. //>>excludeEnd("ide");
  9570. messageSends: []
  9571. }),
  9572. $globals.RegularExpression);
  9573. $core.addMethod(
  9574. $core.method({
  9575. selector: "exec:",
  9576. protocol: 'evaluating',
  9577. fn: function (aString){
  9578. var self=this;
  9579. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9580. return $core.withContext(function($ctx1) {
  9581. //>>excludeEnd("ctx");
  9582. return self.exec(aString) || nil;
  9583. return self;
  9584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9585. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9586. //>>excludeEnd("ctx");
  9587. },
  9588. //>>excludeStart("ide", pragmas.excludeIdeData);
  9589. args: ["aString"],
  9590. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  9591. referencedClasses: [],
  9592. //>>excludeEnd("ide");
  9593. messageSends: []
  9594. }),
  9595. $globals.RegularExpression);
  9596. $core.addMethod(
  9597. $core.method({
  9598. selector: "test:",
  9599. protocol: 'evaluating',
  9600. fn: function (aString){
  9601. var self=this;
  9602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9603. return $core.withContext(function($ctx1) {
  9604. //>>excludeEnd("ctx");
  9605. return self.test(aString);
  9606. return self;
  9607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9608. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9609. //>>excludeEnd("ctx");
  9610. },
  9611. //>>excludeStart("ide", pragmas.excludeIdeData);
  9612. args: ["aString"],
  9613. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  9614. referencedClasses: [],
  9615. //>>excludeEnd("ide");
  9616. messageSends: []
  9617. }),
  9618. $globals.RegularExpression);
  9619. $core.addMethod(
  9620. $core.method({
  9621. selector: "fromString:",
  9622. protocol: 'instance creation',
  9623. fn: function (aString){
  9624. var self=this;
  9625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9626. return $core.withContext(function($ctx1) {
  9627. //>>excludeEnd("ctx");
  9628. return self._fromString_flag_(aString,"");
  9629. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9630. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  9631. //>>excludeEnd("ctx");
  9632. },
  9633. //>>excludeStart("ide", pragmas.excludeIdeData);
  9634. args: ["aString"],
  9635. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9636. referencedClasses: [],
  9637. //>>excludeEnd("ide");
  9638. messageSends: ["fromString:flag:"]
  9639. }),
  9640. $globals.RegularExpression.klass);
  9641. $core.addMethod(
  9642. $core.method({
  9643. selector: "fromString:flag:",
  9644. protocol: 'instance creation',
  9645. fn: function (aString,anotherString){
  9646. var self=this;
  9647. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9648. return $core.withContext(function($ctx1) {
  9649. //>>excludeEnd("ctx");
  9650. return new RegExp(aString, anotherString);
  9651. return self;
  9652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9653. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  9654. //>>excludeEnd("ctx");
  9655. },
  9656. //>>excludeStart("ide", pragmas.excludeIdeData);
  9657. args: ["aString", "anotherString"],
  9658. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  9659. referencedClasses: [],
  9660. //>>excludeEnd("ide");
  9661. messageSends: []
  9662. }),
  9663. $globals.RegularExpression.klass);
  9664. });