Kernel-Collections.js 321 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048
  1. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  2. var $core=$boot.api,nil=$boot.nil,$recv=$boot.asReceiver,$globals=$boot.globals;
  3. $core.addPackage('Kernel-Collections');
  4. $core.packages["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  5. $core.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  6. $core.addClass('Association', $globals.Object, ['key', 'value'], 'Kernel-Collections');
  7. //>>excludeStart("ide", pragmas.excludeIdeData);
  8. $globals.Association.comment="I represent a pair of associated objects, a key and a value. My instances can serve as entries in a dictionary.\x0a\x0aInstances can be created with the class-side method `#key:value:`";
  9. //>>excludeEnd("ide");
  10. $core.addMethod(
  11. $core.method({
  12. selector: "=",
  13. protocol: 'comparing',
  14. fn: function (anAssociation){
  15. var self=this;
  16. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  17. return $core.withContext(function($ctx1) {
  18. //>>excludeEnd("ctx");
  19. var $3,$2,$5,$4,$6,$1;
  20. $3=self._class();
  21. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  22. $ctx1.sendIdx["class"]=1;
  23. //>>excludeEnd("ctx");
  24. $2=$recv($3).__eq($recv(anAssociation)._class());
  25. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  26. $ctx1.sendIdx["="]=1;
  27. //>>excludeEnd("ctx");
  28. $1=$recv($2)._and_((function(){
  29. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  30. return $core.withContext(function($ctx2) {
  31. //>>excludeEnd("ctx");
  32. $5=self._key();
  33. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  34. $ctx2.sendIdx["key"]=1;
  35. //>>excludeEnd("ctx");
  36. $4=$recv($5).__eq($recv(anAssociation)._key());
  37. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  38. $ctx2.sendIdx["="]=2;
  39. //>>excludeEnd("ctx");
  40. return $recv($4)._and_((function(){
  41. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  42. return $core.withContext(function($ctx3) {
  43. //>>excludeEnd("ctx");
  44. $6=self._value();
  45. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  46. $ctx3.sendIdx["value"]=1;
  47. //>>excludeEnd("ctx");
  48. return $recv($6).__eq($recv(anAssociation)._value());
  49. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  50. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51. //>>excludeEnd("ctx");
  52. }));
  53. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  54. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55. //>>excludeEnd("ctx");
  56. }));
  57. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  58. $ctx1.sendIdx["and:"]=1;
  59. //>>excludeEnd("ctx");
  60. return $1;
  61. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  62. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  63. //>>excludeEnd("ctx");
  64. },
  65. //>>excludeStart("ide", pragmas.excludeIdeData);
  66. args: ["anAssociation"],
  67. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  68. referencedClasses: [],
  69. //>>excludeEnd("ide");
  70. messageSends: ["and:", "=", "class", "key", "value"]
  71. }),
  72. $globals.Association);
  73. $core.addMethod(
  74. $core.method({
  75. selector: "key",
  76. protocol: 'accessing',
  77. fn: function (){
  78. var self=this;
  79. return self["@key"];
  80. },
  81. //>>excludeStart("ide", pragmas.excludeIdeData);
  82. args: [],
  83. source: "key\x0a\x09^ key",
  84. referencedClasses: [],
  85. //>>excludeEnd("ide");
  86. messageSends: []
  87. }),
  88. $globals.Association);
  89. $core.addMethod(
  90. $core.method({
  91. selector: "key:",
  92. protocol: 'accessing',
  93. fn: function (aKey){
  94. var self=this;
  95. self["@key"]=aKey;
  96. return self;
  97. },
  98. //>>excludeStart("ide", pragmas.excludeIdeData);
  99. args: ["aKey"],
  100. source: "key: aKey\x0a\x09key := aKey",
  101. referencedClasses: [],
  102. //>>excludeEnd("ide");
  103. messageSends: []
  104. }),
  105. $globals.Association);
  106. $core.addMethod(
  107. $core.method({
  108. selector: "printOn:",
  109. protocol: 'printing',
  110. fn: function (aStream){
  111. var self=this;
  112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  113. return $core.withContext(function($ctx1) {
  114. //>>excludeEnd("ctx");
  115. $recv(self._key())._printOn_(aStream);
  116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  117. $ctx1.sendIdx["printOn:"]=1;
  118. //>>excludeEnd("ctx");
  119. $recv(aStream)._nextPutAll_(" -> ");
  120. $recv(self._value())._printOn_(aStream);
  121. return self;
  122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  123. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  124. //>>excludeEnd("ctx");
  125. },
  126. //>>excludeStart("ide", pragmas.excludeIdeData);
  127. args: ["aStream"],
  128. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  129. referencedClasses: [],
  130. //>>excludeEnd("ide");
  131. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  132. }),
  133. $globals.Association);
  134. $core.addMethod(
  135. $core.method({
  136. selector: "value",
  137. protocol: 'accessing',
  138. fn: function (){
  139. var self=this;
  140. return self["@value"];
  141. },
  142. //>>excludeStart("ide", pragmas.excludeIdeData);
  143. args: [],
  144. source: "value\x0a\x09^ value",
  145. referencedClasses: [],
  146. //>>excludeEnd("ide");
  147. messageSends: []
  148. }),
  149. $globals.Association);
  150. $core.addMethod(
  151. $core.method({
  152. selector: "value:",
  153. protocol: 'accessing',
  154. fn: function (aValue){
  155. var self=this;
  156. self["@value"]=aValue;
  157. return self;
  158. },
  159. //>>excludeStart("ide", pragmas.excludeIdeData);
  160. args: ["aValue"],
  161. source: "value: aValue\x0a\x09value := aValue",
  162. referencedClasses: [],
  163. //>>excludeEnd("ide");
  164. messageSends: []
  165. }),
  166. $globals.Association);
  167. $core.addMethod(
  168. $core.method({
  169. selector: "key:value:",
  170. protocol: 'instance creation',
  171. fn: function (aKey,aValue){
  172. var self=this;
  173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  174. return $core.withContext(function($ctx1) {
  175. //>>excludeEnd("ctx");
  176. var $1;
  177. $1=self._new();
  178. $recv($1)._key_(aKey);
  179. $recv($1)._value_(aValue);
  180. return $recv($1)._yourself();
  181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  182. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.klass)});
  183. //>>excludeEnd("ctx");
  184. },
  185. //>>excludeStart("ide", pragmas.excludeIdeData);
  186. args: ["aKey", "aValue"],
  187. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  188. referencedClasses: [],
  189. //>>excludeEnd("ide");
  190. messageSends: ["key:", "new", "value:", "yourself"]
  191. }),
  192. $globals.Association.klass);
  193. $core.addClass('BucketStore', $globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  194. //>>excludeStart("ide", pragmas.excludeIdeData);
  195. $globals.BucketStore.comment="I am an helper class for hash-based stores.\x0a\x0aI hold buckets which are selected by a hash, specified using `#hashBlock:`.\x0aThe hash can be any object, and\x0ait is used as a JS property (that is, in ES5\x0aits toString() value counts).\x0a\x0a## API\x0aI maintain a list of buckets. Client code can use this API:\x0a - `#bucketOfElement:` (to ask a bucket for element, I can return JS null if n/a)\x0a - `#do:` (to enumerate all elements of all buckets)\x0a - `#removeAll` (to remove all buckets)\x0a\x0aClient code itself should add/remove elements\x0ain a bucket. The `nil` object should not be put into any bucket.\x0a\x0aTypes of buckets are the responsibility of subclasses via `#newBucket`.";
  196. //>>excludeEnd("ide");
  197. $core.addMethod(
  198. $core.method({
  199. selector: "bucketOfElement:",
  200. protocol: 'accessing',
  201. fn: function (anObject){
  202. var self=this;
  203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  204. return $core.withContext(function($ctx1) {
  205. //>>excludeEnd("ctx");
  206. var hash = self['@hashBlock'](anObject);
  207. if (!hash) return null;
  208. var buckets = self['@buckets'],
  209. bucket = buckets[hash];
  210. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  211. return bucket;
  212. ;
  213. return self;
  214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  215. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  216. //>>excludeEnd("ctx");
  217. },
  218. //>>excludeStart("ide", pragmas.excludeIdeData);
  219. args: ["anObject"],
  220. source: "bucketOfElement: anObject\x0a\x09<\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>",
  221. referencedClasses: [],
  222. //>>excludeEnd("ide");
  223. messageSends: []
  224. }),
  225. $globals.BucketStore);
  226. $core.addMethod(
  227. $core.method({
  228. selector: "do:",
  229. protocol: 'enumerating',
  230. fn: function (aBlock){
  231. var self=this;
  232. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  233. return $core.withContext(function($ctx1) {
  234. //>>excludeEnd("ctx");
  235. var buckets = self['@buckets'];
  236. var keys = Object.keys(buckets);
  237. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  238. ;
  239. return self;
  240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  241. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  242. //>>excludeEnd("ctx");
  243. },
  244. //>>excludeStart("ide", pragmas.excludeIdeData);
  245. args: ["aBlock"],
  246. source: "do: aBlock\x0a\x09<\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>",
  247. referencedClasses: [],
  248. //>>excludeEnd("ide");
  249. messageSends: []
  250. }),
  251. $globals.BucketStore);
  252. $core.addMethod(
  253. $core.method({
  254. selector: "hashBlock:",
  255. protocol: 'accessing',
  256. fn: function (aBlock){
  257. var self=this;
  258. self["@hashBlock"]=aBlock;
  259. return self;
  260. },
  261. //>>excludeStart("ide", pragmas.excludeIdeData);
  262. args: ["aBlock"],
  263. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  264. referencedClasses: [],
  265. //>>excludeEnd("ide");
  266. messageSends: []
  267. }),
  268. $globals.BucketStore);
  269. $core.addMethod(
  270. $core.method({
  271. selector: "initialize",
  272. protocol: 'initialization',
  273. fn: function (){
  274. var self=this;
  275. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  276. return $core.withContext(function($ctx1) {
  277. //>>excludeEnd("ctx");
  278. (
  279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  280. $ctx1.supercall = true,
  281. //>>excludeEnd("ctx");
  282. ($globals.BucketStore.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  284. $ctx1.supercall = false;
  285. //>>excludeEnd("ctx");;
  286. self._removeAll();
  287. return self;
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  290. //>>excludeEnd("ctx");
  291. },
  292. //>>excludeStart("ide", pragmas.excludeIdeData);
  293. args: [],
  294. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  295. referencedClasses: [],
  296. //>>excludeEnd("ide");
  297. messageSends: ["initialize", "removeAll"]
  298. }),
  299. $globals.BucketStore);
  300. $core.addMethod(
  301. $core.method({
  302. selector: "newBucket",
  303. protocol: 'private',
  304. fn: function (){
  305. var self=this;
  306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  307. return $core.withContext(function($ctx1) {
  308. //>>excludeEnd("ctx");
  309. self._subclassResponsibility();
  310. return self;
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  313. //>>excludeEnd("ctx");
  314. },
  315. //>>excludeStart("ide", pragmas.excludeIdeData);
  316. args: [],
  317. source: "newBucket\x0a\x09self subclassResponsibility",
  318. referencedClasses: [],
  319. //>>excludeEnd("ide");
  320. messageSends: ["subclassResponsibility"]
  321. }),
  322. $globals.BucketStore);
  323. $core.addMethod(
  324. $core.method({
  325. selector: "removeAll",
  326. protocol: 'adding/removing',
  327. fn: function (){
  328. var self=this;
  329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  330. return $core.withContext(function($ctx1) {
  331. //>>excludeEnd("ctx");
  332. self['@buckets'] = Object.create(null);;
  333. return self;
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  336. //>>excludeEnd("ctx");
  337. },
  338. //>>excludeStart("ide", pragmas.excludeIdeData);
  339. args: [],
  340. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  341. referencedClasses: [],
  342. //>>excludeEnd("ide");
  343. messageSends: []
  344. }),
  345. $globals.BucketStore);
  346. $core.addMethod(
  347. $core.method({
  348. selector: "hashBlock:",
  349. protocol: 'instance creation',
  350. fn: function (aBlock){
  351. var self=this;
  352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  353. return $core.withContext(function($ctx1) {
  354. //>>excludeEnd("ctx");
  355. var $1;
  356. $1=self._new();
  357. $recv($1)._hashBlock_(aBlock);
  358. return $recv($1)._yourself();
  359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  360. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.klass)});
  361. //>>excludeEnd("ctx");
  362. },
  363. //>>excludeStart("ide", pragmas.excludeIdeData);
  364. args: ["aBlock"],
  365. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  366. referencedClasses: [],
  367. //>>excludeEnd("ide");
  368. messageSends: ["hashBlock:", "new", "yourself"]
  369. }),
  370. $globals.BucketStore.klass);
  371. $core.addClass('ArrayBucketStore', $globals.BucketStore, [], 'Kernel-Collections');
  372. //>>excludeStart("ide", pragmas.excludeIdeData);
  373. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  374. //>>excludeEnd("ide");
  375. $core.addMethod(
  376. $core.method({
  377. selector: "newBucket",
  378. protocol: 'private',
  379. fn: function (){
  380. var self=this;
  381. return [];
  382. },
  383. //>>excludeStart("ide", pragmas.excludeIdeData);
  384. args: [],
  385. source: "newBucket\x0a\x09^ #()",
  386. referencedClasses: [],
  387. //>>excludeEnd("ide");
  388. messageSends: []
  389. }),
  390. $globals.ArrayBucketStore);
  391. $core.addClass('Collection', $globals.Object, [], 'Kernel-Collections');
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. $globals.Collection.comment="I am the abstract superclass of all classes that represent a group of elements.\x0a\x0aI provide a set of useful methods to the Collection hierarchy such as enumerating and converting methods.";
  394. //>>excludeEnd("ide");
  395. $core.addMethod(
  396. $core.method({
  397. selector: ",",
  398. protocol: 'copying',
  399. fn: function (aCollection){
  400. var self=this;
  401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  402. return $core.withContext(function($ctx1) {
  403. //>>excludeEnd("ctx");
  404. var $1;
  405. $1=self._copy();
  406. $recv($1)._addAll_(aCollection);
  407. return $recv($1)._yourself();
  408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  409. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  410. //>>excludeEnd("ctx");
  411. },
  412. //>>excludeStart("ide", pragmas.excludeIdeData);
  413. args: ["aCollection"],
  414. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  415. referencedClasses: [],
  416. //>>excludeEnd("ide");
  417. messageSends: ["addAll:", "copy", "yourself"]
  418. }),
  419. $globals.Collection);
  420. $core.addMethod(
  421. $core.method({
  422. selector: "add:",
  423. protocol: 'adding/removing',
  424. fn: function (anObject){
  425. var self=this;
  426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  427. return $core.withContext(function($ctx1) {
  428. //>>excludeEnd("ctx");
  429. self._subclassResponsibility();
  430. return self;
  431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  432. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  433. //>>excludeEnd("ctx");
  434. },
  435. //>>excludeStart("ide", pragmas.excludeIdeData);
  436. args: ["anObject"],
  437. source: "add: anObject\x0a\x09self subclassResponsibility",
  438. referencedClasses: [],
  439. //>>excludeEnd("ide");
  440. messageSends: ["subclassResponsibility"]
  441. }),
  442. $globals.Collection);
  443. $core.addMethod(
  444. $core.method({
  445. selector: "addAll:",
  446. protocol: 'adding/removing',
  447. fn: function (aCollection){
  448. var self=this;
  449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  450. return $core.withContext(function($ctx1) {
  451. //>>excludeEnd("ctx");
  452. $recv(aCollection)._do_((function(each){
  453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  454. return $core.withContext(function($ctx2) {
  455. //>>excludeEnd("ctx");
  456. return self._add_(each);
  457. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  459. //>>excludeEnd("ctx");
  460. }));
  461. return aCollection;
  462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  463. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  464. //>>excludeEnd("ctx");
  465. },
  466. //>>excludeStart("ide", pragmas.excludeIdeData);
  467. args: ["aCollection"],
  468. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  469. referencedClasses: [],
  470. //>>excludeEnd("ide");
  471. messageSends: ["do:", "add:"]
  472. }),
  473. $globals.Collection);
  474. $core.addMethod(
  475. $core.method({
  476. selector: "allSatisfy:",
  477. protocol: 'enumerating',
  478. fn: function (aBlock){
  479. var self=this;
  480. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  481. return $core.withContext(function($ctx1) {
  482. //>>excludeEnd("ctx");
  483. var $1;
  484. var $early={};
  485. try {
  486. self._do_((function(each){
  487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  488. return $core.withContext(function($ctx2) {
  489. //>>excludeEnd("ctx");
  490. $1=$recv(aBlock)._value_(each);
  491. if(!$core.assert($1)){
  492. throw $early=[false];
  493. };
  494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  496. //>>excludeEnd("ctx");
  497. }));
  498. return true;
  499. }
  500. catch(e) {if(e===$early)return e[0]; throw e}
  501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  502. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  503. //>>excludeEnd("ctx");
  504. },
  505. //>>excludeStart("ide", pragmas.excludeIdeData);
  506. args: ["aBlock"],
  507. 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",
  508. referencedClasses: [],
  509. //>>excludeEnd("ide");
  510. messageSends: ["do:", "ifFalse:", "value:"]
  511. }),
  512. $globals.Collection);
  513. $core.addMethod(
  514. $core.method({
  515. selector: "anyOne",
  516. protocol: 'adding/removing',
  517. fn: function (){
  518. var self=this;
  519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  520. return $core.withContext(function($ctx1) {
  521. //>>excludeEnd("ctx");
  522. var $early={};
  523. try {
  524. self._ifEmpty_((function(){
  525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  526. return $core.withContext(function($ctx2) {
  527. //>>excludeEnd("ctx");
  528. return self._error_("Collection is empty");
  529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  530. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  531. //>>excludeEnd("ctx");
  532. }));
  533. self._do_((function(each){
  534. throw $early=[each];
  535. }));
  536. return self;
  537. }
  538. catch(e) {if(e===$early)return e[0]; throw e}
  539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  540. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  541. //>>excludeEnd("ctx");
  542. },
  543. //>>excludeStart("ide", pragmas.excludeIdeData);
  544. args: [],
  545. 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 ]",
  546. referencedClasses: [],
  547. //>>excludeEnd("ide");
  548. messageSends: ["ifEmpty:", "error:", "do:"]
  549. }),
  550. $globals.Collection);
  551. $core.addMethod(
  552. $core.method({
  553. selector: "anySatisfy:",
  554. protocol: 'enumerating',
  555. fn: function (aBlock){
  556. var self=this;
  557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  558. return $core.withContext(function($ctx1) {
  559. //>>excludeEnd("ctx");
  560. var $1;
  561. var $early={};
  562. try {
  563. self._do_((function(each){
  564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  565. return $core.withContext(function($ctx2) {
  566. //>>excludeEnd("ctx");
  567. $1=$recv(aBlock)._value_(each);
  568. if($core.assert($1)){
  569. throw $early=[true];
  570. };
  571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  572. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  573. //>>excludeEnd("ctx");
  574. }));
  575. return false;
  576. }
  577. catch(e) {if(e===$early)return e[0]; throw e}
  578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  579. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  580. //>>excludeEnd("ctx");
  581. },
  582. //>>excludeStart("ide", pragmas.excludeIdeData);
  583. args: ["aBlock"],
  584. 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",
  585. referencedClasses: [],
  586. //>>excludeEnd("ide");
  587. messageSends: ["do:", "ifTrue:", "value:"]
  588. }),
  589. $globals.Collection);
  590. $core.addMethod(
  591. $core.method({
  592. selector: "asArray",
  593. protocol: 'converting',
  594. fn: function (){
  595. var self=this;
  596. function $Array(){return $globals.Array||(typeof Array=="undefined"?nil:Array)}
  597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  598. return $core.withContext(function($ctx1) {
  599. //>>excludeEnd("ctx");
  600. return $recv($Array())._withAll_(self);
  601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  602. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  603. //>>excludeEnd("ctx");
  604. },
  605. //>>excludeStart("ide", pragmas.excludeIdeData);
  606. args: [],
  607. source: "asArray\x0a\x09^ Array withAll: self",
  608. referencedClasses: ["Array"],
  609. //>>excludeEnd("ide");
  610. messageSends: ["withAll:"]
  611. }),
  612. $globals.Collection);
  613. $core.addMethod(
  614. $core.method({
  615. selector: "asJSON",
  616. protocol: 'converting',
  617. fn: function (){
  618. var self=this;
  619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  620. return $core.withContext(function($ctx1) {
  621. //>>excludeEnd("ctx");
  622. return $recv(self._asArray())._collect_((function(each){
  623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  624. return $core.withContext(function($ctx2) {
  625. //>>excludeEnd("ctx");
  626. return $recv(each)._asJSON();
  627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  629. //>>excludeEnd("ctx");
  630. }));
  631. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  632. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},$globals.Collection)});
  633. //>>excludeEnd("ctx");
  634. },
  635. //>>excludeStart("ide", pragmas.excludeIdeData);
  636. args: [],
  637. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  638. referencedClasses: [],
  639. //>>excludeEnd("ide");
  640. messageSends: ["collect:", "asArray", "asJSON"]
  641. }),
  642. $globals.Collection);
  643. $core.addMethod(
  644. $core.method({
  645. selector: "asOrderedCollection",
  646. protocol: 'converting',
  647. fn: function (){
  648. var self=this;
  649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  650. return $core.withContext(function($ctx1) {
  651. //>>excludeEnd("ctx");
  652. return self._asArray();
  653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  654. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  655. //>>excludeEnd("ctx");
  656. },
  657. //>>excludeStart("ide", pragmas.excludeIdeData);
  658. args: [],
  659. source: "asOrderedCollection\x0a\x09^ self asArray",
  660. referencedClasses: [],
  661. //>>excludeEnd("ide");
  662. messageSends: ["asArray"]
  663. }),
  664. $globals.Collection);
  665. $core.addMethod(
  666. $core.method({
  667. selector: "asSet",
  668. protocol: 'converting',
  669. fn: function (){
  670. var self=this;
  671. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  673. return $core.withContext(function($ctx1) {
  674. //>>excludeEnd("ctx");
  675. return $recv($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. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  979. return self;
  980. }));
  981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  982. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  983. //>>excludeEnd("ctx");
  984. },
  985. //>>excludeStart("ide", pragmas.excludeIdeData);
  986. args: ["aBlock"],
  987. 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: aBlock\x0a\x09\x09ifFalse: [ self ]",
  988. referencedClasses: [],
  989. //>>excludeEnd("ide");
  990. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  991. }),
  992. $globals.Collection);
  993. $core.addMethod(
  994. $core.method({
  995. selector: "ifEmpty:ifNotEmpty:",
  996. protocol: 'testing',
  997. fn: function (aBlock,anotherBlock){
  998. var self=this;
  999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1000. return $core.withContext(function($ctx1) {
  1001. //>>excludeEnd("ctx");
  1002. var $1;
  1003. $1=self._isEmpty();
  1004. return $recv($1)._ifTrue_ifFalse_(aBlock,(function(){
  1005. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1006. return $core.withContext(function($ctx2) {
  1007. //>>excludeEnd("ctx");
  1008. return $recv(anotherBlock)._value_(self);
  1009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1011. //>>excludeEnd("ctx");
  1012. }));
  1013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1014. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1015. //>>excludeEnd("ctx");
  1016. },
  1017. //>>excludeStart("ide", pragmas.excludeIdeData);
  1018. args: ["aBlock", "anotherBlock"],
  1019. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1020. referencedClasses: [],
  1021. //>>excludeEnd("ide");
  1022. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  1023. }),
  1024. $globals.Collection);
  1025. $core.addMethod(
  1026. $core.method({
  1027. selector: "ifNotEmpty:",
  1028. protocol: 'testing',
  1029. fn: function (aBlock){
  1030. var self=this;
  1031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1032. return $core.withContext(function($ctx1) {
  1033. //>>excludeEnd("ctx");
  1034. var $1;
  1035. $1=self._notEmpty();
  1036. if($core.assert($1)){
  1037. return $recv(aBlock)._value_(self);
  1038. } else {
  1039. return self;
  1040. };
  1041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1042. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  1043. //>>excludeEnd("ctx");
  1044. },
  1045. //>>excludeStart("ide", pragmas.excludeIdeData);
  1046. args: ["aBlock"],
  1047. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1048. referencedClasses: [],
  1049. //>>excludeEnd("ide");
  1050. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1051. }),
  1052. $globals.Collection);
  1053. $core.addMethod(
  1054. $core.method({
  1055. selector: "ifNotEmpty:ifEmpty:",
  1056. protocol: 'testing',
  1057. fn: function (aBlock,anotherBlock){
  1058. var self=this;
  1059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1060. return $core.withContext(function($ctx1) {
  1061. //>>excludeEnd("ctx");
  1062. var $1;
  1063. $1=self._notEmpty();
  1064. return $recv($1)._ifTrue_ifFalse_((function(){
  1065. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1066. return $core.withContext(function($ctx2) {
  1067. //>>excludeEnd("ctx");
  1068. return $recv(aBlock)._value_(self);
  1069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1071. //>>excludeEnd("ctx");
  1072. }),anotherBlock);
  1073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1074. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  1075. //>>excludeEnd("ctx");
  1076. },
  1077. //>>excludeStart("ide", pragmas.excludeIdeData);
  1078. args: ["aBlock", "anotherBlock"],
  1079. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  1080. referencedClasses: [],
  1081. //>>excludeEnd("ide");
  1082. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1083. }),
  1084. $globals.Collection);
  1085. $core.addMethod(
  1086. $core.method({
  1087. selector: "includes:",
  1088. protocol: 'testing',
  1089. fn: function (anObject){
  1090. var self=this;
  1091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1092. return $core.withContext(function($ctx1) {
  1093. //>>excludeEnd("ctx");
  1094. return self._anySatisfy_((function(each){
  1095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1096. return $core.withContext(function($ctx2) {
  1097. //>>excludeEnd("ctx");
  1098. return $recv(each).__eq(anObject);
  1099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1100. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1101. //>>excludeEnd("ctx");
  1102. }));
  1103. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1104. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  1105. //>>excludeEnd("ctx");
  1106. },
  1107. //>>excludeStart("ide", pragmas.excludeIdeData);
  1108. args: ["anObject"],
  1109. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1110. referencedClasses: [],
  1111. //>>excludeEnd("ide");
  1112. messageSends: ["anySatisfy:", "="]
  1113. }),
  1114. $globals.Collection);
  1115. $core.addMethod(
  1116. $core.method({
  1117. selector: "inject:into:",
  1118. protocol: 'enumerating',
  1119. fn: function (anObject,aBlock){
  1120. var self=this;
  1121. var result;
  1122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1123. return $core.withContext(function($ctx1) {
  1124. //>>excludeEnd("ctx");
  1125. result=anObject;
  1126. self._do_((function(each){
  1127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1128. return $core.withContext(function($ctx2) {
  1129. //>>excludeEnd("ctx");
  1130. result=$recv(aBlock)._value_value_(result,each);
  1131. return result;
  1132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1133. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1134. //>>excludeEnd("ctx");
  1135. }));
  1136. return result;
  1137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1138. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  1139. //>>excludeEnd("ctx");
  1140. },
  1141. //>>excludeStart("ide", pragmas.excludeIdeData);
  1142. args: ["anObject", "aBlock"],
  1143. 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",
  1144. referencedClasses: [],
  1145. //>>excludeEnd("ide");
  1146. messageSends: ["do:", "value:value:"]
  1147. }),
  1148. $globals.Collection);
  1149. $core.addMethod(
  1150. $core.method({
  1151. selector: "intersection:",
  1152. protocol: 'enumerating',
  1153. fn: function (aCollection){
  1154. var self=this;
  1155. var set,outputSet;
  1156. function $Set(){return $globals.Set||(typeof Set=="undefined"?nil:Set)}
  1157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1158. return $core.withContext(function($ctx1) {
  1159. //>>excludeEnd("ctx");
  1160. var $2,$1;
  1161. set=self._asSet();
  1162. outputSet=$recv($Set())._new();
  1163. $recv(aCollection)._do_((function(each){
  1164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1165. return $core.withContext(function($ctx2) {
  1166. //>>excludeEnd("ctx");
  1167. $2=$recv(set)._includes_(each);
  1168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1169. $ctx2.sendIdx["includes:"]=1;
  1170. //>>excludeEnd("ctx");
  1171. $1=$recv($2)._and_((function(){
  1172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1173. return $core.withContext(function($ctx3) {
  1174. //>>excludeEnd("ctx");
  1175. return $recv($recv(outputSet)._includes_(each))._not();
  1176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1177. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1178. //>>excludeEnd("ctx");
  1179. }));
  1180. if($core.assert($1)){
  1181. return $recv(outputSet)._add_(each);
  1182. };
  1183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1184. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1185. //>>excludeEnd("ctx");
  1186. }));
  1187. return $recv(self._class())._withAll_($recv(outputSet)._asArray());
  1188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1189. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  1190. //>>excludeEnd("ctx");
  1191. },
  1192. //>>excludeStart("ide", pragmas.excludeIdeData);
  1193. args: ["aCollection"],
  1194. 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",
  1195. referencedClasses: ["Set"],
  1196. //>>excludeEnd("ide");
  1197. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1198. }),
  1199. $globals.Collection);
  1200. $core.addMethod(
  1201. $core.method({
  1202. selector: "isEmpty",
  1203. protocol: 'testing',
  1204. fn: function (){
  1205. var self=this;
  1206. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1207. return $core.withContext(function($ctx1) {
  1208. //>>excludeEnd("ctx");
  1209. return $recv(self._size()).__eq((0));
  1210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1211. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  1212. //>>excludeEnd("ctx");
  1213. },
  1214. //>>excludeStart("ide", pragmas.excludeIdeData);
  1215. args: [],
  1216. source: "isEmpty\x0a\x09^ self size = 0",
  1217. referencedClasses: [],
  1218. //>>excludeEnd("ide");
  1219. messageSends: ["=", "size"]
  1220. }),
  1221. $globals.Collection);
  1222. $core.addMethod(
  1223. $core.method({
  1224. selector: "noneSatisfy:",
  1225. protocol: 'enumerating',
  1226. fn: function (aBlock){
  1227. var self=this;
  1228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1229. return $core.withContext(function($ctx1) {
  1230. //>>excludeEnd("ctx");
  1231. var $1;
  1232. var $early={};
  1233. try {
  1234. self._do_((function(item){
  1235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1236. return $core.withContext(function($ctx2) {
  1237. //>>excludeEnd("ctx");
  1238. $1=$recv(aBlock)._value_(item);
  1239. if($core.assert($1)){
  1240. throw $early=[false];
  1241. };
  1242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1243. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1244. //>>excludeEnd("ctx");
  1245. }));
  1246. return true;
  1247. }
  1248. catch(e) {if(e===$early)return e[0]; throw e}
  1249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1250. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  1251. //>>excludeEnd("ctx");
  1252. },
  1253. //>>excludeStart("ide", pragmas.excludeIdeData);
  1254. args: ["aBlock"],
  1255. 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",
  1256. referencedClasses: [],
  1257. //>>excludeEnd("ide");
  1258. messageSends: ["do:", "ifTrue:", "value:"]
  1259. }),
  1260. $globals.Collection);
  1261. $core.addMethod(
  1262. $core.method({
  1263. selector: "notEmpty",
  1264. protocol: 'testing',
  1265. fn: function (){
  1266. var self=this;
  1267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1268. return $core.withContext(function($ctx1) {
  1269. //>>excludeEnd("ctx");
  1270. return $recv(self._isEmpty())._not();
  1271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1272. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  1273. //>>excludeEnd("ctx");
  1274. },
  1275. //>>excludeStart("ide", pragmas.excludeIdeData);
  1276. args: [],
  1277. source: "notEmpty\x0a\x09^ self isEmpty not",
  1278. referencedClasses: [],
  1279. //>>excludeEnd("ide");
  1280. messageSends: ["not", "isEmpty"]
  1281. }),
  1282. $globals.Collection);
  1283. $core.addMethod(
  1284. $core.method({
  1285. selector: "occurrencesOf:",
  1286. protocol: 'accessing',
  1287. fn: function (anObject){
  1288. var self=this;
  1289. var tally;
  1290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1291. return $core.withContext(function($ctx1) {
  1292. //>>excludeEnd("ctx");
  1293. var $1;
  1294. tally=(0);
  1295. self._do_((function(each){
  1296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1297. return $core.withContext(function($ctx2) {
  1298. //>>excludeEnd("ctx");
  1299. $1=$recv(anObject).__eq(each);
  1300. if($core.assert($1)){
  1301. tally=$recv(tally).__plus((1));
  1302. return tally;
  1303. };
  1304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1306. //>>excludeEnd("ctx");
  1307. }));
  1308. return tally;
  1309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1310. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  1311. //>>excludeEnd("ctx");
  1312. },
  1313. //>>excludeStart("ide", pragmas.excludeIdeData);
  1314. args: ["anObject"],
  1315. 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",
  1316. referencedClasses: [],
  1317. //>>excludeEnd("ide");
  1318. messageSends: ["do:", "ifTrue:", "=", "+"]
  1319. }),
  1320. $globals.Collection);
  1321. $core.addMethod(
  1322. $core.method({
  1323. selector: "putOn:",
  1324. protocol: 'streaming',
  1325. fn: function (aStream){
  1326. var self=this;
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. return $core.withContext(function($ctx1) {
  1329. //>>excludeEnd("ctx");
  1330. self._do_((function(each){
  1331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1332. return $core.withContext(function($ctx2) {
  1333. //>>excludeEnd("ctx");
  1334. return $recv(each)._putOn_(aStream);
  1335. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1336. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1337. //>>excludeEnd("ctx");
  1338. }));
  1339. return self;
  1340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1341. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  1342. //>>excludeEnd("ctx");
  1343. },
  1344. //>>excludeStart("ide", pragmas.excludeIdeData);
  1345. args: ["aStream"],
  1346. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1347. referencedClasses: [],
  1348. //>>excludeEnd("ide");
  1349. messageSends: ["do:", "putOn:"]
  1350. }),
  1351. $globals.Collection);
  1352. $core.addMethod(
  1353. $core.method({
  1354. selector: "reject:",
  1355. protocol: 'enumerating',
  1356. fn: function (aBlock){
  1357. var self=this;
  1358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1359. return $core.withContext(function($ctx1) {
  1360. //>>excludeEnd("ctx");
  1361. return self._select_((function(each){
  1362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1363. return $core.withContext(function($ctx2) {
  1364. //>>excludeEnd("ctx");
  1365. return $recv($recv(aBlock)._value_(each)).__eq(false);
  1366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1368. //>>excludeEnd("ctx");
  1369. }));
  1370. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1371. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  1372. //>>excludeEnd("ctx");
  1373. },
  1374. //>>excludeStart("ide", pragmas.excludeIdeData);
  1375. args: ["aBlock"],
  1376. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1377. referencedClasses: [],
  1378. //>>excludeEnd("ide");
  1379. messageSends: ["select:", "=", "value:"]
  1380. }),
  1381. $globals.Collection);
  1382. $core.addMethod(
  1383. $core.method({
  1384. selector: "remove:",
  1385. protocol: 'adding/removing',
  1386. fn: function (anObject){
  1387. var self=this;
  1388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1389. return $core.withContext(function($ctx1) {
  1390. //>>excludeEnd("ctx");
  1391. return self._remove_ifAbsent_(anObject,(function(){
  1392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1393. return $core.withContext(function($ctx2) {
  1394. //>>excludeEnd("ctx");
  1395. return self._errorNotFound();
  1396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1398. //>>excludeEnd("ctx");
  1399. }));
  1400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1401. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  1402. //>>excludeEnd("ctx");
  1403. },
  1404. //>>excludeStart("ide", pragmas.excludeIdeData);
  1405. args: ["anObject"],
  1406. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1407. referencedClasses: [],
  1408. //>>excludeEnd("ide");
  1409. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1410. }),
  1411. $globals.Collection);
  1412. $core.addMethod(
  1413. $core.method({
  1414. selector: "remove:ifAbsent:",
  1415. protocol: 'adding/removing',
  1416. fn: function (anObject,aBlock){
  1417. var self=this;
  1418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1419. return $core.withContext(function($ctx1) {
  1420. //>>excludeEnd("ctx");
  1421. self._subclassResponsibility();
  1422. return self;
  1423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1424. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  1425. //>>excludeEnd("ctx");
  1426. },
  1427. //>>excludeStart("ide", pragmas.excludeIdeData);
  1428. args: ["anObject", "aBlock"],
  1429. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1430. referencedClasses: [],
  1431. //>>excludeEnd("ide");
  1432. messageSends: ["subclassResponsibility"]
  1433. }),
  1434. $globals.Collection);
  1435. $core.addMethod(
  1436. $core.method({
  1437. selector: "removeAll",
  1438. protocol: 'adding/removing',
  1439. fn: function (){
  1440. var self=this;
  1441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1442. return $core.withContext(function($ctx1) {
  1443. //>>excludeEnd("ctx");
  1444. self._subclassResponsibility();
  1445. return self;
  1446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1447. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  1448. //>>excludeEnd("ctx");
  1449. },
  1450. //>>excludeStart("ide", pragmas.excludeIdeData);
  1451. args: [],
  1452. source: "removeAll\x0a\x09self subclassResponsibility",
  1453. referencedClasses: [],
  1454. //>>excludeEnd("ide");
  1455. messageSends: ["subclassResponsibility"]
  1456. }),
  1457. $globals.Collection);
  1458. $core.addMethod(
  1459. $core.method({
  1460. selector: "select:",
  1461. protocol: 'enumerating',
  1462. fn: function (aBlock){
  1463. var self=this;
  1464. var stream;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. return $core.withContext(function($ctx1) {
  1467. //>>excludeEnd("ctx");
  1468. var $1;
  1469. stream=$recv($recv(self._class())._new())._writeStream();
  1470. self._do_((function(each){
  1471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1472. return $core.withContext(function($ctx2) {
  1473. //>>excludeEnd("ctx");
  1474. $1=$recv(aBlock)._value_(each);
  1475. if($core.assert($1)){
  1476. return $recv(stream)._nextPut_(each);
  1477. };
  1478. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1479. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1480. //>>excludeEnd("ctx");
  1481. }));
  1482. return $recv(stream)._contents();
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  1485. //>>excludeEnd("ctx");
  1486. },
  1487. //>>excludeStart("ide", pragmas.excludeIdeData);
  1488. args: ["aBlock"],
  1489. 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",
  1490. referencedClasses: [],
  1491. //>>excludeEnd("ide");
  1492. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1493. }),
  1494. $globals.Collection);
  1495. $core.addMethod(
  1496. $core.method({
  1497. selector: "select:thenCollect:",
  1498. protocol: 'enumerating',
  1499. fn: function (selectBlock,collectBlock){
  1500. var self=this;
  1501. var stream;
  1502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1503. return $core.withContext(function($ctx1) {
  1504. //>>excludeEnd("ctx");
  1505. var $1;
  1506. stream=$recv($recv(self._class())._new())._writeStream();
  1507. self._do_((function(each){
  1508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1509. return $core.withContext(function($ctx2) {
  1510. //>>excludeEnd("ctx");
  1511. $1=$recv(selectBlock)._value_(each);
  1512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1513. $ctx2.sendIdx["value:"]=1;
  1514. //>>excludeEnd("ctx");
  1515. if($core.assert($1)){
  1516. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  1517. };
  1518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1520. //>>excludeEnd("ctx");
  1521. }));
  1522. return $recv(stream)._contents();
  1523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1524. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  1525. //>>excludeEnd("ctx");
  1526. },
  1527. //>>excludeStart("ide", pragmas.excludeIdeData);
  1528. args: ["selectBlock", "collectBlock"],
  1529. 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",
  1530. referencedClasses: [],
  1531. //>>excludeEnd("ide");
  1532. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1533. }),
  1534. $globals.Collection);
  1535. $core.addMethod(
  1536. $core.method({
  1537. selector: "shallowCopy",
  1538. protocol: 'copying',
  1539. fn: function (){
  1540. var self=this;
  1541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1542. return $core.withContext(function($ctx1) {
  1543. //>>excludeEnd("ctx");
  1544. return self._collect_((function(each){
  1545. return each;
  1546. }));
  1547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1548. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  1549. //>>excludeEnd("ctx");
  1550. },
  1551. //>>excludeStart("ide", pragmas.excludeIdeData);
  1552. args: [],
  1553. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  1554. referencedClasses: [],
  1555. //>>excludeEnd("ide");
  1556. messageSends: ["collect:"]
  1557. }),
  1558. $globals.Collection);
  1559. $core.addMethod(
  1560. $core.method({
  1561. selector: "size",
  1562. protocol: 'accessing',
  1563. fn: function (){
  1564. var self=this;
  1565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1566. return $core.withContext(function($ctx1) {
  1567. //>>excludeEnd("ctx");
  1568. self._subclassResponsibility();
  1569. return self;
  1570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1571. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  1572. //>>excludeEnd("ctx");
  1573. },
  1574. //>>excludeStart("ide", pragmas.excludeIdeData);
  1575. args: [],
  1576. source: "size\x0a\x09self subclassResponsibility",
  1577. referencedClasses: [],
  1578. //>>excludeEnd("ide");
  1579. messageSends: ["subclassResponsibility"]
  1580. }),
  1581. $globals.Collection);
  1582. $core.addMethod(
  1583. $core.method({
  1584. selector: "classTag",
  1585. protocol: 'accessing',
  1586. fn: function (){
  1587. var self=this;
  1588. return "collection";
  1589. },
  1590. //>>excludeStart("ide", pragmas.excludeIdeData);
  1591. args: [],
  1592. 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'",
  1593. referencedClasses: [],
  1594. //>>excludeEnd("ide");
  1595. messageSends: []
  1596. }),
  1597. $globals.Collection.klass);
  1598. $core.addMethod(
  1599. $core.method({
  1600. selector: "new:",
  1601. protocol: 'instance creation',
  1602. fn: function (anInteger){
  1603. var self=this;
  1604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1605. return $core.withContext(function($ctx1) {
  1606. //>>excludeEnd("ctx");
  1607. return self._new();
  1608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1609. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.klass)});
  1610. //>>excludeEnd("ctx");
  1611. },
  1612. //>>excludeStart("ide", pragmas.excludeIdeData);
  1613. args: ["anInteger"],
  1614. source: "new: anInteger\x0a\x09^ self new",
  1615. referencedClasses: [],
  1616. //>>excludeEnd("ide");
  1617. messageSends: ["new"]
  1618. }),
  1619. $globals.Collection.klass);
  1620. $core.addMethod(
  1621. $core.method({
  1622. selector: "with:",
  1623. protocol: 'instance creation',
  1624. fn: function (anObject){
  1625. var self=this;
  1626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1627. return $core.withContext(function($ctx1) {
  1628. //>>excludeEnd("ctx");
  1629. var $1;
  1630. $1=self._new();
  1631. $recv($1)._add_(anObject);
  1632. return $recv($1)._yourself();
  1633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1634. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.klass)});
  1635. //>>excludeEnd("ctx");
  1636. },
  1637. //>>excludeStart("ide", pragmas.excludeIdeData);
  1638. args: ["anObject"],
  1639. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1640. referencedClasses: [],
  1641. //>>excludeEnd("ide");
  1642. messageSends: ["add:", "new", "yourself"]
  1643. }),
  1644. $globals.Collection.klass);
  1645. $core.addMethod(
  1646. $core.method({
  1647. selector: "with:with:",
  1648. protocol: 'instance creation',
  1649. fn: function (anObject,anotherObject){
  1650. var self=this;
  1651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1652. return $core.withContext(function($ctx1) {
  1653. //>>excludeEnd("ctx");
  1654. var $1;
  1655. $1=self._new();
  1656. $recv($1)._add_(anObject);
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. $ctx1.sendIdx["add:"]=1;
  1659. //>>excludeEnd("ctx");
  1660. $recv($1)._add_(anotherObject);
  1661. return $recv($1)._yourself();
  1662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1663. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.klass)});
  1664. //>>excludeEnd("ctx");
  1665. },
  1666. //>>excludeStart("ide", pragmas.excludeIdeData);
  1667. args: ["anObject", "anotherObject"],
  1668. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1669. referencedClasses: [],
  1670. //>>excludeEnd("ide");
  1671. messageSends: ["add:", "new", "yourself"]
  1672. }),
  1673. $globals.Collection.klass);
  1674. $core.addMethod(
  1675. $core.method({
  1676. selector: "with:with:with:",
  1677. protocol: 'instance creation',
  1678. fn: function (firstObject,secondObject,thirdObject){
  1679. var self=this;
  1680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1681. return $core.withContext(function($ctx1) {
  1682. //>>excludeEnd("ctx");
  1683. var $1;
  1684. $1=self._new();
  1685. $recv($1)._add_(firstObject);
  1686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1687. $ctx1.sendIdx["add:"]=1;
  1688. //>>excludeEnd("ctx");
  1689. $recv($1)._add_(secondObject);
  1690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1691. $ctx1.sendIdx["add:"]=2;
  1692. //>>excludeEnd("ctx");
  1693. $recv($1)._add_(thirdObject);
  1694. return $recv($1)._yourself();
  1695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1696. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.klass)});
  1697. //>>excludeEnd("ctx");
  1698. },
  1699. //>>excludeStart("ide", pragmas.excludeIdeData);
  1700. args: ["firstObject", "secondObject", "thirdObject"],
  1701. 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",
  1702. referencedClasses: [],
  1703. //>>excludeEnd("ide");
  1704. messageSends: ["add:", "new", "yourself"]
  1705. }),
  1706. $globals.Collection.klass);
  1707. $core.addMethod(
  1708. $core.method({
  1709. selector: "withAll:",
  1710. protocol: 'instance creation',
  1711. fn: function (aCollection){
  1712. var self=this;
  1713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1714. return $core.withContext(function($ctx1) {
  1715. //>>excludeEnd("ctx");
  1716. var $1;
  1717. $1=self._new();
  1718. $recv($1)._addAll_(aCollection);
  1719. return $recv($1)._yourself();
  1720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1721. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.klass)});
  1722. //>>excludeEnd("ctx");
  1723. },
  1724. //>>excludeStart("ide", pragmas.excludeIdeData);
  1725. args: ["aCollection"],
  1726. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1727. referencedClasses: [],
  1728. //>>excludeEnd("ide");
  1729. messageSends: ["addAll:", "new", "yourself"]
  1730. }),
  1731. $globals.Collection.klass);
  1732. $core.addClass('IndexableCollection', $globals.Collection, [], 'Kernel-Collections');
  1733. //>>excludeStart("ide", pragmas.excludeIdeData);
  1734. $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.";
  1735. //>>excludeEnd("ide");
  1736. $core.addMethod(
  1737. $core.method({
  1738. selector: "at:",
  1739. protocol: 'accessing',
  1740. fn: function (anIndex){
  1741. var self=this;
  1742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1743. return $core.withContext(function($ctx1) {
  1744. //>>excludeEnd("ctx");
  1745. return self._at_ifAbsent_(anIndex,(function(){
  1746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1747. return $core.withContext(function($ctx2) {
  1748. //>>excludeEnd("ctx");
  1749. return self._errorNotFound();
  1750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1752. //>>excludeEnd("ctx");
  1753. }));
  1754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1755. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  1756. //>>excludeEnd("ctx");
  1757. },
  1758. //>>excludeStart("ide", pragmas.excludeIdeData);
  1759. args: ["anIndex"],
  1760. 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 ]",
  1761. referencedClasses: [],
  1762. //>>excludeEnd("ide");
  1763. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1764. }),
  1765. $globals.IndexableCollection);
  1766. $core.addMethod(
  1767. $core.method({
  1768. selector: "at:ifAbsent:",
  1769. protocol: 'accessing',
  1770. fn: function (anIndex,aBlock){
  1771. var self=this;
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. return $core.withContext(function($ctx1) {
  1774. //>>excludeEnd("ctx");
  1775. self._subclassResponsibility();
  1776. return self;
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1779. //>>excludeEnd("ctx");
  1780. },
  1781. //>>excludeStart("ide", pragmas.excludeIdeData);
  1782. args: ["anIndex", "aBlock"],
  1783. 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",
  1784. referencedClasses: [],
  1785. //>>excludeEnd("ide");
  1786. messageSends: ["subclassResponsibility"]
  1787. }),
  1788. $globals.IndexableCollection);
  1789. $core.addMethod(
  1790. $core.method({
  1791. selector: "at:ifAbsentPut:",
  1792. protocol: 'accessing',
  1793. fn: function (aKey,aBlock){
  1794. var self=this;
  1795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1796. return $core.withContext(function($ctx1) {
  1797. //>>excludeEnd("ctx");
  1798. return self._at_ifAbsent_(aKey,(function(){
  1799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1800. return $core.withContext(function($ctx2) {
  1801. //>>excludeEnd("ctx");
  1802. return self._at_put_(aKey,$recv(aBlock)._value());
  1803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1804. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1805. //>>excludeEnd("ctx");
  1806. }));
  1807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1808. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  1809. //>>excludeEnd("ctx");
  1810. },
  1811. //>>excludeStart("ide", pragmas.excludeIdeData);
  1812. args: ["aKey", "aBlock"],
  1813. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1814. referencedClasses: [],
  1815. //>>excludeEnd("ide");
  1816. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1817. }),
  1818. $globals.IndexableCollection);
  1819. $core.addMethod(
  1820. $core.method({
  1821. selector: "at:ifPresent:",
  1822. protocol: 'accessing',
  1823. fn: function (anIndex,aBlock){
  1824. var self=this;
  1825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1826. return $core.withContext(function($ctx1) {
  1827. //>>excludeEnd("ctx");
  1828. return self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1829. return nil;
  1830. }));
  1831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1832. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  1833. //>>excludeEnd("ctx");
  1834. },
  1835. //>>excludeStart("ide", pragmas.excludeIdeData);
  1836. args: ["anIndex", "aBlock"],
  1837. 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 ]",
  1838. referencedClasses: [],
  1839. //>>excludeEnd("ide");
  1840. messageSends: ["at:ifPresent:ifAbsent:"]
  1841. }),
  1842. $globals.IndexableCollection);
  1843. $core.addMethod(
  1844. $core.method({
  1845. selector: "at:ifPresent:ifAbsent:",
  1846. protocol: 'accessing',
  1847. fn: function (anIndex,aBlock,anotherBlock){
  1848. var self=this;
  1849. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1850. return $core.withContext(function($ctx1) {
  1851. //>>excludeEnd("ctx");
  1852. self._subclassResponsibility();
  1853. return self;
  1854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1855. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  1856. //>>excludeEnd("ctx");
  1857. },
  1858. //>>excludeStart("ide", pragmas.excludeIdeData);
  1859. args: ["anIndex", "aBlock", "anotherBlock"],
  1860. 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",
  1861. referencedClasses: [],
  1862. //>>excludeEnd("ide");
  1863. messageSends: ["subclassResponsibility"]
  1864. }),
  1865. $globals.IndexableCollection);
  1866. $core.addMethod(
  1867. $core.method({
  1868. selector: "at:put:",
  1869. protocol: 'accessing',
  1870. fn: function (anIndex,anObject){
  1871. var self=this;
  1872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1873. return $core.withContext(function($ctx1) {
  1874. //>>excludeEnd("ctx");
  1875. self._subclassResponsibility();
  1876. return self;
  1877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1878. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  1879. //>>excludeEnd("ctx");
  1880. },
  1881. //>>excludeStart("ide", pragmas.excludeIdeData);
  1882. args: ["anIndex", "anObject"],
  1883. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1884. referencedClasses: [],
  1885. //>>excludeEnd("ide");
  1886. messageSends: ["subclassResponsibility"]
  1887. }),
  1888. $globals.IndexableCollection);
  1889. $core.addMethod(
  1890. $core.method({
  1891. selector: "indexOf:",
  1892. protocol: 'accessing',
  1893. fn: function (anObject){
  1894. var self=this;
  1895. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1896. return $core.withContext(function($ctx1) {
  1897. //>>excludeEnd("ctx");
  1898. return self._indexOf_ifAbsent_(anObject,(function(){
  1899. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1900. return $core.withContext(function($ctx2) {
  1901. //>>excludeEnd("ctx");
  1902. return self._errorNotFound();
  1903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1905. //>>excludeEnd("ctx");
  1906. }));
  1907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1908. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  1909. //>>excludeEnd("ctx");
  1910. },
  1911. //>>excludeStart("ide", pragmas.excludeIdeData);
  1912. args: ["anObject"],
  1913. 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 ]",
  1914. referencedClasses: [],
  1915. //>>excludeEnd("ide");
  1916. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1917. }),
  1918. $globals.IndexableCollection);
  1919. $core.addMethod(
  1920. $core.method({
  1921. selector: "indexOf:ifAbsent:",
  1922. protocol: 'accessing',
  1923. fn: function (anObject,aBlock){
  1924. var self=this;
  1925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1926. return $core.withContext(function($ctx1) {
  1927. //>>excludeEnd("ctx");
  1928. self._subclassResponsibility();
  1929. return self;
  1930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1931. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  1932. //>>excludeEnd("ctx");
  1933. },
  1934. //>>excludeStart("ide", pragmas.excludeIdeData);
  1935. args: ["anObject", "aBlock"],
  1936. 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",
  1937. referencedClasses: [],
  1938. //>>excludeEnd("ide");
  1939. messageSends: ["subclassResponsibility"]
  1940. }),
  1941. $globals.IndexableCollection);
  1942. $core.addMethod(
  1943. $core.method({
  1944. selector: "with:do:",
  1945. protocol: 'enumerating',
  1946. fn: function (anotherCollection,aBlock){
  1947. var self=this;
  1948. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1949. return $core.withContext(function($ctx1) {
  1950. //>>excludeEnd("ctx");
  1951. self._withIndexDo_((function(each,index){
  1952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1953. return $core.withContext(function($ctx2) {
  1954. //>>excludeEnd("ctx");
  1955. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  1956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1957. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  1958. //>>excludeEnd("ctx");
  1959. }));
  1960. return self;
  1961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1962. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  1963. //>>excludeEnd("ctx");
  1964. },
  1965. //>>excludeStart("ide", pragmas.excludeIdeData);
  1966. args: ["anotherCollection", "aBlock"],
  1967. 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) ]",
  1968. referencedClasses: [],
  1969. //>>excludeEnd("ide");
  1970. messageSends: ["withIndexDo:", "value:value:", "at:"]
  1971. }),
  1972. $globals.IndexableCollection);
  1973. $core.addMethod(
  1974. $core.method({
  1975. selector: "withIndexDo:",
  1976. protocol: 'enumerating',
  1977. fn: function (aBlock){
  1978. var self=this;
  1979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1980. return $core.withContext(function($ctx1) {
  1981. //>>excludeEnd("ctx");
  1982. self._subclassResponsibility();
  1983. return self;
  1984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1985. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  1986. //>>excludeEnd("ctx");
  1987. },
  1988. //>>excludeStart("ide", pragmas.excludeIdeData);
  1989. args: ["aBlock"],
  1990. 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",
  1991. referencedClasses: [],
  1992. //>>excludeEnd("ide");
  1993. messageSends: ["subclassResponsibility"]
  1994. }),
  1995. $globals.IndexableCollection);
  1996. $core.addClass('AssociativeCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  1997. //>>excludeStart("ide", pragmas.excludeIdeData);
  1998. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  1999. //>>excludeEnd("ide");
  2000. $core.addMethod(
  2001. $core.method({
  2002. selector: "=",
  2003. protocol: 'comparing',
  2004. fn: function (anAssocitativeCollection){
  2005. var self=this;
  2006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2007. return $core.withContext(function($ctx1) {
  2008. //>>excludeEnd("ctx");
  2009. var $2,$1,$4,$3,$5;
  2010. $2=self._class();
  2011. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2012. $ctx1.sendIdx["class"]=1;
  2013. //>>excludeEnd("ctx");
  2014. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  2015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2016. $ctx1.sendIdx["="]=1;
  2017. //>>excludeEnd("ctx");
  2018. if(!$core.assert($1)){
  2019. return false;
  2020. };
  2021. $4=self._size();
  2022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2023. $ctx1.sendIdx["size"]=1;
  2024. //>>excludeEnd("ctx");
  2025. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  2026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2027. $ctx1.sendIdx["="]=2;
  2028. //>>excludeEnd("ctx");
  2029. if(!$core.assert($3)){
  2030. return false;
  2031. };
  2032. $5=self._associations();
  2033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2034. $ctx1.sendIdx["associations"]=1;
  2035. //>>excludeEnd("ctx");
  2036. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  2037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2038. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  2039. //>>excludeEnd("ctx");
  2040. },
  2041. //>>excludeStart("ide", pragmas.excludeIdeData);
  2042. args: ["anAssocitativeCollection"],
  2043. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2044. referencedClasses: [],
  2045. //>>excludeEnd("ide");
  2046. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2047. }),
  2048. $globals.AssociativeCollection);
  2049. $core.addMethod(
  2050. $core.method({
  2051. selector: "add:",
  2052. protocol: 'adding/removing',
  2053. fn: function (anAssociation){
  2054. var self=this;
  2055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2056. return $core.withContext(function($ctx1) {
  2057. //>>excludeEnd("ctx");
  2058. self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  2059. return self;
  2060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2061. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  2062. //>>excludeEnd("ctx");
  2063. },
  2064. //>>excludeStart("ide", pragmas.excludeIdeData);
  2065. args: ["anAssociation"],
  2066. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2067. referencedClasses: [],
  2068. //>>excludeEnd("ide");
  2069. messageSends: ["at:put:", "key", "value"]
  2070. }),
  2071. $globals.AssociativeCollection);
  2072. $core.addMethod(
  2073. $core.method({
  2074. selector: "addAll:",
  2075. protocol: 'adding/removing',
  2076. fn: function (anAssociativeCollection){
  2077. var self=this;
  2078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2079. return $core.withContext(function($ctx1) {
  2080. //>>excludeEnd("ctx");
  2081. (
  2082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2083. $ctx1.supercall = true,
  2084. //>>excludeEnd("ctx");
  2085. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._addAll_.apply($recv(self), [$recv(anAssociativeCollection)._associations()]));
  2086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2087. $ctx1.supercall = false;
  2088. //>>excludeEnd("ctx");;
  2089. return anAssociativeCollection;
  2090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2091. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  2092. //>>excludeEnd("ctx");
  2093. },
  2094. //>>excludeStart("ide", pragmas.excludeIdeData);
  2095. args: ["anAssociativeCollection"],
  2096. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2097. referencedClasses: [],
  2098. //>>excludeEnd("ide");
  2099. messageSends: ["addAll:", "associations"]
  2100. }),
  2101. $globals.AssociativeCollection);
  2102. $core.addMethod(
  2103. $core.method({
  2104. selector: "asDictionary",
  2105. protocol: 'converting',
  2106. fn: function (){
  2107. var self=this;
  2108. function $Dictionary(){return $globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2110. return $core.withContext(function($ctx1) {
  2111. //>>excludeEnd("ctx");
  2112. return $recv($Dictionary())._from_(self._associations());
  2113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2114. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  2115. //>>excludeEnd("ctx");
  2116. },
  2117. //>>excludeStart("ide", pragmas.excludeIdeData);
  2118. args: [],
  2119. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2120. referencedClasses: ["Dictionary"],
  2121. //>>excludeEnd("ide");
  2122. messageSends: ["from:", "associations"]
  2123. }),
  2124. $globals.AssociativeCollection);
  2125. $core.addMethod(
  2126. $core.method({
  2127. selector: "asHashedCollection",
  2128. protocol: 'converting',
  2129. fn: function (){
  2130. var self=this;
  2131. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2133. return $core.withContext(function($ctx1) {
  2134. //>>excludeEnd("ctx");
  2135. return $recv($HashedCollection())._from_(self._associations());
  2136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2137. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  2138. //>>excludeEnd("ctx");
  2139. },
  2140. //>>excludeStart("ide", pragmas.excludeIdeData);
  2141. args: [],
  2142. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2143. referencedClasses: ["HashedCollection"],
  2144. //>>excludeEnd("ide");
  2145. messageSends: ["from:", "associations"]
  2146. }),
  2147. $globals.AssociativeCollection);
  2148. $core.addMethod(
  2149. $core.method({
  2150. selector: "asJSON",
  2151. protocol: 'converting',
  2152. fn: function (){
  2153. var self=this;
  2154. var hash;
  2155. function $HashedCollection(){return $globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2156. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2157. return $core.withContext(function($ctx1) {
  2158. //>>excludeEnd("ctx");
  2159. hash=$recv($HashedCollection())._new();
  2160. self._keysAndValuesDo_((function(key,value){
  2161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2162. return $core.withContext(function($ctx2) {
  2163. //>>excludeEnd("ctx");
  2164. return $recv(hash)._at_put_(key,$recv(value)._asJSON());
  2165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2166. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2167. //>>excludeEnd("ctx");
  2168. }));
  2169. return hash;
  2170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2171. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},$globals.AssociativeCollection)});
  2172. //>>excludeEnd("ctx");
  2173. },
  2174. //>>excludeStart("ide", pragmas.excludeIdeData);
  2175. args: [],
  2176. 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",
  2177. referencedClasses: ["HashedCollection"],
  2178. //>>excludeEnd("ide");
  2179. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  2180. }),
  2181. $globals.AssociativeCollection);
  2182. $core.addMethod(
  2183. $core.method({
  2184. selector: "associations",
  2185. protocol: 'accessing',
  2186. fn: function (){
  2187. var self=this;
  2188. var associations;
  2189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2190. return $core.withContext(function($ctx1) {
  2191. //>>excludeEnd("ctx");
  2192. associations=[];
  2193. self._associationsDo_((function(each){
  2194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2195. return $core.withContext(function($ctx2) {
  2196. //>>excludeEnd("ctx");
  2197. return $recv(associations)._add_(each);
  2198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2200. //>>excludeEnd("ctx");
  2201. }));
  2202. return associations;
  2203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2204. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  2205. //>>excludeEnd("ctx");
  2206. },
  2207. //>>excludeStart("ide", pragmas.excludeIdeData);
  2208. args: [],
  2209. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2210. referencedClasses: [],
  2211. //>>excludeEnd("ide");
  2212. messageSends: ["associationsDo:", "add:"]
  2213. }),
  2214. $globals.AssociativeCollection);
  2215. $core.addMethod(
  2216. $core.method({
  2217. selector: "associationsDo:",
  2218. protocol: 'enumerating',
  2219. fn: function (aBlock){
  2220. var self=this;
  2221. function $Association(){return $globals.Association||(typeof Association=="undefined"?nil:Association)}
  2222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2223. return $core.withContext(function($ctx1) {
  2224. //>>excludeEnd("ctx");
  2225. self._keysAndValuesDo_((function(key,value){
  2226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2227. return $core.withContext(function($ctx2) {
  2228. //>>excludeEnd("ctx");
  2229. return $recv(aBlock)._value_($recv($Association())._key_value_(key,value));
  2230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2231. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2232. //>>excludeEnd("ctx");
  2233. }));
  2234. return self;
  2235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2236. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2237. //>>excludeEnd("ctx");
  2238. },
  2239. //>>excludeStart("ide", pragmas.excludeIdeData);
  2240. args: ["aBlock"],
  2241. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2242. referencedClasses: ["Association"],
  2243. //>>excludeEnd("ide");
  2244. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2245. }),
  2246. $globals.AssociativeCollection);
  2247. $core.addMethod(
  2248. $core.method({
  2249. selector: "at:ifPresent:ifAbsent:",
  2250. protocol: 'accessing',
  2251. fn: function (aKey,aBlock,anotherBlock){
  2252. var self=this;
  2253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2254. return $core.withContext(function($ctx1) {
  2255. //>>excludeEnd("ctx");
  2256. var $1;
  2257. $1=self._includesKey_(aKey);
  2258. if($core.assert($1)){
  2259. return $recv(aBlock)._value_(self._at_(aKey));
  2260. } else {
  2261. return $recv(anotherBlock)._value();
  2262. };
  2263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2264. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2265. //>>excludeEnd("ctx");
  2266. },
  2267. //>>excludeStart("ide", pragmas.excludeIdeData);
  2268. args: ["aKey", "aBlock", "anotherBlock"],
  2269. 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 ]",
  2270. referencedClasses: [],
  2271. //>>excludeEnd("ide");
  2272. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2273. }),
  2274. $globals.AssociativeCollection);
  2275. $core.addMethod(
  2276. $core.method({
  2277. selector: "collect:",
  2278. protocol: 'enumerating',
  2279. fn: function (aBlock){
  2280. var self=this;
  2281. var newDict;
  2282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2283. return $core.withContext(function($ctx1) {
  2284. //>>excludeEnd("ctx");
  2285. newDict=$recv(self._class())._new();
  2286. self._keysAndValuesDo_((function(key,value){
  2287. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2288. return $core.withContext(function($ctx2) {
  2289. //>>excludeEnd("ctx");
  2290. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  2291. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2292. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2293. //>>excludeEnd("ctx");
  2294. }));
  2295. return newDict;
  2296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2297. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2298. //>>excludeEnd("ctx");
  2299. },
  2300. //>>excludeStart("ide", pragmas.excludeIdeData);
  2301. args: ["aBlock"],
  2302. 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",
  2303. referencedClasses: [],
  2304. //>>excludeEnd("ide");
  2305. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2306. }),
  2307. $globals.AssociativeCollection);
  2308. $core.addMethod(
  2309. $core.method({
  2310. selector: "deepCopy",
  2311. protocol: 'copying',
  2312. fn: function (){
  2313. var self=this;
  2314. var copy;
  2315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2316. return $core.withContext(function($ctx1) {
  2317. //>>excludeEnd("ctx");
  2318. copy=$recv(self._class())._new();
  2319. self._keysAndValuesDo_((function(key,value){
  2320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2321. return $core.withContext(function($ctx2) {
  2322. //>>excludeEnd("ctx");
  2323. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  2324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2325. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2326. //>>excludeEnd("ctx");
  2327. }));
  2328. return copy;
  2329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2330. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  2331. //>>excludeEnd("ctx");
  2332. },
  2333. //>>excludeStart("ide", pragmas.excludeIdeData);
  2334. args: [],
  2335. 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",
  2336. referencedClasses: [],
  2337. //>>excludeEnd("ide");
  2338. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2339. }),
  2340. $globals.AssociativeCollection);
  2341. $core.addMethod(
  2342. $core.method({
  2343. selector: "detect:ifNone:",
  2344. protocol: 'enumerating',
  2345. fn: function (aBlock,anotherBlock){
  2346. var self=this;
  2347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2348. return $core.withContext(function($ctx1) {
  2349. //>>excludeEnd("ctx");
  2350. return $recv(self._values())._detect_ifNone_(aBlock,anotherBlock);
  2351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2352. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  2353. //>>excludeEnd("ctx");
  2354. },
  2355. //>>excludeStart("ide", pragmas.excludeIdeData);
  2356. args: ["aBlock", "anotherBlock"],
  2357. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2358. referencedClasses: [],
  2359. //>>excludeEnd("ide");
  2360. messageSends: ["detect:ifNone:", "values"]
  2361. }),
  2362. $globals.AssociativeCollection);
  2363. $core.addMethod(
  2364. $core.method({
  2365. selector: "do:",
  2366. protocol: 'enumerating',
  2367. fn: function (aBlock){
  2368. var self=this;
  2369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2370. return $core.withContext(function($ctx1) {
  2371. //>>excludeEnd("ctx");
  2372. self._valuesDo_(aBlock);
  2373. return self;
  2374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2375. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2376. //>>excludeEnd("ctx");
  2377. },
  2378. //>>excludeStart("ide", pragmas.excludeIdeData);
  2379. args: ["aBlock"],
  2380. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2381. referencedClasses: [],
  2382. //>>excludeEnd("ide");
  2383. messageSends: ["valuesDo:"]
  2384. }),
  2385. $globals.AssociativeCollection);
  2386. $core.addMethod(
  2387. $core.method({
  2388. selector: "includes:",
  2389. protocol: 'enumerating',
  2390. fn: function (anObject){
  2391. var self=this;
  2392. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2393. return $core.withContext(function($ctx1) {
  2394. //>>excludeEnd("ctx");
  2395. return $recv(self._values())._includes_(anObject);
  2396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2397. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  2398. //>>excludeEnd("ctx");
  2399. },
  2400. //>>excludeStart("ide", pragmas.excludeIdeData);
  2401. args: ["anObject"],
  2402. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2403. referencedClasses: [],
  2404. //>>excludeEnd("ide");
  2405. messageSends: ["includes:", "values"]
  2406. }),
  2407. $globals.AssociativeCollection);
  2408. $core.addMethod(
  2409. $core.method({
  2410. selector: "includesKey:",
  2411. protocol: 'testing',
  2412. fn: function (aKey){
  2413. var self=this;
  2414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2415. return $core.withContext(function($ctx1) {
  2416. //>>excludeEnd("ctx");
  2417. self._subclassResponsibility();
  2418. return self;
  2419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2420. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2421. //>>excludeEnd("ctx");
  2422. },
  2423. //>>excludeStart("ide", pragmas.excludeIdeData);
  2424. args: ["aKey"],
  2425. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2426. referencedClasses: [],
  2427. //>>excludeEnd("ide");
  2428. messageSends: ["subclassResponsibility"]
  2429. }),
  2430. $globals.AssociativeCollection);
  2431. $core.addMethod(
  2432. $core.method({
  2433. selector: "indexOf:ifAbsent:",
  2434. protocol: 'accessing',
  2435. fn: function (anObject,aBlock){
  2436. var self=this;
  2437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2438. return $core.withContext(function($ctx1) {
  2439. //>>excludeEnd("ctx");
  2440. return $recv(self._keys())._detect_ifNone_((function(each){
  2441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2442. return $core.withContext(function($ctx2) {
  2443. //>>excludeEnd("ctx");
  2444. return $recv(self._at_(each)).__eq(anObject);
  2445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2446. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2447. //>>excludeEnd("ctx");
  2448. }),aBlock);
  2449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2450. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2451. //>>excludeEnd("ctx");
  2452. },
  2453. //>>excludeStart("ide", pragmas.excludeIdeData);
  2454. args: ["anObject", "aBlock"],
  2455. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2456. referencedClasses: [],
  2457. //>>excludeEnd("ide");
  2458. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2459. }),
  2460. $globals.AssociativeCollection);
  2461. $core.addMethod(
  2462. $core.method({
  2463. selector: "keyAtValue:",
  2464. protocol: 'accessing',
  2465. fn: function (anObject){
  2466. var self=this;
  2467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2468. return $core.withContext(function($ctx1) {
  2469. //>>excludeEnd("ctx");
  2470. return self._keyAtValue_ifAbsent_(anObject,(function(){
  2471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2472. return $core.withContext(function($ctx2) {
  2473. //>>excludeEnd("ctx");
  2474. return self._errorNotFound();
  2475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2476. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2477. //>>excludeEnd("ctx");
  2478. }));
  2479. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2480. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  2481. //>>excludeEnd("ctx");
  2482. },
  2483. //>>excludeStart("ide", pragmas.excludeIdeData);
  2484. args: ["anObject"],
  2485. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2486. referencedClasses: [],
  2487. //>>excludeEnd("ide");
  2488. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2489. }),
  2490. $globals.AssociativeCollection);
  2491. $core.addMethod(
  2492. $core.method({
  2493. selector: "keyAtValue:ifAbsent:",
  2494. protocol: 'accessing',
  2495. fn: function (anObject,aBlock){
  2496. var self=this;
  2497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2498. return $core.withContext(function($ctx1) {
  2499. //>>excludeEnd("ctx");
  2500. return self._indexOf_ifAbsent_(anObject,aBlock);
  2501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2502. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  2503. //>>excludeEnd("ctx");
  2504. },
  2505. //>>excludeStart("ide", pragmas.excludeIdeData);
  2506. args: ["anObject", "aBlock"],
  2507. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2508. referencedClasses: [],
  2509. //>>excludeEnd("ide");
  2510. messageSends: ["indexOf:ifAbsent:"]
  2511. }),
  2512. $globals.AssociativeCollection);
  2513. $core.addMethod(
  2514. $core.method({
  2515. selector: "keys",
  2516. protocol: 'accessing',
  2517. fn: function (){
  2518. var self=this;
  2519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2520. return $core.withContext(function($ctx1) {
  2521. //>>excludeEnd("ctx");
  2522. self._subclassResponsibility();
  2523. return self;
  2524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2525. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  2526. //>>excludeEnd("ctx");
  2527. },
  2528. //>>excludeStart("ide", pragmas.excludeIdeData);
  2529. args: [],
  2530. source: "keys\x0a\x09self subclassResponsibility",
  2531. referencedClasses: [],
  2532. //>>excludeEnd("ide");
  2533. messageSends: ["subclassResponsibility"]
  2534. }),
  2535. $globals.AssociativeCollection);
  2536. $core.addMethod(
  2537. $core.method({
  2538. selector: "keysAndValuesDo:",
  2539. protocol: 'enumerating',
  2540. fn: function (aBlock){
  2541. var self=this;
  2542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2543. return $core.withContext(function($ctx1) {
  2544. //>>excludeEnd("ctx");
  2545. self._keysDo_((function(each){
  2546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2547. return $core.withContext(function($ctx2) {
  2548. //>>excludeEnd("ctx");
  2549. return $recv(aBlock)._value_value_(each,self._at_(each));
  2550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2552. //>>excludeEnd("ctx");
  2553. }));
  2554. return self;
  2555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2556. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2557. //>>excludeEnd("ctx");
  2558. },
  2559. //>>excludeStart("ide", pragmas.excludeIdeData);
  2560. args: ["aBlock"],
  2561. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2562. referencedClasses: [],
  2563. //>>excludeEnd("ide");
  2564. messageSends: ["keysDo:", "value:value:", "at:"]
  2565. }),
  2566. $globals.AssociativeCollection);
  2567. $core.addMethod(
  2568. $core.method({
  2569. selector: "keysDo:",
  2570. protocol: 'enumerating',
  2571. fn: function (aBlock){
  2572. var self=this;
  2573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2574. return $core.withContext(function($ctx1) {
  2575. //>>excludeEnd("ctx");
  2576. self._subclassResponsibility();
  2577. return self;
  2578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2579. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2580. //>>excludeEnd("ctx");
  2581. },
  2582. //>>excludeStart("ide", pragmas.excludeIdeData);
  2583. args: ["aBlock"],
  2584. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2585. referencedClasses: [],
  2586. //>>excludeEnd("ide");
  2587. messageSends: ["subclassResponsibility"]
  2588. }),
  2589. $globals.AssociativeCollection);
  2590. $core.addMethod(
  2591. $core.method({
  2592. selector: "printOn:",
  2593. protocol: 'printing',
  2594. fn: function (aStream){
  2595. var self=this;
  2596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2597. return $core.withContext(function($ctx1) {
  2598. //>>excludeEnd("ctx");
  2599. (
  2600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2601. $ctx1.supercall = true,
  2602. //>>excludeEnd("ctx");
  2603. ($globals.AssociativeCollection.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  2604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2605. $ctx1.supercall = false;
  2606. //>>excludeEnd("ctx");;
  2607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2608. $ctx1.sendIdx["printOn:"]=1;
  2609. //>>excludeEnd("ctx");
  2610. $recv(aStream)._nextPutAll_(" (");
  2611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2612. $ctx1.sendIdx["nextPutAll:"]=1;
  2613. //>>excludeEnd("ctx");
  2614. $recv(self._associations())._do_separatedBy_((function(each){
  2615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2616. return $core.withContext(function($ctx2) {
  2617. //>>excludeEnd("ctx");
  2618. return $recv(each)._printOn_(aStream);
  2619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2620. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2621. //>>excludeEnd("ctx");
  2622. }),(function(){
  2623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2624. return $core.withContext(function($ctx2) {
  2625. //>>excludeEnd("ctx");
  2626. return $recv(aStream)._nextPutAll_(" , ");
  2627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2628. $ctx2.sendIdx["nextPutAll:"]=2;
  2629. //>>excludeEnd("ctx");
  2630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2631. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2632. //>>excludeEnd("ctx");
  2633. }));
  2634. $recv(aStream)._nextPutAll_(")");
  2635. return self;
  2636. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2637. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  2638. //>>excludeEnd("ctx");
  2639. },
  2640. //>>excludeStart("ide", pragmas.excludeIdeData);
  2641. args: ["aStream"],
  2642. 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: ')'",
  2643. referencedClasses: [],
  2644. //>>excludeEnd("ide");
  2645. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2646. }),
  2647. $globals.AssociativeCollection);
  2648. $core.addMethod(
  2649. $core.method({
  2650. selector: "remove:ifAbsent:",
  2651. protocol: 'adding/removing',
  2652. fn: function (aKey,aBlock){
  2653. var self=this;
  2654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2655. return $core.withContext(function($ctx1) {
  2656. //>>excludeEnd("ctx");
  2657. return self._removeKey_ifAbsent_(aKey,aBlock);
  2658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2659. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2660. //>>excludeEnd("ctx");
  2661. },
  2662. //>>excludeStart("ide", pragmas.excludeIdeData);
  2663. args: ["aKey", "aBlock"],
  2664. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2665. referencedClasses: [],
  2666. //>>excludeEnd("ide");
  2667. messageSends: ["removeKey:ifAbsent:"]
  2668. }),
  2669. $globals.AssociativeCollection);
  2670. $core.addMethod(
  2671. $core.method({
  2672. selector: "removeAll",
  2673. protocol: 'adding/removing',
  2674. fn: function (){
  2675. var self=this;
  2676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2677. return $core.withContext(function($ctx1) {
  2678. //>>excludeEnd("ctx");
  2679. return $recv(self._keys())._do_((function(each){
  2680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2681. return $core.withContext(function($ctx2) {
  2682. //>>excludeEnd("ctx");
  2683. return self._removeKey_(each);
  2684. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2685. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2686. //>>excludeEnd("ctx");
  2687. }));
  2688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2689. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  2690. //>>excludeEnd("ctx");
  2691. },
  2692. //>>excludeStart("ide", pragmas.excludeIdeData);
  2693. args: [],
  2694. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2695. referencedClasses: [],
  2696. //>>excludeEnd("ide");
  2697. messageSends: ["do:", "keys", "removeKey:"]
  2698. }),
  2699. $globals.AssociativeCollection);
  2700. $core.addMethod(
  2701. $core.method({
  2702. selector: "removeKey:",
  2703. protocol: 'adding/removing',
  2704. fn: function (aKey){
  2705. var self=this;
  2706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2707. return $core.withContext(function($ctx1) {
  2708. //>>excludeEnd("ctx");
  2709. return self._remove_(aKey);
  2710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2711. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  2712. //>>excludeEnd("ctx");
  2713. },
  2714. //>>excludeStart("ide", pragmas.excludeIdeData);
  2715. args: ["aKey"],
  2716. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2717. referencedClasses: [],
  2718. //>>excludeEnd("ide");
  2719. messageSends: ["remove:"]
  2720. }),
  2721. $globals.AssociativeCollection);
  2722. $core.addMethod(
  2723. $core.method({
  2724. selector: "removeKey:ifAbsent:",
  2725. protocol: 'adding/removing',
  2726. fn: function (aKey,aBlock){
  2727. var self=this;
  2728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2729. return $core.withContext(function($ctx1) {
  2730. //>>excludeEnd("ctx");
  2731. self._subclassResponsibility();
  2732. return self;
  2733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2734. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  2735. //>>excludeEnd("ctx");
  2736. },
  2737. //>>excludeStart("ide", pragmas.excludeIdeData);
  2738. args: ["aKey", "aBlock"],
  2739. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2740. referencedClasses: [],
  2741. //>>excludeEnd("ide");
  2742. messageSends: ["subclassResponsibility"]
  2743. }),
  2744. $globals.AssociativeCollection);
  2745. $core.addMethod(
  2746. $core.method({
  2747. selector: "select:",
  2748. protocol: 'enumerating',
  2749. fn: function (aBlock){
  2750. var self=this;
  2751. var newDict;
  2752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2753. return $core.withContext(function($ctx1) {
  2754. //>>excludeEnd("ctx");
  2755. var $1;
  2756. newDict=$recv(self._class())._new();
  2757. self._keysAndValuesDo_((function(key,value){
  2758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2759. return $core.withContext(function($ctx2) {
  2760. //>>excludeEnd("ctx");
  2761. $1=$recv(aBlock)._value_(value);
  2762. if($core.assert($1)){
  2763. return $recv(newDict)._at_put_(key,value);
  2764. };
  2765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2766. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2767. //>>excludeEnd("ctx");
  2768. }));
  2769. return newDict;
  2770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2771. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  2772. //>>excludeEnd("ctx");
  2773. },
  2774. //>>excludeStart("ide", pragmas.excludeIdeData);
  2775. args: ["aBlock"],
  2776. 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",
  2777. referencedClasses: [],
  2778. //>>excludeEnd("ide");
  2779. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2780. }),
  2781. $globals.AssociativeCollection);
  2782. $core.addMethod(
  2783. $core.method({
  2784. selector: "shallowCopy",
  2785. protocol: 'copying',
  2786. fn: function (){
  2787. var self=this;
  2788. var copy;
  2789. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2790. return $core.withContext(function($ctx1) {
  2791. //>>excludeEnd("ctx");
  2792. copy=$recv(self._class())._new();
  2793. self._keysAndValuesDo_((function(key,value){
  2794. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2795. return $core.withContext(function($ctx2) {
  2796. //>>excludeEnd("ctx");
  2797. return $recv(copy)._at_put_(key,value);
  2798. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2799. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2800. //>>excludeEnd("ctx");
  2801. }));
  2802. return copy;
  2803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2804. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  2805. //>>excludeEnd("ctx");
  2806. },
  2807. //>>excludeStart("ide", pragmas.excludeIdeData);
  2808. args: [],
  2809. 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",
  2810. referencedClasses: [],
  2811. //>>excludeEnd("ide");
  2812. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2813. }),
  2814. $globals.AssociativeCollection);
  2815. $core.addMethod(
  2816. $core.method({
  2817. selector: "size",
  2818. protocol: 'accessing',
  2819. fn: function (){
  2820. var self=this;
  2821. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2822. return $core.withContext(function($ctx1) {
  2823. //>>excludeEnd("ctx");
  2824. return $recv(self._keys())._size();
  2825. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2826. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  2827. //>>excludeEnd("ctx");
  2828. },
  2829. //>>excludeStart("ide", pragmas.excludeIdeData);
  2830. args: [],
  2831. source: "size\x0a\x09^ self keys size",
  2832. referencedClasses: [],
  2833. //>>excludeEnd("ide");
  2834. messageSends: ["size", "keys"]
  2835. }),
  2836. $globals.AssociativeCollection);
  2837. $core.addMethod(
  2838. $core.method({
  2839. selector: "values",
  2840. protocol: 'accessing',
  2841. fn: function (){
  2842. var self=this;
  2843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2844. return $core.withContext(function($ctx1) {
  2845. //>>excludeEnd("ctx");
  2846. self._subclassResponsibility();
  2847. return self;
  2848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2849. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  2850. //>>excludeEnd("ctx");
  2851. },
  2852. //>>excludeStart("ide", pragmas.excludeIdeData);
  2853. args: [],
  2854. source: "values\x0a\x09self subclassResponsibility",
  2855. referencedClasses: [],
  2856. //>>excludeEnd("ide");
  2857. messageSends: ["subclassResponsibility"]
  2858. }),
  2859. $globals.AssociativeCollection);
  2860. $core.addMethod(
  2861. $core.method({
  2862. selector: "valuesDo:",
  2863. protocol: 'enumerating',
  2864. fn: function (aBlock){
  2865. var self=this;
  2866. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2867. return $core.withContext(function($ctx1) {
  2868. //>>excludeEnd("ctx");
  2869. self._subclassResponsibility();
  2870. return self;
  2871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2872. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2873. //>>excludeEnd("ctx");
  2874. },
  2875. //>>excludeStart("ide", pragmas.excludeIdeData);
  2876. args: ["aBlock"],
  2877. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2878. referencedClasses: [],
  2879. //>>excludeEnd("ide");
  2880. messageSends: ["subclassResponsibility"]
  2881. }),
  2882. $globals.AssociativeCollection);
  2883. $core.addMethod(
  2884. $core.method({
  2885. selector: "withIndexDo:",
  2886. protocol: 'enumerating',
  2887. fn: function (aBlock){
  2888. var self=this;
  2889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2890. return $core.withContext(function($ctx1) {
  2891. //>>excludeEnd("ctx");
  2892. self._keysAndValuesDo_((function(key,value){
  2893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2894. return $core.withContext(function($ctx2) {
  2895. //>>excludeEnd("ctx");
  2896. return $recv(aBlock)._value_value_(value,key);
  2897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2898. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2899. //>>excludeEnd("ctx");
  2900. }));
  2901. return self;
  2902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2903. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  2904. //>>excludeEnd("ctx");
  2905. },
  2906. //>>excludeStart("ide", pragmas.excludeIdeData);
  2907. args: ["aBlock"],
  2908. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2909. referencedClasses: [],
  2910. //>>excludeEnd("ide");
  2911. messageSends: ["keysAndValuesDo:", "value:value:"]
  2912. }),
  2913. $globals.AssociativeCollection);
  2914. $core.addMethod(
  2915. $core.method({
  2916. selector: "from:",
  2917. protocol: 'instance creation',
  2918. fn: function (aCollection){
  2919. var self=this;
  2920. var newCollection;
  2921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2922. return $core.withContext(function($ctx1) {
  2923. //>>excludeEnd("ctx");
  2924. newCollection=self._new();
  2925. $recv(aCollection)._do_((function(each){
  2926. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2927. return $core.withContext(function($ctx2) {
  2928. //>>excludeEnd("ctx");
  2929. return $recv(newCollection)._add_(each);
  2930. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2931. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2932. //>>excludeEnd("ctx");
  2933. }));
  2934. return newCollection;
  2935. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2936. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  2937. //>>excludeEnd("ctx");
  2938. },
  2939. //>>excludeStart("ide", pragmas.excludeIdeData);
  2940. args: ["aCollection"],
  2941. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  2942. referencedClasses: [],
  2943. //>>excludeEnd("ide");
  2944. messageSends: ["new", "do:", "add:"]
  2945. }),
  2946. $globals.AssociativeCollection.klass);
  2947. $core.addMethod(
  2948. $core.method({
  2949. selector: "fromPairs:",
  2950. protocol: 'instance creation',
  2951. fn: function (aCollection){
  2952. var self=this;
  2953. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2954. return $core.withContext(function($ctx1) {
  2955. //>>excludeEnd("ctx");
  2956. return self._from_(aCollection);
  2957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2958. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.klass)});
  2959. //>>excludeEnd("ctx");
  2960. },
  2961. //>>excludeStart("ide", pragmas.excludeIdeData);
  2962. args: ["aCollection"],
  2963. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  2964. referencedClasses: [],
  2965. //>>excludeEnd("ide");
  2966. messageSends: ["from:"]
  2967. }),
  2968. $globals.AssociativeCollection.klass);
  2969. $core.addMethod(
  2970. $core.method({
  2971. selector: "newFromPairs:",
  2972. protocol: 'instance creation',
  2973. fn: function (aCollection){
  2974. var self=this;
  2975. var newCollection;
  2976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2977. return $core.withContext(function($ctx1) {
  2978. //>>excludeEnd("ctx");
  2979. var $2,$1,$3,$4;
  2980. $2=$recv(aCollection)._size();
  2981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2982. $ctx1.sendIdx["size"]=1;
  2983. //>>excludeEnd("ctx");
  2984. $1=$recv($2)._even();
  2985. if(!$core.assert($1)){
  2986. self._error_("#newFromPairs only accepts arrays of an even length");
  2987. };
  2988. newCollection=self._new();
  2989. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  2990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2991. return $core.withContext(function($ctx2) {
  2992. //>>excludeEnd("ctx");
  2993. $3=newCollection;
  2994. $4=$recv(aCollection)._at_(each);
  2995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2996. $ctx2.sendIdx["at:"]=1;
  2997. //>>excludeEnd("ctx");
  2998. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  2999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3000. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3001. //>>excludeEnd("ctx");
  3002. }));
  3003. return newCollection;
  3004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3005. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.klass)});
  3006. //>>excludeEnd("ctx");
  3007. },
  3008. //>>excludeStart("ide", pragmas.excludeIdeData);
  3009. args: ["aCollection"],
  3010. 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",
  3011. referencedClasses: [],
  3012. //>>excludeEnd("ide");
  3013. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3014. }),
  3015. $globals.AssociativeCollection.klass);
  3016. $core.addClass('Dictionary', $globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  3017. //>>excludeStart("ide", pragmas.excludeIdeData);
  3018. $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.";
  3019. //>>excludeEnd("ide");
  3020. $core.addMethod(
  3021. $core.method({
  3022. selector: "at:ifAbsent:",
  3023. protocol: 'accessing',
  3024. fn: function (aKey,aBlock){
  3025. var self=this;
  3026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3027. return $core.withContext(function($ctx1) {
  3028. //>>excludeEnd("ctx");
  3029. var index = self._positionOfKey_(aKey);
  3030. return index >=0 ? self['@values'][index] : aBlock._value();
  3031. ;
  3032. return self;
  3033. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3034. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3035. //>>excludeEnd("ctx");
  3036. },
  3037. //>>excludeStart("ide", pragmas.excludeIdeData);
  3038. args: ["aKey", "aBlock"],
  3039. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock._value();\x0a\x09>",
  3040. referencedClasses: [],
  3041. //>>excludeEnd("ide");
  3042. messageSends: []
  3043. }),
  3044. $globals.Dictionary);
  3045. $core.addMethod(
  3046. $core.method({
  3047. selector: "at:put:",
  3048. protocol: 'accessing',
  3049. fn: function (aKey,aValue){
  3050. var self=this;
  3051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3052. return $core.withContext(function($ctx1) {
  3053. //>>excludeEnd("ctx");
  3054. var index = self._positionOfKey_(aKey);
  3055. if(index === -1) {
  3056. var keys = self['@keys'];
  3057. index = keys.length;
  3058. keys.push(aKey);
  3059. }
  3060. return self['@values'][index] = aValue;
  3061. ;
  3062. return self;
  3063. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3064. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  3065. //>>excludeEnd("ctx");
  3066. },
  3067. //>>excludeStart("ide", pragmas.excludeIdeData);
  3068. args: ["aKey", "aValue"],
  3069. source: "at: aKey put: aValue\x0a\x09<\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>",
  3070. referencedClasses: [],
  3071. //>>excludeEnd("ide");
  3072. messageSends: []
  3073. }),
  3074. $globals.Dictionary);
  3075. $core.addMethod(
  3076. $core.method({
  3077. selector: "includesKey:",
  3078. protocol: 'testing',
  3079. fn: function (aKey){
  3080. var self=this;
  3081. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3082. return $core.withContext(function($ctx1) {
  3083. //>>excludeEnd("ctx");
  3084. return self._positionOfKey_(aKey) >= 0; ;
  3085. return self;
  3086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3087. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  3088. //>>excludeEnd("ctx");
  3089. },
  3090. //>>excludeStart("ide", pragmas.excludeIdeData);
  3091. args: ["aKey"],
  3092. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  3093. referencedClasses: [],
  3094. //>>excludeEnd("ide");
  3095. messageSends: []
  3096. }),
  3097. $globals.Dictionary);
  3098. $core.addMethod(
  3099. $core.method({
  3100. selector: "indexOf:ifAbsent:",
  3101. protocol: 'accessing',
  3102. fn: function (anObject,aBlock){
  3103. var self=this;
  3104. var index;
  3105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3106. return $core.withContext(function($ctx1) {
  3107. //>>excludeEnd("ctx");
  3108. var $1;
  3109. index=$recv(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3110. return (0);
  3111. }));
  3112. $1=$recv(index).__eq((0));
  3113. if($core.assert($1)){
  3114. return $recv(aBlock)._value();
  3115. } else {
  3116. return $recv(self["@keys"])._at_(index);
  3117. };
  3118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3119. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  3120. //>>excludeEnd("ctx");
  3121. },
  3122. //>>excludeStart("ide", pragmas.excludeIdeData);
  3123. args: ["anObject", "aBlock"],
  3124. 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 ]",
  3125. referencedClasses: [],
  3126. //>>excludeEnd("ide");
  3127. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3128. }),
  3129. $globals.Dictionary);
  3130. $core.addMethod(
  3131. $core.method({
  3132. selector: "initialize",
  3133. protocol: 'initialization',
  3134. fn: function (){
  3135. var self=this;
  3136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3137. return $core.withContext(function($ctx1) {
  3138. //>>excludeEnd("ctx");
  3139. (
  3140. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3141. $ctx1.supercall = true,
  3142. //>>excludeEnd("ctx");
  3143. ($globals.Dictionary.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  3144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3145. $ctx1.supercall = false;
  3146. //>>excludeEnd("ctx");;
  3147. self["@keys"]=[];
  3148. self["@values"]=[];
  3149. return self;
  3150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3151. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  3152. //>>excludeEnd("ctx");
  3153. },
  3154. //>>excludeStart("ide", pragmas.excludeIdeData);
  3155. args: [],
  3156. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3157. referencedClasses: [],
  3158. //>>excludeEnd("ide");
  3159. messageSends: ["initialize"]
  3160. }),
  3161. $globals.Dictionary);
  3162. $core.addMethod(
  3163. $core.method({
  3164. selector: "keys",
  3165. protocol: 'accessing',
  3166. fn: function (){
  3167. var self=this;
  3168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3169. return $core.withContext(function($ctx1) {
  3170. //>>excludeEnd("ctx");
  3171. return $recv(self["@keys"])._copy();
  3172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3173. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  3174. //>>excludeEnd("ctx");
  3175. },
  3176. //>>excludeStart("ide", pragmas.excludeIdeData);
  3177. args: [],
  3178. source: "keys\x0a\x09^ keys copy",
  3179. referencedClasses: [],
  3180. //>>excludeEnd("ide");
  3181. messageSends: ["copy"]
  3182. }),
  3183. $globals.Dictionary);
  3184. $core.addMethod(
  3185. $core.method({
  3186. selector: "keysAndValuesDo:",
  3187. protocol: 'enumerating',
  3188. fn: function (aBlock){
  3189. var self=this;
  3190. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3191. return $core.withContext(function($ctx1) {
  3192. //>>excludeEnd("ctx");
  3193. return $recv(self["@keys"])._with_do_(self["@values"],aBlock);
  3194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3195. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3196. //>>excludeEnd("ctx");
  3197. },
  3198. //>>excludeStart("ide", pragmas.excludeIdeData);
  3199. args: ["aBlock"],
  3200. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3201. referencedClasses: [],
  3202. //>>excludeEnd("ide");
  3203. messageSends: ["with:do:"]
  3204. }),
  3205. $globals.Dictionary);
  3206. $core.addMethod(
  3207. $core.method({
  3208. selector: "keysDo:",
  3209. protocol: 'enumerating',
  3210. fn: function (aBlock){
  3211. var self=this;
  3212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3213. return $core.withContext(function($ctx1) {
  3214. //>>excludeEnd("ctx");
  3215. return $recv(self["@keys"])._do_(aBlock);
  3216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3217. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  3218. //>>excludeEnd("ctx");
  3219. },
  3220. //>>excludeStart("ide", pragmas.excludeIdeData);
  3221. args: ["aBlock"],
  3222. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3223. referencedClasses: [],
  3224. //>>excludeEnd("ide");
  3225. messageSends: ["do:"]
  3226. }),
  3227. $globals.Dictionary);
  3228. $core.addMethod(
  3229. $core.method({
  3230. selector: "positionOfKey:",
  3231. protocol: 'private',
  3232. fn: function (anObject){
  3233. var self=this;
  3234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3235. return $core.withContext(function($ctx1) {
  3236. //>>excludeEnd("ctx");
  3237. var keys = self['@keys'];
  3238. for(var i=0;i<keys.length;i++){
  3239. if(keys[i].__eq(anObject)) { return i;}
  3240. }
  3241. return -1;
  3242. ;
  3243. return self;
  3244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3245. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  3246. //>>excludeEnd("ctx");
  3247. },
  3248. //>>excludeStart("ide", pragmas.excludeIdeData);
  3249. args: ["anObject"],
  3250. source: "positionOfKey: anObject\x0a\x09<\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>",
  3251. referencedClasses: [],
  3252. //>>excludeEnd("ide");
  3253. messageSends: []
  3254. }),
  3255. $globals.Dictionary);
  3256. $core.addMethod(
  3257. $core.method({
  3258. selector: "removeAll",
  3259. protocol: 'adding/removing',
  3260. fn: function (){
  3261. var self=this;
  3262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3263. return $core.withContext(function($ctx1) {
  3264. //>>excludeEnd("ctx");
  3265. $recv(self["@keys"])._removeAll();
  3266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3267. $ctx1.sendIdx["removeAll"]=1;
  3268. //>>excludeEnd("ctx");
  3269. $recv(self["@values"])._removeAll();
  3270. return self;
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  3273. //>>excludeEnd("ctx");
  3274. },
  3275. //>>excludeStart("ide", pragmas.excludeIdeData);
  3276. args: [],
  3277. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3278. referencedClasses: [],
  3279. //>>excludeEnd("ide");
  3280. messageSends: ["removeAll"]
  3281. }),
  3282. $globals.Dictionary);
  3283. $core.addMethod(
  3284. $core.method({
  3285. selector: "removeKey:ifAbsent:",
  3286. protocol: 'adding/removing',
  3287. fn: function (aKey,aBlock){
  3288. var self=this;
  3289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3290. return $core.withContext(function($ctx1) {
  3291. //>>excludeEnd("ctx");
  3292. var index = self._positionOfKey_(aKey);
  3293. if(index === -1) {
  3294. return aBlock._value()
  3295. } else {
  3296. var keys = self['@keys'], values = self['@values'];
  3297. var value = values[index], l = keys.length;
  3298. keys[index] = keys[l-1];
  3299. keys.pop();
  3300. values[index] = values[l-1];
  3301. values.pop();
  3302. return value;
  3303. }
  3304. ;
  3305. return self;
  3306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3307. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  3308. //>>excludeEnd("ctx");
  3309. },
  3310. //>>excludeStart("ide", pragmas.excludeIdeData);
  3311. args: ["aKey", "aBlock"],
  3312. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\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>",
  3313. referencedClasses: [],
  3314. //>>excludeEnd("ide");
  3315. messageSends: []
  3316. }),
  3317. $globals.Dictionary);
  3318. $core.addMethod(
  3319. $core.method({
  3320. selector: "values",
  3321. protocol: 'accessing',
  3322. fn: function (){
  3323. var self=this;
  3324. return self["@values"];
  3325. },
  3326. //>>excludeStart("ide", pragmas.excludeIdeData);
  3327. args: [],
  3328. source: "values\x0a\x09^ values",
  3329. referencedClasses: [],
  3330. //>>excludeEnd("ide");
  3331. messageSends: []
  3332. }),
  3333. $globals.Dictionary);
  3334. $core.addMethod(
  3335. $core.method({
  3336. selector: "valuesDo:",
  3337. protocol: 'enumerating',
  3338. fn: function (aBlock){
  3339. var self=this;
  3340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3341. return $core.withContext(function($ctx1) {
  3342. //>>excludeEnd("ctx");
  3343. return $recv(self["@values"])._do_(aBlock);
  3344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3345. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  3346. //>>excludeEnd("ctx");
  3347. },
  3348. //>>excludeStart("ide", pragmas.excludeIdeData);
  3349. args: ["aBlock"],
  3350. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3351. referencedClasses: [],
  3352. //>>excludeEnd("ide");
  3353. messageSends: ["do:"]
  3354. }),
  3355. $globals.Dictionary);
  3356. $core.addClass('HashedCollection', $globals.AssociativeCollection, [], 'Kernel-Collections');
  3357. //>>excludeStart("ide", pragmas.excludeIdeData);
  3358. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3359. //>>excludeEnd("ide");
  3360. $core.addMethod(
  3361. $core.method({
  3362. selector: "at:ifAbsent:",
  3363. protocol: 'accessing',
  3364. fn: function (aKey,aBlock){
  3365. var self=this;
  3366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3367. return $core.withContext(function($ctx1) {
  3368. //>>excludeEnd("ctx");
  3369. var $1;
  3370. $1=self._includesKey_(aKey);
  3371. if($core.assert($1)){
  3372. return self._basicAt_(aKey);
  3373. } else {
  3374. return $recv(aBlock)._value();
  3375. };
  3376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3377. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3378. //>>excludeEnd("ctx");
  3379. },
  3380. //>>excludeStart("ide", pragmas.excludeIdeData);
  3381. args: ["aKey", "aBlock"],
  3382. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3383. referencedClasses: [],
  3384. //>>excludeEnd("ide");
  3385. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3386. }),
  3387. $globals.HashedCollection);
  3388. $core.addMethod(
  3389. $core.method({
  3390. selector: "at:put:",
  3391. protocol: 'accessing',
  3392. fn: function (aKey,aValue){
  3393. var self=this;
  3394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3395. return $core.withContext(function($ctx1) {
  3396. //>>excludeEnd("ctx");
  3397. return self._basicAt_put_(aKey,aValue);
  3398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3399. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  3400. //>>excludeEnd("ctx");
  3401. },
  3402. //>>excludeStart("ide", pragmas.excludeIdeData);
  3403. args: ["aKey", "aValue"],
  3404. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3405. referencedClasses: [],
  3406. //>>excludeEnd("ide");
  3407. messageSends: ["basicAt:put:"]
  3408. }),
  3409. $globals.HashedCollection);
  3410. $core.addMethod(
  3411. $core.method({
  3412. selector: "includesKey:",
  3413. protocol: 'testing',
  3414. fn: function (aKey){
  3415. var self=this;
  3416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3417. return $core.withContext(function($ctx1) {
  3418. //>>excludeEnd("ctx");
  3419. return self.hasOwnProperty(aKey);
  3420. return self;
  3421. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3422. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  3423. //>>excludeEnd("ctx");
  3424. },
  3425. //>>excludeStart("ide", pragmas.excludeIdeData);
  3426. args: ["aKey"],
  3427. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  3428. referencedClasses: [],
  3429. //>>excludeEnd("ide");
  3430. messageSends: []
  3431. }),
  3432. $globals.HashedCollection);
  3433. $core.addMethod(
  3434. $core.method({
  3435. selector: "keys",
  3436. protocol: 'accessing',
  3437. fn: function (){
  3438. var self=this;
  3439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3440. return $core.withContext(function($ctx1) {
  3441. //>>excludeEnd("ctx");
  3442. return Object.keys(self);
  3443. return self;
  3444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3445. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  3446. //>>excludeEnd("ctx");
  3447. },
  3448. //>>excludeStart("ide", pragmas.excludeIdeData);
  3449. args: [],
  3450. source: "keys\x0a\x09<return Object.keys(self)>",
  3451. referencedClasses: [],
  3452. //>>excludeEnd("ide");
  3453. messageSends: []
  3454. }),
  3455. $globals.HashedCollection);
  3456. $core.addMethod(
  3457. $core.method({
  3458. selector: "keysDo:",
  3459. protocol: 'enumerating',
  3460. fn: function (aBlock){
  3461. var self=this;
  3462. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3463. return $core.withContext(function($ctx1) {
  3464. //>>excludeEnd("ctx");
  3465. $recv(self._keys())._do_(aBlock);
  3466. return self;
  3467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3468. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3469. //>>excludeEnd("ctx");
  3470. },
  3471. //>>excludeStart("ide", pragmas.excludeIdeData);
  3472. args: ["aBlock"],
  3473. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3474. referencedClasses: [],
  3475. //>>excludeEnd("ide");
  3476. messageSends: ["do:", "keys"]
  3477. }),
  3478. $globals.HashedCollection);
  3479. $core.addMethod(
  3480. $core.method({
  3481. selector: "removeKey:ifAbsent:",
  3482. protocol: 'adding/removing',
  3483. fn: function (aKey,aBlock){
  3484. var self=this;
  3485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3486. return $core.withContext(function($ctx1) {
  3487. //>>excludeEnd("ctx");
  3488. return self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3489. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3490. return $core.withContext(function($ctx2) {
  3491. //>>excludeEnd("ctx");
  3492. self._basicDelete_(aKey);
  3493. return removed;
  3494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3495. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3496. //>>excludeEnd("ctx");
  3497. }),(function(){
  3498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3499. return $core.withContext(function($ctx2) {
  3500. //>>excludeEnd("ctx");
  3501. return $recv(aBlock)._value();
  3502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3503. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3504. //>>excludeEnd("ctx");
  3505. }));
  3506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3507. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  3508. //>>excludeEnd("ctx");
  3509. },
  3510. //>>excludeStart("ide", pragmas.excludeIdeData);
  3511. args: ["aKey", "aBlock"],
  3512. 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 ]",
  3513. referencedClasses: [],
  3514. //>>excludeEnd("ide");
  3515. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3516. }),
  3517. $globals.HashedCollection);
  3518. $core.addMethod(
  3519. $core.method({
  3520. selector: "values",
  3521. protocol: 'accessing',
  3522. fn: function (){
  3523. var self=this;
  3524. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3525. return $core.withContext(function($ctx1) {
  3526. //>>excludeEnd("ctx");
  3527. return self._keys().map(function(key){
  3528. return self._at_(key);
  3529. });
  3530. ;
  3531. return self;
  3532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3533. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  3534. //>>excludeEnd("ctx");
  3535. },
  3536. //>>excludeStart("ide", pragmas.excludeIdeData);
  3537. args: [],
  3538. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  3539. referencedClasses: [],
  3540. //>>excludeEnd("ide");
  3541. messageSends: []
  3542. }),
  3543. $globals.HashedCollection);
  3544. $core.addMethod(
  3545. $core.method({
  3546. selector: "valuesDo:",
  3547. protocol: 'enumerating',
  3548. fn: function (aBlock){
  3549. var self=this;
  3550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3551. return $core.withContext(function($ctx1) {
  3552. //>>excludeEnd("ctx");
  3553. $recv(self._values())._do_(aBlock);
  3554. return self;
  3555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3556. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  3557. //>>excludeEnd("ctx");
  3558. },
  3559. //>>excludeStart("ide", pragmas.excludeIdeData);
  3560. args: ["aBlock"],
  3561. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3562. referencedClasses: [],
  3563. //>>excludeEnd("ide");
  3564. messageSends: ["do:", "values"]
  3565. }),
  3566. $globals.HashedCollection);
  3567. $core.addClass('SequenceableCollection', $globals.IndexableCollection, [], 'Kernel-Collections');
  3568. //>>excludeStart("ide", pragmas.excludeIdeData);
  3569. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3570. //>>excludeEnd("ide");
  3571. $core.addMethod(
  3572. $core.method({
  3573. selector: "=",
  3574. protocol: 'comparing',
  3575. fn: function (aCollection){
  3576. var self=this;
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. return $core.withContext(function($ctx1) {
  3579. //>>excludeEnd("ctx");
  3580. var $3,$2,$4,$1,$5;
  3581. var $early={};
  3582. try {
  3583. $3=self._class();
  3584. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3585. $ctx1.sendIdx["class"]=1;
  3586. //>>excludeEnd("ctx");
  3587. $2=$recv($3).__eq($recv(aCollection)._class());
  3588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3589. $ctx1.sendIdx["="]=1;
  3590. //>>excludeEnd("ctx");
  3591. $1=$recv($2)._and_((function(){
  3592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3593. return $core.withContext(function($ctx2) {
  3594. //>>excludeEnd("ctx");
  3595. $4=self._size();
  3596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3597. $ctx2.sendIdx["size"]=1;
  3598. //>>excludeEnd("ctx");
  3599. return $recv($4).__eq($recv(aCollection)._size());
  3600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3601. $ctx2.sendIdx["="]=2;
  3602. //>>excludeEnd("ctx");
  3603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3604. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3605. //>>excludeEnd("ctx");
  3606. }));
  3607. if(!$core.assert($1)){
  3608. return false;
  3609. };
  3610. self._withIndexDo_((function(each,i){
  3611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3612. return $core.withContext(function($ctx2) {
  3613. //>>excludeEnd("ctx");
  3614. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  3615. if(!$core.assert($5)){
  3616. throw $early=[false];
  3617. };
  3618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3619. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3620. //>>excludeEnd("ctx");
  3621. }));
  3622. return true;
  3623. }
  3624. catch(e) {if(e===$early)return e[0]; throw e}
  3625. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3626. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  3627. //>>excludeEnd("ctx");
  3628. },
  3629. //>>excludeStart("ide", pragmas.excludeIdeData);
  3630. args: ["aCollection"],
  3631. 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",
  3632. referencedClasses: [],
  3633. //>>excludeEnd("ide");
  3634. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3635. }),
  3636. $globals.SequenceableCollection);
  3637. $core.addMethod(
  3638. $core.method({
  3639. selector: "addLast:",
  3640. protocol: 'adding/removing',
  3641. fn: function (anObject){
  3642. var self=this;
  3643. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3644. return $core.withContext(function($ctx1) {
  3645. //>>excludeEnd("ctx");
  3646. self._add_(anObject);
  3647. return self;
  3648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3649. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  3650. //>>excludeEnd("ctx");
  3651. },
  3652. //>>excludeStart("ide", pragmas.excludeIdeData);
  3653. args: ["anObject"],
  3654. source: "addLast: anObject\x0a\x09self add: anObject",
  3655. referencedClasses: [],
  3656. //>>excludeEnd("ide");
  3657. messageSends: ["add:"]
  3658. }),
  3659. $globals.SequenceableCollection);
  3660. $core.addMethod(
  3661. $core.method({
  3662. selector: "allButFirst",
  3663. protocol: 'accessing',
  3664. fn: function (){
  3665. var self=this;
  3666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3667. return $core.withContext(function($ctx1) {
  3668. //>>excludeEnd("ctx");
  3669. return self._copyFrom_to_((2),self._size());
  3670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3671. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  3672. //>>excludeEnd("ctx");
  3673. },
  3674. //>>excludeStart("ide", pragmas.excludeIdeData);
  3675. args: [],
  3676. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3677. referencedClasses: [],
  3678. //>>excludeEnd("ide");
  3679. messageSends: ["copyFrom:to:", "size"]
  3680. }),
  3681. $globals.SequenceableCollection);
  3682. $core.addMethod(
  3683. $core.method({
  3684. selector: "allButLast",
  3685. protocol: 'accessing',
  3686. fn: function (){
  3687. var self=this;
  3688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3689. return $core.withContext(function($ctx1) {
  3690. //>>excludeEnd("ctx");
  3691. return self._copyFrom_to_((1),$recv(self._size()).__minus((1)));
  3692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3693. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  3694. //>>excludeEnd("ctx");
  3695. },
  3696. //>>excludeStart("ide", pragmas.excludeIdeData);
  3697. args: [],
  3698. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3699. referencedClasses: [],
  3700. //>>excludeEnd("ide");
  3701. messageSends: ["copyFrom:to:", "-", "size"]
  3702. }),
  3703. $globals.SequenceableCollection);
  3704. $core.addMethod(
  3705. $core.method({
  3706. selector: "atRandom",
  3707. protocol: 'accessing',
  3708. fn: function (){
  3709. var self=this;
  3710. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3711. return $core.withContext(function($ctx1) {
  3712. //>>excludeEnd("ctx");
  3713. return self._at_($recv(self._size())._atRandom());
  3714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3715. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  3716. //>>excludeEnd("ctx");
  3717. },
  3718. //>>excludeStart("ide", pragmas.excludeIdeData);
  3719. args: [],
  3720. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3721. referencedClasses: [],
  3722. //>>excludeEnd("ide");
  3723. messageSends: ["at:", "atRandom", "size"]
  3724. }),
  3725. $globals.SequenceableCollection);
  3726. $core.addMethod(
  3727. $core.method({
  3728. selector: "beginsWith:",
  3729. protocol: 'testing',
  3730. fn: function (prefix){
  3731. var self=this;
  3732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3733. return $core.withContext(function($ctx1) {
  3734. //>>excludeEnd("ctx");
  3735. var $2,$3,$1;
  3736. $2=self._size();
  3737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3738. $ctx1.sendIdx["size"]=1;
  3739. //>>excludeEnd("ctx");
  3740. $3=$recv(prefix)._size();
  3741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3742. $ctx1.sendIdx["size"]=2;
  3743. //>>excludeEnd("ctx");
  3744. $1=$recv($2).__lt($3);
  3745. if($core.assert($1)){
  3746. return false;
  3747. };
  3748. return $recv(self._first_($recv(prefix)._size())).__eq(prefix);
  3749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3750. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  3751. //>>excludeEnd("ctx");
  3752. },
  3753. //>>excludeStart("ide", pragmas.excludeIdeData);
  3754. args: ["prefix"],
  3755. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3756. referencedClasses: [],
  3757. //>>excludeEnd("ide");
  3758. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3759. }),
  3760. $globals.SequenceableCollection);
  3761. $core.addMethod(
  3762. $core.method({
  3763. selector: "copyFrom:to:",
  3764. protocol: 'copying',
  3765. fn: function (anIndex,anotherIndex){
  3766. var self=this;
  3767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3768. return $core.withContext(function($ctx1) {
  3769. //>>excludeEnd("ctx");
  3770. self._subclassResponsibility();
  3771. return self;
  3772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3773. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  3774. //>>excludeEnd("ctx");
  3775. },
  3776. //>>excludeStart("ide", pragmas.excludeIdeData);
  3777. args: ["anIndex", "anotherIndex"],
  3778. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  3779. referencedClasses: [],
  3780. //>>excludeEnd("ide");
  3781. messageSends: ["subclassResponsibility"]
  3782. }),
  3783. $globals.SequenceableCollection);
  3784. $core.addMethod(
  3785. $core.method({
  3786. selector: "detect:ifNone:",
  3787. protocol: 'enumerating',
  3788. fn: function (aBlock,anotherBlock){
  3789. var self=this;
  3790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3791. return $core.withContext(function($ctx1) {
  3792. //>>excludeEnd("ctx");
  3793. self = self._numericallyIndexable();
  3794. for(var i = 0; i < self.length; i++)
  3795. if(aBlock._value_(self[i]))
  3796. return self[i];
  3797. return anotherBlock._value();
  3798. ;
  3799. return self;
  3800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3801. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  3802. //>>excludeEnd("ctx");
  3803. },
  3804. //>>excludeStart("ide", pragmas.excludeIdeData);
  3805. args: ["aBlock", "anotherBlock"],
  3806. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\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>",
  3807. referencedClasses: [],
  3808. //>>excludeEnd("ide");
  3809. messageSends: []
  3810. }),
  3811. $globals.SequenceableCollection);
  3812. $core.addMethod(
  3813. $core.method({
  3814. selector: "do:",
  3815. protocol: 'enumerating',
  3816. fn: function (aBlock){
  3817. var self=this;
  3818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3819. return $core.withContext(function($ctx1) {
  3820. //>>excludeEnd("ctx");
  3821. self = self._numericallyIndexable();
  3822. for(var i=0; i < self.length; i++) {
  3823. aBlock._value_(self[i]);
  3824. }
  3825. ;
  3826. return self;
  3827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3828. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  3829. //>>excludeEnd("ctx");
  3830. },
  3831. //>>excludeStart("ide", pragmas.excludeIdeData);
  3832. args: ["aBlock"],
  3833. source: "do: aBlock\x0a\x09<\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>",
  3834. referencedClasses: [],
  3835. //>>excludeEnd("ide");
  3836. messageSends: []
  3837. }),
  3838. $globals.SequenceableCollection);
  3839. $core.addMethod(
  3840. $core.method({
  3841. selector: "endsWith:",
  3842. protocol: 'testing',
  3843. fn: function (suffix){
  3844. var self=this;
  3845. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3846. return $core.withContext(function($ctx1) {
  3847. //>>excludeEnd("ctx");
  3848. var $2,$3,$1;
  3849. $2=self._size();
  3850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3851. $ctx1.sendIdx["size"]=1;
  3852. //>>excludeEnd("ctx");
  3853. $3=$recv(suffix)._size();
  3854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3855. $ctx1.sendIdx["size"]=2;
  3856. //>>excludeEnd("ctx");
  3857. $1=$recv($2).__lt($3);
  3858. if($core.assert($1)){
  3859. return false;
  3860. };
  3861. return $recv(self._last_($recv(suffix)._size())).__eq(suffix);
  3862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3863. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  3864. //>>excludeEnd("ctx");
  3865. },
  3866. //>>excludeStart("ide", pragmas.excludeIdeData);
  3867. args: ["suffix"],
  3868. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  3869. referencedClasses: [],
  3870. //>>excludeEnd("ide");
  3871. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  3872. }),
  3873. $globals.SequenceableCollection);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "first",
  3877. protocol: 'accessing',
  3878. fn: function (){
  3879. var self=this;
  3880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3881. return $core.withContext(function($ctx1) {
  3882. //>>excludeEnd("ctx");
  3883. return self._at_((1));
  3884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3885. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  3886. //>>excludeEnd("ctx");
  3887. },
  3888. //>>excludeStart("ide", pragmas.excludeIdeData);
  3889. args: [],
  3890. source: "first\x0a\x09^ self at: 1",
  3891. referencedClasses: [],
  3892. //>>excludeEnd("ide");
  3893. messageSends: ["at:"]
  3894. }),
  3895. $globals.SequenceableCollection);
  3896. $core.addMethod(
  3897. $core.method({
  3898. selector: "first:",
  3899. protocol: 'accessing',
  3900. fn: function (aNumber){
  3901. var self=this;
  3902. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3903. return $core.withContext(function($ctx1) {
  3904. //>>excludeEnd("ctx");
  3905. var $1;
  3906. $1=$recv(self._size()).__lt(aNumber);
  3907. if($core.assert($1)){
  3908. self._error_("Invalid number of elements");
  3909. };
  3910. return self._copyFrom_to_((1),aNumber);
  3911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3912. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  3913. //>>excludeEnd("ctx");
  3914. },
  3915. //>>excludeStart("ide", pragmas.excludeIdeData);
  3916. args: ["aNumber"],
  3917. 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",
  3918. referencedClasses: [],
  3919. //>>excludeEnd("ide");
  3920. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  3921. }),
  3922. $globals.SequenceableCollection);
  3923. $core.addMethod(
  3924. $core.method({
  3925. selector: "fourth",
  3926. protocol: 'accessing',
  3927. fn: function (){
  3928. var self=this;
  3929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3930. return $core.withContext(function($ctx1) {
  3931. //>>excludeEnd("ctx");
  3932. return self._at_((4));
  3933. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3934. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  3935. //>>excludeEnd("ctx");
  3936. },
  3937. //>>excludeStart("ide", pragmas.excludeIdeData);
  3938. args: [],
  3939. source: "fourth\x0a\x09^ self at: 4",
  3940. referencedClasses: [],
  3941. //>>excludeEnd("ide");
  3942. messageSends: ["at:"]
  3943. }),
  3944. $globals.SequenceableCollection);
  3945. $core.addMethod(
  3946. $core.method({
  3947. selector: "includes:",
  3948. protocol: 'testing',
  3949. fn: function (anObject){
  3950. var self=this;
  3951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3952. return $core.withContext(function($ctx1) {
  3953. //>>excludeEnd("ctx");
  3954. return $recv(self._indexOf_ifAbsent_(anObject,(function(){
  3955. return nil;
  3956. })))._notNil();
  3957. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3958. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  3959. //>>excludeEnd("ctx");
  3960. },
  3961. //>>excludeStart("ide", pragmas.excludeIdeData);
  3962. args: ["anObject"],
  3963. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  3964. referencedClasses: [],
  3965. //>>excludeEnd("ide");
  3966. messageSends: ["notNil", "indexOf:ifAbsent:"]
  3967. }),
  3968. $globals.SequenceableCollection);
  3969. $core.addMethod(
  3970. $core.method({
  3971. selector: "indexOf:ifAbsent:",
  3972. protocol: 'accessing',
  3973. fn: function (anObject,aBlock){
  3974. var self=this;
  3975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3976. return $core.withContext(function($ctx1) {
  3977. //>>excludeEnd("ctx");
  3978. self = self._numericallyIndexable();
  3979. for(var i=0; i < self.length; i++) {
  3980. if($recv(self[i]).__eq(anObject)) {return i+1}
  3981. };
  3982. return aBlock._value();
  3983. ;
  3984. return self;
  3985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3986. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  3987. //>>excludeEnd("ctx");
  3988. },
  3989. //>>excludeStart("ide", pragmas.excludeIdeData);
  3990. args: ["anObject", "aBlock"],
  3991. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\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>",
  3992. referencedClasses: [],
  3993. //>>excludeEnd("ide");
  3994. messageSends: []
  3995. }),
  3996. $globals.SequenceableCollection);
  3997. $core.addMethod(
  3998. $core.method({
  3999. selector: "indexOf:startingAt:",
  4000. protocol: 'accessing',
  4001. fn: function (anObject,start){
  4002. var self=this;
  4003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4004. return $core.withContext(function($ctx1) {
  4005. //>>excludeEnd("ctx");
  4006. return self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4007. return (0);
  4008. }));
  4009. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4010. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  4011. //>>excludeEnd("ctx");
  4012. },
  4013. //>>excludeStart("ide", pragmas.excludeIdeData);
  4014. args: ["anObject", "start"],
  4015. 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 ]",
  4016. referencedClasses: [],
  4017. //>>excludeEnd("ide");
  4018. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4019. }),
  4020. $globals.SequenceableCollection);
  4021. $core.addMethod(
  4022. $core.method({
  4023. selector: "indexOf:startingAt:ifAbsent:",
  4024. protocol: 'accessing',
  4025. fn: function (anObject,start,aBlock){
  4026. var self=this;
  4027. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4028. return $core.withContext(function($ctx1) {
  4029. //>>excludeEnd("ctx");
  4030. self = self._numericallyIndexable();
  4031. for(var i=start - 1; i < self.length; i++){
  4032. if($recv(self[i]).__eq(anObject)) {return i+1}
  4033. }
  4034. return aBlock._value();
  4035. ;
  4036. return self;
  4037. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4038. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  4039. //>>excludeEnd("ctx");
  4040. },
  4041. //>>excludeStart("ide", pragmas.excludeIdeData);
  4042. args: ["anObject", "start", "aBlock"],
  4043. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\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>",
  4044. referencedClasses: [],
  4045. //>>excludeEnd("ide");
  4046. messageSends: []
  4047. }),
  4048. $globals.SequenceableCollection);
  4049. $core.addMethod(
  4050. $core.method({
  4051. selector: "last",
  4052. protocol: 'accessing',
  4053. fn: function (){
  4054. var self=this;
  4055. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4056. return $core.withContext(function($ctx1) {
  4057. //>>excludeEnd("ctx");
  4058. return self._at_(self._size());
  4059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4060. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  4061. //>>excludeEnd("ctx");
  4062. },
  4063. //>>excludeStart("ide", pragmas.excludeIdeData);
  4064. args: [],
  4065. source: "last\x0a\x09^ self at: self size",
  4066. referencedClasses: [],
  4067. //>>excludeEnd("ide");
  4068. messageSends: ["at:", "size"]
  4069. }),
  4070. $globals.SequenceableCollection);
  4071. $core.addMethod(
  4072. $core.method({
  4073. selector: "last:",
  4074. protocol: 'accessing',
  4075. fn: function (aNumber){
  4076. var self=this;
  4077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4078. return $core.withContext(function($ctx1) {
  4079. //>>excludeEnd("ctx");
  4080. var $2,$1,$5,$4,$3;
  4081. $2=self._size();
  4082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4083. $ctx1.sendIdx["size"]=1;
  4084. //>>excludeEnd("ctx");
  4085. $1=$recv($2).__lt(aNumber);
  4086. if($core.assert($1)){
  4087. self._error_("Invalid number of elements");
  4088. };
  4089. $5=self._size();
  4090. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4091. $ctx1.sendIdx["size"]=2;
  4092. //>>excludeEnd("ctx");
  4093. $4=$recv($5).__minus(aNumber);
  4094. $3=$recv($4).__plus((1));
  4095. return self._copyFrom_to_($3,self._size());
  4096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4097. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  4098. //>>excludeEnd("ctx");
  4099. },
  4100. //>>excludeStart("ide", pragmas.excludeIdeData);
  4101. args: ["aNumber"],
  4102. 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",
  4103. referencedClasses: [],
  4104. //>>excludeEnd("ide");
  4105. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4106. }),
  4107. $globals.SequenceableCollection);
  4108. $core.addMethod(
  4109. $core.method({
  4110. selector: "newStream",
  4111. protocol: 'streaming',
  4112. fn: function (){
  4113. var self=this;
  4114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4115. return $core.withContext(function($ctx1) {
  4116. //>>excludeEnd("ctx");
  4117. return $recv(self._streamClass())._on_(self);
  4118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4119. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  4120. //>>excludeEnd("ctx");
  4121. },
  4122. //>>excludeStart("ide", pragmas.excludeIdeData);
  4123. args: [],
  4124. source: "newStream\x0a\x09^ self streamClass on: self",
  4125. referencedClasses: [],
  4126. //>>excludeEnd("ide");
  4127. messageSends: ["on:", "streamClass"]
  4128. }),
  4129. $globals.SequenceableCollection);
  4130. $core.addMethod(
  4131. $core.method({
  4132. selector: "numericallyIndexable",
  4133. protocol: 'private',
  4134. fn: function (){
  4135. var self=this;
  4136. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4137. return $core.withContext(function($ctx1) {
  4138. //>>excludeEnd("ctx");
  4139. self._subclassResponsibility();
  4140. return self;
  4141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4142. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  4143. //>>excludeEnd("ctx");
  4144. },
  4145. //>>excludeStart("ide", pragmas.excludeIdeData);
  4146. args: [],
  4147. 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",
  4148. referencedClasses: [],
  4149. //>>excludeEnd("ide");
  4150. messageSends: ["subclassResponsibility"]
  4151. }),
  4152. $globals.SequenceableCollection);
  4153. $core.addMethod(
  4154. $core.method({
  4155. selector: "readStream",
  4156. protocol: 'streaming',
  4157. fn: function (){
  4158. var self=this;
  4159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4160. return $core.withContext(function($ctx1) {
  4161. //>>excludeEnd("ctx");
  4162. return self._stream();
  4163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4164. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  4165. //>>excludeEnd("ctx");
  4166. },
  4167. //>>excludeStart("ide", pragmas.excludeIdeData);
  4168. args: [],
  4169. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4170. referencedClasses: [],
  4171. //>>excludeEnd("ide");
  4172. messageSends: ["stream"]
  4173. }),
  4174. $globals.SequenceableCollection);
  4175. $core.addMethod(
  4176. $core.method({
  4177. selector: "removeLast",
  4178. protocol: 'adding/removing',
  4179. fn: function (){
  4180. var self=this;
  4181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4182. return $core.withContext(function($ctx1) {
  4183. //>>excludeEnd("ctx");
  4184. return self._remove_(self._last());
  4185. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4186. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  4187. //>>excludeEnd("ctx");
  4188. },
  4189. //>>excludeStart("ide", pragmas.excludeIdeData);
  4190. args: [],
  4191. source: "removeLast\x0a\x09^ self remove: self last",
  4192. referencedClasses: [],
  4193. //>>excludeEnd("ide");
  4194. messageSends: ["remove:", "last"]
  4195. }),
  4196. $globals.SequenceableCollection);
  4197. $core.addMethod(
  4198. $core.method({
  4199. selector: "reversed",
  4200. protocol: 'converting',
  4201. fn: function (){
  4202. var self=this;
  4203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4204. return $core.withContext(function($ctx1) {
  4205. //>>excludeEnd("ctx");
  4206. self._subclassResponsibility();
  4207. return self;
  4208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4209. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  4210. //>>excludeEnd("ctx");
  4211. },
  4212. //>>excludeStart("ide", pragmas.excludeIdeData);
  4213. args: [],
  4214. source: "reversed\x0a\x09self subclassResponsibility",
  4215. referencedClasses: [],
  4216. //>>excludeEnd("ide");
  4217. messageSends: ["subclassResponsibility"]
  4218. }),
  4219. $globals.SequenceableCollection);
  4220. $core.addMethod(
  4221. $core.method({
  4222. selector: "second",
  4223. protocol: 'accessing',
  4224. fn: function (){
  4225. var self=this;
  4226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4227. return $core.withContext(function($ctx1) {
  4228. //>>excludeEnd("ctx");
  4229. return self._at_((2));
  4230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4231. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  4232. //>>excludeEnd("ctx");
  4233. },
  4234. //>>excludeStart("ide", pragmas.excludeIdeData);
  4235. args: [],
  4236. source: "second\x0a\x09^ self at: 2",
  4237. referencedClasses: [],
  4238. //>>excludeEnd("ide");
  4239. messageSends: ["at:"]
  4240. }),
  4241. $globals.SequenceableCollection);
  4242. $core.addMethod(
  4243. $core.method({
  4244. selector: "stream",
  4245. protocol: 'streaming',
  4246. fn: function (){
  4247. var self=this;
  4248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4249. return $core.withContext(function($ctx1) {
  4250. //>>excludeEnd("ctx");
  4251. return self._newStream();
  4252. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4253. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  4254. //>>excludeEnd("ctx");
  4255. },
  4256. //>>excludeStart("ide", pragmas.excludeIdeData);
  4257. args: [],
  4258. source: "stream\x0a\x09^ self newStream",
  4259. referencedClasses: [],
  4260. //>>excludeEnd("ide");
  4261. messageSends: ["newStream"]
  4262. }),
  4263. $globals.SequenceableCollection);
  4264. $core.addMethod(
  4265. $core.method({
  4266. selector: "streamClass",
  4267. protocol: 'streaming',
  4268. fn: function (){
  4269. var self=this;
  4270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4271. return $core.withContext(function($ctx1) {
  4272. //>>excludeEnd("ctx");
  4273. return $recv(self._class())._streamClass();
  4274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4275. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  4276. //>>excludeEnd("ctx");
  4277. },
  4278. //>>excludeStart("ide", pragmas.excludeIdeData);
  4279. args: [],
  4280. source: "streamClass\x0a\x09^ self class streamClass",
  4281. referencedClasses: [],
  4282. //>>excludeEnd("ide");
  4283. messageSends: ["streamClass", "class"]
  4284. }),
  4285. $globals.SequenceableCollection);
  4286. $core.addMethod(
  4287. $core.method({
  4288. selector: "third",
  4289. protocol: 'accessing',
  4290. fn: function (){
  4291. var self=this;
  4292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4293. return $core.withContext(function($ctx1) {
  4294. //>>excludeEnd("ctx");
  4295. return self._at_((3));
  4296. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4297. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  4298. //>>excludeEnd("ctx");
  4299. },
  4300. //>>excludeStart("ide", pragmas.excludeIdeData);
  4301. args: [],
  4302. source: "third\x0a\x09^ self at: 3",
  4303. referencedClasses: [],
  4304. //>>excludeEnd("ide");
  4305. messageSends: ["at:"]
  4306. }),
  4307. $globals.SequenceableCollection);
  4308. $core.addMethod(
  4309. $core.method({
  4310. selector: "with:do:",
  4311. protocol: 'enumerating',
  4312. fn: function (anotherCollection,aBlock){
  4313. var self=this;
  4314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4315. return $core.withContext(function($ctx1) {
  4316. //>>excludeEnd("ctx");
  4317. self = self._numericallyIndexable();
  4318. anotherCollection = anotherCollection._numericallyIndexable();
  4319. for(var i=0; i<self.length; i++) {
  4320. aBlock._value_value_(self[i], anotherCollection[i]);
  4321. }
  4322. ;
  4323. return self;
  4324. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4325. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  4326. //>>excludeEnd("ctx");
  4327. },
  4328. //>>excludeStart("ide", pragmas.excludeIdeData);
  4329. args: ["anotherCollection", "aBlock"],
  4330. source: "with: anotherCollection do: aBlock\x0a\x09<\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>",
  4331. referencedClasses: [],
  4332. //>>excludeEnd("ide");
  4333. messageSends: []
  4334. }),
  4335. $globals.SequenceableCollection);
  4336. $core.addMethod(
  4337. $core.method({
  4338. selector: "withIndexDo:",
  4339. protocol: 'enumerating',
  4340. fn: function (aBlock){
  4341. var self=this;
  4342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4343. return $core.withContext(function($ctx1) {
  4344. //>>excludeEnd("ctx");
  4345. self = self._numericallyIndexable();
  4346. for(var i=0; i < self.length; i++) {
  4347. aBlock._value_value_(self[i], i+1);
  4348. }
  4349. ;
  4350. return self;
  4351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4352. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  4353. //>>excludeEnd("ctx");
  4354. },
  4355. //>>excludeStart("ide", pragmas.excludeIdeData);
  4356. args: ["aBlock"],
  4357. source: "withIndexDo: aBlock\x0a\x09<\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>",
  4358. referencedClasses: [],
  4359. //>>excludeEnd("ide");
  4360. messageSends: []
  4361. }),
  4362. $globals.SequenceableCollection);
  4363. $core.addMethod(
  4364. $core.method({
  4365. selector: "writeStream",
  4366. protocol: 'streaming',
  4367. fn: function (){
  4368. var self=this;
  4369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4370. return $core.withContext(function($ctx1) {
  4371. //>>excludeEnd("ctx");
  4372. return self._stream();
  4373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4374. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  4375. //>>excludeEnd("ctx");
  4376. },
  4377. //>>excludeStart("ide", pragmas.excludeIdeData);
  4378. args: [],
  4379. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4380. referencedClasses: [],
  4381. //>>excludeEnd("ide");
  4382. messageSends: ["stream"]
  4383. }),
  4384. $globals.SequenceableCollection);
  4385. $core.addMethod(
  4386. $core.method({
  4387. selector: "streamClass",
  4388. protocol: 'accessing',
  4389. fn: function (){
  4390. var self=this;
  4391. function $Stream(){return $globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  4392. return $Stream();
  4393. },
  4394. //>>excludeStart("ide", pragmas.excludeIdeData);
  4395. args: [],
  4396. source: "streamClass\x0a\x09\x09^ Stream",
  4397. referencedClasses: ["Stream"],
  4398. //>>excludeEnd("ide");
  4399. messageSends: []
  4400. }),
  4401. $globals.SequenceableCollection.klass);
  4402. $core.addMethod(
  4403. $core.method({
  4404. selector: "streamContents:",
  4405. protocol: 'streaming',
  4406. fn: function (aBlock){
  4407. var self=this;
  4408. var stream;
  4409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4410. return $core.withContext(function($ctx1) {
  4411. //>>excludeEnd("ctx");
  4412. stream=$recv(self._streamClass())._on_(self._new());
  4413. $recv(aBlock)._value_(stream);
  4414. return $recv(stream)._contents();
  4415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4416. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.klass)});
  4417. //>>excludeEnd("ctx");
  4418. },
  4419. //>>excludeStart("ide", pragmas.excludeIdeData);
  4420. args: ["aBlock"],
  4421. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4422. referencedClasses: [],
  4423. //>>excludeEnd("ide");
  4424. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4425. }),
  4426. $globals.SequenceableCollection.klass);
  4427. $core.addClass('Array', $globals.SequenceableCollection, [], 'Kernel-Collections');
  4428. //>>excludeStart("ide", pragmas.excludeIdeData);
  4429. $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`.";
  4430. //>>excludeEnd("ide");
  4431. $core.addMethod(
  4432. $core.method({
  4433. selector: "add:",
  4434. protocol: 'adding/removing',
  4435. fn: function (anObject){
  4436. var self=this;
  4437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4438. return $core.withContext(function($ctx1) {
  4439. //>>excludeEnd("ctx");
  4440. self.push(anObject); return anObject;;
  4441. return self;
  4442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4443. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  4444. //>>excludeEnd("ctx");
  4445. },
  4446. //>>excludeStart("ide", pragmas.excludeIdeData);
  4447. args: ["anObject"],
  4448. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  4449. referencedClasses: [],
  4450. //>>excludeEnd("ide");
  4451. messageSends: []
  4452. }),
  4453. $globals.Array);
  4454. $core.addMethod(
  4455. $core.method({
  4456. selector: "addAll:",
  4457. protocol: 'adding/removing',
  4458. fn: function (aCollection){
  4459. var self=this;
  4460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4461. return $core.withContext(function($ctx1) {
  4462. //>>excludeEnd("ctx");
  4463. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  4464. else $globals.Array.superclass.fn.prototype._addAll_.call(self, aCollection);
  4465. return aCollection;;
  4466. return self;
  4467. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4468. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  4469. //>>excludeEnd("ctx");
  4470. },
  4471. //>>excludeStart("ide", pragmas.excludeIdeData);
  4472. args: ["aCollection"],
  4473. source: "addAll: aCollection\x0a<\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>",
  4474. referencedClasses: [],
  4475. //>>excludeEnd("ide");
  4476. messageSends: []
  4477. }),
  4478. $globals.Array);
  4479. $core.addMethod(
  4480. $core.method({
  4481. selector: "addFirst:",
  4482. protocol: 'adding/removing',
  4483. fn: function (anObject){
  4484. var self=this;
  4485. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4486. return $core.withContext(function($ctx1) {
  4487. //>>excludeEnd("ctx");
  4488. self.unshift(anObject); return anObject;;
  4489. return self;
  4490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4491. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  4492. //>>excludeEnd("ctx");
  4493. },
  4494. //>>excludeStart("ide", pragmas.excludeIdeData);
  4495. args: ["anObject"],
  4496. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  4497. referencedClasses: [],
  4498. //>>excludeEnd("ide");
  4499. messageSends: []
  4500. }),
  4501. $globals.Array);
  4502. $core.addMethod(
  4503. $core.method({
  4504. selector: "asJavascript",
  4505. protocol: 'converting',
  4506. fn: function (){
  4507. var self=this;
  4508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4509. return $core.withContext(function($ctx1) {
  4510. //>>excludeEnd("ctx");
  4511. var $1;
  4512. $1=$recv("[".__comma($recv(self._collect_((function(each){
  4513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4514. return $core.withContext(function($ctx2) {
  4515. //>>excludeEnd("ctx");
  4516. return $recv(each)._asJavascript();
  4517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4518. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4519. //>>excludeEnd("ctx");
  4520. })))._join_(", "))).__comma("]");
  4521. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4522. $ctx1.sendIdx[","]=1;
  4523. //>>excludeEnd("ctx");
  4524. return $1;
  4525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4526. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.Array)});
  4527. //>>excludeEnd("ctx");
  4528. },
  4529. //>>excludeStart("ide", pragmas.excludeIdeData);
  4530. args: [],
  4531. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  4532. referencedClasses: [],
  4533. //>>excludeEnd("ide");
  4534. messageSends: [",", "join:", "collect:", "asJavascript"]
  4535. }),
  4536. $globals.Array);
  4537. $core.addMethod(
  4538. $core.method({
  4539. selector: "at:ifAbsent:",
  4540. protocol: 'accessing',
  4541. fn: function (anIndex,aBlock){
  4542. var self=this;
  4543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4544. return $core.withContext(function($ctx1) {
  4545. //>>excludeEnd("ctx");
  4546. return anIndex >= 1 && anIndex <= self.length
  4547. ? self[anIndex - 1]
  4548. : aBlock._value()
  4549. ;
  4550. return self;
  4551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4552. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  4553. //>>excludeEnd("ctx");
  4554. },
  4555. //>>excludeStart("ide", pragmas.excludeIdeData);
  4556. args: ["anIndex", "aBlock"],
  4557. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09return anIndex >>= 1 && anIndex <= self.length\x0a\x09\x09\x09? self[anIndex - 1]\x0a\x09\x09\x09: aBlock._value()\x0a\x09>",
  4558. referencedClasses: [],
  4559. //>>excludeEnd("ide");
  4560. messageSends: []
  4561. }),
  4562. $globals.Array);
  4563. $core.addMethod(
  4564. $core.method({
  4565. selector: "at:ifPresent:ifAbsent:",
  4566. protocol: 'accessing',
  4567. fn: function (anIndex,aBlock,anotherBlock){
  4568. var self=this;
  4569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4570. return $core.withContext(function($ctx1) {
  4571. //>>excludeEnd("ctx");
  4572. return anIndex >= 1 && anIndex <= self.length
  4573. ? aBlock._value_(self[anIndex - 1])
  4574. : anotherBlock._value()
  4575. ;
  4576. return self;
  4577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4578. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  4579. //>>excludeEnd("ctx");
  4580. },
  4581. //>>excludeStart("ide", pragmas.excludeIdeData);
  4582. args: ["anIndex", "aBlock", "anotherBlock"],
  4583. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\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>",
  4584. referencedClasses: [],
  4585. //>>excludeEnd("ide");
  4586. messageSends: []
  4587. }),
  4588. $globals.Array);
  4589. $core.addMethod(
  4590. $core.method({
  4591. selector: "at:put:",
  4592. protocol: 'accessing',
  4593. fn: function (anIndex,anObject){
  4594. var self=this;
  4595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4596. return $core.withContext(function($ctx1) {
  4597. //>>excludeEnd("ctx");
  4598. return self[anIndex - 1] = anObject;
  4599. return self;
  4600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4601. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  4602. //>>excludeEnd("ctx");
  4603. },
  4604. //>>excludeStart("ide", pragmas.excludeIdeData);
  4605. args: ["anIndex", "anObject"],
  4606. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  4607. referencedClasses: [],
  4608. //>>excludeEnd("ide");
  4609. messageSends: []
  4610. }),
  4611. $globals.Array);
  4612. $core.addMethod(
  4613. $core.method({
  4614. selector: "collect:",
  4615. protocol: 'enumerating',
  4616. fn: function (aBlock){
  4617. var self=this;
  4618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4619. return $core.withContext(function($ctx1) {
  4620. //>>excludeEnd("ctx");
  4621. return self.map(function(each) {return aBlock._value_(each)});
  4622. return self;
  4623. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4624. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  4625. //>>excludeEnd("ctx");
  4626. },
  4627. //>>excludeStart("ide", pragmas.excludeIdeData);
  4628. args: ["aBlock"],
  4629. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  4630. referencedClasses: [],
  4631. //>>excludeEnd("ide");
  4632. messageSends: []
  4633. }),
  4634. $globals.Array);
  4635. $core.addMethod(
  4636. $core.method({
  4637. selector: "copyFrom:to:",
  4638. protocol: 'copying',
  4639. fn: function (anIndex,anotherIndex){
  4640. var self=this;
  4641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4642. return $core.withContext(function($ctx1) {
  4643. //>>excludeEnd("ctx");
  4644. if (anIndex >= 1 && anotherIndex <= self.length) {
  4645. return self.slice(anIndex - 1, anotherIndex);
  4646. } else {
  4647. self._at_(anIndex);
  4648. self._at_(self.length + 1);
  4649. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  4650. };
  4651. return self;
  4652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4653. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  4654. //>>excludeEnd("ctx");
  4655. },
  4656. //>>excludeStart("ide", pragmas.excludeIdeData);
  4657. args: ["anIndex", "anotherIndex"],
  4658. source: "copyFrom: anIndex to: anotherIndex\x0a<\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>",
  4659. referencedClasses: [],
  4660. //>>excludeEnd("ide");
  4661. messageSends: []
  4662. }),
  4663. $globals.Array);
  4664. $core.addMethod(
  4665. $core.method({
  4666. selector: "join:",
  4667. protocol: 'enumerating',
  4668. fn: function (aString){
  4669. var self=this;
  4670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4671. return $core.withContext(function($ctx1) {
  4672. //>>excludeEnd("ctx");
  4673. return self.join(aString);
  4674. return self;
  4675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4676. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  4677. //>>excludeEnd("ctx");
  4678. },
  4679. //>>excludeStart("ide", pragmas.excludeIdeData);
  4680. args: ["aString"],
  4681. source: "join: aString\x0a\x09<return self.join(aString)>",
  4682. referencedClasses: [],
  4683. //>>excludeEnd("ide");
  4684. messageSends: []
  4685. }),
  4686. $globals.Array);
  4687. $core.addMethod(
  4688. $core.method({
  4689. selector: "numericallyIndexable",
  4690. protocol: 'private',
  4691. fn: function (){
  4692. var self=this;
  4693. return self;
  4694. },
  4695. //>>excludeStart("ide", pragmas.excludeIdeData);
  4696. args: [],
  4697. source: "numericallyIndexable\x0a\x09^ self",
  4698. referencedClasses: [],
  4699. //>>excludeEnd("ide");
  4700. messageSends: []
  4701. }),
  4702. $globals.Array);
  4703. $core.addMethod(
  4704. $core.method({
  4705. selector: "printOn:",
  4706. protocol: 'printing',
  4707. fn: function (aStream){
  4708. var self=this;
  4709. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4710. return $core.withContext(function($ctx1) {
  4711. //>>excludeEnd("ctx");
  4712. (
  4713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4714. $ctx1.supercall = true,
  4715. //>>excludeEnd("ctx");
  4716. ($globals.Array.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  4717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4718. $ctx1.supercall = false;
  4719. //>>excludeEnd("ctx");;
  4720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4721. $ctx1.sendIdx["printOn:"]=1;
  4722. //>>excludeEnd("ctx");
  4723. $recv(aStream)._nextPutAll_(" (");
  4724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4725. $ctx1.sendIdx["nextPutAll:"]=1;
  4726. //>>excludeEnd("ctx");
  4727. self._do_separatedBy_((function(each){
  4728. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4729. return $core.withContext(function($ctx2) {
  4730. //>>excludeEnd("ctx");
  4731. return $recv(each)._printOn_(aStream);
  4732. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4733. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4734. //>>excludeEnd("ctx");
  4735. }),(function(){
  4736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4737. return $core.withContext(function($ctx2) {
  4738. //>>excludeEnd("ctx");
  4739. return $recv(aStream)._nextPutAll_(" ");
  4740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4741. $ctx2.sendIdx["nextPutAll:"]=2;
  4742. //>>excludeEnd("ctx");
  4743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4744. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4745. //>>excludeEnd("ctx");
  4746. }));
  4747. $recv(aStream)._nextPutAll_(")");
  4748. return self;
  4749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4750. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  4751. //>>excludeEnd("ctx");
  4752. },
  4753. //>>excludeStart("ide", pragmas.excludeIdeData);
  4754. args: ["aStream"],
  4755. 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: ')'",
  4756. referencedClasses: [],
  4757. //>>excludeEnd("ide");
  4758. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4759. }),
  4760. $globals.Array);
  4761. $core.addMethod(
  4762. $core.method({
  4763. selector: "remove:ifAbsent:",
  4764. protocol: 'adding/removing',
  4765. fn: function (anObject,aBlock){
  4766. var self=this;
  4767. var index;
  4768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4769. return $core.withContext(function($ctx1) {
  4770. //>>excludeEnd("ctx");
  4771. var $1;
  4772. index=self._indexOf_ifAbsent_(anObject,(function(){
  4773. return (0);
  4774. }));
  4775. $1=$recv(index).__eq((0));
  4776. if($core.assert($1)){
  4777. return $recv(aBlock)._value();
  4778. } else {
  4779. self._removeIndex_(index);
  4780. return anObject;
  4781. };
  4782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4783. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  4784. //>>excludeEnd("ctx");
  4785. },
  4786. //>>excludeStart("ide", pragmas.excludeIdeData);
  4787. args: ["anObject", "aBlock"],
  4788. 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 ]",
  4789. referencedClasses: [],
  4790. //>>excludeEnd("ide");
  4791. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4792. }),
  4793. $globals.Array);
  4794. $core.addMethod(
  4795. $core.method({
  4796. selector: "removeAll",
  4797. protocol: 'adding/removing',
  4798. fn: function (){
  4799. var self=this;
  4800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4801. return $core.withContext(function($ctx1) {
  4802. //>>excludeEnd("ctx");
  4803. self.length = 0;
  4804. return self;
  4805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4806. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  4807. //>>excludeEnd("ctx");
  4808. },
  4809. //>>excludeStart("ide", pragmas.excludeIdeData);
  4810. args: [],
  4811. source: "removeAll\x0a\x09<self.length = 0>",
  4812. referencedClasses: [],
  4813. //>>excludeEnd("ide");
  4814. messageSends: []
  4815. }),
  4816. $globals.Array);
  4817. $core.addMethod(
  4818. $core.method({
  4819. selector: "removeFrom:to:",
  4820. protocol: 'adding/removing',
  4821. fn: function (aNumber,anotherNumber){
  4822. var self=this;
  4823. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4824. return $core.withContext(function($ctx1) {
  4825. //>>excludeEnd("ctx");
  4826. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4827. return self;
  4828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4829. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  4830. //>>excludeEnd("ctx");
  4831. },
  4832. //>>excludeStart("ide", pragmas.excludeIdeData);
  4833. args: ["aNumber", "anotherNumber"],
  4834. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  4835. referencedClasses: [],
  4836. //>>excludeEnd("ide");
  4837. messageSends: []
  4838. }),
  4839. $globals.Array);
  4840. $core.addMethod(
  4841. $core.method({
  4842. selector: "removeIndex:",
  4843. protocol: 'adding/removing',
  4844. fn: function (anInteger){
  4845. var self=this;
  4846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4847. return $core.withContext(function($ctx1) {
  4848. //>>excludeEnd("ctx");
  4849. self.splice(anInteger - 1, 1);
  4850. return self;
  4851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4852. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  4853. //>>excludeEnd("ctx");
  4854. },
  4855. //>>excludeStart("ide", pragmas.excludeIdeData);
  4856. args: ["anInteger"],
  4857. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  4858. referencedClasses: [],
  4859. //>>excludeEnd("ide");
  4860. messageSends: []
  4861. }),
  4862. $globals.Array);
  4863. $core.addMethod(
  4864. $core.method({
  4865. selector: "removeLast",
  4866. protocol: 'adding/removing',
  4867. fn: function (){
  4868. var self=this;
  4869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4870. return $core.withContext(function($ctx1) {
  4871. //>>excludeEnd("ctx");
  4872. return self.pop();;
  4873. return self;
  4874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4875. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  4876. //>>excludeEnd("ctx");
  4877. },
  4878. //>>excludeStart("ide", pragmas.excludeIdeData);
  4879. args: [],
  4880. source: "removeLast\x0a\x09<return self.pop();>",
  4881. referencedClasses: [],
  4882. //>>excludeEnd("ide");
  4883. messageSends: []
  4884. }),
  4885. $globals.Array);
  4886. $core.addMethod(
  4887. $core.method({
  4888. selector: "reversed",
  4889. protocol: 'converting',
  4890. fn: function (){
  4891. var self=this;
  4892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4893. return $core.withContext(function($ctx1) {
  4894. //>>excludeEnd("ctx");
  4895. return self.slice().reverse();
  4896. return self;
  4897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4898. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  4899. //>>excludeEnd("ctx");
  4900. },
  4901. //>>excludeStart("ide", pragmas.excludeIdeData);
  4902. args: [],
  4903. source: "reversed\x0a\x09<return self.slice().reverse()>",
  4904. referencedClasses: [],
  4905. //>>excludeEnd("ide");
  4906. messageSends: []
  4907. }),
  4908. $globals.Array);
  4909. $core.addMethod(
  4910. $core.method({
  4911. selector: "select:",
  4912. protocol: 'enumerating',
  4913. fn: function (aBlock){
  4914. var self=this;
  4915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4916. return $core.withContext(function($ctx1) {
  4917. //>>excludeEnd("ctx");
  4918. return self.filter(function(each) {return aBlock._value_(each)});
  4919. return self;
  4920. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4921. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  4922. //>>excludeEnd("ctx");
  4923. },
  4924. //>>excludeStart("ide", pragmas.excludeIdeData);
  4925. args: ["aBlock"],
  4926. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.filter(function(each) {return aBlock._value_(each)})>",
  4927. referencedClasses: [],
  4928. //>>excludeEnd("ide");
  4929. messageSends: []
  4930. }),
  4931. $globals.Array);
  4932. $core.addMethod(
  4933. $core.method({
  4934. selector: "shallowCopy",
  4935. protocol: 'copying',
  4936. fn: function (){
  4937. var self=this;
  4938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4939. return $core.withContext(function($ctx1) {
  4940. //>>excludeEnd("ctx");
  4941. return self.slice();
  4942. return self;
  4943. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4944. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  4945. //>>excludeEnd("ctx");
  4946. },
  4947. //>>excludeStart("ide", pragmas.excludeIdeData);
  4948. args: [],
  4949. source: "shallowCopy\x0a\x09<return self.slice()>",
  4950. referencedClasses: [],
  4951. //>>excludeEnd("ide");
  4952. messageSends: []
  4953. }),
  4954. $globals.Array);
  4955. $core.addMethod(
  4956. $core.method({
  4957. selector: "size",
  4958. protocol: 'accessing',
  4959. fn: function (){
  4960. var self=this;
  4961. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4962. return $core.withContext(function($ctx1) {
  4963. //>>excludeEnd("ctx");
  4964. return self.length;
  4965. return self;
  4966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4967. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  4968. //>>excludeEnd("ctx");
  4969. },
  4970. //>>excludeStart("ide", pragmas.excludeIdeData);
  4971. args: [],
  4972. source: "size\x0a\x09<return self.length>",
  4973. referencedClasses: [],
  4974. //>>excludeEnd("ide");
  4975. messageSends: []
  4976. }),
  4977. $globals.Array);
  4978. $core.addMethod(
  4979. $core.method({
  4980. selector: "sort",
  4981. protocol: 'enumerating',
  4982. fn: function (){
  4983. var self=this;
  4984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4985. return $core.withContext(function($ctx1) {
  4986. //>>excludeEnd("ctx");
  4987. return self._sort_((function(a,b){
  4988. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4989. return $core.withContext(function($ctx2) {
  4990. //>>excludeEnd("ctx");
  4991. return $recv(a).__lt(b);
  4992. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4993. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  4994. //>>excludeEnd("ctx");
  4995. }));
  4996. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4997. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  4998. //>>excludeEnd("ctx");
  4999. },
  5000. //>>excludeStart("ide", pragmas.excludeIdeData);
  5001. args: [],
  5002. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5003. referencedClasses: [],
  5004. //>>excludeEnd("ide");
  5005. messageSends: ["sort:", "<"]
  5006. }),
  5007. $globals.Array);
  5008. $core.addMethod(
  5009. $core.method({
  5010. selector: "sort:",
  5011. protocol: 'enumerating',
  5012. fn: function (aBlock){
  5013. var self=this;
  5014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5015. return $core.withContext(function($ctx1) {
  5016. //>>excludeEnd("ctx");
  5017. return self.sort(function(a, b) {
  5018. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5019. })
  5020. ;
  5021. return self;
  5022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5023. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  5024. //>>excludeEnd("ctx");
  5025. },
  5026. //>>excludeStart("ide", pragmas.excludeIdeData);
  5027. args: ["aBlock"],
  5028. source: "sort: aBlock\x0a\x09<\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>",
  5029. referencedClasses: [],
  5030. //>>excludeEnd("ide");
  5031. messageSends: []
  5032. }),
  5033. $globals.Array);
  5034. $core.addMethod(
  5035. $core.method({
  5036. selector: "sorted",
  5037. protocol: 'enumerating',
  5038. fn: function (){
  5039. var self=this;
  5040. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5041. return $core.withContext(function($ctx1) {
  5042. //>>excludeEnd("ctx");
  5043. return $recv(self._copy())._sort();
  5044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5045. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  5046. //>>excludeEnd("ctx");
  5047. },
  5048. //>>excludeStart("ide", pragmas.excludeIdeData);
  5049. args: [],
  5050. source: "sorted\x0a\x09^ self copy sort",
  5051. referencedClasses: [],
  5052. //>>excludeEnd("ide");
  5053. messageSends: ["sort", "copy"]
  5054. }),
  5055. $globals.Array);
  5056. $core.addMethod(
  5057. $core.method({
  5058. selector: "sorted:",
  5059. protocol: 'enumerating',
  5060. fn: function (aBlock){
  5061. var self=this;
  5062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5063. return $core.withContext(function($ctx1) {
  5064. //>>excludeEnd("ctx");
  5065. return $recv(self._copy())._sort_(aBlock);
  5066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5067. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  5068. //>>excludeEnd("ctx");
  5069. },
  5070. //>>excludeStart("ide", pragmas.excludeIdeData);
  5071. args: ["aBlock"],
  5072. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5073. referencedClasses: [],
  5074. //>>excludeEnd("ide");
  5075. messageSends: ["sort:", "copy"]
  5076. }),
  5077. $globals.Array);
  5078. $core.addMethod(
  5079. $core.method({
  5080. selector: "new:",
  5081. protocol: 'instance creation',
  5082. fn: function (anInteger){
  5083. var self=this;
  5084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5085. return $core.withContext(function($ctx1) {
  5086. //>>excludeEnd("ctx");
  5087. return new Array(anInteger);
  5088. return self;
  5089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5090. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.klass)});
  5091. //>>excludeEnd("ctx");
  5092. },
  5093. //>>excludeStart("ide", pragmas.excludeIdeData);
  5094. args: ["anInteger"],
  5095. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  5096. referencedClasses: [],
  5097. //>>excludeEnd("ide");
  5098. messageSends: []
  5099. }),
  5100. $globals.Array.klass);
  5101. $core.addMethod(
  5102. $core.method({
  5103. selector: "with:",
  5104. protocol: 'instance creation',
  5105. fn: function (anObject){
  5106. var self=this;
  5107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5108. return $core.withContext(function($ctx1) {
  5109. //>>excludeEnd("ctx");
  5110. var $1;
  5111. $1=self._new_((1));
  5112. $recv($1)._at_put_((1),anObject);
  5113. return $recv($1)._yourself();
  5114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5115. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.klass)});
  5116. //>>excludeEnd("ctx");
  5117. },
  5118. //>>excludeStart("ide", pragmas.excludeIdeData);
  5119. args: ["anObject"],
  5120. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5121. referencedClasses: [],
  5122. //>>excludeEnd("ide");
  5123. messageSends: ["at:put:", "new:", "yourself"]
  5124. }),
  5125. $globals.Array.klass);
  5126. $core.addMethod(
  5127. $core.method({
  5128. selector: "with:with:",
  5129. protocol: 'instance creation',
  5130. fn: function (anObject,anObject2){
  5131. var self=this;
  5132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5133. return $core.withContext(function($ctx1) {
  5134. //>>excludeEnd("ctx");
  5135. var $1;
  5136. $1=self._new_((2));
  5137. $recv($1)._at_put_((1),anObject);
  5138. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5139. $ctx1.sendIdx["at:put:"]=1;
  5140. //>>excludeEnd("ctx");
  5141. $recv($1)._at_put_((2),anObject2);
  5142. return $recv($1)._yourself();
  5143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5144. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.klass)});
  5145. //>>excludeEnd("ctx");
  5146. },
  5147. //>>excludeStart("ide", pragmas.excludeIdeData);
  5148. args: ["anObject", "anObject2"],
  5149. 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",
  5150. referencedClasses: [],
  5151. //>>excludeEnd("ide");
  5152. messageSends: ["at:put:", "new:", "yourself"]
  5153. }),
  5154. $globals.Array.klass);
  5155. $core.addMethod(
  5156. $core.method({
  5157. selector: "with:with:with:",
  5158. protocol: 'instance creation',
  5159. fn: function (anObject,anObject2,anObject3){
  5160. var self=this;
  5161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5162. return $core.withContext(function($ctx1) {
  5163. //>>excludeEnd("ctx");
  5164. var $1;
  5165. $1=self._new_((3));
  5166. $recv($1)._at_put_((1),anObject);
  5167. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5168. $ctx1.sendIdx["at:put:"]=1;
  5169. //>>excludeEnd("ctx");
  5170. $recv($1)._at_put_((2),anObject2);
  5171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5172. $ctx1.sendIdx["at:put:"]=2;
  5173. //>>excludeEnd("ctx");
  5174. $recv($1)._at_put_((3),anObject3);
  5175. return $recv($1)._yourself();
  5176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5177. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.klass)});
  5178. //>>excludeEnd("ctx");
  5179. },
  5180. //>>excludeStart("ide", pragmas.excludeIdeData);
  5181. args: ["anObject", "anObject2", "anObject3"],
  5182. 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",
  5183. referencedClasses: [],
  5184. //>>excludeEnd("ide");
  5185. messageSends: ["at:put:", "new:", "yourself"]
  5186. }),
  5187. $globals.Array.klass);
  5188. $core.addMethod(
  5189. $core.method({
  5190. selector: "withAll:",
  5191. protocol: 'instance creation',
  5192. fn: function (aCollection){
  5193. var self=this;
  5194. var instance,index;
  5195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5196. return $core.withContext(function($ctx1) {
  5197. //>>excludeEnd("ctx");
  5198. index=(1);
  5199. instance=self._new_($recv(aCollection)._size());
  5200. $recv(aCollection)._do_((function(each){
  5201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5202. return $core.withContext(function($ctx2) {
  5203. //>>excludeEnd("ctx");
  5204. $recv(instance)._at_put_(index,each);
  5205. index=$recv(index).__plus((1));
  5206. return index;
  5207. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5209. //>>excludeEnd("ctx");
  5210. }));
  5211. return instance;
  5212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5213. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.klass)});
  5214. //>>excludeEnd("ctx");
  5215. },
  5216. //>>excludeStart("ide", pragmas.excludeIdeData);
  5217. args: ["aCollection"],
  5218. 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",
  5219. referencedClasses: [],
  5220. //>>excludeEnd("ide");
  5221. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5222. }),
  5223. $globals.Array.klass);
  5224. $core.addClass('CharacterArray', $globals.SequenceableCollection, [], 'Kernel-Collections');
  5225. //>>excludeStart("ide", pragmas.excludeIdeData);
  5226. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5227. //>>excludeEnd("ide");
  5228. $core.addMethod(
  5229. $core.method({
  5230. selector: ",",
  5231. protocol: 'copying',
  5232. fn: function (aString){
  5233. var self=this;
  5234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5235. return $core.withContext(function($ctx1) {
  5236. //>>excludeEnd("ctx");
  5237. var $1;
  5238. $1=self._asString();
  5239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5240. $ctx1.sendIdx["asString"]=1;
  5241. //>>excludeEnd("ctx");
  5242. return $recv($1).__comma($recv(aString)._asString());
  5243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5244. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  5245. //>>excludeEnd("ctx");
  5246. },
  5247. //>>excludeStart("ide", pragmas.excludeIdeData);
  5248. args: ["aString"],
  5249. source: ", aString\x0a\x09^ self asString, aString asString",
  5250. referencedClasses: [],
  5251. //>>excludeEnd("ide");
  5252. messageSends: [",", "asString"]
  5253. }),
  5254. $globals.CharacterArray);
  5255. $core.addMethod(
  5256. $core.method({
  5257. selector: "add:",
  5258. protocol: 'adding/removing',
  5259. fn: function (anObject){
  5260. var self=this;
  5261. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5262. return $core.withContext(function($ctx1) {
  5263. //>>excludeEnd("ctx");
  5264. self._errorReadOnly();
  5265. return self;
  5266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5267. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  5268. //>>excludeEnd("ctx");
  5269. },
  5270. //>>excludeStart("ide", pragmas.excludeIdeData);
  5271. args: ["anObject"],
  5272. source: "add: anObject\x0a\x09self errorReadOnly",
  5273. referencedClasses: [],
  5274. //>>excludeEnd("ide");
  5275. messageSends: ["errorReadOnly"]
  5276. }),
  5277. $globals.CharacterArray);
  5278. $core.addMethod(
  5279. $core.method({
  5280. selector: "asLowercase",
  5281. protocol: 'converting',
  5282. fn: function (){
  5283. var self=this;
  5284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5285. return $core.withContext(function($ctx1) {
  5286. //>>excludeEnd("ctx");
  5287. return $recv(self._class())._fromString_($recv(self._asString())._asLowercase());
  5288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5289. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  5290. //>>excludeEnd("ctx");
  5291. },
  5292. //>>excludeStart("ide", pragmas.excludeIdeData);
  5293. args: [],
  5294. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5295. referencedClasses: [],
  5296. //>>excludeEnd("ide");
  5297. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5298. }),
  5299. $globals.CharacterArray);
  5300. $core.addMethod(
  5301. $core.method({
  5302. selector: "asNumber",
  5303. protocol: 'converting',
  5304. fn: function (){
  5305. var self=this;
  5306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5307. return $core.withContext(function($ctx1) {
  5308. //>>excludeEnd("ctx");
  5309. return $recv(self._asString())._asNumber();
  5310. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5311. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  5312. //>>excludeEnd("ctx");
  5313. },
  5314. //>>excludeStart("ide", pragmas.excludeIdeData);
  5315. args: [],
  5316. source: "asNumber\x0a\x09^ self asString asNumber",
  5317. referencedClasses: [],
  5318. //>>excludeEnd("ide");
  5319. messageSends: ["asNumber", "asString"]
  5320. }),
  5321. $globals.CharacterArray);
  5322. $core.addMethod(
  5323. $core.method({
  5324. selector: "asString",
  5325. protocol: 'converting',
  5326. fn: function (){
  5327. var self=this;
  5328. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5329. return $core.withContext(function($ctx1) {
  5330. //>>excludeEnd("ctx");
  5331. return self._subclassResponsibility();
  5332. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5333. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  5334. //>>excludeEnd("ctx");
  5335. },
  5336. //>>excludeStart("ide", pragmas.excludeIdeData);
  5337. args: [],
  5338. source: "asString\x0a\x09^ self subclassResponsibility",
  5339. referencedClasses: [],
  5340. //>>excludeEnd("ide");
  5341. messageSends: ["subclassResponsibility"]
  5342. }),
  5343. $globals.CharacterArray);
  5344. $core.addMethod(
  5345. $core.method({
  5346. selector: "asSymbol",
  5347. protocol: 'converting',
  5348. fn: function (){
  5349. var self=this;
  5350. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5351. return $core.withContext(function($ctx1) {
  5352. //>>excludeEnd("ctx");
  5353. return self._asString();
  5354. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5355. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  5356. //>>excludeEnd("ctx");
  5357. },
  5358. //>>excludeStart("ide", pragmas.excludeIdeData);
  5359. args: [],
  5360. source: "asSymbol\x0a\x09^ self asString",
  5361. referencedClasses: [],
  5362. //>>excludeEnd("ide");
  5363. messageSends: ["asString"]
  5364. }),
  5365. $globals.CharacterArray);
  5366. $core.addMethod(
  5367. $core.method({
  5368. selector: "asUppercase",
  5369. protocol: 'converting',
  5370. fn: function (){
  5371. var self=this;
  5372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5373. return $core.withContext(function($ctx1) {
  5374. //>>excludeEnd("ctx");
  5375. return $recv(self._class())._fromString_($recv(self._asString())._asUppercase());
  5376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5377. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  5378. //>>excludeEnd("ctx");
  5379. },
  5380. //>>excludeStart("ide", pragmas.excludeIdeData);
  5381. args: [],
  5382. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5383. referencedClasses: [],
  5384. //>>excludeEnd("ide");
  5385. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5386. }),
  5387. $globals.CharacterArray);
  5388. $core.addMethod(
  5389. $core.method({
  5390. selector: "at:put:",
  5391. protocol: 'accessing',
  5392. fn: function (anIndex,anObject){
  5393. var self=this;
  5394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5395. return $core.withContext(function($ctx1) {
  5396. //>>excludeEnd("ctx");
  5397. self._errorReadOnly();
  5398. return self;
  5399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5400. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  5401. //>>excludeEnd("ctx");
  5402. },
  5403. //>>excludeStart("ide", pragmas.excludeIdeData);
  5404. args: ["anIndex", "anObject"],
  5405. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5406. referencedClasses: [],
  5407. //>>excludeEnd("ide");
  5408. messageSends: ["errorReadOnly"]
  5409. }),
  5410. $globals.CharacterArray);
  5411. $core.addMethod(
  5412. $core.method({
  5413. selector: "errorReadOnly",
  5414. protocol: 'error handling',
  5415. fn: function (){
  5416. var self=this;
  5417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5418. return $core.withContext(function($ctx1) {
  5419. //>>excludeEnd("ctx");
  5420. self._error_("Object is read-only");
  5421. return self;
  5422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5423. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  5424. //>>excludeEnd("ctx");
  5425. },
  5426. //>>excludeStart("ide", pragmas.excludeIdeData);
  5427. args: [],
  5428. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5429. referencedClasses: [],
  5430. //>>excludeEnd("ide");
  5431. messageSends: ["error:"]
  5432. }),
  5433. $globals.CharacterArray);
  5434. $core.addMethod(
  5435. $core.method({
  5436. selector: "printOn:",
  5437. protocol: 'printing',
  5438. fn: function (aStream){
  5439. var self=this;
  5440. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5441. return $core.withContext(function($ctx1) {
  5442. //>>excludeEnd("ctx");
  5443. $recv(self._asString())._printOn_(aStream);
  5444. return self;
  5445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5446. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  5447. //>>excludeEnd("ctx");
  5448. },
  5449. //>>excludeStart("ide", pragmas.excludeIdeData);
  5450. args: ["aStream"],
  5451. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5452. referencedClasses: [],
  5453. //>>excludeEnd("ide");
  5454. messageSends: ["printOn:", "asString"]
  5455. }),
  5456. $globals.CharacterArray);
  5457. $core.addMethod(
  5458. $core.method({
  5459. selector: "putOn:",
  5460. protocol: 'streaming',
  5461. fn: function (aStream){
  5462. var self=this;
  5463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5464. return $core.withContext(function($ctx1) {
  5465. //>>excludeEnd("ctx");
  5466. $recv(aStream)._nextPutString_(self);
  5467. return self;
  5468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5469. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  5470. //>>excludeEnd("ctx");
  5471. },
  5472. //>>excludeStart("ide", pragmas.excludeIdeData);
  5473. args: ["aStream"],
  5474. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5475. referencedClasses: [],
  5476. //>>excludeEnd("ide");
  5477. messageSends: ["nextPutString:"]
  5478. }),
  5479. $globals.CharacterArray);
  5480. $core.addMethod(
  5481. $core.method({
  5482. selector: "remove:",
  5483. protocol: 'adding/removing',
  5484. fn: function (anObject){
  5485. var self=this;
  5486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5487. return $core.withContext(function($ctx1) {
  5488. //>>excludeEnd("ctx");
  5489. self._errorReadOnly();
  5490. return self;
  5491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5492. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  5493. //>>excludeEnd("ctx");
  5494. },
  5495. //>>excludeStart("ide", pragmas.excludeIdeData);
  5496. args: ["anObject"],
  5497. source: "remove: anObject\x0a\x09self errorReadOnly",
  5498. referencedClasses: [],
  5499. //>>excludeEnd("ide");
  5500. messageSends: ["errorReadOnly"]
  5501. }),
  5502. $globals.CharacterArray);
  5503. $core.addMethod(
  5504. $core.method({
  5505. selector: "fromString:",
  5506. protocol: 'instance creation',
  5507. fn: function (aString){
  5508. var self=this;
  5509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5510. return $core.withContext(function($ctx1) {
  5511. //>>excludeEnd("ctx");
  5512. self._subclassResponsibility();
  5513. return self;
  5514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5515. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.klass)});
  5516. //>>excludeEnd("ctx");
  5517. },
  5518. //>>excludeStart("ide", pragmas.excludeIdeData);
  5519. args: ["aString"],
  5520. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5521. referencedClasses: [],
  5522. //>>excludeEnd("ide");
  5523. messageSends: ["subclassResponsibility"]
  5524. }),
  5525. $globals.CharacterArray.klass);
  5526. $core.addClass('String', $globals.CharacterArray, [], 'Kernel-Collections');
  5527. //>>excludeStart("ide", pragmas.excludeIdeData);
  5528. $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 >> #,`";
  5529. //>>excludeEnd("ide");
  5530. $core.addMethod(
  5531. $core.method({
  5532. selector: ",",
  5533. protocol: 'copying',
  5534. fn: function (aString){
  5535. var self=this;
  5536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5537. return $core.withContext(function($ctx1) {
  5538. //>>excludeEnd("ctx");
  5539. return String(self) + aString;
  5540. return self;
  5541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5542. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  5543. //>>excludeEnd("ctx");
  5544. },
  5545. //>>excludeStart("ide", pragmas.excludeIdeData);
  5546. args: ["aString"],
  5547. source: ", aString\x0a\x09<return String(self) + aString>",
  5548. referencedClasses: [],
  5549. //>>excludeEnd("ide");
  5550. messageSends: []
  5551. }),
  5552. $globals.String);
  5553. $core.addMethod(
  5554. $core.method({
  5555. selector: "<",
  5556. protocol: 'comparing',
  5557. fn: function (aString){
  5558. var self=this;
  5559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5560. return $core.withContext(function($ctx1) {
  5561. //>>excludeEnd("ctx");
  5562. return String(self) < aString._asString();
  5563. return self;
  5564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5565. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  5566. //>>excludeEnd("ctx");
  5567. },
  5568. //>>excludeStart("ide", pragmas.excludeIdeData);
  5569. args: ["aString"],
  5570. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  5571. referencedClasses: [],
  5572. //>>excludeEnd("ide");
  5573. messageSends: []
  5574. }),
  5575. $globals.String);
  5576. $core.addMethod(
  5577. $core.method({
  5578. selector: "<=",
  5579. protocol: 'comparing',
  5580. fn: function (aString){
  5581. var self=this;
  5582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5583. return $core.withContext(function($ctx1) {
  5584. //>>excludeEnd("ctx");
  5585. return String(self) <= aString._asString();
  5586. return self;
  5587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5588. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  5589. //>>excludeEnd("ctx");
  5590. },
  5591. //>>excludeStart("ide", pragmas.excludeIdeData);
  5592. args: ["aString"],
  5593. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  5594. referencedClasses: [],
  5595. //>>excludeEnd("ide");
  5596. messageSends: []
  5597. }),
  5598. $globals.String);
  5599. $core.addMethod(
  5600. $core.method({
  5601. selector: "=",
  5602. protocol: 'comparing',
  5603. fn: function (aString){
  5604. var self=this;
  5605. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5606. return $core.withContext(function($ctx1) {
  5607. //>>excludeEnd("ctx");
  5608. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5609. return self;
  5610. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5611. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  5612. //>>excludeEnd("ctx");
  5613. },
  5614. //>>excludeStart("ide", pragmas.excludeIdeData);
  5615. args: ["aString"],
  5616. source: "= aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  5617. referencedClasses: [],
  5618. //>>excludeEnd("ide");
  5619. messageSends: []
  5620. }),
  5621. $globals.String);
  5622. $core.addMethod(
  5623. $core.method({
  5624. selector: "==",
  5625. protocol: 'comparing',
  5626. fn: function (aString){
  5627. var self=this;
  5628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5629. return $core.withContext(function($ctx1) {
  5630. //>>excludeEnd("ctx");
  5631. if (typeof aString === "string") return String(self) === aString;
  5632. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  5633. else return false;;
  5634. return self;
  5635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5636. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5637. //>>excludeEnd("ctx");
  5638. },
  5639. //>>excludeStart("ide", pragmas.excludeIdeData);
  5640. args: ["aString"],
  5641. source: "== aString\x0a<\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>",
  5642. referencedClasses: [],
  5643. //>>excludeEnd("ide");
  5644. messageSends: []
  5645. }),
  5646. $globals.String);
  5647. $core.addMethod(
  5648. $core.method({
  5649. selector: ">",
  5650. protocol: 'comparing',
  5651. fn: function (aString){
  5652. var self=this;
  5653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5654. return $core.withContext(function($ctx1) {
  5655. //>>excludeEnd("ctx");
  5656. return String(self) > aString._asString();
  5657. return self;
  5658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5659. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5660. //>>excludeEnd("ctx");
  5661. },
  5662. //>>excludeStart("ide", pragmas.excludeIdeData);
  5663. args: ["aString"],
  5664. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  5665. referencedClasses: [],
  5666. //>>excludeEnd("ide");
  5667. messageSends: []
  5668. }),
  5669. $globals.String);
  5670. $core.addMethod(
  5671. $core.method({
  5672. selector: ">=",
  5673. protocol: 'comparing',
  5674. fn: function (aString){
  5675. var self=this;
  5676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5677. return $core.withContext(function($ctx1) {
  5678. //>>excludeEnd("ctx");
  5679. return String(self) >= aString._asString();
  5680. return self;
  5681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5682. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5683. //>>excludeEnd("ctx");
  5684. },
  5685. //>>excludeStart("ide", pragmas.excludeIdeData);
  5686. args: ["aString"],
  5687. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  5688. referencedClasses: [],
  5689. //>>excludeEnd("ide");
  5690. messageSends: []
  5691. }),
  5692. $globals.String);
  5693. $core.addMethod(
  5694. $core.method({
  5695. selector: "asJSON",
  5696. protocol: 'converting',
  5697. fn: function (){
  5698. var self=this;
  5699. return self;
  5700. },
  5701. //>>excludeStart("ide", pragmas.excludeIdeData);
  5702. args: [],
  5703. source: "asJSON\x0a\x09^ self",
  5704. referencedClasses: [],
  5705. //>>excludeEnd("ide");
  5706. messageSends: []
  5707. }),
  5708. $globals.String);
  5709. $core.addMethod(
  5710. $core.method({
  5711. selector: "asJavaScriptMethodName",
  5712. protocol: 'converting',
  5713. fn: function (){
  5714. var self=this;
  5715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5716. return $core.withContext(function($ctx1) {
  5717. //>>excludeEnd("ctx");
  5718. return $core.st2js(self);
  5719. return self;
  5720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5721. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5722. //>>excludeEnd("ctx");
  5723. },
  5724. //>>excludeStart("ide", pragmas.excludeIdeData);
  5725. args: [],
  5726. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  5727. referencedClasses: [],
  5728. //>>excludeEnd("ide");
  5729. messageSends: []
  5730. }),
  5731. $globals.String);
  5732. $core.addMethod(
  5733. $core.method({
  5734. selector: "asJavascript",
  5735. protocol: 'converting',
  5736. fn: function (){
  5737. var self=this;
  5738. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5739. return $core.withContext(function($ctx1) {
  5740. //>>excludeEnd("ctx");
  5741. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5742. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5743. else
  5744. return "\"" + self + "\"";
  5745. ;
  5746. return self;
  5747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5748. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  5749. //>>excludeEnd("ctx");
  5750. },
  5751. //>>excludeStart("ide", pragmas.excludeIdeData);
  5752. args: [],
  5753. source: "asJavascript\x0a\x09<\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>",
  5754. referencedClasses: [],
  5755. //>>excludeEnd("ide");
  5756. messageSends: []
  5757. }),
  5758. $globals.String);
  5759. $core.addMethod(
  5760. $core.method({
  5761. selector: "asLowercase",
  5762. protocol: 'converting',
  5763. fn: function (){
  5764. var self=this;
  5765. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5766. return $core.withContext(function($ctx1) {
  5767. //>>excludeEnd("ctx");
  5768. return self.toLowerCase();
  5769. return self;
  5770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5771. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5772. //>>excludeEnd("ctx");
  5773. },
  5774. //>>excludeStart("ide", pragmas.excludeIdeData);
  5775. args: [],
  5776. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  5777. referencedClasses: [],
  5778. //>>excludeEnd("ide");
  5779. messageSends: []
  5780. }),
  5781. $globals.String);
  5782. $core.addMethod(
  5783. $core.method({
  5784. selector: "asMutator",
  5785. protocol: 'converting',
  5786. fn: function (){
  5787. var self=this;
  5788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5789. return $core.withContext(function($ctx1) {
  5790. //>>excludeEnd("ctx");
  5791. var $1;
  5792. $1=$recv(self._last()).__eq(":");
  5793. if(!$core.assert($1)){
  5794. return self.__comma(":");
  5795. };
  5796. return self;
  5797. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5798. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5799. //>>excludeEnd("ctx");
  5800. },
  5801. //>>excludeStart("ide", pragmas.excludeIdeData);
  5802. args: [],
  5803. 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",
  5804. referencedClasses: [],
  5805. //>>excludeEnd("ide");
  5806. messageSends: ["ifFalse:", "=", "last", ","]
  5807. }),
  5808. $globals.String);
  5809. $core.addMethod(
  5810. $core.method({
  5811. selector: "asNumber",
  5812. protocol: 'converting',
  5813. fn: function (){
  5814. var self=this;
  5815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5816. return $core.withContext(function($ctx1) {
  5817. //>>excludeEnd("ctx");
  5818. return Number(self);
  5819. return self;
  5820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5821. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5822. //>>excludeEnd("ctx");
  5823. },
  5824. //>>excludeStart("ide", pragmas.excludeIdeData);
  5825. args: [],
  5826. source: "asNumber\x0a\x09<return Number(self)>",
  5827. referencedClasses: [],
  5828. //>>excludeEnd("ide");
  5829. messageSends: []
  5830. }),
  5831. $globals.String);
  5832. $core.addMethod(
  5833. $core.method({
  5834. selector: "asRegexp",
  5835. protocol: 'converting',
  5836. fn: function (){
  5837. var self=this;
  5838. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  5839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5840. return $core.withContext(function($ctx1) {
  5841. //>>excludeEnd("ctx");
  5842. return $recv($RegularExpression())._fromString_(self);
  5843. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5844. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5845. //>>excludeEnd("ctx");
  5846. },
  5847. //>>excludeStart("ide", pragmas.excludeIdeData);
  5848. args: [],
  5849. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5850. referencedClasses: ["RegularExpression"],
  5851. //>>excludeEnd("ide");
  5852. messageSends: ["fromString:"]
  5853. }),
  5854. $globals.String);
  5855. $core.addMethod(
  5856. $core.method({
  5857. selector: "asString",
  5858. protocol: 'converting',
  5859. fn: function (){
  5860. var self=this;
  5861. return self;
  5862. },
  5863. //>>excludeStart("ide", pragmas.excludeIdeData);
  5864. args: [],
  5865. source: "asString\x0a\x09^ self",
  5866. referencedClasses: [],
  5867. //>>excludeEnd("ide");
  5868. messageSends: []
  5869. }),
  5870. $globals.String);
  5871. $core.addMethod(
  5872. $core.method({
  5873. selector: "asSymbol",
  5874. protocol: 'converting',
  5875. fn: function (){
  5876. var self=this;
  5877. return self;
  5878. },
  5879. //>>excludeStart("ide", pragmas.excludeIdeData);
  5880. args: [],
  5881. source: "asSymbol\x0a\x09^ self",
  5882. referencedClasses: [],
  5883. //>>excludeEnd("ide");
  5884. messageSends: []
  5885. }),
  5886. $globals.String);
  5887. $core.addMethod(
  5888. $core.method({
  5889. selector: "asUppercase",
  5890. protocol: 'converting',
  5891. fn: function (){
  5892. var self=this;
  5893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5894. return $core.withContext(function($ctx1) {
  5895. //>>excludeEnd("ctx");
  5896. return self.toUpperCase();
  5897. return self;
  5898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5899. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5900. //>>excludeEnd("ctx");
  5901. },
  5902. //>>excludeStart("ide", pragmas.excludeIdeData);
  5903. args: [],
  5904. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  5905. referencedClasses: [],
  5906. //>>excludeEnd("ide");
  5907. messageSends: []
  5908. }),
  5909. $globals.String);
  5910. $core.addMethod(
  5911. $core.method({
  5912. selector: "asciiValue",
  5913. protocol: 'accessing',
  5914. fn: function (){
  5915. var self=this;
  5916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5917. return $core.withContext(function($ctx1) {
  5918. //>>excludeEnd("ctx");
  5919. return self.charCodeAt(0);;
  5920. return self;
  5921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5922. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5923. //>>excludeEnd("ctx");
  5924. },
  5925. //>>excludeStart("ide", pragmas.excludeIdeData);
  5926. args: [],
  5927. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  5928. referencedClasses: [],
  5929. //>>excludeEnd("ide");
  5930. messageSends: []
  5931. }),
  5932. $globals.String);
  5933. $core.addMethod(
  5934. $core.method({
  5935. selector: "at:ifAbsent:",
  5936. protocol: 'accessing',
  5937. fn: function (anIndex,aBlock){
  5938. var self=this;
  5939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5940. return $core.withContext(function($ctx1) {
  5941. //>>excludeEnd("ctx");
  5942. return String(self)[anIndex - 1] || aBlock._value();
  5943. return self;
  5944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5945. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5946. //>>excludeEnd("ctx");
  5947. },
  5948. //>>excludeStart("ide", pragmas.excludeIdeData);
  5949. args: ["anIndex", "aBlock"],
  5950. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  5951. referencedClasses: [],
  5952. //>>excludeEnd("ide");
  5953. messageSends: []
  5954. }),
  5955. $globals.String);
  5956. $core.addMethod(
  5957. $core.method({
  5958. selector: "at:ifPresent:ifAbsent:",
  5959. protocol: 'accessing',
  5960. fn: function (anIndex,aBlock,anotherBlock){
  5961. var self=this;
  5962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5963. return $core.withContext(function($ctx1) {
  5964. //>>excludeEnd("ctx");
  5965. var result = String(self)[anIndex - 1];
  5966. return result ? aBlock._value_(result) : anotherBlock._value();
  5967. ;
  5968. return self;
  5969. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5970. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5971. //>>excludeEnd("ctx");
  5972. },
  5973. //>>excludeStart("ide", pragmas.excludeIdeData);
  5974. args: ["anIndex", "aBlock", "anotherBlock"],
  5975. source: "at: anIndex ifPresent: aBlock ifAbsent: anotherBlock\x0a\x09<\x0a\x09\x09var result = String(self)[anIndex - 1];\x0a\x09\x09return result ? aBlock._value_(result) : anotherBlock._value();\x0a\x09>",
  5976. referencedClasses: [],
  5977. //>>excludeEnd("ide");
  5978. messageSends: []
  5979. }),
  5980. $globals.String);
  5981. $core.addMethod(
  5982. $core.method({
  5983. selector: "capitalized",
  5984. protocol: 'converting',
  5985. fn: function (){
  5986. var self=this;
  5987. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5988. return $core.withContext(function($ctx1) {
  5989. //>>excludeEnd("ctx");
  5990. var $1;
  5991. $1=self._isEmpty();
  5992. if($core.assert($1)){
  5993. return self;
  5994. } else {
  5995. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  5996. };
  5997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5998. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5999. //>>excludeEnd("ctx");
  6000. },
  6001. //>>excludeStart("ide", pragmas.excludeIdeData);
  6002. args: [],
  6003. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  6004. referencedClasses: [],
  6005. //>>excludeEnd("ide");
  6006. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  6007. }),
  6008. $globals.String);
  6009. $core.addMethod(
  6010. $core.method({
  6011. selector: "charCodeAt:",
  6012. protocol: 'accessing',
  6013. fn: function (anInteger){
  6014. var self=this;
  6015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6016. return $core.withContext(function($ctx1) {
  6017. //>>excludeEnd("ctx");
  6018. return self.charCodeAt(anInteger - 1);
  6019. return self;
  6020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6021. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6022. //>>excludeEnd("ctx");
  6023. },
  6024. //>>excludeStart("ide", pragmas.excludeIdeData);
  6025. args: ["anInteger"],
  6026. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  6027. referencedClasses: [],
  6028. //>>excludeEnd("ide");
  6029. messageSends: []
  6030. }),
  6031. $globals.String);
  6032. $core.addMethod(
  6033. $core.method({
  6034. selector: "copyFrom:to:",
  6035. protocol: 'copying',
  6036. fn: function (anIndex,anotherIndex){
  6037. var self=this;
  6038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6039. return $core.withContext(function($ctx1) {
  6040. //>>excludeEnd("ctx");
  6041. return self.substring(anIndex - 1, anotherIndex);
  6042. return self;
  6043. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6044. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6045. //>>excludeEnd("ctx");
  6046. },
  6047. //>>excludeStart("ide", pragmas.excludeIdeData);
  6048. args: ["anIndex", "anotherIndex"],
  6049. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  6050. referencedClasses: [],
  6051. //>>excludeEnd("ide");
  6052. messageSends: []
  6053. }),
  6054. $globals.String);
  6055. $core.addMethod(
  6056. $core.method({
  6057. selector: "crlfSanitized",
  6058. protocol: 'converting',
  6059. fn: function (){
  6060. var self=this;
  6061. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6063. return $core.withContext(function($ctx1) {
  6064. //>>excludeEnd("ctx");
  6065. return $recv(self._lines())._join_($recv($String())._lf());
  6066. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6067. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6068. //>>excludeEnd("ctx");
  6069. },
  6070. //>>excludeStart("ide", pragmas.excludeIdeData);
  6071. args: [],
  6072. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6073. referencedClasses: ["String"],
  6074. //>>excludeEnd("ide");
  6075. messageSends: ["join:", "lines", "lf"]
  6076. }),
  6077. $globals.String);
  6078. $core.addMethod(
  6079. $core.method({
  6080. selector: "deepCopy",
  6081. protocol: 'copying',
  6082. fn: function (){
  6083. var self=this;
  6084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6085. return $core.withContext(function($ctx1) {
  6086. //>>excludeEnd("ctx");
  6087. return self._shallowCopy();
  6088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6089. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6090. //>>excludeEnd("ctx");
  6091. },
  6092. //>>excludeStart("ide", pragmas.excludeIdeData);
  6093. args: [],
  6094. source: "deepCopy\x0a\x09^ self shallowCopy",
  6095. referencedClasses: [],
  6096. //>>excludeEnd("ide");
  6097. messageSends: ["shallowCopy"]
  6098. }),
  6099. $globals.String);
  6100. $core.addMethod(
  6101. $core.method({
  6102. selector: "escaped",
  6103. protocol: 'converting',
  6104. fn: function (){
  6105. var self=this;
  6106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6107. return $core.withContext(function($ctx1) {
  6108. //>>excludeEnd("ctx");
  6109. return escape(self);
  6110. return self;
  6111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6112. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6113. //>>excludeEnd("ctx");
  6114. },
  6115. //>>excludeStart("ide", pragmas.excludeIdeData);
  6116. args: [],
  6117. source: "escaped\x0a\x09<return escape(self)>",
  6118. referencedClasses: [],
  6119. //>>excludeEnd("ide");
  6120. messageSends: []
  6121. }),
  6122. $globals.String);
  6123. $core.addMethod(
  6124. $core.method({
  6125. selector: "includesSubString:",
  6126. protocol: 'testing',
  6127. fn: function (subString){
  6128. var self=this;
  6129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6130. return $core.withContext(function($ctx1) {
  6131. //>>excludeEnd("ctx");
  6132. return self.indexOf(subString) != -1;
  6133. return self;
  6134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6135. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6136. //>>excludeEnd("ctx");
  6137. },
  6138. //>>excludeStart("ide", pragmas.excludeIdeData);
  6139. args: ["subString"],
  6140. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  6141. referencedClasses: [],
  6142. //>>excludeEnd("ide");
  6143. messageSends: []
  6144. }),
  6145. $globals.String);
  6146. $core.addMethod(
  6147. $core.method({
  6148. selector: "isCapitalized",
  6149. protocol: 'testing',
  6150. fn: function (){
  6151. var self=this;
  6152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6153. return $core.withContext(function($ctx1) {
  6154. //>>excludeEnd("ctx");
  6155. var $2,$1;
  6156. $2=self._first();
  6157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6158. $ctx1.sendIdx["first"]=1;
  6159. //>>excludeEnd("ctx");
  6160. $1=$recv($2)._asUppercase();
  6161. return $recv($1).__eq_eq(self._first());
  6162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6163. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6164. //>>excludeEnd("ctx");
  6165. },
  6166. //>>excludeStart("ide", pragmas.excludeIdeData);
  6167. args: [],
  6168. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6169. referencedClasses: [],
  6170. //>>excludeEnd("ide");
  6171. messageSends: ["==", "asUppercase", "first"]
  6172. }),
  6173. $globals.String);
  6174. $core.addMethod(
  6175. $core.method({
  6176. selector: "isImmutable",
  6177. protocol: 'testing',
  6178. fn: function (){
  6179. var self=this;
  6180. return true;
  6181. },
  6182. //>>excludeStart("ide", pragmas.excludeIdeData);
  6183. args: [],
  6184. source: "isImmutable\x0a\x09^ true",
  6185. referencedClasses: [],
  6186. //>>excludeEnd("ide");
  6187. messageSends: []
  6188. }),
  6189. $globals.String);
  6190. $core.addMethod(
  6191. $core.method({
  6192. selector: "isString",
  6193. protocol: 'testing',
  6194. fn: function (){
  6195. var self=this;
  6196. return true;
  6197. },
  6198. //>>excludeStart("ide", pragmas.excludeIdeData);
  6199. args: [],
  6200. source: "isString\x0a\x09^ true",
  6201. referencedClasses: [],
  6202. //>>excludeEnd("ide");
  6203. messageSends: []
  6204. }),
  6205. $globals.String);
  6206. $core.addMethod(
  6207. $core.method({
  6208. selector: "isVowel",
  6209. protocol: 'testing',
  6210. fn: function (){
  6211. var self=this;
  6212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6213. return $core.withContext(function($ctx1) {
  6214. //>>excludeEnd("ctx");
  6215. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  6216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6217. return $core.withContext(function($ctx2) {
  6218. //>>excludeEnd("ctx");
  6219. return "aeiou"._includes_(self._asLowercase());
  6220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6221. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6222. //>>excludeEnd("ctx");
  6223. }));
  6224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6225. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6226. //>>excludeEnd("ctx");
  6227. },
  6228. //>>excludeStart("ide", pragmas.excludeIdeData);
  6229. args: [],
  6230. 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 ]",
  6231. referencedClasses: [],
  6232. //>>excludeEnd("ide");
  6233. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6234. }),
  6235. $globals.String);
  6236. $core.addMethod(
  6237. $core.method({
  6238. selector: "join:",
  6239. protocol: 'split join',
  6240. fn: function (aCollection){
  6241. var self=this;
  6242. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6244. return $core.withContext(function($ctx1) {
  6245. //>>excludeEnd("ctx");
  6246. return $recv($String())._streamContents_((function(stream){
  6247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6248. return $core.withContext(function($ctx2) {
  6249. //>>excludeEnd("ctx");
  6250. return $recv(aCollection)._do_separatedBy_((function(each){
  6251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6252. return $core.withContext(function($ctx3) {
  6253. //>>excludeEnd("ctx");
  6254. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6255. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6256. $ctx3.sendIdx["nextPutAll:"]=1;
  6257. //>>excludeEnd("ctx");
  6258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6259. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6260. //>>excludeEnd("ctx");
  6261. }),(function(){
  6262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6263. return $core.withContext(function($ctx3) {
  6264. //>>excludeEnd("ctx");
  6265. return $recv(stream)._nextPutAll_(self);
  6266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6267. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6268. //>>excludeEnd("ctx");
  6269. }));
  6270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6271. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6272. //>>excludeEnd("ctx");
  6273. }));
  6274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6275. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6276. //>>excludeEnd("ctx");
  6277. },
  6278. //>>excludeStart("ide", pragmas.excludeIdeData);
  6279. args: ["aCollection"],
  6280. 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 ]]",
  6281. referencedClasses: ["String"],
  6282. //>>excludeEnd("ide");
  6283. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6284. }),
  6285. $globals.String);
  6286. $core.addMethod(
  6287. $core.method({
  6288. selector: "lineIndicesDo:",
  6289. protocol: 'split join',
  6290. fn: function (aBlock){
  6291. var self=this;
  6292. var cr,lf,start,sz,nextLF,nextCR;
  6293. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6295. return $core.withContext(function($ctx1) {
  6296. //>>excludeEnd("ctx");
  6297. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6298. var $early={};
  6299. try {
  6300. start=(1);
  6301. sz=self._size();
  6302. cr=$recv($String())._cr();
  6303. nextCR=self._indexOf_startingAt_(cr,(1));
  6304. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6305. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6306. //>>excludeEnd("ctx");
  6307. lf=$recv($String())._lf();
  6308. nextLF=self._indexOf_startingAt_(lf,(1));
  6309. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6310. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6311. //>>excludeEnd("ctx");
  6312. $recv((function(){
  6313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6314. return $core.withContext(function($ctx2) {
  6315. //>>excludeEnd("ctx");
  6316. return $recv(start).__lt_eq(sz);
  6317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6319. //>>excludeEnd("ctx");
  6320. }))._whileTrue_((function(){
  6321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6322. return $core.withContext(function($ctx2) {
  6323. //>>excludeEnd("ctx");
  6324. $2=$recv(nextLF).__eq((0));
  6325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6326. $ctx2.sendIdx["="]=1;
  6327. //>>excludeEnd("ctx");
  6328. $1=$recv($2)._and_((function(){
  6329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6330. return $core.withContext(function($ctx3) {
  6331. //>>excludeEnd("ctx");
  6332. return $recv(nextCR).__eq((0));
  6333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6334. $ctx3.sendIdx["="]=2;
  6335. //>>excludeEnd("ctx");
  6336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6337. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6338. //>>excludeEnd("ctx");
  6339. }));
  6340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6341. $ctx2.sendIdx["and:"]=1;
  6342. //>>excludeEnd("ctx");
  6343. if($core.assert($1)){
  6344. $recv(aBlock)._value_value_value_(start,sz,sz);
  6345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6346. $ctx2.sendIdx["value:value:value:"]=1;
  6347. //>>excludeEnd("ctx");
  6348. throw $early=[self];
  6349. };
  6350. $4=$recv(nextCR).__eq((0));
  6351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6352. $ctx2.sendIdx["="]=3;
  6353. //>>excludeEnd("ctx");
  6354. $3=$recv($4)._or_((function(){
  6355. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6356. return $core.withContext(function($ctx3) {
  6357. //>>excludeEnd("ctx");
  6358. $5=(0).__lt(nextLF);
  6359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6360. $ctx3.sendIdx["<"]=1;
  6361. //>>excludeEnd("ctx");
  6362. return $recv($5)._and_((function(){
  6363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6364. return $core.withContext(function($ctx4) {
  6365. //>>excludeEnd("ctx");
  6366. return $recv(nextLF).__lt(nextCR);
  6367. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6368. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6369. //>>excludeEnd("ctx");
  6370. }));
  6371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6372. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6373. //>>excludeEnd("ctx");
  6374. }));
  6375. if($core.assert($3)){
  6376. $6=start;
  6377. $7=$recv(nextLF).__minus((1));
  6378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6379. $ctx2.sendIdx["-"]=1;
  6380. //>>excludeEnd("ctx");
  6381. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6382. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6383. $ctx2.sendIdx["value:value:value:"]=2;
  6384. //>>excludeEnd("ctx");
  6385. start=(1).__plus(nextLF);
  6386. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6387. $ctx2.sendIdx["+"]=1;
  6388. //>>excludeEnd("ctx");
  6389. start;
  6390. nextLF=self._indexOf_startingAt_(lf,start);
  6391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6392. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6393. //>>excludeEnd("ctx");
  6394. return nextLF;
  6395. } else {
  6396. $9=(1).__plus(nextCR);
  6397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6398. $ctx2.sendIdx["+"]=2;
  6399. //>>excludeEnd("ctx");
  6400. $8=$recv($9).__eq(nextLF);
  6401. if($core.assert($8)){
  6402. $10=start;
  6403. $11=$recv(nextCR).__minus((1));
  6404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6405. $ctx2.sendIdx["-"]=2;
  6406. //>>excludeEnd("ctx");
  6407. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6409. $ctx2.sendIdx["value:value:value:"]=3;
  6410. //>>excludeEnd("ctx");
  6411. start=(1).__plus(nextLF);
  6412. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6413. $ctx2.sendIdx["+"]=3;
  6414. //>>excludeEnd("ctx");
  6415. start;
  6416. nextCR=self._indexOf_startingAt_(cr,start);
  6417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6418. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6419. //>>excludeEnd("ctx");
  6420. nextCR;
  6421. nextLF=self._indexOf_startingAt_(lf,start);
  6422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6423. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6424. //>>excludeEnd("ctx");
  6425. return nextLF;
  6426. } else {
  6427. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6428. start=(1).__plus(nextCR);
  6429. start;
  6430. nextCR=self._indexOf_startingAt_(cr,start);
  6431. return nextCR;
  6432. };
  6433. };
  6434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6435. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6436. //>>excludeEnd("ctx");
  6437. }));
  6438. return self;
  6439. }
  6440. catch(e) {if(e===$early)return e[0]; throw e}
  6441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6442. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6443. //>>excludeEnd("ctx");
  6444. },
  6445. //>>excludeStart("ide", pragmas.excludeIdeData);
  6446. args: ["aBlock"],
  6447. 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 ] ]]",
  6448. referencedClasses: ["String"],
  6449. //>>excludeEnd("ide");
  6450. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6451. }),
  6452. $globals.String);
  6453. $core.addMethod(
  6454. $core.method({
  6455. selector: "lineNumber:",
  6456. protocol: 'split join',
  6457. fn: function (anIndex){
  6458. var self=this;
  6459. var lineCount;
  6460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6461. return $core.withContext(function($ctx1) {
  6462. //>>excludeEnd("ctx");
  6463. var $2,$1;
  6464. var $early={};
  6465. try {
  6466. lineCount=(0);
  6467. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6469. return $core.withContext(function($ctx2) {
  6470. //>>excludeEnd("ctx");
  6471. lineCount=$recv(lineCount).__plus((1));
  6472. $2=lineCount;
  6473. $1=$recv($2).__eq(anIndex);
  6474. if($core.assert($1)){
  6475. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  6476. };
  6477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6478. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6479. //>>excludeEnd("ctx");
  6480. }));
  6481. return nil;
  6482. }
  6483. catch(e) {if(e===$early)return e[0]; throw e}
  6484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6485. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6486. //>>excludeEnd("ctx");
  6487. },
  6488. //>>excludeStart("ide", pragmas.excludeIdeData);
  6489. args: ["anIndex"],
  6490. 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",
  6491. referencedClasses: [],
  6492. //>>excludeEnd("ide");
  6493. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6494. }),
  6495. $globals.String);
  6496. $core.addMethod(
  6497. $core.method({
  6498. selector: "lines",
  6499. protocol: 'split join',
  6500. fn: function (){
  6501. var self=this;
  6502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6503. return $core.withContext(function($ctx1) {
  6504. //>>excludeEnd("ctx");
  6505. var result = self.split(/\r\n|\r|\n/);
  6506. if (!result[result.length-1]) result.pop();
  6507. return result;;
  6508. return self;
  6509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6510. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6511. //>>excludeEnd("ctx");
  6512. },
  6513. //>>excludeStart("ide", pragmas.excludeIdeData);
  6514. args: [],
  6515. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a<\x0a\x09var result = self.split(/\x5cr\x5cn|\x5cr|\x5cn/);\x0a\x09if (!result[result.length-1]) result.pop();\x0a\x09return result;\x0a>",
  6516. referencedClasses: [],
  6517. //>>excludeEnd("ide");
  6518. messageSends: []
  6519. }),
  6520. $globals.String);
  6521. $core.addMethod(
  6522. $core.method({
  6523. selector: "linesDo:",
  6524. protocol: 'split join',
  6525. fn: function (aBlock){
  6526. var self=this;
  6527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6528. return $core.withContext(function($ctx1) {
  6529. //>>excludeEnd("ctx");
  6530. $recv(self._lines())._do_(aBlock);
  6531. return self;
  6532. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6533. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6534. //>>excludeEnd("ctx");
  6535. },
  6536. //>>excludeStart("ide", pragmas.excludeIdeData);
  6537. args: ["aBlock"],
  6538. 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",
  6539. referencedClasses: [],
  6540. //>>excludeEnd("ide");
  6541. messageSends: ["do:", "lines"]
  6542. }),
  6543. $globals.String);
  6544. $core.addMethod(
  6545. $core.method({
  6546. selector: "match:",
  6547. protocol: 'regular expressions',
  6548. fn: function (aRegexp){
  6549. var self=this;
  6550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6551. return $core.withContext(function($ctx1) {
  6552. //>>excludeEnd("ctx");
  6553. return self.search(aRegexp) != -1;
  6554. return self;
  6555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6556. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6557. //>>excludeEnd("ctx");
  6558. },
  6559. //>>excludeStart("ide", pragmas.excludeIdeData);
  6560. args: ["aRegexp"],
  6561. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  6562. referencedClasses: [],
  6563. //>>excludeEnd("ide");
  6564. messageSends: []
  6565. }),
  6566. $globals.String);
  6567. $core.addMethod(
  6568. $core.method({
  6569. selector: "matchesOf:",
  6570. protocol: 'regular expressions',
  6571. fn: function (aRegularExpression){
  6572. var self=this;
  6573. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6574. return $core.withContext(function($ctx1) {
  6575. //>>excludeEnd("ctx");
  6576. return self.match(aRegularExpression);
  6577. return self;
  6578. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6579. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6580. //>>excludeEnd("ctx");
  6581. },
  6582. //>>excludeStart("ide", pragmas.excludeIdeData);
  6583. args: ["aRegularExpression"],
  6584. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  6585. referencedClasses: [],
  6586. //>>excludeEnd("ide");
  6587. messageSends: []
  6588. }),
  6589. $globals.String);
  6590. $core.addMethod(
  6591. $core.method({
  6592. selector: "numericallyIndexable",
  6593. protocol: 'private',
  6594. fn: function (){
  6595. var self=this;
  6596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6597. return $core.withContext(function($ctx1) {
  6598. //>>excludeEnd("ctx");
  6599. return String(self);
  6600. return self;
  6601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6602. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6603. //>>excludeEnd("ctx");
  6604. },
  6605. //>>excludeStart("ide", pragmas.excludeIdeData);
  6606. args: [],
  6607. source: "numericallyIndexable\x0a\x09<return String(self)>",
  6608. referencedClasses: [],
  6609. //>>excludeEnd("ide");
  6610. messageSends: []
  6611. }),
  6612. $globals.String);
  6613. $core.addMethod(
  6614. $core.method({
  6615. selector: "printNl",
  6616. protocol: 'printing',
  6617. fn: function (){
  6618. var self=this;
  6619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6620. return $core.withContext(function($ctx1) {
  6621. //>>excludeEnd("ctx");
  6622. console.log(self);
  6623. return self;
  6624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6625. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6626. //>>excludeEnd("ctx");
  6627. },
  6628. //>>excludeStart("ide", pragmas.excludeIdeData);
  6629. args: [],
  6630. source: "printNl\x0a\x09<console.log(self)>",
  6631. referencedClasses: [],
  6632. //>>excludeEnd("ide");
  6633. messageSends: []
  6634. }),
  6635. $globals.String);
  6636. $core.addMethod(
  6637. $core.method({
  6638. selector: "printOn:",
  6639. protocol: 'printing',
  6640. fn: function (aStream){
  6641. var self=this;
  6642. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6643. return $core.withContext(function($ctx1) {
  6644. //>>excludeEnd("ctx");
  6645. $recv(aStream)._nextPutAll_("'");
  6646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6647. $ctx1.sendIdx["nextPutAll:"]=1;
  6648. //>>excludeEnd("ctx");
  6649. $recv(aStream)._nextPutAll_(self);
  6650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6651. $ctx1.sendIdx["nextPutAll:"]=2;
  6652. //>>excludeEnd("ctx");
  6653. $recv(aStream)._nextPutAll_("'");
  6654. return self;
  6655. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6656. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6657. //>>excludeEnd("ctx");
  6658. },
  6659. //>>excludeStart("ide", pragmas.excludeIdeData);
  6660. args: ["aStream"],
  6661. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  6662. referencedClasses: [],
  6663. //>>excludeEnd("ide");
  6664. messageSends: ["nextPutAll:"]
  6665. }),
  6666. $globals.String);
  6667. $core.addMethod(
  6668. $core.method({
  6669. selector: "replace:with:",
  6670. protocol: 'regular expressions',
  6671. fn: function (aString,anotherString){
  6672. var self=this;
  6673. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6675. return $core.withContext(function($ctx1) {
  6676. //>>excludeEnd("ctx");
  6677. return self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  6678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6679. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6680. //>>excludeEnd("ctx");
  6681. },
  6682. //>>excludeStart("ide", pragmas.excludeIdeData);
  6683. args: ["aString", "anotherString"],
  6684. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6685. referencedClasses: ["RegularExpression"],
  6686. //>>excludeEnd("ide");
  6687. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6688. }),
  6689. $globals.String);
  6690. $core.addMethod(
  6691. $core.method({
  6692. selector: "replaceRegexp:with:",
  6693. protocol: 'regular expressions',
  6694. fn: function (aRegexp,aString){
  6695. var self=this;
  6696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6697. return $core.withContext(function($ctx1) {
  6698. //>>excludeEnd("ctx");
  6699. return self.replace(aRegexp, aString);
  6700. return self;
  6701. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6702. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6703. //>>excludeEnd("ctx");
  6704. },
  6705. //>>excludeStart("ide", pragmas.excludeIdeData);
  6706. args: ["aRegexp", "aString"],
  6707. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  6708. referencedClasses: [],
  6709. //>>excludeEnd("ide");
  6710. messageSends: []
  6711. }),
  6712. $globals.String);
  6713. $core.addMethod(
  6714. $core.method({
  6715. selector: "reversed",
  6716. protocol: 'converting',
  6717. fn: function (){
  6718. var self=this;
  6719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6720. return $core.withContext(function($ctx1) {
  6721. //>>excludeEnd("ctx");
  6722. return self.split("").reverse().join("");
  6723. return self;
  6724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6725. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6726. //>>excludeEnd("ctx");
  6727. },
  6728. //>>excludeStart("ide", pragmas.excludeIdeData);
  6729. args: [],
  6730. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  6731. referencedClasses: [],
  6732. //>>excludeEnd("ide");
  6733. messageSends: []
  6734. }),
  6735. $globals.String);
  6736. $core.addMethod(
  6737. $core.method({
  6738. selector: "shallowCopy",
  6739. protocol: 'copying',
  6740. fn: function (){
  6741. var self=this;
  6742. return self;
  6743. },
  6744. //>>excludeStart("ide", pragmas.excludeIdeData);
  6745. args: [],
  6746. source: "shallowCopy\x0a\x09^ self",
  6747. referencedClasses: [],
  6748. //>>excludeEnd("ide");
  6749. messageSends: []
  6750. }),
  6751. $globals.String);
  6752. $core.addMethod(
  6753. $core.method({
  6754. selector: "size",
  6755. protocol: 'accessing',
  6756. fn: function (){
  6757. var self=this;
  6758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6759. return $core.withContext(function($ctx1) {
  6760. //>>excludeEnd("ctx");
  6761. return self.length;
  6762. return self;
  6763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6764. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6765. //>>excludeEnd("ctx");
  6766. },
  6767. //>>excludeStart("ide", pragmas.excludeIdeData);
  6768. args: [],
  6769. source: "size\x0a\x09<return self.length>",
  6770. referencedClasses: [],
  6771. //>>excludeEnd("ide");
  6772. messageSends: []
  6773. }),
  6774. $globals.String);
  6775. $core.addMethod(
  6776. $core.method({
  6777. selector: "subStrings:",
  6778. protocol: 'split join',
  6779. fn: function (aString){
  6780. var self=this;
  6781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6782. return $core.withContext(function($ctx1) {
  6783. //>>excludeEnd("ctx");
  6784. return self._tokenize_(aString);
  6785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6786. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6787. //>>excludeEnd("ctx");
  6788. },
  6789. //>>excludeStart("ide", pragmas.excludeIdeData);
  6790. args: ["aString"],
  6791. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6792. referencedClasses: [],
  6793. //>>excludeEnd("ide");
  6794. messageSends: ["tokenize:"]
  6795. }),
  6796. $globals.String);
  6797. $core.addMethod(
  6798. $core.method({
  6799. selector: "tokenize:",
  6800. protocol: 'split join',
  6801. fn: function (aString){
  6802. var self=this;
  6803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6804. return $core.withContext(function($ctx1) {
  6805. //>>excludeEnd("ctx");
  6806. return self.split(aString);
  6807. return self;
  6808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6809. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6810. //>>excludeEnd("ctx");
  6811. },
  6812. //>>excludeStart("ide", pragmas.excludeIdeData);
  6813. args: ["aString"],
  6814. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  6815. referencedClasses: [],
  6816. //>>excludeEnd("ide");
  6817. messageSends: []
  6818. }),
  6819. $globals.String);
  6820. $core.addMethod(
  6821. $core.method({
  6822. selector: "trimBoth",
  6823. protocol: 'regular expressions',
  6824. fn: function (){
  6825. var self=this;
  6826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6827. return $core.withContext(function($ctx1) {
  6828. //>>excludeEnd("ctx");
  6829. return self._trimBoth_("\x5cs");
  6830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6831. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6832. //>>excludeEnd("ctx");
  6833. },
  6834. //>>excludeStart("ide", pragmas.excludeIdeData);
  6835. args: [],
  6836. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6837. referencedClasses: [],
  6838. //>>excludeEnd("ide");
  6839. messageSends: ["trimBoth:"]
  6840. }),
  6841. $globals.String);
  6842. $core.addMethod(
  6843. $core.method({
  6844. selector: "trimBoth:",
  6845. protocol: 'regular expressions',
  6846. fn: function (separators){
  6847. var self=this;
  6848. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6849. return $core.withContext(function($ctx1) {
  6850. //>>excludeEnd("ctx");
  6851. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  6852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6853. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6854. //>>excludeEnd("ctx");
  6855. },
  6856. //>>excludeStart("ide", pragmas.excludeIdeData);
  6857. args: ["separators"],
  6858. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6859. referencedClasses: [],
  6860. //>>excludeEnd("ide");
  6861. messageSends: ["trimRight:", "trimLeft:"]
  6862. }),
  6863. $globals.String);
  6864. $core.addMethod(
  6865. $core.method({
  6866. selector: "trimLeft",
  6867. protocol: 'regular expressions',
  6868. fn: function (){
  6869. var self=this;
  6870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6871. return $core.withContext(function($ctx1) {
  6872. //>>excludeEnd("ctx");
  6873. return self._trimLeft_("\x5cs");
  6874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6875. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6876. //>>excludeEnd("ctx");
  6877. },
  6878. //>>excludeStart("ide", pragmas.excludeIdeData);
  6879. args: [],
  6880. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6881. referencedClasses: [],
  6882. //>>excludeEnd("ide");
  6883. messageSends: ["trimLeft:"]
  6884. }),
  6885. $globals.String);
  6886. $core.addMethod(
  6887. $core.method({
  6888. selector: "trimLeft:",
  6889. protocol: 'regular expressions',
  6890. fn: function (separators){
  6891. var self=this;
  6892. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6894. return $core.withContext(function($ctx1) {
  6895. //>>excludeEnd("ctx");
  6896. var $2,$1;
  6897. $2=$recv("^[".__comma(separators)).__comma("]+");
  6898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6899. $ctx1.sendIdx[","]=1;
  6900. //>>excludeEnd("ctx");
  6901. $1=$recv($RegularExpression())._fromString_flag_($2,"g");
  6902. return self._replaceRegexp_with_($1,"");
  6903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6904. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6905. //>>excludeEnd("ctx");
  6906. },
  6907. //>>excludeStart("ide", pragmas.excludeIdeData);
  6908. args: ["separators"],
  6909. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6910. referencedClasses: ["RegularExpression"],
  6911. //>>excludeEnd("ide");
  6912. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6913. }),
  6914. $globals.String);
  6915. $core.addMethod(
  6916. $core.method({
  6917. selector: "trimRight",
  6918. protocol: 'regular expressions',
  6919. fn: function (){
  6920. var self=this;
  6921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6922. return $core.withContext(function($ctx1) {
  6923. //>>excludeEnd("ctx");
  6924. return self._trimRight_("\x5cs");
  6925. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6926. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6927. //>>excludeEnd("ctx");
  6928. },
  6929. //>>excludeStart("ide", pragmas.excludeIdeData);
  6930. args: [],
  6931. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6932. referencedClasses: [],
  6933. //>>excludeEnd("ide");
  6934. messageSends: ["trimRight:"]
  6935. }),
  6936. $globals.String);
  6937. $core.addMethod(
  6938. $core.method({
  6939. selector: "trimRight:",
  6940. protocol: 'regular expressions',
  6941. fn: function (separators){
  6942. var self=this;
  6943. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6945. return $core.withContext(function($ctx1) {
  6946. //>>excludeEnd("ctx");
  6947. var $2,$1;
  6948. $2=$recv("[".__comma(separators)).__comma("]+$");
  6949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6950. $ctx1.sendIdx[","]=1;
  6951. //>>excludeEnd("ctx");
  6952. $1=$recv($RegularExpression())._fromString_flag_($2,"g");
  6953. return self._replaceRegexp_with_($1,"");
  6954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6955. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6956. //>>excludeEnd("ctx");
  6957. },
  6958. //>>excludeStart("ide", pragmas.excludeIdeData);
  6959. args: ["separators"],
  6960. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6961. referencedClasses: ["RegularExpression"],
  6962. //>>excludeEnd("ide");
  6963. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6964. }),
  6965. $globals.String);
  6966. $core.addMethod(
  6967. $core.method({
  6968. selector: "unescaped",
  6969. protocol: 'converting',
  6970. fn: function (){
  6971. var self=this;
  6972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6973. return $core.withContext(function($ctx1) {
  6974. //>>excludeEnd("ctx");
  6975. return unescape(self);
  6976. return self;
  6977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6978. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6979. //>>excludeEnd("ctx");
  6980. },
  6981. //>>excludeStart("ide", pragmas.excludeIdeData);
  6982. args: [],
  6983. source: "unescaped\x0a\x09<return unescape(self)>",
  6984. referencedClasses: [],
  6985. //>>excludeEnd("ide");
  6986. messageSends: []
  6987. }),
  6988. $globals.String);
  6989. $core.addMethod(
  6990. $core.method({
  6991. selector: "uriComponentDecoded",
  6992. protocol: 'converting',
  6993. fn: function (){
  6994. var self=this;
  6995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6996. return $core.withContext(function($ctx1) {
  6997. //>>excludeEnd("ctx");
  6998. return decodeURIComponent(self);
  6999. return self;
  7000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7001. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7002. //>>excludeEnd("ctx");
  7003. },
  7004. //>>excludeStart("ide", pragmas.excludeIdeData);
  7005. args: [],
  7006. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  7007. referencedClasses: [],
  7008. //>>excludeEnd("ide");
  7009. messageSends: []
  7010. }),
  7011. $globals.String);
  7012. $core.addMethod(
  7013. $core.method({
  7014. selector: "uriComponentEncoded",
  7015. protocol: 'converting',
  7016. fn: function (){
  7017. var self=this;
  7018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7019. return $core.withContext(function($ctx1) {
  7020. //>>excludeEnd("ctx");
  7021. return encodeURIComponent(self);
  7022. return self;
  7023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7024. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7025. //>>excludeEnd("ctx");
  7026. },
  7027. //>>excludeStart("ide", pragmas.excludeIdeData);
  7028. args: [],
  7029. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  7030. referencedClasses: [],
  7031. //>>excludeEnd("ide");
  7032. messageSends: []
  7033. }),
  7034. $globals.String);
  7035. $core.addMethod(
  7036. $core.method({
  7037. selector: "uriDecoded",
  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 decodeURI(self);
  7045. return self;
  7046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7047. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7048. //>>excludeEnd("ctx");
  7049. },
  7050. //>>excludeStart("ide", pragmas.excludeIdeData);
  7051. args: [],
  7052. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  7053. referencedClasses: [],
  7054. //>>excludeEnd("ide");
  7055. messageSends: []
  7056. }),
  7057. $globals.String);
  7058. $core.addMethod(
  7059. $core.method({
  7060. selector: "uriEncoded",
  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 encodeURI(self);
  7068. return self;
  7069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7070. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7071. //>>excludeEnd("ctx");
  7072. },
  7073. //>>excludeStart("ide", pragmas.excludeIdeData);
  7074. args: [],
  7075. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  7076. referencedClasses: [],
  7077. //>>excludeEnd("ide");
  7078. messageSends: []
  7079. }),
  7080. $globals.String);
  7081. $core.addMethod(
  7082. $core.method({
  7083. selector: "value:",
  7084. protocol: 'evaluating',
  7085. fn: function (anObject){
  7086. var self=this;
  7087. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7088. return $core.withContext(function($ctx1) {
  7089. //>>excludeEnd("ctx");
  7090. return $recv(anObject)._perform_(self);
  7091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7092. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7093. //>>excludeEnd("ctx");
  7094. },
  7095. //>>excludeStart("ide", pragmas.excludeIdeData);
  7096. args: ["anObject"],
  7097. source: "value: anObject \x0a\x09^ anObject perform: self",
  7098. referencedClasses: [],
  7099. //>>excludeEnd("ide");
  7100. messageSends: ["perform:"]
  7101. }),
  7102. $globals.String);
  7103. $core.addMethod(
  7104. $core.method({
  7105. selector: "cr",
  7106. protocol: 'accessing',
  7107. fn: function (){
  7108. var self=this;
  7109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7110. return $core.withContext(function($ctx1) {
  7111. //>>excludeEnd("ctx");
  7112. return '\r';
  7113. return self;
  7114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7115. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  7116. //>>excludeEnd("ctx");
  7117. },
  7118. //>>excludeStart("ide", pragmas.excludeIdeData);
  7119. args: [],
  7120. source: "cr\x0a\x09<return '\x5cr'>",
  7121. referencedClasses: [],
  7122. //>>excludeEnd("ide");
  7123. messageSends: []
  7124. }),
  7125. $globals.String.klass);
  7126. $core.addMethod(
  7127. $core.method({
  7128. selector: "crlf",
  7129. protocol: 'accessing',
  7130. fn: function (){
  7131. var self=this;
  7132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7133. return $core.withContext(function($ctx1) {
  7134. //>>excludeEnd("ctx");
  7135. return '\r\n';
  7136. return self;
  7137. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7138. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  7139. //>>excludeEnd("ctx");
  7140. },
  7141. //>>excludeStart("ide", pragmas.excludeIdeData);
  7142. args: [],
  7143. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  7144. referencedClasses: [],
  7145. //>>excludeEnd("ide");
  7146. messageSends: []
  7147. }),
  7148. $globals.String.klass);
  7149. $core.addMethod(
  7150. $core.method({
  7151. selector: "esc",
  7152. protocol: 'accessing',
  7153. fn: function (){
  7154. var self=this;
  7155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7156. return $core.withContext(function($ctx1) {
  7157. //>>excludeEnd("ctx");
  7158. return self._fromCharCode_((27));
  7159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7160. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  7161. //>>excludeEnd("ctx");
  7162. },
  7163. //>>excludeStart("ide", pragmas.excludeIdeData);
  7164. args: [],
  7165. source: "esc\x0a\x09^ self fromCharCode: 27",
  7166. referencedClasses: [],
  7167. //>>excludeEnd("ide");
  7168. messageSends: ["fromCharCode:"]
  7169. }),
  7170. $globals.String.klass);
  7171. $core.addMethod(
  7172. $core.method({
  7173. selector: "fromCharCode:",
  7174. protocol: 'instance creation',
  7175. fn: function (anInteger){
  7176. var self=this;
  7177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7178. return $core.withContext(function($ctx1) {
  7179. //>>excludeEnd("ctx");
  7180. return String.fromCharCode(anInteger);
  7181. return self;
  7182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7183. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  7184. //>>excludeEnd("ctx");
  7185. },
  7186. //>>excludeStart("ide", pragmas.excludeIdeData);
  7187. args: ["anInteger"],
  7188. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  7189. referencedClasses: [],
  7190. //>>excludeEnd("ide");
  7191. messageSends: []
  7192. }),
  7193. $globals.String.klass);
  7194. $core.addMethod(
  7195. $core.method({
  7196. selector: "fromString:",
  7197. protocol: 'instance creation',
  7198. fn: function (aString){
  7199. var self=this;
  7200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7201. return $core.withContext(function($ctx1) {
  7202. //>>excludeEnd("ctx");
  7203. return String(aString);
  7204. return self;
  7205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7206. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  7207. //>>excludeEnd("ctx");
  7208. },
  7209. //>>excludeStart("ide", pragmas.excludeIdeData);
  7210. args: ["aString"],
  7211. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  7212. referencedClasses: [],
  7213. //>>excludeEnd("ide");
  7214. messageSends: []
  7215. }),
  7216. $globals.String.klass);
  7217. $core.addMethod(
  7218. $core.method({
  7219. selector: "lf",
  7220. protocol: 'accessing',
  7221. fn: function (){
  7222. var self=this;
  7223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7224. return $core.withContext(function($ctx1) {
  7225. //>>excludeEnd("ctx");
  7226. return '\n';
  7227. return self;
  7228. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7229. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  7230. //>>excludeEnd("ctx");
  7231. },
  7232. //>>excludeStart("ide", pragmas.excludeIdeData);
  7233. args: [],
  7234. source: "lf\x0a\x09<return '\x5cn'>",
  7235. referencedClasses: [],
  7236. //>>excludeEnd("ide");
  7237. messageSends: []
  7238. }),
  7239. $globals.String.klass);
  7240. $core.addMethod(
  7241. $core.method({
  7242. selector: "random",
  7243. protocol: 'random',
  7244. fn: function (){
  7245. var self=this;
  7246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7247. return $core.withContext(function($ctx1) {
  7248. //>>excludeEnd("ctx");
  7249. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7250. return self;
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  7253. //>>excludeEnd("ctx");
  7254. },
  7255. //>>excludeStart("ide", pragmas.excludeIdeData);
  7256. args: [],
  7257. source: "random\x0a\x09\x22Returns random alphanumeric string beginning with letter\x22\x0a\x09<return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);>",
  7258. referencedClasses: [],
  7259. //>>excludeEnd("ide");
  7260. messageSends: []
  7261. }),
  7262. $globals.String.klass);
  7263. $core.addMethod(
  7264. $core.method({
  7265. selector: "randomNotIn:",
  7266. protocol: 'random',
  7267. fn: function (aString){
  7268. var self=this;
  7269. var result;
  7270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7271. return $core.withContext(function($ctx1) {
  7272. //>>excludeEnd("ctx");
  7273. $recv((function(){
  7274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7275. return $core.withContext(function($ctx2) {
  7276. //>>excludeEnd("ctx");
  7277. result=self._random();
  7278. result;
  7279. return $recv(aString)._includesSubString_(result);
  7280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7282. //>>excludeEnd("ctx");
  7283. }))._whileTrue();
  7284. return result;
  7285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7286. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  7287. //>>excludeEnd("ctx");
  7288. },
  7289. //>>excludeStart("ide", pragmas.excludeIdeData);
  7290. args: ["aString"],
  7291. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7292. referencedClasses: [],
  7293. //>>excludeEnd("ide");
  7294. messageSends: ["whileTrue", "random", "includesSubString:"]
  7295. }),
  7296. $globals.String.klass);
  7297. $core.addMethod(
  7298. $core.method({
  7299. selector: "space",
  7300. protocol: 'accessing',
  7301. fn: function (){
  7302. var self=this;
  7303. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7304. return $core.withContext(function($ctx1) {
  7305. //>>excludeEnd("ctx");
  7306. return ' ';
  7307. return self;
  7308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7309. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  7310. //>>excludeEnd("ctx");
  7311. },
  7312. //>>excludeStart("ide", pragmas.excludeIdeData);
  7313. args: [],
  7314. source: "space\x0a\x09<return ' '>",
  7315. referencedClasses: [],
  7316. //>>excludeEnd("ide");
  7317. messageSends: []
  7318. }),
  7319. $globals.String.klass);
  7320. $core.addMethod(
  7321. $core.method({
  7322. selector: "streamClass",
  7323. protocol: 'accessing',
  7324. fn: function (){
  7325. var self=this;
  7326. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  7327. return $StringStream();
  7328. },
  7329. //>>excludeStart("ide", pragmas.excludeIdeData);
  7330. args: [],
  7331. source: "streamClass\x0a\x09\x09^ StringStream",
  7332. referencedClasses: ["StringStream"],
  7333. //>>excludeEnd("ide");
  7334. messageSends: []
  7335. }),
  7336. $globals.String.klass);
  7337. $core.addMethod(
  7338. $core.method({
  7339. selector: "tab",
  7340. protocol: 'accessing',
  7341. fn: function (){
  7342. var self=this;
  7343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7344. return $core.withContext(function($ctx1) {
  7345. //>>excludeEnd("ctx");
  7346. return '\t';
  7347. return self;
  7348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7349. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  7350. //>>excludeEnd("ctx");
  7351. },
  7352. //>>excludeStart("ide", pragmas.excludeIdeData);
  7353. args: [],
  7354. source: "tab\x0a\x09<return '\x5ct'>",
  7355. referencedClasses: [],
  7356. //>>excludeEnd("ide");
  7357. messageSends: []
  7358. }),
  7359. $globals.String.klass);
  7360. $core.addMethod(
  7361. $core.method({
  7362. selector: "value:",
  7363. protocol: 'instance creation',
  7364. fn: function (aUTFCharCode){
  7365. var self=this;
  7366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7367. return $core.withContext(function($ctx1) {
  7368. //>>excludeEnd("ctx");
  7369. return String.fromCharCode(aUTFCharCode);;
  7370. return self;
  7371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7372. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  7373. //>>excludeEnd("ctx");
  7374. },
  7375. //>>excludeStart("ide", pragmas.excludeIdeData);
  7376. args: ["aUTFCharCode"],
  7377. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  7378. referencedClasses: [],
  7379. //>>excludeEnd("ide");
  7380. messageSends: []
  7381. }),
  7382. $globals.String.klass);
  7383. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  7384. //>>excludeStart("ide", pragmas.excludeIdeData);
  7385. $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`.";
  7386. //>>excludeEnd("ide");
  7387. $core.addMethod(
  7388. $core.method({
  7389. selector: "=",
  7390. protocol: 'comparing',
  7391. fn: function (aCollection){
  7392. var self=this;
  7393. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7394. return $core.withContext(function($ctx1) {
  7395. //>>excludeEnd("ctx");
  7396. var $2,$1,$4,$3,$5;
  7397. var $early={};
  7398. try {
  7399. $2=self._class();
  7400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7401. $ctx1.sendIdx["class"]=1;
  7402. //>>excludeEnd("ctx");
  7403. $1=$recv($2).__eq($recv(aCollection)._class());
  7404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7405. $ctx1.sendIdx["="]=1;
  7406. //>>excludeEnd("ctx");
  7407. if(!$core.assert($1)){
  7408. return false;
  7409. };
  7410. $4=self._size();
  7411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7412. $ctx1.sendIdx["size"]=1;
  7413. //>>excludeEnd("ctx");
  7414. $3=$recv($4).__eq($recv(aCollection)._size());
  7415. if(!$core.assert($3)){
  7416. return false;
  7417. };
  7418. self._do_((function(each){
  7419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7420. return $core.withContext(function($ctx2) {
  7421. //>>excludeEnd("ctx");
  7422. $5=$recv(aCollection)._includes_(each);
  7423. if(!$core.assert($5)){
  7424. throw $early=[false];
  7425. };
  7426. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7427. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7428. //>>excludeEnd("ctx");
  7429. }));
  7430. return true;
  7431. }
  7432. catch(e) {if(e===$early)return e[0]; throw e}
  7433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7434. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7435. //>>excludeEnd("ctx");
  7436. },
  7437. //>>excludeStart("ide", pragmas.excludeIdeData);
  7438. args: ["aCollection"],
  7439. 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",
  7440. referencedClasses: [],
  7441. //>>excludeEnd("ide");
  7442. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7443. }),
  7444. $globals.Set);
  7445. $core.addMethod(
  7446. $core.method({
  7447. selector: "add:",
  7448. protocol: 'adding/removing',
  7449. fn: function (anObject){
  7450. var self=this;
  7451. var bucket;
  7452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7453. return $core.withContext(function($ctx1) {
  7454. //>>excludeEnd("ctx");
  7455. var $1,$receiver;
  7456. bucket=self._bucketsOfElement_(anObject);
  7457. $1=$recv(bucket)._second();
  7458. if(($receiver = $1) == null || $receiver.isNil){
  7459. var object,slowBucket;
  7460. object=$recv(bucket)._first();
  7461. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7462. $ctx1.sendIdx["first"]=1;
  7463. //>>excludeEnd("ctx");
  7464. object;
  7465. slowBucket=$recv(bucket)._third();
  7466. slowBucket;
  7467. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7469. return $core.withContext(function($ctx2) {
  7470. //>>excludeEnd("ctx");
  7471. $recv(slowBucket)._add_(object);
  7472. self["@size"]=$recv(self["@size"]).__plus((1));
  7473. return self["@size"];
  7474. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7475. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7476. //>>excludeEnd("ctx");
  7477. }));
  7478. return object;
  7479. } else {
  7480. var primitiveBucket;
  7481. primitiveBucket=$receiver;
  7482. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  7483. };
  7484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7485. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7486. //>>excludeEnd("ctx");
  7487. },
  7488. //>>excludeStart("ide", pragmas.excludeIdeData);
  7489. args: ["anObject"],
  7490. 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 ]",
  7491. referencedClasses: [],
  7492. //>>excludeEnd("ide");
  7493. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7494. }),
  7495. $globals.Set);
  7496. $core.addMethod(
  7497. $core.method({
  7498. selector: "add:in:",
  7499. protocol: 'private',
  7500. fn: function (anObject,anotherObject){
  7501. var self=this;
  7502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7503. return $core.withContext(function($ctx1) {
  7504. //>>excludeEnd("ctx");
  7505. if (anObject in anotherObject.store) { return false; }
  7506. self['@size']++;
  7507. anotherObject.store[anObject] = true;
  7508. return anObject;
  7509. ;
  7510. return self;
  7511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7512. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7513. //>>excludeEnd("ctx");
  7514. },
  7515. //>>excludeStart("ide", pragmas.excludeIdeData);
  7516. args: ["anObject", "anotherObject"],
  7517. source: "add: anObject in: anotherObject\x0a\x09<\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>",
  7518. referencedClasses: [],
  7519. //>>excludeEnd("ide");
  7520. messageSends: []
  7521. }),
  7522. $globals.Set);
  7523. $core.addMethod(
  7524. $core.method({
  7525. selector: "bucketsOfElement:",
  7526. protocol: 'private',
  7527. fn: function (anObject){
  7528. var self=this;
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. return $core.withContext(function($ctx1) {
  7531. //>>excludeEnd("ctx");
  7532. // include nil to well-known objects under 'boolean' fastBucket
  7533. if (anObject == null || anObject.isNil) return [ null, self['@fastBuckets'].boolean ];
  7534. var prim = anObject.valueOf();
  7535. if (typeof prim === "object" || typeof prim === "function" || !self['@fastBuckets'][typeof prim]) {
  7536. var bucket = null;
  7537. self['@slowBucketStores'].some(function (store) {
  7538. return bucket = store._bucketOfElement_(anObject);
  7539. });
  7540. return [ anObject, null, bucket || self['@defaultBucket'] ];
  7541. }
  7542. return [ prim, self['@fastBuckets'][typeof prim] ];
  7543. ;
  7544. return self;
  7545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7546. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7547. //>>excludeEnd("ctx");
  7548. },
  7549. //>>excludeStart("ide", pragmas.excludeIdeData);
  7550. args: ["anObject"],
  7551. 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<\x0a\x09\x09// include nil to well-known objects under 'boolean' 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>",
  7552. referencedClasses: [],
  7553. //>>excludeEnd("ide");
  7554. messageSends: []
  7555. }),
  7556. $globals.Set);
  7557. $core.addMethod(
  7558. $core.method({
  7559. selector: "classNameOf:",
  7560. protocol: 'private',
  7561. fn: function (anObject){
  7562. var self=this;
  7563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7564. return $core.withContext(function($ctx1) {
  7565. //>>excludeEnd("ctx");
  7566. return anObject.klass != null && anObject.klass.className;
  7567. return self;
  7568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7569. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7570. //>>excludeEnd("ctx");
  7571. },
  7572. //>>excludeStart("ide", pragmas.excludeIdeData);
  7573. args: ["anObject"],
  7574. 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<return anObject.klass != null && anObject.klass.className>",
  7575. referencedClasses: [],
  7576. //>>excludeEnd("ide");
  7577. messageSends: []
  7578. }),
  7579. $globals.Set);
  7580. $core.addMethod(
  7581. $core.method({
  7582. selector: "collect:",
  7583. protocol: 'enumerating',
  7584. fn: function (aBlock){
  7585. var self=this;
  7586. var collection;
  7587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7588. return $core.withContext(function($ctx1) {
  7589. //>>excludeEnd("ctx");
  7590. collection=$recv(self._class())._new();
  7591. self._do_((function(each){
  7592. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7593. return $core.withContext(function($ctx2) {
  7594. //>>excludeEnd("ctx");
  7595. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7598. //>>excludeEnd("ctx");
  7599. }));
  7600. return collection;
  7601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7602. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7603. //>>excludeEnd("ctx");
  7604. },
  7605. //>>excludeStart("ide", pragmas.excludeIdeData);
  7606. args: ["aBlock"],
  7607. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7608. referencedClasses: [],
  7609. //>>excludeEnd("ide");
  7610. messageSends: ["new", "class", "do:", "add:", "value:"]
  7611. }),
  7612. $globals.Set);
  7613. $core.addMethod(
  7614. $core.method({
  7615. selector: "detect:ifNone:",
  7616. protocol: 'enumerating',
  7617. fn: function (aBlock,anotherBlock){
  7618. var self=this;
  7619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7620. return $core.withContext(function($ctx1) {
  7621. //>>excludeEnd("ctx");
  7622. var $1;
  7623. var $early={};
  7624. try {
  7625. self._do_((function(each){
  7626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7627. return $core.withContext(function($ctx2) {
  7628. //>>excludeEnd("ctx");
  7629. $1=$recv(aBlock)._value_(each);
  7630. if($core.assert($1)){
  7631. throw $early=[each];
  7632. };
  7633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7635. //>>excludeEnd("ctx");
  7636. }));
  7637. return $recv(anotherBlock)._value();
  7638. }
  7639. catch(e) {if(e===$early)return e[0]; throw e}
  7640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7641. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7642. //>>excludeEnd("ctx");
  7643. },
  7644. //>>excludeStart("ide", pragmas.excludeIdeData);
  7645. args: ["aBlock", "anotherBlock"],
  7646. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7647. referencedClasses: [],
  7648. //>>excludeEnd("ide");
  7649. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7650. }),
  7651. $globals.Set);
  7652. $core.addMethod(
  7653. $core.method({
  7654. selector: "do:",
  7655. protocol: 'enumerating',
  7656. fn: function (aBlock){
  7657. var self=this;
  7658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7659. return $core.withContext(function($ctx1) {
  7660. //>>excludeEnd("ctx");
  7661. var el, keys, i;
  7662. el = self['@fastBuckets'];
  7663. keys = Object.keys(el);
  7664. for (i = 0; i < keys.length; ++i) {
  7665. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7666. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7667. else { store._do_(aBlock); }
  7668. }
  7669. el = self['@slowBucketStores'];
  7670. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7671. self['@defaultBucket']._do_(aBlock);
  7672. ;
  7673. return self;
  7674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7675. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7676. //>>excludeEnd("ctx");
  7677. },
  7678. //>>excludeStart("ide", pragmas.excludeIdeData);
  7679. args: ["aBlock"],
  7680. source: "do: aBlock\x0a\x09<\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>",
  7681. referencedClasses: [],
  7682. //>>excludeEnd("ide");
  7683. messageSends: []
  7684. }),
  7685. $globals.Set);
  7686. $core.addMethod(
  7687. $core.method({
  7688. selector: "includes:",
  7689. protocol: 'testing',
  7690. fn: function (anObject){
  7691. var self=this;
  7692. var bucket;
  7693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7694. return $core.withContext(function($ctx1) {
  7695. //>>excludeEnd("ctx");
  7696. var $1,$2,$3,$receiver;
  7697. bucket=self._bucketsOfElement_(anObject);
  7698. $1=$recv(bucket)._second();
  7699. if(($receiver = $1) == null || $receiver.isNil){
  7700. $2=$recv(bucket)._third();
  7701. $3=$recv(bucket)._first();
  7702. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7703. $ctx1.sendIdx["first"]=1;
  7704. //>>excludeEnd("ctx");
  7705. return $recv($2)._includes_($3);
  7706. } else {
  7707. var primitiveBucket;
  7708. primitiveBucket=$receiver;
  7709. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7710. };
  7711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7712. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7713. //>>excludeEnd("ctx");
  7714. },
  7715. //>>excludeStart("ide", pragmas.excludeIdeData);
  7716. args: ["anObject"],
  7717. 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 ]",
  7718. referencedClasses: [],
  7719. //>>excludeEnd("ide");
  7720. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7721. }),
  7722. $globals.Set);
  7723. $core.addMethod(
  7724. $core.method({
  7725. selector: "includes:in:",
  7726. protocol: 'private',
  7727. fn: function (anObject,anotherObject){
  7728. var self=this;
  7729. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7730. return $core.withContext(function($ctx1) {
  7731. //>>excludeEnd("ctx");
  7732. return anObject in anotherObject.store;
  7733. return self;
  7734. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7735. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7736. //>>excludeEnd("ctx");
  7737. },
  7738. //>>excludeStart("ide", pragmas.excludeIdeData);
  7739. args: ["anObject", "anotherObject"],
  7740. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  7741. referencedClasses: [],
  7742. //>>excludeEnd("ide");
  7743. messageSends: []
  7744. }),
  7745. $globals.Set);
  7746. $core.addMethod(
  7747. $core.method({
  7748. selector: "initialize",
  7749. protocol: 'initialization',
  7750. fn: function (){
  7751. var self=this;
  7752. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7753. return $core.withContext(function($ctx1) {
  7754. //>>excludeEnd("ctx");
  7755. (
  7756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7757. $ctx1.supercall = true,
  7758. //>>excludeEnd("ctx");
  7759. ($globals.Set.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  7760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7761. $ctx1.supercall = false;
  7762. //>>excludeEnd("ctx");;
  7763. self["@defaultBucket"]=[];
  7764. self._initializeSlowBucketStores();
  7765. self._removeAll();
  7766. return self;
  7767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7768. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7769. //>>excludeEnd("ctx");
  7770. },
  7771. //>>excludeStart("ide", pragmas.excludeIdeData);
  7772. args: [],
  7773. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7774. referencedClasses: [],
  7775. //>>excludeEnd("ide");
  7776. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7777. }),
  7778. $globals.Set);
  7779. $core.addMethod(
  7780. $core.method({
  7781. selector: "initializeSlowBucketStores",
  7782. protocol: 'initialization',
  7783. fn: function (){
  7784. var self=this;
  7785. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  7786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7787. return $core.withContext(function($ctx1) {
  7788. //>>excludeEnd("ctx");
  7789. var $1;
  7790. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  7791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7792. return $core.withContext(function($ctx2) {
  7793. //>>excludeEnd("ctx");
  7794. return self._classNameOf_(x);
  7795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7796. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7797. //>>excludeEnd("ctx");
  7798. }));
  7799. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7800. $ctx1.sendIdx["hashBlock:"]=1;
  7801. //>>excludeEnd("ctx");
  7802. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  7803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7804. return $core.withContext(function($ctx2) {
  7805. //>>excludeEnd("ctx");
  7806. return self._jsConstructorNameOf_(x);
  7807. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7808. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7809. //>>excludeEnd("ctx");
  7810. }))];
  7811. return self;
  7812. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7813. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7814. //>>excludeEnd("ctx");
  7815. },
  7816. //>>excludeStart("ide", pragmas.excludeIdeData);
  7817. args: [],
  7818. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7819. referencedClasses: ["ArrayBucketStore"],
  7820. //>>excludeEnd("ide");
  7821. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7822. }),
  7823. $globals.Set);
  7824. $core.addMethod(
  7825. $core.method({
  7826. selector: "jsConstructorNameOf:",
  7827. protocol: 'private',
  7828. fn: function (anObject){
  7829. var self=this;
  7830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7831. return $core.withContext(function($ctx1) {
  7832. //>>excludeEnd("ctx");
  7833. return anObject.constructor && anObject.constructor.name;
  7834. return self;
  7835. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7836. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7837. //>>excludeEnd("ctx");
  7838. },
  7839. //>>excludeStart("ide", pragmas.excludeIdeData);
  7840. args: ["anObject"],
  7841. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  7842. referencedClasses: [],
  7843. //>>excludeEnd("ide");
  7844. messageSends: []
  7845. }),
  7846. $globals.Set);
  7847. $core.addMethod(
  7848. $core.method({
  7849. selector: "printOn:",
  7850. protocol: 'printing',
  7851. fn: function (aStream){
  7852. var self=this;
  7853. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7854. return $core.withContext(function($ctx1) {
  7855. //>>excludeEnd("ctx");
  7856. (
  7857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7858. $ctx1.supercall = true,
  7859. //>>excludeEnd("ctx");
  7860. ($globals.Set.superclass||$boot.dnu).fn.prototype._printOn_.apply($recv(self), [aStream]));
  7861. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7862. $ctx1.supercall = false;
  7863. //>>excludeEnd("ctx");;
  7864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7865. $ctx1.sendIdx["printOn:"]=1;
  7866. //>>excludeEnd("ctx");
  7867. $recv(aStream)._nextPutAll_(" (");
  7868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7869. $ctx1.sendIdx["nextPutAll:"]=1;
  7870. //>>excludeEnd("ctx");
  7871. self._do_separatedBy_((function(each){
  7872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7873. return $core.withContext(function($ctx2) {
  7874. //>>excludeEnd("ctx");
  7875. return $recv(each)._printOn_(aStream);
  7876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7877. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7878. //>>excludeEnd("ctx");
  7879. }),(function(){
  7880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7881. return $core.withContext(function($ctx2) {
  7882. //>>excludeEnd("ctx");
  7883. return $recv(aStream)._nextPutAll_(" ");
  7884. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7885. $ctx2.sendIdx["nextPutAll:"]=2;
  7886. //>>excludeEnd("ctx");
  7887. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7888. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7889. //>>excludeEnd("ctx");
  7890. }));
  7891. $recv(aStream)._nextPutAll_(")");
  7892. return self;
  7893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7894. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7895. //>>excludeEnd("ctx");
  7896. },
  7897. //>>excludeStart("ide", pragmas.excludeIdeData);
  7898. args: ["aStream"],
  7899. 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: ')'",
  7900. referencedClasses: [],
  7901. //>>excludeEnd("ide");
  7902. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7903. }),
  7904. $globals.Set);
  7905. $core.addMethod(
  7906. $core.method({
  7907. selector: "remove:ifAbsent:",
  7908. protocol: 'adding/removing',
  7909. fn: function (anObject,aBlock){
  7910. var self=this;
  7911. var bucket;
  7912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7913. return $core.withContext(function($ctx1) {
  7914. //>>excludeEnd("ctx");
  7915. var $1,$2,$3,$receiver;
  7916. var $early={};
  7917. try {
  7918. bucket=self._bucketsOfElement_(anObject);
  7919. $1=$recv(bucket)._second();
  7920. if(($receiver = $1) == null || $receiver.isNil){
  7921. $2=$recv(bucket)._third();
  7922. $3=$recv(bucket)._first();
  7923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7924. $ctx1.sendIdx["first"]=1;
  7925. //>>excludeEnd("ctx");
  7926. $recv($2)._remove_ifAbsent_($3,(function(){
  7927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7928. return $core.withContext(function($ctx2) {
  7929. //>>excludeEnd("ctx");
  7930. throw $early=[$recv(aBlock)._value()];
  7931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7933. //>>excludeEnd("ctx");
  7934. }));
  7935. self["@size"]=$recv(self["@size"]).__minus((1));
  7936. return self["@size"];
  7937. } else {
  7938. var primitiveBucket;
  7939. primitiveBucket=$receiver;
  7940. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  7941. };
  7942. }
  7943. catch(e) {if(e===$early)return e[0]; throw e}
  7944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7945. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7946. //>>excludeEnd("ctx");
  7947. },
  7948. //>>excludeStart("ide", pragmas.excludeIdeData);
  7949. args: ["anObject", "aBlock"],
  7950. 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 ]",
  7951. referencedClasses: [],
  7952. //>>excludeEnd("ide");
  7953. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  7954. }),
  7955. $globals.Set);
  7956. $core.addMethod(
  7957. $core.method({
  7958. selector: "remove:in:",
  7959. protocol: 'private',
  7960. fn: function (anObject,anotherObject){
  7961. var self=this;
  7962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7963. return $core.withContext(function($ctx1) {
  7964. //>>excludeEnd("ctx");
  7965. if (delete anotherObject.store[anObject]) self['@size']--;
  7966. return self;
  7967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7968. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7969. //>>excludeEnd("ctx");
  7970. },
  7971. //>>excludeStart("ide", pragmas.excludeIdeData);
  7972. args: ["anObject", "anotherObject"],
  7973. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  7974. referencedClasses: [],
  7975. //>>excludeEnd("ide");
  7976. messageSends: []
  7977. }),
  7978. $globals.Set);
  7979. $core.addMethod(
  7980. $core.method({
  7981. selector: "removeAll",
  7982. protocol: 'adding/removing',
  7983. fn: function (){
  7984. var self=this;
  7985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7986. return $core.withContext(function($ctx1) {
  7987. //>>excludeEnd("ctx");
  7988. self['@fastBuckets'] = {
  7989. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  7990. 'number': { store: Object.create(null), fn: Number },
  7991. 'string': { store: Object.create(null) }
  7992. };
  7993. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7994. self['@defaultBucket']._removeAll();
  7995. self['@size'] = 0;
  7996. ;
  7997. return self;
  7998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7999. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8000. //>>excludeEnd("ctx");
  8001. },
  8002. //>>excludeStart("ide", pragmas.excludeIdeData);
  8003. args: [],
  8004. source: "removeAll\x0a\x09<\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { 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>",
  8005. referencedClasses: [],
  8006. //>>excludeEnd("ide");
  8007. messageSends: []
  8008. }),
  8009. $globals.Set);
  8010. $core.addMethod(
  8011. $core.method({
  8012. selector: "select:",
  8013. protocol: 'enumerating',
  8014. fn: function (aBlock){
  8015. var self=this;
  8016. var collection;
  8017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8018. return $core.withContext(function($ctx1) {
  8019. //>>excludeEnd("ctx");
  8020. var $1;
  8021. collection=$recv(self._class())._new();
  8022. self._do_((function(each){
  8023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8024. return $core.withContext(function($ctx2) {
  8025. //>>excludeEnd("ctx");
  8026. $1=$recv(aBlock)._value_(each);
  8027. if($core.assert($1)){
  8028. return $recv(collection)._add_(each);
  8029. };
  8030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8031. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8032. //>>excludeEnd("ctx");
  8033. }));
  8034. return collection;
  8035. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8036. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8037. //>>excludeEnd("ctx");
  8038. },
  8039. //>>excludeStart("ide", pragmas.excludeIdeData);
  8040. args: ["aBlock"],
  8041. 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",
  8042. referencedClasses: [],
  8043. //>>excludeEnd("ide");
  8044. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8045. }),
  8046. $globals.Set);
  8047. $core.addMethod(
  8048. $core.method({
  8049. selector: "size",
  8050. protocol: 'accessing',
  8051. fn: function (){
  8052. var self=this;
  8053. return self["@size"];
  8054. },
  8055. //>>excludeStart("ide", pragmas.excludeIdeData);
  8056. args: [],
  8057. source: "size\x0a\x09^ size",
  8058. referencedClasses: [],
  8059. //>>excludeEnd("ide");
  8060. messageSends: []
  8061. }),
  8062. $globals.Set);
  8063. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  8064. //>>excludeStart("ide", pragmas.excludeIdeData);
  8065. $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.";
  8066. //>>excludeEnd("ide");
  8067. $core.addMethod(
  8068. $core.method({
  8069. selector: "<<",
  8070. protocol: 'writing',
  8071. fn: function (anObject){
  8072. var self=this;
  8073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8074. return $core.withContext(function($ctx1) {
  8075. //>>excludeEnd("ctx");
  8076. self._write_(anObject);
  8077. return self;
  8078. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8079. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8080. //>>excludeEnd("ctx");
  8081. },
  8082. //>>excludeStart("ide", pragmas.excludeIdeData);
  8083. args: ["anObject"],
  8084. source: "<< anObject\x0a\x09self write: anObject",
  8085. referencedClasses: [],
  8086. //>>excludeEnd("ide");
  8087. messageSends: ["write:"]
  8088. }),
  8089. $globals.ProtoStream);
  8090. $core.addMethod(
  8091. $core.method({
  8092. selector: "atEnd",
  8093. protocol: 'testing',
  8094. fn: function (){
  8095. var self=this;
  8096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8097. return $core.withContext(function($ctx1) {
  8098. //>>excludeEnd("ctx");
  8099. self._subclassResponsibility();
  8100. return self;
  8101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8102. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8103. //>>excludeEnd("ctx");
  8104. },
  8105. //>>excludeStart("ide", pragmas.excludeIdeData);
  8106. args: [],
  8107. source: "atEnd\x0a\x09self subclassResponsibility",
  8108. referencedClasses: [],
  8109. //>>excludeEnd("ide");
  8110. messageSends: ["subclassResponsibility"]
  8111. }),
  8112. $globals.ProtoStream);
  8113. $core.addMethod(
  8114. $core.method({
  8115. selector: "atStart",
  8116. protocol: 'testing',
  8117. fn: function (){
  8118. var self=this;
  8119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8120. return $core.withContext(function($ctx1) {
  8121. //>>excludeEnd("ctx");
  8122. self._subclassResponsibility();
  8123. return self;
  8124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8125. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8126. //>>excludeEnd("ctx");
  8127. },
  8128. //>>excludeStart("ide", pragmas.excludeIdeData);
  8129. args: [],
  8130. source: "atStart\x0a\x09self subclassResponsibility",
  8131. referencedClasses: [],
  8132. //>>excludeEnd("ide");
  8133. messageSends: ["subclassResponsibility"]
  8134. }),
  8135. $globals.ProtoStream);
  8136. $core.addMethod(
  8137. $core.method({
  8138. selector: "contents",
  8139. protocol: 'accessing',
  8140. fn: function (){
  8141. var self=this;
  8142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8143. return $core.withContext(function($ctx1) {
  8144. //>>excludeEnd("ctx");
  8145. self._subclassResponsibility();
  8146. return self;
  8147. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8148. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8149. //>>excludeEnd("ctx");
  8150. },
  8151. //>>excludeStart("ide", pragmas.excludeIdeData);
  8152. args: [],
  8153. source: "contents\x0a\x09self subclassResponsibility",
  8154. referencedClasses: [],
  8155. //>>excludeEnd("ide");
  8156. messageSends: ["subclassResponsibility"]
  8157. }),
  8158. $globals.ProtoStream);
  8159. $core.addMethod(
  8160. $core.method({
  8161. selector: "do:",
  8162. protocol: 'enumerating',
  8163. fn: function (aBlock){
  8164. var self=this;
  8165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8166. return $core.withContext(function($ctx1) {
  8167. //>>excludeEnd("ctx");
  8168. $recv((function(){
  8169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8170. return $core.withContext(function($ctx2) {
  8171. //>>excludeEnd("ctx");
  8172. return self._atEnd();
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8175. //>>excludeEnd("ctx");
  8176. }))._whileFalse_((function(){
  8177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8178. return $core.withContext(function($ctx2) {
  8179. //>>excludeEnd("ctx");
  8180. return $recv(aBlock)._value_(self._next());
  8181. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8182. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8183. //>>excludeEnd("ctx");
  8184. }));
  8185. return self;
  8186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8187. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8188. //>>excludeEnd("ctx");
  8189. },
  8190. //>>excludeStart("ide", pragmas.excludeIdeData);
  8191. args: ["aBlock"],
  8192. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8193. referencedClasses: [],
  8194. //>>excludeEnd("ide");
  8195. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8196. }),
  8197. $globals.ProtoStream);
  8198. $core.addMethod(
  8199. $core.method({
  8200. selector: "isEmpty",
  8201. protocol: 'testing',
  8202. fn: function (){
  8203. var self=this;
  8204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8205. return $core.withContext(function($ctx1) {
  8206. //>>excludeEnd("ctx");
  8207. return $recv(self._atStart())._and_((function(){
  8208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8209. return $core.withContext(function($ctx2) {
  8210. //>>excludeEnd("ctx");
  8211. return self._atEnd();
  8212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8213. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8214. //>>excludeEnd("ctx");
  8215. }));
  8216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8217. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8218. //>>excludeEnd("ctx");
  8219. },
  8220. //>>excludeStart("ide", pragmas.excludeIdeData);
  8221. args: [],
  8222. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8223. referencedClasses: [],
  8224. //>>excludeEnd("ide");
  8225. messageSends: ["and:", "atStart", "atEnd"]
  8226. }),
  8227. $globals.ProtoStream);
  8228. $core.addMethod(
  8229. $core.method({
  8230. selector: "next",
  8231. protocol: 'reading',
  8232. fn: function (){
  8233. var self=this;
  8234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8235. return $core.withContext(function($ctx1) {
  8236. //>>excludeEnd("ctx");
  8237. var $1;
  8238. $1=self._atEnd();
  8239. if($core.assert($1)){
  8240. return nil;
  8241. } else {
  8242. return self._subclassResponsibility();
  8243. };
  8244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8245. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8246. //>>excludeEnd("ctx");
  8247. },
  8248. //>>excludeStart("ide", pragmas.excludeIdeData);
  8249. args: [],
  8250. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8251. referencedClasses: [],
  8252. //>>excludeEnd("ide");
  8253. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8254. }),
  8255. $globals.ProtoStream);
  8256. $core.addMethod(
  8257. $core.method({
  8258. selector: "nextPut:",
  8259. protocol: 'writing',
  8260. fn: function (anObject){
  8261. var self=this;
  8262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8263. return $core.withContext(function($ctx1) {
  8264. //>>excludeEnd("ctx");
  8265. self._subclassResponsibility();
  8266. return self;
  8267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8268. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8269. //>>excludeEnd("ctx");
  8270. },
  8271. //>>excludeStart("ide", pragmas.excludeIdeData);
  8272. args: ["anObject"],
  8273. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8274. referencedClasses: [],
  8275. //>>excludeEnd("ide");
  8276. messageSends: ["subclassResponsibility"]
  8277. }),
  8278. $globals.ProtoStream);
  8279. $core.addMethod(
  8280. $core.method({
  8281. selector: "nextPutAll:",
  8282. protocol: 'writing',
  8283. fn: function (aCollection){
  8284. var self=this;
  8285. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8286. return $core.withContext(function($ctx1) {
  8287. //>>excludeEnd("ctx");
  8288. $recv(aCollection)._do_((function(each){
  8289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8290. return $core.withContext(function($ctx2) {
  8291. //>>excludeEnd("ctx");
  8292. return self._nextPut_(each);
  8293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8295. //>>excludeEnd("ctx");
  8296. }));
  8297. return self;
  8298. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8299. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8300. //>>excludeEnd("ctx");
  8301. },
  8302. //>>excludeStart("ide", pragmas.excludeIdeData);
  8303. args: ["aCollection"],
  8304. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8305. referencedClasses: [],
  8306. //>>excludeEnd("ide");
  8307. messageSends: ["do:", "nextPut:"]
  8308. }),
  8309. $globals.ProtoStream);
  8310. $core.addMethod(
  8311. $core.method({
  8312. selector: "nextPutJSObject:",
  8313. protocol: 'writing',
  8314. fn: function (aJSObject){
  8315. var self=this;
  8316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8317. return $core.withContext(function($ctx1) {
  8318. //>>excludeEnd("ctx");
  8319. self._nextPut_(aJSObject);
  8320. return self;
  8321. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8322. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  8323. //>>excludeEnd("ctx");
  8324. },
  8325. //>>excludeStart("ide", pragmas.excludeIdeData);
  8326. args: ["aJSObject"],
  8327. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  8328. referencedClasses: [],
  8329. //>>excludeEnd("ide");
  8330. messageSends: ["nextPut:"]
  8331. }),
  8332. $globals.ProtoStream);
  8333. $core.addMethod(
  8334. $core.method({
  8335. selector: "nextPutString:",
  8336. protocol: 'writing',
  8337. fn: function (aString){
  8338. var self=this;
  8339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8340. return $core.withContext(function($ctx1) {
  8341. //>>excludeEnd("ctx");
  8342. self._nextPut_(aString);
  8343. return self;
  8344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8345. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8346. //>>excludeEnd("ctx");
  8347. },
  8348. //>>excludeStart("ide", pragmas.excludeIdeData);
  8349. args: ["aString"],
  8350. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8351. referencedClasses: [],
  8352. //>>excludeEnd("ide");
  8353. messageSends: ["nextPut:"]
  8354. }),
  8355. $globals.ProtoStream);
  8356. $core.addMethod(
  8357. $core.method({
  8358. selector: "peek",
  8359. protocol: 'reading',
  8360. fn: function (){
  8361. var self=this;
  8362. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8363. return $core.withContext(function($ctx1) {
  8364. //>>excludeEnd("ctx");
  8365. var $1;
  8366. $1=self._atEnd();
  8367. if($core.assert($1)){
  8368. return nil;
  8369. } else {
  8370. return self._subclassResponsibility();
  8371. };
  8372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8373. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8374. //>>excludeEnd("ctx");
  8375. },
  8376. //>>excludeStart("ide", pragmas.excludeIdeData);
  8377. args: [],
  8378. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8379. referencedClasses: [],
  8380. //>>excludeEnd("ide");
  8381. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8382. }),
  8383. $globals.ProtoStream);
  8384. $core.addMethod(
  8385. $core.method({
  8386. selector: "reset",
  8387. protocol: 'actions',
  8388. fn: function (){
  8389. var self=this;
  8390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8391. return $core.withContext(function($ctx1) {
  8392. //>>excludeEnd("ctx");
  8393. self._subclassResponsibility();
  8394. return self;
  8395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8396. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8397. //>>excludeEnd("ctx");
  8398. },
  8399. //>>excludeStart("ide", pragmas.excludeIdeData);
  8400. args: [],
  8401. source: "reset\x0a\x09self subclassResponsibility",
  8402. referencedClasses: [],
  8403. //>>excludeEnd("ide");
  8404. messageSends: ["subclassResponsibility"]
  8405. }),
  8406. $globals.ProtoStream);
  8407. $core.addMethod(
  8408. $core.method({
  8409. selector: "resetContents",
  8410. protocol: 'actions',
  8411. fn: function (){
  8412. var self=this;
  8413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8414. return $core.withContext(function($ctx1) {
  8415. //>>excludeEnd("ctx");
  8416. self._subclassResponsibility();
  8417. return self;
  8418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8419. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8420. //>>excludeEnd("ctx");
  8421. },
  8422. //>>excludeStart("ide", pragmas.excludeIdeData);
  8423. args: [],
  8424. source: "resetContents\x0a\x09self subclassResponsibility",
  8425. referencedClasses: [],
  8426. //>>excludeEnd("ide");
  8427. messageSends: ["subclassResponsibility"]
  8428. }),
  8429. $globals.ProtoStream);
  8430. $core.addMethod(
  8431. $core.method({
  8432. selector: "setToEnd",
  8433. protocol: 'positioning',
  8434. fn: function (){
  8435. var self=this;
  8436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8437. return $core.withContext(function($ctx1) {
  8438. //>>excludeEnd("ctx");
  8439. self._subclassResponsibility();
  8440. return self;
  8441. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8442. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8443. //>>excludeEnd("ctx");
  8444. },
  8445. //>>excludeStart("ide", pragmas.excludeIdeData);
  8446. args: [],
  8447. source: "setToEnd\x0a\x09self subclassResponsibility",
  8448. referencedClasses: [],
  8449. //>>excludeEnd("ide");
  8450. messageSends: ["subclassResponsibility"]
  8451. }),
  8452. $globals.ProtoStream);
  8453. $core.addMethod(
  8454. $core.method({
  8455. selector: "setToStart",
  8456. protocol: 'positioning',
  8457. fn: function (){
  8458. var self=this;
  8459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8460. return $core.withContext(function($ctx1) {
  8461. //>>excludeEnd("ctx");
  8462. self._reset();
  8463. return self;
  8464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8465. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8466. //>>excludeEnd("ctx");
  8467. },
  8468. //>>excludeStart("ide", pragmas.excludeIdeData);
  8469. args: [],
  8470. source: "setToStart\x0a\x09self reset",
  8471. referencedClasses: [],
  8472. //>>excludeEnd("ide");
  8473. messageSends: ["reset"]
  8474. }),
  8475. $globals.ProtoStream);
  8476. $core.addMethod(
  8477. $core.method({
  8478. selector: "write:",
  8479. protocol: 'writing',
  8480. fn: function (anObject){
  8481. var self=this;
  8482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8483. return $core.withContext(function($ctx1) {
  8484. //>>excludeEnd("ctx");
  8485. $recv(anObject)._putOn_(self);
  8486. return self;
  8487. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8488. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8489. //>>excludeEnd("ctx");
  8490. },
  8491. //>>excludeStart("ide", pragmas.excludeIdeData);
  8492. args: ["anObject"],
  8493. source: "write: anObject\x0a\x09anObject putOn: self",
  8494. referencedClasses: [],
  8495. //>>excludeEnd("ide");
  8496. messageSends: ["putOn:"]
  8497. }),
  8498. $globals.ProtoStream);
  8499. $core.addMethod(
  8500. $core.method({
  8501. selector: "on:",
  8502. protocol: 'instance creation',
  8503. fn: function (aCollection){
  8504. var self=this;
  8505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8506. return $core.withContext(function($ctx1) {
  8507. //>>excludeEnd("ctx");
  8508. var $1;
  8509. $1=self._new();
  8510. $recv($1)._setCollection_(aCollection);
  8511. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8512. return $recv($1)._yourself();
  8513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8514. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  8515. //>>excludeEnd("ctx");
  8516. },
  8517. //>>excludeStart("ide", pragmas.excludeIdeData);
  8518. args: ["aCollection"],
  8519. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8520. referencedClasses: [],
  8521. //>>excludeEnd("ide");
  8522. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8523. }),
  8524. $globals.ProtoStream.klass);
  8525. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  8526. //>>excludeStart("ide", pragmas.excludeIdeData);
  8527. $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.";
  8528. //>>excludeEnd("ide");
  8529. $core.addMethod(
  8530. $core.method({
  8531. selector: "atEnd",
  8532. protocol: 'testing',
  8533. fn: function (){
  8534. var self=this;
  8535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8536. return $core.withContext(function($ctx1) {
  8537. //>>excludeEnd("ctx");
  8538. return $recv(self._position()).__eq(self._size());
  8539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8540. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8541. //>>excludeEnd("ctx");
  8542. },
  8543. //>>excludeStart("ide", pragmas.excludeIdeData);
  8544. args: [],
  8545. source: "atEnd\x0a\x09^ self position = self size",
  8546. referencedClasses: [],
  8547. //>>excludeEnd("ide");
  8548. messageSends: ["=", "position", "size"]
  8549. }),
  8550. $globals.Stream);
  8551. $core.addMethod(
  8552. $core.method({
  8553. selector: "atStart",
  8554. protocol: 'testing',
  8555. fn: function (){
  8556. var self=this;
  8557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8558. return $core.withContext(function($ctx1) {
  8559. //>>excludeEnd("ctx");
  8560. return $recv(self._position()).__eq((0));
  8561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8562. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8563. //>>excludeEnd("ctx");
  8564. },
  8565. //>>excludeStart("ide", pragmas.excludeIdeData);
  8566. args: [],
  8567. source: "atStart\x0a\x09^ self position = 0",
  8568. referencedClasses: [],
  8569. //>>excludeEnd("ide");
  8570. messageSends: ["=", "position"]
  8571. }),
  8572. $globals.Stream);
  8573. $core.addMethod(
  8574. $core.method({
  8575. selector: "close",
  8576. protocol: 'actions',
  8577. fn: function (){
  8578. var self=this;
  8579. return self;
  8580. },
  8581. //>>excludeStart("ide", pragmas.excludeIdeData);
  8582. args: [],
  8583. source: "close",
  8584. referencedClasses: [],
  8585. //>>excludeEnd("ide");
  8586. messageSends: []
  8587. }),
  8588. $globals.Stream);
  8589. $core.addMethod(
  8590. $core.method({
  8591. selector: "collection",
  8592. protocol: 'accessing',
  8593. fn: function (){
  8594. var self=this;
  8595. return self["@collection"];
  8596. },
  8597. //>>excludeStart("ide", pragmas.excludeIdeData);
  8598. args: [],
  8599. source: "collection\x0a\x09^ collection",
  8600. referencedClasses: [],
  8601. //>>excludeEnd("ide");
  8602. messageSends: []
  8603. }),
  8604. $globals.Stream);
  8605. $core.addMethod(
  8606. $core.method({
  8607. selector: "contents",
  8608. protocol: 'accessing',
  8609. fn: function (){
  8610. var self=this;
  8611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8612. return $core.withContext(function($ctx1) {
  8613. //>>excludeEnd("ctx");
  8614. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  8615. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8616. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8617. //>>excludeEnd("ctx");
  8618. },
  8619. //>>excludeStart("ide", pragmas.excludeIdeData);
  8620. args: [],
  8621. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8622. referencedClasses: [],
  8623. //>>excludeEnd("ide");
  8624. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8625. }),
  8626. $globals.Stream);
  8627. $core.addMethod(
  8628. $core.method({
  8629. selector: "flush",
  8630. protocol: 'actions',
  8631. fn: function (){
  8632. var self=this;
  8633. return self;
  8634. },
  8635. //>>excludeStart("ide", pragmas.excludeIdeData);
  8636. args: [],
  8637. source: "flush",
  8638. referencedClasses: [],
  8639. //>>excludeEnd("ide");
  8640. messageSends: []
  8641. }),
  8642. $globals.Stream);
  8643. $core.addMethod(
  8644. $core.method({
  8645. selector: "isEmpty",
  8646. protocol: 'testing',
  8647. fn: function (){
  8648. var self=this;
  8649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8650. return $core.withContext(function($ctx1) {
  8651. //>>excludeEnd("ctx");
  8652. return $recv(self._size()).__eq((0));
  8653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8654. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8655. //>>excludeEnd("ctx");
  8656. },
  8657. //>>excludeStart("ide", pragmas.excludeIdeData);
  8658. args: [],
  8659. source: "isEmpty\x0a\x09^ self size = 0",
  8660. referencedClasses: [],
  8661. //>>excludeEnd("ide");
  8662. messageSends: ["=", "size"]
  8663. }),
  8664. $globals.Stream);
  8665. $core.addMethod(
  8666. $core.method({
  8667. selector: "next",
  8668. protocol: 'reading',
  8669. fn: function (){
  8670. var self=this;
  8671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8672. return $core.withContext(function($ctx1) {
  8673. //>>excludeEnd("ctx");
  8674. var $1,$3,$2;
  8675. $1=self._atEnd();
  8676. if($core.assert($1)){
  8677. return nil;
  8678. } else {
  8679. $3=self._position();
  8680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8681. $ctx1.sendIdx["position"]=1;
  8682. //>>excludeEnd("ctx");
  8683. $2=$recv($3).__plus((1));
  8684. self._position_($2);
  8685. return $recv(self["@collection"])._at_(self._position());
  8686. };
  8687. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8688. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8689. //>>excludeEnd("ctx");
  8690. },
  8691. //>>excludeStart("ide", pragmas.excludeIdeData);
  8692. args: [],
  8693. 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 ]",
  8694. referencedClasses: [],
  8695. //>>excludeEnd("ide");
  8696. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8697. }),
  8698. $globals.Stream);
  8699. $core.addMethod(
  8700. $core.method({
  8701. selector: "next:",
  8702. protocol: 'reading',
  8703. fn: function (anInteger){
  8704. var self=this;
  8705. var tempCollection;
  8706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8707. return $core.withContext(function($ctx1) {
  8708. //>>excludeEnd("ctx");
  8709. var $1;
  8710. tempCollection=$recv($recv(self._collection())._class())._new();
  8711. $recv(anInteger)._timesRepeat_((function(){
  8712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8713. return $core.withContext(function($ctx2) {
  8714. //>>excludeEnd("ctx");
  8715. $1=self._atEnd();
  8716. if(!$core.assert($1)){
  8717. return $recv(tempCollection)._add_(self._next());
  8718. };
  8719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8721. //>>excludeEnd("ctx");
  8722. }));
  8723. return tempCollection;
  8724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8725. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8726. //>>excludeEnd("ctx");
  8727. },
  8728. //>>excludeStart("ide", pragmas.excludeIdeData);
  8729. args: ["anInteger"],
  8730. 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",
  8731. referencedClasses: [],
  8732. //>>excludeEnd("ide");
  8733. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8734. }),
  8735. $globals.Stream);
  8736. $core.addMethod(
  8737. $core.method({
  8738. selector: "nextPut:",
  8739. protocol: 'writing',
  8740. fn: function (anObject){
  8741. var self=this;
  8742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8743. return $core.withContext(function($ctx1) {
  8744. //>>excludeEnd("ctx");
  8745. var $2,$1,$3,$4;
  8746. $2=self._position();
  8747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8748. $ctx1.sendIdx["position"]=1;
  8749. //>>excludeEnd("ctx");
  8750. $1=$recv($2).__plus((1));
  8751. self._position_($1);
  8752. $3=self._collection();
  8753. $4=self._position();
  8754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8755. $ctx1.sendIdx["position"]=2;
  8756. //>>excludeEnd("ctx");
  8757. $recv($3)._at_put_($4,anObject);
  8758. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  8759. return self;
  8760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8761. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8762. //>>excludeEnd("ctx");
  8763. },
  8764. //>>excludeStart("ide", pragmas.excludeIdeData);
  8765. args: ["anObject"],
  8766. 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)",
  8767. referencedClasses: [],
  8768. //>>excludeEnd("ide");
  8769. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8770. }),
  8771. $globals.Stream);
  8772. $core.addMethod(
  8773. $core.method({
  8774. selector: "peek",
  8775. protocol: 'reading',
  8776. fn: function (){
  8777. var self=this;
  8778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8779. return $core.withContext(function($ctx1) {
  8780. //>>excludeEnd("ctx");
  8781. var $1;
  8782. $1=self._atEnd();
  8783. if(!$core.assert($1)){
  8784. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  8785. };
  8786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8787. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8788. //>>excludeEnd("ctx");
  8789. },
  8790. //>>excludeStart("ide", pragmas.excludeIdeData);
  8791. args: [],
  8792. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8793. referencedClasses: [],
  8794. //>>excludeEnd("ide");
  8795. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8796. }),
  8797. $globals.Stream);
  8798. $core.addMethod(
  8799. $core.method({
  8800. selector: "position",
  8801. protocol: 'accessing',
  8802. fn: function (){
  8803. var self=this;
  8804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8805. return $core.withContext(function($ctx1) {
  8806. //>>excludeEnd("ctx");
  8807. var $1,$receiver;
  8808. $1=self["@position"];
  8809. if(($receiver = $1) == null || $receiver.isNil){
  8810. self["@position"]=(0);
  8811. return self["@position"];
  8812. } else {
  8813. return $1;
  8814. };
  8815. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8816. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8817. //>>excludeEnd("ctx");
  8818. },
  8819. //>>excludeStart("ide", pragmas.excludeIdeData);
  8820. args: [],
  8821. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8822. referencedClasses: [],
  8823. //>>excludeEnd("ide");
  8824. messageSends: ["ifNil:"]
  8825. }),
  8826. $globals.Stream);
  8827. $core.addMethod(
  8828. $core.method({
  8829. selector: "position:",
  8830. protocol: 'accessing',
  8831. fn: function (anInteger){
  8832. var self=this;
  8833. self["@position"]=anInteger;
  8834. return self;
  8835. },
  8836. //>>excludeStart("ide", pragmas.excludeIdeData);
  8837. args: ["anInteger"],
  8838. source: "position: anInteger\x0a\x09position := anInteger",
  8839. referencedClasses: [],
  8840. //>>excludeEnd("ide");
  8841. messageSends: []
  8842. }),
  8843. $globals.Stream);
  8844. $core.addMethod(
  8845. $core.method({
  8846. selector: "reset",
  8847. protocol: 'actions',
  8848. fn: function (){
  8849. var self=this;
  8850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8851. return $core.withContext(function($ctx1) {
  8852. //>>excludeEnd("ctx");
  8853. self._position_((0));
  8854. return self;
  8855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8856. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8857. //>>excludeEnd("ctx");
  8858. },
  8859. //>>excludeStart("ide", pragmas.excludeIdeData);
  8860. args: [],
  8861. source: "reset\x0a\x09self position: 0",
  8862. referencedClasses: [],
  8863. //>>excludeEnd("ide");
  8864. messageSends: ["position:"]
  8865. }),
  8866. $globals.Stream);
  8867. $core.addMethod(
  8868. $core.method({
  8869. selector: "resetContents",
  8870. protocol: 'actions',
  8871. fn: function (){
  8872. var self=this;
  8873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8874. return $core.withContext(function($ctx1) {
  8875. //>>excludeEnd("ctx");
  8876. self._reset();
  8877. self._setStreamSize_((0));
  8878. return self;
  8879. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8880. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8881. //>>excludeEnd("ctx");
  8882. },
  8883. //>>excludeStart("ide", pragmas.excludeIdeData);
  8884. args: [],
  8885. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8886. referencedClasses: [],
  8887. //>>excludeEnd("ide");
  8888. messageSends: ["reset", "setStreamSize:"]
  8889. }),
  8890. $globals.Stream);
  8891. $core.addMethod(
  8892. $core.method({
  8893. selector: "setCollection:",
  8894. protocol: 'accessing',
  8895. fn: function (aCollection){
  8896. var self=this;
  8897. self["@collection"]=aCollection;
  8898. return self;
  8899. },
  8900. //>>excludeStart("ide", pragmas.excludeIdeData);
  8901. args: ["aCollection"],
  8902. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8903. referencedClasses: [],
  8904. //>>excludeEnd("ide");
  8905. messageSends: []
  8906. }),
  8907. $globals.Stream);
  8908. $core.addMethod(
  8909. $core.method({
  8910. selector: "setStreamSize:",
  8911. protocol: 'accessing',
  8912. fn: function (anInteger){
  8913. var self=this;
  8914. self["@streamSize"]=anInteger;
  8915. return self;
  8916. },
  8917. //>>excludeStart("ide", pragmas.excludeIdeData);
  8918. args: ["anInteger"],
  8919. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8920. referencedClasses: [],
  8921. //>>excludeEnd("ide");
  8922. messageSends: []
  8923. }),
  8924. $globals.Stream);
  8925. $core.addMethod(
  8926. $core.method({
  8927. selector: "setToEnd",
  8928. protocol: 'positioning',
  8929. fn: function (){
  8930. var self=this;
  8931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8932. return $core.withContext(function($ctx1) {
  8933. //>>excludeEnd("ctx");
  8934. self._position_(self._size());
  8935. return self;
  8936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8937. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8938. //>>excludeEnd("ctx");
  8939. },
  8940. //>>excludeStart("ide", pragmas.excludeIdeData);
  8941. args: [],
  8942. source: "setToEnd\x0a\x09self position: self size",
  8943. referencedClasses: [],
  8944. //>>excludeEnd("ide");
  8945. messageSends: ["position:", "size"]
  8946. }),
  8947. $globals.Stream);
  8948. $core.addMethod(
  8949. $core.method({
  8950. selector: "size",
  8951. protocol: 'accessing',
  8952. fn: function (){
  8953. var self=this;
  8954. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8955. return $core.withContext(function($ctx1) {
  8956. //>>excludeEnd("ctx");
  8957. return self._streamSize();
  8958. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8959. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8960. //>>excludeEnd("ctx");
  8961. },
  8962. //>>excludeStart("ide", pragmas.excludeIdeData);
  8963. args: [],
  8964. source: "size\x0a\x09^ self streamSize",
  8965. referencedClasses: [],
  8966. //>>excludeEnd("ide");
  8967. messageSends: ["streamSize"]
  8968. }),
  8969. $globals.Stream);
  8970. $core.addMethod(
  8971. $core.method({
  8972. selector: "skip:",
  8973. protocol: 'positioning',
  8974. fn: function (anInteger){
  8975. var self=this;
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. return $core.withContext(function($ctx1) {
  8978. //>>excludeEnd("ctx");
  8979. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  8980. return self;
  8981. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8982. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8983. //>>excludeEnd("ctx");
  8984. },
  8985. //>>excludeStart("ide", pragmas.excludeIdeData);
  8986. args: ["anInteger"],
  8987. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8988. referencedClasses: [],
  8989. //>>excludeEnd("ide");
  8990. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8991. }),
  8992. $globals.Stream);
  8993. $core.addMethod(
  8994. $core.method({
  8995. selector: "streamSize",
  8996. protocol: 'accessing',
  8997. fn: function (){
  8998. var self=this;
  8999. return self["@streamSize"];
  9000. },
  9001. //>>excludeStart("ide", pragmas.excludeIdeData);
  9002. args: [],
  9003. source: "streamSize\x0a\x09^ streamSize",
  9004. referencedClasses: [],
  9005. //>>excludeEnd("ide");
  9006. messageSends: []
  9007. }),
  9008. $globals.Stream);
  9009. $core.addMethod(
  9010. $core.method({
  9011. selector: "on:",
  9012. protocol: 'instance creation',
  9013. fn: function (aCollection){
  9014. var self=this;
  9015. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9016. return $core.withContext(function($ctx1) {
  9017. //>>excludeEnd("ctx");
  9018. var $1;
  9019. $1=self._new();
  9020. $recv($1)._setCollection_(aCollection);
  9021. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9022. return $recv($1)._yourself();
  9023. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9024. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  9025. //>>excludeEnd("ctx");
  9026. },
  9027. //>>excludeStart("ide", pragmas.excludeIdeData);
  9028. args: ["aCollection"],
  9029. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9030. referencedClasses: [],
  9031. //>>excludeEnd("ide");
  9032. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9033. }),
  9034. $globals.Stream.klass);
  9035. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  9036. //>>excludeStart("ide", pragmas.excludeIdeData);
  9037. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9038. //>>excludeEnd("ide");
  9039. $core.addMethod(
  9040. $core.method({
  9041. selector: "cr",
  9042. protocol: 'writing',
  9043. fn: function (){
  9044. var self=this;
  9045. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9046. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9047. return $core.withContext(function($ctx1) {
  9048. //>>excludeEnd("ctx");
  9049. return self._nextPutAll_($recv($String())._cr());
  9050. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9051. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9052. //>>excludeEnd("ctx");
  9053. },
  9054. //>>excludeStart("ide", pragmas.excludeIdeData);
  9055. args: [],
  9056. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9057. referencedClasses: ["String"],
  9058. //>>excludeEnd("ide");
  9059. messageSends: ["nextPutAll:", "cr"]
  9060. }),
  9061. $globals.StringStream);
  9062. $core.addMethod(
  9063. $core.method({
  9064. selector: "crlf",
  9065. protocol: 'writing',
  9066. fn: function (){
  9067. var self=this;
  9068. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9069. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9070. return $core.withContext(function($ctx1) {
  9071. //>>excludeEnd("ctx");
  9072. return self._nextPutAll_($recv($String())._crlf());
  9073. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9074. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9075. //>>excludeEnd("ctx");
  9076. },
  9077. //>>excludeStart("ide", pragmas.excludeIdeData);
  9078. args: [],
  9079. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9080. referencedClasses: ["String"],
  9081. //>>excludeEnd("ide");
  9082. messageSends: ["nextPutAll:", "crlf"]
  9083. }),
  9084. $globals.StringStream);
  9085. $core.addMethod(
  9086. $core.method({
  9087. selector: "lf",
  9088. protocol: 'writing',
  9089. fn: function (){
  9090. var self=this;
  9091. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9093. return $core.withContext(function($ctx1) {
  9094. //>>excludeEnd("ctx");
  9095. return self._nextPutAll_($recv($String())._lf());
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9098. //>>excludeEnd("ctx");
  9099. },
  9100. //>>excludeStart("ide", pragmas.excludeIdeData);
  9101. args: [],
  9102. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9103. referencedClasses: ["String"],
  9104. //>>excludeEnd("ide");
  9105. messageSends: ["nextPutAll:", "lf"]
  9106. }),
  9107. $globals.StringStream);
  9108. $core.addMethod(
  9109. $core.method({
  9110. selector: "next:",
  9111. protocol: 'reading',
  9112. fn: function (anInteger){
  9113. var self=this;
  9114. var tempCollection;
  9115. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9116. return $core.withContext(function($ctx1) {
  9117. //>>excludeEnd("ctx");
  9118. var $1;
  9119. tempCollection=$recv($recv(self._collection())._class())._new();
  9120. $recv(anInteger)._timesRepeat_((function(){
  9121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9122. return $core.withContext(function($ctx2) {
  9123. //>>excludeEnd("ctx");
  9124. $1=self._atEnd();
  9125. if(!$core.assert($1)){
  9126. tempCollection=$recv(tempCollection).__comma(self._next());
  9127. return tempCollection;
  9128. };
  9129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9131. //>>excludeEnd("ctx");
  9132. }));
  9133. return tempCollection;
  9134. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9135. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9136. //>>excludeEnd("ctx");
  9137. },
  9138. //>>excludeStart("ide", pragmas.excludeIdeData);
  9139. args: ["anInteger"],
  9140. 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",
  9141. referencedClasses: [],
  9142. //>>excludeEnd("ide");
  9143. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9144. }),
  9145. $globals.StringStream);
  9146. $core.addMethod(
  9147. $core.method({
  9148. selector: "nextPut:",
  9149. protocol: 'writing',
  9150. fn: function (aString){
  9151. var self=this;
  9152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9153. return $core.withContext(function($ctx1) {
  9154. //>>excludeEnd("ctx");
  9155. self._nextPutAll_(aString);
  9156. return self;
  9157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9158. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9159. //>>excludeEnd("ctx");
  9160. },
  9161. //>>excludeStart("ide", pragmas.excludeIdeData);
  9162. args: ["aString"],
  9163. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9164. referencedClasses: [],
  9165. //>>excludeEnd("ide");
  9166. messageSends: ["nextPutAll:"]
  9167. }),
  9168. $globals.StringStream);
  9169. $core.addMethod(
  9170. $core.method({
  9171. selector: "nextPutAll:",
  9172. protocol: 'writing',
  9173. fn: function (aString){
  9174. var self=this;
  9175. var pre,post;
  9176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9177. return $core.withContext(function($ctx1) {
  9178. //>>excludeEnd("ctx");
  9179. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9180. $1=self._atEnd();
  9181. if($core.assert($1)){
  9182. $3=self._collection();
  9183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9184. $ctx1.sendIdx["collection"]=1;
  9185. //>>excludeEnd("ctx");
  9186. $2=$recv($3).__comma(aString);
  9187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9188. $ctx1.sendIdx[","]=1;
  9189. //>>excludeEnd("ctx");
  9190. self._setCollection_($2);
  9191. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9192. $ctx1.sendIdx["setCollection:"]=1;
  9193. //>>excludeEnd("ctx");
  9194. } else {
  9195. $4=self._collection();
  9196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9197. $ctx1.sendIdx["collection"]=2;
  9198. //>>excludeEnd("ctx");
  9199. $5=self._position();
  9200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9201. $ctx1.sendIdx["position"]=1;
  9202. //>>excludeEnd("ctx");
  9203. pre=$recv($4)._copyFrom_to_((1),$5);
  9204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9205. $ctx1.sendIdx["copyFrom:to:"]=1;
  9206. //>>excludeEnd("ctx");
  9207. pre;
  9208. $6=self._collection();
  9209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9210. $ctx1.sendIdx["collection"]=3;
  9211. //>>excludeEnd("ctx");
  9212. $9=self._position();
  9213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9214. $ctx1.sendIdx["position"]=2;
  9215. //>>excludeEnd("ctx");
  9216. $8=$recv($9).__plus((1));
  9217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9218. $ctx1.sendIdx["+"]=2;
  9219. //>>excludeEnd("ctx");
  9220. $10=$recv(aString)._size();
  9221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9222. $ctx1.sendIdx["size"]=1;
  9223. //>>excludeEnd("ctx");
  9224. $7=$recv($8).__plus($10);
  9225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9226. $ctx1.sendIdx["+"]=1;
  9227. //>>excludeEnd("ctx");
  9228. $11=$recv(self._collection())._size();
  9229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9230. $ctx1.sendIdx["size"]=2;
  9231. //>>excludeEnd("ctx");
  9232. post=$recv($6)._copyFrom_to_($7,$11);
  9233. post;
  9234. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9236. $ctx1.sendIdx[","]=2;
  9237. //>>excludeEnd("ctx");
  9238. self._setCollection_($12);
  9239. };
  9240. $14=self._position();
  9241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9242. $ctx1.sendIdx["position"]=3;
  9243. //>>excludeEnd("ctx");
  9244. $13=$recv($14).__plus($recv(aString)._size());
  9245. self._position_($13);
  9246. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  9247. return self;
  9248. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9249. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9250. //>>excludeEnd("ctx");
  9251. },
  9252. //>>excludeStart("ide", pragmas.excludeIdeData);
  9253. args: ["aString"],
  9254. 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)",
  9255. referencedClasses: [],
  9256. //>>excludeEnd("ide");
  9257. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9258. }),
  9259. $globals.StringStream);
  9260. $core.addMethod(
  9261. $core.method({
  9262. selector: "nextPutString:",
  9263. protocol: 'writing',
  9264. fn: function (aString){
  9265. var self=this;
  9266. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9267. return $core.withContext(function($ctx1) {
  9268. //>>excludeEnd("ctx");
  9269. self._nextPutAll_(aString);
  9270. return self;
  9271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9272. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9273. //>>excludeEnd("ctx");
  9274. },
  9275. //>>excludeStart("ide", pragmas.excludeIdeData);
  9276. args: ["aString"],
  9277. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9278. referencedClasses: [],
  9279. //>>excludeEnd("ide");
  9280. messageSends: ["nextPutAll:"]
  9281. }),
  9282. $globals.StringStream);
  9283. $core.addMethod(
  9284. $core.method({
  9285. selector: "space",
  9286. protocol: 'writing',
  9287. fn: function (){
  9288. var self=this;
  9289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9290. return $core.withContext(function($ctx1) {
  9291. //>>excludeEnd("ctx");
  9292. self._nextPut_(" ");
  9293. return self;
  9294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9295. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9296. //>>excludeEnd("ctx");
  9297. },
  9298. //>>excludeStart("ide", pragmas.excludeIdeData);
  9299. args: [],
  9300. source: "space\x0a\x09self nextPut: ' '",
  9301. referencedClasses: [],
  9302. //>>excludeEnd("ide");
  9303. messageSends: ["nextPut:"]
  9304. }),
  9305. $globals.StringStream);
  9306. $core.addMethod(
  9307. $core.method({
  9308. selector: "tab",
  9309. protocol: 'writing',
  9310. fn: function (){
  9311. var self=this;
  9312. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9314. return $core.withContext(function($ctx1) {
  9315. //>>excludeEnd("ctx");
  9316. return self._nextPutAll_($recv($String())._tab());
  9317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9318. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9319. //>>excludeEnd("ctx");
  9320. },
  9321. //>>excludeStart("ide", pragmas.excludeIdeData);
  9322. args: [],
  9323. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9324. referencedClasses: ["String"],
  9325. //>>excludeEnd("ide");
  9326. messageSends: ["nextPutAll:", "tab"]
  9327. }),
  9328. $globals.StringStream);
  9329. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  9330. //>>excludeStart("ide", pragmas.excludeIdeData);
  9331. $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.";
  9332. //>>excludeEnd("ide");
  9333. $core.addMethod(
  9334. $core.method({
  9335. selector: "initialize",
  9336. protocol: 'initialization',
  9337. fn: function (){
  9338. var self=this;
  9339. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  9340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9341. return $core.withContext(function($ctx1) {
  9342. //>>excludeEnd("ctx");
  9343. (
  9344. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9345. $ctx1.supercall = true,
  9346. //>>excludeEnd("ctx");
  9347. ($globals.Queue.superclass||$boot.dnu).fn.prototype._initialize.apply($recv(self), []));
  9348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9349. $ctx1.supercall = false;
  9350. //>>excludeEnd("ctx");;
  9351. self["@read"]=$recv($OrderedCollection())._new();
  9352. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9353. $ctx1.sendIdx["new"]=1;
  9354. //>>excludeEnd("ctx");
  9355. self["@write"]=$recv($OrderedCollection())._new();
  9356. self["@readIndex"]=(1);
  9357. return self;
  9358. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9359. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9360. //>>excludeEnd("ctx");
  9361. },
  9362. //>>excludeStart("ide", pragmas.excludeIdeData);
  9363. args: [],
  9364. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9365. referencedClasses: ["OrderedCollection"],
  9366. //>>excludeEnd("ide");
  9367. messageSends: ["initialize", "new"]
  9368. }),
  9369. $globals.Queue);
  9370. $core.addMethod(
  9371. $core.method({
  9372. selector: "next",
  9373. protocol: 'accessing',
  9374. fn: function (){
  9375. var self=this;
  9376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9377. return $core.withContext(function($ctx1) {
  9378. //>>excludeEnd("ctx");
  9379. return self._nextIfAbsent_((function(){
  9380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9381. return $core.withContext(function($ctx2) {
  9382. //>>excludeEnd("ctx");
  9383. return self._error_("Cannot read from empty Queue.");
  9384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9385. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9386. //>>excludeEnd("ctx");
  9387. }));
  9388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9389. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9390. //>>excludeEnd("ctx");
  9391. },
  9392. //>>excludeStart("ide", pragmas.excludeIdeData);
  9393. args: [],
  9394. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9395. referencedClasses: [],
  9396. //>>excludeEnd("ide");
  9397. messageSends: ["nextIfAbsent:", "error:"]
  9398. }),
  9399. $globals.Queue);
  9400. $core.addMethod(
  9401. $core.method({
  9402. selector: "nextIfAbsent:",
  9403. protocol: 'accessing',
  9404. fn: function (aBlock){
  9405. var self=this;
  9406. var result;
  9407. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  9408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9409. return $core.withContext(function($ctx1) {
  9410. //>>excludeEnd("ctx");
  9411. var $1,$2;
  9412. var $early={};
  9413. try {
  9414. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  9415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9416. return $core.withContext(function($ctx2) {
  9417. //>>excludeEnd("ctx");
  9418. $1=$recv(self["@write"])._isEmpty();
  9419. if($core.assert($1)){
  9420. $2=$recv(self["@readIndex"]).__gt((1));
  9421. if($core.assert($2)){
  9422. self["@read"]=[];
  9423. self["@read"];
  9424. self["@readIndex"]=(1);
  9425. self["@readIndex"];
  9426. };
  9427. throw $early=[$recv(aBlock)._value()];
  9428. };
  9429. self["@read"]=self["@write"];
  9430. self["@read"];
  9431. self["@readIndex"]=(1);
  9432. self["@readIndex"];
  9433. self["@write"]=$recv($OrderedCollection())._new();
  9434. self["@write"];
  9435. return $recv(self["@read"])._first();
  9436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9438. //>>excludeEnd("ctx");
  9439. }));
  9440. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  9441. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  9442. return result;
  9443. }
  9444. catch(e) {if(e===$early)return e[0]; throw e}
  9445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9446. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9447. //>>excludeEnd("ctx");
  9448. },
  9449. //>>excludeStart("ide", pragmas.excludeIdeData);
  9450. args: ["aBlock"],
  9451. source: "nextIfAbsent: aBlock\x0a\x09| result |\x0a\x09result := read at: readIndex ifAbsent: [\x0a\x09\x09write isEmpty ifTrue: [\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",
  9452. referencedClasses: ["OrderedCollection"],
  9453. //>>excludeEnd("ide");
  9454. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  9455. }),
  9456. $globals.Queue);
  9457. $core.addMethod(
  9458. $core.method({
  9459. selector: "nextPut:",
  9460. protocol: 'accessing',
  9461. fn: function (anObject){
  9462. var self=this;
  9463. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9464. return $core.withContext(function($ctx1) {
  9465. //>>excludeEnd("ctx");
  9466. $recv(self["@write"])._add_(anObject);
  9467. return self;
  9468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9469. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9470. //>>excludeEnd("ctx");
  9471. },
  9472. //>>excludeStart("ide", pragmas.excludeIdeData);
  9473. args: ["anObject"],
  9474. source: "nextPut: anObject\x0a\x09write add: anObject",
  9475. referencedClasses: [],
  9476. //>>excludeEnd("ide");
  9477. messageSends: ["add:"]
  9478. }),
  9479. $globals.Queue);
  9480. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  9481. //>>excludeStart("ide", pragmas.excludeIdeData);
  9482. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9483. //>>excludeEnd("ide");
  9484. $core.addMethod(
  9485. $core.method({
  9486. selector: "compile:",
  9487. protocol: 'evaluating',
  9488. fn: function (aString){
  9489. var self=this;
  9490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9491. return $core.withContext(function($ctx1) {
  9492. //>>excludeEnd("ctx");
  9493. return self.compile(aString);
  9494. return self;
  9495. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9496. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9497. //>>excludeEnd("ctx");
  9498. },
  9499. //>>excludeStart("ide", pragmas.excludeIdeData);
  9500. args: ["aString"],
  9501. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  9502. referencedClasses: [],
  9503. //>>excludeEnd("ide");
  9504. messageSends: []
  9505. }),
  9506. $globals.RegularExpression);
  9507. $core.addMethod(
  9508. $core.method({
  9509. selector: "exec:",
  9510. protocol: 'evaluating',
  9511. fn: function (aString){
  9512. var self=this;
  9513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9514. return $core.withContext(function($ctx1) {
  9515. //>>excludeEnd("ctx");
  9516. return self.exec(aString) || nil;
  9517. return self;
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9520. //>>excludeEnd("ctx");
  9521. },
  9522. //>>excludeStart("ide", pragmas.excludeIdeData);
  9523. args: ["aString"],
  9524. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  9525. referencedClasses: [],
  9526. //>>excludeEnd("ide");
  9527. messageSends: []
  9528. }),
  9529. $globals.RegularExpression);
  9530. $core.addMethod(
  9531. $core.method({
  9532. selector: "test:",
  9533. protocol: 'evaluating',
  9534. fn: function (aString){
  9535. var self=this;
  9536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9537. return $core.withContext(function($ctx1) {
  9538. //>>excludeEnd("ctx");
  9539. return self.test(aString);
  9540. return self;
  9541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9542. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9543. //>>excludeEnd("ctx");
  9544. },
  9545. //>>excludeStart("ide", pragmas.excludeIdeData);
  9546. args: ["aString"],
  9547. source: "test: aString\x0a\x09<return self.test(aString)>",
  9548. referencedClasses: [],
  9549. //>>excludeEnd("ide");
  9550. messageSends: []
  9551. }),
  9552. $globals.RegularExpression);
  9553. $core.addMethod(
  9554. $core.method({
  9555. selector: "fromString:",
  9556. protocol: 'instance creation',
  9557. fn: function (aString){
  9558. var self=this;
  9559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9560. return $core.withContext(function($ctx1) {
  9561. //>>excludeEnd("ctx");
  9562. return self._fromString_flag_(aString,"");
  9563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9564. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  9565. //>>excludeEnd("ctx");
  9566. },
  9567. //>>excludeStart("ide", pragmas.excludeIdeData);
  9568. args: ["aString"],
  9569. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9570. referencedClasses: [],
  9571. //>>excludeEnd("ide");
  9572. messageSends: ["fromString:flag:"]
  9573. }),
  9574. $globals.RegularExpression.klass);
  9575. $core.addMethod(
  9576. $core.method({
  9577. selector: "fromString:flag:",
  9578. protocol: 'instance creation',
  9579. fn: function (aString,anotherString){
  9580. var self=this;
  9581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9582. return $core.withContext(function($ctx1) {
  9583. //>>excludeEnd("ctx");
  9584. return new RegExp(aString, anotherString);
  9585. return self;
  9586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9587. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  9588. //>>excludeEnd("ctx");
  9589. },
  9590. //>>excludeStart("ide", pragmas.excludeIdeData);
  9591. args: ["aString", "anotherString"],
  9592. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  9593. referencedClasses: [],
  9594. //>>excludeEnd("ide");
  9595. messageSends: []
  9596. }),
  9597. $globals.RegularExpression.klass);
  9598. });