1
0

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.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.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.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.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.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. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  5632. return self;
  5633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5634. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  5635. //>>excludeEnd("ctx");
  5636. },
  5637. //>>excludeStart("ide", pragmas.excludeIdeData);
  5638. args: ["aString"],
  5639. source: "== aString\x0a<return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())>",
  5640. referencedClasses: [],
  5641. //>>excludeEnd("ide");
  5642. messageSends: []
  5643. }),
  5644. $globals.String);
  5645. $core.addMethod(
  5646. $core.method({
  5647. selector: ">",
  5648. protocol: 'comparing',
  5649. fn: function (aString){
  5650. var self=this;
  5651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5652. return $core.withContext(function($ctx1) {
  5653. //>>excludeEnd("ctx");
  5654. return String(self) > aString._asString();
  5655. return self;
  5656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5657. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  5658. //>>excludeEnd("ctx");
  5659. },
  5660. //>>excludeStart("ide", pragmas.excludeIdeData);
  5661. args: ["aString"],
  5662. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  5663. referencedClasses: [],
  5664. //>>excludeEnd("ide");
  5665. messageSends: []
  5666. }),
  5667. $globals.String);
  5668. $core.addMethod(
  5669. $core.method({
  5670. selector: ">=",
  5671. protocol: 'comparing',
  5672. fn: function (aString){
  5673. var self=this;
  5674. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5675. return $core.withContext(function($ctx1) {
  5676. //>>excludeEnd("ctx");
  5677. return String(self) >= aString._asString();
  5678. return self;
  5679. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5680. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  5681. //>>excludeEnd("ctx");
  5682. },
  5683. //>>excludeStart("ide", pragmas.excludeIdeData);
  5684. args: ["aString"],
  5685. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  5686. referencedClasses: [],
  5687. //>>excludeEnd("ide");
  5688. messageSends: []
  5689. }),
  5690. $globals.String);
  5691. $core.addMethod(
  5692. $core.method({
  5693. selector: "asJSON",
  5694. protocol: 'converting',
  5695. fn: function (){
  5696. var self=this;
  5697. return self;
  5698. },
  5699. //>>excludeStart("ide", pragmas.excludeIdeData);
  5700. args: [],
  5701. source: "asJSON\x0a\x09^ self",
  5702. referencedClasses: [],
  5703. //>>excludeEnd("ide");
  5704. messageSends: []
  5705. }),
  5706. $globals.String);
  5707. $core.addMethod(
  5708. $core.method({
  5709. selector: "asJavaScriptMethodName",
  5710. protocol: 'converting',
  5711. fn: function (){
  5712. var self=this;
  5713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5714. return $core.withContext(function($ctx1) {
  5715. //>>excludeEnd("ctx");
  5716. return $core.st2js(self);
  5717. return self;
  5718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5719. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  5720. //>>excludeEnd("ctx");
  5721. },
  5722. //>>excludeStart("ide", pragmas.excludeIdeData);
  5723. args: [],
  5724. source: "asJavaScriptMethodName\x0a\x09<return $core.st2js(self)>",
  5725. referencedClasses: [],
  5726. //>>excludeEnd("ide");
  5727. messageSends: []
  5728. }),
  5729. $globals.String);
  5730. $core.addMethod(
  5731. $core.method({
  5732. selector: "asJavascript",
  5733. protocol: 'converting',
  5734. fn: function (){
  5735. var self=this;
  5736. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5737. return $core.withContext(function($ctx1) {
  5738. //>>excludeEnd("ctx");
  5739. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5740. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5741. else
  5742. return "\"" + self + "\"";
  5743. ;
  5744. return self;
  5745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5746. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},$globals.String)});
  5747. //>>excludeEnd("ctx");
  5748. },
  5749. //>>excludeStart("ide", pragmas.excludeIdeData);
  5750. args: [],
  5751. 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>",
  5752. referencedClasses: [],
  5753. //>>excludeEnd("ide");
  5754. messageSends: []
  5755. }),
  5756. $globals.String);
  5757. $core.addMethod(
  5758. $core.method({
  5759. selector: "asLowercase",
  5760. protocol: 'converting',
  5761. fn: function (){
  5762. var self=this;
  5763. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5764. return $core.withContext(function($ctx1) {
  5765. //>>excludeEnd("ctx");
  5766. return self.toLowerCase();
  5767. return self;
  5768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5769. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  5770. //>>excludeEnd("ctx");
  5771. },
  5772. //>>excludeStart("ide", pragmas.excludeIdeData);
  5773. args: [],
  5774. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  5775. referencedClasses: [],
  5776. //>>excludeEnd("ide");
  5777. messageSends: []
  5778. }),
  5779. $globals.String);
  5780. $core.addMethod(
  5781. $core.method({
  5782. selector: "asMutator",
  5783. protocol: 'converting',
  5784. fn: function (){
  5785. var self=this;
  5786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5787. return $core.withContext(function($ctx1) {
  5788. //>>excludeEnd("ctx");
  5789. var $1;
  5790. $1=$recv(self._last()).__eq(":");
  5791. if(!$core.assert($1)){
  5792. return self.__comma(":");
  5793. };
  5794. return self;
  5795. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5796. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  5797. //>>excludeEnd("ctx");
  5798. },
  5799. //>>excludeStart("ide", pragmas.excludeIdeData);
  5800. args: [],
  5801. 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",
  5802. referencedClasses: [],
  5803. //>>excludeEnd("ide");
  5804. messageSends: ["ifFalse:", "=", "last", ","]
  5805. }),
  5806. $globals.String);
  5807. $core.addMethod(
  5808. $core.method({
  5809. selector: "asNumber",
  5810. protocol: 'converting',
  5811. fn: function (){
  5812. var self=this;
  5813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5814. return $core.withContext(function($ctx1) {
  5815. //>>excludeEnd("ctx");
  5816. return Number(self);
  5817. return self;
  5818. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5819. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  5820. //>>excludeEnd("ctx");
  5821. },
  5822. //>>excludeStart("ide", pragmas.excludeIdeData);
  5823. args: [],
  5824. source: "asNumber\x0a\x09<return Number(self)>",
  5825. referencedClasses: [],
  5826. //>>excludeEnd("ide");
  5827. messageSends: []
  5828. }),
  5829. $globals.String);
  5830. $core.addMethod(
  5831. $core.method({
  5832. selector: "asRegexp",
  5833. protocol: 'converting',
  5834. fn: function (){
  5835. var self=this;
  5836. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  5837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5838. return $core.withContext(function($ctx1) {
  5839. //>>excludeEnd("ctx");
  5840. return $recv($RegularExpression())._fromString_(self);
  5841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5842. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  5843. //>>excludeEnd("ctx");
  5844. },
  5845. //>>excludeStart("ide", pragmas.excludeIdeData);
  5846. args: [],
  5847. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  5848. referencedClasses: ["RegularExpression"],
  5849. //>>excludeEnd("ide");
  5850. messageSends: ["fromString:"]
  5851. }),
  5852. $globals.String);
  5853. $core.addMethod(
  5854. $core.method({
  5855. selector: "asString",
  5856. protocol: 'converting',
  5857. fn: function (){
  5858. var self=this;
  5859. return self;
  5860. },
  5861. //>>excludeStart("ide", pragmas.excludeIdeData);
  5862. args: [],
  5863. source: "asString\x0a\x09^ self",
  5864. referencedClasses: [],
  5865. //>>excludeEnd("ide");
  5866. messageSends: []
  5867. }),
  5868. $globals.String);
  5869. $core.addMethod(
  5870. $core.method({
  5871. selector: "asSymbol",
  5872. protocol: 'converting',
  5873. fn: function (){
  5874. var self=this;
  5875. return self;
  5876. },
  5877. //>>excludeStart("ide", pragmas.excludeIdeData);
  5878. args: [],
  5879. source: "asSymbol\x0a\x09^ self",
  5880. referencedClasses: [],
  5881. //>>excludeEnd("ide");
  5882. messageSends: []
  5883. }),
  5884. $globals.String);
  5885. $core.addMethod(
  5886. $core.method({
  5887. selector: "asUppercase",
  5888. protocol: 'converting',
  5889. fn: function (){
  5890. var self=this;
  5891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5892. return $core.withContext(function($ctx1) {
  5893. //>>excludeEnd("ctx");
  5894. return self.toUpperCase();
  5895. return self;
  5896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5897. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  5898. //>>excludeEnd("ctx");
  5899. },
  5900. //>>excludeStart("ide", pragmas.excludeIdeData);
  5901. args: [],
  5902. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  5903. referencedClasses: [],
  5904. //>>excludeEnd("ide");
  5905. messageSends: []
  5906. }),
  5907. $globals.String);
  5908. $core.addMethod(
  5909. $core.method({
  5910. selector: "asciiValue",
  5911. protocol: 'accessing',
  5912. fn: function (){
  5913. var self=this;
  5914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5915. return $core.withContext(function($ctx1) {
  5916. //>>excludeEnd("ctx");
  5917. return self.charCodeAt(0);;
  5918. return self;
  5919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5920. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  5921. //>>excludeEnd("ctx");
  5922. },
  5923. //>>excludeStart("ide", pragmas.excludeIdeData);
  5924. args: [],
  5925. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  5926. referencedClasses: [],
  5927. //>>excludeEnd("ide");
  5928. messageSends: []
  5929. }),
  5930. $globals.String);
  5931. $core.addMethod(
  5932. $core.method({
  5933. selector: "at:ifAbsent:",
  5934. protocol: 'accessing',
  5935. fn: function (anIndex,aBlock){
  5936. var self=this;
  5937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5938. return $core.withContext(function($ctx1) {
  5939. //>>excludeEnd("ctx");
  5940. return String(self)[anIndex - 1] || aBlock._value();
  5941. return self;
  5942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5943. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  5944. //>>excludeEnd("ctx");
  5945. },
  5946. //>>excludeStart("ide", pragmas.excludeIdeData);
  5947. args: ["anIndex", "aBlock"],
  5948. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  5949. referencedClasses: [],
  5950. //>>excludeEnd("ide");
  5951. messageSends: []
  5952. }),
  5953. $globals.String);
  5954. $core.addMethod(
  5955. $core.method({
  5956. selector: "at:ifPresent:ifAbsent:",
  5957. protocol: 'accessing',
  5958. fn: function (anIndex,aBlock,anotherBlock){
  5959. var self=this;
  5960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5961. return $core.withContext(function($ctx1) {
  5962. //>>excludeEnd("ctx");
  5963. var result = String(self)[anIndex - 1];
  5964. return result ? aBlock._value_(result) : anotherBlock._value();
  5965. ;
  5966. return self;
  5967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5968. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  5969. //>>excludeEnd("ctx");
  5970. },
  5971. //>>excludeStart("ide", pragmas.excludeIdeData);
  5972. args: ["anIndex", "aBlock", "anotherBlock"],
  5973. 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>",
  5974. referencedClasses: [],
  5975. //>>excludeEnd("ide");
  5976. messageSends: []
  5977. }),
  5978. $globals.String);
  5979. $core.addMethod(
  5980. $core.method({
  5981. selector: "capitalized",
  5982. protocol: 'converting',
  5983. fn: function (){
  5984. var self=this;
  5985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5986. return $core.withContext(function($ctx1) {
  5987. //>>excludeEnd("ctx");
  5988. var $1;
  5989. $1=self._isEmpty();
  5990. if($core.assert($1)){
  5991. return self;
  5992. } else {
  5993. return $recv($recv(self._first())._asUppercase()).__comma(self._allButFirst());
  5994. };
  5995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5996. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  5997. //>>excludeEnd("ctx");
  5998. },
  5999. //>>excludeStart("ide", pragmas.excludeIdeData);
  6000. args: [],
  6001. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  6002. referencedClasses: [],
  6003. //>>excludeEnd("ide");
  6004. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  6005. }),
  6006. $globals.String);
  6007. $core.addMethod(
  6008. $core.method({
  6009. selector: "charCodeAt:",
  6010. protocol: 'accessing',
  6011. fn: function (anInteger){
  6012. var self=this;
  6013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6014. return $core.withContext(function($ctx1) {
  6015. //>>excludeEnd("ctx");
  6016. return self.charCodeAt(anInteger - 1);
  6017. return self;
  6018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6019. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  6020. //>>excludeEnd("ctx");
  6021. },
  6022. //>>excludeStart("ide", pragmas.excludeIdeData);
  6023. args: ["anInteger"],
  6024. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  6025. referencedClasses: [],
  6026. //>>excludeEnd("ide");
  6027. messageSends: []
  6028. }),
  6029. $globals.String);
  6030. $core.addMethod(
  6031. $core.method({
  6032. selector: "copyFrom:to:",
  6033. protocol: 'copying',
  6034. fn: function (anIndex,anotherIndex){
  6035. var self=this;
  6036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6037. return $core.withContext(function($ctx1) {
  6038. //>>excludeEnd("ctx");
  6039. return self.substring(anIndex - 1, anotherIndex);
  6040. return self;
  6041. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6042. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  6043. //>>excludeEnd("ctx");
  6044. },
  6045. //>>excludeStart("ide", pragmas.excludeIdeData);
  6046. args: ["anIndex", "anotherIndex"],
  6047. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  6048. referencedClasses: [],
  6049. //>>excludeEnd("ide");
  6050. messageSends: []
  6051. }),
  6052. $globals.String);
  6053. $core.addMethod(
  6054. $core.method({
  6055. selector: "crlfSanitized",
  6056. protocol: 'converting',
  6057. fn: function (){
  6058. var self=this;
  6059. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6061. return $core.withContext(function($ctx1) {
  6062. //>>excludeEnd("ctx");
  6063. return $recv(self._lines())._join_($recv($String())._lf());
  6064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6065. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  6066. //>>excludeEnd("ctx");
  6067. },
  6068. //>>excludeStart("ide", pragmas.excludeIdeData);
  6069. args: [],
  6070. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6071. referencedClasses: ["String"],
  6072. //>>excludeEnd("ide");
  6073. messageSends: ["join:", "lines", "lf"]
  6074. }),
  6075. $globals.String);
  6076. $core.addMethod(
  6077. $core.method({
  6078. selector: "deepCopy",
  6079. protocol: 'copying',
  6080. fn: function (){
  6081. var self=this;
  6082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6083. return $core.withContext(function($ctx1) {
  6084. //>>excludeEnd("ctx");
  6085. return self._shallowCopy();
  6086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6087. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  6088. //>>excludeEnd("ctx");
  6089. },
  6090. //>>excludeStart("ide", pragmas.excludeIdeData);
  6091. args: [],
  6092. source: "deepCopy\x0a\x09^ self shallowCopy",
  6093. referencedClasses: [],
  6094. //>>excludeEnd("ide");
  6095. messageSends: ["shallowCopy"]
  6096. }),
  6097. $globals.String);
  6098. $core.addMethod(
  6099. $core.method({
  6100. selector: "escaped",
  6101. protocol: 'converting',
  6102. fn: function (){
  6103. var self=this;
  6104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6105. return $core.withContext(function($ctx1) {
  6106. //>>excludeEnd("ctx");
  6107. return escape(self);
  6108. return self;
  6109. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6110. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  6111. //>>excludeEnd("ctx");
  6112. },
  6113. //>>excludeStart("ide", pragmas.excludeIdeData);
  6114. args: [],
  6115. source: "escaped\x0a\x09<return escape(self)>",
  6116. referencedClasses: [],
  6117. //>>excludeEnd("ide");
  6118. messageSends: []
  6119. }),
  6120. $globals.String);
  6121. $core.addMethod(
  6122. $core.method({
  6123. selector: "includesSubString:",
  6124. protocol: 'testing',
  6125. fn: function (subString){
  6126. var self=this;
  6127. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6128. return $core.withContext(function($ctx1) {
  6129. //>>excludeEnd("ctx");
  6130. return self.indexOf(subString) != -1;
  6131. return self;
  6132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6133. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  6134. //>>excludeEnd("ctx");
  6135. },
  6136. //>>excludeStart("ide", pragmas.excludeIdeData);
  6137. args: ["subString"],
  6138. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  6139. referencedClasses: [],
  6140. //>>excludeEnd("ide");
  6141. messageSends: []
  6142. }),
  6143. $globals.String);
  6144. $core.addMethod(
  6145. $core.method({
  6146. selector: "isCapitalized",
  6147. protocol: 'testing',
  6148. fn: function (){
  6149. var self=this;
  6150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6151. return $core.withContext(function($ctx1) {
  6152. //>>excludeEnd("ctx");
  6153. var $2,$1;
  6154. $2=self._first();
  6155. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6156. $ctx1.sendIdx["first"]=1;
  6157. //>>excludeEnd("ctx");
  6158. $1=$recv($2)._asUppercase();
  6159. return $recv($1).__eq_eq(self._first());
  6160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6161. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  6162. //>>excludeEnd("ctx");
  6163. },
  6164. //>>excludeStart("ide", pragmas.excludeIdeData);
  6165. args: [],
  6166. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6167. referencedClasses: [],
  6168. //>>excludeEnd("ide");
  6169. messageSends: ["==", "asUppercase", "first"]
  6170. }),
  6171. $globals.String);
  6172. $core.addMethod(
  6173. $core.method({
  6174. selector: "isImmutable",
  6175. protocol: 'testing',
  6176. fn: function (){
  6177. var self=this;
  6178. return true;
  6179. },
  6180. //>>excludeStart("ide", pragmas.excludeIdeData);
  6181. args: [],
  6182. source: "isImmutable\x0a\x09^ true",
  6183. referencedClasses: [],
  6184. //>>excludeEnd("ide");
  6185. messageSends: []
  6186. }),
  6187. $globals.String);
  6188. $core.addMethod(
  6189. $core.method({
  6190. selector: "isString",
  6191. protocol: 'testing',
  6192. fn: function (){
  6193. var self=this;
  6194. return true;
  6195. },
  6196. //>>excludeStart("ide", pragmas.excludeIdeData);
  6197. args: [],
  6198. source: "isString\x0a\x09^ true",
  6199. referencedClasses: [],
  6200. //>>excludeEnd("ide");
  6201. messageSends: []
  6202. }),
  6203. $globals.String);
  6204. $core.addMethod(
  6205. $core.method({
  6206. selector: "isVowel",
  6207. protocol: 'testing',
  6208. fn: function (){
  6209. var self=this;
  6210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6211. return $core.withContext(function($ctx1) {
  6212. //>>excludeEnd("ctx");
  6213. return $recv($recv(self._size()).__eq((1)))._and_((function(){
  6214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6215. return $core.withContext(function($ctx2) {
  6216. //>>excludeEnd("ctx");
  6217. return "aeiou"._includes_(self._asLowercase());
  6218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6220. //>>excludeEnd("ctx");
  6221. }));
  6222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6223. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  6224. //>>excludeEnd("ctx");
  6225. },
  6226. //>>excludeStart("ide", pragmas.excludeIdeData);
  6227. args: [],
  6228. 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 ]",
  6229. referencedClasses: [],
  6230. //>>excludeEnd("ide");
  6231. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6232. }),
  6233. $globals.String);
  6234. $core.addMethod(
  6235. $core.method({
  6236. selector: "join:",
  6237. protocol: 'split join',
  6238. fn: function (aCollection){
  6239. var self=this;
  6240. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6242. return $core.withContext(function($ctx1) {
  6243. //>>excludeEnd("ctx");
  6244. return $recv($String())._streamContents_((function(stream){
  6245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6246. return $core.withContext(function($ctx2) {
  6247. //>>excludeEnd("ctx");
  6248. return $recv(aCollection)._do_separatedBy_((function(each){
  6249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6250. return $core.withContext(function($ctx3) {
  6251. //>>excludeEnd("ctx");
  6252. return $recv(stream)._nextPutAll_($recv(each)._asString());
  6253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6254. $ctx3.sendIdx["nextPutAll:"]=1;
  6255. //>>excludeEnd("ctx");
  6256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6257. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6258. //>>excludeEnd("ctx");
  6259. }),(function(){
  6260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6261. return $core.withContext(function($ctx3) {
  6262. //>>excludeEnd("ctx");
  6263. return $recv(stream)._nextPutAll_(self);
  6264. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6265. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6266. //>>excludeEnd("ctx");
  6267. }));
  6268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6269. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6270. //>>excludeEnd("ctx");
  6271. }));
  6272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6273. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  6274. //>>excludeEnd("ctx");
  6275. },
  6276. //>>excludeStart("ide", pragmas.excludeIdeData);
  6277. args: ["aCollection"],
  6278. 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 ]]",
  6279. referencedClasses: ["String"],
  6280. //>>excludeEnd("ide");
  6281. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6282. }),
  6283. $globals.String);
  6284. $core.addMethod(
  6285. $core.method({
  6286. selector: "lineIndicesDo:",
  6287. protocol: 'split join',
  6288. fn: function (aBlock){
  6289. var self=this;
  6290. var cr,lf,start,sz,nextLF,nextCR;
  6291. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  6292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6293. return $core.withContext(function($ctx1) {
  6294. //>>excludeEnd("ctx");
  6295. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6296. var $early={};
  6297. try {
  6298. start=(1);
  6299. sz=self._size();
  6300. cr=$recv($String())._cr();
  6301. nextCR=self._indexOf_startingAt_(cr,(1));
  6302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6303. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6304. //>>excludeEnd("ctx");
  6305. lf=$recv($String())._lf();
  6306. nextLF=self._indexOf_startingAt_(lf,(1));
  6307. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6308. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6309. //>>excludeEnd("ctx");
  6310. $recv((function(){
  6311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6312. return $core.withContext(function($ctx2) {
  6313. //>>excludeEnd("ctx");
  6314. return $recv(start).__lt_eq(sz);
  6315. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6317. //>>excludeEnd("ctx");
  6318. }))._whileTrue_((function(){
  6319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6320. return $core.withContext(function($ctx2) {
  6321. //>>excludeEnd("ctx");
  6322. $2=$recv(nextLF).__eq((0));
  6323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6324. $ctx2.sendIdx["="]=1;
  6325. //>>excludeEnd("ctx");
  6326. $1=$recv($2)._and_((function(){
  6327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6328. return $core.withContext(function($ctx3) {
  6329. //>>excludeEnd("ctx");
  6330. return $recv(nextCR).__eq((0));
  6331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6332. $ctx3.sendIdx["="]=2;
  6333. //>>excludeEnd("ctx");
  6334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6335. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6336. //>>excludeEnd("ctx");
  6337. }));
  6338. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6339. $ctx2.sendIdx["and:"]=1;
  6340. //>>excludeEnd("ctx");
  6341. if($core.assert($1)){
  6342. $recv(aBlock)._value_value_value_(start,sz,sz);
  6343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6344. $ctx2.sendIdx["value:value:value:"]=1;
  6345. //>>excludeEnd("ctx");
  6346. throw $early=[self];
  6347. };
  6348. $4=$recv(nextCR).__eq((0));
  6349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6350. $ctx2.sendIdx["="]=3;
  6351. //>>excludeEnd("ctx");
  6352. $3=$recv($4)._or_((function(){
  6353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6354. return $core.withContext(function($ctx3) {
  6355. //>>excludeEnd("ctx");
  6356. $5=(0).__lt(nextLF);
  6357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6358. $ctx3.sendIdx["<"]=1;
  6359. //>>excludeEnd("ctx");
  6360. return $recv($5)._and_((function(){
  6361. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6362. return $core.withContext(function($ctx4) {
  6363. //>>excludeEnd("ctx");
  6364. return $recv(nextLF).__lt(nextCR);
  6365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6366. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6367. //>>excludeEnd("ctx");
  6368. }));
  6369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6370. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6371. //>>excludeEnd("ctx");
  6372. }));
  6373. if($core.assert($3)){
  6374. $6=start;
  6375. $7=$recv(nextLF).__minus((1));
  6376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6377. $ctx2.sendIdx["-"]=1;
  6378. //>>excludeEnd("ctx");
  6379. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  6380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6381. $ctx2.sendIdx["value:value:value:"]=2;
  6382. //>>excludeEnd("ctx");
  6383. start=(1).__plus(nextLF);
  6384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6385. $ctx2.sendIdx["+"]=1;
  6386. //>>excludeEnd("ctx");
  6387. start;
  6388. nextLF=self._indexOf_startingAt_(lf,start);
  6389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6390. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6391. //>>excludeEnd("ctx");
  6392. return nextLF;
  6393. } else {
  6394. $9=(1).__plus(nextCR);
  6395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6396. $ctx2.sendIdx["+"]=2;
  6397. //>>excludeEnd("ctx");
  6398. $8=$recv($9).__eq(nextLF);
  6399. if($core.assert($8)){
  6400. $10=start;
  6401. $11=$recv(nextCR).__minus((1));
  6402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6403. $ctx2.sendIdx["-"]=2;
  6404. //>>excludeEnd("ctx");
  6405. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  6406. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6407. $ctx2.sendIdx["value:value:value:"]=3;
  6408. //>>excludeEnd("ctx");
  6409. start=(1).__plus(nextLF);
  6410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6411. $ctx2.sendIdx["+"]=3;
  6412. //>>excludeEnd("ctx");
  6413. start;
  6414. nextCR=self._indexOf_startingAt_(cr,start);
  6415. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6416. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6417. //>>excludeEnd("ctx");
  6418. nextCR;
  6419. nextLF=self._indexOf_startingAt_(lf,start);
  6420. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6421. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6422. //>>excludeEnd("ctx");
  6423. return nextLF;
  6424. } else {
  6425. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  6426. start=(1).__plus(nextCR);
  6427. start;
  6428. nextCR=self._indexOf_startingAt_(cr,start);
  6429. return nextCR;
  6430. };
  6431. };
  6432. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6434. //>>excludeEnd("ctx");
  6435. }));
  6436. return self;
  6437. }
  6438. catch(e) {if(e===$early)return e[0]; throw e}
  6439. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6440. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  6441. //>>excludeEnd("ctx");
  6442. },
  6443. //>>excludeStart("ide", pragmas.excludeIdeData);
  6444. args: ["aBlock"],
  6445. 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 ] ]]",
  6446. referencedClasses: ["String"],
  6447. //>>excludeEnd("ide");
  6448. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6449. }),
  6450. $globals.String);
  6451. $core.addMethod(
  6452. $core.method({
  6453. selector: "lineNumber:",
  6454. protocol: 'split join',
  6455. fn: function (anIndex){
  6456. var self=this;
  6457. var lineCount;
  6458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6459. return $core.withContext(function($ctx1) {
  6460. //>>excludeEnd("ctx");
  6461. var $2,$1;
  6462. var $early={};
  6463. try {
  6464. lineCount=(0);
  6465. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6467. return $core.withContext(function($ctx2) {
  6468. //>>excludeEnd("ctx");
  6469. lineCount=$recv(lineCount).__plus((1));
  6470. $2=lineCount;
  6471. $1=$recv($2).__eq(anIndex);
  6472. if($core.assert($1)){
  6473. throw $early=[self._copyFrom_to_(start,endWithoutDelimiters)];
  6474. };
  6475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6476. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6477. //>>excludeEnd("ctx");
  6478. }));
  6479. return nil;
  6480. }
  6481. catch(e) {if(e===$early)return e[0]; throw e}
  6482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6483. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  6484. //>>excludeEnd("ctx");
  6485. },
  6486. //>>excludeStart("ide", pragmas.excludeIdeData);
  6487. args: ["anIndex"],
  6488. 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",
  6489. referencedClasses: [],
  6490. //>>excludeEnd("ide");
  6491. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6492. }),
  6493. $globals.String);
  6494. $core.addMethod(
  6495. $core.method({
  6496. selector: "lines",
  6497. protocol: 'split join',
  6498. fn: function (){
  6499. var self=this;
  6500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6501. return $core.withContext(function($ctx1) {
  6502. //>>excludeEnd("ctx");
  6503. var result = self.split(/\r\n|\r|\n/);
  6504. if (!result[result.length-1]) result.pop();
  6505. return result;;
  6506. return self;
  6507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6508. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  6509. //>>excludeEnd("ctx");
  6510. },
  6511. //>>excludeStart("ide", pragmas.excludeIdeData);
  6512. args: [],
  6513. 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>",
  6514. referencedClasses: [],
  6515. //>>excludeEnd("ide");
  6516. messageSends: []
  6517. }),
  6518. $globals.String);
  6519. $core.addMethod(
  6520. $core.method({
  6521. selector: "linesDo:",
  6522. protocol: 'split join',
  6523. fn: function (aBlock){
  6524. var self=this;
  6525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6526. return $core.withContext(function($ctx1) {
  6527. //>>excludeEnd("ctx");
  6528. $recv(self._lines())._do_(aBlock);
  6529. return self;
  6530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6531. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  6532. //>>excludeEnd("ctx");
  6533. },
  6534. //>>excludeStart("ide", pragmas.excludeIdeData);
  6535. args: ["aBlock"],
  6536. 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",
  6537. referencedClasses: [],
  6538. //>>excludeEnd("ide");
  6539. messageSends: ["do:", "lines"]
  6540. }),
  6541. $globals.String);
  6542. $core.addMethod(
  6543. $core.method({
  6544. selector: "match:",
  6545. protocol: 'regular expressions',
  6546. fn: function (aRegexp){
  6547. var self=this;
  6548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6549. return $core.withContext(function($ctx1) {
  6550. //>>excludeEnd("ctx");
  6551. return self.search(aRegexp) != -1;
  6552. return self;
  6553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6554. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  6555. //>>excludeEnd("ctx");
  6556. },
  6557. //>>excludeStart("ide", pragmas.excludeIdeData);
  6558. args: ["aRegexp"],
  6559. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  6560. referencedClasses: [],
  6561. //>>excludeEnd("ide");
  6562. messageSends: []
  6563. }),
  6564. $globals.String);
  6565. $core.addMethod(
  6566. $core.method({
  6567. selector: "matchesOf:",
  6568. protocol: 'regular expressions',
  6569. fn: function (aRegularExpression){
  6570. var self=this;
  6571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6572. return $core.withContext(function($ctx1) {
  6573. //>>excludeEnd("ctx");
  6574. return self.match(aRegularExpression);
  6575. return self;
  6576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6577. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  6578. //>>excludeEnd("ctx");
  6579. },
  6580. //>>excludeStart("ide", pragmas.excludeIdeData);
  6581. args: ["aRegularExpression"],
  6582. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  6583. referencedClasses: [],
  6584. //>>excludeEnd("ide");
  6585. messageSends: []
  6586. }),
  6587. $globals.String);
  6588. $core.addMethod(
  6589. $core.method({
  6590. selector: "numericallyIndexable",
  6591. protocol: 'private',
  6592. fn: function (){
  6593. var self=this;
  6594. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6595. return $core.withContext(function($ctx1) {
  6596. //>>excludeEnd("ctx");
  6597. return String(self);
  6598. return self;
  6599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6600. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  6601. //>>excludeEnd("ctx");
  6602. },
  6603. //>>excludeStart("ide", pragmas.excludeIdeData);
  6604. args: [],
  6605. source: "numericallyIndexable\x0a\x09<return String(self)>",
  6606. referencedClasses: [],
  6607. //>>excludeEnd("ide");
  6608. messageSends: []
  6609. }),
  6610. $globals.String);
  6611. $core.addMethod(
  6612. $core.method({
  6613. selector: "printNl",
  6614. protocol: 'printing',
  6615. fn: function (){
  6616. var self=this;
  6617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6618. return $core.withContext(function($ctx1) {
  6619. //>>excludeEnd("ctx");
  6620. console.log(self);
  6621. return self;
  6622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6623. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  6624. //>>excludeEnd("ctx");
  6625. },
  6626. //>>excludeStart("ide", pragmas.excludeIdeData);
  6627. args: [],
  6628. source: "printNl\x0a\x09<console.log(self)>",
  6629. referencedClasses: [],
  6630. //>>excludeEnd("ide");
  6631. messageSends: []
  6632. }),
  6633. $globals.String);
  6634. $core.addMethod(
  6635. $core.method({
  6636. selector: "printOn:",
  6637. protocol: 'printing',
  6638. fn: function (aStream){
  6639. var self=this;
  6640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6641. return $core.withContext(function($ctx1) {
  6642. //>>excludeEnd("ctx");
  6643. $recv(aStream)._nextPutAll_("'");
  6644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6645. $ctx1.sendIdx["nextPutAll:"]=1;
  6646. //>>excludeEnd("ctx");
  6647. $recv(aStream)._nextPutAll_(self);
  6648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6649. $ctx1.sendIdx["nextPutAll:"]=2;
  6650. //>>excludeEnd("ctx");
  6651. $recv(aStream)._nextPutAll_("'");
  6652. return self;
  6653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6654. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  6655. //>>excludeEnd("ctx");
  6656. },
  6657. //>>excludeStart("ide", pragmas.excludeIdeData);
  6658. args: ["aStream"],
  6659. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  6660. referencedClasses: [],
  6661. //>>excludeEnd("ide");
  6662. messageSends: ["nextPutAll:"]
  6663. }),
  6664. $globals.String);
  6665. $core.addMethod(
  6666. $core.method({
  6667. selector: "replace:with:",
  6668. protocol: 'regular expressions',
  6669. fn: function (aString,anotherString){
  6670. var self=this;
  6671. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6673. return $core.withContext(function($ctx1) {
  6674. //>>excludeEnd("ctx");
  6675. return self._replaceRegexp_with_($recv($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  6676. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6677. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  6678. //>>excludeEnd("ctx");
  6679. },
  6680. //>>excludeStart("ide", pragmas.excludeIdeData);
  6681. args: ["aString", "anotherString"],
  6682. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6683. referencedClasses: ["RegularExpression"],
  6684. //>>excludeEnd("ide");
  6685. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6686. }),
  6687. $globals.String);
  6688. $core.addMethod(
  6689. $core.method({
  6690. selector: "replaceRegexp:with:",
  6691. protocol: 'regular expressions',
  6692. fn: function (aRegexp,aString){
  6693. var self=this;
  6694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6695. return $core.withContext(function($ctx1) {
  6696. //>>excludeEnd("ctx");
  6697. return self.replace(aRegexp, aString);
  6698. return self;
  6699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6700. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  6701. //>>excludeEnd("ctx");
  6702. },
  6703. //>>excludeStart("ide", pragmas.excludeIdeData);
  6704. args: ["aRegexp", "aString"],
  6705. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  6706. referencedClasses: [],
  6707. //>>excludeEnd("ide");
  6708. messageSends: []
  6709. }),
  6710. $globals.String);
  6711. $core.addMethod(
  6712. $core.method({
  6713. selector: "reversed",
  6714. protocol: 'converting',
  6715. fn: function (){
  6716. var self=this;
  6717. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6718. return $core.withContext(function($ctx1) {
  6719. //>>excludeEnd("ctx");
  6720. return self.split("").reverse().join("");
  6721. return self;
  6722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6723. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  6724. //>>excludeEnd("ctx");
  6725. },
  6726. //>>excludeStart("ide", pragmas.excludeIdeData);
  6727. args: [],
  6728. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  6729. referencedClasses: [],
  6730. //>>excludeEnd("ide");
  6731. messageSends: []
  6732. }),
  6733. $globals.String);
  6734. $core.addMethod(
  6735. $core.method({
  6736. selector: "shallowCopy",
  6737. protocol: 'copying',
  6738. fn: function (){
  6739. var self=this;
  6740. return self;
  6741. },
  6742. //>>excludeStart("ide", pragmas.excludeIdeData);
  6743. args: [],
  6744. source: "shallowCopy\x0a\x09^ self",
  6745. referencedClasses: [],
  6746. //>>excludeEnd("ide");
  6747. messageSends: []
  6748. }),
  6749. $globals.String);
  6750. $core.addMethod(
  6751. $core.method({
  6752. selector: "size",
  6753. protocol: 'accessing',
  6754. fn: function (){
  6755. var self=this;
  6756. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6757. return $core.withContext(function($ctx1) {
  6758. //>>excludeEnd("ctx");
  6759. return self.length;
  6760. return self;
  6761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6762. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  6763. //>>excludeEnd("ctx");
  6764. },
  6765. //>>excludeStart("ide", pragmas.excludeIdeData);
  6766. args: [],
  6767. source: "size\x0a\x09<return self.length>",
  6768. referencedClasses: [],
  6769. //>>excludeEnd("ide");
  6770. messageSends: []
  6771. }),
  6772. $globals.String);
  6773. $core.addMethod(
  6774. $core.method({
  6775. selector: "subStrings:",
  6776. protocol: 'split join',
  6777. fn: function (aString){
  6778. var self=this;
  6779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6780. return $core.withContext(function($ctx1) {
  6781. //>>excludeEnd("ctx");
  6782. return self._tokenize_(aString);
  6783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6784. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  6785. //>>excludeEnd("ctx");
  6786. },
  6787. //>>excludeStart("ide", pragmas.excludeIdeData);
  6788. args: ["aString"],
  6789. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  6790. referencedClasses: [],
  6791. //>>excludeEnd("ide");
  6792. messageSends: ["tokenize:"]
  6793. }),
  6794. $globals.String);
  6795. $core.addMethod(
  6796. $core.method({
  6797. selector: "tokenize:",
  6798. protocol: 'split join',
  6799. fn: function (aString){
  6800. var self=this;
  6801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6802. return $core.withContext(function($ctx1) {
  6803. //>>excludeEnd("ctx");
  6804. return self.split(aString);
  6805. return self;
  6806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6807. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  6808. //>>excludeEnd("ctx");
  6809. },
  6810. //>>excludeStart("ide", pragmas.excludeIdeData);
  6811. args: ["aString"],
  6812. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  6813. referencedClasses: [],
  6814. //>>excludeEnd("ide");
  6815. messageSends: []
  6816. }),
  6817. $globals.String);
  6818. $core.addMethod(
  6819. $core.method({
  6820. selector: "trimBoth",
  6821. protocol: 'regular expressions',
  6822. fn: function (){
  6823. var self=this;
  6824. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6825. return $core.withContext(function($ctx1) {
  6826. //>>excludeEnd("ctx");
  6827. return self._trimBoth_("\x5cs");
  6828. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6829. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  6830. //>>excludeEnd("ctx");
  6831. },
  6832. //>>excludeStart("ide", pragmas.excludeIdeData);
  6833. args: [],
  6834. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  6835. referencedClasses: [],
  6836. //>>excludeEnd("ide");
  6837. messageSends: ["trimBoth:"]
  6838. }),
  6839. $globals.String);
  6840. $core.addMethod(
  6841. $core.method({
  6842. selector: "trimBoth:",
  6843. protocol: 'regular expressions',
  6844. fn: function (separators){
  6845. var self=this;
  6846. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6847. return $core.withContext(function($ctx1) {
  6848. //>>excludeEnd("ctx");
  6849. return $recv(self._trimLeft_(separators))._trimRight_(separators);
  6850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6851. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  6852. //>>excludeEnd("ctx");
  6853. },
  6854. //>>excludeStart("ide", pragmas.excludeIdeData);
  6855. args: ["separators"],
  6856. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  6857. referencedClasses: [],
  6858. //>>excludeEnd("ide");
  6859. messageSends: ["trimRight:", "trimLeft:"]
  6860. }),
  6861. $globals.String);
  6862. $core.addMethod(
  6863. $core.method({
  6864. selector: "trimLeft",
  6865. protocol: 'regular expressions',
  6866. fn: function (){
  6867. var self=this;
  6868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6869. return $core.withContext(function($ctx1) {
  6870. //>>excludeEnd("ctx");
  6871. return self._trimLeft_("\x5cs");
  6872. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6873. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  6874. //>>excludeEnd("ctx");
  6875. },
  6876. //>>excludeStart("ide", pragmas.excludeIdeData);
  6877. args: [],
  6878. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  6879. referencedClasses: [],
  6880. //>>excludeEnd("ide");
  6881. messageSends: ["trimLeft:"]
  6882. }),
  6883. $globals.String);
  6884. $core.addMethod(
  6885. $core.method({
  6886. selector: "trimLeft:",
  6887. protocol: 'regular expressions',
  6888. fn: function (separators){
  6889. var self=this;
  6890. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6892. return $core.withContext(function($ctx1) {
  6893. //>>excludeEnd("ctx");
  6894. var $2,$1;
  6895. $2=$recv("^[".__comma(separators)).__comma("]+");
  6896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6897. $ctx1.sendIdx[","]=1;
  6898. //>>excludeEnd("ctx");
  6899. $1=$recv($RegularExpression())._fromString_flag_($2,"g");
  6900. return self._replaceRegexp_with_($1,"");
  6901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6902. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  6903. //>>excludeEnd("ctx");
  6904. },
  6905. //>>excludeStart("ide", pragmas.excludeIdeData);
  6906. args: ["separators"],
  6907. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  6908. referencedClasses: ["RegularExpression"],
  6909. //>>excludeEnd("ide");
  6910. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6911. }),
  6912. $globals.String);
  6913. $core.addMethod(
  6914. $core.method({
  6915. selector: "trimRight",
  6916. protocol: 'regular expressions',
  6917. fn: function (){
  6918. var self=this;
  6919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6920. return $core.withContext(function($ctx1) {
  6921. //>>excludeEnd("ctx");
  6922. return self._trimRight_("\x5cs");
  6923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6924. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  6925. //>>excludeEnd("ctx");
  6926. },
  6927. //>>excludeStart("ide", pragmas.excludeIdeData);
  6928. args: [],
  6929. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  6930. referencedClasses: [],
  6931. //>>excludeEnd("ide");
  6932. messageSends: ["trimRight:"]
  6933. }),
  6934. $globals.String);
  6935. $core.addMethod(
  6936. $core.method({
  6937. selector: "trimRight:",
  6938. protocol: 'regular expressions',
  6939. fn: function (separators){
  6940. var self=this;
  6941. function $RegularExpression(){return $globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6942. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6943. return $core.withContext(function($ctx1) {
  6944. //>>excludeEnd("ctx");
  6945. var $2,$1;
  6946. $2=$recv("[".__comma(separators)).__comma("]+$");
  6947. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6948. $ctx1.sendIdx[","]=1;
  6949. //>>excludeEnd("ctx");
  6950. $1=$recv($RegularExpression())._fromString_flag_($2,"g");
  6951. return self._replaceRegexp_with_($1,"");
  6952. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6953. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  6954. //>>excludeEnd("ctx");
  6955. },
  6956. //>>excludeStart("ide", pragmas.excludeIdeData);
  6957. args: ["separators"],
  6958. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  6959. referencedClasses: ["RegularExpression"],
  6960. //>>excludeEnd("ide");
  6961. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  6962. }),
  6963. $globals.String);
  6964. $core.addMethod(
  6965. $core.method({
  6966. selector: "unescaped",
  6967. protocol: 'converting',
  6968. fn: function (){
  6969. var self=this;
  6970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6971. return $core.withContext(function($ctx1) {
  6972. //>>excludeEnd("ctx");
  6973. return unescape(self);
  6974. return self;
  6975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6976. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  6977. //>>excludeEnd("ctx");
  6978. },
  6979. //>>excludeStart("ide", pragmas.excludeIdeData);
  6980. args: [],
  6981. source: "unescaped\x0a\x09<return unescape(self)>",
  6982. referencedClasses: [],
  6983. //>>excludeEnd("ide");
  6984. messageSends: []
  6985. }),
  6986. $globals.String);
  6987. $core.addMethod(
  6988. $core.method({
  6989. selector: "uriComponentDecoded",
  6990. protocol: 'converting',
  6991. fn: function (){
  6992. var self=this;
  6993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6994. return $core.withContext(function($ctx1) {
  6995. //>>excludeEnd("ctx");
  6996. return decodeURIComponent(self);
  6997. return self;
  6998. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6999. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  7000. //>>excludeEnd("ctx");
  7001. },
  7002. //>>excludeStart("ide", pragmas.excludeIdeData);
  7003. args: [],
  7004. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  7005. referencedClasses: [],
  7006. //>>excludeEnd("ide");
  7007. messageSends: []
  7008. }),
  7009. $globals.String);
  7010. $core.addMethod(
  7011. $core.method({
  7012. selector: "uriComponentEncoded",
  7013. protocol: 'converting',
  7014. fn: function (){
  7015. var self=this;
  7016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7017. return $core.withContext(function($ctx1) {
  7018. //>>excludeEnd("ctx");
  7019. return encodeURIComponent(self);
  7020. return self;
  7021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7022. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  7023. //>>excludeEnd("ctx");
  7024. },
  7025. //>>excludeStart("ide", pragmas.excludeIdeData);
  7026. args: [],
  7027. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  7028. referencedClasses: [],
  7029. //>>excludeEnd("ide");
  7030. messageSends: []
  7031. }),
  7032. $globals.String);
  7033. $core.addMethod(
  7034. $core.method({
  7035. selector: "uriDecoded",
  7036. protocol: 'converting',
  7037. fn: function (){
  7038. var self=this;
  7039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7040. return $core.withContext(function($ctx1) {
  7041. //>>excludeEnd("ctx");
  7042. return decodeURI(self);
  7043. return self;
  7044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7045. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  7046. //>>excludeEnd("ctx");
  7047. },
  7048. //>>excludeStart("ide", pragmas.excludeIdeData);
  7049. args: [],
  7050. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  7051. referencedClasses: [],
  7052. //>>excludeEnd("ide");
  7053. messageSends: []
  7054. }),
  7055. $globals.String);
  7056. $core.addMethod(
  7057. $core.method({
  7058. selector: "uriEncoded",
  7059. protocol: 'converting',
  7060. fn: function (){
  7061. var self=this;
  7062. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7063. return $core.withContext(function($ctx1) {
  7064. //>>excludeEnd("ctx");
  7065. return encodeURI(self);
  7066. return self;
  7067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7068. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  7069. //>>excludeEnd("ctx");
  7070. },
  7071. //>>excludeStart("ide", pragmas.excludeIdeData);
  7072. args: [],
  7073. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  7074. referencedClasses: [],
  7075. //>>excludeEnd("ide");
  7076. messageSends: []
  7077. }),
  7078. $globals.String);
  7079. $core.addMethod(
  7080. $core.method({
  7081. selector: "value:",
  7082. protocol: 'evaluating',
  7083. fn: function (anObject){
  7084. var self=this;
  7085. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7086. return $core.withContext(function($ctx1) {
  7087. //>>excludeEnd("ctx");
  7088. return $recv(anObject)._perform_(self);
  7089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7090. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  7091. //>>excludeEnd("ctx");
  7092. },
  7093. //>>excludeStart("ide", pragmas.excludeIdeData);
  7094. args: ["anObject"],
  7095. source: "value: anObject \x0a\x09^ anObject perform: self",
  7096. referencedClasses: [],
  7097. //>>excludeEnd("ide");
  7098. messageSends: ["perform:"]
  7099. }),
  7100. $globals.String);
  7101. $core.addMethod(
  7102. $core.method({
  7103. selector: "cr",
  7104. protocol: 'accessing',
  7105. fn: function (){
  7106. var self=this;
  7107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7108. return $core.withContext(function($ctx1) {
  7109. //>>excludeEnd("ctx");
  7110. return '\r';
  7111. return self;
  7112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7113. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.klass)});
  7114. //>>excludeEnd("ctx");
  7115. },
  7116. //>>excludeStart("ide", pragmas.excludeIdeData);
  7117. args: [],
  7118. source: "cr\x0a\x09<return '\x5cr'>",
  7119. referencedClasses: [],
  7120. //>>excludeEnd("ide");
  7121. messageSends: []
  7122. }),
  7123. $globals.String.klass);
  7124. $core.addMethod(
  7125. $core.method({
  7126. selector: "crlf",
  7127. protocol: 'accessing',
  7128. fn: function (){
  7129. var self=this;
  7130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7131. return $core.withContext(function($ctx1) {
  7132. //>>excludeEnd("ctx");
  7133. return '\r\n';
  7134. return self;
  7135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7136. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.klass)});
  7137. //>>excludeEnd("ctx");
  7138. },
  7139. //>>excludeStart("ide", pragmas.excludeIdeData);
  7140. args: [],
  7141. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  7142. referencedClasses: [],
  7143. //>>excludeEnd("ide");
  7144. messageSends: []
  7145. }),
  7146. $globals.String.klass);
  7147. $core.addMethod(
  7148. $core.method({
  7149. selector: "esc",
  7150. protocol: 'accessing',
  7151. fn: function (){
  7152. var self=this;
  7153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7154. return $core.withContext(function($ctx1) {
  7155. //>>excludeEnd("ctx");
  7156. return self._fromCharCode_((27));
  7157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7158. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.klass)});
  7159. //>>excludeEnd("ctx");
  7160. },
  7161. //>>excludeStart("ide", pragmas.excludeIdeData);
  7162. args: [],
  7163. source: "esc\x0a\x09^ self fromCharCode: 27",
  7164. referencedClasses: [],
  7165. //>>excludeEnd("ide");
  7166. messageSends: ["fromCharCode:"]
  7167. }),
  7168. $globals.String.klass);
  7169. $core.addMethod(
  7170. $core.method({
  7171. selector: "fromCharCode:",
  7172. protocol: 'instance creation',
  7173. fn: function (anInteger){
  7174. var self=this;
  7175. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7176. return $core.withContext(function($ctx1) {
  7177. //>>excludeEnd("ctx");
  7178. return String.fromCharCode(anInteger);
  7179. return self;
  7180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7181. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.klass)});
  7182. //>>excludeEnd("ctx");
  7183. },
  7184. //>>excludeStart("ide", pragmas.excludeIdeData);
  7185. args: ["anInteger"],
  7186. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  7187. referencedClasses: [],
  7188. //>>excludeEnd("ide");
  7189. messageSends: []
  7190. }),
  7191. $globals.String.klass);
  7192. $core.addMethod(
  7193. $core.method({
  7194. selector: "fromString:",
  7195. protocol: 'instance creation',
  7196. fn: function (aString){
  7197. var self=this;
  7198. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7199. return $core.withContext(function($ctx1) {
  7200. //>>excludeEnd("ctx");
  7201. return String(aString);
  7202. return self;
  7203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7204. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.klass)});
  7205. //>>excludeEnd("ctx");
  7206. },
  7207. //>>excludeStart("ide", pragmas.excludeIdeData);
  7208. args: ["aString"],
  7209. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  7210. referencedClasses: [],
  7211. //>>excludeEnd("ide");
  7212. messageSends: []
  7213. }),
  7214. $globals.String.klass);
  7215. $core.addMethod(
  7216. $core.method({
  7217. selector: "lf",
  7218. protocol: 'accessing',
  7219. fn: function (){
  7220. var self=this;
  7221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7222. return $core.withContext(function($ctx1) {
  7223. //>>excludeEnd("ctx");
  7224. return '\n';
  7225. return self;
  7226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7227. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.klass)});
  7228. //>>excludeEnd("ctx");
  7229. },
  7230. //>>excludeStart("ide", pragmas.excludeIdeData);
  7231. args: [],
  7232. source: "lf\x0a\x09<return '\x5cn'>",
  7233. referencedClasses: [],
  7234. //>>excludeEnd("ide");
  7235. messageSends: []
  7236. }),
  7237. $globals.String.klass);
  7238. $core.addMethod(
  7239. $core.method({
  7240. selector: "random",
  7241. protocol: 'random',
  7242. fn: function (){
  7243. var self=this;
  7244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7245. return $core.withContext(function($ctx1) {
  7246. //>>excludeEnd("ctx");
  7247. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7248. return self;
  7249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7250. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.klass)});
  7251. //>>excludeEnd("ctx");
  7252. },
  7253. //>>excludeStart("ide", pragmas.excludeIdeData);
  7254. args: [],
  7255. 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);>",
  7256. referencedClasses: [],
  7257. //>>excludeEnd("ide");
  7258. messageSends: []
  7259. }),
  7260. $globals.String.klass);
  7261. $core.addMethod(
  7262. $core.method({
  7263. selector: "randomNotIn:",
  7264. protocol: 'random',
  7265. fn: function (aString){
  7266. var self=this;
  7267. var result;
  7268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7269. return $core.withContext(function($ctx1) {
  7270. //>>excludeEnd("ctx");
  7271. $recv((function(){
  7272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7273. return $core.withContext(function($ctx2) {
  7274. //>>excludeEnd("ctx");
  7275. result=self._random();
  7276. result;
  7277. return $recv(aString)._includesSubString_(result);
  7278. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7279. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7280. //>>excludeEnd("ctx");
  7281. }))._whileTrue();
  7282. return result;
  7283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7284. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.klass)});
  7285. //>>excludeEnd("ctx");
  7286. },
  7287. //>>excludeStart("ide", pragmas.excludeIdeData);
  7288. args: ["aString"],
  7289. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7290. referencedClasses: [],
  7291. //>>excludeEnd("ide");
  7292. messageSends: ["whileTrue", "random", "includesSubString:"]
  7293. }),
  7294. $globals.String.klass);
  7295. $core.addMethod(
  7296. $core.method({
  7297. selector: "space",
  7298. protocol: 'accessing',
  7299. fn: function (){
  7300. var self=this;
  7301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7302. return $core.withContext(function($ctx1) {
  7303. //>>excludeEnd("ctx");
  7304. return ' ';
  7305. return self;
  7306. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7307. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.klass)});
  7308. //>>excludeEnd("ctx");
  7309. },
  7310. //>>excludeStart("ide", pragmas.excludeIdeData);
  7311. args: [],
  7312. source: "space\x0a\x09<return ' '>",
  7313. referencedClasses: [],
  7314. //>>excludeEnd("ide");
  7315. messageSends: []
  7316. }),
  7317. $globals.String.klass);
  7318. $core.addMethod(
  7319. $core.method({
  7320. selector: "streamClass",
  7321. protocol: 'accessing',
  7322. fn: function (){
  7323. var self=this;
  7324. function $StringStream(){return $globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  7325. return $StringStream();
  7326. },
  7327. //>>excludeStart("ide", pragmas.excludeIdeData);
  7328. args: [],
  7329. source: "streamClass\x0a\x09\x09^ StringStream",
  7330. referencedClasses: ["StringStream"],
  7331. //>>excludeEnd("ide");
  7332. messageSends: []
  7333. }),
  7334. $globals.String.klass);
  7335. $core.addMethod(
  7336. $core.method({
  7337. selector: "tab",
  7338. protocol: 'accessing',
  7339. fn: function (){
  7340. var self=this;
  7341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7342. return $core.withContext(function($ctx1) {
  7343. //>>excludeEnd("ctx");
  7344. return '\t';
  7345. return self;
  7346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7347. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.klass)});
  7348. //>>excludeEnd("ctx");
  7349. },
  7350. //>>excludeStart("ide", pragmas.excludeIdeData);
  7351. args: [],
  7352. source: "tab\x0a\x09<return '\x5ct'>",
  7353. referencedClasses: [],
  7354. //>>excludeEnd("ide");
  7355. messageSends: []
  7356. }),
  7357. $globals.String.klass);
  7358. $core.addMethod(
  7359. $core.method({
  7360. selector: "value:",
  7361. protocol: 'instance creation',
  7362. fn: function (aUTFCharCode){
  7363. var self=this;
  7364. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7365. return $core.withContext(function($ctx1) {
  7366. //>>excludeEnd("ctx");
  7367. return String.fromCharCode(aUTFCharCode);;
  7368. return self;
  7369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7370. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.klass)});
  7371. //>>excludeEnd("ctx");
  7372. },
  7373. //>>excludeStart("ide", pragmas.excludeIdeData);
  7374. args: ["aUTFCharCode"],
  7375. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  7376. referencedClasses: [],
  7377. //>>excludeEnd("ide");
  7378. messageSends: []
  7379. }),
  7380. $globals.String.klass);
  7381. $core.addClass('Set', $globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  7382. //>>excludeStart("ide", pragmas.excludeIdeData);
  7383. $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`.";
  7384. //>>excludeEnd("ide");
  7385. $core.addMethod(
  7386. $core.method({
  7387. selector: "=",
  7388. protocol: 'comparing',
  7389. fn: function (aCollection){
  7390. var self=this;
  7391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7392. return $core.withContext(function($ctx1) {
  7393. //>>excludeEnd("ctx");
  7394. var $2,$1,$4,$3,$5;
  7395. var $early={};
  7396. try {
  7397. $2=self._class();
  7398. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7399. $ctx1.sendIdx["class"]=1;
  7400. //>>excludeEnd("ctx");
  7401. $1=$recv($2).__eq($recv(aCollection)._class());
  7402. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7403. $ctx1.sendIdx["="]=1;
  7404. //>>excludeEnd("ctx");
  7405. if(!$core.assert($1)){
  7406. return false;
  7407. };
  7408. $4=self._size();
  7409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7410. $ctx1.sendIdx["size"]=1;
  7411. //>>excludeEnd("ctx");
  7412. $3=$recv($4).__eq($recv(aCollection)._size());
  7413. if(!$core.assert($3)){
  7414. return false;
  7415. };
  7416. self._do_((function(each){
  7417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7418. return $core.withContext(function($ctx2) {
  7419. //>>excludeEnd("ctx");
  7420. $5=$recv(aCollection)._includes_(each);
  7421. if(!$core.assert($5)){
  7422. throw $early=[false];
  7423. };
  7424. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7426. //>>excludeEnd("ctx");
  7427. }));
  7428. return true;
  7429. }
  7430. catch(e) {if(e===$early)return e[0]; throw e}
  7431. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7432. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  7433. //>>excludeEnd("ctx");
  7434. },
  7435. //>>excludeStart("ide", pragmas.excludeIdeData);
  7436. args: ["aCollection"],
  7437. 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",
  7438. referencedClasses: [],
  7439. //>>excludeEnd("ide");
  7440. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7441. }),
  7442. $globals.Set);
  7443. $core.addMethod(
  7444. $core.method({
  7445. selector: "add:",
  7446. protocol: 'adding/removing',
  7447. fn: function (anObject){
  7448. var self=this;
  7449. var bucket;
  7450. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7451. return $core.withContext(function($ctx1) {
  7452. //>>excludeEnd("ctx");
  7453. var $1,$receiver;
  7454. bucket=self._bucketsOfElement_(anObject);
  7455. $1=$recv(bucket)._second();
  7456. if(($receiver = $1) == null || $receiver.isNil){
  7457. var object,slowBucket;
  7458. object=$recv(bucket)._first();
  7459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7460. $ctx1.sendIdx["first"]=1;
  7461. //>>excludeEnd("ctx");
  7462. object;
  7463. slowBucket=$recv(bucket)._third();
  7464. slowBucket;
  7465. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7467. return $core.withContext(function($ctx2) {
  7468. //>>excludeEnd("ctx");
  7469. $recv(slowBucket)._add_(object);
  7470. self["@size"]=$recv(self["@size"]).__plus((1));
  7471. return self["@size"];
  7472. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7473. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7474. //>>excludeEnd("ctx");
  7475. }));
  7476. return object;
  7477. } else {
  7478. var primitiveBucket;
  7479. primitiveBucket=$receiver;
  7480. return self._add_in_($recv(bucket)._first(),primitiveBucket);
  7481. };
  7482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7483. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7484. //>>excludeEnd("ctx");
  7485. },
  7486. //>>excludeStart("ide", pragmas.excludeIdeData);
  7487. args: ["anObject"],
  7488. 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 ]",
  7489. referencedClasses: [],
  7490. //>>excludeEnd("ide");
  7491. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7492. }),
  7493. $globals.Set);
  7494. $core.addMethod(
  7495. $core.method({
  7496. selector: "add:in:",
  7497. protocol: 'private',
  7498. fn: function (anObject,anotherObject){
  7499. var self=this;
  7500. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7501. return $core.withContext(function($ctx1) {
  7502. //>>excludeEnd("ctx");
  7503. if (anObject in anotherObject.store) { return false; }
  7504. self['@size']++;
  7505. anotherObject.store[anObject] = true;
  7506. return anObject;
  7507. ;
  7508. return self;
  7509. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7510. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7511. //>>excludeEnd("ctx");
  7512. },
  7513. //>>excludeStart("ide", pragmas.excludeIdeData);
  7514. args: ["anObject", "anotherObject"],
  7515. 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>",
  7516. referencedClasses: [],
  7517. //>>excludeEnd("ide");
  7518. messageSends: []
  7519. }),
  7520. $globals.Set);
  7521. $core.addMethod(
  7522. $core.method({
  7523. selector: "bucketsOfElement:",
  7524. protocol: 'private',
  7525. fn: function (anObject){
  7526. var self=this;
  7527. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7528. return $core.withContext(function($ctx1) {
  7529. //>>excludeEnd("ctx");
  7530. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  7531. if ((type = typeof prim) === "object") {
  7532. if (anObject !== nil) {
  7533. bucket = null;
  7534. self['@slowBucketStores'].some(function (store) {
  7535. return bucket = store._bucketOfElement_(anObject);
  7536. });
  7537. return [ anObject, null, bucket || self['@defaultBucket'] ];
  7538. }
  7539. // include nil to well-known objects under 'boolean' fastBucket
  7540. prim = null;
  7541. type = 'boolean';
  7542. }
  7543. return [ prim, self['@fastBuckets'][type] ];
  7544. ;
  7545. return self;
  7546. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7547. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  7548. //>>excludeEnd("ctx");
  7549. },
  7550. //>>excludeStart("ide", pragmas.excludeIdeData);
  7551. args: ["anObject"],
  7552. 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\x09var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();\x0a\x09\x09if ((type = typeof prim) === \x22object\x22) {\x0a\x09\x09\x09if (anObject !== nil) {\x0a\x09\x09\x09\x09bucket = null;\x0a\x09\x09\x09\x09self['@slowBucketStores'].some(function (store) {\x0a\x09\x09\x09\x09\x09return bucket = store._bucketOfElement_(anObject);\x0a\x09\x09\x09\x09});\x0a\x09\x09\x09\x09return [ anObject, null, bucket || self['@defaultBucket'] ];\x0a\x09\x09\x09}\x0a\x09\x09\x09\x0a\x09\x09\x09// include nil to well-known objects under 'boolean' fastBucket\x0a\x09\x09\x09prim = null;\x0a\x09\x09\x09type = 'boolean';\x0a\x09\x09}\x0a\x09\x09return [ prim, self['@fastBuckets'][type] ];\x0a\x09>",
  7553. referencedClasses: [],
  7554. //>>excludeEnd("ide");
  7555. messageSends: []
  7556. }),
  7557. $globals.Set);
  7558. $core.addMethod(
  7559. $core.method({
  7560. selector: "classNameOf:",
  7561. protocol: 'private',
  7562. fn: function (anObject){
  7563. var self=this;
  7564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7565. return $core.withContext(function($ctx1) {
  7566. //>>excludeEnd("ctx");
  7567. return anObject.klass != null && anObject.klass.className;
  7568. return self;
  7569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7570. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  7571. //>>excludeEnd("ctx");
  7572. },
  7573. //>>excludeStart("ide", pragmas.excludeIdeData);
  7574. args: ["anObject"],
  7575. 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>",
  7576. referencedClasses: [],
  7577. //>>excludeEnd("ide");
  7578. messageSends: []
  7579. }),
  7580. $globals.Set);
  7581. $core.addMethod(
  7582. $core.method({
  7583. selector: "collect:",
  7584. protocol: 'enumerating',
  7585. fn: function (aBlock){
  7586. var self=this;
  7587. var collection;
  7588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7589. return $core.withContext(function($ctx1) {
  7590. //>>excludeEnd("ctx");
  7591. collection=$recv(self._class())._new();
  7592. self._do_((function(each){
  7593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7594. return $core.withContext(function($ctx2) {
  7595. //>>excludeEnd("ctx");
  7596. return $recv(collection)._add_($recv(aBlock)._value_(each));
  7597. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7598. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7599. //>>excludeEnd("ctx");
  7600. }));
  7601. return collection;
  7602. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7603. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  7604. //>>excludeEnd("ctx");
  7605. },
  7606. //>>excludeStart("ide", pragmas.excludeIdeData);
  7607. args: ["aBlock"],
  7608. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7609. referencedClasses: [],
  7610. //>>excludeEnd("ide");
  7611. messageSends: ["new", "class", "do:", "add:", "value:"]
  7612. }),
  7613. $globals.Set);
  7614. $core.addMethod(
  7615. $core.method({
  7616. selector: "detect:ifNone:",
  7617. protocol: 'enumerating',
  7618. fn: function (aBlock,anotherBlock){
  7619. var self=this;
  7620. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7621. return $core.withContext(function($ctx1) {
  7622. //>>excludeEnd("ctx");
  7623. var $1;
  7624. var $early={};
  7625. try {
  7626. self._do_((function(each){
  7627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7628. return $core.withContext(function($ctx2) {
  7629. //>>excludeEnd("ctx");
  7630. $1=$recv(aBlock)._value_(each);
  7631. if($core.assert($1)){
  7632. throw $early=[each];
  7633. };
  7634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7635. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7636. //>>excludeEnd("ctx");
  7637. }));
  7638. return $recv(anotherBlock)._value();
  7639. }
  7640. catch(e) {if(e===$early)return e[0]; throw e}
  7641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7642. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  7643. //>>excludeEnd("ctx");
  7644. },
  7645. //>>excludeStart("ide", pragmas.excludeIdeData);
  7646. args: ["aBlock", "anotherBlock"],
  7647. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7648. referencedClasses: [],
  7649. //>>excludeEnd("ide");
  7650. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7651. }),
  7652. $globals.Set);
  7653. $core.addMethod(
  7654. $core.method({
  7655. selector: "do:",
  7656. protocol: 'enumerating',
  7657. fn: function (aBlock){
  7658. var self=this;
  7659. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7660. return $core.withContext(function($ctx1) {
  7661. //>>excludeEnd("ctx");
  7662. var el, keys, i;
  7663. el = self['@fastBuckets'];
  7664. keys = Object.keys(el);
  7665. for (i = 0; i < keys.length; ++i) {
  7666. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7667. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7668. else { store._do_(aBlock); }
  7669. }
  7670. el = self['@slowBucketStores'];
  7671. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7672. self['@defaultBucket']._do_(aBlock);
  7673. ;
  7674. return self;
  7675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7676. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  7677. //>>excludeEnd("ctx");
  7678. },
  7679. //>>excludeStart("ide", pragmas.excludeIdeData);
  7680. args: ["aBlock"],
  7681. 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>",
  7682. referencedClasses: [],
  7683. //>>excludeEnd("ide");
  7684. messageSends: []
  7685. }),
  7686. $globals.Set);
  7687. $core.addMethod(
  7688. $core.method({
  7689. selector: "includes:",
  7690. protocol: 'testing',
  7691. fn: function (anObject){
  7692. var self=this;
  7693. var bucket;
  7694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7695. return $core.withContext(function($ctx1) {
  7696. //>>excludeEnd("ctx");
  7697. var $1,$2,$3,$receiver;
  7698. bucket=self._bucketsOfElement_(anObject);
  7699. $1=$recv(bucket)._second();
  7700. if(($receiver = $1) == null || $receiver.isNil){
  7701. $2=$recv(bucket)._third();
  7702. $3=$recv(bucket)._first();
  7703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7704. $ctx1.sendIdx["first"]=1;
  7705. //>>excludeEnd("ctx");
  7706. return $recv($2)._includes_($3);
  7707. } else {
  7708. var primitiveBucket;
  7709. primitiveBucket=$receiver;
  7710. return self._includes_in_($recv(bucket)._first(),primitiveBucket);
  7711. };
  7712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7713. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  7714. //>>excludeEnd("ctx");
  7715. },
  7716. //>>excludeStart("ide", pragmas.excludeIdeData);
  7717. args: ["anObject"],
  7718. 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 ]",
  7719. referencedClasses: [],
  7720. //>>excludeEnd("ide");
  7721. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  7722. }),
  7723. $globals.Set);
  7724. $core.addMethod(
  7725. $core.method({
  7726. selector: "includes:in:",
  7727. protocol: 'private',
  7728. fn: function (anObject,anotherObject){
  7729. var self=this;
  7730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7731. return $core.withContext(function($ctx1) {
  7732. //>>excludeEnd("ctx");
  7733. return anObject in anotherObject.store;
  7734. return self;
  7735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7736. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7737. //>>excludeEnd("ctx");
  7738. },
  7739. //>>excludeStart("ide", pragmas.excludeIdeData);
  7740. args: ["anObject", "anotherObject"],
  7741. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  7742. referencedClasses: [],
  7743. //>>excludeEnd("ide");
  7744. messageSends: []
  7745. }),
  7746. $globals.Set);
  7747. $core.addMethod(
  7748. $core.method({
  7749. selector: "initialize",
  7750. protocol: 'initialization',
  7751. fn: function (){
  7752. var self=this;
  7753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7754. return $core.withContext(function($ctx1) {
  7755. //>>excludeEnd("ctx");
  7756. (
  7757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7758. $ctx1.supercall = true,
  7759. //>>excludeEnd("ctx");
  7760. $globals.Set.superclass.fn.prototype._initialize.apply($recv(self), []));
  7761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7762. $ctx1.supercall = false;
  7763. //>>excludeEnd("ctx");;
  7764. self["@defaultBucket"]=[];
  7765. self._initializeSlowBucketStores();
  7766. self._removeAll();
  7767. return self;
  7768. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7769. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  7770. //>>excludeEnd("ctx");
  7771. },
  7772. //>>excludeStart("ide", pragmas.excludeIdeData);
  7773. args: [],
  7774. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  7775. referencedClasses: [],
  7776. //>>excludeEnd("ide");
  7777. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  7778. }),
  7779. $globals.Set);
  7780. $core.addMethod(
  7781. $core.method({
  7782. selector: "initializeSlowBucketStores",
  7783. protocol: 'initialization',
  7784. fn: function (){
  7785. var self=this;
  7786. function $ArrayBucketStore(){return $globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  7787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7788. return $core.withContext(function($ctx1) {
  7789. //>>excludeEnd("ctx");
  7790. var $1;
  7791. $1=$recv($ArrayBucketStore())._hashBlock_((function(x){
  7792. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7793. return $core.withContext(function($ctx2) {
  7794. //>>excludeEnd("ctx");
  7795. return self._classNameOf_(x);
  7796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7797. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  7798. //>>excludeEnd("ctx");
  7799. }));
  7800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7801. $ctx1.sendIdx["hashBlock:"]=1;
  7802. //>>excludeEnd("ctx");
  7803. self["@slowBucketStores"]=[$1,$recv($ArrayBucketStore())._hashBlock_((function(x){
  7804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7805. return $core.withContext(function($ctx2) {
  7806. //>>excludeEnd("ctx");
  7807. return self._jsConstructorNameOf_(x);
  7808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7809. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  7810. //>>excludeEnd("ctx");
  7811. }))];
  7812. return self;
  7813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7814. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  7815. //>>excludeEnd("ctx");
  7816. },
  7817. //>>excludeStart("ide", pragmas.excludeIdeData);
  7818. args: [],
  7819. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  7820. referencedClasses: ["ArrayBucketStore"],
  7821. //>>excludeEnd("ide");
  7822. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  7823. }),
  7824. $globals.Set);
  7825. $core.addMethod(
  7826. $core.method({
  7827. selector: "jsConstructorNameOf:",
  7828. protocol: 'private',
  7829. fn: function (anObject){
  7830. var self=this;
  7831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7832. return $core.withContext(function($ctx1) {
  7833. //>>excludeEnd("ctx");
  7834. return anObject.constructor && anObject.constructor.name;
  7835. return self;
  7836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7837. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  7838. //>>excludeEnd("ctx");
  7839. },
  7840. //>>excludeStart("ide", pragmas.excludeIdeData);
  7841. args: ["anObject"],
  7842. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  7843. referencedClasses: [],
  7844. //>>excludeEnd("ide");
  7845. messageSends: []
  7846. }),
  7847. $globals.Set);
  7848. $core.addMethod(
  7849. $core.method({
  7850. selector: "printOn:",
  7851. protocol: 'printing',
  7852. fn: function (aStream){
  7853. var self=this;
  7854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7855. return $core.withContext(function($ctx1) {
  7856. //>>excludeEnd("ctx");
  7857. (
  7858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7859. $ctx1.supercall = true,
  7860. //>>excludeEnd("ctx");
  7861. $globals.Set.superclass.fn.prototype._printOn_.apply($recv(self), [aStream]));
  7862. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7863. $ctx1.supercall = false;
  7864. //>>excludeEnd("ctx");;
  7865. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7866. $ctx1.sendIdx["printOn:"]=1;
  7867. //>>excludeEnd("ctx");
  7868. $recv(aStream)._nextPutAll_(" (");
  7869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7870. $ctx1.sendIdx["nextPutAll:"]=1;
  7871. //>>excludeEnd("ctx");
  7872. self._do_separatedBy_((function(each){
  7873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7874. return $core.withContext(function($ctx2) {
  7875. //>>excludeEnd("ctx");
  7876. return $recv(each)._printOn_(aStream);
  7877. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7878. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7879. //>>excludeEnd("ctx");
  7880. }),(function(){
  7881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7882. return $core.withContext(function($ctx2) {
  7883. //>>excludeEnd("ctx");
  7884. return $recv(aStream)._nextPutAll_(" ");
  7885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7886. $ctx2.sendIdx["nextPutAll:"]=2;
  7887. //>>excludeEnd("ctx");
  7888. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7889. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7890. //>>excludeEnd("ctx");
  7891. }));
  7892. $recv(aStream)._nextPutAll_(")");
  7893. return self;
  7894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7895. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  7896. //>>excludeEnd("ctx");
  7897. },
  7898. //>>excludeStart("ide", pragmas.excludeIdeData);
  7899. args: ["aStream"],
  7900. 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: ')'",
  7901. referencedClasses: [],
  7902. //>>excludeEnd("ide");
  7903. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  7904. }),
  7905. $globals.Set);
  7906. $core.addMethod(
  7907. $core.method({
  7908. selector: "remove:ifAbsent:",
  7909. protocol: 'adding/removing',
  7910. fn: function (anObject,aBlock){
  7911. var self=this;
  7912. var bucket;
  7913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7914. return $core.withContext(function($ctx1) {
  7915. //>>excludeEnd("ctx");
  7916. var $1,$2,$3,$receiver;
  7917. var $early={};
  7918. try {
  7919. bucket=self._bucketsOfElement_(anObject);
  7920. $1=$recv(bucket)._second();
  7921. if(($receiver = $1) == null || $receiver.isNil){
  7922. $2=$recv(bucket)._third();
  7923. $3=$recv(bucket)._first();
  7924. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7925. $ctx1.sendIdx["first"]=1;
  7926. //>>excludeEnd("ctx");
  7927. $recv($2)._remove_ifAbsent_($3,(function(){
  7928. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7929. return $core.withContext(function($ctx2) {
  7930. //>>excludeEnd("ctx");
  7931. throw $early=[$recv(aBlock)._value()];
  7932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7934. //>>excludeEnd("ctx");
  7935. }));
  7936. self["@size"]=$recv(self["@size"]).__minus((1));
  7937. return self["@size"];
  7938. } else {
  7939. var primitiveBucket;
  7940. primitiveBucket=$receiver;
  7941. return self._remove_in_($recv(bucket)._first(),primitiveBucket);
  7942. };
  7943. }
  7944. catch(e) {if(e===$early)return e[0]; throw e}
  7945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7946. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  7947. //>>excludeEnd("ctx");
  7948. },
  7949. //>>excludeStart("ide", pragmas.excludeIdeData);
  7950. args: ["anObject", "aBlock"],
  7951. 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 ]",
  7952. referencedClasses: [],
  7953. //>>excludeEnd("ide");
  7954. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  7955. }),
  7956. $globals.Set);
  7957. $core.addMethod(
  7958. $core.method({
  7959. selector: "remove:in:",
  7960. protocol: 'private',
  7961. fn: function (anObject,anotherObject){
  7962. var self=this;
  7963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7964. return $core.withContext(function($ctx1) {
  7965. //>>excludeEnd("ctx");
  7966. if (delete anotherObject.store[anObject]) self['@size']--;
  7967. return self;
  7968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7969. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  7970. //>>excludeEnd("ctx");
  7971. },
  7972. //>>excludeStart("ide", pragmas.excludeIdeData);
  7973. args: ["anObject", "anotherObject"],
  7974. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  7975. referencedClasses: [],
  7976. //>>excludeEnd("ide");
  7977. messageSends: []
  7978. }),
  7979. $globals.Set);
  7980. $core.addMethod(
  7981. $core.method({
  7982. selector: "removeAll",
  7983. protocol: 'adding/removing',
  7984. fn: function (){
  7985. var self=this;
  7986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7987. return $core.withContext(function($ctx1) {
  7988. //>>excludeEnd("ctx");
  7989. self['@fastBuckets'] = {
  7990. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  7991. 'number': { store: Object.create(null), fn: Number },
  7992. 'string': { store: Object.create(null) }
  7993. };
  7994. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  7995. self['@defaultBucket']._removeAll();
  7996. self['@size'] = 0;
  7997. ;
  7998. return self;
  7999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8000. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  8001. //>>excludeEnd("ctx");
  8002. },
  8003. //>>excludeStart("ide", pragmas.excludeIdeData);
  8004. args: [],
  8005. 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>",
  8006. referencedClasses: [],
  8007. //>>excludeEnd("ide");
  8008. messageSends: []
  8009. }),
  8010. $globals.Set);
  8011. $core.addMethod(
  8012. $core.method({
  8013. selector: "select:",
  8014. protocol: 'enumerating',
  8015. fn: function (aBlock){
  8016. var self=this;
  8017. var collection;
  8018. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8019. return $core.withContext(function($ctx1) {
  8020. //>>excludeEnd("ctx");
  8021. var $1;
  8022. collection=$recv(self._class())._new();
  8023. self._do_((function(each){
  8024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8025. return $core.withContext(function($ctx2) {
  8026. //>>excludeEnd("ctx");
  8027. $1=$recv(aBlock)._value_(each);
  8028. if($core.assert($1)){
  8029. return $recv(collection)._add_(each);
  8030. };
  8031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8032. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8033. //>>excludeEnd("ctx");
  8034. }));
  8035. return collection;
  8036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8037. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  8038. //>>excludeEnd("ctx");
  8039. },
  8040. //>>excludeStart("ide", pragmas.excludeIdeData);
  8041. args: ["aBlock"],
  8042. 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",
  8043. referencedClasses: [],
  8044. //>>excludeEnd("ide");
  8045. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8046. }),
  8047. $globals.Set);
  8048. $core.addMethod(
  8049. $core.method({
  8050. selector: "size",
  8051. protocol: 'accessing',
  8052. fn: function (){
  8053. var self=this;
  8054. return self["@size"];
  8055. },
  8056. //>>excludeStart("ide", pragmas.excludeIdeData);
  8057. args: [],
  8058. source: "size\x0a\x09^ size",
  8059. referencedClasses: [],
  8060. //>>excludeEnd("ide");
  8061. messageSends: []
  8062. }),
  8063. $globals.Set);
  8064. $core.addClass('ProtoStream', $globals.Object, [], 'Kernel-Collections');
  8065. //>>excludeStart("ide", pragmas.excludeIdeData);
  8066. $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.";
  8067. //>>excludeEnd("ide");
  8068. $core.addMethod(
  8069. $core.method({
  8070. selector: "<<",
  8071. protocol: 'writing',
  8072. fn: function (anObject){
  8073. var self=this;
  8074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8075. return $core.withContext(function($ctx1) {
  8076. //>>excludeEnd("ctx");
  8077. self._write_(anObject);
  8078. return self;
  8079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8080. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  8081. //>>excludeEnd("ctx");
  8082. },
  8083. //>>excludeStart("ide", pragmas.excludeIdeData);
  8084. args: ["anObject"],
  8085. source: "<< anObject\x0a\x09self write: anObject",
  8086. referencedClasses: [],
  8087. //>>excludeEnd("ide");
  8088. messageSends: ["write:"]
  8089. }),
  8090. $globals.ProtoStream);
  8091. $core.addMethod(
  8092. $core.method({
  8093. selector: "atEnd",
  8094. protocol: 'testing',
  8095. fn: function (){
  8096. var self=this;
  8097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8098. return $core.withContext(function($ctx1) {
  8099. //>>excludeEnd("ctx");
  8100. self._subclassResponsibility();
  8101. return self;
  8102. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8103. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  8104. //>>excludeEnd("ctx");
  8105. },
  8106. //>>excludeStart("ide", pragmas.excludeIdeData);
  8107. args: [],
  8108. source: "atEnd\x0a\x09self subclassResponsibility",
  8109. referencedClasses: [],
  8110. //>>excludeEnd("ide");
  8111. messageSends: ["subclassResponsibility"]
  8112. }),
  8113. $globals.ProtoStream);
  8114. $core.addMethod(
  8115. $core.method({
  8116. selector: "atStart",
  8117. protocol: 'testing',
  8118. fn: function (){
  8119. var self=this;
  8120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8121. return $core.withContext(function($ctx1) {
  8122. //>>excludeEnd("ctx");
  8123. self._subclassResponsibility();
  8124. return self;
  8125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8126. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  8127. //>>excludeEnd("ctx");
  8128. },
  8129. //>>excludeStart("ide", pragmas.excludeIdeData);
  8130. args: [],
  8131. source: "atStart\x0a\x09self subclassResponsibility",
  8132. referencedClasses: [],
  8133. //>>excludeEnd("ide");
  8134. messageSends: ["subclassResponsibility"]
  8135. }),
  8136. $globals.ProtoStream);
  8137. $core.addMethod(
  8138. $core.method({
  8139. selector: "contents",
  8140. protocol: 'accessing',
  8141. fn: function (){
  8142. var self=this;
  8143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8144. return $core.withContext(function($ctx1) {
  8145. //>>excludeEnd("ctx");
  8146. self._subclassResponsibility();
  8147. return self;
  8148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8149. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  8150. //>>excludeEnd("ctx");
  8151. },
  8152. //>>excludeStart("ide", pragmas.excludeIdeData);
  8153. args: [],
  8154. source: "contents\x0a\x09self subclassResponsibility",
  8155. referencedClasses: [],
  8156. //>>excludeEnd("ide");
  8157. messageSends: ["subclassResponsibility"]
  8158. }),
  8159. $globals.ProtoStream);
  8160. $core.addMethod(
  8161. $core.method({
  8162. selector: "do:",
  8163. protocol: 'enumerating',
  8164. fn: function (aBlock){
  8165. var self=this;
  8166. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8167. return $core.withContext(function($ctx1) {
  8168. //>>excludeEnd("ctx");
  8169. $recv((function(){
  8170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8171. return $core.withContext(function($ctx2) {
  8172. //>>excludeEnd("ctx");
  8173. return self._atEnd();
  8174. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8175. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8176. //>>excludeEnd("ctx");
  8177. }))._whileFalse_((function(){
  8178. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8179. return $core.withContext(function($ctx2) {
  8180. //>>excludeEnd("ctx");
  8181. return $recv(aBlock)._value_(self._next());
  8182. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8183. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8184. //>>excludeEnd("ctx");
  8185. }));
  8186. return self;
  8187. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8188. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  8189. //>>excludeEnd("ctx");
  8190. },
  8191. //>>excludeStart("ide", pragmas.excludeIdeData);
  8192. args: ["aBlock"],
  8193. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8194. referencedClasses: [],
  8195. //>>excludeEnd("ide");
  8196. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8197. }),
  8198. $globals.ProtoStream);
  8199. $core.addMethod(
  8200. $core.method({
  8201. selector: "isEmpty",
  8202. protocol: 'testing',
  8203. fn: function (){
  8204. var self=this;
  8205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8206. return $core.withContext(function($ctx1) {
  8207. //>>excludeEnd("ctx");
  8208. return $recv(self._atStart())._and_((function(){
  8209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8210. return $core.withContext(function($ctx2) {
  8211. //>>excludeEnd("ctx");
  8212. return self._atEnd();
  8213. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8214. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8215. //>>excludeEnd("ctx");
  8216. }));
  8217. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8218. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  8219. //>>excludeEnd("ctx");
  8220. },
  8221. //>>excludeStart("ide", pragmas.excludeIdeData);
  8222. args: [],
  8223. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  8224. referencedClasses: [],
  8225. //>>excludeEnd("ide");
  8226. messageSends: ["and:", "atStart", "atEnd"]
  8227. }),
  8228. $globals.ProtoStream);
  8229. $core.addMethod(
  8230. $core.method({
  8231. selector: "next",
  8232. protocol: 'reading',
  8233. fn: function (){
  8234. var self=this;
  8235. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8236. return $core.withContext(function($ctx1) {
  8237. //>>excludeEnd("ctx");
  8238. var $1;
  8239. $1=self._atEnd();
  8240. if($core.assert($1)){
  8241. return nil;
  8242. } else {
  8243. return self._subclassResponsibility();
  8244. };
  8245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8246. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  8247. //>>excludeEnd("ctx");
  8248. },
  8249. //>>excludeStart("ide", pragmas.excludeIdeData);
  8250. args: [],
  8251. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8252. referencedClasses: [],
  8253. //>>excludeEnd("ide");
  8254. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8255. }),
  8256. $globals.ProtoStream);
  8257. $core.addMethod(
  8258. $core.method({
  8259. selector: "nextPut:",
  8260. protocol: 'writing',
  8261. fn: function (anObject){
  8262. var self=this;
  8263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8264. return $core.withContext(function($ctx1) {
  8265. //>>excludeEnd("ctx");
  8266. self._subclassResponsibility();
  8267. return self;
  8268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8269. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  8270. //>>excludeEnd("ctx");
  8271. },
  8272. //>>excludeStart("ide", pragmas.excludeIdeData);
  8273. args: ["anObject"],
  8274. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  8275. referencedClasses: [],
  8276. //>>excludeEnd("ide");
  8277. messageSends: ["subclassResponsibility"]
  8278. }),
  8279. $globals.ProtoStream);
  8280. $core.addMethod(
  8281. $core.method({
  8282. selector: "nextPutAll:",
  8283. protocol: 'writing',
  8284. fn: function (aCollection){
  8285. var self=this;
  8286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8287. return $core.withContext(function($ctx1) {
  8288. //>>excludeEnd("ctx");
  8289. $recv(aCollection)._do_((function(each){
  8290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8291. return $core.withContext(function($ctx2) {
  8292. //>>excludeEnd("ctx");
  8293. return self._nextPut_(each);
  8294. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8296. //>>excludeEnd("ctx");
  8297. }));
  8298. return self;
  8299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8300. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  8301. //>>excludeEnd("ctx");
  8302. },
  8303. //>>excludeStart("ide", pragmas.excludeIdeData);
  8304. args: ["aCollection"],
  8305. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8306. referencedClasses: [],
  8307. //>>excludeEnd("ide");
  8308. messageSends: ["do:", "nextPut:"]
  8309. }),
  8310. $globals.ProtoStream);
  8311. $core.addMethod(
  8312. $core.method({
  8313. selector: "nextPutJSObject:",
  8314. protocol: 'writing',
  8315. fn: function (aJSObject){
  8316. var self=this;
  8317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8318. return $core.withContext(function($ctx1) {
  8319. //>>excludeEnd("ctx");
  8320. self._nextPut_(aJSObject);
  8321. return self;
  8322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8323. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  8324. //>>excludeEnd("ctx");
  8325. },
  8326. //>>excludeStart("ide", pragmas.excludeIdeData);
  8327. args: ["aJSObject"],
  8328. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  8329. referencedClasses: [],
  8330. //>>excludeEnd("ide");
  8331. messageSends: ["nextPut:"]
  8332. }),
  8333. $globals.ProtoStream);
  8334. $core.addMethod(
  8335. $core.method({
  8336. selector: "nextPutString:",
  8337. protocol: 'writing',
  8338. fn: function (aString){
  8339. var self=this;
  8340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8341. return $core.withContext(function($ctx1) {
  8342. //>>excludeEnd("ctx");
  8343. self._nextPut_(aString);
  8344. return self;
  8345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8346. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  8347. //>>excludeEnd("ctx");
  8348. },
  8349. //>>excludeStart("ide", pragmas.excludeIdeData);
  8350. args: ["aString"],
  8351. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  8352. referencedClasses: [],
  8353. //>>excludeEnd("ide");
  8354. messageSends: ["nextPut:"]
  8355. }),
  8356. $globals.ProtoStream);
  8357. $core.addMethod(
  8358. $core.method({
  8359. selector: "peek",
  8360. protocol: 'reading',
  8361. fn: function (){
  8362. var self=this;
  8363. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8364. return $core.withContext(function($ctx1) {
  8365. //>>excludeEnd("ctx");
  8366. var $1;
  8367. $1=self._atEnd();
  8368. if($core.assert($1)){
  8369. return nil;
  8370. } else {
  8371. return self._subclassResponsibility();
  8372. };
  8373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8374. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  8375. //>>excludeEnd("ctx");
  8376. },
  8377. //>>excludeStart("ide", pragmas.excludeIdeData);
  8378. args: [],
  8379. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  8380. referencedClasses: [],
  8381. //>>excludeEnd("ide");
  8382. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  8383. }),
  8384. $globals.ProtoStream);
  8385. $core.addMethod(
  8386. $core.method({
  8387. selector: "reset",
  8388. protocol: 'actions',
  8389. fn: function (){
  8390. var self=this;
  8391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8392. return $core.withContext(function($ctx1) {
  8393. //>>excludeEnd("ctx");
  8394. self._subclassResponsibility();
  8395. return self;
  8396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8397. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  8398. //>>excludeEnd("ctx");
  8399. },
  8400. //>>excludeStart("ide", pragmas.excludeIdeData);
  8401. args: [],
  8402. source: "reset\x0a\x09self subclassResponsibility",
  8403. referencedClasses: [],
  8404. //>>excludeEnd("ide");
  8405. messageSends: ["subclassResponsibility"]
  8406. }),
  8407. $globals.ProtoStream);
  8408. $core.addMethod(
  8409. $core.method({
  8410. selector: "resetContents",
  8411. protocol: 'actions',
  8412. fn: function (){
  8413. var self=this;
  8414. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8415. return $core.withContext(function($ctx1) {
  8416. //>>excludeEnd("ctx");
  8417. self._subclassResponsibility();
  8418. return self;
  8419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8420. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  8421. //>>excludeEnd("ctx");
  8422. },
  8423. //>>excludeStart("ide", pragmas.excludeIdeData);
  8424. args: [],
  8425. source: "resetContents\x0a\x09self subclassResponsibility",
  8426. referencedClasses: [],
  8427. //>>excludeEnd("ide");
  8428. messageSends: ["subclassResponsibility"]
  8429. }),
  8430. $globals.ProtoStream);
  8431. $core.addMethod(
  8432. $core.method({
  8433. selector: "setToEnd",
  8434. protocol: 'positioning',
  8435. fn: function (){
  8436. var self=this;
  8437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8438. return $core.withContext(function($ctx1) {
  8439. //>>excludeEnd("ctx");
  8440. self._subclassResponsibility();
  8441. return self;
  8442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8443. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  8444. //>>excludeEnd("ctx");
  8445. },
  8446. //>>excludeStart("ide", pragmas.excludeIdeData);
  8447. args: [],
  8448. source: "setToEnd\x0a\x09self subclassResponsibility",
  8449. referencedClasses: [],
  8450. //>>excludeEnd("ide");
  8451. messageSends: ["subclassResponsibility"]
  8452. }),
  8453. $globals.ProtoStream);
  8454. $core.addMethod(
  8455. $core.method({
  8456. selector: "setToStart",
  8457. protocol: 'positioning',
  8458. fn: function (){
  8459. var self=this;
  8460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8461. return $core.withContext(function($ctx1) {
  8462. //>>excludeEnd("ctx");
  8463. self._reset();
  8464. return self;
  8465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8466. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  8467. //>>excludeEnd("ctx");
  8468. },
  8469. //>>excludeStart("ide", pragmas.excludeIdeData);
  8470. args: [],
  8471. source: "setToStart\x0a\x09self reset",
  8472. referencedClasses: [],
  8473. //>>excludeEnd("ide");
  8474. messageSends: ["reset"]
  8475. }),
  8476. $globals.ProtoStream);
  8477. $core.addMethod(
  8478. $core.method({
  8479. selector: "write:",
  8480. protocol: 'writing',
  8481. fn: function (anObject){
  8482. var self=this;
  8483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8484. return $core.withContext(function($ctx1) {
  8485. //>>excludeEnd("ctx");
  8486. $recv(anObject)._putOn_(self);
  8487. return self;
  8488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8489. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  8490. //>>excludeEnd("ctx");
  8491. },
  8492. //>>excludeStart("ide", pragmas.excludeIdeData);
  8493. args: ["anObject"],
  8494. source: "write: anObject\x0a\x09anObject putOn: self",
  8495. referencedClasses: [],
  8496. //>>excludeEnd("ide");
  8497. messageSends: ["putOn:"]
  8498. }),
  8499. $globals.ProtoStream);
  8500. $core.addMethod(
  8501. $core.method({
  8502. selector: "on:",
  8503. protocol: 'instance creation',
  8504. fn: function (aCollection){
  8505. var self=this;
  8506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8507. return $core.withContext(function($ctx1) {
  8508. //>>excludeEnd("ctx");
  8509. var $1;
  8510. $1=self._new();
  8511. $recv($1)._setCollection_(aCollection);
  8512. $recv($1)._setStreamSize_($recv(aCollection)._size());
  8513. return $recv($1)._yourself();
  8514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8515. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.klass)});
  8516. //>>excludeEnd("ctx");
  8517. },
  8518. //>>excludeStart("ide", pragmas.excludeIdeData);
  8519. args: ["aCollection"],
  8520. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  8521. referencedClasses: [],
  8522. //>>excludeEnd("ide");
  8523. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  8524. }),
  8525. $globals.ProtoStream.klass);
  8526. $core.addClass('Stream', $globals.ProtoStream, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  8527. //>>excludeStart("ide", pragmas.excludeIdeData);
  8528. $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.";
  8529. //>>excludeEnd("ide");
  8530. $core.addMethod(
  8531. $core.method({
  8532. selector: "atEnd",
  8533. protocol: 'testing',
  8534. fn: function (){
  8535. var self=this;
  8536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8537. return $core.withContext(function($ctx1) {
  8538. //>>excludeEnd("ctx");
  8539. return $recv(self._position()).__eq(self._size());
  8540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8541. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  8542. //>>excludeEnd("ctx");
  8543. },
  8544. //>>excludeStart("ide", pragmas.excludeIdeData);
  8545. args: [],
  8546. source: "atEnd\x0a\x09^ self position = self size",
  8547. referencedClasses: [],
  8548. //>>excludeEnd("ide");
  8549. messageSends: ["=", "position", "size"]
  8550. }),
  8551. $globals.Stream);
  8552. $core.addMethod(
  8553. $core.method({
  8554. selector: "atStart",
  8555. protocol: 'testing',
  8556. fn: function (){
  8557. var self=this;
  8558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8559. return $core.withContext(function($ctx1) {
  8560. //>>excludeEnd("ctx");
  8561. return $recv(self._position()).__eq((0));
  8562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8563. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  8564. //>>excludeEnd("ctx");
  8565. },
  8566. //>>excludeStart("ide", pragmas.excludeIdeData);
  8567. args: [],
  8568. source: "atStart\x0a\x09^ self position = 0",
  8569. referencedClasses: [],
  8570. //>>excludeEnd("ide");
  8571. messageSends: ["=", "position"]
  8572. }),
  8573. $globals.Stream);
  8574. $core.addMethod(
  8575. $core.method({
  8576. selector: "close",
  8577. protocol: 'actions',
  8578. fn: function (){
  8579. var self=this;
  8580. return self;
  8581. },
  8582. //>>excludeStart("ide", pragmas.excludeIdeData);
  8583. args: [],
  8584. source: "close",
  8585. referencedClasses: [],
  8586. //>>excludeEnd("ide");
  8587. messageSends: []
  8588. }),
  8589. $globals.Stream);
  8590. $core.addMethod(
  8591. $core.method({
  8592. selector: "collection",
  8593. protocol: 'accessing',
  8594. fn: function (){
  8595. var self=this;
  8596. return self["@collection"];
  8597. },
  8598. //>>excludeStart("ide", pragmas.excludeIdeData);
  8599. args: [],
  8600. source: "collection\x0a\x09^ collection",
  8601. referencedClasses: [],
  8602. //>>excludeEnd("ide");
  8603. messageSends: []
  8604. }),
  8605. $globals.Stream);
  8606. $core.addMethod(
  8607. $core.method({
  8608. selector: "contents",
  8609. protocol: 'accessing',
  8610. fn: function (){
  8611. var self=this;
  8612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8613. return $core.withContext(function($ctx1) {
  8614. //>>excludeEnd("ctx");
  8615. return $recv(self._collection())._copyFrom_to_((1),self._streamSize());
  8616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8617. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  8618. //>>excludeEnd("ctx");
  8619. },
  8620. //>>excludeStart("ide", pragmas.excludeIdeData);
  8621. args: [],
  8622. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8623. referencedClasses: [],
  8624. //>>excludeEnd("ide");
  8625. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8626. }),
  8627. $globals.Stream);
  8628. $core.addMethod(
  8629. $core.method({
  8630. selector: "flush",
  8631. protocol: 'actions',
  8632. fn: function (){
  8633. var self=this;
  8634. return self;
  8635. },
  8636. //>>excludeStart("ide", pragmas.excludeIdeData);
  8637. args: [],
  8638. source: "flush",
  8639. referencedClasses: [],
  8640. //>>excludeEnd("ide");
  8641. messageSends: []
  8642. }),
  8643. $globals.Stream);
  8644. $core.addMethod(
  8645. $core.method({
  8646. selector: "isEmpty",
  8647. protocol: 'testing',
  8648. fn: function (){
  8649. var self=this;
  8650. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8651. return $core.withContext(function($ctx1) {
  8652. //>>excludeEnd("ctx");
  8653. return $recv(self._size()).__eq((0));
  8654. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8655. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  8656. //>>excludeEnd("ctx");
  8657. },
  8658. //>>excludeStart("ide", pragmas.excludeIdeData);
  8659. args: [],
  8660. source: "isEmpty\x0a\x09^ self size = 0",
  8661. referencedClasses: [],
  8662. //>>excludeEnd("ide");
  8663. messageSends: ["=", "size"]
  8664. }),
  8665. $globals.Stream);
  8666. $core.addMethod(
  8667. $core.method({
  8668. selector: "next",
  8669. protocol: 'reading',
  8670. fn: function (){
  8671. var self=this;
  8672. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8673. return $core.withContext(function($ctx1) {
  8674. //>>excludeEnd("ctx");
  8675. var $1,$3,$2;
  8676. $1=self._atEnd();
  8677. if($core.assert($1)){
  8678. return nil;
  8679. } else {
  8680. $3=self._position();
  8681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8682. $ctx1.sendIdx["position"]=1;
  8683. //>>excludeEnd("ctx");
  8684. $2=$recv($3).__plus((1));
  8685. self._position_($2);
  8686. return $recv(self["@collection"])._at_(self._position());
  8687. };
  8688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8689. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  8690. //>>excludeEnd("ctx");
  8691. },
  8692. //>>excludeStart("ide", pragmas.excludeIdeData);
  8693. args: [],
  8694. 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 ]",
  8695. referencedClasses: [],
  8696. //>>excludeEnd("ide");
  8697. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8698. }),
  8699. $globals.Stream);
  8700. $core.addMethod(
  8701. $core.method({
  8702. selector: "next:",
  8703. protocol: 'reading',
  8704. fn: function (anInteger){
  8705. var self=this;
  8706. var tempCollection;
  8707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8708. return $core.withContext(function($ctx1) {
  8709. //>>excludeEnd("ctx");
  8710. var $1;
  8711. tempCollection=$recv($recv(self._collection())._class())._new();
  8712. $recv(anInteger)._timesRepeat_((function(){
  8713. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8714. return $core.withContext(function($ctx2) {
  8715. //>>excludeEnd("ctx");
  8716. $1=self._atEnd();
  8717. if(!$core.assert($1)){
  8718. return $recv(tempCollection)._add_(self._next());
  8719. };
  8720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8721. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8722. //>>excludeEnd("ctx");
  8723. }));
  8724. return tempCollection;
  8725. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8726. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  8727. //>>excludeEnd("ctx");
  8728. },
  8729. //>>excludeStart("ide", pragmas.excludeIdeData);
  8730. args: ["anInteger"],
  8731. 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",
  8732. referencedClasses: [],
  8733. //>>excludeEnd("ide");
  8734. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8735. }),
  8736. $globals.Stream);
  8737. $core.addMethod(
  8738. $core.method({
  8739. selector: "nextPut:",
  8740. protocol: 'writing',
  8741. fn: function (anObject){
  8742. var self=this;
  8743. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8744. return $core.withContext(function($ctx1) {
  8745. //>>excludeEnd("ctx");
  8746. var $2,$1,$3,$4;
  8747. $2=self._position();
  8748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8749. $ctx1.sendIdx["position"]=1;
  8750. //>>excludeEnd("ctx");
  8751. $1=$recv($2).__plus((1));
  8752. self._position_($1);
  8753. $3=self._collection();
  8754. $4=self._position();
  8755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8756. $ctx1.sendIdx["position"]=2;
  8757. //>>excludeEnd("ctx");
  8758. $recv($3)._at_put_($4,anObject);
  8759. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  8760. return self;
  8761. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8762. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  8763. //>>excludeEnd("ctx");
  8764. },
  8765. //>>excludeStart("ide", pragmas.excludeIdeData);
  8766. args: ["anObject"],
  8767. 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)",
  8768. referencedClasses: [],
  8769. //>>excludeEnd("ide");
  8770. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8771. }),
  8772. $globals.Stream);
  8773. $core.addMethod(
  8774. $core.method({
  8775. selector: "peek",
  8776. protocol: 'reading',
  8777. fn: function (){
  8778. var self=this;
  8779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8780. return $core.withContext(function($ctx1) {
  8781. //>>excludeEnd("ctx");
  8782. var $1;
  8783. $1=self._atEnd();
  8784. if(!$core.assert($1)){
  8785. return $recv(self._collection())._at_($recv(self._position()).__plus((1)));
  8786. };
  8787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8788. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  8789. //>>excludeEnd("ctx");
  8790. },
  8791. //>>excludeStart("ide", pragmas.excludeIdeData);
  8792. args: [],
  8793. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  8794. referencedClasses: [],
  8795. //>>excludeEnd("ide");
  8796. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  8797. }),
  8798. $globals.Stream);
  8799. $core.addMethod(
  8800. $core.method({
  8801. selector: "position",
  8802. protocol: 'accessing',
  8803. fn: function (){
  8804. var self=this;
  8805. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8806. return $core.withContext(function($ctx1) {
  8807. //>>excludeEnd("ctx");
  8808. var $1,$receiver;
  8809. $1=self["@position"];
  8810. if(($receiver = $1) == null || $receiver.isNil){
  8811. self["@position"]=(0);
  8812. return self["@position"];
  8813. } else {
  8814. return $1;
  8815. };
  8816. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8817. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  8818. //>>excludeEnd("ctx");
  8819. },
  8820. //>>excludeStart("ide", pragmas.excludeIdeData);
  8821. args: [],
  8822. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  8823. referencedClasses: [],
  8824. //>>excludeEnd("ide");
  8825. messageSends: ["ifNil:"]
  8826. }),
  8827. $globals.Stream);
  8828. $core.addMethod(
  8829. $core.method({
  8830. selector: "position:",
  8831. protocol: 'accessing',
  8832. fn: function (anInteger){
  8833. var self=this;
  8834. self["@position"]=anInteger;
  8835. return self;
  8836. },
  8837. //>>excludeStart("ide", pragmas.excludeIdeData);
  8838. args: ["anInteger"],
  8839. source: "position: anInteger\x0a\x09position := anInteger",
  8840. referencedClasses: [],
  8841. //>>excludeEnd("ide");
  8842. messageSends: []
  8843. }),
  8844. $globals.Stream);
  8845. $core.addMethod(
  8846. $core.method({
  8847. selector: "reset",
  8848. protocol: 'actions',
  8849. fn: function (){
  8850. var self=this;
  8851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8852. return $core.withContext(function($ctx1) {
  8853. //>>excludeEnd("ctx");
  8854. self._position_((0));
  8855. return self;
  8856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8857. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  8858. //>>excludeEnd("ctx");
  8859. },
  8860. //>>excludeStart("ide", pragmas.excludeIdeData);
  8861. args: [],
  8862. source: "reset\x0a\x09self position: 0",
  8863. referencedClasses: [],
  8864. //>>excludeEnd("ide");
  8865. messageSends: ["position:"]
  8866. }),
  8867. $globals.Stream);
  8868. $core.addMethod(
  8869. $core.method({
  8870. selector: "resetContents",
  8871. protocol: 'actions',
  8872. fn: function (){
  8873. var self=this;
  8874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8875. return $core.withContext(function($ctx1) {
  8876. //>>excludeEnd("ctx");
  8877. self._reset();
  8878. self._setStreamSize_((0));
  8879. return self;
  8880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8881. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  8882. //>>excludeEnd("ctx");
  8883. },
  8884. //>>excludeStart("ide", pragmas.excludeIdeData);
  8885. args: [],
  8886. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  8887. referencedClasses: [],
  8888. //>>excludeEnd("ide");
  8889. messageSends: ["reset", "setStreamSize:"]
  8890. }),
  8891. $globals.Stream);
  8892. $core.addMethod(
  8893. $core.method({
  8894. selector: "setCollection:",
  8895. protocol: 'accessing',
  8896. fn: function (aCollection){
  8897. var self=this;
  8898. self["@collection"]=aCollection;
  8899. return self;
  8900. },
  8901. //>>excludeStart("ide", pragmas.excludeIdeData);
  8902. args: ["aCollection"],
  8903. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  8904. referencedClasses: [],
  8905. //>>excludeEnd("ide");
  8906. messageSends: []
  8907. }),
  8908. $globals.Stream);
  8909. $core.addMethod(
  8910. $core.method({
  8911. selector: "setStreamSize:",
  8912. protocol: 'accessing',
  8913. fn: function (anInteger){
  8914. var self=this;
  8915. self["@streamSize"]=anInteger;
  8916. return self;
  8917. },
  8918. //>>excludeStart("ide", pragmas.excludeIdeData);
  8919. args: ["anInteger"],
  8920. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  8921. referencedClasses: [],
  8922. //>>excludeEnd("ide");
  8923. messageSends: []
  8924. }),
  8925. $globals.Stream);
  8926. $core.addMethod(
  8927. $core.method({
  8928. selector: "setToEnd",
  8929. protocol: 'positioning',
  8930. fn: function (){
  8931. var self=this;
  8932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8933. return $core.withContext(function($ctx1) {
  8934. //>>excludeEnd("ctx");
  8935. self._position_(self._size());
  8936. return self;
  8937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8938. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  8939. //>>excludeEnd("ctx");
  8940. },
  8941. //>>excludeStart("ide", pragmas.excludeIdeData);
  8942. args: [],
  8943. source: "setToEnd\x0a\x09self position: self size",
  8944. referencedClasses: [],
  8945. //>>excludeEnd("ide");
  8946. messageSends: ["position:", "size"]
  8947. }),
  8948. $globals.Stream);
  8949. $core.addMethod(
  8950. $core.method({
  8951. selector: "size",
  8952. protocol: 'accessing',
  8953. fn: function (){
  8954. var self=this;
  8955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8956. return $core.withContext(function($ctx1) {
  8957. //>>excludeEnd("ctx");
  8958. return self._streamSize();
  8959. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8960. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  8961. //>>excludeEnd("ctx");
  8962. },
  8963. //>>excludeStart("ide", pragmas.excludeIdeData);
  8964. args: [],
  8965. source: "size\x0a\x09^ self streamSize",
  8966. referencedClasses: [],
  8967. //>>excludeEnd("ide");
  8968. messageSends: ["streamSize"]
  8969. }),
  8970. $globals.Stream);
  8971. $core.addMethod(
  8972. $core.method({
  8973. selector: "skip:",
  8974. protocol: 'positioning',
  8975. fn: function (anInteger){
  8976. var self=this;
  8977. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8978. return $core.withContext(function($ctx1) {
  8979. //>>excludeEnd("ctx");
  8980. self._position_($recv($recv(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  8981. return self;
  8982. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8983. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  8984. //>>excludeEnd("ctx");
  8985. },
  8986. //>>excludeStart("ide", pragmas.excludeIdeData);
  8987. args: ["anInteger"],
  8988. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  8989. referencedClasses: [],
  8990. //>>excludeEnd("ide");
  8991. messageSends: ["position:", "min:max:", "+", "position", "size"]
  8992. }),
  8993. $globals.Stream);
  8994. $core.addMethod(
  8995. $core.method({
  8996. selector: "streamSize",
  8997. protocol: 'accessing',
  8998. fn: function (){
  8999. var self=this;
  9000. return self["@streamSize"];
  9001. },
  9002. //>>excludeStart("ide", pragmas.excludeIdeData);
  9003. args: [],
  9004. source: "streamSize\x0a\x09^ streamSize",
  9005. referencedClasses: [],
  9006. //>>excludeEnd("ide");
  9007. messageSends: []
  9008. }),
  9009. $globals.Stream);
  9010. $core.addMethod(
  9011. $core.method({
  9012. selector: "on:",
  9013. protocol: 'instance creation',
  9014. fn: function (aCollection){
  9015. var self=this;
  9016. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9017. return $core.withContext(function($ctx1) {
  9018. //>>excludeEnd("ctx");
  9019. var $1;
  9020. $1=self._new();
  9021. $recv($1)._setCollection_(aCollection);
  9022. $recv($1)._setStreamSize_($recv(aCollection)._size());
  9023. return $recv($1)._yourself();
  9024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9025. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.klass)});
  9026. //>>excludeEnd("ctx");
  9027. },
  9028. //>>excludeStart("ide", pragmas.excludeIdeData);
  9029. args: ["aCollection"],
  9030. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9031. referencedClasses: [],
  9032. //>>excludeEnd("ide");
  9033. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9034. }),
  9035. $globals.Stream.klass);
  9036. $core.addClass('StringStream', $globals.Stream, [], 'Kernel-Collections');
  9037. //>>excludeStart("ide", pragmas.excludeIdeData);
  9038. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9039. //>>excludeEnd("ide");
  9040. $core.addMethod(
  9041. $core.method({
  9042. selector: "cr",
  9043. protocol: 'writing',
  9044. fn: function (){
  9045. var self=this;
  9046. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9047. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9048. return $core.withContext(function($ctx1) {
  9049. //>>excludeEnd("ctx");
  9050. return self._nextPutAll_($recv($String())._cr());
  9051. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9052. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  9053. //>>excludeEnd("ctx");
  9054. },
  9055. //>>excludeStart("ide", pragmas.excludeIdeData);
  9056. args: [],
  9057. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9058. referencedClasses: ["String"],
  9059. //>>excludeEnd("ide");
  9060. messageSends: ["nextPutAll:", "cr"]
  9061. }),
  9062. $globals.StringStream);
  9063. $core.addMethod(
  9064. $core.method({
  9065. selector: "crlf",
  9066. protocol: 'writing',
  9067. fn: function (){
  9068. var self=this;
  9069. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9070. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9071. return $core.withContext(function($ctx1) {
  9072. //>>excludeEnd("ctx");
  9073. return self._nextPutAll_($recv($String())._crlf());
  9074. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9075. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  9076. //>>excludeEnd("ctx");
  9077. },
  9078. //>>excludeStart("ide", pragmas.excludeIdeData);
  9079. args: [],
  9080. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9081. referencedClasses: ["String"],
  9082. //>>excludeEnd("ide");
  9083. messageSends: ["nextPutAll:", "crlf"]
  9084. }),
  9085. $globals.StringStream);
  9086. $core.addMethod(
  9087. $core.method({
  9088. selector: "lf",
  9089. protocol: 'writing',
  9090. fn: function (){
  9091. var self=this;
  9092. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9093. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9094. return $core.withContext(function($ctx1) {
  9095. //>>excludeEnd("ctx");
  9096. return self._nextPutAll_($recv($String())._lf());
  9097. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9098. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  9099. //>>excludeEnd("ctx");
  9100. },
  9101. //>>excludeStart("ide", pragmas.excludeIdeData);
  9102. args: [],
  9103. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9104. referencedClasses: ["String"],
  9105. //>>excludeEnd("ide");
  9106. messageSends: ["nextPutAll:", "lf"]
  9107. }),
  9108. $globals.StringStream);
  9109. $core.addMethod(
  9110. $core.method({
  9111. selector: "next:",
  9112. protocol: 'reading',
  9113. fn: function (anInteger){
  9114. var self=this;
  9115. var tempCollection;
  9116. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9117. return $core.withContext(function($ctx1) {
  9118. //>>excludeEnd("ctx");
  9119. var $1;
  9120. tempCollection=$recv($recv(self._collection())._class())._new();
  9121. $recv(anInteger)._timesRepeat_((function(){
  9122. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9123. return $core.withContext(function($ctx2) {
  9124. //>>excludeEnd("ctx");
  9125. $1=self._atEnd();
  9126. if(!$core.assert($1)){
  9127. tempCollection=$recv(tempCollection).__comma(self._next());
  9128. return tempCollection;
  9129. };
  9130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9132. //>>excludeEnd("ctx");
  9133. }));
  9134. return tempCollection;
  9135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9136. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  9137. //>>excludeEnd("ctx");
  9138. },
  9139. //>>excludeStart("ide", pragmas.excludeIdeData);
  9140. args: ["anInteger"],
  9141. 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",
  9142. referencedClasses: [],
  9143. //>>excludeEnd("ide");
  9144. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9145. }),
  9146. $globals.StringStream);
  9147. $core.addMethod(
  9148. $core.method({
  9149. selector: "nextPut:",
  9150. protocol: 'writing',
  9151. fn: function (aString){
  9152. var self=this;
  9153. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9154. return $core.withContext(function($ctx1) {
  9155. //>>excludeEnd("ctx");
  9156. self._nextPutAll_(aString);
  9157. return self;
  9158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9159. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  9160. //>>excludeEnd("ctx");
  9161. },
  9162. //>>excludeStart("ide", pragmas.excludeIdeData);
  9163. args: ["aString"],
  9164. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9165. referencedClasses: [],
  9166. //>>excludeEnd("ide");
  9167. messageSends: ["nextPutAll:"]
  9168. }),
  9169. $globals.StringStream);
  9170. $core.addMethod(
  9171. $core.method({
  9172. selector: "nextPutAll:",
  9173. protocol: 'writing',
  9174. fn: function (aString){
  9175. var self=this;
  9176. var pre,post;
  9177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9178. return $core.withContext(function($ctx1) {
  9179. //>>excludeEnd("ctx");
  9180. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9181. $1=self._atEnd();
  9182. if($core.assert($1)){
  9183. $3=self._collection();
  9184. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9185. $ctx1.sendIdx["collection"]=1;
  9186. //>>excludeEnd("ctx");
  9187. $2=$recv($3).__comma(aString);
  9188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9189. $ctx1.sendIdx[","]=1;
  9190. //>>excludeEnd("ctx");
  9191. self._setCollection_($2);
  9192. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9193. $ctx1.sendIdx["setCollection:"]=1;
  9194. //>>excludeEnd("ctx");
  9195. } else {
  9196. $4=self._collection();
  9197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9198. $ctx1.sendIdx["collection"]=2;
  9199. //>>excludeEnd("ctx");
  9200. $5=self._position();
  9201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9202. $ctx1.sendIdx["position"]=1;
  9203. //>>excludeEnd("ctx");
  9204. pre=$recv($4)._copyFrom_to_((1),$5);
  9205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9206. $ctx1.sendIdx["copyFrom:to:"]=1;
  9207. //>>excludeEnd("ctx");
  9208. pre;
  9209. $6=self._collection();
  9210. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9211. $ctx1.sendIdx["collection"]=3;
  9212. //>>excludeEnd("ctx");
  9213. $9=self._position();
  9214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9215. $ctx1.sendIdx["position"]=2;
  9216. //>>excludeEnd("ctx");
  9217. $8=$recv($9).__plus((1));
  9218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9219. $ctx1.sendIdx["+"]=2;
  9220. //>>excludeEnd("ctx");
  9221. $10=$recv(aString)._size();
  9222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9223. $ctx1.sendIdx["size"]=1;
  9224. //>>excludeEnd("ctx");
  9225. $7=$recv($8).__plus($10);
  9226. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9227. $ctx1.sendIdx["+"]=1;
  9228. //>>excludeEnd("ctx");
  9229. $11=$recv(self._collection())._size();
  9230. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9231. $ctx1.sendIdx["size"]=2;
  9232. //>>excludeEnd("ctx");
  9233. post=$recv($6)._copyFrom_to_($7,$11);
  9234. post;
  9235. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  9236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9237. $ctx1.sendIdx[","]=2;
  9238. //>>excludeEnd("ctx");
  9239. self._setCollection_($12);
  9240. };
  9241. $14=self._position();
  9242. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9243. $ctx1.sendIdx["position"]=3;
  9244. //>>excludeEnd("ctx");
  9245. $13=$recv($14).__plus($recv(aString)._size());
  9246. self._position_($13);
  9247. self._setStreamSize_($recv(self._streamSize())._max_(self._position()));
  9248. return self;
  9249. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9250. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  9251. //>>excludeEnd("ctx");
  9252. },
  9253. //>>excludeStart("ide", pragmas.excludeIdeData);
  9254. args: ["aString"],
  9255. 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)",
  9256. referencedClasses: [],
  9257. //>>excludeEnd("ide");
  9258. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9259. }),
  9260. $globals.StringStream);
  9261. $core.addMethod(
  9262. $core.method({
  9263. selector: "nextPutString:",
  9264. protocol: 'writing',
  9265. fn: function (aString){
  9266. var self=this;
  9267. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9268. return $core.withContext(function($ctx1) {
  9269. //>>excludeEnd("ctx");
  9270. self._nextPutAll_(aString);
  9271. return self;
  9272. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9273. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  9274. //>>excludeEnd("ctx");
  9275. },
  9276. //>>excludeStart("ide", pragmas.excludeIdeData);
  9277. args: ["aString"],
  9278. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9279. referencedClasses: [],
  9280. //>>excludeEnd("ide");
  9281. messageSends: ["nextPutAll:"]
  9282. }),
  9283. $globals.StringStream);
  9284. $core.addMethod(
  9285. $core.method({
  9286. selector: "space",
  9287. protocol: 'writing',
  9288. fn: function (){
  9289. var self=this;
  9290. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9291. return $core.withContext(function($ctx1) {
  9292. //>>excludeEnd("ctx");
  9293. self._nextPut_(" ");
  9294. return self;
  9295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9296. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  9297. //>>excludeEnd("ctx");
  9298. },
  9299. //>>excludeStart("ide", pragmas.excludeIdeData);
  9300. args: [],
  9301. source: "space\x0a\x09self nextPut: ' '",
  9302. referencedClasses: [],
  9303. //>>excludeEnd("ide");
  9304. messageSends: ["nextPut:"]
  9305. }),
  9306. $globals.StringStream);
  9307. $core.addMethod(
  9308. $core.method({
  9309. selector: "tab",
  9310. protocol: 'writing',
  9311. fn: function (){
  9312. var self=this;
  9313. function $String(){return $globals.String||(typeof String=="undefined"?nil:String)}
  9314. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9315. return $core.withContext(function($ctx1) {
  9316. //>>excludeEnd("ctx");
  9317. return self._nextPutAll_($recv($String())._tab());
  9318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9319. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  9320. //>>excludeEnd("ctx");
  9321. },
  9322. //>>excludeStart("ide", pragmas.excludeIdeData);
  9323. args: [],
  9324. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9325. referencedClasses: ["String"],
  9326. //>>excludeEnd("ide");
  9327. messageSends: ["nextPutAll:", "tab"]
  9328. }),
  9329. $globals.StringStream);
  9330. $core.addClass('Queue', $globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  9331. //>>excludeStart("ide", pragmas.excludeIdeData);
  9332. $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.";
  9333. //>>excludeEnd("ide");
  9334. $core.addMethod(
  9335. $core.method({
  9336. selector: "initialize",
  9337. protocol: 'initialization',
  9338. fn: function (){
  9339. var self=this;
  9340. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  9341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9342. return $core.withContext(function($ctx1) {
  9343. //>>excludeEnd("ctx");
  9344. (
  9345. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9346. $ctx1.supercall = true,
  9347. //>>excludeEnd("ctx");
  9348. $globals.Queue.superclass.fn.prototype._initialize.apply($recv(self), []));
  9349. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9350. $ctx1.supercall = false;
  9351. //>>excludeEnd("ctx");;
  9352. self["@read"]=$recv($OrderedCollection())._new();
  9353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9354. $ctx1.sendIdx["new"]=1;
  9355. //>>excludeEnd("ctx");
  9356. self["@write"]=$recv($OrderedCollection())._new();
  9357. self["@readIndex"]=(1);
  9358. return self;
  9359. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9360. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  9361. //>>excludeEnd("ctx");
  9362. },
  9363. //>>excludeStart("ide", pragmas.excludeIdeData);
  9364. args: [],
  9365. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  9366. referencedClasses: ["OrderedCollection"],
  9367. //>>excludeEnd("ide");
  9368. messageSends: ["initialize", "new"]
  9369. }),
  9370. $globals.Queue);
  9371. $core.addMethod(
  9372. $core.method({
  9373. selector: "next",
  9374. protocol: 'accessing',
  9375. fn: function (){
  9376. var self=this;
  9377. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9378. return $core.withContext(function($ctx1) {
  9379. //>>excludeEnd("ctx");
  9380. return self._nextIfAbsent_((function(){
  9381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9382. return $core.withContext(function($ctx2) {
  9383. //>>excludeEnd("ctx");
  9384. return self._error_("Cannot read from empty Queue.");
  9385. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9387. //>>excludeEnd("ctx");
  9388. }));
  9389. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9390. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  9391. //>>excludeEnd("ctx");
  9392. },
  9393. //>>excludeStart("ide", pragmas.excludeIdeData);
  9394. args: [],
  9395. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  9396. referencedClasses: [],
  9397. //>>excludeEnd("ide");
  9398. messageSends: ["nextIfAbsent:", "error:"]
  9399. }),
  9400. $globals.Queue);
  9401. $core.addMethod(
  9402. $core.method({
  9403. selector: "nextIfAbsent:",
  9404. protocol: 'accessing',
  9405. fn: function (aBlock){
  9406. var self=this;
  9407. var result;
  9408. function $OrderedCollection(){return $globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  9409. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9410. return $core.withContext(function($ctx1) {
  9411. //>>excludeEnd("ctx");
  9412. var $1,$2;
  9413. var $early={};
  9414. try {
  9415. result=$recv(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  9416. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9417. return $core.withContext(function($ctx2) {
  9418. //>>excludeEnd("ctx");
  9419. $1=$recv(self["@write"])._isEmpty();
  9420. if($core.assert($1)){
  9421. $2=$recv(self["@readIndex"]).__gt((1));
  9422. if($core.assert($2)){
  9423. self["@read"]=[];
  9424. self["@read"];
  9425. self["@readIndex"]=(1);
  9426. self["@readIndex"];
  9427. };
  9428. throw $early=[$recv(aBlock)._value()];
  9429. };
  9430. self["@read"]=self["@write"];
  9431. self["@read"];
  9432. self["@readIndex"]=(1);
  9433. self["@readIndex"];
  9434. self["@write"]=$recv($OrderedCollection())._new();
  9435. self["@write"];
  9436. return $recv(self["@read"])._first();
  9437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9439. //>>excludeEnd("ctx");
  9440. }));
  9441. $recv(self["@read"])._at_put_(self["@readIndex"],nil);
  9442. self["@readIndex"]=$recv(self["@readIndex"]).__plus((1));
  9443. return result;
  9444. }
  9445. catch(e) {if(e===$early)return e[0]; throw e}
  9446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9447. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  9448. //>>excludeEnd("ctx");
  9449. },
  9450. //>>excludeStart("ide", pragmas.excludeIdeData);
  9451. args: ["aBlock"],
  9452. 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",
  9453. referencedClasses: ["OrderedCollection"],
  9454. //>>excludeEnd("ide");
  9455. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  9456. }),
  9457. $globals.Queue);
  9458. $core.addMethod(
  9459. $core.method({
  9460. selector: "nextPut:",
  9461. protocol: 'accessing',
  9462. fn: function (anObject){
  9463. var self=this;
  9464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9465. return $core.withContext(function($ctx1) {
  9466. //>>excludeEnd("ctx");
  9467. $recv(self["@write"])._add_(anObject);
  9468. return self;
  9469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9470. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  9471. //>>excludeEnd("ctx");
  9472. },
  9473. //>>excludeStart("ide", pragmas.excludeIdeData);
  9474. args: ["anObject"],
  9475. source: "nextPut: anObject\x0a\x09write add: anObject",
  9476. referencedClasses: [],
  9477. //>>excludeEnd("ide");
  9478. messageSends: ["add:"]
  9479. }),
  9480. $globals.Queue);
  9481. $core.addClass('RegularExpression', $globals.Object, [], 'Kernel-Collections');
  9482. //>>excludeStart("ide", pragmas.excludeIdeData);
  9483. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  9484. //>>excludeEnd("ide");
  9485. $core.addMethod(
  9486. $core.method({
  9487. selector: "compile:",
  9488. protocol: 'evaluating',
  9489. fn: function (aString){
  9490. var self=this;
  9491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9492. return $core.withContext(function($ctx1) {
  9493. //>>excludeEnd("ctx");
  9494. return self.compile(aString);
  9495. return self;
  9496. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9497. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  9498. //>>excludeEnd("ctx");
  9499. },
  9500. //>>excludeStart("ide", pragmas.excludeIdeData);
  9501. args: ["aString"],
  9502. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  9503. referencedClasses: [],
  9504. //>>excludeEnd("ide");
  9505. messageSends: []
  9506. }),
  9507. $globals.RegularExpression);
  9508. $core.addMethod(
  9509. $core.method({
  9510. selector: "exec:",
  9511. protocol: 'evaluating',
  9512. fn: function (aString){
  9513. var self=this;
  9514. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9515. return $core.withContext(function($ctx1) {
  9516. //>>excludeEnd("ctx");
  9517. return self.exec(aString) || nil;
  9518. return self;
  9519. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9520. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  9521. //>>excludeEnd("ctx");
  9522. },
  9523. //>>excludeStart("ide", pragmas.excludeIdeData);
  9524. args: ["aString"],
  9525. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  9526. referencedClasses: [],
  9527. //>>excludeEnd("ide");
  9528. messageSends: []
  9529. }),
  9530. $globals.RegularExpression);
  9531. $core.addMethod(
  9532. $core.method({
  9533. selector: "test:",
  9534. protocol: 'evaluating',
  9535. fn: function (aString){
  9536. var self=this;
  9537. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9538. return $core.withContext(function($ctx1) {
  9539. //>>excludeEnd("ctx");
  9540. return self.test(aString);
  9541. return self;
  9542. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9543. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  9544. //>>excludeEnd("ctx");
  9545. },
  9546. //>>excludeStart("ide", pragmas.excludeIdeData);
  9547. args: ["aString"],
  9548. source: "test: aString\x0a\x09<return self.test(aString)>",
  9549. referencedClasses: [],
  9550. //>>excludeEnd("ide");
  9551. messageSends: []
  9552. }),
  9553. $globals.RegularExpression);
  9554. $core.addMethod(
  9555. $core.method({
  9556. selector: "fromString:",
  9557. protocol: 'instance creation',
  9558. fn: function (aString){
  9559. var self=this;
  9560. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9561. return $core.withContext(function($ctx1) {
  9562. //>>excludeEnd("ctx");
  9563. return self._fromString_flag_(aString,"");
  9564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9565. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.klass)});
  9566. //>>excludeEnd("ctx");
  9567. },
  9568. //>>excludeStart("ide", pragmas.excludeIdeData);
  9569. args: ["aString"],
  9570. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  9571. referencedClasses: [],
  9572. //>>excludeEnd("ide");
  9573. messageSends: ["fromString:flag:"]
  9574. }),
  9575. $globals.RegularExpression.klass);
  9576. $core.addMethod(
  9577. $core.method({
  9578. selector: "fromString:flag:",
  9579. protocol: 'instance creation',
  9580. fn: function (aString,anotherString){
  9581. var self=this;
  9582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9583. return $core.withContext(function($ctx1) {
  9584. //>>excludeEnd("ctx");
  9585. return new RegExp(aString, anotherString);
  9586. return self;
  9587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9588. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.klass)});
  9589. //>>excludeEnd("ctx");
  9590. },
  9591. //>>excludeStart("ide", pragmas.excludeIdeData);
  9592. args: ["aString", "anotherString"],
  9593. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  9594. referencedClasses: [],
  9595. //>>excludeEnd("ide");
  9596. messageSends: []
  9597. }),
  9598. $globals.RegularExpression.klass);
  9599. });