Kernel-Collections.js 319 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039
  1. define("amber_core/Kernel-Collections", ["amber/boot", "amber_core/Kernel-Objects"], function($boot){
  2. var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
  3. smalltalk.addPackage('Kernel-Collections');
  4. smalltalk.packages["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  5. smalltalk.addClass('Association', globals.Object, ['key', 'value'], 'Kernel-Collections');
  6. //>>excludeStart("ide", pragmas.excludeIdeData);
  7. 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:`";
  8. //>>excludeEnd("ide");
  9. smalltalk.addMethod(
  10. smalltalk.method({
  11. selector: "=",
  12. protocol: 'comparing',
  13. fn: function (anAssociation){
  14. var self=this;
  15. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  16. return smalltalk.withContext(function($ctx1) {
  17. //>>excludeEnd("ctx");
  18. var $3,$2,$5,$4,$6,$1;
  19. $3=self._class();
  20. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  21. $ctx1.sendIdx["class"]=1;
  22. //>>excludeEnd("ctx");
  23. $2=_st($3).__eq(_st(anAssociation)._class());
  24. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  25. $ctx1.sendIdx["="]=1;
  26. //>>excludeEnd("ctx");
  27. $1=_st($2)._and_((function(){
  28. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  29. return smalltalk.withContext(function($ctx2) {
  30. //>>excludeEnd("ctx");
  31. $5=self._key();
  32. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  33. $ctx2.sendIdx["key"]=1;
  34. //>>excludeEnd("ctx");
  35. $4=_st($5).__eq(_st(anAssociation)._key());
  36. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  37. $ctx2.sendIdx["="]=2;
  38. //>>excludeEnd("ctx");
  39. return _st($4)._and_((function(){
  40. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  41. return smalltalk.withContext(function($ctx3) {
  42. //>>excludeEnd("ctx");
  43. $6=self._value();
  44. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  45. $ctx3.sendIdx["value"]=1;
  46. //>>excludeEnd("ctx");
  47. return _st($6).__eq(_st(anAssociation)._value());
  48. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  49. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50. //>>excludeEnd("ctx");
  51. }));
  52. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  53. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54. //>>excludeEnd("ctx");
  55. }));
  56. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  57. $ctx1.sendIdx["and:"]=1;
  58. //>>excludeEnd("ctx");
  59. return $1;
  60. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  61. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},globals.Association)});
  62. //>>excludeEnd("ctx");
  63. },
  64. //>>excludeStart("ide", pragmas.excludeIdeData);
  65. args: ["anAssociation"],
  66. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  67. referencedClasses: [],
  68. //>>excludeEnd("ide");
  69. messageSends: ["and:", "=", "class", "key", "value"]
  70. }),
  71. globals.Association);
  72. smalltalk.addMethod(
  73. smalltalk.method({
  74. selector: "key",
  75. protocol: 'accessing',
  76. fn: function (){
  77. var self=this;
  78. var $1;
  79. $1=self["@key"];
  80. return $1;
  81. },
  82. //>>excludeStart("ide", pragmas.excludeIdeData);
  83. args: [],
  84. source: "key\x0a\x09^ key",
  85. referencedClasses: [],
  86. //>>excludeEnd("ide");
  87. messageSends: []
  88. }),
  89. globals.Association);
  90. smalltalk.addMethod(
  91. smalltalk.method({
  92. selector: "key:",
  93. protocol: 'accessing',
  94. fn: function (aKey){
  95. var self=this;
  96. self["@key"]=aKey;
  97. return self;
  98. },
  99. //>>excludeStart("ide", pragmas.excludeIdeData);
  100. args: ["aKey"],
  101. source: "key: aKey\x0a\x09key := aKey",
  102. referencedClasses: [],
  103. //>>excludeEnd("ide");
  104. messageSends: []
  105. }),
  106. globals.Association);
  107. smalltalk.addMethod(
  108. smalltalk.method({
  109. selector: "printOn:",
  110. protocol: 'printing',
  111. fn: function (aStream){
  112. var self=this;
  113. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  114. return smalltalk.withContext(function($ctx1) {
  115. //>>excludeEnd("ctx");
  116. _st(self._key())._printOn_(aStream);
  117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  118. $ctx1.sendIdx["printOn:"]=1;
  119. //>>excludeEnd("ctx");
  120. _st(aStream)._nextPutAll_(" -> ");
  121. _st(self._value())._printOn_(aStream);
  122. return self;
  123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  124. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Association)});
  125. //>>excludeEnd("ctx");
  126. },
  127. //>>excludeStart("ide", pragmas.excludeIdeData);
  128. args: ["aStream"],
  129. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  130. referencedClasses: [],
  131. //>>excludeEnd("ide");
  132. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  133. }),
  134. globals.Association);
  135. smalltalk.addMethod(
  136. smalltalk.method({
  137. selector: "value",
  138. protocol: 'accessing',
  139. fn: function (){
  140. var self=this;
  141. var $1;
  142. $1=self["@value"];
  143. return $1;
  144. },
  145. //>>excludeStart("ide", pragmas.excludeIdeData);
  146. args: [],
  147. source: "value\x0a\x09^ value",
  148. referencedClasses: [],
  149. //>>excludeEnd("ide");
  150. messageSends: []
  151. }),
  152. globals.Association);
  153. smalltalk.addMethod(
  154. smalltalk.method({
  155. selector: "value:",
  156. protocol: 'accessing',
  157. fn: function (aValue){
  158. var self=this;
  159. self["@value"]=aValue;
  160. return self;
  161. },
  162. //>>excludeStart("ide", pragmas.excludeIdeData);
  163. args: ["aValue"],
  164. source: "value: aValue\x0a\x09value := aValue",
  165. referencedClasses: [],
  166. //>>excludeEnd("ide");
  167. messageSends: []
  168. }),
  169. globals.Association);
  170. smalltalk.addMethod(
  171. smalltalk.method({
  172. selector: "key:value:",
  173. protocol: 'instance creation',
  174. fn: function (aKey,aValue){
  175. var self=this;
  176. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  177. return smalltalk.withContext(function($ctx1) {
  178. //>>excludeEnd("ctx");
  179. var $2,$3,$1;
  180. $2=self._new();
  181. _st($2)._key_(aKey);
  182. _st($2)._value_(aValue);
  183. $3=_st($2)._yourself();
  184. $1=$3;
  185. return $1;
  186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  187. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},globals.Association.klass)});
  188. //>>excludeEnd("ctx");
  189. },
  190. //>>excludeStart("ide", pragmas.excludeIdeData);
  191. args: ["aKey", "aValue"],
  192. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  193. referencedClasses: [],
  194. //>>excludeEnd("ide");
  195. messageSends: ["key:", "new", "value:", "yourself"]
  196. }),
  197. globals.Association.klass);
  198. smalltalk.addClass('BucketStore', globals.Object, ['buckets', 'hashBlock'], 'Kernel-Collections');
  199. //>>excludeStart("ide", pragmas.excludeIdeData);
  200. 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`.";
  201. //>>excludeEnd("ide");
  202. smalltalk.addMethod(
  203. smalltalk.method({
  204. selector: "bucketOfElement:",
  205. protocol: 'accessing',
  206. fn: function (anObject){
  207. var self=this;
  208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  209. return smalltalk.withContext(function($ctx1) {
  210. //>>excludeEnd("ctx");
  211. var hash = self['@hashBlock'](anObject);
  212. if (!hash) return null;
  213. var buckets = self['@buckets'],
  214. bucket = buckets[hash];
  215. if (!bucket) { bucket = buckets[hash] = self._newBucket(); }
  216. return bucket;
  217. ;
  218. return self;
  219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  220. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},globals.BucketStore)});
  221. //>>excludeEnd("ctx");
  222. },
  223. //>>excludeStart("ide", pragmas.excludeIdeData);
  224. args: ["anObject"],
  225. 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>",
  226. referencedClasses: [],
  227. //>>excludeEnd("ide");
  228. messageSends: []
  229. }),
  230. globals.BucketStore);
  231. smalltalk.addMethod(
  232. smalltalk.method({
  233. selector: "do:",
  234. protocol: 'enumerating',
  235. fn: function (aBlock){
  236. var self=this;
  237. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  238. return smalltalk.withContext(function($ctx1) {
  239. //>>excludeEnd("ctx");
  240. var buckets = self['@buckets'];
  241. var keys = Object.keys(buckets);
  242. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  243. ;
  244. return self;
  245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  246. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.BucketStore)});
  247. //>>excludeEnd("ctx");
  248. },
  249. //>>excludeStart("ide", pragmas.excludeIdeData);
  250. args: ["aBlock"],
  251. 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>",
  252. referencedClasses: [],
  253. //>>excludeEnd("ide");
  254. messageSends: []
  255. }),
  256. globals.BucketStore);
  257. smalltalk.addMethod(
  258. smalltalk.method({
  259. selector: "hashBlock:",
  260. protocol: 'accessing',
  261. fn: function (aBlock){
  262. var self=this;
  263. self["@hashBlock"]=aBlock;
  264. return self;
  265. },
  266. //>>excludeStart("ide", pragmas.excludeIdeData);
  267. args: ["aBlock"],
  268. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  269. referencedClasses: [],
  270. //>>excludeEnd("ide");
  271. messageSends: []
  272. }),
  273. globals.BucketStore);
  274. smalltalk.addMethod(
  275. smalltalk.method({
  276. selector: "initialize",
  277. protocol: 'initialization',
  278. fn: function (){
  279. var self=this;
  280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  281. return smalltalk.withContext(function($ctx1) {
  282. //>>excludeEnd("ctx");
  283. (
  284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  285. $ctx1.supercall = true,
  286. //>>excludeEnd("ctx");
  287. globals.BucketStore.superclass.fn.prototype._initialize.apply(_st(self), []));
  288. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  289. $ctx1.supercall = false;
  290. //>>excludeEnd("ctx");;
  291. self._removeAll();
  292. return self;
  293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  294. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.BucketStore)});
  295. //>>excludeEnd("ctx");
  296. },
  297. //>>excludeStart("ide", pragmas.excludeIdeData);
  298. args: [],
  299. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  300. referencedClasses: [],
  301. //>>excludeEnd("ide");
  302. messageSends: ["initialize", "removeAll"]
  303. }),
  304. globals.BucketStore);
  305. smalltalk.addMethod(
  306. smalltalk.method({
  307. selector: "newBucket",
  308. protocol: 'private',
  309. fn: function (){
  310. var self=this;
  311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  312. return smalltalk.withContext(function($ctx1) {
  313. //>>excludeEnd("ctx");
  314. self._subclassResponsibility();
  315. return self;
  316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  317. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},globals.BucketStore)});
  318. //>>excludeEnd("ctx");
  319. },
  320. //>>excludeStart("ide", pragmas.excludeIdeData);
  321. args: [],
  322. source: "newBucket\x0a\x09self subclassResponsibility",
  323. referencedClasses: [],
  324. //>>excludeEnd("ide");
  325. messageSends: ["subclassResponsibility"]
  326. }),
  327. globals.BucketStore);
  328. smalltalk.addMethod(
  329. smalltalk.method({
  330. selector: "removeAll",
  331. protocol: 'adding/removing',
  332. fn: function (){
  333. var self=this;
  334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  335. return smalltalk.withContext(function($ctx1) {
  336. //>>excludeEnd("ctx");
  337. self['@buckets'] = Object.create(null);;
  338. return self;
  339. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  340. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.BucketStore)});
  341. //>>excludeEnd("ctx");
  342. },
  343. //>>excludeStart("ide", pragmas.excludeIdeData);
  344. args: [],
  345. source: "removeAll\x0a\x09<self['@buckets'] = Object.create(null);>",
  346. referencedClasses: [],
  347. //>>excludeEnd("ide");
  348. messageSends: []
  349. }),
  350. globals.BucketStore);
  351. smalltalk.addMethod(
  352. smalltalk.method({
  353. selector: "hashBlock:",
  354. protocol: 'instance creation',
  355. fn: function (aBlock){
  356. var self=this;
  357. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  358. return smalltalk.withContext(function($ctx1) {
  359. //>>excludeEnd("ctx");
  360. var $2,$3,$1;
  361. $2=self._new();
  362. _st($2)._hashBlock_(aBlock);
  363. $3=_st($2)._yourself();
  364. $1=$3;
  365. return $1;
  366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  367. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},globals.BucketStore.klass)});
  368. //>>excludeEnd("ctx");
  369. },
  370. //>>excludeStart("ide", pragmas.excludeIdeData);
  371. args: ["aBlock"],
  372. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  373. referencedClasses: [],
  374. //>>excludeEnd("ide");
  375. messageSends: ["hashBlock:", "new", "yourself"]
  376. }),
  377. globals.BucketStore.klass);
  378. smalltalk.addClass('ArrayBucketStore', globals.BucketStore, [], 'Kernel-Collections');
  379. //>>excludeStart("ide", pragmas.excludeIdeData);
  380. globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  381. //>>excludeEnd("ide");
  382. smalltalk.addMethod(
  383. smalltalk.method({
  384. selector: "newBucket",
  385. protocol: 'private',
  386. fn: function (){
  387. var self=this;
  388. var $1;
  389. $1=[];
  390. return $1;
  391. },
  392. //>>excludeStart("ide", pragmas.excludeIdeData);
  393. args: [],
  394. source: "newBucket\x0a\x09^ #()",
  395. referencedClasses: [],
  396. //>>excludeEnd("ide");
  397. messageSends: []
  398. }),
  399. globals.ArrayBucketStore);
  400. smalltalk.addClass('Collection', globals.Object, [], 'Kernel-Collections');
  401. //>>excludeStart("ide", pragmas.excludeIdeData);
  402. 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.";
  403. //>>excludeEnd("ide");
  404. smalltalk.addMethod(
  405. smalltalk.method({
  406. selector: ",",
  407. protocol: 'copying',
  408. fn: function (aCollection){
  409. var self=this;
  410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  411. return smalltalk.withContext(function($ctx1) {
  412. //>>excludeEnd("ctx");
  413. var $2,$3,$1;
  414. $2=self._copy();
  415. _st($2)._addAll_(aCollection);
  416. $3=_st($2)._yourself();
  417. $1=$3;
  418. return $1;
  419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  420. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},globals.Collection)});
  421. //>>excludeEnd("ctx");
  422. },
  423. //>>excludeStart("ide", pragmas.excludeIdeData);
  424. args: ["aCollection"],
  425. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  426. referencedClasses: [],
  427. //>>excludeEnd("ide");
  428. messageSends: ["addAll:", "copy", "yourself"]
  429. }),
  430. globals.Collection);
  431. smalltalk.addMethod(
  432. smalltalk.method({
  433. selector: "add:",
  434. protocol: 'adding/removing',
  435. fn: function (anObject){
  436. var self=this;
  437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  438. return smalltalk.withContext(function($ctx1) {
  439. //>>excludeEnd("ctx");
  440. self._subclassResponsibility();
  441. return self;
  442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  443. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Collection)});
  444. //>>excludeEnd("ctx");
  445. },
  446. //>>excludeStart("ide", pragmas.excludeIdeData);
  447. args: ["anObject"],
  448. source: "add: anObject\x0a\x09self subclassResponsibility",
  449. referencedClasses: [],
  450. //>>excludeEnd("ide");
  451. messageSends: ["subclassResponsibility"]
  452. }),
  453. globals.Collection);
  454. smalltalk.addMethod(
  455. smalltalk.method({
  456. selector: "addAll:",
  457. protocol: 'adding/removing',
  458. fn: function (aCollection){
  459. var self=this;
  460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  461. return smalltalk.withContext(function($ctx1) {
  462. //>>excludeEnd("ctx");
  463. _st(aCollection)._do_((function(each){
  464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  465. return smalltalk.withContext(function($ctx2) {
  466. //>>excludeEnd("ctx");
  467. return self._add_(each);
  468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  470. //>>excludeEnd("ctx");
  471. }));
  472. return aCollection;
  473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  474. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},globals.Collection)});
  475. //>>excludeEnd("ctx");
  476. },
  477. //>>excludeStart("ide", pragmas.excludeIdeData);
  478. args: ["aCollection"],
  479. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  480. referencedClasses: [],
  481. //>>excludeEnd("ide");
  482. messageSends: ["do:", "add:"]
  483. }),
  484. globals.Collection);
  485. smalltalk.addMethod(
  486. smalltalk.method({
  487. selector: "allSatisfy:",
  488. protocol: 'enumerating',
  489. fn: function (aBlock){
  490. var self=this;
  491. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  492. return smalltalk.withContext(function($ctx1) {
  493. //>>excludeEnd("ctx");
  494. var $1;
  495. var $early={};
  496. try {
  497. self._do_((function(each){
  498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  499. return smalltalk.withContext(function($ctx2) {
  500. //>>excludeEnd("ctx");
  501. $1=_st(aBlock)._value_(each);
  502. if(! smalltalk.assert($1)){
  503. throw $early=[false];
  504. };
  505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  507. //>>excludeEnd("ctx");
  508. }));
  509. return true;
  510. }
  511. catch(e) {if(e===$early)return e[0]; throw e}
  512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  513. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},globals.Collection)});
  514. //>>excludeEnd("ctx");
  515. },
  516. //>>excludeStart("ide", pragmas.excludeIdeData);
  517. args: ["aBlock"],
  518. 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",
  519. referencedClasses: [],
  520. //>>excludeEnd("ide");
  521. messageSends: ["do:", "ifFalse:", "value:"]
  522. }),
  523. globals.Collection);
  524. smalltalk.addMethod(
  525. smalltalk.method({
  526. selector: "anyOne",
  527. protocol: 'adding/removing',
  528. fn: function (){
  529. var self=this;
  530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  531. return smalltalk.withContext(function($ctx1) {
  532. //>>excludeEnd("ctx");
  533. var $early={};
  534. try {
  535. self._ifEmpty_((function(){
  536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  537. return smalltalk.withContext(function($ctx2) {
  538. //>>excludeEnd("ctx");
  539. return self._error_("Collection is empty");
  540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  541. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  542. //>>excludeEnd("ctx");
  543. }));
  544. self._do_((function(each){
  545. throw $early=[each];
  546. }));
  547. return self;
  548. }
  549. catch(e) {if(e===$early)return e[0]; throw e}
  550. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  551. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},globals.Collection)});
  552. //>>excludeEnd("ctx");
  553. },
  554. //>>excludeStart("ide", pragmas.excludeIdeData);
  555. args: [],
  556. 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 ]",
  557. referencedClasses: [],
  558. //>>excludeEnd("ide");
  559. messageSends: ["ifEmpty:", "error:", "do:"]
  560. }),
  561. globals.Collection);
  562. smalltalk.addMethod(
  563. smalltalk.method({
  564. selector: "anySatisfy:",
  565. protocol: 'enumerating',
  566. fn: function (aBlock){
  567. var self=this;
  568. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  569. return smalltalk.withContext(function($ctx1) {
  570. //>>excludeEnd("ctx");
  571. var $1;
  572. var $early={};
  573. try {
  574. self._do_((function(each){
  575. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  576. return smalltalk.withContext(function($ctx2) {
  577. //>>excludeEnd("ctx");
  578. $1=_st(aBlock)._value_(each);
  579. if(smalltalk.assert($1)){
  580. throw $early=[true];
  581. };
  582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  584. //>>excludeEnd("ctx");
  585. }));
  586. return false;
  587. }
  588. catch(e) {if(e===$early)return e[0]; throw e}
  589. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  590. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},globals.Collection)});
  591. //>>excludeEnd("ctx");
  592. },
  593. //>>excludeStart("ide", pragmas.excludeIdeData);
  594. args: ["aBlock"],
  595. 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",
  596. referencedClasses: [],
  597. //>>excludeEnd("ide");
  598. messageSends: ["do:", "ifTrue:", "value:"]
  599. }),
  600. globals.Collection);
  601. smalltalk.addMethod(
  602. smalltalk.method({
  603. selector: "asArray",
  604. protocol: 'converting',
  605. fn: function (){
  606. var self=this;
  607. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  609. return smalltalk.withContext(function($ctx1) {
  610. //>>excludeEnd("ctx");
  611. var $1;
  612. $1=_st($Array())._withAll_(self);
  613. return $1;
  614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  615. }, function($ctx1) {$ctx1.fill(self,"asArray",{},globals.Collection)});
  616. //>>excludeEnd("ctx");
  617. },
  618. //>>excludeStart("ide", pragmas.excludeIdeData);
  619. args: [],
  620. source: "asArray\x0a\x09^ Array withAll: self",
  621. referencedClasses: ["Array"],
  622. //>>excludeEnd("ide");
  623. messageSends: ["withAll:"]
  624. }),
  625. globals.Collection);
  626. smalltalk.addMethod(
  627. smalltalk.method({
  628. selector: "asJSON",
  629. protocol: 'converting',
  630. fn: function (){
  631. var self=this;
  632. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  633. return smalltalk.withContext(function($ctx1) {
  634. //>>excludeEnd("ctx");
  635. var $1;
  636. $1=_st(self._asArray())._collect_((function(each){
  637. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  638. return smalltalk.withContext(function($ctx2) {
  639. //>>excludeEnd("ctx");
  640. return _st(each)._asJSON();
  641. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  642. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  643. //>>excludeEnd("ctx");
  644. }));
  645. return $1;
  646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  647. }, function($ctx1) {$ctx1.fill(self,"asJSON",{},globals.Collection)});
  648. //>>excludeEnd("ctx");
  649. },
  650. //>>excludeStart("ide", pragmas.excludeIdeData);
  651. args: [],
  652. source: "asJSON\x0a\x09^ self asArray collect: [ :each | each asJSON ]",
  653. referencedClasses: [],
  654. //>>excludeEnd("ide");
  655. messageSends: ["collect:", "asArray", "asJSON"]
  656. }),
  657. globals.Collection);
  658. smalltalk.addMethod(
  659. smalltalk.method({
  660. selector: "asOrderedCollection",
  661. protocol: 'converting',
  662. fn: function (){
  663. var self=this;
  664. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  665. return smalltalk.withContext(function($ctx1) {
  666. //>>excludeEnd("ctx");
  667. var $1;
  668. $1=self._asArray();
  669. return $1;
  670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  671. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},globals.Collection)});
  672. //>>excludeEnd("ctx");
  673. },
  674. //>>excludeStart("ide", pragmas.excludeIdeData);
  675. args: [],
  676. source: "asOrderedCollection\x0a\x09^ self asArray",
  677. referencedClasses: [],
  678. //>>excludeEnd("ide");
  679. messageSends: ["asArray"]
  680. }),
  681. globals.Collection);
  682. smalltalk.addMethod(
  683. smalltalk.method({
  684. selector: "asSet",
  685. protocol: 'converting',
  686. fn: function (){
  687. var self=this;
  688. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  690. return smalltalk.withContext(function($ctx1) {
  691. //>>excludeEnd("ctx");
  692. var $1;
  693. $1=_st($Set())._withAll_(self);
  694. return $1;
  695. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  696. }, function($ctx1) {$ctx1.fill(self,"asSet",{},globals.Collection)});
  697. //>>excludeEnd("ctx");
  698. },
  699. //>>excludeStart("ide", pragmas.excludeIdeData);
  700. args: [],
  701. source: "asSet\x0a\x09^ Set withAll: self",
  702. referencedClasses: ["Set"],
  703. //>>excludeEnd("ide");
  704. messageSends: ["withAll:"]
  705. }),
  706. globals.Collection);
  707. smalltalk.addMethod(
  708. smalltalk.method({
  709. selector: "collect:",
  710. protocol: 'enumerating',
  711. fn: function (aBlock){
  712. var self=this;
  713. var stream;
  714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  715. return smalltalk.withContext(function($ctx1) {
  716. //>>excludeEnd("ctx");
  717. var $1;
  718. stream=_st(_st(self._class())._new())._writeStream();
  719. self._do_((function(each){
  720. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  721. return smalltalk.withContext(function($ctx2) {
  722. //>>excludeEnd("ctx");
  723. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  724. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  726. //>>excludeEnd("ctx");
  727. }));
  728. $1=_st(stream)._contents();
  729. return $1;
  730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  731. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},globals.Collection)});
  732. //>>excludeEnd("ctx");
  733. },
  734. //>>excludeStart("ide", pragmas.excludeIdeData);
  735. args: ["aBlock"],
  736. 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",
  737. referencedClasses: [],
  738. //>>excludeEnd("ide");
  739. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  740. }),
  741. globals.Collection);
  742. smalltalk.addMethod(
  743. smalltalk.method({
  744. selector: "contains:",
  745. protocol: 'testing',
  746. fn: function (aBlock){
  747. var self=this;
  748. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  749. return smalltalk.withContext(function($ctx1) {
  750. //>>excludeEnd("ctx");
  751. var $1;
  752. self._deprecatedAPI();
  753. $1=self._anySatisfy_(aBlock);
  754. return $1;
  755. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  756. }, function($ctx1) {$ctx1.fill(self,"contains:",{aBlock:aBlock},globals.Collection)});
  757. //>>excludeEnd("ctx");
  758. },
  759. //>>excludeStart("ide", pragmas.excludeIdeData);
  760. args: ["aBlock"],
  761. source: "contains: aBlock\x0a\x09self deprecatedAPI.\x0a\x0a\x09^ self anySatisfy: aBlock",
  762. referencedClasses: [],
  763. //>>excludeEnd("ide");
  764. messageSends: ["deprecatedAPI", "anySatisfy:"]
  765. }),
  766. globals.Collection);
  767. smalltalk.addMethod(
  768. smalltalk.method({
  769. selector: "copyWith:",
  770. protocol: 'copying',
  771. fn: function (anObject){
  772. var self=this;
  773. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  774. return smalltalk.withContext(function($ctx1) {
  775. //>>excludeEnd("ctx");
  776. var $2,$3,$1;
  777. $2=self._copy();
  778. _st($2)._add_(anObject);
  779. $3=_st($2)._yourself();
  780. $1=$3;
  781. return $1;
  782. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  783. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},globals.Collection)});
  784. //>>excludeEnd("ctx");
  785. },
  786. //>>excludeStart("ide", pragmas.excludeIdeData);
  787. args: ["anObject"],
  788. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  789. referencedClasses: [],
  790. //>>excludeEnd("ide");
  791. messageSends: ["add:", "copy", "yourself"]
  792. }),
  793. globals.Collection);
  794. smalltalk.addMethod(
  795. smalltalk.method({
  796. selector: "copyWithAll:",
  797. protocol: 'copying',
  798. fn: function (aCollection){
  799. var self=this;
  800. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  801. return smalltalk.withContext(function($ctx1) {
  802. //>>excludeEnd("ctx");
  803. var $2,$3,$1;
  804. $2=self._copy();
  805. _st($2)._addAll_(aCollection);
  806. $3=_st($2)._yourself();
  807. $1=$3;
  808. return $1;
  809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  810. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},globals.Collection)});
  811. //>>excludeEnd("ctx");
  812. },
  813. //>>excludeStart("ide", pragmas.excludeIdeData);
  814. args: ["aCollection"],
  815. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  816. referencedClasses: [],
  817. //>>excludeEnd("ide");
  818. messageSends: ["addAll:", "copy", "yourself"]
  819. }),
  820. globals.Collection);
  821. smalltalk.addMethod(
  822. smalltalk.method({
  823. selector: "copyWithoutAll:",
  824. protocol: 'copying',
  825. fn: function (aCollection){
  826. var self=this;
  827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  828. return smalltalk.withContext(function($ctx1) {
  829. //>>excludeEnd("ctx");
  830. var $1;
  831. $1=self._reject_((function(each){
  832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  833. return smalltalk.withContext(function($ctx2) {
  834. //>>excludeEnd("ctx");
  835. return _st(aCollection)._includes_(each);
  836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  837. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  838. //>>excludeEnd("ctx");
  839. }));
  840. return $1;
  841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  842. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},globals.Collection)});
  843. //>>excludeEnd("ctx");
  844. },
  845. //>>excludeStart("ide", pragmas.excludeIdeData);
  846. args: ["aCollection"],
  847. 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 ]",
  848. referencedClasses: [],
  849. //>>excludeEnd("ide");
  850. messageSends: ["reject:", "includes:"]
  851. }),
  852. globals.Collection);
  853. smalltalk.addMethod(
  854. smalltalk.method({
  855. selector: "detect:",
  856. protocol: 'enumerating',
  857. fn: function (aBlock){
  858. var self=this;
  859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  860. return smalltalk.withContext(function($ctx1) {
  861. //>>excludeEnd("ctx");
  862. var $1;
  863. $1=self._detect_ifNone_(aBlock,(function(){
  864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  865. return smalltalk.withContext(function($ctx2) {
  866. //>>excludeEnd("ctx");
  867. return self._errorNotFound();
  868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  870. //>>excludeEnd("ctx");
  871. }));
  872. return $1;
  873. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  874. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},globals.Collection)});
  875. //>>excludeEnd("ctx");
  876. },
  877. //>>excludeStart("ide", pragmas.excludeIdeData);
  878. args: ["aBlock"],
  879. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  880. referencedClasses: [],
  881. //>>excludeEnd("ide");
  882. messageSends: ["detect:ifNone:", "errorNotFound"]
  883. }),
  884. globals.Collection);
  885. smalltalk.addMethod(
  886. smalltalk.method({
  887. selector: "detect:ifNone:",
  888. protocol: 'enumerating',
  889. fn: function (aBlock,anotherBlock){
  890. var self=this;
  891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  892. return smalltalk.withContext(function($ctx1) {
  893. //>>excludeEnd("ctx");
  894. self._subclassResponsibility();
  895. return self;
  896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  897. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  898. //>>excludeEnd("ctx");
  899. },
  900. //>>excludeStart("ide", pragmas.excludeIdeData);
  901. args: ["aBlock", "anotherBlock"],
  902. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  903. referencedClasses: [],
  904. //>>excludeEnd("ide");
  905. messageSends: ["subclassResponsibility"]
  906. }),
  907. globals.Collection);
  908. smalltalk.addMethod(
  909. smalltalk.method({
  910. selector: "do:",
  911. protocol: 'enumerating',
  912. fn: function (aBlock){
  913. var self=this;
  914. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  915. return smalltalk.withContext(function($ctx1) {
  916. //>>excludeEnd("ctx");
  917. self._subclassResponsibility();
  918. return self;
  919. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  920. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Collection)});
  921. //>>excludeEnd("ctx");
  922. },
  923. //>>excludeStart("ide", pragmas.excludeIdeData);
  924. args: ["aBlock"],
  925. source: "do: aBlock\x0a\x09self subclassResponsibility",
  926. referencedClasses: [],
  927. //>>excludeEnd("ide");
  928. messageSends: ["subclassResponsibility"]
  929. }),
  930. globals.Collection);
  931. smalltalk.addMethod(
  932. smalltalk.method({
  933. selector: "do:separatedBy:",
  934. protocol: 'enumerating',
  935. fn: function (aBlock,anotherBlock){
  936. var self=this;
  937. var actionBeforeElement;
  938. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  939. return smalltalk.withContext(function($ctx1) {
  940. //>>excludeEnd("ctx");
  941. actionBeforeElement=(function(){
  942. actionBeforeElement=anotherBlock;
  943. return actionBeforeElement;
  944. });
  945. self._do_((function(each){
  946. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  947. return smalltalk.withContext(function($ctx2) {
  948. //>>excludeEnd("ctx");
  949. _st(actionBeforeElement)._value();
  950. return _st(aBlock)._value_(each);
  951. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  952. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  953. //>>excludeEnd("ctx");
  954. }));
  955. return self;
  956. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  957. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},globals.Collection)});
  958. //>>excludeEnd("ctx");
  959. },
  960. //>>excludeStart("ide", pragmas.excludeIdeData);
  961. args: ["aBlock", "anotherBlock"],
  962. 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 ]",
  963. referencedClasses: [],
  964. //>>excludeEnd("ide");
  965. messageSends: ["do:", "value", "value:"]
  966. }),
  967. globals.Collection);
  968. smalltalk.addMethod(
  969. smalltalk.method({
  970. selector: "errorNotFound",
  971. protocol: 'error handling',
  972. fn: function (){
  973. var self=this;
  974. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  975. return smalltalk.withContext(function($ctx1) {
  976. //>>excludeEnd("ctx");
  977. self._error_("Object is not in the collection");
  978. return self;
  979. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  980. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},globals.Collection)});
  981. //>>excludeEnd("ctx");
  982. },
  983. //>>excludeStart("ide", pragmas.excludeIdeData);
  984. args: [],
  985. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  986. referencedClasses: [],
  987. //>>excludeEnd("ide");
  988. messageSends: ["error:"]
  989. }),
  990. globals.Collection);
  991. smalltalk.addMethod(
  992. smalltalk.method({
  993. selector: "ifEmpty:",
  994. protocol: 'testing',
  995. fn: function (aBlock){
  996. var self=this;
  997. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  998. return smalltalk.withContext(function($ctx1) {
  999. //>>excludeEnd("ctx");
  1000. var $2,$1;
  1001. $2=self._isEmpty();
  1002. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1003. return self;
  1004. }));
  1005. return $1;
  1006. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1007. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},globals.Collection)});
  1008. //>>excludeEnd("ctx");
  1009. },
  1010. //>>excludeStart("ide", pragmas.excludeIdeData);
  1011. args: ["aBlock"],
  1012. 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 ]",
  1013. referencedClasses: [],
  1014. //>>excludeEnd("ide");
  1015. messageSends: ["ifTrue:ifFalse:", "isEmpty"]
  1016. }),
  1017. globals.Collection);
  1018. smalltalk.addMethod(
  1019. smalltalk.method({
  1020. selector: "ifEmpty:ifNotEmpty:",
  1021. protocol: 'testing',
  1022. fn: function (aBlock,anotherBlock){
  1023. var self=this;
  1024. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1025. return smalltalk.withContext(function($ctx1) {
  1026. //>>excludeEnd("ctx");
  1027. var $2,$1;
  1028. $2=self._isEmpty();
  1029. $1=_st($2)._ifTrue_ifFalse_(aBlock,(function(){
  1030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1031. return smalltalk.withContext(function($ctx2) {
  1032. //>>excludeEnd("ctx");
  1033. return _st(anotherBlock)._value_(self);
  1034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1036. //>>excludeEnd("ctx");
  1037. }));
  1038. return $1;
  1039. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1040. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  1041. //>>excludeEnd("ctx");
  1042. },
  1043. //>>excludeStart("ide", pragmas.excludeIdeData);
  1044. args: ["aBlock", "anotherBlock"],
  1045. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: aBlock\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  1046. referencedClasses: [],
  1047. //>>excludeEnd("ide");
  1048. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value:"]
  1049. }),
  1050. globals.Collection);
  1051. smalltalk.addMethod(
  1052. smalltalk.method({
  1053. selector: "ifNotEmpty:",
  1054. protocol: 'testing',
  1055. fn: function (aBlock){
  1056. var self=this;
  1057. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1058. return smalltalk.withContext(function($ctx1) {
  1059. //>>excludeEnd("ctx");
  1060. var $2,$1;
  1061. $2=self._notEmpty();
  1062. if(smalltalk.assert($2)){
  1063. $1=_st(aBlock)._value_(self);
  1064. } else {
  1065. $1=self;
  1066. };
  1067. return $1;
  1068. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1069. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},globals.Collection)});
  1070. //>>excludeEnd("ctx");
  1071. },
  1072. //>>excludeStart("ide", pragmas.excludeIdeData);
  1073. args: ["aBlock"],
  1074. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  1075. referencedClasses: [],
  1076. //>>excludeEnd("ide");
  1077. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1078. }),
  1079. globals.Collection);
  1080. smalltalk.addMethod(
  1081. smalltalk.method({
  1082. selector: "ifNotEmpty:ifEmpty:",
  1083. protocol: 'testing',
  1084. fn: function (aBlock,anotherBlock){
  1085. var self=this;
  1086. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1087. return smalltalk.withContext(function($ctx1) {
  1088. //>>excludeEnd("ctx");
  1089. var $2,$1;
  1090. $2=self._notEmpty();
  1091. $1=_st($2)._ifTrue_ifFalse_((function(){
  1092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1093. return smalltalk.withContext(function($ctx2) {
  1094. //>>excludeEnd("ctx");
  1095. return _st(aBlock)._value_(self);
  1096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1098. //>>excludeEnd("ctx");
  1099. }),anotherBlock);
  1100. return $1;
  1101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1102. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Collection)});
  1103. //>>excludeEnd("ctx");
  1104. },
  1105. //>>excludeStart("ide", pragmas.excludeIdeData);
  1106. args: ["aBlock", "anotherBlock"],
  1107. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: anotherBlock",
  1108. referencedClasses: [],
  1109. //>>excludeEnd("ide");
  1110. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  1111. }),
  1112. globals.Collection);
  1113. smalltalk.addMethod(
  1114. smalltalk.method({
  1115. selector: "includes:",
  1116. protocol: 'testing',
  1117. fn: function (anObject){
  1118. var self=this;
  1119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1120. return smalltalk.withContext(function($ctx1) {
  1121. //>>excludeEnd("ctx");
  1122. var $1;
  1123. $1=self._anySatisfy_((function(each){
  1124. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1125. return smalltalk.withContext(function($ctx2) {
  1126. //>>excludeEnd("ctx");
  1127. return _st(each).__eq(anObject);
  1128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1129. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1130. //>>excludeEnd("ctx");
  1131. }));
  1132. return $1;
  1133. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1134. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.Collection)});
  1135. //>>excludeEnd("ctx");
  1136. },
  1137. //>>excludeStart("ide", pragmas.excludeIdeData);
  1138. args: ["anObject"],
  1139. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  1140. referencedClasses: [],
  1141. //>>excludeEnd("ide");
  1142. messageSends: ["anySatisfy:", "="]
  1143. }),
  1144. globals.Collection);
  1145. smalltalk.addMethod(
  1146. smalltalk.method({
  1147. selector: "inject:into:",
  1148. protocol: 'enumerating',
  1149. fn: function (anObject,aBlock){
  1150. var self=this;
  1151. var result;
  1152. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1153. return smalltalk.withContext(function($ctx1) {
  1154. //>>excludeEnd("ctx");
  1155. var $1;
  1156. result=anObject;
  1157. self._do_((function(each){
  1158. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1159. return smalltalk.withContext(function($ctx2) {
  1160. //>>excludeEnd("ctx");
  1161. result=_st(aBlock)._value_value_(result,each);
  1162. return result;
  1163. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1164. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1165. //>>excludeEnd("ctx");
  1166. }));
  1167. $1=result;
  1168. return $1;
  1169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1170. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},globals.Collection)});
  1171. //>>excludeEnd("ctx");
  1172. },
  1173. //>>excludeStart("ide", pragmas.excludeIdeData);
  1174. args: ["anObject", "aBlock"],
  1175. 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",
  1176. referencedClasses: [],
  1177. //>>excludeEnd("ide");
  1178. messageSends: ["do:", "value:value:"]
  1179. }),
  1180. globals.Collection);
  1181. smalltalk.addMethod(
  1182. smalltalk.method({
  1183. selector: "intersection:",
  1184. protocol: 'enumerating',
  1185. fn: function (aCollection){
  1186. var self=this;
  1187. var set,outputSet;
  1188. function $Set(){return globals.Set||(typeof Set=="undefined"?nil:Set)}
  1189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1190. return smalltalk.withContext(function($ctx1) {
  1191. //>>excludeEnd("ctx");
  1192. var $2,$1,$3;
  1193. set=self._asSet();
  1194. outputSet=_st($Set())._new();
  1195. _st(aCollection)._do_((function(each){
  1196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1197. return smalltalk.withContext(function($ctx2) {
  1198. //>>excludeEnd("ctx");
  1199. $2=_st(set)._includes_(each);
  1200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1201. $ctx2.sendIdx["includes:"]=1;
  1202. //>>excludeEnd("ctx");
  1203. $1=_st($2)._and_((function(){
  1204. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1205. return smalltalk.withContext(function($ctx3) {
  1206. //>>excludeEnd("ctx");
  1207. return _st(_st(outputSet)._includes_(each))._not();
  1208. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1209. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  1210. //>>excludeEnd("ctx");
  1211. }));
  1212. if(smalltalk.assert($1)){
  1213. return _st(outputSet)._add_(each);
  1214. };
  1215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1216. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1217. //>>excludeEnd("ctx");
  1218. }));
  1219. $3=_st(self._class())._withAll_(_st(outputSet)._asArray());
  1220. return $3;
  1221. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1222. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},globals.Collection)});
  1223. //>>excludeEnd("ctx");
  1224. },
  1225. //>>excludeStart("ide", pragmas.excludeIdeData);
  1226. args: ["aCollection"],
  1227. 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",
  1228. referencedClasses: ["Set"],
  1229. //>>excludeEnd("ide");
  1230. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  1231. }),
  1232. globals.Collection);
  1233. smalltalk.addMethod(
  1234. smalltalk.method({
  1235. selector: "isEmpty",
  1236. protocol: 'testing',
  1237. fn: function (){
  1238. var self=this;
  1239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1240. return smalltalk.withContext(function($ctx1) {
  1241. //>>excludeEnd("ctx");
  1242. var $1;
  1243. $1=_st(self._size()).__eq((0));
  1244. return $1;
  1245. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1246. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Collection)});
  1247. //>>excludeEnd("ctx");
  1248. },
  1249. //>>excludeStart("ide", pragmas.excludeIdeData);
  1250. args: [],
  1251. source: "isEmpty\x0a\x09^ self size = 0",
  1252. referencedClasses: [],
  1253. //>>excludeEnd("ide");
  1254. messageSends: ["=", "size"]
  1255. }),
  1256. globals.Collection);
  1257. smalltalk.addMethod(
  1258. smalltalk.method({
  1259. selector: "noneSatisfy:",
  1260. protocol: 'enumerating',
  1261. fn: function (aBlock){
  1262. var self=this;
  1263. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1264. return smalltalk.withContext(function($ctx1) {
  1265. //>>excludeEnd("ctx");
  1266. var $1;
  1267. var $early={};
  1268. try {
  1269. self._do_((function(item){
  1270. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1271. return smalltalk.withContext(function($ctx2) {
  1272. //>>excludeEnd("ctx");
  1273. $1=_st(aBlock)._value_(item);
  1274. if(smalltalk.assert($1)){
  1275. throw $early=[false];
  1276. };
  1277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1278. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  1279. //>>excludeEnd("ctx");
  1280. }));
  1281. return true;
  1282. }
  1283. catch(e) {if(e===$early)return e[0]; throw e}
  1284. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1285. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},globals.Collection)});
  1286. //>>excludeEnd("ctx");
  1287. },
  1288. //>>excludeStart("ide", pragmas.excludeIdeData);
  1289. args: ["aBlock"],
  1290. 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",
  1291. referencedClasses: [],
  1292. //>>excludeEnd("ide");
  1293. messageSends: ["do:", "ifTrue:", "value:"]
  1294. }),
  1295. globals.Collection);
  1296. smalltalk.addMethod(
  1297. smalltalk.method({
  1298. selector: "notEmpty",
  1299. protocol: 'testing',
  1300. fn: function (){
  1301. var self=this;
  1302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1303. return smalltalk.withContext(function($ctx1) {
  1304. //>>excludeEnd("ctx");
  1305. var $1;
  1306. $1=_st(self._isEmpty())._not();
  1307. return $1;
  1308. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1309. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},globals.Collection)});
  1310. //>>excludeEnd("ctx");
  1311. },
  1312. //>>excludeStart("ide", pragmas.excludeIdeData);
  1313. args: [],
  1314. source: "notEmpty\x0a\x09^ self isEmpty not",
  1315. referencedClasses: [],
  1316. //>>excludeEnd("ide");
  1317. messageSends: ["not", "isEmpty"]
  1318. }),
  1319. globals.Collection);
  1320. smalltalk.addMethod(
  1321. smalltalk.method({
  1322. selector: "occurrencesOf:",
  1323. protocol: 'accessing',
  1324. fn: function (anObject){
  1325. var self=this;
  1326. var tally;
  1327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1328. return smalltalk.withContext(function($ctx1) {
  1329. //>>excludeEnd("ctx");
  1330. var $1,$2;
  1331. tally=(0);
  1332. self._do_((function(each){
  1333. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1334. return smalltalk.withContext(function($ctx2) {
  1335. //>>excludeEnd("ctx");
  1336. $1=_st(anObject).__eq(each);
  1337. if(smalltalk.assert($1)){
  1338. tally=_st(tally).__plus((1));
  1339. return tally;
  1340. };
  1341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1343. //>>excludeEnd("ctx");
  1344. }));
  1345. $2=tally;
  1346. return $2;
  1347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1348. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},globals.Collection)});
  1349. //>>excludeEnd("ctx");
  1350. },
  1351. //>>excludeStart("ide", pragmas.excludeIdeData);
  1352. args: ["anObject"],
  1353. 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",
  1354. referencedClasses: [],
  1355. //>>excludeEnd("ide");
  1356. messageSends: ["do:", "ifTrue:", "=", "+"]
  1357. }),
  1358. globals.Collection);
  1359. smalltalk.addMethod(
  1360. smalltalk.method({
  1361. selector: "putOn:",
  1362. protocol: 'streaming',
  1363. fn: function (aStream){
  1364. var self=this;
  1365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1366. return smalltalk.withContext(function($ctx1) {
  1367. //>>excludeEnd("ctx");
  1368. self._do_((function(each){
  1369. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1370. return smalltalk.withContext(function($ctx2) {
  1371. //>>excludeEnd("ctx");
  1372. return _st(each)._putOn_(aStream);
  1373. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1375. //>>excludeEnd("ctx");
  1376. }));
  1377. return self;
  1378. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1379. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.Collection)});
  1380. //>>excludeEnd("ctx");
  1381. },
  1382. //>>excludeStart("ide", pragmas.excludeIdeData);
  1383. args: ["aStream"],
  1384. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  1385. referencedClasses: [],
  1386. //>>excludeEnd("ide");
  1387. messageSends: ["do:", "putOn:"]
  1388. }),
  1389. globals.Collection);
  1390. smalltalk.addMethod(
  1391. smalltalk.method({
  1392. selector: "reject:",
  1393. protocol: 'enumerating',
  1394. fn: function (aBlock){
  1395. var self=this;
  1396. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1397. return smalltalk.withContext(function($ctx1) {
  1398. //>>excludeEnd("ctx");
  1399. var $1;
  1400. $1=self._select_((function(each){
  1401. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1402. return smalltalk.withContext(function($ctx2) {
  1403. //>>excludeEnd("ctx");
  1404. return _st(_st(aBlock)._value_(each)).__eq(false);
  1405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1407. //>>excludeEnd("ctx");
  1408. }));
  1409. return $1;
  1410. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1411. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},globals.Collection)});
  1412. //>>excludeEnd("ctx");
  1413. },
  1414. //>>excludeStart("ide", pragmas.excludeIdeData);
  1415. args: ["aBlock"],
  1416. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  1417. referencedClasses: [],
  1418. //>>excludeEnd("ide");
  1419. messageSends: ["select:", "=", "value:"]
  1420. }),
  1421. globals.Collection);
  1422. smalltalk.addMethod(
  1423. smalltalk.method({
  1424. selector: "remove:",
  1425. protocol: 'adding/removing',
  1426. fn: function (anObject){
  1427. var self=this;
  1428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1429. return smalltalk.withContext(function($ctx1) {
  1430. //>>excludeEnd("ctx");
  1431. var $1;
  1432. $1=self._remove_ifAbsent_(anObject,(function(){
  1433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1434. return smalltalk.withContext(function($ctx2) {
  1435. //>>excludeEnd("ctx");
  1436. return self._errorNotFound();
  1437. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1439. //>>excludeEnd("ctx");
  1440. }));
  1441. return $1;
  1442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1443. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.Collection)});
  1444. //>>excludeEnd("ctx");
  1445. },
  1446. //>>excludeStart("ide", pragmas.excludeIdeData);
  1447. args: ["anObject"],
  1448. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  1449. referencedClasses: [],
  1450. //>>excludeEnd("ide");
  1451. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  1452. }),
  1453. globals.Collection);
  1454. smalltalk.addMethod(
  1455. smalltalk.method({
  1456. selector: "remove:ifAbsent:",
  1457. protocol: 'adding/removing',
  1458. fn: function (anObject,aBlock){
  1459. var self=this;
  1460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1461. return smalltalk.withContext(function($ctx1) {
  1462. //>>excludeEnd("ctx");
  1463. self._subclassResponsibility();
  1464. return self;
  1465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1466. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.Collection)});
  1467. //>>excludeEnd("ctx");
  1468. },
  1469. //>>excludeStart("ide", pragmas.excludeIdeData);
  1470. args: ["anObject", "aBlock"],
  1471. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  1472. referencedClasses: [],
  1473. //>>excludeEnd("ide");
  1474. messageSends: ["subclassResponsibility"]
  1475. }),
  1476. globals.Collection);
  1477. smalltalk.addMethod(
  1478. smalltalk.method({
  1479. selector: "removeAll",
  1480. protocol: 'adding/removing',
  1481. fn: function (){
  1482. var self=this;
  1483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1484. return smalltalk.withContext(function($ctx1) {
  1485. //>>excludeEnd("ctx");
  1486. self._subclassResponsibility();
  1487. return self;
  1488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1489. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Collection)});
  1490. //>>excludeEnd("ctx");
  1491. },
  1492. //>>excludeStart("ide", pragmas.excludeIdeData);
  1493. args: [],
  1494. source: "removeAll\x0a\x09self subclassResponsibility",
  1495. referencedClasses: [],
  1496. //>>excludeEnd("ide");
  1497. messageSends: ["subclassResponsibility"]
  1498. }),
  1499. globals.Collection);
  1500. smalltalk.addMethod(
  1501. smalltalk.method({
  1502. selector: "select:",
  1503. protocol: 'enumerating',
  1504. fn: function (aBlock){
  1505. var self=this;
  1506. var stream;
  1507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1508. return smalltalk.withContext(function($ctx1) {
  1509. //>>excludeEnd("ctx");
  1510. var $1,$2;
  1511. stream=_st(_st(self._class())._new())._writeStream();
  1512. self._do_((function(each){
  1513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1514. return smalltalk.withContext(function($ctx2) {
  1515. //>>excludeEnd("ctx");
  1516. $1=_st(aBlock)._value_(each);
  1517. if(smalltalk.assert($1)){
  1518. return _st(stream)._nextPut_(each);
  1519. };
  1520. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1521. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1522. //>>excludeEnd("ctx");
  1523. }));
  1524. $2=_st(stream)._contents();
  1525. return $2;
  1526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1527. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},globals.Collection)});
  1528. //>>excludeEnd("ctx");
  1529. },
  1530. //>>excludeStart("ide", pragmas.excludeIdeData);
  1531. args: ["aBlock"],
  1532. 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",
  1533. referencedClasses: [],
  1534. //>>excludeEnd("ide");
  1535. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1536. }),
  1537. globals.Collection);
  1538. smalltalk.addMethod(
  1539. smalltalk.method({
  1540. selector: "select:thenCollect:",
  1541. protocol: 'enumerating',
  1542. fn: function (selectBlock,collectBlock){
  1543. var self=this;
  1544. var stream;
  1545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1546. return smalltalk.withContext(function($ctx1) {
  1547. //>>excludeEnd("ctx");
  1548. var $1,$2;
  1549. stream=_st(_st(self._class())._new())._writeStream();
  1550. self._do_((function(each){
  1551. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1552. return smalltalk.withContext(function($ctx2) {
  1553. //>>excludeEnd("ctx");
  1554. $1=_st(selectBlock)._value_(each);
  1555. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1556. $ctx2.sendIdx["value:"]=1;
  1557. //>>excludeEnd("ctx");
  1558. if(smalltalk.assert($1)){
  1559. return _st(stream)._nextPut_(_st(collectBlock)._value_(each));
  1560. };
  1561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1562. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  1563. //>>excludeEnd("ctx");
  1564. }));
  1565. $2=_st(stream)._contents();
  1566. return $2;
  1567. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1568. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},globals.Collection)});
  1569. //>>excludeEnd("ctx");
  1570. },
  1571. //>>excludeStart("ide", pragmas.excludeIdeData);
  1572. args: ["selectBlock", "collectBlock"],
  1573. 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",
  1574. referencedClasses: [],
  1575. //>>excludeEnd("ide");
  1576. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  1577. }),
  1578. globals.Collection);
  1579. smalltalk.addMethod(
  1580. smalltalk.method({
  1581. selector: "size",
  1582. protocol: 'accessing',
  1583. fn: function (){
  1584. var self=this;
  1585. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1586. return smalltalk.withContext(function($ctx1) {
  1587. //>>excludeEnd("ctx");
  1588. self._subclassResponsibility();
  1589. return self;
  1590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1591. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Collection)});
  1592. //>>excludeEnd("ctx");
  1593. },
  1594. //>>excludeStart("ide", pragmas.excludeIdeData);
  1595. args: [],
  1596. source: "size\x0a\x09self subclassResponsibility",
  1597. referencedClasses: [],
  1598. //>>excludeEnd("ide");
  1599. messageSends: ["subclassResponsibility"]
  1600. }),
  1601. globals.Collection);
  1602. smalltalk.addMethod(
  1603. smalltalk.method({
  1604. selector: "heliosClass",
  1605. protocol: 'helios',
  1606. fn: function (){
  1607. var self=this;
  1608. return "collection";
  1609. },
  1610. //>>excludeStart("ide", pragmas.excludeIdeData);
  1611. args: [],
  1612. source: "heliosClass\x0a\x09^ 'collection'",
  1613. referencedClasses: [],
  1614. //>>excludeEnd("ide");
  1615. messageSends: []
  1616. }),
  1617. globals.Collection.klass);
  1618. smalltalk.addMethod(
  1619. smalltalk.method({
  1620. selector: "new:",
  1621. protocol: 'instance creation',
  1622. fn: function (anInteger){
  1623. var self=this;
  1624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1625. return smalltalk.withContext(function($ctx1) {
  1626. //>>excludeEnd("ctx");
  1627. var $1;
  1628. $1=self._new();
  1629. return $1;
  1630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1631. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Collection.klass)});
  1632. //>>excludeEnd("ctx");
  1633. },
  1634. //>>excludeStart("ide", pragmas.excludeIdeData);
  1635. args: ["anInteger"],
  1636. source: "new: anInteger\x0a\x09^ self new",
  1637. referencedClasses: [],
  1638. //>>excludeEnd("ide");
  1639. messageSends: ["new"]
  1640. }),
  1641. globals.Collection.klass);
  1642. smalltalk.addMethod(
  1643. smalltalk.method({
  1644. selector: "with:",
  1645. protocol: 'instance creation',
  1646. fn: function (anObject){
  1647. var self=this;
  1648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1649. return smalltalk.withContext(function($ctx1) {
  1650. //>>excludeEnd("ctx");
  1651. var $2,$3,$1;
  1652. $2=self._new();
  1653. _st($2)._add_(anObject);
  1654. $3=_st($2)._yourself();
  1655. $1=$3;
  1656. return $1;
  1657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1658. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Collection.klass)});
  1659. //>>excludeEnd("ctx");
  1660. },
  1661. //>>excludeStart("ide", pragmas.excludeIdeData);
  1662. args: ["anObject"],
  1663. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  1664. referencedClasses: [],
  1665. //>>excludeEnd("ide");
  1666. messageSends: ["add:", "new", "yourself"]
  1667. }),
  1668. globals.Collection.klass);
  1669. smalltalk.addMethod(
  1670. smalltalk.method({
  1671. selector: "with:with:",
  1672. protocol: 'instance creation',
  1673. fn: function (anObject,anotherObject){
  1674. var self=this;
  1675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1676. return smalltalk.withContext(function($ctx1) {
  1677. //>>excludeEnd("ctx");
  1678. var $2,$3,$1;
  1679. $2=self._new();
  1680. _st($2)._add_(anObject);
  1681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1682. $ctx1.sendIdx["add:"]=1;
  1683. //>>excludeEnd("ctx");
  1684. _st($2)._add_(anotherObject);
  1685. $3=_st($2)._yourself();
  1686. $1=$3;
  1687. return $1;
  1688. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1689. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},globals.Collection.klass)});
  1690. //>>excludeEnd("ctx");
  1691. },
  1692. //>>excludeStart("ide", pragmas.excludeIdeData);
  1693. args: ["anObject", "anotherObject"],
  1694. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  1695. referencedClasses: [],
  1696. //>>excludeEnd("ide");
  1697. messageSends: ["add:", "new", "yourself"]
  1698. }),
  1699. globals.Collection.klass);
  1700. smalltalk.addMethod(
  1701. smalltalk.method({
  1702. selector: "with:with:with:",
  1703. protocol: 'instance creation',
  1704. fn: function (firstObject,secondObject,thirdObject){
  1705. var self=this;
  1706. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1707. return smalltalk.withContext(function($ctx1) {
  1708. //>>excludeEnd("ctx");
  1709. var $2,$3,$1;
  1710. $2=self._new();
  1711. _st($2)._add_(firstObject);
  1712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1713. $ctx1.sendIdx["add:"]=1;
  1714. //>>excludeEnd("ctx");
  1715. _st($2)._add_(secondObject);
  1716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1717. $ctx1.sendIdx["add:"]=2;
  1718. //>>excludeEnd("ctx");
  1719. _st($2)._add_(thirdObject);
  1720. $3=_st($2)._yourself();
  1721. $1=$3;
  1722. return $1;
  1723. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1724. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},globals.Collection.klass)});
  1725. //>>excludeEnd("ctx");
  1726. },
  1727. //>>excludeStart("ide", pragmas.excludeIdeData);
  1728. args: ["firstObject", "secondObject", "thirdObject"],
  1729. 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",
  1730. referencedClasses: [],
  1731. //>>excludeEnd("ide");
  1732. messageSends: ["add:", "new", "yourself"]
  1733. }),
  1734. globals.Collection.klass);
  1735. smalltalk.addMethod(
  1736. smalltalk.method({
  1737. selector: "withAll:",
  1738. protocol: 'instance creation',
  1739. fn: function (aCollection){
  1740. var self=this;
  1741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1742. return smalltalk.withContext(function($ctx1) {
  1743. //>>excludeEnd("ctx");
  1744. var $2,$3,$1;
  1745. $2=self._new();
  1746. _st($2)._addAll_(aCollection);
  1747. $3=_st($2)._yourself();
  1748. $1=$3;
  1749. return $1;
  1750. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1751. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},globals.Collection.klass)});
  1752. //>>excludeEnd("ctx");
  1753. },
  1754. //>>excludeStart("ide", pragmas.excludeIdeData);
  1755. args: ["aCollection"],
  1756. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  1757. referencedClasses: [],
  1758. //>>excludeEnd("ide");
  1759. messageSends: ["addAll:", "new", "yourself"]
  1760. }),
  1761. globals.Collection.klass);
  1762. smalltalk.addClass('IndexableCollection', globals.Collection, [], 'Kernel-Collections');
  1763. //>>excludeStart("ide", pragmas.excludeIdeData);
  1764. 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.";
  1765. //>>excludeEnd("ide");
  1766. smalltalk.addMethod(
  1767. smalltalk.method({
  1768. selector: "at:",
  1769. protocol: 'accessing',
  1770. fn: function (anIndex){
  1771. var self=this;
  1772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1773. return smalltalk.withContext(function($ctx1) {
  1774. //>>excludeEnd("ctx");
  1775. var $1;
  1776. $1=self._at_ifAbsent_(anIndex,(function(){
  1777. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1778. return smalltalk.withContext(function($ctx2) {
  1779. //>>excludeEnd("ctx");
  1780. return self._errorNotFound();
  1781. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1783. //>>excludeEnd("ctx");
  1784. }));
  1785. return $1;
  1786. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1787. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},globals.IndexableCollection)});
  1788. //>>excludeEnd("ctx");
  1789. },
  1790. //>>excludeStart("ide", pragmas.excludeIdeData);
  1791. args: ["anIndex"],
  1792. source: "at: anIndex\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, raise an error.\x22\x0a\x0a\x09^ self at: anIndex ifAbsent: [ self errorNotFound ]",
  1793. referencedClasses: [],
  1794. //>>excludeEnd("ide");
  1795. messageSends: ["at:ifAbsent:", "errorNotFound"]
  1796. }),
  1797. globals.IndexableCollection);
  1798. smalltalk.addMethod(
  1799. smalltalk.method({
  1800. selector: "at:ifAbsent:",
  1801. protocol: 'accessing',
  1802. fn: function (anIndex,aBlock){
  1803. var self=this;
  1804. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1805. return smalltalk.withContext(function($ctx1) {
  1806. //>>excludeEnd("ctx");
  1807. self._subclassResponsibility();
  1808. return self;
  1809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1810. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)});
  1811. //>>excludeEnd("ctx");
  1812. },
  1813. //>>excludeStart("ide", pragmas.excludeIdeData);
  1814. args: ["anIndex", "aBlock"],
  1815. source: "at: anIndex ifAbsent: aBlock\x0a\x09\x22Lookup the given index in the receiver.\x0a\x09If it is present, answer the value stored at anIndex.\x0a\x09Otherwise, answer the value of aBlock.\x22\x0a\x0a\x09self subclassResponsibility",
  1816. referencedClasses: [],
  1817. //>>excludeEnd("ide");
  1818. messageSends: ["subclassResponsibility"]
  1819. }),
  1820. globals.IndexableCollection);
  1821. smalltalk.addMethod(
  1822. smalltalk.method({
  1823. selector: "at:ifAbsentPut:",
  1824. protocol: 'accessing',
  1825. fn: function (aKey,aBlock){
  1826. var self=this;
  1827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1828. return smalltalk.withContext(function($ctx1) {
  1829. //>>excludeEnd("ctx");
  1830. var $1;
  1831. $1=self._at_ifAbsent_(aKey,(function(){
  1832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1833. return smalltalk.withContext(function($ctx2) {
  1834. //>>excludeEnd("ctx");
  1835. return self._at_put_(aKey,_st(aBlock)._value());
  1836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1838. //>>excludeEnd("ctx");
  1839. }));
  1840. return $1;
  1841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1842. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},globals.IndexableCollection)});
  1843. //>>excludeEnd("ctx");
  1844. },
  1845. //>>excludeStart("ide", pragmas.excludeIdeData);
  1846. args: ["aKey", "aBlock"],
  1847. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  1848. referencedClasses: [],
  1849. //>>excludeEnd("ide");
  1850. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  1851. }),
  1852. globals.IndexableCollection);
  1853. smalltalk.addMethod(
  1854. smalltalk.method({
  1855. selector: "at:ifPresent:",
  1856. protocol: 'accessing',
  1857. fn: function (anIndex,aBlock){
  1858. var self=this;
  1859. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1860. return smalltalk.withContext(function($ctx1) {
  1861. //>>excludeEnd("ctx");
  1862. var $1;
  1863. $1=self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  1864. return nil;
  1865. }));
  1866. return $1;
  1867. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1868. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},globals.IndexableCollection)});
  1869. //>>excludeEnd("ctx");
  1870. },
  1871. //>>excludeStart("ide", pragmas.excludeIdeData);
  1872. args: ["anIndex", "aBlock"],
  1873. 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 ]",
  1874. referencedClasses: [],
  1875. //>>excludeEnd("ide");
  1876. messageSends: ["at:ifPresent:ifAbsent:"]
  1877. }),
  1878. globals.IndexableCollection);
  1879. smalltalk.addMethod(
  1880. smalltalk.method({
  1881. selector: "at:ifPresent:ifAbsent:",
  1882. protocol: 'accessing',
  1883. fn: function (anIndex,aBlock,anotherBlock){
  1884. var self=this;
  1885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1886. return smalltalk.withContext(function($ctx1) {
  1887. //>>excludeEnd("ctx");
  1888. self._subclassResponsibility();
  1889. return self;
  1890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1891. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.IndexableCollection)});
  1892. //>>excludeEnd("ctx");
  1893. },
  1894. //>>excludeStart("ide", pragmas.excludeIdeData);
  1895. args: ["anIndex", "aBlock", "anotherBlock"],
  1896. 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",
  1897. referencedClasses: [],
  1898. //>>excludeEnd("ide");
  1899. messageSends: ["subclassResponsibility"]
  1900. }),
  1901. globals.IndexableCollection);
  1902. smalltalk.addMethod(
  1903. smalltalk.method({
  1904. selector: "at:put:",
  1905. protocol: 'accessing',
  1906. fn: function (anIndex,anObject){
  1907. var self=this;
  1908. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1909. return smalltalk.withContext(function($ctx1) {
  1910. //>>excludeEnd("ctx");
  1911. self._subclassResponsibility();
  1912. return self;
  1913. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1914. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.IndexableCollection)});
  1915. //>>excludeEnd("ctx");
  1916. },
  1917. //>>excludeStart("ide", pragmas.excludeIdeData);
  1918. args: ["anIndex", "anObject"],
  1919. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  1920. referencedClasses: [],
  1921. //>>excludeEnd("ide");
  1922. messageSends: ["subclassResponsibility"]
  1923. }),
  1924. globals.IndexableCollection);
  1925. smalltalk.addMethod(
  1926. smalltalk.method({
  1927. selector: "indexOf:",
  1928. protocol: 'accessing',
  1929. fn: function (anObject){
  1930. var self=this;
  1931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1932. return smalltalk.withContext(function($ctx1) {
  1933. //>>excludeEnd("ctx");
  1934. var $1;
  1935. $1=self._indexOf_ifAbsent_(anObject,(function(){
  1936. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1937. return smalltalk.withContext(function($ctx2) {
  1938. //>>excludeEnd("ctx");
  1939. return self._errorNotFound();
  1940. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1941. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  1942. //>>excludeEnd("ctx");
  1943. }));
  1944. return $1;
  1945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1946. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},globals.IndexableCollection)});
  1947. //>>excludeEnd("ctx");
  1948. },
  1949. //>>excludeStart("ide", pragmas.excludeIdeData);
  1950. args: ["anObject"],
  1951. 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 ]",
  1952. referencedClasses: [],
  1953. //>>excludeEnd("ide");
  1954. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  1955. }),
  1956. globals.IndexableCollection);
  1957. smalltalk.addMethod(
  1958. smalltalk.method({
  1959. selector: "indexOf:ifAbsent:",
  1960. protocol: 'accessing',
  1961. fn: function (anObject,aBlock){
  1962. var self=this;
  1963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1964. return smalltalk.withContext(function($ctx1) {
  1965. //>>excludeEnd("ctx");
  1966. self._subclassResponsibility();
  1967. return self;
  1968. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1969. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.IndexableCollection)});
  1970. //>>excludeEnd("ctx");
  1971. },
  1972. //>>excludeStart("ide", pragmas.excludeIdeData);
  1973. args: ["anObject", "aBlock"],
  1974. 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",
  1975. referencedClasses: [],
  1976. //>>excludeEnd("ide");
  1977. messageSends: ["subclassResponsibility"]
  1978. }),
  1979. globals.IndexableCollection);
  1980. smalltalk.addMethod(
  1981. smalltalk.method({
  1982. selector: "with:do:",
  1983. protocol: 'enumerating',
  1984. fn: function (anotherCollection,aBlock){
  1985. var self=this;
  1986. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1987. return smalltalk.withContext(function($ctx1) {
  1988. //>>excludeEnd("ctx");
  1989. self._withIndexDo_((function(each,index){
  1990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1991. return smalltalk.withContext(function($ctx2) {
  1992. //>>excludeEnd("ctx");
  1993. return _st(aBlock)._value_value_(each,_st(anotherCollection)._at_(index));
  1994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  1995. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  1996. //>>excludeEnd("ctx");
  1997. }));
  1998. return self;
  1999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2000. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.IndexableCollection)});
  2001. //>>excludeEnd("ctx");
  2002. },
  2003. //>>excludeStart("ide", pragmas.excludeIdeData);
  2004. args: ["anotherCollection", "aBlock"],
  2005. 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) ]",
  2006. referencedClasses: [],
  2007. //>>excludeEnd("ide");
  2008. messageSends: ["withIndexDo:", "value:value:", "at:"]
  2009. }),
  2010. globals.IndexableCollection);
  2011. smalltalk.addMethod(
  2012. smalltalk.method({
  2013. selector: "withIndexDo:",
  2014. protocol: 'enumerating',
  2015. fn: function (aBlock){
  2016. var self=this;
  2017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2018. return smalltalk.withContext(function($ctx1) {
  2019. //>>excludeEnd("ctx");
  2020. self._subclassResponsibility();
  2021. return self;
  2022. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2023. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.IndexableCollection)});
  2024. //>>excludeEnd("ctx");
  2025. },
  2026. //>>excludeStart("ide", pragmas.excludeIdeData);
  2027. args: ["aBlock"],
  2028. 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",
  2029. referencedClasses: [],
  2030. //>>excludeEnd("ide");
  2031. messageSends: ["subclassResponsibility"]
  2032. }),
  2033. globals.IndexableCollection);
  2034. smalltalk.addClass('AssociativeCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  2035. //>>excludeStart("ide", pragmas.excludeIdeData);
  2036. globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  2037. //>>excludeEnd("ide");
  2038. smalltalk.addMethod(
  2039. smalltalk.method({
  2040. selector: "=",
  2041. protocol: 'comparing',
  2042. fn: function (anAssocitativeCollection){
  2043. var self=this;
  2044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2045. return smalltalk.withContext(function($ctx1) {
  2046. //>>excludeEnd("ctx");
  2047. var $2,$1,$4,$3,$6,$5;
  2048. $2=self._class();
  2049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2050. $ctx1.sendIdx["class"]=1;
  2051. //>>excludeEnd("ctx");
  2052. $1=_st($2).__eq(_st(anAssocitativeCollection)._class());
  2053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2054. $ctx1.sendIdx["="]=1;
  2055. //>>excludeEnd("ctx");
  2056. if(! smalltalk.assert($1)){
  2057. return false;
  2058. };
  2059. $4=self._size();
  2060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2061. $ctx1.sendIdx["size"]=1;
  2062. //>>excludeEnd("ctx");
  2063. $3=_st($4).__eq(_st(anAssocitativeCollection)._size());
  2064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2065. $ctx1.sendIdx["="]=2;
  2066. //>>excludeEnd("ctx");
  2067. if(! smalltalk.assert($3)){
  2068. return false;
  2069. };
  2070. $6=self._associations();
  2071. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2072. $ctx1.sendIdx["associations"]=1;
  2073. //>>excludeEnd("ctx");
  2074. $5=_st($6).__eq(_st(anAssocitativeCollection)._associations());
  2075. return $5;
  2076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2077. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},globals.AssociativeCollection)});
  2078. //>>excludeEnd("ctx");
  2079. },
  2080. //>>excludeStart("ide", pragmas.excludeIdeData);
  2081. args: ["anAssocitativeCollection"],
  2082. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  2083. referencedClasses: [],
  2084. //>>excludeEnd("ide");
  2085. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  2086. }),
  2087. globals.AssociativeCollection);
  2088. smalltalk.addMethod(
  2089. smalltalk.method({
  2090. selector: "add:",
  2091. protocol: 'adding/removing',
  2092. fn: function (anAssociation){
  2093. var self=this;
  2094. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2095. return smalltalk.withContext(function($ctx1) {
  2096. //>>excludeEnd("ctx");
  2097. self._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  2098. return self;
  2099. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2100. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},globals.AssociativeCollection)});
  2101. //>>excludeEnd("ctx");
  2102. },
  2103. //>>excludeStart("ide", pragmas.excludeIdeData);
  2104. args: ["anAssociation"],
  2105. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  2106. referencedClasses: [],
  2107. //>>excludeEnd("ide");
  2108. messageSends: ["at:put:", "key", "value"]
  2109. }),
  2110. globals.AssociativeCollection);
  2111. smalltalk.addMethod(
  2112. smalltalk.method({
  2113. selector: "addAll:",
  2114. protocol: 'adding/removing',
  2115. fn: function (anAssociativeCollection){
  2116. var self=this;
  2117. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2118. return smalltalk.withContext(function($ctx1) {
  2119. //>>excludeEnd("ctx");
  2120. (
  2121. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2122. $ctx1.supercall = true,
  2123. //>>excludeEnd("ctx");
  2124. globals.AssociativeCollection.superclass.fn.prototype._addAll_.apply(_st(self), [_st(anAssociativeCollection)._associations()]));
  2125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2126. $ctx1.supercall = false;
  2127. //>>excludeEnd("ctx");;
  2128. return anAssociativeCollection;
  2129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2130. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},globals.AssociativeCollection)});
  2131. //>>excludeEnd("ctx");
  2132. },
  2133. //>>excludeStart("ide", pragmas.excludeIdeData);
  2134. args: ["anAssociativeCollection"],
  2135. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  2136. referencedClasses: [],
  2137. //>>excludeEnd("ide");
  2138. messageSends: ["addAll:", "associations"]
  2139. }),
  2140. globals.AssociativeCollection);
  2141. smalltalk.addMethod(
  2142. smalltalk.method({
  2143. selector: "asDictionary",
  2144. protocol: 'converting',
  2145. fn: function (){
  2146. var self=this;
  2147. function $Dictionary(){return globals.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2148. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2149. return smalltalk.withContext(function($ctx1) {
  2150. //>>excludeEnd("ctx");
  2151. var $1;
  2152. $1=_st($Dictionary())._from_(self._associations());
  2153. return $1;
  2154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2155. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},globals.AssociativeCollection)});
  2156. //>>excludeEnd("ctx");
  2157. },
  2158. //>>excludeStart("ide", pragmas.excludeIdeData);
  2159. args: [],
  2160. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  2161. referencedClasses: ["Dictionary"],
  2162. //>>excludeEnd("ide");
  2163. messageSends: ["from:", "associations"]
  2164. }),
  2165. globals.AssociativeCollection);
  2166. smalltalk.addMethod(
  2167. smalltalk.method({
  2168. selector: "asHashedCollection",
  2169. protocol: 'converting',
  2170. fn: function (){
  2171. var self=this;
  2172. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2174. return smalltalk.withContext(function($ctx1) {
  2175. //>>excludeEnd("ctx");
  2176. var $1;
  2177. $1=_st($HashedCollection())._from_(self._associations());
  2178. return $1;
  2179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2180. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},globals.AssociativeCollection)});
  2181. //>>excludeEnd("ctx");
  2182. },
  2183. //>>excludeStart("ide", pragmas.excludeIdeData);
  2184. args: [],
  2185. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  2186. referencedClasses: ["HashedCollection"],
  2187. //>>excludeEnd("ide");
  2188. messageSends: ["from:", "associations"]
  2189. }),
  2190. globals.AssociativeCollection);
  2191. smalltalk.addMethod(
  2192. smalltalk.method({
  2193. selector: "asJSON",
  2194. protocol: 'converting',
  2195. fn: function (){
  2196. var self=this;
  2197. var hash;
  2198. function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
  2199. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2200. return smalltalk.withContext(function($ctx1) {
  2201. //>>excludeEnd("ctx");
  2202. var $1;
  2203. hash=_st($HashedCollection())._new();
  2204. self._keysAndValuesDo_((function(key,value){
  2205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2206. return smalltalk.withContext(function($ctx2) {
  2207. //>>excludeEnd("ctx");
  2208. return _st(hash)._at_put_(key,_st(value)._asJSON());
  2209. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2210. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2211. //>>excludeEnd("ctx");
  2212. }));
  2213. $1=hash;
  2214. return $1;
  2215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2216. }, function($ctx1) {$ctx1.fill(self,"asJSON",{hash:hash},globals.AssociativeCollection)});
  2217. //>>excludeEnd("ctx");
  2218. },
  2219. //>>excludeStart("ide", pragmas.excludeIdeData);
  2220. args: [],
  2221. 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",
  2222. referencedClasses: ["HashedCollection"],
  2223. //>>excludeEnd("ide");
  2224. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJSON"]
  2225. }),
  2226. globals.AssociativeCollection);
  2227. smalltalk.addMethod(
  2228. smalltalk.method({
  2229. selector: "associations",
  2230. protocol: 'accessing',
  2231. fn: function (){
  2232. var self=this;
  2233. var associations;
  2234. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2235. return smalltalk.withContext(function($ctx1) {
  2236. //>>excludeEnd("ctx");
  2237. var $1;
  2238. associations=[];
  2239. self._associationsDo_((function(each){
  2240. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2241. return smalltalk.withContext(function($ctx2) {
  2242. //>>excludeEnd("ctx");
  2243. return _st(associations)._add_(each);
  2244. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2245. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2246. //>>excludeEnd("ctx");
  2247. }));
  2248. $1=associations;
  2249. return $1;
  2250. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2251. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},globals.AssociativeCollection)});
  2252. //>>excludeEnd("ctx");
  2253. },
  2254. //>>excludeStart("ide", pragmas.excludeIdeData);
  2255. args: [],
  2256. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  2257. referencedClasses: [],
  2258. //>>excludeEnd("ide");
  2259. messageSends: ["associationsDo:", "add:"]
  2260. }),
  2261. globals.AssociativeCollection);
  2262. smalltalk.addMethod(
  2263. smalltalk.method({
  2264. selector: "associationsDo:",
  2265. protocol: 'enumerating',
  2266. fn: function (aBlock){
  2267. var self=this;
  2268. function $Association(){return globals.Association||(typeof Association=="undefined"?nil:Association)}
  2269. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2270. return smalltalk.withContext(function($ctx1) {
  2271. //>>excludeEnd("ctx");
  2272. self._keysAndValuesDo_((function(key,value){
  2273. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2274. return smalltalk.withContext(function($ctx2) {
  2275. //>>excludeEnd("ctx");
  2276. return _st(aBlock)._value_(_st($Association())._key_value_(key,value));
  2277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2278. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2279. //>>excludeEnd("ctx");
  2280. }));
  2281. return self;
  2282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2283. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  2284. //>>excludeEnd("ctx");
  2285. },
  2286. //>>excludeStart("ide", pragmas.excludeIdeData);
  2287. args: ["aBlock"],
  2288. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  2289. referencedClasses: ["Association"],
  2290. //>>excludeEnd("ide");
  2291. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  2292. }),
  2293. globals.AssociativeCollection);
  2294. smalltalk.addMethod(
  2295. smalltalk.method({
  2296. selector: "at:ifPresent:ifAbsent:",
  2297. protocol: 'accessing',
  2298. fn: function (aKey,aBlock,anotherBlock){
  2299. var self=this;
  2300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2301. return smalltalk.withContext(function($ctx1) {
  2302. //>>excludeEnd("ctx");
  2303. var $2,$1;
  2304. $2=self._includesKey_(aKey);
  2305. if(smalltalk.assert($2)){
  2306. $1=_st(aBlock)._value_(self._at_(aKey));
  2307. } else {
  2308. $1=_st(anotherBlock)._value();
  2309. };
  2310. return $1;
  2311. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2312. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)});
  2313. //>>excludeEnd("ctx");
  2314. },
  2315. //>>excludeStart("ide", pragmas.excludeIdeData);
  2316. args: ["aKey", "aBlock", "anotherBlock"],
  2317. 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 ]",
  2318. referencedClasses: [],
  2319. //>>excludeEnd("ide");
  2320. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  2321. }),
  2322. globals.AssociativeCollection);
  2323. smalltalk.addMethod(
  2324. smalltalk.method({
  2325. selector: "collect:",
  2326. protocol: 'enumerating',
  2327. fn: function (aBlock){
  2328. var self=this;
  2329. var newDict;
  2330. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2331. return smalltalk.withContext(function($ctx1) {
  2332. //>>excludeEnd("ctx");
  2333. var $1;
  2334. newDict=_st(self._class())._new();
  2335. self._keysAndValuesDo_((function(key,value){
  2336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2337. return smalltalk.withContext(function($ctx2) {
  2338. //>>excludeEnd("ctx");
  2339. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  2340. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2341. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2342. //>>excludeEnd("ctx");
  2343. }));
  2344. $1=newDict;
  2345. return $1;
  2346. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2347. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)});
  2348. //>>excludeEnd("ctx");
  2349. },
  2350. //>>excludeStart("ide", pragmas.excludeIdeData);
  2351. args: ["aBlock"],
  2352. 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",
  2353. referencedClasses: [],
  2354. //>>excludeEnd("ide");
  2355. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  2356. }),
  2357. globals.AssociativeCollection);
  2358. smalltalk.addMethod(
  2359. smalltalk.method({
  2360. selector: "deepCopy",
  2361. protocol: 'copying',
  2362. fn: function (){
  2363. var self=this;
  2364. var copy;
  2365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2366. return smalltalk.withContext(function($ctx1) {
  2367. //>>excludeEnd("ctx");
  2368. var $1;
  2369. copy=_st(self._class())._new();
  2370. self._keysAndValuesDo_((function(key,value){
  2371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2372. return smalltalk.withContext(function($ctx2) {
  2373. //>>excludeEnd("ctx");
  2374. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  2375. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2376. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2377. //>>excludeEnd("ctx");
  2378. }));
  2379. $1=copy;
  2380. return $1;
  2381. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2382. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},globals.AssociativeCollection)});
  2383. //>>excludeEnd("ctx");
  2384. },
  2385. //>>excludeStart("ide", pragmas.excludeIdeData);
  2386. args: [],
  2387. 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",
  2388. referencedClasses: [],
  2389. //>>excludeEnd("ide");
  2390. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  2391. }),
  2392. globals.AssociativeCollection);
  2393. smalltalk.addMethod(
  2394. smalltalk.method({
  2395. selector: "detect:ifNone:",
  2396. protocol: 'enumerating',
  2397. fn: function (aBlock,anotherBlock){
  2398. var self=this;
  2399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2400. return smalltalk.withContext(function($ctx1) {
  2401. //>>excludeEnd("ctx");
  2402. var $1;
  2403. $1=_st(self._values())._detect_ifNone_(aBlock,anotherBlock);
  2404. return $1;
  2405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2406. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.AssociativeCollection)});
  2407. //>>excludeEnd("ctx");
  2408. },
  2409. //>>excludeStart("ide", pragmas.excludeIdeData);
  2410. args: ["aBlock", "anotherBlock"],
  2411. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  2412. referencedClasses: [],
  2413. //>>excludeEnd("ide");
  2414. messageSends: ["detect:ifNone:", "values"]
  2415. }),
  2416. globals.AssociativeCollection);
  2417. smalltalk.addMethod(
  2418. smalltalk.method({
  2419. selector: "do:",
  2420. protocol: 'enumerating',
  2421. fn: function (aBlock){
  2422. var self=this;
  2423. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2424. return smalltalk.withContext(function($ctx1) {
  2425. //>>excludeEnd("ctx");
  2426. self._valuesDo_(aBlock);
  2427. return self;
  2428. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2429. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.AssociativeCollection)});
  2430. //>>excludeEnd("ctx");
  2431. },
  2432. //>>excludeStart("ide", pragmas.excludeIdeData);
  2433. args: ["aBlock"],
  2434. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  2435. referencedClasses: [],
  2436. //>>excludeEnd("ide");
  2437. messageSends: ["valuesDo:"]
  2438. }),
  2439. globals.AssociativeCollection);
  2440. smalltalk.addMethod(
  2441. smalltalk.method({
  2442. selector: "includes:",
  2443. protocol: 'enumerating',
  2444. fn: function (anObject){
  2445. var self=this;
  2446. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2447. return smalltalk.withContext(function($ctx1) {
  2448. //>>excludeEnd("ctx");
  2449. var $1;
  2450. $1=_st(self._values())._includes_(anObject);
  2451. return $1;
  2452. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2453. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.AssociativeCollection)});
  2454. //>>excludeEnd("ctx");
  2455. },
  2456. //>>excludeStart("ide", pragmas.excludeIdeData);
  2457. args: ["anObject"],
  2458. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  2459. referencedClasses: [],
  2460. //>>excludeEnd("ide");
  2461. messageSends: ["includes:", "values"]
  2462. }),
  2463. globals.AssociativeCollection);
  2464. smalltalk.addMethod(
  2465. smalltalk.method({
  2466. selector: "includesKey:",
  2467. protocol: 'testing',
  2468. fn: function (aKey){
  2469. var self=this;
  2470. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2471. return smalltalk.withContext(function($ctx1) {
  2472. //>>excludeEnd("ctx");
  2473. self._subclassResponsibility();
  2474. return self;
  2475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2476. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.AssociativeCollection)});
  2477. //>>excludeEnd("ctx");
  2478. },
  2479. //>>excludeStart("ide", pragmas.excludeIdeData);
  2480. args: ["aKey"],
  2481. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  2482. referencedClasses: [],
  2483. //>>excludeEnd("ide");
  2484. messageSends: ["subclassResponsibility"]
  2485. }),
  2486. globals.AssociativeCollection);
  2487. smalltalk.addMethod(
  2488. smalltalk.method({
  2489. selector: "indexOf:ifAbsent:",
  2490. protocol: 'accessing',
  2491. fn: function (anObject,aBlock){
  2492. var self=this;
  2493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2494. return smalltalk.withContext(function($ctx1) {
  2495. //>>excludeEnd("ctx");
  2496. var $1;
  2497. $1=_st(self._keys())._detect_ifNone_((function(each){
  2498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2499. return smalltalk.withContext(function($ctx2) {
  2500. //>>excludeEnd("ctx");
  2501. return _st(self._at_(each)).__eq(anObject);
  2502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2504. //>>excludeEnd("ctx");
  2505. }),aBlock);
  2506. return $1;
  2507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2508. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)});
  2509. //>>excludeEnd("ctx");
  2510. },
  2511. //>>excludeStart("ide", pragmas.excludeIdeData);
  2512. args: ["anObject", "aBlock"],
  2513. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  2514. referencedClasses: [],
  2515. //>>excludeEnd("ide");
  2516. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  2517. }),
  2518. globals.AssociativeCollection);
  2519. smalltalk.addMethod(
  2520. smalltalk.method({
  2521. selector: "keyAtValue:",
  2522. protocol: 'accessing',
  2523. fn: function (anObject){
  2524. var self=this;
  2525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2526. return smalltalk.withContext(function($ctx1) {
  2527. //>>excludeEnd("ctx");
  2528. var $1;
  2529. $1=self._keyAtValue_ifAbsent_(anObject,(function(){
  2530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2531. return smalltalk.withContext(function($ctx2) {
  2532. //>>excludeEnd("ctx");
  2533. return self._errorNotFound();
  2534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  2536. //>>excludeEnd("ctx");
  2537. }));
  2538. return $1;
  2539. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2540. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},globals.AssociativeCollection)});
  2541. //>>excludeEnd("ctx");
  2542. },
  2543. //>>excludeStart("ide", pragmas.excludeIdeData);
  2544. args: ["anObject"],
  2545. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  2546. referencedClasses: [],
  2547. //>>excludeEnd("ide");
  2548. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  2549. }),
  2550. globals.AssociativeCollection);
  2551. smalltalk.addMethod(
  2552. smalltalk.method({
  2553. selector: "keyAtValue:ifAbsent:",
  2554. protocol: 'accessing',
  2555. fn: function (anObject,aBlock){
  2556. var self=this;
  2557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2558. return smalltalk.withContext(function($ctx1) {
  2559. //>>excludeEnd("ctx");
  2560. var $1;
  2561. $1=self._indexOf_ifAbsent_(anObject,aBlock);
  2562. return $1;
  2563. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2564. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.AssociativeCollection)});
  2565. //>>excludeEnd("ctx");
  2566. },
  2567. //>>excludeStart("ide", pragmas.excludeIdeData);
  2568. args: ["anObject", "aBlock"],
  2569. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  2570. referencedClasses: [],
  2571. //>>excludeEnd("ide");
  2572. messageSends: ["indexOf:ifAbsent:"]
  2573. }),
  2574. globals.AssociativeCollection);
  2575. smalltalk.addMethod(
  2576. smalltalk.method({
  2577. selector: "keys",
  2578. protocol: 'accessing',
  2579. fn: function (){
  2580. var self=this;
  2581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2582. return smalltalk.withContext(function($ctx1) {
  2583. //>>excludeEnd("ctx");
  2584. self._subclassResponsibility();
  2585. return self;
  2586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2587. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.AssociativeCollection)});
  2588. //>>excludeEnd("ctx");
  2589. },
  2590. //>>excludeStart("ide", pragmas.excludeIdeData);
  2591. args: [],
  2592. source: "keys\x0a\x09self subclassResponsibility",
  2593. referencedClasses: [],
  2594. //>>excludeEnd("ide");
  2595. messageSends: ["subclassResponsibility"]
  2596. }),
  2597. globals.AssociativeCollection);
  2598. smalltalk.addMethod(
  2599. smalltalk.method({
  2600. selector: "keysAndValuesDo:",
  2601. protocol: 'enumerating',
  2602. fn: function (aBlock){
  2603. var self=this;
  2604. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2605. return smalltalk.withContext(function($ctx1) {
  2606. //>>excludeEnd("ctx");
  2607. self._keysDo_((function(each){
  2608. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2609. return smalltalk.withContext(function($ctx2) {
  2610. //>>excludeEnd("ctx");
  2611. return _st(aBlock)._value_value_(each,self._at_(each));
  2612. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2613. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2614. //>>excludeEnd("ctx");
  2615. }));
  2616. return self;
  2617. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2618. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  2619. //>>excludeEnd("ctx");
  2620. },
  2621. //>>excludeStart("ide", pragmas.excludeIdeData);
  2622. args: ["aBlock"],
  2623. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  2624. referencedClasses: [],
  2625. //>>excludeEnd("ide");
  2626. messageSends: ["keysDo:", "value:value:", "at:"]
  2627. }),
  2628. globals.AssociativeCollection);
  2629. smalltalk.addMethod(
  2630. smalltalk.method({
  2631. selector: "keysDo:",
  2632. protocol: 'enumerating',
  2633. fn: function (aBlock){
  2634. var self=this;
  2635. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2636. return smalltalk.withContext(function($ctx1) {
  2637. //>>excludeEnd("ctx");
  2638. self._subclassResponsibility();
  2639. return self;
  2640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2641. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  2642. //>>excludeEnd("ctx");
  2643. },
  2644. //>>excludeStart("ide", pragmas.excludeIdeData);
  2645. args: ["aBlock"],
  2646. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  2647. referencedClasses: [],
  2648. //>>excludeEnd("ide");
  2649. messageSends: ["subclassResponsibility"]
  2650. }),
  2651. globals.AssociativeCollection);
  2652. smalltalk.addMethod(
  2653. smalltalk.method({
  2654. selector: "printOn:",
  2655. protocol: 'printing',
  2656. fn: function (aStream){
  2657. var self=this;
  2658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2659. return smalltalk.withContext(function($ctx1) {
  2660. //>>excludeEnd("ctx");
  2661. (
  2662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2663. $ctx1.supercall = true,
  2664. //>>excludeEnd("ctx");
  2665. globals.AssociativeCollection.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  2666. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2667. $ctx1.supercall = false;
  2668. //>>excludeEnd("ctx");;
  2669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2670. $ctx1.sendIdx["printOn:"]=1;
  2671. //>>excludeEnd("ctx");
  2672. _st(aStream)._nextPutAll_(" (");
  2673. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2674. $ctx1.sendIdx["nextPutAll:"]=1;
  2675. //>>excludeEnd("ctx");
  2676. _st(self._associations())._do_separatedBy_((function(each){
  2677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2678. return smalltalk.withContext(function($ctx2) {
  2679. //>>excludeEnd("ctx");
  2680. return _st(each)._printOn_(aStream);
  2681. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2682. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2683. //>>excludeEnd("ctx");
  2684. }),(function(){
  2685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2686. return smalltalk.withContext(function($ctx2) {
  2687. //>>excludeEnd("ctx");
  2688. return _st(aStream)._nextPutAll_(" , ");
  2689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2690. $ctx2.sendIdx["nextPutAll:"]=2;
  2691. //>>excludeEnd("ctx");
  2692. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2693. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  2694. //>>excludeEnd("ctx");
  2695. }));
  2696. _st(aStream)._nextPutAll_(")");
  2697. return self;
  2698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2699. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.AssociativeCollection)});
  2700. //>>excludeEnd("ctx");
  2701. },
  2702. //>>excludeStart("ide", pragmas.excludeIdeData);
  2703. args: ["aStream"],
  2704. 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: ')'",
  2705. referencedClasses: [],
  2706. //>>excludeEnd("ide");
  2707. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  2708. }),
  2709. globals.AssociativeCollection);
  2710. smalltalk.addMethod(
  2711. smalltalk.method({
  2712. selector: "remove:ifAbsent:",
  2713. protocol: 'adding/removing',
  2714. fn: function (aKey,aBlock){
  2715. var self=this;
  2716. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2717. return smalltalk.withContext(function($ctx1) {
  2718. //>>excludeEnd("ctx");
  2719. var $1;
  2720. $1=self._removeKey_ifAbsent_(aKey,aBlock);
  2721. return $1;
  2722. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2723. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)});
  2724. //>>excludeEnd("ctx");
  2725. },
  2726. //>>excludeStart("ide", pragmas.excludeIdeData);
  2727. args: ["aKey", "aBlock"],
  2728. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  2729. referencedClasses: [],
  2730. //>>excludeEnd("ide");
  2731. messageSends: ["removeKey:ifAbsent:"]
  2732. }),
  2733. globals.AssociativeCollection);
  2734. smalltalk.addMethod(
  2735. smalltalk.method({
  2736. selector: "removeAll",
  2737. protocol: 'adding/removing',
  2738. fn: function (){
  2739. var self=this;
  2740. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2741. return smalltalk.withContext(function($ctx1) {
  2742. //>>excludeEnd("ctx");
  2743. var $1;
  2744. $1=_st(self._keys())._do_((function(each){
  2745. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2746. return smalltalk.withContext(function($ctx2) {
  2747. //>>excludeEnd("ctx");
  2748. return self._removeKey_(each);
  2749. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2750. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  2751. //>>excludeEnd("ctx");
  2752. }));
  2753. return $1;
  2754. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2755. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.AssociativeCollection)});
  2756. //>>excludeEnd("ctx");
  2757. },
  2758. //>>excludeStart("ide", pragmas.excludeIdeData);
  2759. args: [],
  2760. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  2761. referencedClasses: [],
  2762. //>>excludeEnd("ide");
  2763. messageSends: ["do:", "keys", "removeKey:"]
  2764. }),
  2765. globals.AssociativeCollection);
  2766. smalltalk.addMethod(
  2767. smalltalk.method({
  2768. selector: "removeKey:",
  2769. protocol: 'adding/removing',
  2770. fn: function (aKey){
  2771. var self=this;
  2772. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2773. return smalltalk.withContext(function($ctx1) {
  2774. //>>excludeEnd("ctx");
  2775. var $1;
  2776. $1=self._remove_(aKey);
  2777. return $1;
  2778. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2779. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},globals.AssociativeCollection)});
  2780. //>>excludeEnd("ctx");
  2781. },
  2782. //>>excludeStart("ide", pragmas.excludeIdeData);
  2783. args: ["aKey"],
  2784. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  2785. referencedClasses: [],
  2786. //>>excludeEnd("ide");
  2787. messageSends: ["remove:"]
  2788. }),
  2789. globals.AssociativeCollection);
  2790. smalltalk.addMethod(
  2791. smalltalk.method({
  2792. selector: "removeKey:ifAbsent:",
  2793. protocol: 'adding/removing',
  2794. fn: function (aKey,aBlock){
  2795. var self=this;
  2796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2797. return smalltalk.withContext(function($ctx1) {
  2798. //>>excludeEnd("ctx");
  2799. self._subclassResponsibility();
  2800. return self;
  2801. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2802. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.AssociativeCollection)});
  2803. //>>excludeEnd("ctx");
  2804. },
  2805. //>>excludeStart("ide", pragmas.excludeIdeData);
  2806. args: ["aKey", "aBlock"],
  2807. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2808. referencedClasses: [],
  2809. //>>excludeEnd("ide");
  2810. messageSends: ["subclassResponsibility"]
  2811. }),
  2812. globals.AssociativeCollection);
  2813. smalltalk.addMethod(
  2814. smalltalk.method({
  2815. selector: "select:",
  2816. protocol: 'enumerating',
  2817. fn: function (aBlock){
  2818. var self=this;
  2819. var newDict;
  2820. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2821. return smalltalk.withContext(function($ctx1) {
  2822. //>>excludeEnd("ctx");
  2823. var $1,$2;
  2824. newDict=_st(self._class())._new();
  2825. self._keysAndValuesDo_((function(key,value){
  2826. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2827. return smalltalk.withContext(function($ctx2) {
  2828. //>>excludeEnd("ctx");
  2829. $1=_st(aBlock)._value_(value);
  2830. if(smalltalk.assert($1)){
  2831. return _st(newDict)._at_put_(key,value);
  2832. };
  2833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2834. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2835. //>>excludeEnd("ctx");
  2836. }));
  2837. $2=newDict;
  2838. return $2;
  2839. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2840. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},globals.AssociativeCollection)});
  2841. //>>excludeEnd("ctx");
  2842. },
  2843. //>>excludeStart("ide", pragmas.excludeIdeData);
  2844. args: ["aBlock"],
  2845. 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",
  2846. referencedClasses: [],
  2847. //>>excludeEnd("ide");
  2848. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  2849. }),
  2850. globals.AssociativeCollection);
  2851. smalltalk.addMethod(
  2852. smalltalk.method({
  2853. selector: "shallowCopy",
  2854. protocol: 'copying',
  2855. fn: function (){
  2856. var self=this;
  2857. var copy;
  2858. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2859. return smalltalk.withContext(function($ctx1) {
  2860. //>>excludeEnd("ctx");
  2861. var $1;
  2862. copy=_st(self._class())._new();
  2863. self._keysAndValuesDo_((function(key,value){
  2864. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2865. return smalltalk.withContext(function($ctx2) {
  2866. //>>excludeEnd("ctx");
  2867. return _st(copy)._at_put_(key,value);
  2868. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2869. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2870. //>>excludeEnd("ctx");
  2871. }));
  2872. $1=copy;
  2873. return $1;
  2874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2875. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},globals.AssociativeCollection)});
  2876. //>>excludeEnd("ctx");
  2877. },
  2878. //>>excludeStart("ide", pragmas.excludeIdeData);
  2879. args: [],
  2880. 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",
  2881. referencedClasses: [],
  2882. //>>excludeEnd("ide");
  2883. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  2884. }),
  2885. globals.AssociativeCollection);
  2886. smalltalk.addMethod(
  2887. smalltalk.method({
  2888. selector: "size",
  2889. protocol: 'accessing',
  2890. fn: function (){
  2891. var self=this;
  2892. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2893. return smalltalk.withContext(function($ctx1) {
  2894. //>>excludeEnd("ctx");
  2895. var $1;
  2896. $1=_st(self._keys())._size();
  2897. return $1;
  2898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2899. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.AssociativeCollection)});
  2900. //>>excludeEnd("ctx");
  2901. },
  2902. //>>excludeStart("ide", pragmas.excludeIdeData);
  2903. args: [],
  2904. source: "size\x0a\x09^ self keys size",
  2905. referencedClasses: [],
  2906. //>>excludeEnd("ide");
  2907. messageSends: ["size", "keys"]
  2908. }),
  2909. globals.AssociativeCollection);
  2910. smalltalk.addMethod(
  2911. smalltalk.method({
  2912. selector: "values",
  2913. protocol: 'accessing',
  2914. fn: function (){
  2915. var self=this;
  2916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2917. return smalltalk.withContext(function($ctx1) {
  2918. //>>excludeEnd("ctx");
  2919. self._subclassResponsibility();
  2920. return self;
  2921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2922. }, function($ctx1) {$ctx1.fill(self,"values",{},globals.AssociativeCollection)});
  2923. //>>excludeEnd("ctx");
  2924. },
  2925. //>>excludeStart("ide", pragmas.excludeIdeData);
  2926. args: [],
  2927. source: "values\x0a\x09self subclassResponsibility",
  2928. referencedClasses: [],
  2929. //>>excludeEnd("ide");
  2930. messageSends: ["subclassResponsibility"]
  2931. }),
  2932. globals.AssociativeCollection);
  2933. smalltalk.addMethod(
  2934. smalltalk.method({
  2935. selector: "valuesDo:",
  2936. protocol: 'enumerating',
  2937. fn: function (aBlock){
  2938. var self=this;
  2939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2940. return smalltalk.withContext(function($ctx1) {
  2941. //>>excludeEnd("ctx");
  2942. self._subclassResponsibility();
  2943. return self;
  2944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2945. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  2946. //>>excludeEnd("ctx");
  2947. },
  2948. //>>excludeStart("ide", pragmas.excludeIdeData);
  2949. args: ["aBlock"],
  2950. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  2951. referencedClasses: [],
  2952. //>>excludeEnd("ide");
  2953. messageSends: ["subclassResponsibility"]
  2954. }),
  2955. globals.AssociativeCollection);
  2956. smalltalk.addMethod(
  2957. smalltalk.method({
  2958. selector: "withIndexDo:",
  2959. protocol: 'enumerating',
  2960. fn: function (aBlock){
  2961. var self=this;
  2962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2963. return smalltalk.withContext(function($ctx1) {
  2964. //>>excludeEnd("ctx");
  2965. self._keysAndValuesDo_((function(key,value){
  2966. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2967. return smalltalk.withContext(function($ctx2) {
  2968. //>>excludeEnd("ctx");
  2969. return _st(aBlock)._value_value_(value,key);
  2970. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2971. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  2972. //>>excludeEnd("ctx");
  2973. }));
  2974. return self;
  2975. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2976. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.AssociativeCollection)});
  2977. //>>excludeEnd("ctx");
  2978. },
  2979. //>>excludeStart("ide", pragmas.excludeIdeData);
  2980. args: ["aBlock"],
  2981. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  2982. referencedClasses: [],
  2983. //>>excludeEnd("ide");
  2984. messageSends: ["keysAndValuesDo:", "value:value:"]
  2985. }),
  2986. globals.AssociativeCollection);
  2987. smalltalk.addMethod(
  2988. smalltalk.method({
  2989. selector: "from:",
  2990. protocol: 'instance creation',
  2991. fn: function (aCollection){
  2992. var self=this;
  2993. var newCollection;
  2994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  2995. return smalltalk.withContext(function($ctx1) {
  2996. //>>excludeEnd("ctx");
  2997. var $1;
  2998. newCollection=self._new();
  2999. _st(aCollection)._do_((function(each){
  3000. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3001. return smalltalk.withContext(function($ctx2) {
  3002. //>>excludeEnd("ctx");
  3003. return _st(newCollection)._add_(each);
  3004. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3006. //>>excludeEnd("ctx");
  3007. }));
  3008. $1=newCollection;
  3009. return $1;
  3010. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3011. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)});
  3012. //>>excludeEnd("ctx");
  3013. },
  3014. //>>excludeStart("ide", pragmas.excludeIdeData);
  3015. args: ["aCollection"],
  3016. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  3017. referencedClasses: [],
  3018. //>>excludeEnd("ide");
  3019. messageSends: ["new", "do:", "add:"]
  3020. }),
  3021. globals.AssociativeCollection.klass);
  3022. smalltalk.addMethod(
  3023. smalltalk.method({
  3024. selector: "fromPairs:",
  3025. protocol: 'instance creation',
  3026. fn: function (aCollection){
  3027. var self=this;
  3028. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3029. return smalltalk.withContext(function($ctx1) {
  3030. //>>excludeEnd("ctx");
  3031. var $1;
  3032. $1=self._from_(aCollection);
  3033. return $1;
  3034. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3035. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},globals.AssociativeCollection.klass)});
  3036. //>>excludeEnd("ctx");
  3037. },
  3038. //>>excludeStart("ide", pragmas.excludeIdeData);
  3039. args: ["aCollection"],
  3040. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  3041. referencedClasses: [],
  3042. //>>excludeEnd("ide");
  3043. messageSends: ["from:"]
  3044. }),
  3045. globals.AssociativeCollection.klass);
  3046. smalltalk.addMethod(
  3047. smalltalk.method({
  3048. selector: "newFromPairs:",
  3049. protocol: 'instance creation',
  3050. fn: function (aCollection){
  3051. var self=this;
  3052. var newCollection;
  3053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3054. return smalltalk.withContext(function($ctx1) {
  3055. //>>excludeEnd("ctx");
  3056. var $2,$1,$3,$4,$5;
  3057. $2=_st(aCollection)._size();
  3058. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3059. $ctx1.sendIdx["size"]=1;
  3060. //>>excludeEnd("ctx");
  3061. $1=_st($2)._even();
  3062. if(! smalltalk.assert($1)){
  3063. self._error_("#newFromPairs only accepts arrays of an even length");
  3064. };
  3065. newCollection=self._new();
  3066. _st((1)._to_by_(_st(aCollection)._size(),(2)))._do_((function(each){
  3067. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3068. return smalltalk.withContext(function($ctx2) {
  3069. //>>excludeEnd("ctx");
  3070. $3=newCollection;
  3071. $4=_st(aCollection)._at_(each);
  3072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3073. $ctx2.sendIdx["at:"]=1;
  3074. //>>excludeEnd("ctx");
  3075. return _st($3)._at_put_($4,_st(aCollection)._at_(_st(each).__plus((1))));
  3076. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3077. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  3078. //>>excludeEnd("ctx");
  3079. }));
  3080. $5=newCollection;
  3081. return $5;
  3082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3083. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},globals.AssociativeCollection.klass)});
  3084. //>>excludeEnd("ctx");
  3085. },
  3086. //>>excludeStart("ide", pragmas.excludeIdeData);
  3087. args: ["aCollection"],
  3088. 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",
  3089. referencedClasses: [],
  3090. //>>excludeEnd("ide");
  3091. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  3092. }),
  3093. globals.AssociativeCollection.klass);
  3094. smalltalk.addClass('Dictionary', globals.AssociativeCollection, ['keys', 'values'], 'Kernel-Collections');
  3095. //>>excludeStart("ide", pragmas.excludeIdeData);
  3096. 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.";
  3097. //>>excludeEnd("ide");
  3098. smalltalk.addMethod(
  3099. smalltalk.method({
  3100. selector: "at:ifAbsent:",
  3101. protocol: 'accessing',
  3102. fn: function (aKey,aBlock){
  3103. var self=this;
  3104. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3105. return smalltalk.withContext(function($ctx1) {
  3106. //>>excludeEnd("ctx");
  3107. var index = self._positionOfKey_(aKey);
  3108. return index >=0 ? self['@values'][index] : aBlock._value();
  3109. ;
  3110. return self;
  3111. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3112. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)});
  3113. //>>excludeEnd("ctx");
  3114. },
  3115. //>>excludeStart("ide", pragmas.excludeIdeData);
  3116. args: ["aKey", "aBlock"],
  3117. 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>",
  3118. referencedClasses: [],
  3119. //>>excludeEnd("ide");
  3120. messageSends: []
  3121. }),
  3122. globals.Dictionary);
  3123. smalltalk.addMethod(
  3124. smalltalk.method({
  3125. selector: "at:put:",
  3126. protocol: 'accessing',
  3127. fn: function (aKey,aValue){
  3128. var self=this;
  3129. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3130. return smalltalk.withContext(function($ctx1) {
  3131. //>>excludeEnd("ctx");
  3132. var index = self._positionOfKey_(aKey);
  3133. if(index === -1) {
  3134. var keys = self['@keys'];
  3135. index = keys.length;
  3136. keys.push(aKey);
  3137. }
  3138. return self['@values'][index] = aValue;
  3139. ;
  3140. return self;
  3141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3142. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.Dictionary)});
  3143. //>>excludeEnd("ctx");
  3144. },
  3145. //>>excludeStart("ide", pragmas.excludeIdeData);
  3146. args: ["aKey", "aValue"],
  3147. 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>",
  3148. referencedClasses: [],
  3149. //>>excludeEnd("ide");
  3150. messageSends: []
  3151. }),
  3152. globals.Dictionary);
  3153. smalltalk.addMethod(
  3154. smalltalk.method({
  3155. selector: "includesKey:",
  3156. protocol: 'testing',
  3157. fn: function (aKey){
  3158. var self=this;
  3159. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3160. return smalltalk.withContext(function($ctx1) {
  3161. //>>excludeEnd("ctx");
  3162. return self._positionOfKey_(aKey) >= 0; ;
  3163. return self;
  3164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3165. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.Dictionary)});
  3166. //>>excludeEnd("ctx");
  3167. },
  3168. //>>excludeStart("ide", pragmas.excludeIdeData);
  3169. args: ["aKey"],
  3170. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  3171. referencedClasses: [],
  3172. //>>excludeEnd("ide");
  3173. messageSends: []
  3174. }),
  3175. globals.Dictionary);
  3176. smalltalk.addMethod(
  3177. smalltalk.method({
  3178. selector: "indexOf:ifAbsent:",
  3179. protocol: 'accessing',
  3180. fn: function (anObject,aBlock){
  3181. var self=this;
  3182. var index;
  3183. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3184. return smalltalk.withContext(function($ctx1) {
  3185. //>>excludeEnd("ctx");
  3186. var $2,$1;
  3187. index=_st(self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  3188. return (0);
  3189. }));
  3190. $2=_st(index).__eq((0));
  3191. if(smalltalk.assert($2)){
  3192. $1=_st(aBlock)._value();
  3193. } else {
  3194. $1=_st(self["@keys"])._at_(index);
  3195. };
  3196. return $1;
  3197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3198. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Dictionary)});
  3199. //>>excludeEnd("ctx");
  3200. },
  3201. //>>excludeStart("ide", pragmas.excludeIdeData);
  3202. args: ["anObject", "aBlock"],
  3203. 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 ]",
  3204. referencedClasses: [],
  3205. //>>excludeEnd("ide");
  3206. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  3207. }),
  3208. globals.Dictionary);
  3209. smalltalk.addMethod(
  3210. smalltalk.method({
  3211. selector: "initialize",
  3212. protocol: 'initialization',
  3213. fn: function (){
  3214. var self=this;
  3215. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3216. return smalltalk.withContext(function($ctx1) {
  3217. //>>excludeEnd("ctx");
  3218. (
  3219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3220. $ctx1.supercall = true,
  3221. //>>excludeEnd("ctx");
  3222. globals.Dictionary.superclass.fn.prototype._initialize.apply(_st(self), []));
  3223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3224. $ctx1.supercall = false;
  3225. //>>excludeEnd("ctx");;
  3226. self["@keys"]=[];
  3227. self["@values"]=[];
  3228. return self;
  3229. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3230. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Dictionary)});
  3231. //>>excludeEnd("ctx");
  3232. },
  3233. //>>excludeStart("ide", pragmas.excludeIdeData);
  3234. args: [],
  3235. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  3236. referencedClasses: [],
  3237. //>>excludeEnd("ide");
  3238. messageSends: ["initialize"]
  3239. }),
  3240. globals.Dictionary);
  3241. smalltalk.addMethod(
  3242. smalltalk.method({
  3243. selector: "keys",
  3244. protocol: 'accessing',
  3245. fn: function (){
  3246. var self=this;
  3247. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3248. return smalltalk.withContext(function($ctx1) {
  3249. //>>excludeEnd("ctx");
  3250. var $1;
  3251. $1=_st(self["@keys"])._copy();
  3252. return $1;
  3253. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3254. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.Dictionary)});
  3255. //>>excludeEnd("ctx");
  3256. },
  3257. //>>excludeStart("ide", pragmas.excludeIdeData);
  3258. args: [],
  3259. source: "keys\x0a\x09^ keys copy",
  3260. referencedClasses: [],
  3261. //>>excludeEnd("ide");
  3262. messageSends: ["copy"]
  3263. }),
  3264. globals.Dictionary);
  3265. smalltalk.addMethod(
  3266. smalltalk.method({
  3267. selector: "keysAndValuesDo:",
  3268. protocol: 'enumerating',
  3269. fn: function (aBlock){
  3270. var self=this;
  3271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3272. return smalltalk.withContext(function($ctx1) {
  3273. //>>excludeEnd("ctx");
  3274. var $1;
  3275. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  3276. return $1;
  3277. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3278. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},globals.Dictionary)});
  3279. //>>excludeEnd("ctx");
  3280. },
  3281. //>>excludeStart("ide", pragmas.excludeIdeData);
  3282. args: ["aBlock"],
  3283. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  3284. referencedClasses: [],
  3285. //>>excludeEnd("ide");
  3286. messageSends: ["with:do:"]
  3287. }),
  3288. globals.Dictionary);
  3289. smalltalk.addMethod(
  3290. smalltalk.method({
  3291. selector: "keysDo:",
  3292. protocol: 'enumerating',
  3293. fn: function (aBlock){
  3294. var self=this;
  3295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3296. return smalltalk.withContext(function($ctx1) {
  3297. //>>excludeEnd("ctx");
  3298. var $1;
  3299. $1=_st(self["@keys"])._do_(aBlock);
  3300. return $1;
  3301. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3302. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.Dictionary)});
  3303. //>>excludeEnd("ctx");
  3304. },
  3305. //>>excludeStart("ide", pragmas.excludeIdeData);
  3306. args: ["aBlock"],
  3307. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  3308. referencedClasses: [],
  3309. //>>excludeEnd("ide");
  3310. messageSends: ["do:"]
  3311. }),
  3312. globals.Dictionary);
  3313. smalltalk.addMethod(
  3314. smalltalk.method({
  3315. selector: "positionOfKey:",
  3316. protocol: 'private',
  3317. fn: function (anObject){
  3318. var self=this;
  3319. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3320. return smalltalk.withContext(function($ctx1) {
  3321. //>>excludeEnd("ctx");
  3322. var keys = self['@keys'];
  3323. for(var i=0;i<keys.length;i++){
  3324. if(keys[i].__eq(anObject)) { return i;}
  3325. }
  3326. return -1;
  3327. ;
  3328. return self;
  3329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3330. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},globals.Dictionary)});
  3331. //>>excludeEnd("ctx");
  3332. },
  3333. //>>excludeStart("ide", pragmas.excludeIdeData);
  3334. args: ["anObject"],
  3335. 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>",
  3336. referencedClasses: [],
  3337. //>>excludeEnd("ide");
  3338. messageSends: []
  3339. }),
  3340. globals.Dictionary);
  3341. smalltalk.addMethod(
  3342. smalltalk.method({
  3343. selector: "removeAll",
  3344. protocol: 'adding/removing',
  3345. fn: function (){
  3346. var self=this;
  3347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3348. return smalltalk.withContext(function($ctx1) {
  3349. //>>excludeEnd("ctx");
  3350. _st(self["@keys"])._removeAll();
  3351. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3352. $ctx1.sendIdx["removeAll"]=1;
  3353. //>>excludeEnd("ctx");
  3354. _st(self["@values"])._removeAll();
  3355. return self;
  3356. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3357. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Dictionary)});
  3358. //>>excludeEnd("ctx");
  3359. },
  3360. //>>excludeStart("ide", pragmas.excludeIdeData);
  3361. args: [],
  3362. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  3363. referencedClasses: [],
  3364. //>>excludeEnd("ide");
  3365. messageSends: ["removeAll"]
  3366. }),
  3367. globals.Dictionary);
  3368. smalltalk.addMethod(
  3369. smalltalk.method({
  3370. selector: "removeKey:ifAbsent:",
  3371. protocol: 'adding/removing',
  3372. fn: function (aKey,aBlock){
  3373. var self=this;
  3374. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3375. return smalltalk.withContext(function($ctx1) {
  3376. //>>excludeEnd("ctx");
  3377. var index = self._positionOfKey_(aKey);
  3378. if(index === -1) {
  3379. return aBlock._value()
  3380. } else {
  3381. var keys = self['@keys'], values = self['@values'];
  3382. var value = values[index], l = keys.length;
  3383. keys[index] = keys[l-1];
  3384. keys.pop();
  3385. values[index] = values[l-1];
  3386. values.pop();
  3387. return value;
  3388. }
  3389. ;
  3390. return self;
  3391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3392. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.Dictionary)});
  3393. //>>excludeEnd("ctx");
  3394. },
  3395. //>>excludeStart("ide", pragmas.excludeIdeData);
  3396. args: ["aKey", "aBlock"],
  3397. 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>",
  3398. referencedClasses: [],
  3399. //>>excludeEnd("ide");
  3400. messageSends: []
  3401. }),
  3402. globals.Dictionary);
  3403. smalltalk.addMethod(
  3404. smalltalk.method({
  3405. selector: "values",
  3406. protocol: 'accessing',
  3407. fn: function (){
  3408. var self=this;
  3409. var $1;
  3410. $1=self["@values"];
  3411. return $1;
  3412. },
  3413. //>>excludeStart("ide", pragmas.excludeIdeData);
  3414. args: [],
  3415. source: "values\x0a\x09^ values",
  3416. referencedClasses: [],
  3417. //>>excludeEnd("ide");
  3418. messageSends: []
  3419. }),
  3420. globals.Dictionary);
  3421. smalltalk.addMethod(
  3422. smalltalk.method({
  3423. selector: "valuesDo:",
  3424. protocol: 'enumerating',
  3425. fn: function (aBlock){
  3426. var self=this;
  3427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3428. return smalltalk.withContext(function($ctx1) {
  3429. //>>excludeEnd("ctx");
  3430. var $1;
  3431. $1=_st(self["@values"])._do_(aBlock);
  3432. return $1;
  3433. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3434. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.Dictionary)});
  3435. //>>excludeEnd("ctx");
  3436. },
  3437. //>>excludeStart("ide", pragmas.excludeIdeData);
  3438. args: ["aBlock"],
  3439. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  3440. referencedClasses: [],
  3441. //>>excludeEnd("ide");
  3442. messageSends: ["do:"]
  3443. }),
  3444. globals.Dictionary);
  3445. smalltalk.addClass('HashedCollection', globals.AssociativeCollection, [], 'Kernel-Collections');
  3446. //>>excludeStart("ide", pragmas.excludeIdeData);
  3447. globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  3448. //>>excludeEnd("ide");
  3449. smalltalk.addMethod(
  3450. smalltalk.method({
  3451. selector: "at:ifAbsent:",
  3452. protocol: 'accessing',
  3453. fn: function (aKey,aBlock){
  3454. var self=this;
  3455. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3456. return smalltalk.withContext(function($ctx1) {
  3457. //>>excludeEnd("ctx");
  3458. var $2,$1;
  3459. $2=self._includesKey_(aKey);
  3460. if(smalltalk.assert($2)){
  3461. $1=self._basicAt_(aKey);
  3462. } else {
  3463. $1=_st(aBlock)._value();
  3464. };
  3465. return $1;
  3466. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3467. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)});
  3468. //>>excludeEnd("ctx");
  3469. },
  3470. //>>excludeStart("ide", pragmas.excludeIdeData);
  3471. args: ["aKey", "aBlock"],
  3472. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  3473. referencedClasses: [],
  3474. //>>excludeEnd("ide");
  3475. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  3476. }),
  3477. globals.HashedCollection);
  3478. smalltalk.addMethod(
  3479. smalltalk.method({
  3480. selector: "at:put:",
  3481. protocol: 'accessing',
  3482. fn: function (aKey,aValue){
  3483. var self=this;
  3484. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3485. return smalltalk.withContext(function($ctx1) {
  3486. //>>excludeEnd("ctx");
  3487. var $1;
  3488. $1=self._basicAt_put_(aKey,aValue);
  3489. return $1;
  3490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3491. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},globals.HashedCollection)});
  3492. //>>excludeEnd("ctx");
  3493. },
  3494. //>>excludeStart("ide", pragmas.excludeIdeData);
  3495. args: ["aKey", "aValue"],
  3496. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  3497. referencedClasses: [],
  3498. //>>excludeEnd("ide");
  3499. messageSends: ["basicAt:put:"]
  3500. }),
  3501. globals.HashedCollection);
  3502. smalltalk.addMethod(
  3503. smalltalk.method({
  3504. selector: "includesKey:",
  3505. protocol: 'testing',
  3506. fn: function (aKey){
  3507. var self=this;
  3508. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3509. return smalltalk.withContext(function($ctx1) {
  3510. //>>excludeEnd("ctx");
  3511. return self.hasOwnProperty(aKey);
  3512. return self;
  3513. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3514. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},globals.HashedCollection)});
  3515. //>>excludeEnd("ctx");
  3516. },
  3517. //>>excludeStart("ide", pragmas.excludeIdeData);
  3518. args: ["aKey"],
  3519. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  3520. referencedClasses: [],
  3521. //>>excludeEnd("ide");
  3522. messageSends: []
  3523. }),
  3524. globals.HashedCollection);
  3525. smalltalk.addMethod(
  3526. smalltalk.method({
  3527. selector: "keys",
  3528. protocol: 'accessing',
  3529. fn: function (){
  3530. var self=this;
  3531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3532. return smalltalk.withContext(function($ctx1) {
  3533. //>>excludeEnd("ctx");
  3534. return Object.keys(self);
  3535. return self;
  3536. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3537. }, function($ctx1) {$ctx1.fill(self,"keys",{},globals.HashedCollection)});
  3538. //>>excludeEnd("ctx");
  3539. },
  3540. //>>excludeStart("ide", pragmas.excludeIdeData);
  3541. args: [],
  3542. source: "keys\x0a\x09<return Object.keys(self)>",
  3543. referencedClasses: [],
  3544. //>>excludeEnd("ide");
  3545. messageSends: []
  3546. }),
  3547. globals.HashedCollection);
  3548. smalltalk.addMethod(
  3549. smalltalk.method({
  3550. selector: "keysDo:",
  3551. protocol: 'enumerating',
  3552. fn: function (aBlock){
  3553. var self=this;
  3554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3555. return smalltalk.withContext(function($ctx1) {
  3556. //>>excludeEnd("ctx");
  3557. _st(self._keys())._do_(aBlock);
  3558. return self;
  3559. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3560. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},globals.HashedCollection)});
  3561. //>>excludeEnd("ctx");
  3562. },
  3563. //>>excludeStart("ide", pragmas.excludeIdeData);
  3564. args: ["aBlock"],
  3565. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  3566. referencedClasses: [],
  3567. //>>excludeEnd("ide");
  3568. messageSends: ["do:", "keys"]
  3569. }),
  3570. globals.HashedCollection);
  3571. smalltalk.addMethod(
  3572. smalltalk.method({
  3573. selector: "removeKey:ifAbsent:",
  3574. protocol: 'adding/removing',
  3575. fn: function (aKey,aBlock){
  3576. var self=this;
  3577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3578. return smalltalk.withContext(function($ctx1) {
  3579. //>>excludeEnd("ctx");
  3580. var $1;
  3581. $1=self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  3582. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3583. return smalltalk.withContext(function($ctx2) {
  3584. //>>excludeEnd("ctx");
  3585. self._basicDelete_(aKey);
  3586. return removed;
  3587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3588. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  3589. //>>excludeEnd("ctx");
  3590. }),(function(){
  3591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3592. return smalltalk.withContext(function($ctx2) {
  3593. //>>excludeEnd("ctx");
  3594. return _st(aBlock)._value();
  3595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  3597. //>>excludeEnd("ctx");
  3598. }));
  3599. return $1;
  3600. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3601. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},globals.HashedCollection)});
  3602. //>>excludeEnd("ctx");
  3603. },
  3604. //>>excludeStart("ide", pragmas.excludeIdeData);
  3605. args: ["aKey", "aBlock"],
  3606. 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 ]",
  3607. referencedClasses: [],
  3608. //>>excludeEnd("ide");
  3609. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  3610. }),
  3611. globals.HashedCollection);
  3612. smalltalk.addMethod(
  3613. smalltalk.method({
  3614. selector: "values",
  3615. protocol: 'accessing',
  3616. fn: function (){
  3617. var self=this;
  3618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3619. return smalltalk.withContext(function($ctx1) {
  3620. //>>excludeEnd("ctx");
  3621. return self._keys().map(function(key){
  3622. return self._at_(key);
  3623. });
  3624. ;
  3625. return self;
  3626. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3627. }, function($ctx1) {$ctx1.fill(self,"values",{},globals.HashedCollection)});
  3628. //>>excludeEnd("ctx");
  3629. },
  3630. //>>excludeStart("ide", pragmas.excludeIdeData);
  3631. args: [],
  3632. source: "values\x0a\x09<\x0a\x09\x09return self._keys().map(function(key){\x0a\x09\x09\x09return self._at_(key);\x0a\x09\x09});\x0a\x09>",
  3633. referencedClasses: [],
  3634. //>>excludeEnd("ide");
  3635. messageSends: []
  3636. }),
  3637. globals.HashedCollection);
  3638. smalltalk.addMethod(
  3639. smalltalk.method({
  3640. selector: "valuesDo:",
  3641. protocol: 'enumerating',
  3642. fn: function (aBlock){
  3643. var self=this;
  3644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3645. return smalltalk.withContext(function($ctx1) {
  3646. //>>excludeEnd("ctx");
  3647. _st(self._values())._do_(aBlock);
  3648. return self;
  3649. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3650. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},globals.HashedCollection)});
  3651. //>>excludeEnd("ctx");
  3652. },
  3653. //>>excludeStart("ide", pragmas.excludeIdeData);
  3654. args: ["aBlock"],
  3655. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  3656. referencedClasses: [],
  3657. //>>excludeEnd("ide");
  3658. messageSends: ["do:", "values"]
  3659. }),
  3660. globals.HashedCollection);
  3661. smalltalk.addClass('SequenceableCollection', globals.IndexableCollection, [], 'Kernel-Collections');
  3662. //>>excludeStart("ide", pragmas.excludeIdeData);
  3663. globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  3664. //>>excludeEnd("ide");
  3665. smalltalk.addMethod(
  3666. smalltalk.method({
  3667. selector: "=",
  3668. protocol: 'comparing',
  3669. fn: function (aCollection){
  3670. var self=this;
  3671. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3672. return smalltalk.withContext(function($ctx1) {
  3673. //>>excludeEnd("ctx");
  3674. var $3,$2,$4,$1,$5;
  3675. var $early={};
  3676. try {
  3677. $3=self._class();
  3678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3679. $ctx1.sendIdx["class"]=1;
  3680. //>>excludeEnd("ctx");
  3681. $2=_st($3).__eq(_st(aCollection)._class());
  3682. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3683. $ctx1.sendIdx["="]=1;
  3684. //>>excludeEnd("ctx");
  3685. $1=_st($2)._and_((function(){
  3686. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3687. return smalltalk.withContext(function($ctx2) {
  3688. //>>excludeEnd("ctx");
  3689. $4=self._size();
  3690. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3691. $ctx2.sendIdx["size"]=1;
  3692. //>>excludeEnd("ctx");
  3693. return _st($4).__eq(_st(aCollection)._size());
  3694. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3695. $ctx2.sendIdx["="]=2;
  3696. //>>excludeEnd("ctx");
  3697. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  3699. //>>excludeEnd("ctx");
  3700. }));
  3701. if(! smalltalk.assert($1)){
  3702. return false;
  3703. };
  3704. self._withIndexDo_((function(each,i){
  3705. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3706. return smalltalk.withContext(function($ctx2) {
  3707. //>>excludeEnd("ctx");
  3708. $5=_st(_st(aCollection)._at_(i)).__eq(each);
  3709. if(! smalltalk.assert($5)){
  3710. throw $early=[false];
  3711. };
  3712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3713. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  3714. //>>excludeEnd("ctx");
  3715. }));
  3716. return true;
  3717. }
  3718. catch(e) {if(e===$early)return e[0]; throw e}
  3719. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3720. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.SequenceableCollection)});
  3721. //>>excludeEnd("ctx");
  3722. },
  3723. //>>excludeStart("ide", pragmas.excludeIdeData);
  3724. args: ["aCollection"],
  3725. 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",
  3726. referencedClasses: [],
  3727. //>>excludeEnd("ide");
  3728. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  3729. }),
  3730. globals.SequenceableCollection);
  3731. smalltalk.addMethod(
  3732. smalltalk.method({
  3733. selector: "addLast:",
  3734. protocol: 'adding/removing',
  3735. fn: function (anObject){
  3736. var self=this;
  3737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3738. return smalltalk.withContext(function($ctx1) {
  3739. //>>excludeEnd("ctx");
  3740. self._add_(anObject);
  3741. return self;
  3742. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3743. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},globals.SequenceableCollection)});
  3744. //>>excludeEnd("ctx");
  3745. },
  3746. //>>excludeStart("ide", pragmas.excludeIdeData);
  3747. args: ["anObject"],
  3748. source: "addLast: anObject\x0a\x09self add: anObject",
  3749. referencedClasses: [],
  3750. //>>excludeEnd("ide");
  3751. messageSends: ["add:"]
  3752. }),
  3753. globals.SequenceableCollection);
  3754. smalltalk.addMethod(
  3755. smalltalk.method({
  3756. selector: "allButFirst",
  3757. protocol: 'accessing',
  3758. fn: function (){
  3759. var self=this;
  3760. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3761. return smalltalk.withContext(function($ctx1) {
  3762. //>>excludeEnd("ctx");
  3763. var $1;
  3764. $1=self._copyFrom_to_((2),self._size());
  3765. return $1;
  3766. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3767. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},globals.SequenceableCollection)});
  3768. //>>excludeEnd("ctx");
  3769. },
  3770. //>>excludeStart("ide", pragmas.excludeIdeData);
  3771. args: [],
  3772. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  3773. referencedClasses: [],
  3774. //>>excludeEnd("ide");
  3775. messageSends: ["copyFrom:to:", "size"]
  3776. }),
  3777. globals.SequenceableCollection);
  3778. smalltalk.addMethod(
  3779. smalltalk.method({
  3780. selector: "allButLast",
  3781. protocol: 'accessing',
  3782. fn: function (){
  3783. var self=this;
  3784. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3785. return smalltalk.withContext(function($ctx1) {
  3786. //>>excludeEnd("ctx");
  3787. var $1;
  3788. $1=self._copyFrom_to_((1),_st(self._size()).__minus((1)));
  3789. return $1;
  3790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3791. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},globals.SequenceableCollection)});
  3792. //>>excludeEnd("ctx");
  3793. },
  3794. //>>excludeStart("ide", pragmas.excludeIdeData);
  3795. args: [],
  3796. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  3797. referencedClasses: [],
  3798. //>>excludeEnd("ide");
  3799. messageSends: ["copyFrom:to:", "-", "size"]
  3800. }),
  3801. globals.SequenceableCollection);
  3802. smalltalk.addMethod(
  3803. smalltalk.method({
  3804. selector: "atRandom",
  3805. protocol: 'accessing',
  3806. fn: function (){
  3807. var self=this;
  3808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3809. return smalltalk.withContext(function($ctx1) {
  3810. //>>excludeEnd("ctx");
  3811. var $1;
  3812. $1=self._at_(_st(self._size())._atRandom());
  3813. return $1;
  3814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3815. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},globals.SequenceableCollection)});
  3816. //>>excludeEnd("ctx");
  3817. },
  3818. //>>excludeStart("ide", pragmas.excludeIdeData);
  3819. args: [],
  3820. source: "atRandom\x0a\x09^ self at: self size atRandom",
  3821. referencedClasses: [],
  3822. //>>excludeEnd("ide");
  3823. messageSends: ["at:", "atRandom", "size"]
  3824. }),
  3825. globals.SequenceableCollection);
  3826. smalltalk.addMethod(
  3827. smalltalk.method({
  3828. selector: "beginsWith:",
  3829. protocol: 'testing',
  3830. fn: function (prefix){
  3831. var self=this;
  3832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3833. return smalltalk.withContext(function($ctx1) {
  3834. //>>excludeEnd("ctx");
  3835. var $2,$3,$1,$4;
  3836. $2=self._size();
  3837. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3838. $ctx1.sendIdx["size"]=1;
  3839. //>>excludeEnd("ctx");
  3840. $3=_st(prefix)._size();
  3841. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3842. $ctx1.sendIdx["size"]=2;
  3843. //>>excludeEnd("ctx");
  3844. $1=_st($2).__lt($3);
  3845. if(smalltalk.assert($1)){
  3846. return false;
  3847. };
  3848. $4=_st(self._first_(_st(prefix)._size())).__eq(prefix);
  3849. return $4;
  3850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3851. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},globals.SequenceableCollection)});
  3852. //>>excludeEnd("ctx");
  3853. },
  3854. //>>excludeStart("ide", pragmas.excludeIdeData);
  3855. args: ["prefix"],
  3856. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  3857. referencedClasses: [],
  3858. //>>excludeEnd("ide");
  3859. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  3860. }),
  3861. globals.SequenceableCollection);
  3862. smalltalk.addMethod(
  3863. smalltalk.method({
  3864. selector: "copyFrom:to:",
  3865. protocol: 'copying',
  3866. fn: function (anIndex,anotherIndex){
  3867. var self=this;
  3868. var range,newCollection;
  3869. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3870. return smalltalk.withContext(function($ctx1) {
  3871. //>>excludeEnd("ctx");
  3872. var $1;
  3873. range=_st(anIndex)._to_(anotherIndex);
  3874. newCollection=_st(self._class())._new_(_st(range)._size());
  3875. _st(range)._withIndexDo_((function(each,i){
  3876. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3877. return smalltalk.withContext(function($ctx2) {
  3878. //>>excludeEnd("ctx");
  3879. return _st(newCollection)._at_put_(i,self._at_(each));
  3880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3881. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  3882. //>>excludeEnd("ctx");
  3883. }));
  3884. $1=newCollection;
  3885. return $1;
  3886. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3887. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection},globals.SequenceableCollection)});
  3888. //>>excludeEnd("ctx");
  3889. },
  3890. //>>excludeStart("ide", pragmas.excludeIdeData);
  3891. args: ["anIndex", "anotherIndex"],
  3892. source: "copyFrom: anIndex to: anotherIndex\x0a\x09| range newCollection |\x0a\x09range := anIndex to: anotherIndex.\x0a\x09newCollection := self class new: range size.\x0a\x09range withIndexDo: [ :each :i |\x0a\x09\x09newCollection at: i put: (self at: each) ].\x0a\x09^ newCollection",
  3893. referencedClasses: [],
  3894. //>>excludeEnd("ide");
  3895. messageSends: ["to:", "new:", "class", "size", "withIndexDo:", "at:put:", "at:"]
  3896. }),
  3897. globals.SequenceableCollection);
  3898. smalltalk.addMethod(
  3899. smalltalk.method({
  3900. selector: "deepCopy",
  3901. protocol: 'copying',
  3902. fn: function (){
  3903. var self=this;
  3904. var newCollection;
  3905. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3906. return smalltalk.withContext(function($ctx1) {
  3907. //>>excludeEnd("ctx");
  3908. var $1;
  3909. newCollection=_st(self._class())._new_(self._size());
  3910. self._withIndexDo_((function(each,index){
  3911. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3912. return smalltalk.withContext(function($ctx2) {
  3913. //>>excludeEnd("ctx");
  3914. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  3915. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3916. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  3917. //>>excludeEnd("ctx");
  3918. }));
  3919. $1=newCollection;
  3920. return $1;
  3921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3922. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection},globals.SequenceableCollection)});
  3923. //>>excludeEnd("ctx");
  3924. },
  3925. //>>excludeStart("ide", pragmas.excludeIdeData);
  3926. args: [],
  3927. source: "deepCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each deepCopy ].\x0a\x09^ newCollection",
  3928. referencedClasses: [],
  3929. //>>excludeEnd("ide");
  3930. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:", "deepCopy"]
  3931. }),
  3932. globals.SequenceableCollection);
  3933. smalltalk.addMethod(
  3934. smalltalk.method({
  3935. selector: "detect:ifNone:",
  3936. protocol: 'enumerating',
  3937. fn: function (aBlock,anotherBlock){
  3938. var self=this;
  3939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3940. return smalltalk.withContext(function($ctx1) {
  3941. //>>excludeEnd("ctx");
  3942. self = self._numericallyIndexable();
  3943. for(var i = 0; i < self.length; i++)
  3944. if(aBlock._value_(self[i]))
  3945. return self[i];
  3946. return anotherBlock._value();
  3947. ;
  3948. return self;
  3949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3950. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.SequenceableCollection)});
  3951. //>>excludeEnd("ctx");
  3952. },
  3953. //>>excludeStart("ide", pragmas.excludeIdeData);
  3954. args: ["aBlock", "anotherBlock"],
  3955. 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>",
  3956. referencedClasses: [],
  3957. //>>excludeEnd("ide");
  3958. messageSends: []
  3959. }),
  3960. globals.SequenceableCollection);
  3961. smalltalk.addMethod(
  3962. smalltalk.method({
  3963. selector: "do:",
  3964. protocol: 'enumerating',
  3965. fn: function (aBlock){
  3966. var self=this;
  3967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3968. return smalltalk.withContext(function($ctx1) {
  3969. //>>excludeEnd("ctx");
  3970. self = self._numericallyIndexable();
  3971. for(var i=0; i < self.length; i++) {
  3972. aBlock._value_(self[i]);
  3973. }
  3974. ;
  3975. return self;
  3976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3977. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.SequenceableCollection)});
  3978. //>>excludeEnd("ctx");
  3979. },
  3980. //>>excludeStart("ide", pragmas.excludeIdeData);
  3981. args: ["aBlock"],
  3982. 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>",
  3983. referencedClasses: [],
  3984. //>>excludeEnd("ide");
  3985. messageSends: []
  3986. }),
  3987. globals.SequenceableCollection);
  3988. smalltalk.addMethod(
  3989. smalltalk.method({
  3990. selector: "endsWith:",
  3991. protocol: 'testing',
  3992. fn: function (suffix){
  3993. var self=this;
  3994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  3995. return smalltalk.withContext(function($ctx1) {
  3996. //>>excludeEnd("ctx");
  3997. var $2,$3,$1,$4;
  3998. $2=self._size();
  3999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4000. $ctx1.sendIdx["size"]=1;
  4001. //>>excludeEnd("ctx");
  4002. $3=_st(suffix)._size();
  4003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4004. $ctx1.sendIdx["size"]=2;
  4005. //>>excludeEnd("ctx");
  4006. $1=_st($2).__lt($3);
  4007. if(smalltalk.assert($1)){
  4008. return false;
  4009. };
  4010. $4=_st(self._last_(_st(suffix)._size())).__eq(suffix);
  4011. return $4;
  4012. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4013. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},globals.SequenceableCollection)});
  4014. //>>excludeEnd("ctx");
  4015. },
  4016. //>>excludeStart("ide", pragmas.excludeIdeData);
  4017. args: ["suffix"],
  4018. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  4019. referencedClasses: [],
  4020. //>>excludeEnd("ide");
  4021. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  4022. }),
  4023. globals.SequenceableCollection);
  4024. smalltalk.addMethod(
  4025. smalltalk.method({
  4026. selector: "first",
  4027. protocol: 'accessing',
  4028. fn: function (){
  4029. var self=this;
  4030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4031. return smalltalk.withContext(function($ctx1) {
  4032. //>>excludeEnd("ctx");
  4033. var $1;
  4034. $1=self._at_((1));
  4035. return $1;
  4036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4037. }, function($ctx1) {$ctx1.fill(self,"first",{},globals.SequenceableCollection)});
  4038. //>>excludeEnd("ctx");
  4039. },
  4040. //>>excludeStart("ide", pragmas.excludeIdeData);
  4041. args: [],
  4042. source: "first\x0a\x09^ self at: 1",
  4043. referencedClasses: [],
  4044. //>>excludeEnd("ide");
  4045. messageSends: ["at:"]
  4046. }),
  4047. globals.SequenceableCollection);
  4048. smalltalk.addMethod(
  4049. smalltalk.method({
  4050. selector: "first:",
  4051. protocol: 'accessing',
  4052. fn: function (aNumber){
  4053. var self=this;
  4054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4055. return smalltalk.withContext(function($ctx1) {
  4056. //>>excludeEnd("ctx");
  4057. var $1,$2;
  4058. $1=_st(self._size()).__lt(aNumber);
  4059. if(smalltalk.assert($1)){
  4060. self._error_("Invalid number of elements");
  4061. };
  4062. $2=self._copyFrom_to_((1),aNumber);
  4063. return $2;
  4064. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4065. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},globals.SequenceableCollection)});
  4066. //>>excludeEnd("ctx");
  4067. },
  4068. //>>excludeStart("ide", pragmas.excludeIdeData);
  4069. args: ["aNumber"],
  4070. 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",
  4071. referencedClasses: [],
  4072. //>>excludeEnd("ide");
  4073. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  4074. }),
  4075. globals.SequenceableCollection);
  4076. smalltalk.addMethod(
  4077. smalltalk.method({
  4078. selector: "fourth",
  4079. protocol: 'accessing',
  4080. fn: function (){
  4081. var self=this;
  4082. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4083. return smalltalk.withContext(function($ctx1) {
  4084. //>>excludeEnd("ctx");
  4085. var $1;
  4086. $1=self._at_((4));
  4087. return $1;
  4088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4089. }, function($ctx1) {$ctx1.fill(self,"fourth",{},globals.SequenceableCollection)});
  4090. //>>excludeEnd("ctx");
  4091. },
  4092. //>>excludeStart("ide", pragmas.excludeIdeData);
  4093. args: [],
  4094. source: "fourth\x0a\x09^ self at: 4",
  4095. referencedClasses: [],
  4096. //>>excludeEnd("ide");
  4097. messageSends: ["at:"]
  4098. }),
  4099. globals.SequenceableCollection);
  4100. smalltalk.addMethod(
  4101. smalltalk.method({
  4102. selector: "includes:",
  4103. protocol: 'testing',
  4104. fn: function (anObject){
  4105. var self=this;
  4106. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4107. return smalltalk.withContext(function($ctx1) {
  4108. //>>excludeEnd("ctx");
  4109. var $1;
  4110. $1=_st(self._indexOf_ifAbsent_(anObject,(function(){
  4111. return nil;
  4112. })))._notNil();
  4113. return $1;
  4114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4115. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},globals.SequenceableCollection)});
  4116. //>>excludeEnd("ctx");
  4117. },
  4118. //>>excludeStart("ide", pragmas.excludeIdeData);
  4119. args: ["anObject"],
  4120. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  4121. referencedClasses: [],
  4122. //>>excludeEnd("ide");
  4123. messageSends: ["notNil", "indexOf:ifAbsent:"]
  4124. }),
  4125. globals.SequenceableCollection);
  4126. smalltalk.addMethod(
  4127. smalltalk.method({
  4128. selector: "indexOf:ifAbsent:",
  4129. protocol: 'accessing',
  4130. fn: function (anObject,aBlock){
  4131. var self=this;
  4132. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4133. return smalltalk.withContext(function($ctx1) {
  4134. //>>excludeEnd("ctx");
  4135. self = self._numericallyIndexable();
  4136. for(var i=0; i < self.length; i++) {
  4137. if(_st(self[i]).__eq(anObject)) {return i+1}
  4138. };
  4139. return aBlock._value();
  4140. ;
  4141. return self;
  4142. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4143. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},globals.SequenceableCollection)});
  4144. //>>excludeEnd("ctx");
  4145. },
  4146. //>>excludeStart("ide", pragmas.excludeIdeData);
  4147. args: ["anObject", "aBlock"],
  4148. 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(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock._value();\x0a\x09>",
  4149. referencedClasses: [],
  4150. //>>excludeEnd("ide");
  4151. messageSends: []
  4152. }),
  4153. globals.SequenceableCollection);
  4154. smalltalk.addMethod(
  4155. smalltalk.method({
  4156. selector: "indexOf:startingAt:",
  4157. protocol: 'accessing',
  4158. fn: function (anObject,start){
  4159. var self=this;
  4160. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4161. return smalltalk.withContext(function($ctx1) {
  4162. //>>excludeEnd("ctx");
  4163. var $1;
  4164. $1=self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  4165. return (0);
  4166. }));
  4167. return $1;
  4168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4169. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},globals.SequenceableCollection)});
  4170. //>>excludeEnd("ctx");
  4171. },
  4172. //>>excludeStart("ide", pragmas.excludeIdeData);
  4173. args: ["anObject", "start"],
  4174. 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 ]",
  4175. referencedClasses: [],
  4176. //>>excludeEnd("ide");
  4177. messageSends: ["indexOf:startingAt:ifAbsent:"]
  4178. }),
  4179. globals.SequenceableCollection);
  4180. smalltalk.addMethod(
  4181. smalltalk.method({
  4182. selector: "indexOf:startingAt:ifAbsent:",
  4183. protocol: 'accessing',
  4184. fn: function (anObject,start,aBlock){
  4185. var self=this;
  4186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4187. return smalltalk.withContext(function($ctx1) {
  4188. //>>excludeEnd("ctx");
  4189. self = self._numericallyIndexable();
  4190. for(var i=start - 1; i < self.length; i++){
  4191. if(_st(self[i]).__eq(anObject)) {return i+1}
  4192. }
  4193. return aBlock._value();
  4194. ;
  4195. return self;
  4196. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4197. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},globals.SequenceableCollection)});
  4198. //>>excludeEnd("ctx");
  4199. },
  4200. //>>excludeStart("ide", pragmas.excludeIdeData);
  4201. args: ["anObject", "start", "aBlock"],
  4202. 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(_st(self[i]).__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock._value();\x0a\x09>",
  4203. referencedClasses: [],
  4204. //>>excludeEnd("ide");
  4205. messageSends: []
  4206. }),
  4207. globals.SequenceableCollection);
  4208. smalltalk.addMethod(
  4209. smalltalk.method({
  4210. selector: "last",
  4211. protocol: 'accessing',
  4212. fn: function (){
  4213. var self=this;
  4214. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4215. return smalltalk.withContext(function($ctx1) {
  4216. //>>excludeEnd("ctx");
  4217. var $1;
  4218. $1=self._at_(self._size());
  4219. return $1;
  4220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4221. }, function($ctx1) {$ctx1.fill(self,"last",{},globals.SequenceableCollection)});
  4222. //>>excludeEnd("ctx");
  4223. },
  4224. //>>excludeStart("ide", pragmas.excludeIdeData);
  4225. args: [],
  4226. source: "last\x0a\x09^ self at: self size",
  4227. referencedClasses: [],
  4228. //>>excludeEnd("ide");
  4229. messageSends: ["at:", "size"]
  4230. }),
  4231. globals.SequenceableCollection);
  4232. smalltalk.addMethod(
  4233. smalltalk.method({
  4234. selector: "last:",
  4235. protocol: 'accessing',
  4236. fn: function (aNumber){
  4237. var self=this;
  4238. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4239. return smalltalk.withContext(function($ctx1) {
  4240. //>>excludeEnd("ctx");
  4241. var $2,$1,$6,$5,$4,$3;
  4242. $2=self._size();
  4243. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4244. $ctx1.sendIdx["size"]=1;
  4245. //>>excludeEnd("ctx");
  4246. $1=_st($2).__lt(aNumber);
  4247. if(smalltalk.assert($1)){
  4248. self._error_("Invalid number of elements");
  4249. };
  4250. $6=self._size();
  4251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4252. $ctx1.sendIdx["size"]=2;
  4253. //>>excludeEnd("ctx");
  4254. $5=_st($6).__minus(aNumber);
  4255. $4=_st($5).__plus((1));
  4256. $3=self._copyFrom_to_($4,self._size());
  4257. return $3;
  4258. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4259. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},globals.SequenceableCollection)});
  4260. //>>excludeEnd("ctx");
  4261. },
  4262. //>>excludeStart("ide", pragmas.excludeIdeData);
  4263. args: ["aNumber"],
  4264. 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",
  4265. referencedClasses: [],
  4266. //>>excludeEnd("ide");
  4267. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  4268. }),
  4269. globals.SequenceableCollection);
  4270. smalltalk.addMethod(
  4271. smalltalk.method({
  4272. selector: "newStream",
  4273. protocol: 'streaming',
  4274. fn: function (){
  4275. var self=this;
  4276. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4277. return smalltalk.withContext(function($ctx1) {
  4278. //>>excludeEnd("ctx");
  4279. var $1;
  4280. $1=_st(self._streamClass())._on_(self);
  4281. return $1;
  4282. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4283. }, function($ctx1) {$ctx1.fill(self,"newStream",{},globals.SequenceableCollection)});
  4284. //>>excludeEnd("ctx");
  4285. },
  4286. //>>excludeStart("ide", pragmas.excludeIdeData);
  4287. args: [],
  4288. source: "newStream\x0a\x09^ self streamClass on: self",
  4289. referencedClasses: [],
  4290. //>>excludeEnd("ide");
  4291. messageSends: ["on:", "streamClass"]
  4292. }),
  4293. globals.SequenceableCollection);
  4294. smalltalk.addMethod(
  4295. smalltalk.method({
  4296. selector: "numericallyIndexable",
  4297. protocol: 'private',
  4298. fn: function (){
  4299. var self=this;
  4300. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4301. return smalltalk.withContext(function($ctx1) {
  4302. //>>excludeEnd("ctx");
  4303. self._subclassResponsibility();
  4304. return self;
  4305. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4306. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.SequenceableCollection)});
  4307. //>>excludeEnd("ctx");
  4308. },
  4309. //>>excludeStart("ide", pragmas.excludeIdeData);
  4310. args: [],
  4311. 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",
  4312. referencedClasses: [],
  4313. //>>excludeEnd("ide");
  4314. messageSends: ["subclassResponsibility"]
  4315. }),
  4316. globals.SequenceableCollection);
  4317. smalltalk.addMethod(
  4318. smalltalk.method({
  4319. selector: "readStream",
  4320. protocol: 'streaming',
  4321. fn: function (){
  4322. var self=this;
  4323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4324. return smalltalk.withContext(function($ctx1) {
  4325. //>>excludeEnd("ctx");
  4326. var $1;
  4327. $1=self._stream();
  4328. return $1;
  4329. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4330. }, function($ctx1) {$ctx1.fill(self,"readStream",{},globals.SequenceableCollection)});
  4331. //>>excludeEnd("ctx");
  4332. },
  4333. //>>excludeStart("ide", pragmas.excludeIdeData);
  4334. args: [],
  4335. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4336. referencedClasses: [],
  4337. //>>excludeEnd("ide");
  4338. messageSends: ["stream"]
  4339. }),
  4340. globals.SequenceableCollection);
  4341. smalltalk.addMethod(
  4342. smalltalk.method({
  4343. selector: "removeLast",
  4344. protocol: 'adding/removing',
  4345. fn: function (){
  4346. var self=this;
  4347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4348. return smalltalk.withContext(function($ctx1) {
  4349. //>>excludeEnd("ctx");
  4350. var $1;
  4351. $1=self._remove_(self._last());
  4352. return $1;
  4353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4354. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.SequenceableCollection)});
  4355. //>>excludeEnd("ctx");
  4356. },
  4357. //>>excludeStart("ide", pragmas.excludeIdeData);
  4358. args: [],
  4359. source: "removeLast\x0a\x09^ self remove: self last",
  4360. referencedClasses: [],
  4361. //>>excludeEnd("ide");
  4362. messageSends: ["remove:", "last"]
  4363. }),
  4364. globals.SequenceableCollection);
  4365. smalltalk.addMethod(
  4366. smalltalk.method({
  4367. selector: "reversed",
  4368. protocol: 'converting',
  4369. fn: function (){
  4370. var self=this;
  4371. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4372. return smalltalk.withContext(function($ctx1) {
  4373. //>>excludeEnd("ctx");
  4374. self._subclassResponsibility();
  4375. return self;
  4376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4377. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.SequenceableCollection)});
  4378. //>>excludeEnd("ctx");
  4379. },
  4380. //>>excludeStart("ide", pragmas.excludeIdeData);
  4381. args: [],
  4382. source: "reversed\x0a\x09self subclassResponsibility",
  4383. referencedClasses: [],
  4384. //>>excludeEnd("ide");
  4385. messageSends: ["subclassResponsibility"]
  4386. }),
  4387. globals.SequenceableCollection);
  4388. smalltalk.addMethod(
  4389. smalltalk.method({
  4390. selector: "second",
  4391. protocol: 'accessing',
  4392. fn: function (){
  4393. var self=this;
  4394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4395. return smalltalk.withContext(function($ctx1) {
  4396. //>>excludeEnd("ctx");
  4397. var $1;
  4398. $1=self._at_((2));
  4399. return $1;
  4400. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4401. }, function($ctx1) {$ctx1.fill(self,"second",{},globals.SequenceableCollection)});
  4402. //>>excludeEnd("ctx");
  4403. },
  4404. //>>excludeStart("ide", pragmas.excludeIdeData);
  4405. args: [],
  4406. source: "second\x0a\x09^ self at: 2",
  4407. referencedClasses: [],
  4408. //>>excludeEnd("ide");
  4409. messageSends: ["at:"]
  4410. }),
  4411. globals.SequenceableCollection);
  4412. smalltalk.addMethod(
  4413. smalltalk.method({
  4414. selector: "shallowCopy",
  4415. protocol: 'copying',
  4416. fn: function (){
  4417. var self=this;
  4418. var newCollection;
  4419. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4420. return smalltalk.withContext(function($ctx1) {
  4421. //>>excludeEnd("ctx");
  4422. var $1;
  4423. newCollection=_st(self._class())._new_(self._size());
  4424. self._withIndexDo_((function(each,index){
  4425. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4426. return smalltalk.withContext(function($ctx2) {
  4427. //>>excludeEnd("ctx");
  4428. return _st(newCollection)._at_put_(index,each);
  4429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4430. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  4431. //>>excludeEnd("ctx");
  4432. }));
  4433. $1=newCollection;
  4434. return $1;
  4435. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4436. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection},globals.SequenceableCollection)});
  4437. //>>excludeEnd("ctx");
  4438. },
  4439. //>>excludeStart("ide", pragmas.excludeIdeData);
  4440. args: [],
  4441. source: "shallowCopy\x0a\x09| newCollection |\x0a\x09newCollection := self class new: self size.\x0a\x09self withIndexDo: [ :each :index |\x0a\x09\x09newCollection at: index put: each ].\x0a\x09^ newCollection",
  4442. referencedClasses: [],
  4443. //>>excludeEnd("ide");
  4444. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"]
  4445. }),
  4446. globals.SequenceableCollection);
  4447. smalltalk.addMethod(
  4448. smalltalk.method({
  4449. selector: "stream",
  4450. protocol: 'streaming',
  4451. fn: function (){
  4452. var self=this;
  4453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4454. return smalltalk.withContext(function($ctx1) {
  4455. //>>excludeEnd("ctx");
  4456. var $1;
  4457. $1=self._newStream();
  4458. return $1;
  4459. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4460. }, function($ctx1) {$ctx1.fill(self,"stream",{},globals.SequenceableCollection)});
  4461. //>>excludeEnd("ctx");
  4462. },
  4463. //>>excludeStart("ide", pragmas.excludeIdeData);
  4464. args: [],
  4465. source: "stream\x0a\x09^ self newStream",
  4466. referencedClasses: [],
  4467. //>>excludeEnd("ide");
  4468. messageSends: ["newStream"]
  4469. }),
  4470. globals.SequenceableCollection);
  4471. smalltalk.addMethod(
  4472. smalltalk.method({
  4473. selector: "streamClass",
  4474. protocol: 'streaming',
  4475. fn: function (){
  4476. var self=this;
  4477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4478. return smalltalk.withContext(function($ctx1) {
  4479. //>>excludeEnd("ctx");
  4480. var $1;
  4481. $1=_st(self._class())._streamClass();
  4482. return $1;
  4483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4484. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},globals.SequenceableCollection)});
  4485. //>>excludeEnd("ctx");
  4486. },
  4487. //>>excludeStart("ide", pragmas.excludeIdeData);
  4488. args: [],
  4489. source: "streamClass\x0a\x09^ self class streamClass",
  4490. referencedClasses: [],
  4491. //>>excludeEnd("ide");
  4492. messageSends: ["streamClass", "class"]
  4493. }),
  4494. globals.SequenceableCollection);
  4495. smalltalk.addMethod(
  4496. smalltalk.method({
  4497. selector: "third",
  4498. protocol: 'accessing',
  4499. fn: function (){
  4500. var self=this;
  4501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4502. return smalltalk.withContext(function($ctx1) {
  4503. //>>excludeEnd("ctx");
  4504. var $1;
  4505. $1=self._at_((3));
  4506. return $1;
  4507. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4508. }, function($ctx1) {$ctx1.fill(self,"third",{},globals.SequenceableCollection)});
  4509. //>>excludeEnd("ctx");
  4510. },
  4511. //>>excludeStart("ide", pragmas.excludeIdeData);
  4512. args: [],
  4513. source: "third\x0a\x09^ self at: 3",
  4514. referencedClasses: [],
  4515. //>>excludeEnd("ide");
  4516. messageSends: ["at:"]
  4517. }),
  4518. globals.SequenceableCollection);
  4519. smalltalk.addMethod(
  4520. smalltalk.method({
  4521. selector: "with:do:",
  4522. protocol: 'enumerating',
  4523. fn: function (anotherCollection,aBlock){
  4524. var self=this;
  4525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4526. return smalltalk.withContext(function($ctx1) {
  4527. //>>excludeEnd("ctx");
  4528. self = self._numericallyIndexable();
  4529. anotherCollection = anotherCollection._numericallyIndexable();
  4530. for(var i=0; i<self.length; i++) {
  4531. aBlock._value_value_(self[i], anotherCollection[i]);
  4532. }
  4533. ;
  4534. return self;
  4535. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4536. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},globals.SequenceableCollection)});
  4537. //>>excludeEnd("ctx");
  4538. },
  4539. //>>excludeStart("ide", pragmas.excludeIdeData);
  4540. args: ["anotherCollection", "aBlock"],
  4541. 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>",
  4542. referencedClasses: [],
  4543. //>>excludeEnd("ide");
  4544. messageSends: []
  4545. }),
  4546. globals.SequenceableCollection);
  4547. smalltalk.addMethod(
  4548. smalltalk.method({
  4549. selector: "withIndexDo:",
  4550. protocol: 'enumerating',
  4551. fn: function (aBlock){
  4552. var self=this;
  4553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4554. return smalltalk.withContext(function($ctx1) {
  4555. //>>excludeEnd("ctx");
  4556. self = self._numericallyIndexable();
  4557. for(var i=0; i < self.length; i++) {
  4558. aBlock._value_value_(self[i], i+1);
  4559. }
  4560. ;
  4561. return self;
  4562. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4563. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},globals.SequenceableCollection)});
  4564. //>>excludeEnd("ctx");
  4565. },
  4566. //>>excludeStart("ide", pragmas.excludeIdeData);
  4567. args: ["aBlock"],
  4568. 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>",
  4569. referencedClasses: [],
  4570. //>>excludeEnd("ide");
  4571. messageSends: []
  4572. }),
  4573. globals.SequenceableCollection);
  4574. smalltalk.addMethod(
  4575. smalltalk.method({
  4576. selector: "writeStream",
  4577. protocol: 'streaming',
  4578. fn: function (){
  4579. var self=this;
  4580. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4581. return smalltalk.withContext(function($ctx1) {
  4582. //>>excludeEnd("ctx");
  4583. var $1;
  4584. $1=self._stream();
  4585. return $1;
  4586. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4587. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},globals.SequenceableCollection)});
  4588. //>>excludeEnd("ctx");
  4589. },
  4590. //>>excludeStart("ide", pragmas.excludeIdeData);
  4591. args: [],
  4592. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  4593. referencedClasses: [],
  4594. //>>excludeEnd("ide");
  4595. messageSends: ["stream"]
  4596. }),
  4597. globals.SequenceableCollection);
  4598. smalltalk.addMethod(
  4599. smalltalk.method({
  4600. selector: "streamClass",
  4601. protocol: 'accessing',
  4602. fn: function (){
  4603. var self=this;
  4604. function $Stream(){return globals.Stream||(typeof Stream=="undefined"?nil:Stream)}
  4605. return $Stream();
  4606. },
  4607. //>>excludeStart("ide", pragmas.excludeIdeData);
  4608. args: [],
  4609. source: "streamClass\x0a\x09\x09^ Stream",
  4610. referencedClasses: ["Stream"],
  4611. //>>excludeEnd("ide");
  4612. messageSends: []
  4613. }),
  4614. globals.SequenceableCollection.klass);
  4615. smalltalk.addMethod(
  4616. smalltalk.method({
  4617. selector: "streamContents:",
  4618. protocol: 'streaming',
  4619. fn: function (aBlock){
  4620. var self=this;
  4621. var stream;
  4622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4623. return smalltalk.withContext(function($ctx1) {
  4624. //>>excludeEnd("ctx");
  4625. var $1;
  4626. stream=_st(self._streamClass())._on_(self._new());
  4627. _st(aBlock)._value_(stream);
  4628. $1=_st(stream)._contents();
  4629. return $1;
  4630. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4631. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},globals.SequenceableCollection.klass)});
  4632. //>>excludeEnd("ctx");
  4633. },
  4634. //>>excludeStart("ide", pragmas.excludeIdeData);
  4635. args: ["aBlock"],
  4636. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  4637. referencedClasses: [],
  4638. //>>excludeEnd("ide");
  4639. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  4640. }),
  4641. globals.SequenceableCollection.klass);
  4642. smalltalk.addClass('Array', globals.SequenceableCollection, [], 'Kernel-Collections');
  4643. //>>excludeStart("ide", pragmas.excludeIdeData);
  4644. 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`.";
  4645. //>>excludeEnd("ide");
  4646. smalltalk.addMethod(
  4647. smalltalk.method({
  4648. selector: "add:",
  4649. protocol: 'adding/removing',
  4650. fn: function (anObject){
  4651. var self=this;
  4652. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4653. return smalltalk.withContext(function($ctx1) {
  4654. //>>excludeEnd("ctx");
  4655. self.push(anObject); return anObject;;
  4656. return self;
  4657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4658. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.Array)});
  4659. //>>excludeEnd("ctx");
  4660. },
  4661. //>>excludeStart("ide", pragmas.excludeIdeData);
  4662. args: ["anObject"],
  4663. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  4664. referencedClasses: [],
  4665. //>>excludeEnd("ide");
  4666. messageSends: []
  4667. }),
  4668. globals.Array);
  4669. smalltalk.addMethod(
  4670. smalltalk.method({
  4671. selector: "addFirst:",
  4672. protocol: 'adding/removing',
  4673. fn: function (anObject){
  4674. var self=this;
  4675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4676. return smalltalk.withContext(function($ctx1) {
  4677. //>>excludeEnd("ctx");
  4678. self.unshift(anObject); return anObject;;
  4679. return self;
  4680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4681. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},globals.Array)});
  4682. //>>excludeEnd("ctx");
  4683. },
  4684. //>>excludeStart("ide", pragmas.excludeIdeData);
  4685. args: ["anObject"],
  4686. source: "addFirst: anObject\x0a\x09<self.unshift(anObject); return anObject;>",
  4687. referencedClasses: [],
  4688. //>>excludeEnd("ide");
  4689. messageSends: []
  4690. }),
  4691. globals.Array);
  4692. smalltalk.addMethod(
  4693. smalltalk.method({
  4694. selector: "asJavascript",
  4695. protocol: 'converting',
  4696. fn: function (){
  4697. var self=this;
  4698. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4699. return smalltalk.withContext(function($ctx1) {
  4700. //>>excludeEnd("ctx");
  4701. var $1;
  4702. $1=_st("[".__comma(_st(self._collect_((function(each){
  4703. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4704. return smalltalk.withContext(function($ctx2) {
  4705. //>>excludeEnd("ctx");
  4706. return _st(each)._asJavascript();
  4707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4708. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4709. //>>excludeEnd("ctx");
  4710. })))._join_(", "))).__comma("]");
  4711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4712. $ctx1.sendIdx[","]=1;
  4713. //>>excludeEnd("ctx");
  4714. return $1;
  4715. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4716. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.Array)});
  4717. //>>excludeEnd("ctx");
  4718. },
  4719. //>>excludeStart("ide", pragmas.excludeIdeData);
  4720. args: [],
  4721. source: "asJavascript\x0a\x09^ '[', ((self collect: [:each | each asJavascript ]) join: ', '), ']'",
  4722. referencedClasses: [],
  4723. //>>excludeEnd("ide");
  4724. messageSends: [",", "join:", "collect:", "asJavascript"]
  4725. }),
  4726. globals.Array);
  4727. smalltalk.addMethod(
  4728. smalltalk.method({
  4729. selector: "at:ifAbsent:",
  4730. protocol: 'accessing',
  4731. fn: function (anIndex,aBlock){
  4732. var self=this;
  4733. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4734. return smalltalk.withContext(function($ctx1) {
  4735. //>>excludeEnd("ctx");
  4736. return anIndex >= 1 && anIndex <= self.length
  4737. ? self[anIndex - 1]
  4738. : aBlock._value()
  4739. ;
  4740. return self;
  4741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4742. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.Array)});
  4743. //>>excludeEnd("ctx");
  4744. },
  4745. //>>excludeStart("ide", pragmas.excludeIdeData);
  4746. args: ["anIndex", "aBlock"],
  4747. 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>",
  4748. referencedClasses: [],
  4749. //>>excludeEnd("ide");
  4750. messageSends: []
  4751. }),
  4752. globals.Array);
  4753. smalltalk.addMethod(
  4754. smalltalk.method({
  4755. selector: "at:ifPresent:ifAbsent:",
  4756. protocol: 'accessing',
  4757. fn: function (anIndex,aBlock,anotherBlock){
  4758. var self=this;
  4759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4760. return smalltalk.withContext(function($ctx1) {
  4761. //>>excludeEnd("ctx");
  4762. return anIndex >= 1 && anIndex <= self.length
  4763. ? aBlock._value_(self[anIndex - 1])
  4764. : anotherBlock._value()
  4765. ;
  4766. return self;
  4767. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4768. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.Array)});
  4769. //>>excludeEnd("ctx");
  4770. },
  4771. //>>excludeStart("ide", pragmas.excludeIdeData);
  4772. args: ["anIndex", "aBlock", "anotherBlock"],
  4773. 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>",
  4774. referencedClasses: [],
  4775. //>>excludeEnd("ide");
  4776. messageSends: []
  4777. }),
  4778. globals.Array);
  4779. smalltalk.addMethod(
  4780. smalltalk.method({
  4781. selector: "at:put:",
  4782. protocol: 'accessing',
  4783. fn: function (anIndex,anObject){
  4784. var self=this;
  4785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4786. return smalltalk.withContext(function($ctx1) {
  4787. //>>excludeEnd("ctx");
  4788. return self[anIndex - 1] = anObject;
  4789. return self;
  4790. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4791. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.Array)});
  4792. //>>excludeEnd("ctx");
  4793. },
  4794. //>>excludeStart("ide", pragmas.excludeIdeData);
  4795. args: ["anIndex", "anObject"],
  4796. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  4797. referencedClasses: [],
  4798. //>>excludeEnd("ide");
  4799. messageSends: []
  4800. }),
  4801. globals.Array);
  4802. smalltalk.addMethod(
  4803. smalltalk.method({
  4804. selector: "collect:",
  4805. protocol: 'enumerating',
  4806. fn: function (aBlock){
  4807. var self=this;
  4808. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4809. return smalltalk.withContext(function($ctx1) {
  4810. //>>excludeEnd("ctx");
  4811. return self.map(function(each) {return aBlock._value_(each)});
  4812. return self;
  4813. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4814. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},globals.Array)});
  4815. //>>excludeEnd("ctx");
  4816. },
  4817. //>>excludeStart("ide", pragmas.excludeIdeData);
  4818. args: ["aBlock"],
  4819. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<return self.map(function(each) {return aBlock._value_(each)})>",
  4820. referencedClasses: [],
  4821. //>>excludeEnd("ide");
  4822. messageSends: []
  4823. }),
  4824. globals.Array);
  4825. smalltalk.addMethod(
  4826. smalltalk.method({
  4827. selector: "join:",
  4828. protocol: 'enumerating',
  4829. fn: function (aString){
  4830. var self=this;
  4831. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4832. return smalltalk.withContext(function($ctx1) {
  4833. //>>excludeEnd("ctx");
  4834. return self.join(aString);
  4835. return self;
  4836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4837. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},globals.Array)});
  4838. //>>excludeEnd("ctx");
  4839. },
  4840. //>>excludeStart("ide", pragmas.excludeIdeData);
  4841. args: ["aString"],
  4842. source: "join: aString\x0a\x09<return self.join(aString)>",
  4843. referencedClasses: [],
  4844. //>>excludeEnd("ide");
  4845. messageSends: []
  4846. }),
  4847. globals.Array);
  4848. smalltalk.addMethod(
  4849. smalltalk.method({
  4850. selector: "numericallyIndexable",
  4851. protocol: 'private',
  4852. fn: function (){
  4853. var self=this;
  4854. return self;
  4855. },
  4856. //>>excludeStart("ide", pragmas.excludeIdeData);
  4857. args: [],
  4858. source: "numericallyIndexable\x0a\x09^ self",
  4859. referencedClasses: [],
  4860. //>>excludeEnd("ide");
  4861. messageSends: []
  4862. }),
  4863. globals.Array);
  4864. smalltalk.addMethod(
  4865. smalltalk.method({
  4866. selector: "printOn:",
  4867. protocol: 'printing',
  4868. fn: function (aStream){
  4869. var self=this;
  4870. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4871. return smalltalk.withContext(function($ctx1) {
  4872. //>>excludeEnd("ctx");
  4873. (
  4874. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4875. $ctx1.supercall = true,
  4876. //>>excludeEnd("ctx");
  4877. globals.Array.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  4878. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4879. $ctx1.supercall = false;
  4880. //>>excludeEnd("ctx");;
  4881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4882. $ctx1.sendIdx["printOn:"]=1;
  4883. //>>excludeEnd("ctx");
  4884. _st(aStream)._nextPutAll_(" (");
  4885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4886. $ctx1.sendIdx["nextPutAll:"]=1;
  4887. //>>excludeEnd("ctx");
  4888. self._do_separatedBy_((function(each){
  4889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4890. return smalltalk.withContext(function($ctx2) {
  4891. //>>excludeEnd("ctx");
  4892. return _st(each)._printOn_(aStream);
  4893. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4894. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  4895. //>>excludeEnd("ctx");
  4896. }),(function(){
  4897. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4898. return smalltalk.withContext(function($ctx2) {
  4899. //>>excludeEnd("ctx");
  4900. return _st(aStream)._nextPutAll_(" ");
  4901. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4902. $ctx2.sendIdx["nextPutAll:"]=2;
  4903. //>>excludeEnd("ctx");
  4904. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4905. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  4906. //>>excludeEnd("ctx");
  4907. }));
  4908. _st(aStream)._nextPutAll_(")");
  4909. return self;
  4910. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4911. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Array)});
  4912. //>>excludeEnd("ctx");
  4913. },
  4914. //>>excludeStart("ide", pragmas.excludeIdeData);
  4915. args: ["aStream"],
  4916. 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: ')'",
  4917. referencedClasses: [],
  4918. //>>excludeEnd("ide");
  4919. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  4920. }),
  4921. globals.Array);
  4922. smalltalk.addMethod(
  4923. smalltalk.method({
  4924. selector: "remove:ifAbsent:",
  4925. protocol: 'adding/removing',
  4926. fn: function (anObject,aBlock){
  4927. var self=this;
  4928. var index;
  4929. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4930. return smalltalk.withContext(function($ctx1) {
  4931. //>>excludeEnd("ctx");
  4932. var $2,$1;
  4933. index=self._indexOf_ifAbsent_(anObject,(function(){
  4934. return (0);
  4935. }));
  4936. $2=_st(index).__eq((0));
  4937. if(smalltalk.assert($2)){
  4938. $1=_st(aBlock)._value();
  4939. } else {
  4940. self._removeIndex_(index);
  4941. $1=anObject;
  4942. };
  4943. return $1;
  4944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4945. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},globals.Array)});
  4946. //>>excludeEnd("ctx");
  4947. },
  4948. //>>excludeStart("ide", pragmas.excludeIdeData);
  4949. args: ["anObject", "aBlock"],
  4950. 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 ]",
  4951. referencedClasses: [],
  4952. //>>excludeEnd("ide");
  4953. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  4954. }),
  4955. globals.Array);
  4956. smalltalk.addMethod(
  4957. smalltalk.method({
  4958. selector: "removeAll",
  4959. protocol: 'adding/removing',
  4960. fn: function (){
  4961. var self=this;
  4962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4963. return smalltalk.withContext(function($ctx1) {
  4964. //>>excludeEnd("ctx");
  4965. self.length = 0;
  4966. return self;
  4967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4968. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Array)});
  4969. //>>excludeEnd("ctx");
  4970. },
  4971. //>>excludeStart("ide", pragmas.excludeIdeData);
  4972. args: [],
  4973. source: "removeAll\x0a\x09<self.length = 0>",
  4974. referencedClasses: [],
  4975. //>>excludeEnd("ide");
  4976. messageSends: []
  4977. }),
  4978. globals.Array);
  4979. smalltalk.addMethod(
  4980. smalltalk.method({
  4981. selector: "removeFrom:to:",
  4982. protocol: 'adding/removing',
  4983. fn: function (aNumber,anotherNumber){
  4984. var self=this;
  4985. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4986. return smalltalk.withContext(function($ctx1) {
  4987. //>>excludeEnd("ctx");
  4988. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  4989. return self;
  4990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  4991. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},globals.Array)});
  4992. //>>excludeEnd("ctx");
  4993. },
  4994. //>>excludeStart("ide", pragmas.excludeIdeData);
  4995. args: ["aNumber", "anotherNumber"],
  4996. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber -1, anotherNumber - aNumber + 1)>",
  4997. referencedClasses: [],
  4998. //>>excludeEnd("ide");
  4999. messageSends: []
  5000. }),
  5001. globals.Array);
  5002. smalltalk.addMethod(
  5003. smalltalk.method({
  5004. selector: "removeIndex:",
  5005. protocol: 'adding/removing',
  5006. fn: function (anInteger){
  5007. var self=this;
  5008. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5009. return smalltalk.withContext(function($ctx1) {
  5010. //>>excludeEnd("ctx");
  5011. self.splice(anInteger - 1, 1);
  5012. return self;
  5013. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5014. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},globals.Array)});
  5015. //>>excludeEnd("ctx");
  5016. },
  5017. //>>excludeStart("ide", pragmas.excludeIdeData);
  5018. args: ["anInteger"],
  5019. source: "removeIndex: anInteger\x0a\x09<self.splice(anInteger - 1, 1)>",
  5020. referencedClasses: [],
  5021. //>>excludeEnd("ide");
  5022. messageSends: []
  5023. }),
  5024. globals.Array);
  5025. smalltalk.addMethod(
  5026. smalltalk.method({
  5027. selector: "removeLast",
  5028. protocol: 'adding/removing',
  5029. fn: function (){
  5030. var self=this;
  5031. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5032. return smalltalk.withContext(function($ctx1) {
  5033. //>>excludeEnd("ctx");
  5034. return self.pop();;
  5035. return self;
  5036. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5037. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},globals.Array)});
  5038. //>>excludeEnd("ctx");
  5039. },
  5040. //>>excludeStart("ide", pragmas.excludeIdeData);
  5041. args: [],
  5042. source: "removeLast\x0a\x09<return self.pop();>",
  5043. referencedClasses: [],
  5044. //>>excludeEnd("ide");
  5045. messageSends: []
  5046. }),
  5047. globals.Array);
  5048. smalltalk.addMethod(
  5049. smalltalk.method({
  5050. selector: "reversed",
  5051. protocol: 'converting',
  5052. fn: function (){
  5053. var self=this;
  5054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5055. return smalltalk.withContext(function($ctx1) {
  5056. //>>excludeEnd("ctx");
  5057. return self._copy().reverse();
  5058. return self;
  5059. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5060. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.Array)});
  5061. //>>excludeEnd("ctx");
  5062. },
  5063. //>>excludeStart("ide", pragmas.excludeIdeData);
  5064. args: [],
  5065. source: "reversed\x0a\x09<return self._copy().reverse()>",
  5066. referencedClasses: [],
  5067. //>>excludeEnd("ide");
  5068. messageSends: []
  5069. }),
  5070. globals.Array);
  5071. smalltalk.addMethod(
  5072. smalltalk.method({
  5073. selector: "select:",
  5074. protocol: 'enumerating',
  5075. fn: function (aBlock){
  5076. var self=this;
  5077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5078. return smalltalk.withContext(function($ctx1) {
  5079. //>>excludeEnd("ctx");
  5080. var result = self.klass._new();
  5081. for(var i=0; i<self.length; i++) {
  5082. if(aBlock._value_(self[i])) {
  5083. result.push(self[i]);
  5084. }
  5085. }
  5086. return result;
  5087. ;
  5088. return self;
  5089. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5090. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},globals.Array)});
  5091. //>>excludeEnd("ctx");
  5092. },
  5093. //>>excludeStart("ide", pragmas.excludeIdeData);
  5094. args: ["aBlock"],
  5095. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<\x0a\x09\x09var result = self.klass._new();\x0a\x09\x09for(var i=0; i<self.length; i++) {\x0a\x09\x09\x09if(aBlock._value_(self[i])) {\x0a\x09\x09\x09\x09result.push(self[i]);\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09return result;\x0a\x09>",
  5096. referencedClasses: [],
  5097. //>>excludeEnd("ide");
  5098. messageSends: []
  5099. }),
  5100. globals.Array);
  5101. smalltalk.addMethod(
  5102. smalltalk.method({
  5103. selector: "size",
  5104. protocol: 'accessing',
  5105. fn: function (){
  5106. var self=this;
  5107. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5108. return smalltalk.withContext(function($ctx1) {
  5109. //>>excludeEnd("ctx");
  5110. return self.length;
  5111. return self;
  5112. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5113. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Array)});
  5114. //>>excludeEnd("ctx");
  5115. },
  5116. //>>excludeStart("ide", pragmas.excludeIdeData);
  5117. args: [],
  5118. source: "size\x0a\x09<return self.length>",
  5119. referencedClasses: [],
  5120. //>>excludeEnd("ide");
  5121. messageSends: []
  5122. }),
  5123. globals.Array);
  5124. smalltalk.addMethod(
  5125. smalltalk.method({
  5126. selector: "sort",
  5127. protocol: 'enumerating',
  5128. fn: function (){
  5129. var self=this;
  5130. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5131. return smalltalk.withContext(function($ctx1) {
  5132. //>>excludeEnd("ctx");
  5133. var $1;
  5134. $1=self._sort_((function(a,b){
  5135. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5136. return smalltalk.withContext(function($ctx2) {
  5137. //>>excludeEnd("ctx");
  5138. return _st(a).__lt(b);
  5139. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5140. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  5141. //>>excludeEnd("ctx");
  5142. }));
  5143. return $1;
  5144. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5145. }, function($ctx1) {$ctx1.fill(self,"sort",{},globals.Array)});
  5146. //>>excludeEnd("ctx");
  5147. },
  5148. //>>excludeStart("ide", pragmas.excludeIdeData);
  5149. args: [],
  5150. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  5151. referencedClasses: [],
  5152. //>>excludeEnd("ide");
  5153. messageSends: ["sort:", "<"]
  5154. }),
  5155. globals.Array);
  5156. smalltalk.addMethod(
  5157. smalltalk.method({
  5158. selector: "sort:",
  5159. protocol: 'enumerating',
  5160. fn: function (aBlock){
  5161. var self=this;
  5162. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5163. return smalltalk.withContext(function($ctx1) {
  5164. //>>excludeEnd("ctx");
  5165. return self.sort(function(a, b) {
  5166. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  5167. })
  5168. ;
  5169. return self;
  5170. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5171. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},globals.Array)});
  5172. //>>excludeEnd("ctx");
  5173. },
  5174. //>>excludeStart("ide", pragmas.excludeIdeData);
  5175. args: ["aBlock"],
  5176. 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>",
  5177. referencedClasses: [],
  5178. //>>excludeEnd("ide");
  5179. messageSends: []
  5180. }),
  5181. globals.Array);
  5182. smalltalk.addMethod(
  5183. smalltalk.method({
  5184. selector: "sorted",
  5185. protocol: 'enumerating',
  5186. fn: function (){
  5187. var self=this;
  5188. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5189. return smalltalk.withContext(function($ctx1) {
  5190. //>>excludeEnd("ctx");
  5191. var $1;
  5192. $1=_st(self._copy())._sort();
  5193. return $1;
  5194. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5195. }, function($ctx1) {$ctx1.fill(self,"sorted",{},globals.Array)});
  5196. //>>excludeEnd("ctx");
  5197. },
  5198. //>>excludeStart("ide", pragmas.excludeIdeData);
  5199. args: [],
  5200. source: "sorted\x0a\x09^ self copy sort",
  5201. referencedClasses: [],
  5202. //>>excludeEnd("ide");
  5203. messageSends: ["sort", "copy"]
  5204. }),
  5205. globals.Array);
  5206. smalltalk.addMethod(
  5207. smalltalk.method({
  5208. selector: "sorted:",
  5209. protocol: 'enumerating',
  5210. fn: function (aBlock){
  5211. var self=this;
  5212. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5213. return smalltalk.withContext(function($ctx1) {
  5214. //>>excludeEnd("ctx");
  5215. var $1;
  5216. $1=_st(self._copy())._sort_(aBlock);
  5217. return $1;
  5218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5219. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},globals.Array)});
  5220. //>>excludeEnd("ctx");
  5221. },
  5222. //>>excludeStart("ide", pragmas.excludeIdeData);
  5223. args: ["aBlock"],
  5224. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  5225. referencedClasses: [],
  5226. //>>excludeEnd("ide");
  5227. messageSends: ["sort:", "copy"]
  5228. }),
  5229. globals.Array);
  5230. smalltalk.addMethod(
  5231. smalltalk.method({
  5232. selector: "new:",
  5233. protocol: 'instance creation',
  5234. fn: function (anInteger){
  5235. var self=this;
  5236. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5237. return smalltalk.withContext(function($ctx1) {
  5238. //>>excludeEnd("ctx");
  5239. return new Array(anInteger);
  5240. return self;
  5241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5242. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},globals.Array.klass)});
  5243. //>>excludeEnd("ctx");
  5244. },
  5245. //>>excludeStart("ide", pragmas.excludeIdeData);
  5246. args: ["anInteger"],
  5247. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  5248. referencedClasses: [],
  5249. //>>excludeEnd("ide");
  5250. messageSends: []
  5251. }),
  5252. globals.Array.klass);
  5253. smalltalk.addMethod(
  5254. smalltalk.method({
  5255. selector: "with:",
  5256. protocol: 'instance creation',
  5257. fn: function (anObject){
  5258. var self=this;
  5259. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5260. return smalltalk.withContext(function($ctx1) {
  5261. //>>excludeEnd("ctx");
  5262. var $2,$3,$1;
  5263. $2=self._new_((1));
  5264. _st($2)._at_put_((1),anObject);
  5265. $3=_st($2)._yourself();
  5266. $1=$3;
  5267. return $1;
  5268. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5269. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},globals.Array.klass)});
  5270. //>>excludeEnd("ctx");
  5271. },
  5272. //>>excludeStart("ide", pragmas.excludeIdeData);
  5273. args: ["anObject"],
  5274. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  5275. referencedClasses: [],
  5276. //>>excludeEnd("ide");
  5277. messageSends: ["at:put:", "new:", "yourself"]
  5278. }),
  5279. globals.Array.klass);
  5280. smalltalk.addMethod(
  5281. smalltalk.method({
  5282. selector: "with:with:",
  5283. protocol: 'instance creation',
  5284. fn: function (anObject,anObject2){
  5285. var self=this;
  5286. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5287. return smalltalk.withContext(function($ctx1) {
  5288. //>>excludeEnd("ctx");
  5289. var $2,$3,$1;
  5290. $2=self._new_((2));
  5291. _st($2)._at_put_((1),anObject);
  5292. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5293. $ctx1.sendIdx["at:put:"]=1;
  5294. //>>excludeEnd("ctx");
  5295. _st($2)._at_put_((2),anObject2);
  5296. $3=_st($2)._yourself();
  5297. $1=$3;
  5298. return $1;
  5299. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5300. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},globals.Array.klass)});
  5301. //>>excludeEnd("ctx");
  5302. },
  5303. //>>excludeStart("ide", pragmas.excludeIdeData);
  5304. args: ["anObject", "anObject2"],
  5305. 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",
  5306. referencedClasses: [],
  5307. //>>excludeEnd("ide");
  5308. messageSends: ["at:put:", "new:", "yourself"]
  5309. }),
  5310. globals.Array.klass);
  5311. smalltalk.addMethod(
  5312. smalltalk.method({
  5313. selector: "with:with:with:",
  5314. protocol: 'instance creation',
  5315. fn: function (anObject,anObject2,anObject3){
  5316. var self=this;
  5317. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5318. return smalltalk.withContext(function($ctx1) {
  5319. //>>excludeEnd("ctx");
  5320. var $2,$3,$1;
  5321. $2=self._new_((3));
  5322. _st($2)._at_put_((1),anObject);
  5323. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5324. $ctx1.sendIdx["at:put:"]=1;
  5325. //>>excludeEnd("ctx");
  5326. _st($2)._at_put_((2),anObject2);
  5327. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5328. $ctx1.sendIdx["at:put:"]=2;
  5329. //>>excludeEnd("ctx");
  5330. _st($2)._at_put_((3),anObject3);
  5331. $3=_st($2)._yourself();
  5332. $1=$3;
  5333. return $1;
  5334. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5335. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},globals.Array.klass)});
  5336. //>>excludeEnd("ctx");
  5337. },
  5338. //>>excludeStart("ide", pragmas.excludeIdeData);
  5339. args: ["anObject", "anObject2", "anObject3"],
  5340. 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",
  5341. referencedClasses: [],
  5342. //>>excludeEnd("ide");
  5343. messageSends: ["at:put:", "new:", "yourself"]
  5344. }),
  5345. globals.Array.klass);
  5346. smalltalk.addMethod(
  5347. smalltalk.method({
  5348. selector: "withAll:",
  5349. protocol: 'instance creation',
  5350. fn: function (aCollection){
  5351. var self=this;
  5352. var instance,index;
  5353. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5354. return smalltalk.withContext(function($ctx1) {
  5355. //>>excludeEnd("ctx");
  5356. var $1;
  5357. index=(1);
  5358. instance=self._new_(_st(aCollection)._size());
  5359. _st(aCollection)._do_((function(each){
  5360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5361. return smalltalk.withContext(function($ctx2) {
  5362. //>>excludeEnd("ctx");
  5363. _st(instance)._at_put_(index,each);
  5364. index=_st(index).__plus((1));
  5365. return index;
  5366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  5368. //>>excludeEnd("ctx");
  5369. }));
  5370. $1=instance;
  5371. return $1;
  5372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5373. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},globals.Array.klass)});
  5374. //>>excludeEnd("ctx");
  5375. },
  5376. //>>excludeStart("ide", pragmas.excludeIdeData);
  5377. args: ["aCollection"],
  5378. 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",
  5379. referencedClasses: [],
  5380. //>>excludeEnd("ide");
  5381. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  5382. }),
  5383. globals.Array.klass);
  5384. smalltalk.addClass('CharacterArray', globals.SequenceableCollection, [], 'Kernel-Collections');
  5385. //>>excludeStart("ide", pragmas.excludeIdeData);
  5386. globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  5387. //>>excludeEnd("ide");
  5388. smalltalk.addMethod(
  5389. smalltalk.method({
  5390. selector: ",",
  5391. protocol: 'copying',
  5392. fn: function (aString){
  5393. var self=this;
  5394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5395. return smalltalk.withContext(function($ctx1) {
  5396. //>>excludeEnd("ctx");
  5397. var $2,$1;
  5398. $2=self._asString();
  5399. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5400. $ctx1.sendIdx["asString"]=1;
  5401. //>>excludeEnd("ctx");
  5402. $1=_st($2).__comma(_st(aString)._asString());
  5403. return $1;
  5404. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5405. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.CharacterArray)});
  5406. //>>excludeEnd("ctx");
  5407. },
  5408. //>>excludeStart("ide", pragmas.excludeIdeData);
  5409. args: ["aString"],
  5410. source: ", aString\x0a\x09^ self asString, aString asString",
  5411. referencedClasses: [],
  5412. //>>excludeEnd("ide");
  5413. messageSends: [",", "asString"]
  5414. }),
  5415. globals.CharacterArray);
  5416. smalltalk.addMethod(
  5417. smalltalk.method({
  5418. selector: "add:",
  5419. protocol: 'adding/removing',
  5420. fn: function (anObject){
  5421. var self=this;
  5422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5423. return smalltalk.withContext(function($ctx1) {
  5424. //>>excludeEnd("ctx");
  5425. self._errorReadOnly();
  5426. return self;
  5427. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5428. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},globals.CharacterArray)});
  5429. //>>excludeEnd("ctx");
  5430. },
  5431. //>>excludeStart("ide", pragmas.excludeIdeData);
  5432. args: ["anObject"],
  5433. source: "add: anObject\x0a\x09self errorReadOnly",
  5434. referencedClasses: [],
  5435. //>>excludeEnd("ide");
  5436. messageSends: ["errorReadOnly"]
  5437. }),
  5438. globals.CharacterArray);
  5439. smalltalk.addMethod(
  5440. smalltalk.method({
  5441. selector: "asLowercase",
  5442. protocol: 'converting',
  5443. fn: function (){
  5444. var self=this;
  5445. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5446. return smalltalk.withContext(function($ctx1) {
  5447. //>>excludeEnd("ctx");
  5448. var $1;
  5449. $1=_st(self._class())._fromString_(_st(self._asString())._asLowercase());
  5450. return $1;
  5451. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5452. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.CharacterArray)});
  5453. //>>excludeEnd("ctx");
  5454. },
  5455. //>>excludeStart("ide", pragmas.excludeIdeData);
  5456. args: [],
  5457. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  5458. referencedClasses: [],
  5459. //>>excludeEnd("ide");
  5460. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  5461. }),
  5462. globals.CharacterArray);
  5463. smalltalk.addMethod(
  5464. smalltalk.method({
  5465. selector: "asNumber",
  5466. protocol: 'converting',
  5467. fn: function (){
  5468. var self=this;
  5469. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5470. return smalltalk.withContext(function($ctx1) {
  5471. //>>excludeEnd("ctx");
  5472. var $1;
  5473. $1=_st(self._asString())._asNumber();
  5474. return $1;
  5475. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5476. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.CharacterArray)});
  5477. //>>excludeEnd("ctx");
  5478. },
  5479. //>>excludeStart("ide", pragmas.excludeIdeData);
  5480. args: [],
  5481. source: "asNumber\x0a\x09^ self asString asNumber",
  5482. referencedClasses: [],
  5483. //>>excludeEnd("ide");
  5484. messageSends: ["asNumber", "asString"]
  5485. }),
  5486. globals.CharacterArray);
  5487. smalltalk.addMethod(
  5488. smalltalk.method({
  5489. selector: "asString",
  5490. protocol: 'converting',
  5491. fn: function (){
  5492. var self=this;
  5493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5494. return smalltalk.withContext(function($ctx1) {
  5495. //>>excludeEnd("ctx");
  5496. var $1;
  5497. $1=self._subclassResponsibility();
  5498. return $1;
  5499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5500. }, function($ctx1) {$ctx1.fill(self,"asString",{},globals.CharacterArray)});
  5501. //>>excludeEnd("ctx");
  5502. },
  5503. //>>excludeStart("ide", pragmas.excludeIdeData);
  5504. args: [],
  5505. source: "asString\x0a\x09^ self subclassResponsibility",
  5506. referencedClasses: [],
  5507. //>>excludeEnd("ide");
  5508. messageSends: ["subclassResponsibility"]
  5509. }),
  5510. globals.CharacterArray);
  5511. smalltalk.addMethod(
  5512. smalltalk.method({
  5513. selector: "asSymbol",
  5514. protocol: 'converting',
  5515. fn: function (){
  5516. var self=this;
  5517. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5518. return smalltalk.withContext(function($ctx1) {
  5519. //>>excludeEnd("ctx");
  5520. var $1;
  5521. $1=self._asString();
  5522. return $1;
  5523. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5524. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},globals.CharacterArray)});
  5525. //>>excludeEnd("ctx");
  5526. },
  5527. //>>excludeStart("ide", pragmas.excludeIdeData);
  5528. args: [],
  5529. source: "asSymbol\x0a\x09^ self asString",
  5530. referencedClasses: [],
  5531. //>>excludeEnd("ide");
  5532. messageSends: ["asString"]
  5533. }),
  5534. globals.CharacterArray);
  5535. smalltalk.addMethod(
  5536. smalltalk.method({
  5537. selector: "asUppercase",
  5538. protocol: 'converting',
  5539. fn: function (){
  5540. var self=this;
  5541. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5542. return smalltalk.withContext(function($ctx1) {
  5543. //>>excludeEnd("ctx");
  5544. var $1;
  5545. $1=_st(self._class())._fromString_(_st(self._asString())._asUppercase());
  5546. return $1;
  5547. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5548. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.CharacterArray)});
  5549. //>>excludeEnd("ctx");
  5550. },
  5551. //>>excludeStart("ide", pragmas.excludeIdeData);
  5552. args: [],
  5553. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  5554. referencedClasses: [],
  5555. //>>excludeEnd("ide");
  5556. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  5557. }),
  5558. globals.CharacterArray);
  5559. smalltalk.addMethod(
  5560. smalltalk.method({
  5561. selector: "at:put:",
  5562. protocol: 'accessing',
  5563. fn: function (anIndex,anObject){
  5564. var self=this;
  5565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5566. return smalltalk.withContext(function($ctx1) {
  5567. //>>excludeEnd("ctx");
  5568. self._errorReadOnly();
  5569. return self;
  5570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5571. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},globals.CharacterArray)});
  5572. //>>excludeEnd("ctx");
  5573. },
  5574. //>>excludeStart("ide", pragmas.excludeIdeData);
  5575. args: ["anIndex", "anObject"],
  5576. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  5577. referencedClasses: [],
  5578. //>>excludeEnd("ide");
  5579. messageSends: ["errorReadOnly"]
  5580. }),
  5581. globals.CharacterArray);
  5582. smalltalk.addMethod(
  5583. smalltalk.method({
  5584. selector: "errorReadOnly",
  5585. protocol: 'error handling',
  5586. fn: function (){
  5587. var self=this;
  5588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5589. return smalltalk.withContext(function($ctx1) {
  5590. //>>excludeEnd("ctx");
  5591. self._error_("Object is read-only");
  5592. return self;
  5593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5594. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},globals.CharacterArray)});
  5595. //>>excludeEnd("ctx");
  5596. },
  5597. //>>excludeStart("ide", pragmas.excludeIdeData);
  5598. args: [],
  5599. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  5600. referencedClasses: [],
  5601. //>>excludeEnd("ide");
  5602. messageSends: ["error:"]
  5603. }),
  5604. globals.CharacterArray);
  5605. smalltalk.addMethod(
  5606. smalltalk.method({
  5607. selector: "printOn:",
  5608. protocol: 'printing',
  5609. fn: function (aStream){
  5610. var self=this;
  5611. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5612. return smalltalk.withContext(function($ctx1) {
  5613. //>>excludeEnd("ctx");
  5614. _st(self._asString())._printOn_(aStream);
  5615. return self;
  5616. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5617. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.CharacterArray)});
  5618. //>>excludeEnd("ctx");
  5619. },
  5620. //>>excludeStart("ide", pragmas.excludeIdeData);
  5621. args: ["aStream"],
  5622. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  5623. referencedClasses: [],
  5624. //>>excludeEnd("ide");
  5625. messageSends: ["printOn:", "asString"]
  5626. }),
  5627. globals.CharacterArray);
  5628. smalltalk.addMethod(
  5629. smalltalk.method({
  5630. selector: "putOn:",
  5631. protocol: 'streaming',
  5632. fn: function (aStream){
  5633. var self=this;
  5634. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5635. return smalltalk.withContext(function($ctx1) {
  5636. //>>excludeEnd("ctx");
  5637. _st(aStream)._nextPutString_(self);
  5638. return self;
  5639. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5640. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},globals.CharacterArray)});
  5641. //>>excludeEnd("ctx");
  5642. },
  5643. //>>excludeStart("ide", pragmas.excludeIdeData);
  5644. args: ["aStream"],
  5645. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  5646. referencedClasses: [],
  5647. //>>excludeEnd("ide");
  5648. messageSends: ["nextPutString:"]
  5649. }),
  5650. globals.CharacterArray);
  5651. smalltalk.addMethod(
  5652. smalltalk.method({
  5653. selector: "remove:",
  5654. protocol: 'adding/removing',
  5655. fn: function (anObject){
  5656. var self=this;
  5657. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5658. return smalltalk.withContext(function($ctx1) {
  5659. //>>excludeEnd("ctx");
  5660. self._errorReadOnly();
  5661. return self;
  5662. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5663. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},globals.CharacterArray)});
  5664. //>>excludeEnd("ctx");
  5665. },
  5666. //>>excludeStart("ide", pragmas.excludeIdeData);
  5667. args: ["anObject"],
  5668. source: "remove: anObject\x0a\x09self errorReadOnly",
  5669. referencedClasses: [],
  5670. //>>excludeEnd("ide");
  5671. messageSends: ["errorReadOnly"]
  5672. }),
  5673. globals.CharacterArray);
  5674. smalltalk.addMethod(
  5675. smalltalk.method({
  5676. selector: "fromString:",
  5677. protocol: 'instance creation',
  5678. fn: function (aString){
  5679. var self=this;
  5680. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5681. return smalltalk.withContext(function($ctx1) {
  5682. //>>excludeEnd("ctx");
  5683. self._subclassResponsibility();
  5684. return self;
  5685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5686. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.CharacterArray.klass)});
  5687. //>>excludeEnd("ctx");
  5688. },
  5689. //>>excludeStart("ide", pragmas.excludeIdeData);
  5690. args: ["aString"],
  5691. source: "fromString: aString\x0a\x09self subclassResponsibility",
  5692. referencedClasses: [],
  5693. //>>excludeEnd("ide");
  5694. messageSends: ["subclassResponsibility"]
  5695. }),
  5696. globals.CharacterArray.klass);
  5697. smalltalk.addClass('String', globals.CharacterArray, [], 'Kernel-Collections');
  5698. //>>excludeStart("ide", pragmas.excludeIdeData);
  5699. 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 >> #,`";
  5700. //>>excludeEnd("ide");
  5701. smalltalk.addMethod(
  5702. smalltalk.method({
  5703. selector: ",",
  5704. protocol: 'copying',
  5705. fn: function (aString){
  5706. var self=this;
  5707. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5708. return smalltalk.withContext(function($ctx1) {
  5709. //>>excludeEnd("ctx");
  5710. return String(self) + aString;
  5711. return self;
  5712. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5713. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},globals.String)});
  5714. //>>excludeEnd("ctx");
  5715. },
  5716. //>>excludeStart("ide", pragmas.excludeIdeData);
  5717. args: ["aString"],
  5718. source: ", aString\x0a\x09<return String(self) + aString>",
  5719. referencedClasses: [],
  5720. //>>excludeEnd("ide");
  5721. messageSends: []
  5722. }),
  5723. globals.String);
  5724. smalltalk.addMethod(
  5725. smalltalk.method({
  5726. selector: "<",
  5727. protocol: 'comparing',
  5728. fn: function (aString){
  5729. var self=this;
  5730. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5731. return smalltalk.withContext(function($ctx1) {
  5732. //>>excludeEnd("ctx");
  5733. return String(self) < aString._asString();
  5734. return self;
  5735. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5736. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},globals.String)});
  5737. //>>excludeEnd("ctx");
  5738. },
  5739. //>>excludeStart("ide", pragmas.excludeIdeData);
  5740. args: ["aString"],
  5741. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  5742. referencedClasses: [],
  5743. //>>excludeEnd("ide");
  5744. messageSends: []
  5745. }),
  5746. globals.String);
  5747. smalltalk.addMethod(
  5748. smalltalk.method({
  5749. selector: "<=",
  5750. protocol: 'comparing',
  5751. fn: function (aString){
  5752. var self=this;
  5753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5754. return smalltalk.withContext(function($ctx1) {
  5755. //>>excludeEnd("ctx");
  5756. return String(self) <= aString._asString();
  5757. return self;
  5758. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5759. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},globals.String)});
  5760. //>>excludeEnd("ctx");
  5761. },
  5762. //>>excludeStart("ide", pragmas.excludeIdeData);
  5763. args: ["aString"],
  5764. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  5765. referencedClasses: [],
  5766. //>>excludeEnd("ide");
  5767. messageSends: []
  5768. }),
  5769. globals.String);
  5770. smalltalk.addMethod(
  5771. smalltalk.method({
  5772. selector: "=",
  5773. protocol: 'comparing',
  5774. fn: function (aString){
  5775. var self=this;
  5776. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5777. return smalltalk.withContext(function($ctx1) {
  5778. //>>excludeEnd("ctx");
  5779. return aString != null &&
  5780. typeof aString._isString === "function" &&
  5781. aString._isString() &&
  5782. String(self) === String(aString)
  5783. ;
  5784. return self;
  5785. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5786. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},globals.String)});
  5787. //>>excludeEnd("ctx");
  5788. },
  5789. //>>excludeStart("ide", pragmas.excludeIdeData);
  5790. args: ["aString"],
  5791. source: "= aString\x0a\x09<\x0a\x09\x09return aString != null &&\x0a\x09\x09\x09typeof aString._isString === \x22function\x22 &&\x0a\x09\x09\x09aString._isString() &&\x0a\x09\x09\x09String(self) === String(aString)\x0a\x09>",
  5792. referencedClasses: [],
  5793. //>>excludeEnd("ide");
  5794. messageSends: []
  5795. }),
  5796. globals.String);
  5797. smalltalk.addMethod(
  5798. smalltalk.method({
  5799. selector: "==",
  5800. protocol: 'comparing',
  5801. fn: function (aString){
  5802. var self=this;
  5803. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5804. return smalltalk.withContext(function($ctx1) {
  5805. //>>excludeEnd("ctx");
  5806. var $1;
  5807. $1=self.__eq(aString);
  5808. return $1;
  5809. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5810. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},globals.String)});
  5811. //>>excludeEnd("ctx");
  5812. },
  5813. //>>excludeStart("ide", pragmas.excludeIdeData);
  5814. args: ["aString"],
  5815. source: "== aString\x0a\x09^ self = aString",
  5816. referencedClasses: [],
  5817. //>>excludeEnd("ide");
  5818. messageSends: ["="]
  5819. }),
  5820. globals.String);
  5821. smalltalk.addMethod(
  5822. smalltalk.method({
  5823. selector: ">",
  5824. protocol: 'comparing',
  5825. fn: function (aString){
  5826. var self=this;
  5827. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5828. return smalltalk.withContext(function($ctx1) {
  5829. //>>excludeEnd("ctx");
  5830. return String(self) > aString._asString();
  5831. return self;
  5832. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5833. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},globals.String)});
  5834. //>>excludeEnd("ctx");
  5835. },
  5836. //>>excludeStart("ide", pragmas.excludeIdeData);
  5837. args: ["aString"],
  5838. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  5839. referencedClasses: [],
  5840. //>>excludeEnd("ide");
  5841. messageSends: []
  5842. }),
  5843. globals.String);
  5844. smalltalk.addMethod(
  5845. smalltalk.method({
  5846. selector: ">=",
  5847. protocol: 'comparing',
  5848. fn: function (aString){
  5849. var self=this;
  5850. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5851. return smalltalk.withContext(function($ctx1) {
  5852. //>>excludeEnd("ctx");
  5853. return String(self) >= aString._asString();
  5854. return self;
  5855. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5856. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},globals.String)});
  5857. //>>excludeEnd("ctx");
  5858. },
  5859. //>>excludeStart("ide", pragmas.excludeIdeData);
  5860. args: ["aString"],
  5861. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  5862. referencedClasses: [],
  5863. //>>excludeEnd("ide");
  5864. messageSends: []
  5865. }),
  5866. globals.String);
  5867. smalltalk.addMethod(
  5868. smalltalk.method({
  5869. selector: "asJSON",
  5870. protocol: 'converting',
  5871. fn: function (){
  5872. var self=this;
  5873. return self;
  5874. },
  5875. //>>excludeStart("ide", pragmas.excludeIdeData);
  5876. args: [],
  5877. source: "asJSON\x0a\x09^ self",
  5878. referencedClasses: [],
  5879. //>>excludeEnd("ide");
  5880. messageSends: []
  5881. }),
  5882. globals.String);
  5883. smalltalk.addMethod(
  5884. smalltalk.method({
  5885. selector: "asJavaScriptMethodName",
  5886. protocol: 'converting',
  5887. fn: function (){
  5888. var self=this;
  5889. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5890. return smalltalk.withContext(function($ctx1) {
  5891. //>>excludeEnd("ctx");
  5892. return smalltalk.st2js(self);
  5893. return self;
  5894. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5895. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},globals.String)});
  5896. //>>excludeEnd("ctx");
  5897. },
  5898. //>>excludeStart("ide", pragmas.excludeIdeData);
  5899. args: [],
  5900. source: "asJavaScriptMethodName\x0a\x09<return smalltalk.st2js(self)>",
  5901. referencedClasses: [],
  5902. //>>excludeEnd("ide");
  5903. messageSends: []
  5904. }),
  5905. globals.String);
  5906. smalltalk.addMethod(
  5907. smalltalk.method({
  5908. selector: "asJavascript",
  5909. protocol: 'converting',
  5910. fn: function (){
  5911. var self=this;
  5912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5913. return smalltalk.withContext(function($ctx1) {
  5914. //>>excludeEnd("ctx");
  5915. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  5916. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  5917. else
  5918. return "\"" + self + "\"";
  5919. ;
  5920. return self;
  5921. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5922. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{},globals.String)});
  5923. //>>excludeEnd("ctx");
  5924. },
  5925. //>>excludeStart("ide", pragmas.excludeIdeData);
  5926. args: [],
  5927. 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>",
  5928. referencedClasses: [],
  5929. //>>excludeEnd("ide");
  5930. messageSends: []
  5931. }),
  5932. globals.String);
  5933. smalltalk.addMethod(
  5934. smalltalk.method({
  5935. selector: "asLowercase",
  5936. protocol: 'converting',
  5937. fn: function (){
  5938. var self=this;
  5939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5940. return smalltalk.withContext(function($ctx1) {
  5941. //>>excludeEnd("ctx");
  5942. return self.toLowerCase();
  5943. return self;
  5944. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5945. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},globals.String)});
  5946. //>>excludeEnd("ctx");
  5947. },
  5948. //>>excludeStart("ide", pragmas.excludeIdeData);
  5949. args: [],
  5950. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  5951. referencedClasses: [],
  5952. //>>excludeEnd("ide");
  5953. messageSends: []
  5954. }),
  5955. globals.String);
  5956. smalltalk.addMethod(
  5957. smalltalk.method({
  5958. selector: "asMutator",
  5959. protocol: 'converting',
  5960. fn: function (){
  5961. var self=this;
  5962. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5963. return smalltalk.withContext(function($ctx1) {
  5964. //>>excludeEnd("ctx");
  5965. var $1,$2;
  5966. $1=_st(self._last()).__eq(":");
  5967. if(! smalltalk.assert($1)){
  5968. $2=self.__comma(":");
  5969. return $2;
  5970. };
  5971. return self;
  5972. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5973. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},globals.String)});
  5974. //>>excludeEnd("ctx");
  5975. },
  5976. //>>excludeStart("ide", pragmas.excludeIdeData);
  5977. args: [],
  5978. 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",
  5979. referencedClasses: [],
  5980. //>>excludeEnd("ide");
  5981. messageSends: ["ifFalse:", "=", "last", ","]
  5982. }),
  5983. globals.String);
  5984. smalltalk.addMethod(
  5985. smalltalk.method({
  5986. selector: "asNumber",
  5987. protocol: 'converting',
  5988. fn: function (){
  5989. var self=this;
  5990. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5991. return smalltalk.withContext(function($ctx1) {
  5992. //>>excludeEnd("ctx");
  5993. return Number(self);
  5994. return self;
  5995. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  5996. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},globals.String)});
  5997. //>>excludeEnd("ctx");
  5998. },
  5999. //>>excludeStart("ide", pragmas.excludeIdeData);
  6000. args: [],
  6001. source: "asNumber\x0a\x09<return Number(self)>",
  6002. referencedClasses: [],
  6003. //>>excludeEnd("ide");
  6004. messageSends: []
  6005. }),
  6006. globals.String);
  6007. smalltalk.addMethod(
  6008. smalltalk.method({
  6009. selector: "asRegexp",
  6010. protocol: 'converting',
  6011. fn: function (){
  6012. var self=this;
  6013. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6014. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6015. return smalltalk.withContext(function($ctx1) {
  6016. //>>excludeEnd("ctx");
  6017. var $1;
  6018. $1=_st($RegularExpression())._fromString_(self);
  6019. return $1;
  6020. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6021. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},globals.String)});
  6022. //>>excludeEnd("ctx");
  6023. },
  6024. //>>excludeStart("ide", pragmas.excludeIdeData);
  6025. args: [],
  6026. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  6027. referencedClasses: ["RegularExpression"],
  6028. //>>excludeEnd("ide");
  6029. messageSends: ["fromString:"]
  6030. }),
  6031. globals.String);
  6032. smalltalk.addMethod(
  6033. smalltalk.method({
  6034. selector: "asSelector",
  6035. protocol: 'converting',
  6036. fn: function (){
  6037. var self=this;
  6038. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6039. return smalltalk.withContext(function($ctx1) {
  6040. //>>excludeEnd("ctx");
  6041. var $1;
  6042. self._deprecatedAPI_("Use #asJavaScriptMethodName");
  6043. $1=self._asJavaScriptMethodName();
  6044. return $1;
  6045. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6046. }, function($ctx1) {$ctx1.fill(self,"asSelector",{},globals.String)});
  6047. //>>excludeEnd("ctx");
  6048. },
  6049. //>>excludeStart("ide", pragmas.excludeIdeData);
  6050. args: [],
  6051. source: "asSelector\x0a\x09self deprecatedAPI: 'Use #asJavaScriptMethodName'.\x0a\x09^ self asJavaScriptMethodName",
  6052. referencedClasses: [],
  6053. //>>excludeEnd("ide");
  6054. messageSends: ["deprecatedAPI:", "asJavaScriptMethodName"]
  6055. }),
  6056. globals.String);
  6057. smalltalk.addMethod(
  6058. smalltalk.method({
  6059. selector: "asString",
  6060. protocol: 'converting',
  6061. fn: function (){
  6062. var self=this;
  6063. return self;
  6064. },
  6065. //>>excludeStart("ide", pragmas.excludeIdeData);
  6066. args: [],
  6067. source: "asString\x0a\x09^ self",
  6068. referencedClasses: [],
  6069. //>>excludeEnd("ide");
  6070. messageSends: []
  6071. }),
  6072. globals.String);
  6073. smalltalk.addMethod(
  6074. smalltalk.method({
  6075. selector: "asSymbol",
  6076. protocol: 'converting',
  6077. fn: function (){
  6078. var self=this;
  6079. return self;
  6080. },
  6081. //>>excludeStart("ide", pragmas.excludeIdeData);
  6082. args: [],
  6083. source: "asSymbol\x0a\x09^ self",
  6084. referencedClasses: [],
  6085. //>>excludeEnd("ide");
  6086. messageSends: []
  6087. }),
  6088. globals.String);
  6089. smalltalk.addMethod(
  6090. smalltalk.method({
  6091. selector: "asUppercase",
  6092. protocol: 'converting',
  6093. fn: function (){
  6094. var self=this;
  6095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6096. return smalltalk.withContext(function($ctx1) {
  6097. //>>excludeEnd("ctx");
  6098. return self.toUpperCase();
  6099. return self;
  6100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6101. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},globals.String)});
  6102. //>>excludeEnd("ctx");
  6103. },
  6104. //>>excludeStart("ide", pragmas.excludeIdeData);
  6105. args: [],
  6106. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  6107. referencedClasses: [],
  6108. //>>excludeEnd("ide");
  6109. messageSends: []
  6110. }),
  6111. globals.String);
  6112. smalltalk.addMethod(
  6113. smalltalk.method({
  6114. selector: "asciiValue",
  6115. protocol: 'accessing',
  6116. fn: function (){
  6117. var self=this;
  6118. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6119. return smalltalk.withContext(function($ctx1) {
  6120. //>>excludeEnd("ctx");
  6121. return self.charCodeAt(0);;
  6122. return self;
  6123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6124. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},globals.String)});
  6125. //>>excludeEnd("ctx");
  6126. },
  6127. //>>excludeStart("ide", pragmas.excludeIdeData);
  6128. args: [],
  6129. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  6130. referencedClasses: [],
  6131. //>>excludeEnd("ide");
  6132. messageSends: []
  6133. }),
  6134. globals.String);
  6135. smalltalk.addMethod(
  6136. smalltalk.method({
  6137. selector: "at:ifAbsent:",
  6138. protocol: 'accessing',
  6139. fn: function (anIndex,aBlock){
  6140. var self=this;
  6141. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6142. return smalltalk.withContext(function($ctx1) {
  6143. //>>excludeEnd("ctx");
  6144. return String(self)[anIndex - 1] || aBlock._value();
  6145. return self;
  6146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6147. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},globals.String)});
  6148. //>>excludeEnd("ctx");
  6149. },
  6150. //>>excludeStart("ide", pragmas.excludeIdeData);
  6151. args: ["anIndex", "aBlock"],
  6152. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self)[anIndex - 1] || aBlock._value()>",
  6153. referencedClasses: [],
  6154. //>>excludeEnd("ide");
  6155. messageSends: []
  6156. }),
  6157. globals.String);
  6158. smalltalk.addMethod(
  6159. smalltalk.method({
  6160. selector: "at:ifPresent:ifAbsent:",
  6161. protocol: 'accessing',
  6162. fn: function (anIndex,aBlock,anotherBlock){
  6163. var self=this;
  6164. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6165. return smalltalk.withContext(function($ctx1) {
  6166. //>>excludeEnd("ctx");
  6167. var result = String(self)[anIndex - 1];
  6168. return result ? aBlock._value_(result) : anotherBlock._value();
  6169. ;
  6170. return self;
  6171. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6172. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},globals.String)});
  6173. //>>excludeEnd("ctx");
  6174. },
  6175. //>>excludeStart("ide", pragmas.excludeIdeData);
  6176. args: ["anIndex", "aBlock", "anotherBlock"],
  6177. 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>",
  6178. referencedClasses: [],
  6179. //>>excludeEnd("ide");
  6180. messageSends: []
  6181. }),
  6182. globals.String);
  6183. smalltalk.addMethod(
  6184. smalltalk.method({
  6185. selector: "capitalized",
  6186. protocol: 'converting',
  6187. fn: function (){
  6188. var self=this;
  6189. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6190. return smalltalk.withContext(function($ctx1) {
  6191. //>>excludeEnd("ctx");
  6192. var $2,$1;
  6193. $2=self._isEmpty();
  6194. if(smalltalk.assert($2)){
  6195. $1=self;
  6196. } else {
  6197. $1=_st(_st(self._first())._asUppercase()).__comma(self._allButFirst());
  6198. };
  6199. return $1;
  6200. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6201. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},globals.String)});
  6202. //>>excludeEnd("ctx");
  6203. },
  6204. //>>excludeStart("ide", pragmas.excludeIdeData);
  6205. args: [],
  6206. source: "capitalized\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: [ self ]\x0a\x09\x09ifFalse: [ self first asUppercase, self allButFirst ]",
  6207. referencedClasses: [],
  6208. //>>excludeEnd("ide");
  6209. messageSends: ["ifTrue:ifFalse:", "isEmpty", ",", "asUppercase", "first", "allButFirst"]
  6210. }),
  6211. globals.String);
  6212. smalltalk.addMethod(
  6213. smalltalk.method({
  6214. selector: "charCodeAt:",
  6215. protocol: 'accessing',
  6216. fn: function (anInteger){
  6217. var self=this;
  6218. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6219. return smalltalk.withContext(function($ctx1) {
  6220. //>>excludeEnd("ctx");
  6221. return self.charCodeAt(anInteger - 1);
  6222. return self;
  6223. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6224. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},globals.String)});
  6225. //>>excludeEnd("ctx");
  6226. },
  6227. //>>excludeStart("ide", pragmas.excludeIdeData);
  6228. args: ["anInteger"],
  6229. source: "charCodeAt: anInteger\x0a\x09<return self.charCodeAt(anInteger - 1)>",
  6230. referencedClasses: [],
  6231. //>>excludeEnd("ide");
  6232. messageSends: []
  6233. }),
  6234. globals.String);
  6235. smalltalk.addMethod(
  6236. smalltalk.method({
  6237. selector: "copyFrom:to:",
  6238. protocol: 'copying',
  6239. fn: function (anIndex,anotherIndex){
  6240. var self=this;
  6241. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6242. return smalltalk.withContext(function($ctx1) {
  6243. //>>excludeEnd("ctx");
  6244. return self.substring(anIndex - 1, anotherIndex);
  6245. return self;
  6246. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6247. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},globals.String)});
  6248. //>>excludeEnd("ctx");
  6249. },
  6250. //>>excludeStart("ide", pragmas.excludeIdeData);
  6251. args: ["anIndex", "anotherIndex"],
  6252. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  6253. referencedClasses: [],
  6254. //>>excludeEnd("ide");
  6255. messageSends: []
  6256. }),
  6257. globals.String);
  6258. smalltalk.addMethod(
  6259. smalltalk.method({
  6260. selector: "crlfSanitized",
  6261. protocol: 'converting',
  6262. fn: function (){
  6263. var self=this;
  6264. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6266. return smalltalk.withContext(function($ctx1) {
  6267. //>>excludeEnd("ctx");
  6268. var $1;
  6269. $1=_st(self._lines())._join_(_st($String())._lf());
  6270. return $1;
  6271. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6272. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},globals.String)});
  6273. //>>excludeEnd("ctx");
  6274. },
  6275. //>>excludeStart("ide", pragmas.excludeIdeData);
  6276. args: [],
  6277. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  6278. referencedClasses: ["String"],
  6279. //>>excludeEnd("ide");
  6280. messageSends: ["join:", "lines", "lf"]
  6281. }),
  6282. globals.String);
  6283. smalltalk.addMethod(
  6284. smalltalk.method({
  6285. selector: "deepCopy",
  6286. protocol: 'copying',
  6287. fn: function (){
  6288. var self=this;
  6289. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6290. return smalltalk.withContext(function($ctx1) {
  6291. //>>excludeEnd("ctx");
  6292. var $1;
  6293. $1=self._shallowCopy();
  6294. return $1;
  6295. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6296. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},globals.String)});
  6297. //>>excludeEnd("ctx");
  6298. },
  6299. //>>excludeStart("ide", pragmas.excludeIdeData);
  6300. args: [],
  6301. source: "deepCopy\x0a\x09^ self shallowCopy",
  6302. referencedClasses: [],
  6303. //>>excludeEnd("ide");
  6304. messageSends: ["shallowCopy"]
  6305. }),
  6306. globals.String);
  6307. smalltalk.addMethod(
  6308. smalltalk.method({
  6309. selector: "escaped",
  6310. protocol: 'converting',
  6311. fn: function (){
  6312. var self=this;
  6313. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6314. return smalltalk.withContext(function($ctx1) {
  6315. //>>excludeEnd("ctx");
  6316. return escape(self);
  6317. return self;
  6318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6319. }, function($ctx1) {$ctx1.fill(self,"escaped",{},globals.String)});
  6320. //>>excludeEnd("ctx");
  6321. },
  6322. //>>excludeStart("ide", pragmas.excludeIdeData);
  6323. args: [],
  6324. source: "escaped\x0a\x09<return escape(self)>",
  6325. referencedClasses: [],
  6326. //>>excludeEnd("ide");
  6327. messageSends: []
  6328. }),
  6329. globals.String);
  6330. smalltalk.addMethod(
  6331. smalltalk.method({
  6332. selector: "identityHash",
  6333. protocol: 'accessing',
  6334. fn: function (){
  6335. var self=this;
  6336. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6337. return smalltalk.withContext(function($ctx1) {
  6338. //>>excludeEnd("ctx");
  6339. var $1;
  6340. $1=self.__comma("s");
  6341. return $1;
  6342. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6343. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},globals.String)});
  6344. //>>excludeEnd("ctx");
  6345. },
  6346. //>>excludeStart("ide", pragmas.excludeIdeData);
  6347. args: [],
  6348. source: "identityHash\x0a\x09^ self, 's'",
  6349. referencedClasses: [],
  6350. //>>excludeEnd("ide");
  6351. messageSends: [","]
  6352. }),
  6353. globals.String);
  6354. smalltalk.addMethod(
  6355. smalltalk.method({
  6356. selector: "includesSubString:",
  6357. protocol: 'testing',
  6358. fn: function (subString){
  6359. var self=this;
  6360. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6361. return smalltalk.withContext(function($ctx1) {
  6362. //>>excludeEnd("ctx");
  6363. return self.indexOf(subString) != -1;
  6364. return self;
  6365. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6366. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},globals.String)});
  6367. //>>excludeEnd("ctx");
  6368. },
  6369. //>>excludeStart("ide", pragmas.excludeIdeData);
  6370. args: ["subString"],
  6371. source: "includesSubString: subString\x0a\x09<return self.indexOf(subString) != -1>",
  6372. referencedClasses: [],
  6373. //>>excludeEnd("ide");
  6374. messageSends: []
  6375. }),
  6376. globals.String);
  6377. smalltalk.addMethod(
  6378. smalltalk.method({
  6379. selector: "isCapitalized",
  6380. protocol: 'testing',
  6381. fn: function (){
  6382. var self=this;
  6383. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6384. return smalltalk.withContext(function($ctx1) {
  6385. //>>excludeEnd("ctx");
  6386. var $3,$2,$1;
  6387. $3=self._first();
  6388. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6389. $ctx1.sendIdx["first"]=1;
  6390. //>>excludeEnd("ctx");
  6391. $2=_st($3)._asUppercase();
  6392. $1=_st($2).__eq_eq(self._first());
  6393. return $1;
  6394. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6395. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},globals.String)});
  6396. //>>excludeEnd("ctx");
  6397. },
  6398. //>>excludeStart("ide", pragmas.excludeIdeData);
  6399. args: [],
  6400. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  6401. referencedClasses: [],
  6402. //>>excludeEnd("ide");
  6403. messageSends: ["==", "asUppercase", "first"]
  6404. }),
  6405. globals.String);
  6406. smalltalk.addMethod(
  6407. smalltalk.method({
  6408. selector: "isImmutable",
  6409. protocol: 'testing',
  6410. fn: function (){
  6411. var self=this;
  6412. return true;
  6413. },
  6414. //>>excludeStart("ide", pragmas.excludeIdeData);
  6415. args: [],
  6416. source: "isImmutable\x0a\x09^ true",
  6417. referencedClasses: [],
  6418. //>>excludeEnd("ide");
  6419. messageSends: []
  6420. }),
  6421. globals.String);
  6422. smalltalk.addMethod(
  6423. smalltalk.method({
  6424. selector: "isString",
  6425. protocol: 'testing',
  6426. fn: function (){
  6427. var self=this;
  6428. return true;
  6429. },
  6430. //>>excludeStart("ide", pragmas.excludeIdeData);
  6431. args: [],
  6432. source: "isString\x0a\x09^ true",
  6433. referencedClasses: [],
  6434. //>>excludeEnd("ide");
  6435. messageSends: []
  6436. }),
  6437. globals.String);
  6438. smalltalk.addMethod(
  6439. smalltalk.method({
  6440. selector: "isVowel",
  6441. protocol: 'testing',
  6442. fn: function (){
  6443. var self=this;
  6444. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6445. return smalltalk.withContext(function($ctx1) {
  6446. //>>excludeEnd("ctx");
  6447. var $1;
  6448. $1=_st(_st(self._size()).__eq((1)))._and_((function(){
  6449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6450. return smalltalk.withContext(function($ctx2) {
  6451. //>>excludeEnd("ctx");
  6452. return "aeiou"._includes_(self._asLowercase());
  6453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6455. //>>excludeEnd("ctx");
  6456. }));
  6457. return $1;
  6458. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6459. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},globals.String)});
  6460. //>>excludeEnd("ctx");
  6461. },
  6462. //>>excludeStart("ide", pragmas.excludeIdeData);
  6463. args: [],
  6464. 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 ]",
  6465. referencedClasses: [],
  6466. //>>excludeEnd("ide");
  6467. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  6468. }),
  6469. globals.String);
  6470. smalltalk.addMethod(
  6471. smalltalk.method({
  6472. selector: "join:",
  6473. protocol: 'split join',
  6474. fn: function (aCollection){
  6475. var self=this;
  6476. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6478. return smalltalk.withContext(function($ctx1) {
  6479. //>>excludeEnd("ctx");
  6480. var $1;
  6481. $1=_st($String())._streamContents_((function(stream){
  6482. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6483. return smalltalk.withContext(function($ctx2) {
  6484. //>>excludeEnd("ctx");
  6485. return _st(aCollection)._do_separatedBy_((function(each){
  6486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6487. return smalltalk.withContext(function($ctx3) {
  6488. //>>excludeEnd("ctx");
  6489. return _st(stream)._nextPutAll_(_st(each)._asString());
  6490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6491. $ctx3.sendIdx["nextPutAll:"]=1;
  6492. //>>excludeEnd("ctx");
  6493. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6494. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  6495. //>>excludeEnd("ctx");
  6496. }),(function(){
  6497. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6498. return smalltalk.withContext(function($ctx3) {
  6499. //>>excludeEnd("ctx");
  6500. return _st(stream)._nextPutAll_(self);
  6501. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6502. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6503. //>>excludeEnd("ctx");
  6504. }));
  6505. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6506. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  6507. //>>excludeEnd("ctx");
  6508. }));
  6509. return $1;
  6510. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6511. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},globals.String)});
  6512. //>>excludeEnd("ctx");
  6513. },
  6514. //>>excludeStart("ide", pragmas.excludeIdeData);
  6515. args: ["aCollection"],
  6516. 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 ]]",
  6517. referencedClasses: ["String"],
  6518. //>>excludeEnd("ide");
  6519. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  6520. }),
  6521. globals.String);
  6522. smalltalk.addMethod(
  6523. smalltalk.method({
  6524. selector: "lineIndicesDo:",
  6525. protocol: 'split join',
  6526. fn: function (aBlock){
  6527. var self=this;
  6528. var cr,lf,start,sz,nextLF,nextCR;
  6529. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  6530. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6531. return smalltalk.withContext(function($ctx1) {
  6532. //>>excludeEnd("ctx");
  6533. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  6534. var $early={};
  6535. try {
  6536. start=(1);
  6537. sz=self._size();
  6538. cr=_st($String())._cr();
  6539. nextCR=self._indexOf_startingAt_(cr,(1));
  6540. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6541. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  6542. //>>excludeEnd("ctx");
  6543. lf=_st($String())._lf();
  6544. nextLF=self._indexOf_startingAt_(lf,(1));
  6545. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6546. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  6547. //>>excludeEnd("ctx");
  6548. _st((function(){
  6549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6550. return smalltalk.withContext(function($ctx2) {
  6551. //>>excludeEnd("ctx");
  6552. return _st(start).__lt_eq(sz);
  6553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6554. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6555. //>>excludeEnd("ctx");
  6556. }))._whileTrue_((function(){
  6557. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6558. return smalltalk.withContext(function($ctx2) {
  6559. //>>excludeEnd("ctx");
  6560. $2=_st(nextLF).__eq((0));
  6561. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6562. $ctx2.sendIdx["="]=1;
  6563. //>>excludeEnd("ctx");
  6564. $1=_st($2)._and_((function(){
  6565. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6566. return smalltalk.withContext(function($ctx3) {
  6567. //>>excludeEnd("ctx");
  6568. return _st(nextCR).__eq((0));
  6569. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6570. $ctx3.sendIdx["="]=2;
  6571. //>>excludeEnd("ctx");
  6572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6573. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  6574. //>>excludeEnd("ctx");
  6575. }));
  6576. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6577. $ctx2.sendIdx["and:"]=1;
  6578. //>>excludeEnd("ctx");
  6579. if(smalltalk.assert($1)){
  6580. _st(aBlock)._value_value_value_(start,sz,sz);
  6581. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6582. $ctx2.sendIdx["value:value:value:"]=1;
  6583. //>>excludeEnd("ctx");
  6584. throw $early=[self];
  6585. };
  6586. $4=_st(nextCR).__eq((0));
  6587. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6588. $ctx2.sendIdx["="]=3;
  6589. //>>excludeEnd("ctx");
  6590. $3=_st($4)._or_((function(){
  6591. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6592. return smalltalk.withContext(function($ctx3) {
  6593. //>>excludeEnd("ctx");
  6594. $5=(0).__lt(nextLF);
  6595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6596. $ctx3.sendIdx["<"]=1;
  6597. //>>excludeEnd("ctx");
  6598. return _st($5)._and_((function(){
  6599. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6600. return smalltalk.withContext(function($ctx4) {
  6601. //>>excludeEnd("ctx");
  6602. return _st(nextLF).__lt(nextCR);
  6603. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6604. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  6605. //>>excludeEnd("ctx");
  6606. }));
  6607. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6608. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  6609. //>>excludeEnd("ctx");
  6610. }));
  6611. if(smalltalk.assert($3)){
  6612. $6=start;
  6613. $7=_st(nextLF).__minus((1));
  6614. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6615. $ctx2.sendIdx["-"]=1;
  6616. //>>excludeEnd("ctx");
  6617. _st(aBlock)._value_value_value_($6,$7,nextLF);
  6618. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6619. $ctx2.sendIdx["value:value:value:"]=2;
  6620. //>>excludeEnd("ctx");
  6621. start=(1).__plus(nextLF);
  6622. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6623. $ctx2.sendIdx["+"]=1;
  6624. //>>excludeEnd("ctx");
  6625. start;
  6626. nextLF=self._indexOf_startingAt_(lf,start);
  6627. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6628. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  6629. //>>excludeEnd("ctx");
  6630. return nextLF;
  6631. } else {
  6632. $9=(1).__plus(nextCR);
  6633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6634. $ctx2.sendIdx["+"]=2;
  6635. //>>excludeEnd("ctx");
  6636. $8=_st($9).__eq(nextLF);
  6637. if(smalltalk.assert($8)){
  6638. $10=start;
  6639. $11=_st(nextCR).__minus((1));
  6640. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6641. $ctx2.sendIdx["-"]=2;
  6642. //>>excludeEnd("ctx");
  6643. _st(aBlock)._value_value_value_($10,$11,nextLF);
  6644. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6645. $ctx2.sendIdx["value:value:value:"]=3;
  6646. //>>excludeEnd("ctx");
  6647. start=(1).__plus(nextLF);
  6648. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6649. $ctx2.sendIdx["+"]=3;
  6650. //>>excludeEnd("ctx");
  6651. start;
  6652. nextCR=self._indexOf_startingAt_(cr,start);
  6653. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6654. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  6655. //>>excludeEnd("ctx");
  6656. nextCR;
  6657. nextLF=self._indexOf_startingAt_(lf,start);
  6658. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6659. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  6660. //>>excludeEnd("ctx");
  6661. return nextLF;
  6662. } else {
  6663. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  6664. start=(1).__plus(nextCR);
  6665. start;
  6666. nextCR=self._indexOf_startingAt_(cr,start);
  6667. return nextCR;
  6668. };
  6669. };
  6670. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6671. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6672. //>>excludeEnd("ctx");
  6673. }));
  6674. return self;
  6675. }
  6676. catch(e) {if(e===$early)return e[0]; throw e}
  6677. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6678. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},globals.String)});
  6679. //>>excludeEnd("ctx");
  6680. },
  6681. //>>excludeStart("ide", pragmas.excludeIdeData);
  6682. args: ["aBlock"],
  6683. 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 ] ]]",
  6684. referencedClasses: ["String"],
  6685. //>>excludeEnd("ide");
  6686. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  6687. }),
  6688. globals.String);
  6689. smalltalk.addMethod(
  6690. smalltalk.method({
  6691. selector: "lineNumber:",
  6692. protocol: 'split join',
  6693. fn: function (anIndex){
  6694. var self=this;
  6695. var lineCount;
  6696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6697. return smalltalk.withContext(function($ctx1) {
  6698. //>>excludeEnd("ctx");
  6699. var $2,$1,$3;
  6700. var $early={};
  6701. try {
  6702. lineCount=(0);
  6703. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6705. return smalltalk.withContext(function($ctx2) {
  6706. //>>excludeEnd("ctx");
  6707. lineCount=_st(lineCount).__plus((1));
  6708. $2=lineCount;
  6709. $1=_st($2).__eq(anIndex);
  6710. if(smalltalk.assert($1)){
  6711. $3=self._copyFrom_to_(start,endWithoutDelimiters);
  6712. throw $early=[$3];
  6713. };
  6714. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6715. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6716. //>>excludeEnd("ctx");
  6717. }));
  6718. return nil;
  6719. }
  6720. catch(e) {if(e===$early)return e[0]; throw e}
  6721. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6722. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},globals.String)});
  6723. //>>excludeEnd("ctx");
  6724. },
  6725. //>>excludeStart("ide", pragmas.excludeIdeData);
  6726. args: ["anIndex"],
  6727. 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",
  6728. referencedClasses: [],
  6729. //>>excludeEnd("ide");
  6730. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  6731. }),
  6732. globals.String);
  6733. smalltalk.addMethod(
  6734. smalltalk.method({
  6735. selector: "lines",
  6736. protocol: 'split join',
  6737. fn: function (){
  6738. var self=this;
  6739. var lines;
  6740. function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
  6741. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6742. return smalltalk.withContext(function($ctx1) {
  6743. //>>excludeEnd("ctx");
  6744. var $1;
  6745. lines=_st($Array())._new();
  6746. self._linesDo_((function(aLine){
  6747. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6748. return smalltalk.withContext(function($ctx2) {
  6749. //>>excludeEnd("ctx");
  6750. return _st(lines)._add_(aLine);
  6751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6752. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1,1)});
  6753. //>>excludeEnd("ctx");
  6754. }));
  6755. $1=lines;
  6756. return $1;
  6757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6758. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines},globals.String)});
  6759. //>>excludeEnd("ctx");
  6760. },
  6761. //>>excludeStart("ide", pragmas.excludeIdeData);
  6762. args: [],
  6763. source: "lines\x0a\x09\x22Answer an array of lines composing this receiver without the line ending delimiters.\x22\x0a\x0a\x09| lines |\x0a\x09lines := Array new.\x0a\x09self linesDo: [ :aLine | lines add: aLine ].\x0a\x09^ lines",
  6764. referencedClasses: ["Array"],
  6765. //>>excludeEnd("ide");
  6766. messageSends: ["new", "linesDo:", "add:"]
  6767. }),
  6768. globals.String);
  6769. smalltalk.addMethod(
  6770. smalltalk.method({
  6771. selector: "linesDo:",
  6772. protocol: 'split join',
  6773. fn: function (aBlock){
  6774. var self=this;
  6775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6776. return smalltalk.withContext(function($ctx1) {
  6777. //>>excludeEnd("ctx");
  6778. self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  6779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6780. return smalltalk.withContext(function($ctx2) {
  6781. //>>excludeEnd("ctx");
  6782. return _st(aBlock)._value_(self._copyFrom_to_(start,endWithoutDelimiters));
  6783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6784. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  6785. //>>excludeEnd("ctx");
  6786. }));
  6787. return self;
  6788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6789. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},globals.String)});
  6790. //>>excludeEnd("ctx");
  6791. },
  6792. //>>excludeStart("ide", pragmas.excludeIdeData);
  6793. args: ["aBlock"],
  6794. 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 lineIndicesDo: [ :start :endWithoutDelimiters :end |\x0a\x09\x09aBlock value: (self copyFrom: start to: endWithoutDelimiters) ]",
  6795. referencedClasses: [],
  6796. //>>excludeEnd("ide");
  6797. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"]
  6798. }),
  6799. globals.String);
  6800. smalltalk.addMethod(
  6801. smalltalk.method({
  6802. selector: "match:",
  6803. protocol: 'regular expressions',
  6804. fn: function (aRegexp){
  6805. var self=this;
  6806. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6807. return smalltalk.withContext(function($ctx1) {
  6808. //>>excludeEnd("ctx");
  6809. return self.search(aRegexp) != -1;
  6810. return self;
  6811. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6812. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},globals.String)});
  6813. //>>excludeEnd("ctx");
  6814. },
  6815. //>>excludeStart("ide", pragmas.excludeIdeData);
  6816. args: ["aRegexp"],
  6817. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  6818. referencedClasses: [],
  6819. //>>excludeEnd("ide");
  6820. messageSends: []
  6821. }),
  6822. globals.String);
  6823. smalltalk.addMethod(
  6824. smalltalk.method({
  6825. selector: "matchesOf:",
  6826. protocol: 'regular expressions',
  6827. fn: function (aRegularExpression){
  6828. var self=this;
  6829. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6830. return smalltalk.withContext(function($ctx1) {
  6831. //>>excludeEnd("ctx");
  6832. return self.match(aRegularExpression);
  6833. return self;
  6834. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6835. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},globals.String)});
  6836. //>>excludeEnd("ctx");
  6837. },
  6838. //>>excludeStart("ide", pragmas.excludeIdeData);
  6839. args: ["aRegularExpression"],
  6840. source: "matchesOf: aRegularExpression\x0a\x09<return self.match(aRegularExpression)>",
  6841. referencedClasses: [],
  6842. //>>excludeEnd("ide");
  6843. messageSends: []
  6844. }),
  6845. globals.String);
  6846. smalltalk.addMethod(
  6847. smalltalk.method({
  6848. selector: "numericallyIndexable",
  6849. protocol: 'private',
  6850. fn: function (){
  6851. var self=this;
  6852. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6853. return smalltalk.withContext(function($ctx1) {
  6854. //>>excludeEnd("ctx");
  6855. return String(self);
  6856. return self;
  6857. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6858. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},globals.String)});
  6859. //>>excludeEnd("ctx");
  6860. },
  6861. //>>excludeStart("ide", pragmas.excludeIdeData);
  6862. args: [],
  6863. source: "numericallyIndexable\x0a\x09<return String(self)>",
  6864. referencedClasses: [],
  6865. //>>excludeEnd("ide");
  6866. messageSends: []
  6867. }),
  6868. globals.String);
  6869. smalltalk.addMethod(
  6870. smalltalk.method({
  6871. selector: "printNl",
  6872. protocol: 'printing',
  6873. fn: function (){
  6874. var self=this;
  6875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6876. return smalltalk.withContext(function($ctx1) {
  6877. //>>excludeEnd("ctx");
  6878. console.log(self);
  6879. return self;
  6880. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6881. }, function($ctx1) {$ctx1.fill(self,"printNl",{},globals.String)});
  6882. //>>excludeEnd("ctx");
  6883. },
  6884. //>>excludeStart("ide", pragmas.excludeIdeData);
  6885. args: [],
  6886. source: "printNl\x0a\x09<console.log(self)>",
  6887. referencedClasses: [],
  6888. //>>excludeEnd("ide");
  6889. messageSends: []
  6890. }),
  6891. globals.String);
  6892. smalltalk.addMethod(
  6893. smalltalk.method({
  6894. selector: "printOn:",
  6895. protocol: 'printing',
  6896. fn: function (aStream){
  6897. var self=this;
  6898. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6899. return smalltalk.withContext(function($ctx1) {
  6900. //>>excludeEnd("ctx");
  6901. var $1;
  6902. _st(aStream)._nextPutAll_("'");
  6903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6904. $ctx1.sendIdx["nextPutAll:"]=1;
  6905. //>>excludeEnd("ctx");
  6906. _st(aStream)._nextPutAll_(self);
  6907. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6908. $ctx1.sendIdx["nextPutAll:"]=2;
  6909. //>>excludeEnd("ctx");
  6910. $1=_st(aStream)._nextPutAll_("'");
  6911. return self;
  6912. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6913. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.String)});
  6914. //>>excludeEnd("ctx");
  6915. },
  6916. //>>excludeStart("ide", pragmas.excludeIdeData);
  6917. args: ["aStream"],
  6918. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: self;\x0a\x09\x09nextPutAll: ''''",
  6919. referencedClasses: [],
  6920. //>>excludeEnd("ide");
  6921. messageSends: ["nextPutAll:"]
  6922. }),
  6923. globals.String);
  6924. smalltalk.addMethod(
  6925. smalltalk.method({
  6926. selector: "replace:with:",
  6927. protocol: 'regular expressions',
  6928. fn: function (aString,anotherString){
  6929. var self=this;
  6930. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  6931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6932. return smalltalk.withContext(function($ctx1) {
  6933. //>>excludeEnd("ctx");
  6934. var $1;
  6935. $1=self._replaceRegexp_with_(_st($RegularExpression())._fromString_flag_(aString,"g"),anotherString);
  6936. return $1;
  6937. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6938. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},globals.String)});
  6939. //>>excludeEnd("ctx");
  6940. },
  6941. //>>excludeStart("ide", pragmas.excludeIdeData);
  6942. args: ["aString", "anotherString"],
  6943. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  6944. referencedClasses: ["RegularExpression"],
  6945. //>>excludeEnd("ide");
  6946. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  6947. }),
  6948. globals.String);
  6949. smalltalk.addMethod(
  6950. smalltalk.method({
  6951. selector: "replaceRegexp:with:",
  6952. protocol: 'regular expressions',
  6953. fn: function (aRegexp,aString){
  6954. var self=this;
  6955. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6956. return smalltalk.withContext(function($ctx1) {
  6957. //>>excludeEnd("ctx");
  6958. return self.replace(aRegexp, aString);
  6959. return self;
  6960. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6961. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},globals.String)});
  6962. //>>excludeEnd("ctx");
  6963. },
  6964. //>>excludeStart("ide", pragmas.excludeIdeData);
  6965. args: ["aRegexp", "aString"],
  6966. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  6967. referencedClasses: [],
  6968. //>>excludeEnd("ide");
  6969. messageSends: []
  6970. }),
  6971. globals.String);
  6972. smalltalk.addMethod(
  6973. smalltalk.method({
  6974. selector: "reversed",
  6975. protocol: 'converting',
  6976. fn: function (){
  6977. var self=this;
  6978. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6979. return smalltalk.withContext(function($ctx1) {
  6980. //>>excludeEnd("ctx");
  6981. return self.split("").reverse().join("");
  6982. return self;
  6983. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  6984. }, function($ctx1) {$ctx1.fill(self,"reversed",{},globals.String)});
  6985. //>>excludeEnd("ctx");
  6986. },
  6987. //>>excludeStart("ide", pragmas.excludeIdeData);
  6988. args: [],
  6989. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  6990. referencedClasses: [],
  6991. //>>excludeEnd("ide");
  6992. messageSends: []
  6993. }),
  6994. globals.String);
  6995. smalltalk.addMethod(
  6996. smalltalk.method({
  6997. selector: "shallowCopy",
  6998. protocol: 'copying',
  6999. fn: function (){
  7000. var self=this;
  7001. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7002. return smalltalk.withContext(function($ctx1) {
  7003. //>>excludeEnd("ctx");
  7004. var $1;
  7005. $1=_st(self._class())._fromString_(self);
  7006. return $1;
  7007. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7008. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},globals.String)});
  7009. //>>excludeEnd("ctx");
  7010. },
  7011. //>>excludeStart("ide", pragmas.excludeIdeData);
  7012. args: [],
  7013. source: "shallowCopy\x0a\x09^ self class fromString: self",
  7014. referencedClasses: [],
  7015. //>>excludeEnd("ide");
  7016. messageSends: ["fromString:", "class"]
  7017. }),
  7018. globals.String);
  7019. smalltalk.addMethod(
  7020. smalltalk.method({
  7021. selector: "size",
  7022. protocol: 'accessing',
  7023. fn: function (){
  7024. var self=this;
  7025. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7026. return smalltalk.withContext(function($ctx1) {
  7027. //>>excludeEnd("ctx");
  7028. return self.length;
  7029. return self;
  7030. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7031. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.String)});
  7032. //>>excludeEnd("ctx");
  7033. },
  7034. //>>excludeStart("ide", pragmas.excludeIdeData);
  7035. args: [],
  7036. source: "size\x0a\x09<return self.length>",
  7037. referencedClasses: [],
  7038. //>>excludeEnd("ide");
  7039. messageSends: []
  7040. }),
  7041. globals.String);
  7042. smalltalk.addMethod(
  7043. smalltalk.method({
  7044. selector: "subStrings:",
  7045. protocol: 'split join',
  7046. fn: function (aString){
  7047. var self=this;
  7048. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7049. return smalltalk.withContext(function($ctx1) {
  7050. //>>excludeEnd("ctx");
  7051. var $1;
  7052. $1=self._tokenize_(aString);
  7053. return $1;
  7054. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7055. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},globals.String)});
  7056. //>>excludeEnd("ctx");
  7057. },
  7058. //>>excludeStart("ide", pragmas.excludeIdeData);
  7059. args: ["aString"],
  7060. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  7061. referencedClasses: [],
  7062. //>>excludeEnd("ide");
  7063. messageSends: ["tokenize:"]
  7064. }),
  7065. globals.String);
  7066. smalltalk.addMethod(
  7067. smalltalk.method({
  7068. selector: "tokenize:",
  7069. protocol: 'split join',
  7070. fn: function (aString){
  7071. var self=this;
  7072. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7073. return smalltalk.withContext(function($ctx1) {
  7074. //>>excludeEnd("ctx");
  7075. return self.split(aString);
  7076. return self;
  7077. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7078. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},globals.String)});
  7079. //>>excludeEnd("ctx");
  7080. },
  7081. //>>excludeStart("ide", pragmas.excludeIdeData);
  7082. args: ["aString"],
  7083. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  7084. referencedClasses: [],
  7085. //>>excludeEnd("ide");
  7086. messageSends: []
  7087. }),
  7088. globals.String);
  7089. smalltalk.addMethod(
  7090. smalltalk.method({
  7091. selector: "trimBoth",
  7092. protocol: 'regular expressions',
  7093. fn: function (){
  7094. var self=this;
  7095. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7096. return smalltalk.withContext(function($ctx1) {
  7097. //>>excludeEnd("ctx");
  7098. var $1;
  7099. $1=self._trimBoth_("\x5cs");
  7100. return $1;
  7101. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7102. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},globals.String)});
  7103. //>>excludeEnd("ctx");
  7104. },
  7105. //>>excludeStart("ide", pragmas.excludeIdeData);
  7106. args: [],
  7107. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  7108. referencedClasses: [],
  7109. //>>excludeEnd("ide");
  7110. messageSends: ["trimBoth:"]
  7111. }),
  7112. globals.String);
  7113. smalltalk.addMethod(
  7114. smalltalk.method({
  7115. selector: "trimBoth:",
  7116. protocol: 'regular expressions',
  7117. fn: function (separators){
  7118. var self=this;
  7119. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7120. return smalltalk.withContext(function($ctx1) {
  7121. //>>excludeEnd("ctx");
  7122. var $1;
  7123. $1=_st(self._trimLeft_(separators))._trimRight_(separators);
  7124. return $1;
  7125. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7126. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},globals.String)});
  7127. //>>excludeEnd("ctx");
  7128. },
  7129. //>>excludeStart("ide", pragmas.excludeIdeData);
  7130. args: ["separators"],
  7131. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  7132. referencedClasses: [],
  7133. //>>excludeEnd("ide");
  7134. messageSends: ["trimRight:", "trimLeft:"]
  7135. }),
  7136. globals.String);
  7137. smalltalk.addMethod(
  7138. smalltalk.method({
  7139. selector: "trimLeft",
  7140. protocol: 'regular expressions',
  7141. fn: function (){
  7142. var self=this;
  7143. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7144. return smalltalk.withContext(function($ctx1) {
  7145. //>>excludeEnd("ctx");
  7146. var $1;
  7147. $1=self._trimLeft_("\x5cs");
  7148. return $1;
  7149. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7150. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},globals.String)});
  7151. //>>excludeEnd("ctx");
  7152. },
  7153. //>>excludeStart("ide", pragmas.excludeIdeData);
  7154. args: [],
  7155. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  7156. referencedClasses: [],
  7157. //>>excludeEnd("ide");
  7158. messageSends: ["trimLeft:"]
  7159. }),
  7160. globals.String);
  7161. smalltalk.addMethod(
  7162. smalltalk.method({
  7163. selector: "trimLeft:",
  7164. protocol: 'regular expressions',
  7165. fn: function (separators){
  7166. var self=this;
  7167. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  7168. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7169. return smalltalk.withContext(function($ctx1) {
  7170. //>>excludeEnd("ctx");
  7171. var $3,$2,$1;
  7172. $3=_st("^[".__comma(separators)).__comma("]+");
  7173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7174. $ctx1.sendIdx[","]=1;
  7175. //>>excludeEnd("ctx");
  7176. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  7177. $1=self._replaceRegexp_with_($2,"");
  7178. return $1;
  7179. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7180. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},globals.String)});
  7181. //>>excludeEnd("ctx");
  7182. },
  7183. //>>excludeStart("ide", pragmas.excludeIdeData);
  7184. args: ["separators"],
  7185. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  7186. referencedClasses: ["RegularExpression"],
  7187. //>>excludeEnd("ide");
  7188. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7189. }),
  7190. globals.String);
  7191. smalltalk.addMethod(
  7192. smalltalk.method({
  7193. selector: "trimRight",
  7194. protocol: 'regular expressions',
  7195. fn: function (){
  7196. var self=this;
  7197. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7198. return smalltalk.withContext(function($ctx1) {
  7199. //>>excludeEnd("ctx");
  7200. var $1;
  7201. $1=self._trimRight_("\x5cs");
  7202. return $1;
  7203. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7204. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},globals.String)});
  7205. //>>excludeEnd("ctx");
  7206. },
  7207. //>>excludeStart("ide", pragmas.excludeIdeData);
  7208. args: [],
  7209. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  7210. referencedClasses: [],
  7211. //>>excludeEnd("ide");
  7212. messageSends: ["trimRight:"]
  7213. }),
  7214. globals.String);
  7215. smalltalk.addMethod(
  7216. smalltalk.method({
  7217. selector: "trimRight:",
  7218. protocol: 'regular expressions',
  7219. fn: function (separators){
  7220. var self=this;
  7221. function $RegularExpression(){return globals.RegularExpression||(typeof RegularExpression=="undefined"?nil:RegularExpression)}
  7222. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7223. return smalltalk.withContext(function($ctx1) {
  7224. //>>excludeEnd("ctx");
  7225. var $3,$2,$1;
  7226. $3=_st("[".__comma(separators)).__comma("]+$");
  7227. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7228. $ctx1.sendIdx[","]=1;
  7229. //>>excludeEnd("ctx");
  7230. $2=_st($RegularExpression())._fromString_flag_($3,"g");
  7231. $1=self._replaceRegexp_with_($2,"");
  7232. return $1;
  7233. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7234. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},globals.String)});
  7235. //>>excludeEnd("ctx");
  7236. },
  7237. //>>excludeStart("ide", pragmas.excludeIdeData);
  7238. args: ["separators"],
  7239. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  7240. referencedClasses: ["RegularExpression"],
  7241. //>>excludeEnd("ide");
  7242. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  7243. }),
  7244. globals.String);
  7245. smalltalk.addMethod(
  7246. smalltalk.method({
  7247. selector: "unescaped",
  7248. protocol: 'converting',
  7249. fn: function (){
  7250. var self=this;
  7251. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7252. return smalltalk.withContext(function($ctx1) {
  7253. //>>excludeEnd("ctx");
  7254. return unescape(self);
  7255. return self;
  7256. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7257. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},globals.String)});
  7258. //>>excludeEnd("ctx");
  7259. },
  7260. //>>excludeStart("ide", pragmas.excludeIdeData);
  7261. args: [],
  7262. source: "unescaped\x0a\x09<return unescape(self)>",
  7263. referencedClasses: [],
  7264. //>>excludeEnd("ide");
  7265. messageSends: []
  7266. }),
  7267. globals.String);
  7268. smalltalk.addMethod(
  7269. smalltalk.method({
  7270. selector: "uriComponentDecoded",
  7271. protocol: 'converting',
  7272. fn: function (){
  7273. var self=this;
  7274. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7275. return smalltalk.withContext(function($ctx1) {
  7276. //>>excludeEnd("ctx");
  7277. return decodeURIComponent(self);
  7278. return self;
  7279. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7280. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},globals.String)});
  7281. //>>excludeEnd("ctx");
  7282. },
  7283. //>>excludeStart("ide", pragmas.excludeIdeData);
  7284. args: [],
  7285. source: "uriComponentDecoded\x0a\x09<return decodeURIComponent(self)>",
  7286. referencedClasses: [],
  7287. //>>excludeEnd("ide");
  7288. messageSends: []
  7289. }),
  7290. globals.String);
  7291. smalltalk.addMethod(
  7292. smalltalk.method({
  7293. selector: "uriComponentEncoded",
  7294. protocol: 'converting',
  7295. fn: function (){
  7296. var self=this;
  7297. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7298. return smalltalk.withContext(function($ctx1) {
  7299. //>>excludeEnd("ctx");
  7300. return encodeURIComponent(self);
  7301. return self;
  7302. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7303. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},globals.String)});
  7304. //>>excludeEnd("ctx");
  7305. },
  7306. //>>excludeStart("ide", pragmas.excludeIdeData);
  7307. args: [],
  7308. source: "uriComponentEncoded\x0a\x09<return encodeURIComponent(self)>",
  7309. referencedClasses: [],
  7310. //>>excludeEnd("ide");
  7311. messageSends: []
  7312. }),
  7313. globals.String);
  7314. smalltalk.addMethod(
  7315. smalltalk.method({
  7316. selector: "uriDecoded",
  7317. protocol: 'converting',
  7318. fn: function (){
  7319. var self=this;
  7320. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7321. return smalltalk.withContext(function($ctx1) {
  7322. //>>excludeEnd("ctx");
  7323. return decodeURI(self);
  7324. return self;
  7325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7326. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},globals.String)});
  7327. //>>excludeEnd("ctx");
  7328. },
  7329. //>>excludeStart("ide", pragmas.excludeIdeData);
  7330. args: [],
  7331. source: "uriDecoded\x0a\x09<return decodeURI(self)>",
  7332. referencedClasses: [],
  7333. //>>excludeEnd("ide");
  7334. messageSends: []
  7335. }),
  7336. globals.String);
  7337. smalltalk.addMethod(
  7338. smalltalk.method({
  7339. selector: "uriEncoded",
  7340. protocol: 'converting',
  7341. fn: function (){
  7342. var self=this;
  7343. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7344. return smalltalk.withContext(function($ctx1) {
  7345. //>>excludeEnd("ctx");
  7346. return encodeURI(self);
  7347. return self;
  7348. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7349. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},globals.String)});
  7350. //>>excludeEnd("ctx");
  7351. },
  7352. //>>excludeStart("ide", pragmas.excludeIdeData);
  7353. args: [],
  7354. source: "uriEncoded\x0a\x09<return encodeURI(self)>",
  7355. referencedClasses: [],
  7356. //>>excludeEnd("ide");
  7357. messageSends: []
  7358. }),
  7359. globals.String);
  7360. smalltalk.addMethod(
  7361. smalltalk.method({
  7362. selector: "value:",
  7363. protocol: 'evaluating',
  7364. fn: function (anObject){
  7365. var self=this;
  7366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7367. return smalltalk.withContext(function($ctx1) {
  7368. //>>excludeEnd("ctx");
  7369. var $1;
  7370. $1=_st(anObject)._perform_(self);
  7371. return $1;
  7372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7373. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},globals.String)});
  7374. //>>excludeEnd("ctx");
  7375. },
  7376. //>>excludeStart("ide", pragmas.excludeIdeData);
  7377. args: ["anObject"],
  7378. source: "value: anObject \x0a\x09^ anObject perform: self",
  7379. referencedClasses: [],
  7380. //>>excludeEnd("ide");
  7381. messageSends: ["perform:"]
  7382. }),
  7383. globals.String);
  7384. smalltalk.addMethod(
  7385. smalltalk.method({
  7386. selector: "cr",
  7387. protocol: 'accessing',
  7388. fn: function (){
  7389. var self=this;
  7390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7391. return smalltalk.withContext(function($ctx1) {
  7392. //>>excludeEnd("ctx");
  7393. return '\r';
  7394. return self;
  7395. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7396. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.String.klass)});
  7397. //>>excludeEnd("ctx");
  7398. },
  7399. //>>excludeStart("ide", pragmas.excludeIdeData);
  7400. args: [],
  7401. source: "cr\x0a\x09<return '\x5cr'>",
  7402. referencedClasses: [],
  7403. //>>excludeEnd("ide");
  7404. messageSends: []
  7405. }),
  7406. globals.String.klass);
  7407. smalltalk.addMethod(
  7408. smalltalk.method({
  7409. selector: "crlf",
  7410. protocol: 'accessing',
  7411. fn: function (){
  7412. var self=this;
  7413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7414. return smalltalk.withContext(function($ctx1) {
  7415. //>>excludeEnd("ctx");
  7416. return '\r\n';
  7417. return self;
  7418. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7419. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.String.klass)});
  7420. //>>excludeEnd("ctx");
  7421. },
  7422. //>>excludeStart("ide", pragmas.excludeIdeData);
  7423. args: [],
  7424. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  7425. referencedClasses: [],
  7426. //>>excludeEnd("ide");
  7427. messageSends: []
  7428. }),
  7429. globals.String.klass);
  7430. smalltalk.addMethod(
  7431. smalltalk.method({
  7432. selector: "esc",
  7433. protocol: 'accessing',
  7434. fn: function (){
  7435. var self=this;
  7436. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7437. return smalltalk.withContext(function($ctx1) {
  7438. //>>excludeEnd("ctx");
  7439. var $1;
  7440. $1=self._fromCharCode_((27));
  7441. return $1;
  7442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7443. }, function($ctx1) {$ctx1.fill(self,"esc",{},globals.String.klass)});
  7444. //>>excludeEnd("ctx");
  7445. },
  7446. //>>excludeStart("ide", pragmas.excludeIdeData);
  7447. args: [],
  7448. source: "esc\x0a\x09^ self fromCharCode: 27",
  7449. referencedClasses: [],
  7450. //>>excludeEnd("ide");
  7451. messageSends: ["fromCharCode:"]
  7452. }),
  7453. globals.String.klass);
  7454. smalltalk.addMethod(
  7455. smalltalk.method({
  7456. selector: "fromCharCode:",
  7457. protocol: 'instance creation',
  7458. fn: function (anInteger){
  7459. var self=this;
  7460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7461. return smalltalk.withContext(function($ctx1) {
  7462. //>>excludeEnd("ctx");
  7463. return String.fromCharCode(anInteger);
  7464. return self;
  7465. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7466. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},globals.String.klass)});
  7467. //>>excludeEnd("ctx");
  7468. },
  7469. //>>excludeStart("ide", pragmas.excludeIdeData);
  7470. args: ["anInteger"],
  7471. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  7472. referencedClasses: [],
  7473. //>>excludeEnd("ide");
  7474. messageSends: []
  7475. }),
  7476. globals.String.klass);
  7477. smalltalk.addMethod(
  7478. smalltalk.method({
  7479. selector: "fromString:",
  7480. protocol: 'instance creation',
  7481. fn: function (aString){
  7482. var self=this;
  7483. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7484. return smalltalk.withContext(function($ctx1) {
  7485. //>>excludeEnd("ctx");
  7486. return String(aString);
  7487. return self;
  7488. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7489. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.String.klass)});
  7490. //>>excludeEnd("ctx");
  7491. },
  7492. //>>excludeStart("ide", pragmas.excludeIdeData);
  7493. args: ["aString"],
  7494. source: "fromString: aString\x0a\x09\x09<return String(aString)>",
  7495. referencedClasses: [],
  7496. //>>excludeEnd("ide");
  7497. messageSends: []
  7498. }),
  7499. globals.String.klass);
  7500. smalltalk.addMethod(
  7501. smalltalk.method({
  7502. selector: "lf",
  7503. protocol: 'accessing',
  7504. fn: function (){
  7505. var self=this;
  7506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7507. return smalltalk.withContext(function($ctx1) {
  7508. //>>excludeEnd("ctx");
  7509. return '\n';
  7510. return self;
  7511. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7512. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.String.klass)});
  7513. //>>excludeEnd("ctx");
  7514. },
  7515. //>>excludeStart("ide", pragmas.excludeIdeData);
  7516. args: [],
  7517. source: "lf\x0a\x09<return '\x5cn'>",
  7518. referencedClasses: [],
  7519. //>>excludeEnd("ide");
  7520. messageSends: []
  7521. }),
  7522. globals.String.klass);
  7523. smalltalk.addMethod(
  7524. smalltalk.method({
  7525. selector: "random",
  7526. protocol: 'random',
  7527. fn: function (){
  7528. var self=this;
  7529. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7530. return smalltalk.withContext(function($ctx1) {
  7531. //>>excludeEnd("ctx");
  7532. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  7533. return self;
  7534. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7535. }, function($ctx1) {$ctx1.fill(self,"random",{},globals.String.klass)});
  7536. //>>excludeEnd("ctx");
  7537. },
  7538. //>>excludeStart("ide", pragmas.excludeIdeData);
  7539. args: [],
  7540. 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);>",
  7541. referencedClasses: [],
  7542. //>>excludeEnd("ide");
  7543. messageSends: []
  7544. }),
  7545. globals.String.klass);
  7546. smalltalk.addMethod(
  7547. smalltalk.method({
  7548. selector: "randomNotIn:",
  7549. protocol: 'random',
  7550. fn: function (aString){
  7551. var self=this;
  7552. var result;
  7553. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7554. return smalltalk.withContext(function($ctx1) {
  7555. //>>excludeEnd("ctx");
  7556. var $1;
  7557. _st((function(){
  7558. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7559. return smalltalk.withContext(function($ctx2) {
  7560. //>>excludeEnd("ctx");
  7561. result=self._random();
  7562. result;
  7563. return _st(aString)._includesSubString_(result);
  7564. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7566. //>>excludeEnd("ctx");
  7567. }))._whileTrue();
  7568. $1=result;
  7569. return $1;
  7570. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7571. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},globals.String.klass)});
  7572. //>>excludeEnd("ctx");
  7573. },
  7574. //>>excludeStart("ide", pragmas.excludeIdeData);
  7575. args: ["aString"],
  7576. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  7577. referencedClasses: [],
  7578. //>>excludeEnd("ide");
  7579. messageSends: ["whileTrue", "random", "includesSubString:"]
  7580. }),
  7581. globals.String.klass);
  7582. smalltalk.addMethod(
  7583. smalltalk.method({
  7584. selector: "space",
  7585. protocol: 'accessing',
  7586. fn: function (){
  7587. var self=this;
  7588. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7589. return smalltalk.withContext(function($ctx1) {
  7590. //>>excludeEnd("ctx");
  7591. return ' ';
  7592. return self;
  7593. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7594. }, function($ctx1) {$ctx1.fill(self,"space",{},globals.String.klass)});
  7595. //>>excludeEnd("ctx");
  7596. },
  7597. //>>excludeStart("ide", pragmas.excludeIdeData);
  7598. args: [],
  7599. source: "space\x0a\x09<return ' '>",
  7600. referencedClasses: [],
  7601. //>>excludeEnd("ide");
  7602. messageSends: []
  7603. }),
  7604. globals.String.klass);
  7605. smalltalk.addMethod(
  7606. smalltalk.method({
  7607. selector: "streamClass",
  7608. protocol: 'accessing',
  7609. fn: function (){
  7610. var self=this;
  7611. function $StringStream(){return globals.StringStream||(typeof StringStream=="undefined"?nil:StringStream)}
  7612. return $StringStream();
  7613. },
  7614. //>>excludeStart("ide", pragmas.excludeIdeData);
  7615. args: [],
  7616. source: "streamClass\x0a\x09\x09^ StringStream",
  7617. referencedClasses: ["StringStream"],
  7618. //>>excludeEnd("ide");
  7619. messageSends: []
  7620. }),
  7621. globals.String.klass);
  7622. smalltalk.addMethod(
  7623. smalltalk.method({
  7624. selector: "tab",
  7625. protocol: 'accessing',
  7626. fn: function (){
  7627. var self=this;
  7628. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7629. return smalltalk.withContext(function($ctx1) {
  7630. //>>excludeEnd("ctx");
  7631. return '\t';
  7632. return self;
  7633. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7634. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.String.klass)});
  7635. //>>excludeEnd("ctx");
  7636. },
  7637. //>>excludeStart("ide", pragmas.excludeIdeData);
  7638. args: [],
  7639. source: "tab\x0a\x09<return '\x5ct'>",
  7640. referencedClasses: [],
  7641. //>>excludeEnd("ide");
  7642. messageSends: []
  7643. }),
  7644. globals.String.klass);
  7645. smalltalk.addMethod(
  7646. smalltalk.method({
  7647. selector: "value:",
  7648. protocol: 'instance creation',
  7649. fn: function (aUTFCharCode){
  7650. var self=this;
  7651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7652. return smalltalk.withContext(function($ctx1) {
  7653. //>>excludeEnd("ctx");
  7654. return String.fromCharCode(aUTFCharCode);;
  7655. return self;
  7656. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7657. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},globals.String.klass)});
  7658. //>>excludeEnd("ctx");
  7659. },
  7660. //>>excludeStart("ide", pragmas.excludeIdeData);
  7661. args: ["aUTFCharCode"],
  7662. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  7663. referencedClasses: [],
  7664. //>>excludeEnd("ide");
  7665. messageSends: []
  7666. }),
  7667. globals.String.klass);
  7668. smalltalk.addClass('Set', globals.Collection, ['defaultBucket', 'slowBucketStores', 'fastBuckets', 'size'], 'Kernel-Collections');
  7669. //>>excludeStart("ide", pragmas.excludeIdeData);
  7670. 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`.";
  7671. //>>excludeEnd("ide");
  7672. smalltalk.addMethod(
  7673. smalltalk.method({
  7674. selector: "=",
  7675. protocol: 'comparing',
  7676. fn: function (aCollection){
  7677. var self=this;
  7678. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7679. return smalltalk.withContext(function($ctx1) {
  7680. //>>excludeEnd("ctx");
  7681. var $2,$1,$4,$3,$5;
  7682. var $early={};
  7683. try {
  7684. $2=self._class();
  7685. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7686. $ctx1.sendIdx["class"]=1;
  7687. //>>excludeEnd("ctx");
  7688. $1=_st($2).__eq(_st(aCollection)._class());
  7689. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7690. $ctx1.sendIdx["="]=1;
  7691. //>>excludeEnd("ctx");
  7692. if(! smalltalk.assert($1)){
  7693. return false;
  7694. };
  7695. $4=self._size();
  7696. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7697. $ctx1.sendIdx["size"]=1;
  7698. //>>excludeEnd("ctx");
  7699. $3=_st($4).__eq(_st(aCollection)._size());
  7700. if(! smalltalk.assert($3)){
  7701. return false;
  7702. };
  7703. self._do_((function(each){
  7704. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7705. return smalltalk.withContext(function($ctx2) {
  7706. //>>excludeEnd("ctx");
  7707. $5=_st(aCollection)._includes_(each);
  7708. if(! smalltalk.assert($5)){
  7709. throw $early=[false];
  7710. };
  7711. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7712. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  7713. //>>excludeEnd("ctx");
  7714. }));
  7715. return true;
  7716. }
  7717. catch(e) {if(e===$early)return e[0]; throw e}
  7718. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7719. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},globals.Set)});
  7720. //>>excludeEnd("ctx");
  7721. },
  7722. //>>excludeStart("ide", pragmas.excludeIdeData);
  7723. args: ["aCollection"],
  7724. 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",
  7725. referencedClasses: [],
  7726. //>>excludeEnd("ide");
  7727. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  7728. }),
  7729. globals.Set);
  7730. smalltalk.addMethod(
  7731. smalltalk.method({
  7732. selector: "add:",
  7733. protocol: 'adding/removing',
  7734. fn: function (anObject){
  7735. var self=this;
  7736. var bucket;
  7737. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7738. return smalltalk.withContext(function($ctx1) {
  7739. //>>excludeEnd("ctx");
  7740. var $2,$1,$receiver;
  7741. bucket=self._bucketsOfElement_(anObject);
  7742. $2=_st(bucket)._second();
  7743. if(($receiver = $2) == null || $receiver.isNil){
  7744. var object,slowBucket;
  7745. object=_st(bucket)._first();
  7746. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7747. $ctx1.sendIdx["first"]=1;
  7748. //>>excludeEnd("ctx");
  7749. object;
  7750. slowBucket=_st(bucket)._third();
  7751. slowBucket;
  7752. _st(slowBucket)._indexOf_ifAbsent_(object,(function(){
  7753. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7754. return smalltalk.withContext(function($ctx2) {
  7755. //>>excludeEnd("ctx");
  7756. _st(slowBucket)._add_(object);
  7757. self["@size"]=_st(self["@size"]).__plus((1));
  7758. return self["@size"];
  7759. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7760. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  7761. //>>excludeEnd("ctx");
  7762. }));
  7763. $1=object;
  7764. } else {
  7765. var primitiveBucket;
  7766. primitiveBucket=$receiver;
  7767. $1=self._add_in_(_st(bucket)._first(),primitiveBucket);
  7768. };
  7769. return $1;
  7770. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7771. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},globals.Set)});
  7772. //>>excludeEnd("ctx");
  7773. },
  7774. //>>excludeStart("ide", pragmas.excludeIdeData);
  7775. args: ["anObject"],
  7776. 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 ]",
  7777. referencedClasses: [],
  7778. //>>excludeEnd("ide");
  7779. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  7780. }),
  7781. globals.Set);
  7782. smalltalk.addMethod(
  7783. smalltalk.method({
  7784. selector: "add:in:",
  7785. protocol: 'private',
  7786. fn: function (anObject,anotherObject){
  7787. var self=this;
  7788. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7789. return smalltalk.withContext(function($ctx1) {
  7790. //>>excludeEnd("ctx");
  7791. if (anObject in anotherObject.store) { return false; }
  7792. self['@size']++;
  7793. return anotherObject.store[anObject] = true;
  7794. ;
  7795. return self;
  7796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7797. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  7798. //>>excludeEnd("ctx");
  7799. },
  7800. //>>excludeStart("ide", pragmas.excludeIdeData);
  7801. args: ["anObject", "anotherObject"],
  7802. source: "add: anObject in: anotherObject\x0a\x09<\x0a\x09\x09if (anObject in anotherObject.store) { return false; }\x0a\x09\x09self['@size']++;\x0a\x09\x09return anotherObject.store[anObject] = true;\x0a\x09>",
  7803. referencedClasses: [],
  7804. //>>excludeEnd("ide");
  7805. messageSends: []
  7806. }),
  7807. globals.Set);
  7808. smalltalk.addMethod(
  7809. smalltalk.method({
  7810. selector: "bucketsOfElement:",
  7811. protocol: 'private',
  7812. fn: function (anObject){
  7813. var self=this;
  7814. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7815. return smalltalk.withContext(function($ctx1) {
  7816. //>>excludeEnd("ctx");
  7817. var type, bucket, prim = anObject == null ? (anObject = nil) : anObject.valueOf();
  7818. if ((type = typeof prim) === "object") {
  7819. if (anObject !== nil) {
  7820. bucket = null;
  7821. self['@slowBucketStores'].some(function (store) {
  7822. return bucket = store._bucketOfElement_(anObject);
  7823. });
  7824. return [ anObject, null, bucket || self['@defaultBucket'] ];
  7825. }
  7826. // include nil to well-known objects under 'boolean' fastBucket
  7827. prim = null;
  7828. type = 'boolean';
  7829. }
  7830. return [ prim, self['@fastBuckets'][type] ];
  7831. ;
  7832. return self;
  7833. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7834. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},globals.Set)});
  7835. //>>excludeEnd("ctx");
  7836. },
  7837. //>>excludeStart("ide", pragmas.excludeIdeData);
  7838. args: ["anObject"],
  7839. 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>",
  7840. referencedClasses: [],
  7841. //>>excludeEnd("ide");
  7842. messageSends: []
  7843. }),
  7844. globals.Set);
  7845. smalltalk.addMethod(
  7846. smalltalk.method({
  7847. selector: "classNameOf:",
  7848. protocol: 'private',
  7849. fn: function (anObject){
  7850. var self=this;
  7851. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7852. return smalltalk.withContext(function($ctx1) {
  7853. //>>excludeEnd("ctx");
  7854. return anObject.klass && anObject.klass.className;
  7855. return self;
  7856. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7857. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},globals.Set)});
  7858. //>>excludeEnd("ctx");
  7859. },
  7860. //>>excludeStart("ide", pragmas.excludeIdeData);
  7861. args: ["anObject"],
  7862. 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 && anObject.klass.className>",
  7863. referencedClasses: [],
  7864. //>>excludeEnd("ide");
  7865. messageSends: []
  7866. }),
  7867. globals.Set);
  7868. smalltalk.addMethod(
  7869. smalltalk.method({
  7870. selector: "collect:",
  7871. protocol: 'enumerating',
  7872. fn: function (aBlock){
  7873. var self=this;
  7874. var collection;
  7875. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7876. return smalltalk.withContext(function($ctx1) {
  7877. //>>excludeEnd("ctx");
  7878. var $1;
  7879. collection=_st(self._class())._new();
  7880. self._do_((function(each){
  7881. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7882. return smalltalk.withContext(function($ctx2) {
  7883. //>>excludeEnd("ctx");
  7884. return _st(collection)._add_(_st(aBlock)._value_(each));
  7885. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7886. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7887. //>>excludeEnd("ctx");
  7888. }));
  7889. $1=collection;
  7890. return $1;
  7891. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7892. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},globals.Set)});
  7893. //>>excludeEnd("ctx");
  7894. },
  7895. //>>excludeStart("ide", pragmas.excludeIdeData);
  7896. args: ["aBlock"],
  7897. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  7898. referencedClasses: [],
  7899. //>>excludeEnd("ide");
  7900. messageSends: ["new", "class", "do:", "add:", "value:"]
  7901. }),
  7902. globals.Set);
  7903. smalltalk.addMethod(
  7904. smalltalk.method({
  7905. selector: "detect:ifNone:",
  7906. protocol: 'enumerating',
  7907. fn: function (aBlock,anotherBlock){
  7908. var self=this;
  7909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7910. return smalltalk.withContext(function($ctx1) {
  7911. //>>excludeEnd("ctx");
  7912. var $1,$2;
  7913. var $early={};
  7914. try {
  7915. self._do_((function(each){
  7916. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7917. return smalltalk.withContext(function($ctx2) {
  7918. //>>excludeEnd("ctx");
  7919. $1=_st(aBlock)._value_(each);
  7920. if(smalltalk.assert($1)){
  7921. throw $early=[each];
  7922. };
  7923. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7925. //>>excludeEnd("ctx");
  7926. }));
  7927. $2=_st(anotherBlock)._value();
  7928. return $2;
  7929. }
  7930. catch(e) {if(e===$early)return e[0]; throw e}
  7931. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7932. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},globals.Set)});
  7933. //>>excludeEnd("ctx");
  7934. },
  7935. //>>excludeStart("ide", pragmas.excludeIdeData);
  7936. args: ["aBlock", "anotherBlock"],
  7937. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  7938. referencedClasses: [],
  7939. //>>excludeEnd("ide");
  7940. messageSends: ["do:", "ifTrue:", "value:", "value"]
  7941. }),
  7942. globals.Set);
  7943. smalltalk.addMethod(
  7944. smalltalk.method({
  7945. selector: "do:",
  7946. protocol: 'enumerating',
  7947. fn: function (aBlock){
  7948. var self=this;
  7949. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7950. return smalltalk.withContext(function($ctx1) {
  7951. //>>excludeEnd("ctx");
  7952. var el, keys, i;
  7953. el = self['@fastBuckets'];
  7954. keys = Object.keys(el);
  7955. for (i = 0; i < keys.length; ++i) {
  7956. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  7957. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  7958. else { store._do_(aBlock); }
  7959. }
  7960. el = self['@slowBucketStores'];
  7961. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  7962. self['@defaultBucket']._do_(aBlock);
  7963. ;
  7964. return self;
  7965. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7966. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Set)});
  7967. //>>excludeEnd("ctx");
  7968. },
  7969. //>>excludeStart("ide", pragmas.excludeIdeData);
  7970. args: ["aBlock"],
  7971. 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>",
  7972. referencedClasses: [],
  7973. //>>excludeEnd("ide");
  7974. messageSends: []
  7975. }),
  7976. globals.Set);
  7977. smalltalk.addMethod(
  7978. smalltalk.method({
  7979. selector: "includes:",
  7980. protocol: 'testing',
  7981. fn: function (anObject){
  7982. var self=this;
  7983. var bucket;
  7984. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7985. return smalltalk.withContext(function($ctx1) {
  7986. //>>excludeEnd("ctx");
  7987. var $2,$3,$4,$1,$receiver;
  7988. bucket=self._bucketsOfElement_(anObject);
  7989. $2=_st(bucket)._second();
  7990. if(($receiver = $2) == null || $receiver.isNil){
  7991. $3=_st(bucket)._third();
  7992. $4=_st(bucket)._first();
  7993. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  7994. $ctx1.sendIdx["first"]=1;
  7995. //>>excludeEnd("ctx");
  7996. $1=_st($3)._includes_($4);
  7997. } else {
  7998. var primitiveBucket;
  7999. primitiveBucket=$receiver;
  8000. $1=self._includes_in_(_st(bucket)._first(),primitiveBucket);
  8001. };
  8002. return $1;
  8003. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8004. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},globals.Set)});
  8005. //>>excludeEnd("ctx");
  8006. },
  8007. //>>excludeStart("ide", pragmas.excludeIdeData);
  8008. args: ["anObject"],
  8009. 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 ]",
  8010. referencedClasses: [],
  8011. //>>excludeEnd("ide");
  8012. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  8013. }),
  8014. globals.Set);
  8015. smalltalk.addMethod(
  8016. smalltalk.method({
  8017. selector: "includes:in:",
  8018. protocol: 'private',
  8019. fn: function (anObject,anotherObject){
  8020. var self=this;
  8021. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8022. return smalltalk.withContext(function($ctx1) {
  8023. //>>excludeEnd("ctx");
  8024. return anObject in anotherObject.store;
  8025. return self;
  8026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8027. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  8028. //>>excludeEnd("ctx");
  8029. },
  8030. //>>excludeStart("ide", pragmas.excludeIdeData);
  8031. args: ["anObject", "anotherObject"],
  8032. source: "includes: anObject in: anotherObject\x0a\x09<return anObject in anotherObject.store>",
  8033. referencedClasses: [],
  8034. //>>excludeEnd("ide");
  8035. messageSends: []
  8036. }),
  8037. globals.Set);
  8038. smalltalk.addMethod(
  8039. smalltalk.method({
  8040. selector: "initialize",
  8041. protocol: 'initialization',
  8042. fn: function (){
  8043. var self=this;
  8044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8045. return smalltalk.withContext(function($ctx1) {
  8046. //>>excludeEnd("ctx");
  8047. var $1;
  8048. (
  8049. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8050. $ctx1.supercall = true,
  8051. //>>excludeEnd("ctx");
  8052. globals.Set.superclass.fn.prototype._initialize.apply(_st(self), []));
  8053. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8054. $ctx1.supercall = false;
  8055. //>>excludeEnd("ctx");;
  8056. self["@defaultBucket"]=[];
  8057. self._initializeSlowBucketStores();
  8058. $1=self._removeAll();
  8059. return self;
  8060. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8061. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Set)});
  8062. //>>excludeEnd("ctx");
  8063. },
  8064. //>>excludeStart("ide", pragmas.excludeIdeData);
  8065. args: [],
  8066. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  8067. referencedClasses: [],
  8068. //>>excludeEnd("ide");
  8069. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  8070. }),
  8071. globals.Set);
  8072. smalltalk.addMethod(
  8073. smalltalk.method({
  8074. selector: "initializeSlowBucketStores",
  8075. protocol: 'initialization',
  8076. fn: function (){
  8077. var self=this;
  8078. function $ArrayBucketStore(){return globals.ArrayBucketStore||(typeof ArrayBucketStore=="undefined"?nil:ArrayBucketStore)}
  8079. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8080. return smalltalk.withContext(function($ctx1) {
  8081. //>>excludeEnd("ctx");
  8082. var $1;
  8083. $1=_st($ArrayBucketStore())._hashBlock_((function(x){
  8084. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8085. return smalltalk.withContext(function($ctx2) {
  8086. //>>excludeEnd("ctx");
  8087. return self._classNameOf_(x);
  8088. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8089. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  8090. //>>excludeEnd("ctx");
  8091. }));
  8092. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8093. $ctx1.sendIdx["hashBlock:"]=1;
  8094. //>>excludeEnd("ctx");
  8095. self["@slowBucketStores"]=[$1,_st($ArrayBucketStore())._hashBlock_((function(x){
  8096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8097. return smalltalk.withContext(function($ctx2) {
  8098. //>>excludeEnd("ctx");
  8099. return self._jsConstructorNameOf_(x);
  8100. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8101. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  8102. //>>excludeEnd("ctx");
  8103. }))];
  8104. return self;
  8105. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8106. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},globals.Set)});
  8107. //>>excludeEnd("ctx");
  8108. },
  8109. //>>excludeStart("ide", pragmas.excludeIdeData);
  8110. args: [],
  8111. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  8112. referencedClasses: ["ArrayBucketStore"],
  8113. //>>excludeEnd("ide");
  8114. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  8115. }),
  8116. globals.Set);
  8117. smalltalk.addMethod(
  8118. smalltalk.method({
  8119. selector: "jsConstructorNameOf:",
  8120. protocol: 'private',
  8121. fn: function (anObject){
  8122. var self=this;
  8123. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8124. return smalltalk.withContext(function($ctx1) {
  8125. //>>excludeEnd("ctx");
  8126. return anObject.constructor && anObject.constructor.name;
  8127. return self;
  8128. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8129. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},globals.Set)});
  8130. //>>excludeEnd("ctx");
  8131. },
  8132. //>>excludeStart("ide", pragmas.excludeIdeData);
  8133. args: ["anObject"],
  8134. source: "jsConstructorNameOf: anObject\x0a\x09<return anObject.constructor && anObject.constructor.name>",
  8135. referencedClasses: [],
  8136. //>>excludeEnd("ide");
  8137. messageSends: []
  8138. }),
  8139. globals.Set);
  8140. smalltalk.addMethod(
  8141. smalltalk.method({
  8142. selector: "printOn:",
  8143. protocol: 'printing',
  8144. fn: function (aStream){
  8145. var self=this;
  8146. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8147. return smalltalk.withContext(function($ctx1) {
  8148. //>>excludeEnd("ctx");
  8149. (
  8150. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8151. $ctx1.supercall = true,
  8152. //>>excludeEnd("ctx");
  8153. globals.Set.superclass.fn.prototype._printOn_.apply(_st(self), [aStream]));
  8154. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8155. $ctx1.supercall = false;
  8156. //>>excludeEnd("ctx");;
  8157. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8158. $ctx1.sendIdx["printOn:"]=1;
  8159. //>>excludeEnd("ctx");
  8160. _st(aStream)._nextPutAll_(" (");
  8161. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8162. $ctx1.sendIdx["nextPutAll:"]=1;
  8163. //>>excludeEnd("ctx");
  8164. self._do_separatedBy_((function(each){
  8165. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8166. return smalltalk.withContext(function($ctx2) {
  8167. //>>excludeEnd("ctx");
  8168. return _st(each)._printOn_(aStream);
  8169. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8170. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8171. //>>excludeEnd("ctx");
  8172. }),(function(){
  8173. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8174. return smalltalk.withContext(function($ctx2) {
  8175. //>>excludeEnd("ctx");
  8176. return _st(aStream)._nextPutAll_(" ");
  8177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8178. $ctx2.sendIdx["nextPutAll:"]=2;
  8179. //>>excludeEnd("ctx");
  8180. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8181. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8182. //>>excludeEnd("ctx");
  8183. }));
  8184. _st(aStream)._nextPutAll_(")");
  8185. return self;
  8186. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8187. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},globals.Set)});
  8188. //>>excludeEnd("ctx");
  8189. },
  8190. //>>excludeStart("ide", pragmas.excludeIdeData);
  8191. args: ["aStream"],
  8192. 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: ')'",
  8193. referencedClasses: [],
  8194. //>>excludeEnd("ide");
  8195. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  8196. }),
  8197. globals.Set);
  8198. smalltalk.addMethod(
  8199. smalltalk.method({
  8200. selector: "remove:ifAbsent:",
  8201. protocol: 'adding/removing',
  8202. fn: function (anObject,aBlock){
  8203. var self=this;
  8204. var bucket;
  8205. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8206. return smalltalk.withContext(function($ctx1) {
  8207. //>>excludeEnd("ctx");
  8208. var $2,$3,$4,$5,$1,$receiver;
  8209. var $early={};
  8210. try {
  8211. bucket=self._bucketsOfElement_(anObject);
  8212. $2=_st(bucket)._second();
  8213. if(($receiver = $2) == null || $receiver.isNil){
  8214. $3=_st(bucket)._third();
  8215. $4=_st(bucket)._first();
  8216. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8217. $ctx1.sendIdx["first"]=1;
  8218. //>>excludeEnd("ctx");
  8219. _st($3)._remove_ifAbsent_($4,(function(){
  8220. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8221. return smalltalk.withContext(function($ctx2) {
  8222. //>>excludeEnd("ctx");
  8223. $5=_st(aBlock)._value();
  8224. throw $early=[$5];
  8225. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8226. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8227. //>>excludeEnd("ctx");
  8228. }));
  8229. self["@size"]=_st(self["@size"]).__minus((1));
  8230. $1=self["@size"];
  8231. } else {
  8232. var primitiveBucket;
  8233. primitiveBucket=$receiver;
  8234. $1=self._remove_in_(_st(bucket)._first(),primitiveBucket);
  8235. };
  8236. return $1;
  8237. }
  8238. catch(e) {if(e===$early)return e[0]; throw e}
  8239. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8240. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},globals.Set)});
  8241. //>>excludeEnd("ctx");
  8242. },
  8243. //>>excludeStart("ide", pragmas.excludeIdeData);
  8244. args: ["anObject", "aBlock"],
  8245. 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 ]",
  8246. referencedClasses: [],
  8247. //>>excludeEnd("ide");
  8248. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  8249. }),
  8250. globals.Set);
  8251. smalltalk.addMethod(
  8252. smalltalk.method({
  8253. selector: "remove:in:",
  8254. protocol: 'private',
  8255. fn: function (anObject,anotherObject){
  8256. var self=this;
  8257. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8258. return smalltalk.withContext(function($ctx1) {
  8259. //>>excludeEnd("ctx");
  8260. if (delete anotherObject.store[anObject]) self['@size']--;
  8261. return self;
  8262. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8263. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},globals.Set)});
  8264. //>>excludeEnd("ctx");
  8265. },
  8266. //>>excludeStart("ide", pragmas.excludeIdeData);
  8267. args: ["anObject", "anotherObject"],
  8268. source: "remove: anObject in: anotherObject\x0a\x09<if (delete anotherObject.store[anObject]) self['@size']-->",
  8269. referencedClasses: [],
  8270. //>>excludeEnd("ide");
  8271. messageSends: []
  8272. }),
  8273. globals.Set);
  8274. smalltalk.addMethod(
  8275. smalltalk.method({
  8276. selector: "removeAll",
  8277. protocol: 'adding/removing',
  8278. fn: function (){
  8279. var self=this;
  8280. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8281. return smalltalk.withContext(function($ctx1) {
  8282. //>>excludeEnd("ctx");
  8283. self['@fastBuckets'] = {
  8284. 'boolean': { store: Object.create(null), fn: function (x) { return {'true': true, 'false': false, 'null': null}[x]; } },
  8285. 'number': { store: Object.create(null), fn: Number },
  8286. 'string': { store: Object.create(null) }
  8287. };
  8288. self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  8289. self['@defaultBucket']._removeAll();
  8290. self['@size'] = 0;
  8291. ;
  8292. return self;
  8293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8294. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},globals.Set)});
  8295. //>>excludeEnd("ctx");
  8296. },
  8297. //>>excludeStart("ide", pragmas.excludeIdeData);
  8298. args: [],
  8299. 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>",
  8300. referencedClasses: [],
  8301. //>>excludeEnd("ide");
  8302. messageSends: []
  8303. }),
  8304. globals.Set);
  8305. smalltalk.addMethod(
  8306. smalltalk.method({
  8307. selector: "select:",
  8308. protocol: 'enumerating',
  8309. fn: function (aBlock){
  8310. var self=this;
  8311. var collection;
  8312. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8313. return smalltalk.withContext(function($ctx1) {
  8314. //>>excludeEnd("ctx");
  8315. var $1,$2;
  8316. collection=_st(self._class())._new();
  8317. self._do_((function(each){
  8318. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8319. return smalltalk.withContext(function($ctx2) {
  8320. //>>excludeEnd("ctx");
  8321. $1=_st(aBlock)._value_(each);
  8322. if(smalltalk.assert($1)){
  8323. return _st(collection)._add_(each);
  8324. };
  8325. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8326. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8327. //>>excludeEnd("ctx");
  8328. }));
  8329. $2=collection;
  8330. return $2;
  8331. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8332. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},globals.Set)});
  8333. //>>excludeEnd("ctx");
  8334. },
  8335. //>>excludeStart("ide", pragmas.excludeIdeData);
  8336. args: ["aBlock"],
  8337. 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",
  8338. referencedClasses: [],
  8339. //>>excludeEnd("ide");
  8340. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  8341. }),
  8342. globals.Set);
  8343. smalltalk.addMethod(
  8344. smalltalk.method({
  8345. selector: "size",
  8346. protocol: 'accessing',
  8347. fn: function (){
  8348. var self=this;
  8349. var $1;
  8350. $1=self["@size"];
  8351. return $1;
  8352. },
  8353. //>>excludeStart("ide", pragmas.excludeIdeData);
  8354. args: [],
  8355. source: "size\x0a\x09^ size",
  8356. referencedClasses: [],
  8357. //>>excludeEnd("ide");
  8358. messageSends: []
  8359. }),
  8360. globals.Set);
  8361. smalltalk.addClass('Queue', globals.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  8362. //>>excludeStart("ide", pragmas.excludeIdeData);
  8363. 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.";
  8364. //>>excludeEnd("ide");
  8365. smalltalk.addMethod(
  8366. smalltalk.method({
  8367. selector: "initialize",
  8368. protocol: 'initialization',
  8369. fn: function (){
  8370. var self=this;
  8371. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  8372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8373. return smalltalk.withContext(function($ctx1) {
  8374. //>>excludeEnd("ctx");
  8375. (
  8376. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8377. $ctx1.supercall = true,
  8378. //>>excludeEnd("ctx");
  8379. globals.Queue.superclass.fn.prototype._initialize.apply(_st(self), []));
  8380. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8381. $ctx1.supercall = false;
  8382. //>>excludeEnd("ctx");;
  8383. self["@read"]=_st($OrderedCollection())._new();
  8384. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8385. $ctx1.sendIdx["new"]=1;
  8386. //>>excludeEnd("ctx");
  8387. self["@write"]=_st($OrderedCollection())._new();
  8388. self["@readIndex"]=(1);
  8389. return self;
  8390. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8391. }, function($ctx1) {$ctx1.fill(self,"initialize",{},globals.Queue)});
  8392. //>>excludeEnd("ctx");
  8393. },
  8394. //>>excludeStart("ide", pragmas.excludeIdeData);
  8395. args: [],
  8396. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  8397. referencedClasses: ["OrderedCollection"],
  8398. //>>excludeEnd("ide");
  8399. messageSends: ["initialize", "new"]
  8400. }),
  8401. globals.Queue);
  8402. smalltalk.addMethod(
  8403. smalltalk.method({
  8404. selector: "next",
  8405. protocol: 'accessing',
  8406. fn: function (){
  8407. var self=this;
  8408. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8409. return smalltalk.withContext(function($ctx1) {
  8410. //>>excludeEnd("ctx");
  8411. var $1;
  8412. $1=self._nextIfAbsent_((function(){
  8413. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8414. return smalltalk.withContext(function($ctx2) {
  8415. //>>excludeEnd("ctx");
  8416. return self._error_("Cannot read from empty Queue.");
  8417. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8419. //>>excludeEnd("ctx");
  8420. }));
  8421. return $1;
  8422. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8423. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Queue)});
  8424. //>>excludeEnd("ctx");
  8425. },
  8426. //>>excludeStart("ide", pragmas.excludeIdeData);
  8427. args: [],
  8428. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  8429. referencedClasses: [],
  8430. //>>excludeEnd("ide");
  8431. messageSends: ["nextIfAbsent:", "error:"]
  8432. }),
  8433. globals.Queue);
  8434. smalltalk.addMethod(
  8435. smalltalk.method({
  8436. selector: "nextIfAbsent:",
  8437. protocol: 'accessing',
  8438. fn: function (aBlock){
  8439. var self=this;
  8440. var result;
  8441. function $OrderedCollection(){return globals.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  8442. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8443. return smalltalk.withContext(function($ctx1) {
  8444. //>>excludeEnd("ctx");
  8445. var $1,$2,$3,$4;
  8446. var $early={};
  8447. try {
  8448. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  8449. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8450. return smalltalk.withContext(function($ctx2) {
  8451. //>>excludeEnd("ctx");
  8452. $1=_st(self["@write"])._isEmpty();
  8453. if(smalltalk.assert($1)){
  8454. $2=_st(self["@readIndex"]).__gt((1));
  8455. if(smalltalk.assert($2)){
  8456. self["@read"]=[];
  8457. self["@read"];
  8458. self["@readIndex"]=(1);
  8459. self["@readIndex"];
  8460. };
  8461. $3=_st(aBlock)._value();
  8462. throw $early=[$3];
  8463. };
  8464. self["@read"]=self["@write"];
  8465. self["@read"];
  8466. self["@readIndex"]=(1);
  8467. self["@readIndex"];
  8468. self["@write"]=_st($OrderedCollection())._new();
  8469. self["@write"];
  8470. return _st(self["@read"])._first();
  8471. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8473. //>>excludeEnd("ctx");
  8474. }));
  8475. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  8476. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  8477. $4=result;
  8478. return $4;
  8479. }
  8480. catch(e) {if(e===$early)return e[0]; throw e}
  8481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8482. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},globals.Queue)});
  8483. //>>excludeEnd("ctx");
  8484. },
  8485. //>>excludeStart("ide", pragmas.excludeIdeData);
  8486. args: ["aBlock"],
  8487. 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",
  8488. referencedClasses: ["OrderedCollection"],
  8489. //>>excludeEnd("ide");
  8490. messageSends: ["at:ifAbsent:", "ifTrue:", "isEmpty", ">", "value", "new", "first", "at:put:", "+"]
  8491. }),
  8492. globals.Queue);
  8493. smalltalk.addMethod(
  8494. smalltalk.method({
  8495. selector: "nextPut:",
  8496. protocol: 'accessing',
  8497. fn: function (anObject){
  8498. var self=this;
  8499. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8500. return smalltalk.withContext(function($ctx1) {
  8501. //>>excludeEnd("ctx");
  8502. _st(self["@write"])._add_(anObject);
  8503. return self;
  8504. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8505. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Queue)});
  8506. //>>excludeEnd("ctx");
  8507. },
  8508. //>>excludeStart("ide", pragmas.excludeIdeData);
  8509. args: ["anObject"],
  8510. source: "nextPut: anObject\x0a\x09write add: anObject",
  8511. referencedClasses: [],
  8512. //>>excludeEnd("ide");
  8513. messageSends: ["add:"]
  8514. }),
  8515. globals.Queue);
  8516. smalltalk.addClass('RegularExpression', globals.Object, [], 'Kernel-Collections');
  8517. //>>excludeStart("ide", pragmas.excludeIdeData);
  8518. globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  8519. //>>excludeEnd("ide");
  8520. smalltalk.addMethod(
  8521. smalltalk.method({
  8522. selector: "compile:",
  8523. protocol: 'evaluating',
  8524. fn: function (aString){
  8525. var self=this;
  8526. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8527. return smalltalk.withContext(function($ctx1) {
  8528. //>>excludeEnd("ctx");
  8529. return self.compile(aString);
  8530. return self;
  8531. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8532. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},globals.RegularExpression)});
  8533. //>>excludeEnd("ctx");
  8534. },
  8535. //>>excludeStart("ide", pragmas.excludeIdeData);
  8536. args: ["aString"],
  8537. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  8538. referencedClasses: [],
  8539. //>>excludeEnd("ide");
  8540. messageSends: []
  8541. }),
  8542. globals.RegularExpression);
  8543. smalltalk.addMethod(
  8544. smalltalk.method({
  8545. selector: "exec:",
  8546. protocol: 'evaluating',
  8547. fn: function (aString){
  8548. var self=this;
  8549. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8550. return smalltalk.withContext(function($ctx1) {
  8551. //>>excludeEnd("ctx");
  8552. return self.exec(aString) || nil;
  8553. return self;
  8554. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8555. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},globals.RegularExpression)});
  8556. //>>excludeEnd("ctx");
  8557. },
  8558. //>>excludeStart("ide", pragmas.excludeIdeData);
  8559. args: ["aString"],
  8560. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  8561. referencedClasses: [],
  8562. //>>excludeEnd("ide");
  8563. messageSends: []
  8564. }),
  8565. globals.RegularExpression);
  8566. smalltalk.addMethod(
  8567. smalltalk.method({
  8568. selector: "test:",
  8569. protocol: 'evaluating',
  8570. fn: function (aString){
  8571. var self=this;
  8572. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8573. return smalltalk.withContext(function($ctx1) {
  8574. //>>excludeEnd("ctx");
  8575. return self.test(aString);
  8576. return self;
  8577. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8578. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},globals.RegularExpression)});
  8579. //>>excludeEnd("ctx");
  8580. },
  8581. //>>excludeStart("ide", pragmas.excludeIdeData);
  8582. args: ["aString"],
  8583. source: "test: aString\x0a\x09<return self.test(aString)>",
  8584. referencedClasses: [],
  8585. //>>excludeEnd("ide");
  8586. messageSends: []
  8587. }),
  8588. globals.RegularExpression);
  8589. smalltalk.addMethod(
  8590. smalltalk.method({
  8591. selector: "fromString:",
  8592. protocol: 'instance creation',
  8593. fn: function (aString){
  8594. var self=this;
  8595. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8596. return smalltalk.withContext(function($ctx1) {
  8597. //>>excludeEnd("ctx");
  8598. var $1;
  8599. $1=self._fromString_flag_(aString,"");
  8600. return $1;
  8601. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8602. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},globals.RegularExpression.klass)});
  8603. //>>excludeEnd("ctx");
  8604. },
  8605. //>>excludeStart("ide", pragmas.excludeIdeData);
  8606. args: ["aString"],
  8607. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  8608. referencedClasses: [],
  8609. //>>excludeEnd("ide");
  8610. messageSends: ["fromString:flag:"]
  8611. }),
  8612. globals.RegularExpression.klass);
  8613. smalltalk.addMethod(
  8614. smalltalk.method({
  8615. selector: "fromString:flag:",
  8616. protocol: 'instance creation',
  8617. fn: function (aString,anotherString){
  8618. var self=this;
  8619. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8620. return smalltalk.withContext(function($ctx1) {
  8621. //>>excludeEnd("ctx");
  8622. return new RegExp(aString, anotherString);
  8623. return self;
  8624. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8625. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},globals.RegularExpression.klass)});
  8626. //>>excludeEnd("ctx");
  8627. },
  8628. //>>excludeStart("ide", pragmas.excludeIdeData);
  8629. args: ["aString", "anotherString"],
  8630. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  8631. referencedClasses: [],
  8632. //>>excludeEnd("ide");
  8633. messageSends: []
  8634. }),
  8635. globals.RegularExpression.klass);
  8636. smalltalk.addClass('Stream', globals.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  8637. //>>excludeStart("ide", pragmas.excludeIdeData);
  8638. 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.";
  8639. //>>excludeEnd("ide");
  8640. smalltalk.addMethod(
  8641. smalltalk.method({
  8642. selector: "<<",
  8643. protocol: 'writing',
  8644. fn: function (anObject){
  8645. var self=this;
  8646. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8647. return smalltalk.withContext(function($ctx1) {
  8648. //>>excludeEnd("ctx");
  8649. self._write_(anObject);
  8650. return self;
  8651. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8652. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},globals.Stream)});
  8653. //>>excludeEnd("ctx");
  8654. },
  8655. //>>excludeStart("ide", pragmas.excludeIdeData);
  8656. args: ["anObject"],
  8657. source: "<< anObject\x0a\x09self write: anObject",
  8658. referencedClasses: [],
  8659. //>>excludeEnd("ide");
  8660. messageSends: ["write:"]
  8661. }),
  8662. globals.Stream);
  8663. smalltalk.addMethod(
  8664. smalltalk.method({
  8665. selector: "atEnd",
  8666. protocol: 'testing',
  8667. fn: function (){
  8668. var self=this;
  8669. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8670. return smalltalk.withContext(function($ctx1) {
  8671. //>>excludeEnd("ctx");
  8672. var $1;
  8673. $1=_st(self._position()).__eq(self._size());
  8674. return $1;
  8675. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8676. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},globals.Stream)});
  8677. //>>excludeEnd("ctx");
  8678. },
  8679. //>>excludeStart("ide", pragmas.excludeIdeData);
  8680. args: [],
  8681. source: "atEnd\x0a\x09^ self position = self size",
  8682. referencedClasses: [],
  8683. //>>excludeEnd("ide");
  8684. messageSends: ["=", "position", "size"]
  8685. }),
  8686. globals.Stream);
  8687. smalltalk.addMethod(
  8688. smalltalk.method({
  8689. selector: "atStart",
  8690. protocol: 'testing',
  8691. fn: function (){
  8692. var self=this;
  8693. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8694. return smalltalk.withContext(function($ctx1) {
  8695. //>>excludeEnd("ctx");
  8696. var $1;
  8697. $1=_st(self._position()).__eq((0));
  8698. return $1;
  8699. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8700. }, function($ctx1) {$ctx1.fill(self,"atStart",{},globals.Stream)});
  8701. //>>excludeEnd("ctx");
  8702. },
  8703. //>>excludeStart("ide", pragmas.excludeIdeData);
  8704. args: [],
  8705. source: "atStart\x0a\x09^ self position = 0",
  8706. referencedClasses: [],
  8707. //>>excludeEnd("ide");
  8708. messageSends: ["=", "position"]
  8709. }),
  8710. globals.Stream);
  8711. smalltalk.addMethod(
  8712. smalltalk.method({
  8713. selector: "close",
  8714. protocol: 'actions',
  8715. fn: function (){
  8716. var self=this;
  8717. return self;
  8718. },
  8719. //>>excludeStart("ide", pragmas.excludeIdeData);
  8720. args: [],
  8721. source: "close",
  8722. referencedClasses: [],
  8723. //>>excludeEnd("ide");
  8724. messageSends: []
  8725. }),
  8726. globals.Stream);
  8727. smalltalk.addMethod(
  8728. smalltalk.method({
  8729. selector: "collection",
  8730. protocol: 'accessing',
  8731. fn: function (){
  8732. var self=this;
  8733. var $1;
  8734. $1=self["@collection"];
  8735. return $1;
  8736. },
  8737. //>>excludeStart("ide", pragmas.excludeIdeData);
  8738. args: [],
  8739. source: "collection\x0a\x09^ collection",
  8740. referencedClasses: [],
  8741. //>>excludeEnd("ide");
  8742. messageSends: []
  8743. }),
  8744. globals.Stream);
  8745. smalltalk.addMethod(
  8746. smalltalk.method({
  8747. selector: "contents",
  8748. protocol: 'accessing',
  8749. fn: function (){
  8750. var self=this;
  8751. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8752. return smalltalk.withContext(function($ctx1) {
  8753. //>>excludeEnd("ctx");
  8754. var $1;
  8755. $1=_st(self._collection())._copyFrom_to_((1),self._streamSize());
  8756. return $1;
  8757. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8758. }, function($ctx1) {$ctx1.fill(self,"contents",{},globals.Stream)});
  8759. //>>excludeEnd("ctx");
  8760. },
  8761. //>>excludeStart("ide", pragmas.excludeIdeData);
  8762. args: [],
  8763. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  8764. referencedClasses: [],
  8765. //>>excludeEnd("ide");
  8766. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  8767. }),
  8768. globals.Stream);
  8769. smalltalk.addMethod(
  8770. smalltalk.method({
  8771. selector: "do:",
  8772. protocol: 'enumerating',
  8773. fn: function (aBlock){
  8774. var self=this;
  8775. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8776. return smalltalk.withContext(function($ctx1) {
  8777. //>>excludeEnd("ctx");
  8778. _st((function(){
  8779. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8780. return smalltalk.withContext(function($ctx2) {
  8781. //>>excludeEnd("ctx");
  8782. return self._atEnd();
  8783. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8785. //>>excludeEnd("ctx");
  8786. }))._whileFalse_((function(){
  8787. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8788. return smalltalk.withContext(function($ctx2) {
  8789. //>>excludeEnd("ctx");
  8790. return _st(aBlock)._value_(self._next());
  8791. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8792. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  8793. //>>excludeEnd("ctx");
  8794. }));
  8795. return self;
  8796. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8797. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},globals.Stream)});
  8798. //>>excludeEnd("ctx");
  8799. },
  8800. //>>excludeStart("ide", pragmas.excludeIdeData);
  8801. args: ["aBlock"],
  8802. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  8803. referencedClasses: [],
  8804. //>>excludeEnd("ide");
  8805. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  8806. }),
  8807. globals.Stream);
  8808. smalltalk.addMethod(
  8809. smalltalk.method({
  8810. selector: "flush",
  8811. protocol: 'actions',
  8812. fn: function (){
  8813. var self=this;
  8814. return self;
  8815. },
  8816. //>>excludeStart("ide", pragmas.excludeIdeData);
  8817. args: [],
  8818. source: "flush",
  8819. referencedClasses: [],
  8820. //>>excludeEnd("ide");
  8821. messageSends: []
  8822. }),
  8823. globals.Stream);
  8824. smalltalk.addMethod(
  8825. smalltalk.method({
  8826. selector: "isEmpty",
  8827. protocol: 'testing',
  8828. fn: function (){
  8829. var self=this;
  8830. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8831. return smalltalk.withContext(function($ctx1) {
  8832. //>>excludeEnd("ctx");
  8833. var $1;
  8834. $1=_st(self._size()).__eq((0));
  8835. return $1;
  8836. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8837. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},globals.Stream)});
  8838. //>>excludeEnd("ctx");
  8839. },
  8840. //>>excludeStart("ide", pragmas.excludeIdeData);
  8841. args: [],
  8842. source: "isEmpty\x0a\x09^ self size = 0",
  8843. referencedClasses: [],
  8844. //>>excludeEnd("ide");
  8845. messageSends: ["=", "size"]
  8846. }),
  8847. globals.Stream);
  8848. smalltalk.addMethod(
  8849. smalltalk.method({
  8850. selector: "next",
  8851. protocol: 'reading',
  8852. fn: function (){
  8853. var self=this;
  8854. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8855. return smalltalk.withContext(function($ctx1) {
  8856. //>>excludeEnd("ctx");
  8857. var $2,$4,$3,$1;
  8858. $2=self._atEnd();
  8859. if(smalltalk.assert($2)){
  8860. $1=nil;
  8861. } else {
  8862. $4=self._position();
  8863. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8864. $ctx1.sendIdx["position"]=1;
  8865. //>>excludeEnd("ctx");
  8866. $3=_st($4).__plus((1));
  8867. self._position_($3);
  8868. $1=_st(self["@collection"])._at_(self._position());
  8869. };
  8870. return $1;
  8871. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8872. }, function($ctx1) {$ctx1.fill(self,"next",{},globals.Stream)});
  8873. //>>excludeEnd("ctx");
  8874. },
  8875. //>>excludeStart("ide", pragmas.excludeIdeData);
  8876. args: [],
  8877. 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 ]",
  8878. referencedClasses: [],
  8879. //>>excludeEnd("ide");
  8880. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  8881. }),
  8882. globals.Stream);
  8883. smalltalk.addMethod(
  8884. smalltalk.method({
  8885. selector: "next:",
  8886. protocol: 'reading',
  8887. fn: function (anInteger){
  8888. var self=this;
  8889. var tempCollection;
  8890. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8891. return smalltalk.withContext(function($ctx1) {
  8892. //>>excludeEnd("ctx");
  8893. var $1,$2;
  8894. tempCollection=_st(_st(self._collection())._class())._new();
  8895. _st(anInteger)._timesRepeat_((function(){
  8896. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8897. return smalltalk.withContext(function($ctx2) {
  8898. //>>excludeEnd("ctx");
  8899. $1=self._atEnd();
  8900. if(! smalltalk.assert($1)){
  8901. return _st(tempCollection)._add_(self._next());
  8902. };
  8903. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8905. //>>excludeEnd("ctx");
  8906. }));
  8907. $2=tempCollection;
  8908. return $2;
  8909. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8910. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.Stream)});
  8911. //>>excludeEnd("ctx");
  8912. },
  8913. //>>excludeStart("ide", pragmas.excludeIdeData);
  8914. args: ["anInteger"],
  8915. 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",
  8916. referencedClasses: [],
  8917. //>>excludeEnd("ide");
  8918. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  8919. }),
  8920. globals.Stream);
  8921. smalltalk.addMethod(
  8922. smalltalk.method({
  8923. selector: "nextPut:",
  8924. protocol: 'writing',
  8925. fn: function (anObject){
  8926. var self=this;
  8927. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8928. return smalltalk.withContext(function($ctx1) {
  8929. //>>excludeEnd("ctx");
  8930. var $2,$1,$3,$4;
  8931. $2=self._position();
  8932. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8933. $ctx1.sendIdx["position"]=1;
  8934. //>>excludeEnd("ctx");
  8935. $1=_st($2).__plus((1));
  8936. self._position_($1);
  8937. $3=self._collection();
  8938. $4=self._position();
  8939. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8940. $ctx1.sendIdx["position"]=2;
  8941. //>>excludeEnd("ctx");
  8942. _st($3)._at_put_($4,anObject);
  8943. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  8944. return self;
  8945. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8946. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},globals.Stream)});
  8947. //>>excludeEnd("ctx");
  8948. },
  8949. //>>excludeStart("ide", pragmas.excludeIdeData);
  8950. args: ["anObject"],
  8951. 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)",
  8952. referencedClasses: [],
  8953. //>>excludeEnd("ide");
  8954. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  8955. }),
  8956. globals.Stream);
  8957. smalltalk.addMethod(
  8958. smalltalk.method({
  8959. selector: "nextPutAll:",
  8960. protocol: 'writing',
  8961. fn: function (aCollection){
  8962. var self=this;
  8963. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8964. return smalltalk.withContext(function($ctx1) {
  8965. //>>excludeEnd("ctx");
  8966. _st(aCollection)._do_((function(each){
  8967. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8968. return smalltalk.withContext(function($ctx2) {
  8969. //>>excludeEnd("ctx");
  8970. return self._nextPut_(each);
  8971. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8972. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8973. //>>excludeEnd("ctx");
  8974. }));
  8975. return self;
  8976. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8977. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},globals.Stream)});
  8978. //>>excludeEnd("ctx");
  8979. },
  8980. //>>excludeStart("ide", pragmas.excludeIdeData);
  8981. args: ["aCollection"],
  8982. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  8983. referencedClasses: [],
  8984. //>>excludeEnd("ide");
  8985. messageSends: ["do:", "nextPut:"]
  8986. }),
  8987. globals.Stream);
  8988. smalltalk.addMethod(
  8989. smalltalk.method({
  8990. selector: "nextPutString:",
  8991. protocol: 'writing',
  8992. fn: function (aString){
  8993. var self=this;
  8994. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  8995. return smalltalk.withContext(function($ctx1) {
  8996. //>>excludeEnd("ctx");
  8997. self._nextPut_(aString);
  8998. return self;
  8999. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9000. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.Stream)});
  9001. //>>excludeEnd("ctx");
  9002. },
  9003. //>>excludeStart("ide", pragmas.excludeIdeData);
  9004. args: ["aString"],
  9005. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  9006. referencedClasses: [],
  9007. //>>excludeEnd("ide");
  9008. messageSends: ["nextPut:"]
  9009. }),
  9010. globals.Stream);
  9011. smalltalk.addMethod(
  9012. smalltalk.method({
  9013. selector: "peek",
  9014. protocol: 'reading',
  9015. fn: function (){
  9016. var self=this;
  9017. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9018. return smalltalk.withContext(function($ctx1) {
  9019. //>>excludeEnd("ctx");
  9020. var $2,$1;
  9021. $2=self._atEnd();
  9022. if(! smalltalk.assert($2)){
  9023. $1=_st(self._collection())._at_(_st(self._position()).__plus((1)));
  9024. };
  9025. return $1;
  9026. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9027. }, function($ctx1) {$ctx1.fill(self,"peek",{},globals.Stream)});
  9028. //>>excludeEnd("ctx");
  9029. },
  9030. //>>excludeStart("ide", pragmas.excludeIdeData);
  9031. args: [],
  9032. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  9033. referencedClasses: [],
  9034. //>>excludeEnd("ide");
  9035. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  9036. }),
  9037. globals.Stream);
  9038. smalltalk.addMethod(
  9039. smalltalk.method({
  9040. selector: "position",
  9041. protocol: 'accessing',
  9042. fn: function (){
  9043. var self=this;
  9044. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9045. return smalltalk.withContext(function($ctx1) {
  9046. //>>excludeEnd("ctx");
  9047. var $2,$1,$receiver;
  9048. $2=self["@position"];
  9049. if(($receiver = $2) == null || $receiver.isNil){
  9050. self["@position"]=(0);
  9051. $1=self["@position"];
  9052. } else {
  9053. $1=$2;
  9054. };
  9055. return $1;
  9056. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9057. }, function($ctx1) {$ctx1.fill(self,"position",{},globals.Stream)});
  9058. //>>excludeEnd("ctx");
  9059. },
  9060. //>>excludeStart("ide", pragmas.excludeIdeData);
  9061. args: [],
  9062. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  9063. referencedClasses: [],
  9064. //>>excludeEnd("ide");
  9065. messageSends: ["ifNil:"]
  9066. }),
  9067. globals.Stream);
  9068. smalltalk.addMethod(
  9069. smalltalk.method({
  9070. selector: "position:",
  9071. protocol: 'accessing',
  9072. fn: function (anInteger){
  9073. var self=this;
  9074. self["@position"]=anInteger;
  9075. return self;
  9076. },
  9077. //>>excludeStart("ide", pragmas.excludeIdeData);
  9078. args: ["anInteger"],
  9079. source: "position: anInteger\x0a\x09position := anInteger",
  9080. referencedClasses: [],
  9081. //>>excludeEnd("ide");
  9082. messageSends: []
  9083. }),
  9084. globals.Stream);
  9085. smalltalk.addMethod(
  9086. smalltalk.method({
  9087. selector: "reset",
  9088. protocol: 'actions',
  9089. fn: function (){
  9090. var self=this;
  9091. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9092. return smalltalk.withContext(function($ctx1) {
  9093. //>>excludeEnd("ctx");
  9094. self._position_((0));
  9095. return self;
  9096. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9097. }, function($ctx1) {$ctx1.fill(self,"reset",{},globals.Stream)});
  9098. //>>excludeEnd("ctx");
  9099. },
  9100. //>>excludeStart("ide", pragmas.excludeIdeData);
  9101. args: [],
  9102. source: "reset\x0a\x09self position: 0",
  9103. referencedClasses: [],
  9104. //>>excludeEnd("ide");
  9105. messageSends: ["position:"]
  9106. }),
  9107. globals.Stream);
  9108. smalltalk.addMethod(
  9109. smalltalk.method({
  9110. selector: "resetContents",
  9111. protocol: 'actions',
  9112. fn: function (){
  9113. var self=this;
  9114. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9115. return smalltalk.withContext(function($ctx1) {
  9116. //>>excludeEnd("ctx");
  9117. self._reset();
  9118. self._setStreamSize_((0));
  9119. return self;
  9120. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9121. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},globals.Stream)});
  9122. //>>excludeEnd("ctx");
  9123. },
  9124. //>>excludeStart("ide", pragmas.excludeIdeData);
  9125. args: [],
  9126. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  9127. referencedClasses: [],
  9128. //>>excludeEnd("ide");
  9129. messageSends: ["reset", "setStreamSize:"]
  9130. }),
  9131. globals.Stream);
  9132. smalltalk.addMethod(
  9133. smalltalk.method({
  9134. selector: "setCollection:",
  9135. protocol: 'accessing',
  9136. fn: function (aCollection){
  9137. var self=this;
  9138. self["@collection"]=aCollection;
  9139. return self;
  9140. },
  9141. //>>excludeStart("ide", pragmas.excludeIdeData);
  9142. args: ["aCollection"],
  9143. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  9144. referencedClasses: [],
  9145. //>>excludeEnd("ide");
  9146. messageSends: []
  9147. }),
  9148. globals.Stream);
  9149. smalltalk.addMethod(
  9150. smalltalk.method({
  9151. selector: "setStreamSize:",
  9152. protocol: 'accessing',
  9153. fn: function (anInteger){
  9154. var self=this;
  9155. self["@streamSize"]=anInteger;
  9156. return self;
  9157. },
  9158. //>>excludeStart("ide", pragmas.excludeIdeData);
  9159. args: ["anInteger"],
  9160. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  9161. referencedClasses: [],
  9162. //>>excludeEnd("ide");
  9163. messageSends: []
  9164. }),
  9165. globals.Stream);
  9166. smalltalk.addMethod(
  9167. smalltalk.method({
  9168. selector: "setToEnd",
  9169. protocol: 'positioning',
  9170. fn: function (){
  9171. var self=this;
  9172. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9173. return smalltalk.withContext(function($ctx1) {
  9174. //>>excludeEnd("ctx");
  9175. self._position_(self._size());
  9176. return self;
  9177. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9178. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},globals.Stream)});
  9179. //>>excludeEnd("ctx");
  9180. },
  9181. //>>excludeStart("ide", pragmas.excludeIdeData);
  9182. args: [],
  9183. source: "setToEnd\x0a\x09self position: self size",
  9184. referencedClasses: [],
  9185. //>>excludeEnd("ide");
  9186. messageSends: ["position:", "size"]
  9187. }),
  9188. globals.Stream);
  9189. smalltalk.addMethod(
  9190. smalltalk.method({
  9191. selector: "size",
  9192. protocol: 'accessing',
  9193. fn: function (){
  9194. var self=this;
  9195. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9196. return smalltalk.withContext(function($ctx1) {
  9197. //>>excludeEnd("ctx");
  9198. var $1;
  9199. $1=self._streamSize();
  9200. return $1;
  9201. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9202. }, function($ctx1) {$ctx1.fill(self,"size",{},globals.Stream)});
  9203. //>>excludeEnd("ctx");
  9204. },
  9205. //>>excludeStart("ide", pragmas.excludeIdeData);
  9206. args: [],
  9207. source: "size\x0a\x09^ self streamSize",
  9208. referencedClasses: [],
  9209. //>>excludeEnd("ide");
  9210. messageSends: ["streamSize"]
  9211. }),
  9212. globals.Stream);
  9213. smalltalk.addMethod(
  9214. smalltalk.method({
  9215. selector: "skip:",
  9216. protocol: 'positioning',
  9217. fn: function (anInteger){
  9218. var self=this;
  9219. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9220. return smalltalk.withContext(function($ctx1) {
  9221. //>>excludeEnd("ctx");
  9222. self._position_(_st(_st(self._position()).__plus(anInteger))._min_max_(self._size(),(0)));
  9223. return self;
  9224. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9225. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},globals.Stream)});
  9226. //>>excludeEnd("ctx");
  9227. },
  9228. //>>excludeStart("ide", pragmas.excludeIdeData);
  9229. args: ["anInteger"],
  9230. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  9231. referencedClasses: [],
  9232. //>>excludeEnd("ide");
  9233. messageSends: ["position:", "min:max:", "+", "position", "size"]
  9234. }),
  9235. globals.Stream);
  9236. smalltalk.addMethod(
  9237. smalltalk.method({
  9238. selector: "streamSize",
  9239. protocol: 'accessing',
  9240. fn: function (){
  9241. var self=this;
  9242. var $1;
  9243. $1=self["@streamSize"];
  9244. return $1;
  9245. },
  9246. //>>excludeStart("ide", pragmas.excludeIdeData);
  9247. args: [],
  9248. source: "streamSize\x0a\x09^ streamSize",
  9249. referencedClasses: [],
  9250. //>>excludeEnd("ide");
  9251. messageSends: []
  9252. }),
  9253. globals.Stream);
  9254. smalltalk.addMethod(
  9255. smalltalk.method({
  9256. selector: "write:",
  9257. protocol: 'writing',
  9258. fn: function (anObject){
  9259. var self=this;
  9260. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9261. return smalltalk.withContext(function($ctx1) {
  9262. //>>excludeEnd("ctx");
  9263. _st(anObject)._putOn_(self);
  9264. return self;
  9265. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9266. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},globals.Stream)});
  9267. //>>excludeEnd("ctx");
  9268. },
  9269. //>>excludeStart("ide", pragmas.excludeIdeData);
  9270. args: ["anObject"],
  9271. source: "write: anObject\x0a\x09anObject putOn: self",
  9272. referencedClasses: [],
  9273. //>>excludeEnd("ide");
  9274. messageSends: ["putOn:"]
  9275. }),
  9276. globals.Stream);
  9277. smalltalk.addMethod(
  9278. smalltalk.method({
  9279. selector: "on:",
  9280. protocol: 'instance creation',
  9281. fn: function (aCollection){
  9282. var self=this;
  9283. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9284. return smalltalk.withContext(function($ctx1) {
  9285. //>>excludeEnd("ctx");
  9286. var $2,$3,$1;
  9287. $2=self._new();
  9288. _st($2)._setCollection_(aCollection);
  9289. _st($2)._setStreamSize_(_st(aCollection)._size());
  9290. $3=_st($2)._yourself();
  9291. $1=$3;
  9292. return $1;
  9293. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9294. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},globals.Stream.klass)});
  9295. //>>excludeEnd("ctx");
  9296. },
  9297. //>>excludeStart("ide", pragmas.excludeIdeData);
  9298. args: ["aCollection"],
  9299. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  9300. referencedClasses: [],
  9301. //>>excludeEnd("ide");
  9302. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  9303. }),
  9304. globals.Stream.klass);
  9305. smalltalk.addClass('StringStream', globals.Stream, [], 'Kernel-Collections');
  9306. //>>excludeStart("ide", pragmas.excludeIdeData);
  9307. globals.StringStream.comment="I am a Stream specific to `String` objects.";
  9308. //>>excludeEnd("ide");
  9309. smalltalk.addMethod(
  9310. smalltalk.method({
  9311. selector: "cr",
  9312. protocol: 'writing',
  9313. fn: function (){
  9314. var self=this;
  9315. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  9316. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9317. return smalltalk.withContext(function($ctx1) {
  9318. //>>excludeEnd("ctx");
  9319. var $1;
  9320. $1=self._nextPutAll_(_st($String())._cr());
  9321. return $1;
  9322. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9323. }, function($ctx1) {$ctx1.fill(self,"cr",{},globals.StringStream)});
  9324. //>>excludeEnd("ctx");
  9325. },
  9326. //>>excludeStart("ide", pragmas.excludeIdeData);
  9327. args: [],
  9328. source: "cr\x0a\x09^ self nextPutAll: String cr",
  9329. referencedClasses: ["String"],
  9330. //>>excludeEnd("ide");
  9331. messageSends: ["nextPutAll:", "cr"]
  9332. }),
  9333. globals.StringStream);
  9334. smalltalk.addMethod(
  9335. smalltalk.method({
  9336. selector: "crlf",
  9337. protocol: 'writing',
  9338. fn: function (){
  9339. var self=this;
  9340. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  9341. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9342. return smalltalk.withContext(function($ctx1) {
  9343. //>>excludeEnd("ctx");
  9344. var $1;
  9345. $1=self._nextPutAll_(_st($String())._crlf());
  9346. return $1;
  9347. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9348. }, function($ctx1) {$ctx1.fill(self,"crlf",{},globals.StringStream)});
  9349. //>>excludeEnd("ctx");
  9350. },
  9351. //>>excludeStart("ide", pragmas.excludeIdeData);
  9352. args: [],
  9353. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  9354. referencedClasses: ["String"],
  9355. //>>excludeEnd("ide");
  9356. messageSends: ["nextPutAll:", "crlf"]
  9357. }),
  9358. globals.StringStream);
  9359. smalltalk.addMethod(
  9360. smalltalk.method({
  9361. selector: "lf",
  9362. protocol: 'writing',
  9363. fn: function (){
  9364. var self=this;
  9365. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  9366. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9367. return smalltalk.withContext(function($ctx1) {
  9368. //>>excludeEnd("ctx");
  9369. var $1;
  9370. $1=self._nextPutAll_(_st($String())._lf());
  9371. return $1;
  9372. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9373. }, function($ctx1) {$ctx1.fill(self,"lf",{},globals.StringStream)});
  9374. //>>excludeEnd("ctx");
  9375. },
  9376. //>>excludeStart("ide", pragmas.excludeIdeData);
  9377. args: [],
  9378. source: "lf\x0a\x09^ self nextPutAll: String lf",
  9379. referencedClasses: ["String"],
  9380. //>>excludeEnd("ide");
  9381. messageSends: ["nextPutAll:", "lf"]
  9382. }),
  9383. globals.StringStream);
  9384. smalltalk.addMethod(
  9385. smalltalk.method({
  9386. selector: "next:",
  9387. protocol: 'reading',
  9388. fn: function (anInteger){
  9389. var self=this;
  9390. var tempCollection;
  9391. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9392. return smalltalk.withContext(function($ctx1) {
  9393. //>>excludeEnd("ctx");
  9394. var $1,$2;
  9395. tempCollection=_st(_st(self._collection())._class())._new();
  9396. _st(anInteger)._timesRepeat_((function(){
  9397. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9398. return smalltalk.withContext(function($ctx2) {
  9399. //>>excludeEnd("ctx");
  9400. $1=self._atEnd();
  9401. if(! smalltalk.assert($1)){
  9402. tempCollection=_st(tempCollection).__comma(self._next());
  9403. return tempCollection;
  9404. };
  9405. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9407. //>>excludeEnd("ctx");
  9408. }));
  9409. $2=tempCollection;
  9410. return $2;
  9411. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9412. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},globals.StringStream)});
  9413. //>>excludeEnd("ctx");
  9414. },
  9415. //>>excludeStart("ide", pragmas.excludeIdeData);
  9416. args: ["anInteger"],
  9417. 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",
  9418. referencedClasses: [],
  9419. //>>excludeEnd("ide");
  9420. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  9421. }),
  9422. globals.StringStream);
  9423. smalltalk.addMethod(
  9424. smalltalk.method({
  9425. selector: "nextPut:",
  9426. protocol: 'writing',
  9427. fn: function (aString){
  9428. var self=this;
  9429. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9430. return smalltalk.withContext(function($ctx1) {
  9431. //>>excludeEnd("ctx");
  9432. self._nextPutAll_(aString);
  9433. return self;
  9434. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9435. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},globals.StringStream)});
  9436. //>>excludeEnd("ctx");
  9437. },
  9438. //>>excludeStart("ide", pragmas.excludeIdeData);
  9439. args: ["aString"],
  9440. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  9441. referencedClasses: [],
  9442. //>>excludeEnd("ide");
  9443. messageSends: ["nextPutAll:"]
  9444. }),
  9445. globals.StringStream);
  9446. smalltalk.addMethod(
  9447. smalltalk.method({
  9448. selector: "nextPutAll:",
  9449. protocol: 'writing',
  9450. fn: function (aString){
  9451. var self=this;
  9452. var pre,post;
  9453. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9454. return smalltalk.withContext(function($ctx1) {
  9455. //>>excludeEnd("ctx");
  9456. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  9457. $1=self._atEnd();
  9458. if(smalltalk.assert($1)){
  9459. $3=self._collection();
  9460. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9461. $ctx1.sendIdx["collection"]=1;
  9462. //>>excludeEnd("ctx");
  9463. $2=_st($3).__comma(aString);
  9464. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9465. $ctx1.sendIdx[","]=1;
  9466. //>>excludeEnd("ctx");
  9467. self._setCollection_($2);
  9468. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9469. $ctx1.sendIdx["setCollection:"]=1;
  9470. //>>excludeEnd("ctx");
  9471. } else {
  9472. $4=self._collection();
  9473. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9474. $ctx1.sendIdx["collection"]=2;
  9475. //>>excludeEnd("ctx");
  9476. $5=self._position();
  9477. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9478. $ctx1.sendIdx["position"]=1;
  9479. //>>excludeEnd("ctx");
  9480. pre=_st($4)._copyFrom_to_((1),$5);
  9481. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9482. $ctx1.sendIdx["copyFrom:to:"]=1;
  9483. //>>excludeEnd("ctx");
  9484. pre;
  9485. $6=self._collection();
  9486. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9487. $ctx1.sendIdx["collection"]=3;
  9488. //>>excludeEnd("ctx");
  9489. $9=self._position();
  9490. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9491. $ctx1.sendIdx["position"]=2;
  9492. //>>excludeEnd("ctx");
  9493. $8=_st($9).__plus((1));
  9494. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9495. $ctx1.sendIdx["+"]=2;
  9496. //>>excludeEnd("ctx");
  9497. $10=_st(aString)._size();
  9498. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9499. $ctx1.sendIdx["size"]=1;
  9500. //>>excludeEnd("ctx");
  9501. $7=_st($8).__plus($10);
  9502. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9503. $ctx1.sendIdx["+"]=1;
  9504. //>>excludeEnd("ctx");
  9505. $11=_st(self._collection())._size();
  9506. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9507. $ctx1.sendIdx["size"]=2;
  9508. //>>excludeEnd("ctx");
  9509. post=_st($6)._copyFrom_to_($7,$11);
  9510. post;
  9511. $12=_st(_st(pre).__comma(aString)).__comma(post);
  9512. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9513. $ctx1.sendIdx[","]=2;
  9514. //>>excludeEnd("ctx");
  9515. self._setCollection_($12);
  9516. };
  9517. $14=self._position();
  9518. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9519. $ctx1.sendIdx["position"]=3;
  9520. //>>excludeEnd("ctx");
  9521. $13=_st($14).__plus(_st(aString)._size());
  9522. self._position_($13);
  9523. self._setStreamSize_(_st(self._streamSize())._max_(self._position()));
  9524. return self;
  9525. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9526. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},globals.StringStream)});
  9527. //>>excludeEnd("ctx");
  9528. },
  9529. //>>excludeStart("ide", pragmas.excludeIdeData);
  9530. args: ["aString"],
  9531. 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)",
  9532. referencedClasses: [],
  9533. //>>excludeEnd("ide");
  9534. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  9535. }),
  9536. globals.StringStream);
  9537. smalltalk.addMethod(
  9538. smalltalk.method({
  9539. selector: "nextPutString:",
  9540. protocol: 'writing',
  9541. fn: function (aString){
  9542. var self=this;
  9543. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9544. return smalltalk.withContext(function($ctx1) {
  9545. //>>excludeEnd("ctx");
  9546. self._nextPutAll_(aString);
  9547. return self;
  9548. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9549. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},globals.StringStream)});
  9550. //>>excludeEnd("ctx");
  9551. },
  9552. //>>excludeStart("ide", pragmas.excludeIdeData);
  9553. args: ["aString"],
  9554. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  9555. referencedClasses: [],
  9556. //>>excludeEnd("ide");
  9557. messageSends: ["nextPutAll:"]
  9558. }),
  9559. globals.StringStream);
  9560. smalltalk.addMethod(
  9561. smalltalk.method({
  9562. selector: "space",
  9563. protocol: 'writing',
  9564. fn: function (){
  9565. var self=this;
  9566. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9567. return smalltalk.withContext(function($ctx1) {
  9568. //>>excludeEnd("ctx");
  9569. self._nextPut_(" ");
  9570. return self;
  9571. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9572. }, function($ctx1) {$ctx1.fill(self,"space",{},globals.StringStream)});
  9573. //>>excludeEnd("ctx");
  9574. },
  9575. //>>excludeStart("ide", pragmas.excludeIdeData);
  9576. args: [],
  9577. source: "space\x0a\x09self nextPut: ' '",
  9578. referencedClasses: [],
  9579. //>>excludeEnd("ide");
  9580. messageSends: ["nextPut:"]
  9581. }),
  9582. globals.StringStream);
  9583. smalltalk.addMethod(
  9584. smalltalk.method({
  9585. selector: "tab",
  9586. protocol: 'writing',
  9587. fn: function (){
  9588. var self=this;
  9589. function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
  9590. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9591. return smalltalk.withContext(function($ctx1) {
  9592. //>>excludeEnd("ctx");
  9593. var $1;
  9594. $1=self._nextPutAll_(_st($String())._tab());
  9595. return $1;
  9596. //>>excludeStart("ctx", pragmas.excludeDebugContexts);
  9597. }, function($ctx1) {$ctx1.fill(self,"tab",{},globals.StringStream)});
  9598. //>>excludeEnd("ctx");
  9599. },
  9600. //>>excludeStart("ide", pragmas.excludeIdeData);
  9601. args: [],
  9602. source: "tab\x0a\x09^ self nextPutAll: String tab",
  9603. referencedClasses: ["String"],
  9604. //>>excludeEnd("ide");
  9605. messageSends: ["nextPutAll:", "tab"]
  9606. }),
  9607. globals.StringStream);
  9608. });