1
0

Kernel-Collections.js 181 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894
  1. smalltalk.addPackage('Kernel-Collections', {});
  2. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
  3. smalltalk.addMethod(
  4. "__eq",
  5. smalltalk.method({
  6. selector: "=",
  7. category: 'comparing',
  8. fn: function (anAssociation){
  9. var self=this;
  10. return smalltalk.withContext(function($ctx1) {
  11. var $1;
  12. $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  13. return smalltalk.withContext(function($ctx2) {
  14. return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  15. return smalltalk.withContext(function($ctx3) {
  16. return _st(_st(self)._value()).__eq(_st(anAssociation)._value());
  17. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  18. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  19. return $1;
  20. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation}, smalltalk.Association)})},
  21. args: ["anAssociation"],
  22. source: "= anAssociation\x0a\x09^self class = anAssociation class and: [\x0a\x09 self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value]]",
  23. messageSends: ["and:", "=", "value", "key", "class"],
  24. referencedClasses: []
  25. }),
  26. smalltalk.Association);
  27. smalltalk.addMethod(
  28. "_key",
  29. smalltalk.method({
  30. selector: "key",
  31. category: 'accessing',
  32. fn: function (){
  33. var self=this;
  34. return smalltalk.withContext(function($ctx1) {
  35. var $1;
  36. $1=self["@key"];
  37. return $1;
  38. }, function($ctx1) {$ctx1.fill(self,"key",{}, smalltalk.Association)})},
  39. args: [],
  40. source: "key\x0a\x09^key",
  41. messageSends: [],
  42. referencedClasses: []
  43. }),
  44. smalltalk.Association);
  45. smalltalk.addMethod(
  46. "_key_",
  47. smalltalk.method({
  48. selector: "key:",
  49. category: 'accessing',
  50. fn: function (aKey){
  51. var self=this;
  52. return smalltalk.withContext(function($ctx1) {
  53. self["@key"]=aKey;
  54. return self}, function($ctx1) {$ctx1.fill(self,"key:",{aKey:aKey}, smalltalk.Association)})},
  55. args: ["aKey"],
  56. source: "key: aKey\x0a\x09key := aKey",
  57. messageSends: [],
  58. referencedClasses: []
  59. }),
  60. smalltalk.Association);
  61. smalltalk.addMethod(
  62. "_printString",
  63. smalltalk.method({
  64. selector: "printString",
  65. category: 'printing',
  66. fn: function (){
  67. var self=this;
  68. return smalltalk.withContext(function($ctx1) {
  69. var $1;
  70. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  71. return smalltalk.withContext(function($ctx2) {
  72. return _st(self)._storeOn_(aStream);
  73. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  74. return $1;
  75. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Association)})},
  76. args: [],
  77. source: "printString\x0a\x09\x22print the contents of the Association into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09self storeOn: aStream]",
  78. messageSends: ["streamContents:", "storeOn:"],
  79. referencedClasses: ["String"]
  80. }),
  81. smalltalk.Association);
  82. smalltalk.addMethod(
  83. "_storeOn_",
  84. smalltalk.method({
  85. selector: "storeOn:",
  86. category: 'printing',
  87. fn: function (aStream){
  88. var self=this;
  89. return smalltalk.withContext(function($ctx1) {
  90. _st(self["@key"])._storeOn_(aStream);
  91. _st(aStream)._nextPutAll_("->");
  92. _st(self["@value"])._storeOn_(aStream);
  93. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.Association)})},
  94. args: ["aStream"],
  95. source: "storeOn: aStream\x0a\x09\x22Store in the format: key->value\x22\x0a\x0a\x09key storeOn: aStream.\x0a\x09aStream nextPutAll: '->'.\x0a\x09value storeOn: aStream.",
  96. messageSends: ["storeOn:", "nextPutAll:"],
  97. referencedClasses: []
  98. }),
  99. smalltalk.Association);
  100. smalltalk.addMethod(
  101. "_value",
  102. smalltalk.method({
  103. selector: "value",
  104. category: 'accessing',
  105. fn: function (){
  106. var self=this;
  107. return smalltalk.withContext(function($ctx1) {
  108. var $1;
  109. $1=self["@value"];
  110. return $1;
  111. }, function($ctx1) {$ctx1.fill(self,"value",{}, smalltalk.Association)})},
  112. args: [],
  113. source: "value\x0a\x09^value",
  114. messageSends: [],
  115. referencedClasses: []
  116. }),
  117. smalltalk.Association);
  118. smalltalk.addMethod(
  119. "_value_",
  120. smalltalk.method({
  121. selector: "value:",
  122. category: 'accessing',
  123. fn: function (aValue){
  124. var self=this;
  125. return smalltalk.withContext(function($ctx1) {
  126. self["@value"]=aValue;
  127. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aValue:aValue}, smalltalk.Association)})},
  128. args: ["aValue"],
  129. source: "value: aValue\x0a\x09value := aValue",
  130. messageSends: [],
  131. referencedClasses: []
  132. }),
  133. smalltalk.Association);
  134. smalltalk.addMethod(
  135. "_key_value_",
  136. smalltalk.method({
  137. selector: "key:value:",
  138. category: 'instance creation',
  139. fn: function (aKey,aValue){
  140. var self=this;
  141. return smalltalk.withContext(function($ctx1) {
  142. var $2,$3,$1;
  143. $2=_st(self)._new();
  144. _st($2)._key_(aKey);
  145. _st($2)._value_(aValue);
  146. $3=_st($2)._yourself();
  147. $1=$3;
  148. return $1;
  149. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue}, smalltalk.Association.klass)})},
  150. args: ["aKey", "aValue"],
  151. source: "key: aKey value: aValue\x0a\x09 ^self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  152. messageSends: ["key:", "new", "value:", "yourself"],
  153. referencedClasses: []
  154. }),
  155. smalltalk.Association.klass);
  156. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel-Collections');
  157. smalltalk.addMethod(
  158. "__comma",
  159. smalltalk.method({
  160. selector: ",",
  161. category: 'copying',
  162. fn: function (aCollection){
  163. var self=this;
  164. return smalltalk.withContext(function($ctx1) {
  165. var $2,$3,$1;
  166. $2=_st(self)._copy();
  167. _st($2)._addAll_(aCollection);
  168. $3=_st($2)._yourself();
  169. $1=$3;
  170. return $1;
  171. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.Collection)})},
  172. args: ["aCollection"],
  173. source: ", aCollection\x0a\x09^self copy \x0a\x09 addAll: aCollection; \x0a\x09 yourself",
  174. messageSends: ["addAll:", "copy", "yourself"],
  175. referencedClasses: []
  176. }),
  177. smalltalk.Collection);
  178. smalltalk.addMethod(
  179. "_add_",
  180. smalltalk.method({
  181. selector: "add:",
  182. category: 'adding/removing',
  183. fn: function (anObject){
  184. var self=this;
  185. return smalltalk.withContext(function($ctx1) {
  186. _st(self)._subclassResponsibility();
  187. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Collection)})},
  188. args: ["anObject"],
  189. source: "add: anObject\x0a\x09self subclassResponsibility",
  190. messageSends: ["subclassResponsibility"],
  191. referencedClasses: []
  192. }),
  193. smalltalk.Collection);
  194. smalltalk.addMethod(
  195. "_addAll_",
  196. smalltalk.method({
  197. selector: "addAll:",
  198. category: 'adding/removing',
  199. fn: function (aCollection){
  200. var self=this;
  201. return smalltalk.withContext(function($ctx1) {
  202. var $1;
  203. _st(aCollection)._do_((function(each){
  204. return smalltalk.withContext(function($ctx2) {
  205. return _st(self)._add_(each);
  206. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  207. $1=aCollection;
  208. return $1;
  209. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection}, smalltalk.Collection)})},
  210. args: ["aCollection"],
  211. source: "addAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self add: each].\x0a\x09^aCollection",
  212. messageSends: ["do:", "add:"],
  213. referencedClasses: []
  214. }),
  215. smalltalk.Collection);
  216. smalltalk.addMethod(
  217. "_asArray",
  218. smalltalk.method({
  219. selector: "asArray",
  220. category: 'converting',
  221. fn: function (){
  222. var self=this;
  223. return smalltalk.withContext(function($ctx1) {
  224. var $1;
  225. $1=_st((smalltalk.Array || Array))._withAll_(self);
  226. return $1;
  227. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Collection)})},
  228. args: [],
  229. source: "asArray\x0a\x09^Array withAll: self",
  230. messageSends: ["withAll:"],
  231. referencedClasses: ["Array"]
  232. }),
  233. smalltalk.Collection);
  234. smalltalk.addMethod(
  235. "_asJSON",
  236. smalltalk.method({
  237. selector: "asJSON",
  238. category: 'converting',
  239. fn: function (){
  240. var self=this;
  241. return smalltalk.withContext(function($ctx1) {
  242. var $1;
  243. $1=_st(_st(self)._asArray())._collect_((function(each){
  244. return smalltalk.withContext(function($ctx2) {
  245. return _st(each)._asJSON();
  246. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  247. return $1;
  248. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Collection)})},
  249. args: [],
  250. source: "asJSON\x0a\x09^self asArray collect: [:each | each asJSON]",
  251. messageSends: ["collect:", "asJSON", "asArray"],
  252. referencedClasses: []
  253. }),
  254. smalltalk.Collection);
  255. smalltalk.addMethod(
  256. "_asOrderedCollection",
  257. smalltalk.method({
  258. selector: "asOrderedCollection",
  259. category: 'converting',
  260. fn: function (){
  261. var self=this;
  262. return smalltalk.withContext(function($ctx1) {
  263. var $1;
  264. $1=_st(self)._asArray();
  265. return $1;
  266. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{}, smalltalk.Collection)})},
  267. args: [],
  268. source: "asOrderedCollection\x0a\x09^self asArray",
  269. messageSends: ["asArray"],
  270. referencedClasses: []
  271. }),
  272. smalltalk.Collection);
  273. smalltalk.addMethod(
  274. "_asSet",
  275. smalltalk.method({
  276. selector: "asSet",
  277. category: 'converting',
  278. fn: function (){
  279. var self=this;
  280. return smalltalk.withContext(function($ctx1) {
  281. var $1;
  282. $1=_st((smalltalk.Set || Set))._withAll_(self);
  283. return $1;
  284. }, function($ctx1) {$ctx1.fill(self,"asSet",{}, smalltalk.Collection)})},
  285. args: [],
  286. source: "asSet\x0a\x09^Set withAll: self",
  287. messageSends: ["withAll:"],
  288. referencedClasses: ["Set"]
  289. }),
  290. smalltalk.Collection);
  291. smalltalk.addMethod(
  292. "_collect_",
  293. smalltalk.method({
  294. selector: "collect:",
  295. category: 'enumerating',
  296. fn: function (aBlock){
  297. var self=this;
  298. var stream;
  299. return smalltalk.withContext(function($ctx1) {
  300. var $1;
  301. stream=_st(_st(_st(self)._class())._new())._writeStream();
  302. _st(self)._do_((function(each){
  303. return smalltalk.withContext(function($ctx2) {
  304. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  305. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  306. $1=_st(stream)._contents();
  307. return $1;
  308. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)})},
  309. args: ["aBlock"],
  310. 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",
  311. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"],
  312. referencedClasses: []
  313. }),
  314. smalltalk.Collection);
  315. smalltalk.addMethod(
  316. "_copyWith_",
  317. smalltalk.method({
  318. selector: "copyWith:",
  319. category: 'copying',
  320. fn: function (anObject){
  321. var self=this;
  322. return smalltalk.withContext(function($ctx1) {
  323. var $2,$3,$1;
  324. $2=_st(self)._copy();
  325. _st($2)._add_(anObject);
  326. $3=_st($2)._yourself();
  327. $1=$3;
  328. return $1;
  329. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject}, smalltalk.Collection)})},
  330. args: ["anObject"],
  331. source: "copyWith: anObject\x0a\x09^self copy add: anObject; yourself",
  332. messageSends: ["add:", "copy", "yourself"],
  333. referencedClasses: []
  334. }),
  335. smalltalk.Collection);
  336. smalltalk.addMethod(
  337. "_copyWithAll_",
  338. smalltalk.method({
  339. selector: "copyWithAll:",
  340. category: 'copying',
  341. fn: function (aCollection){
  342. var self=this;
  343. return smalltalk.withContext(function($ctx1) {
  344. var $2,$3,$1;
  345. $2=_st(self)._copy();
  346. _st($2)._addAll_(aCollection);
  347. $3=_st($2)._yourself();
  348. $1=$3;
  349. return $1;
  350. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection}, smalltalk.Collection)})},
  351. args: ["aCollection"],
  352. source: "copyWithAll: aCollection\x0a\x09^self copy addAll: aCollection; yourself",
  353. messageSends: ["addAll:", "copy", "yourself"],
  354. referencedClasses: []
  355. }),
  356. smalltalk.Collection);
  357. smalltalk.addMethod(
  358. "_copyWithoutAll_",
  359. smalltalk.method({
  360. selector: "copyWithoutAll:",
  361. category: 'copying',
  362. fn: function (aCollection){
  363. var self=this;
  364. return smalltalk.withContext(function($ctx1) {
  365. var $1;
  366. $1=_st(self)._reject_((function(each){
  367. return smalltalk.withContext(function($ctx2) {
  368. return _st(aCollection)._includes_(each);
  369. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  370. return $1;
  371. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection}, smalltalk.Collection)})},
  372. args: ["aCollection"],
  373. 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]",
  374. messageSends: ["reject:", "includes:"],
  375. referencedClasses: []
  376. }),
  377. smalltalk.Collection);
  378. smalltalk.addMethod(
  379. "_detect_",
  380. smalltalk.method({
  381. selector: "detect:",
  382. category: 'enumerating',
  383. fn: function (aBlock){
  384. var self=this;
  385. return smalltalk.withContext(function($ctx1) {
  386. var $1;
  387. $1=_st(self)._detect_ifNone_(aBlock,(function(){
  388. return smalltalk.withContext(function($ctx2) {
  389. return _st(self)._errorNotFound();
  390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  391. return $1;
  392. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Collection)})},
  393. args: ["aBlock"],
  394. source: "detect: aBlock\x0a\x09^self detect: aBlock ifNone: [self errorNotFound]",
  395. messageSends: ["detect:ifNone:", "errorNotFound"],
  396. referencedClasses: []
  397. }),
  398. smalltalk.Collection);
  399. smalltalk.addMethod(
  400. "_detect_ifNone_",
  401. smalltalk.method({
  402. selector: "detect:ifNone:",
  403. category: 'enumerating',
  404. fn: function (aBlock,anotherBlock){
  405. var self=this;
  406. return smalltalk.withContext(function($ctx1) {
  407. _st(self)._subclassResponsibility();
  408. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Collection)})},
  409. args: ["aBlock", "anotherBlock"],
  410. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  411. messageSends: ["subclassResponsibility"],
  412. referencedClasses: []
  413. }),
  414. smalltalk.Collection);
  415. smalltalk.addMethod(
  416. "_do_",
  417. smalltalk.method({
  418. selector: "do:",
  419. category: 'enumerating',
  420. fn: function (aBlock){
  421. var self=this;
  422. return smalltalk.withContext(function($ctx1) {
  423. _st(self)._subclassResponsibility();
  424. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Collection)})},
  425. args: ["aBlock"],
  426. source: "do: aBlock\x0a\x09self subclassResponsibility",
  427. messageSends: ["subclassResponsibility"],
  428. referencedClasses: []
  429. }),
  430. smalltalk.Collection);
  431. smalltalk.addMethod(
  432. "_do_separatedBy_",
  433. smalltalk.method({
  434. selector: "do:separatedBy:",
  435. category: 'enumerating',
  436. fn: function (aBlock,anotherBlock){
  437. var self=this;
  438. var actionBeforeElement;
  439. return smalltalk.withContext(function($ctx1) {
  440. actionBeforeElement=(function(){
  441. return smalltalk.withContext(function($ctx2) {
  442. actionBeforeElement=anotherBlock;
  443. return actionBeforeElement;
  444. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})});
  445. _st(self)._do_((function(each){
  446. return smalltalk.withContext(function($ctx2) {
  447. _st(actionBeforeElement)._value();
  448. return _st(aBlock)._value_(each);
  449. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  450. return self}, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement}, smalltalk.Collection)})},
  451. args: ["aBlock", "anotherBlock"],
  452. source: "do: aBlock separatedBy: anotherBlock\x0a\x09| actionBeforeElement |\x0a\x09actionBeforeElement := [actionBeforeElement := anotherBlock].\x0a\x09self do: [:each |\x0a \x09actionBeforeElement value.\x0a\x09 aBlock value: each]",
  453. messageSends: ["do:", "value", "value:"],
  454. referencedClasses: []
  455. }),
  456. smalltalk.Collection);
  457. smalltalk.addMethod(
  458. "_errorNotFound",
  459. smalltalk.method({
  460. selector: "errorNotFound",
  461. category: 'error handling',
  462. fn: function (){
  463. var self=this;
  464. return smalltalk.withContext(function($ctx1) {
  465. _st(self)._error_("Object is not in the collection");
  466. return self}, function($ctx1) {$ctx1.fill(self,"errorNotFound",{}, smalltalk.Collection)})},
  467. args: [],
  468. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  469. messageSends: ["error:"],
  470. referencedClasses: []
  471. }),
  472. smalltalk.Collection);
  473. smalltalk.addMethod(
  474. "_ifEmpty_",
  475. smalltalk.method({
  476. selector: "ifEmpty:",
  477. category: 'testing',
  478. fn: function (aBlock){
  479. var self=this;
  480. return smalltalk.withContext(function($ctx1) {
  481. var $2,$1;
  482. $2=_st(self)._isEmpty();
  483. if(smalltalk.assert($2)){
  484. $1=_st(aBlock)._value();
  485. } else {
  486. $1=self;
  487. };
  488. return $1;
  489. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock}, smalltalk.Collection)})},
  490. args: ["aBlock"],
  491. 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. Note 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: self classifyMethodAs: \x0a\x09\x09(myProtocol ifEmpty: ['As yet unclassified'])\x22\x0a\x09^ self isEmpty \x0a\x09\x09ifTrue: [ aBlock value ]\x0a\x09\x09ifFalse: [ self ]",
  492. messageSends: ["ifTrue:ifFalse:", "value", "isEmpty"],
  493. referencedClasses: []
  494. }),
  495. smalltalk.Collection);
  496. smalltalk.addMethod(
  497. "_ifNotEmpty_",
  498. smalltalk.method({
  499. selector: "ifNotEmpty:",
  500. category: 'testing',
  501. fn: function (aBlock){
  502. var self=this;
  503. return smalltalk.withContext(function($ctx1) {
  504. var $1;
  505. $1=_st(self)._notEmpty();
  506. _st($1)._ifTrue_(aBlock);
  507. return self}, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock}, smalltalk.Collection)})},
  508. args: ["aBlock"],
  509. source: "ifNotEmpty: aBlock\x0a\x09self notEmpty ifTrue: aBlock.",
  510. messageSends: ["ifTrue:", "notEmpty"],
  511. referencedClasses: []
  512. }),
  513. smalltalk.Collection);
  514. smalltalk.addMethod(
  515. "_includes_",
  516. smalltalk.method({
  517. selector: "includes:",
  518. category: 'testing',
  519. fn: function (anObject){
  520. var self=this;
  521. var sentinel;
  522. return smalltalk.withContext(function($ctx1) {
  523. var $1;
  524. sentinel=_st((smalltalk.Object || Object))._new();
  525. $1=_st(_st(self)._detect_ifNone_((function(each){
  526. return smalltalk.withContext(function($ctx2) {
  527. return _st(each).__eq(anObject);
  528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  529. return smalltalk.withContext(function($ctx2) {
  530. return sentinel;
  531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))).__tild_eq(sentinel);
  532. return $1;
  533. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,sentinel:sentinel}, smalltalk.Collection)})},
  534. args: ["anObject"],
  535. source: "includes: anObject\x0a\x09| sentinel |\x0a sentinel := Object new.\x0a ^(self detect: [ :each | each = anObject] ifNone: [ sentinel ]) ~= sentinel",
  536. messageSends: ["new", "~=", "detect:ifNone:", "="],
  537. referencedClasses: ["Object"]
  538. }),
  539. smalltalk.Collection);
  540. smalltalk.addMethod(
  541. "_inject_into_",
  542. smalltalk.method({
  543. selector: "inject:into:",
  544. category: 'enumerating',
  545. fn: function (anObject,aBlock){
  546. var self=this;
  547. var result;
  548. return smalltalk.withContext(function($ctx1) {
  549. var $1;
  550. result=anObject;
  551. _st(self)._do_((function(each){
  552. return smalltalk.withContext(function($ctx2) {
  553. result=_st(aBlock)._value_value_(result,each);
  554. return result;
  555. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  556. $1=result;
  557. return $1;
  558. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result}, smalltalk.Collection)})},
  559. args: ["anObject", "aBlock"],
  560. source: "inject: anObject into: aBlock\x0a\x09| result |\x0a\x09result := anObject.\x0a\x09self do: [:each | \x0a\x09 result := aBlock value: result value: each].\x0a\x09^result",
  561. messageSends: ["do:", "value:value:"],
  562. referencedClasses: []
  563. }),
  564. smalltalk.Collection);
  565. smalltalk.addMethod(
  566. "_intersection_",
  567. smalltalk.method({
  568. selector: "intersection:",
  569. category: 'enumerating',
  570. fn: function (aCollection){
  571. var self=this;
  572. var set,outputSet;
  573. return smalltalk.withContext(function($ctx1) {
  574. var $1,$2;
  575. set=_st(self)._asSet();
  576. outputSet=_st((smalltalk.Set || Set))._new();
  577. _st(aCollection)._do_((function(each){
  578. return smalltalk.withContext(function($ctx2) {
  579. $1=_st(_st(set)._includes_(each))._and_((function(){
  580. return smalltalk.withContext(function($ctx3) {
  581. return _st(_st(outputSet)._includes_(each))._not();
  582. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  583. if(smalltalk.assert($1)){
  584. return _st(outputSet)._add_(each);
  585. };
  586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  587. $2=_st(_st(self)._class())._withAll_(_st(outputSet)._asArray());
  588. return $2;
  589. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet}, smalltalk.Collection)})},
  590. args: ["aCollection"],
  591. 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",
  592. messageSends: ["asSet", "new", "do:", "ifTrue:", "add:", "and:", "not", "includes:", "withAll:", "asArray", "class"],
  593. referencedClasses: ["Set"]
  594. }),
  595. smalltalk.Collection);
  596. smalltalk.addMethod(
  597. "_isEmpty",
  598. smalltalk.method({
  599. selector: "isEmpty",
  600. category: 'testing',
  601. fn: function (){
  602. var self=this;
  603. return smalltalk.withContext(function($ctx1) {
  604. var $1;
  605. $1=_st(_st(self)._size()).__eq((0));
  606. return $1;
  607. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Collection)})},
  608. args: [],
  609. source: "isEmpty\x0a\x09^self size = 0",
  610. messageSends: ["=", "size"],
  611. referencedClasses: []
  612. }),
  613. smalltalk.Collection);
  614. smalltalk.addMethod(
  615. "_notEmpty",
  616. smalltalk.method({
  617. selector: "notEmpty",
  618. category: 'testing',
  619. fn: function (){
  620. var self=this;
  621. return smalltalk.withContext(function($ctx1) {
  622. var $1;
  623. $1=_st(_st(self)._isEmpty())._not();
  624. return $1;
  625. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{}, smalltalk.Collection)})},
  626. args: [],
  627. source: "notEmpty\x0a\x09^self isEmpty not",
  628. messageSends: ["not", "isEmpty"],
  629. referencedClasses: []
  630. }),
  631. smalltalk.Collection);
  632. smalltalk.addMethod(
  633. "_occurrencesOf_",
  634. smalltalk.method({
  635. selector: "occurrencesOf:",
  636. category: 'accessing',
  637. fn: function (anObject){
  638. var self=this;
  639. var tally;
  640. return smalltalk.withContext(function($ctx1) {
  641. var $1,$2;
  642. tally=(0);
  643. _st(self)._do_((function(each){
  644. return smalltalk.withContext(function($ctx2) {
  645. $1=_st(anObject).__eq(each);
  646. if(smalltalk.assert($1)){
  647. tally=_st(tally).__plus((1));
  648. return tally;
  649. };
  650. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  651. $2=tally;
  652. return $2;
  653. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally}, smalltalk.Collection)})},
  654. args: ["anObject"],
  655. 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",
  656. messageSends: ["do:", "ifTrue:", "+", "="],
  657. referencedClasses: []
  658. }),
  659. smalltalk.Collection);
  660. smalltalk.addMethod(
  661. "_printString",
  662. smalltalk.method({
  663. selector: "printString",
  664. category: 'printing',
  665. fn: function (){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) {
  668. var $1;
  669. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  670. return smalltalk.withContext(function($ctx2) {
  671. _st(aStream)._nextPutAll_(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma(" ("));
  672. _st(self)._do_separatedBy_((function(each){
  673. return smalltalk.withContext(function($ctx3) {
  674. return _st(aStream)._nextPutAll_(_st(each)._printString());
  675. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  676. return smalltalk.withContext(function($ctx3) {
  677. return _st(aStream)._nextPutAll_(" ");
  678. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  679. return _st(aStream)._nextPutAll_(")");
  680. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  681. return $1;
  682. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Collection)})},
  683. args: [],
  684. source: "printString\x0a\x09\x22print the contents of the Collection into a string and return it\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream\x0a\x09\x09\x09nextPutAll: super printString, ' ('.\x0a\x09\x09self do: [:each | aStream nextPutAll: each printString]\x0a\x09\x09\x09separatedBy: [aStream nextPutAll: ' '].\x0a\x09\x09aStream nextPutAll: ')']",
  685. messageSends: ["streamContents:", "nextPutAll:", ",", "printString", "do:separatedBy:"],
  686. referencedClasses: ["String"]
  687. }),
  688. smalltalk.Collection);
  689. smalltalk.addMethod(
  690. "_readStream",
  691. smalltalk.method({
  692. selector: "readStream",
  693. category: 'accessing',
  694. fn: function (){
  695. var self=this;
  696. return smalltalk.withContext(function($ctx1) {
  697. var $1;
  698. $1=_st(self)._stream();
  699. return $1;
  700. }, function($ctx1) {$ctx1.fill(self,"readStream",{}, smalltalk.Collection)})},
  701. args: [],
  702. source: "readStream\x0a\x09^self stream",
  703. messageSends: ["stream"],
  704. referencedClasses: []
  705. }),
  706. smalltalk.Collection);
  707. smalltalk.addMethod(
  708. "_reject_",
  709. smalltalk.method({
  710. selector: "reject:",
  711. category: 'enumerating',
  712. fn: function (aBlock){
  713. var self=this;
  714. return smalltalk.withContext(function($ctx1) {
  715. var $1;
  716. $1=_st(self)._select_((function(each){
  717. return smalltalk.withContext(function($ctx2) {
  718. return _st(_st(aBlock)._value_(each)).__eq(false);
  719. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  720. return $1;
  721. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock}, smalltalk.Collection)})},
  722. args: ["aBlock"],
  723. source: "reject: aBlock\x0a\x09^self select: [:each | (aBlock value: each) = false]",
  724. messageSends: ["select:", "=", "value:"],
  725. referencedClasses: []
  726. }),
  727. smalltalk.Collection);
  728. smalltalk.addMethod(
  729. "_remove_",
  730. smalltalk.method({
  731. selector: "remove:",
  732. category: 'adding/removing',
  733. fn: function (anObject){
  734. var self=this;
  735. return smalltalk.withContext(function($ctx1) {
  736. var $1;
  737. $1=_st(self)._remove_ifAbsent_(anObject,(function(){
  738. return smalltalk.withContext(function($ctx2) {
  739. return _st(self)._errorNotFound();
  740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  741. return $1;
  742. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Collection)})},
  743. args: ["anObject"],
  744. source: "remove: anObject\x0a ^self remove: anObject ifAbsent: [self errorNotFound]",
  745. messageSends: ["remove:ifAbsent:", "errorNotFound"],
  746. referencedClasses: []
  747. }),
  748. smalltalk.Collection);
  749. smalltalk.addMethod(
  750. "_remove_ifAbsent_",
  751. smalltalk.method({
  752. selector: "remove:ifAbsent:",
  753. category: 'adding/removing',
  754. fn: function (anObject,aBlock){
  755. var self=this;
  756. return smalltalk.withContext(function($ctx1) {
  757. _st(self)._subclassResponsibility();
  758. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Collection)})},
  759. args: ["anObject", "aBlock"],
  760. source: "remove: anObject ifAbsent: aBlock\x0a self subclassResponsibility",
  761. messageSends: ["subclassResponsibility"],
  762. referencedClasses: []
  763. }),
  764. smalltalk.Collection);
  765. smalltalk.addMethod(
  766. "_select_",
  767. smalltalk.method({
  768. selector: "select:",
  769. category: 'enumerating',
  770. fn: function (aBlock){
  771. var self=this;
  772. var stream;
  773. return smalltalk.withContext(function($ctx1) {
  774. var $1,$2;
  775. stream=_st(_st(_st(self)._class())._new())._writeStream();
  776. _st(self)._do_((function(each){
  777. return smalltalk.withContext(function($ctx2) {
  778. $1=_st(aBlock)._value_(each);
  779. if(smalltalk.assert($1)){
  780. return _st(stream)._nextPut_(each);
  781. };
  782. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  783. $2=_st(stream)._contents();
  784. return $2;
  785. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream}, smalltalk.Collection)})},
  786. args: ["aBlock"],
  787. source: "select: aBlock\x0a\x09| stream |\x0a\x09stream := self class new writeStream.\x0a\x09self do: [:each |\x0a\x09 (aBlock value: each) ifTrue: [\x0a\x09\x09stream nextPut: each]].\x0a\x09^stream contents",
  788. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "nextPut:", "value:", "contents"],
  789. referencedClasses: []
  790. }),
  791. smalltalk.Collection);
  792. smalltalk.addMethod(
  793. "_size",
  794. smalltalk.method({
  795. selector: "size",
  796. category: 'accessing',
  797. fn: function (){
  798. var self=this;
  799. return smalltalk.withContext(function($ctx1) {
  800. _st(self)._subclassResponsibility();
  801. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Collection)})},
  802. args: [],
  803. source: "size\x0a\x09self subclassResponsibility",
  804. messageSends: ["subclassResponsibility"],
  805. referencedClasses: []
  806. }),
  807. smalltalk.Collection);
  808. smalltalk.addMethod(
  809. "_stream",
  810. smalltalk.method({
  811. selector: "stream",
  812. category: 'accessing',
  813. fn: function (){
  814. var self=this;
  815. return smalltalk.withContext(function($ctx1) {
  816. var $1;
  817. $1=_st(_st(self)._streamClass())._on_(self);
  818. return $1;
  819. }, function($ctx1) {$ctx1.fill(self,"stream",{}, smalltalk.Collection)})},
  820. args: [],
  821. source: "stream\x0a\x09^self streamClass on: self",
  822. messageSends: ["on:", "streamClass"],
  823. referencedClasses: []
  824. }),
  825. smalltalk.Collection);
  826. smalltalk.addMethod(
  827. "_streamClass",
  828. smalltalk.method({
  829. selector: "streamClass",
  830. category: 'accessing',
  831. fn: function (){
  832. var self=this;
  833. return smalltalk.withContext(function($ctx1) {
  834. var $1;
  835. $1=_st(_st(self)._class())._streamClass();
  836. return $1;
  837. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection)})},
  838. args: [],
  839. source: "streamClass\x0a\x09^self class streamClass",
  840. messageSends: ["streamClass", "class"],
  841. referencedClasses: []
  842. }),
  843. smalltalk.Collection);
  844. smalltalk.addMethod(
  845. "_writeStream",
  846. smalltalk.method({
  847. selector: "writeStream",
  848. category: 'accessing',
  849. fn: function (){
  850. var self=this;
  851. return smalltalk.withContext(function($ctx1) {
  852. var $1;
  853. $1=_st(self)._stream();
  854. return $1;
  855. }, function($ctx1) {$ctx1.fill(self,"writeStream",{}, smalltalk.Collection)})},
  856. args: [],
  857. source: "writeStream\x0a\x09^self stream",
  858. messageSends: ["stream"],
  859. referencedClasses: []
  860. }),
  861. smalltalk.Collection);
  862. smalltalk.addMethod(
  863. "_new_",
  864. smalltalk.method({
  865. selector: "new:",
  866. category: 'instance creation',
  867. fn: function (anInteger){
  868. var self=this;
  869. return smalltalk.withContext(function($ctx1) {
  870. var $1;
  871. $1=_st(self)._new();
  872. return $1;
  873. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Collection.klass)})},
  874. args: ["anInteger"],
  875. source: "new: anInteger\x0a\x09^self new",
  876. messageSends: ["new"],
  877. referencedClasses: []
  878. }),
  879. smalltalk.Collection.klass);
  880. smalltalk.addMethod(
  881. "_streamClass",
  882. smalltalk.method({
  883. selector: "streamClass",
  884. category: 'accessing',
  885. fn: function (){
  886. var self=this;
  887. return smalltalk.withContext(function($ctx1) {
  888. var $1;
  889. $1=(smalltalk.Stream || Stream);
  890. return $1;
  891. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.Collection.klass)})},
  892. args: [],
  893. source: "streamClass\x0a\x09 ^Stream",
  894. messageSends: [],
  895. referencedClasses: ["Stream"]
  896. }),
  897. smalltalk.Collection.klass);
  898. smalltalk.addMethod(
  899. "_with_",
  900. smalltalk.method({
  901. selector: "with:",
  902. category: 'instance creation',
  903. fn: function (anObject){
  904. var self=this;
  905. return smalltalk.withContext(function($ctx1) {
  906. var $2,$3,$1;
  907. $2=_st(self)._new();
  908. _st($2)._add_(anObject);
  909. $3=_st($2)._yourself();
  910. $1=$3;
  911. return $1;
  912. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Collection.klass)})},
  913. args: ["anObject"],
  914. source: "with: anObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  915. messageSends: ["add:", "new", "yourself"],
  916. referencedClasses: []
  917. }),
  918. smalltalk.Collection.klass);
  919. smalltalk.addMethod(
  920. "_with_with_",
  921. smalltalk.method({
  922. selector: "with:with:",
  923. category: 'instance creation',
  924. fn: function (anObject,anotherObject){
  925. var self=this;
  926. return smalltalk.withContext(function($ctx1) {
  927. var $2,$3,$1;
  928. $2=_st(self)._new();
  929. _st($2)._add_(anObject);
  930. _st($2)._add_(anotherObject);
  931. $3=_st($2)._yourself();
  932. $1=$3;
  933. return $1;
  934. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject}, smalltalk.Collection.klass)})},
  935. args: ["anObject", "anotherObject"],
  936. source: "with: anObject with: anotherObject\x0a\x09 ^self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  937. messageSends: ["add:", "new", "yourself"],
  938. referencedClasses: []
  939. }),
  940. smalltalk.Collection.klass);
  941. smalltalk.addMethod(
  942. "_with_with_with_",
  943. smalltalk.method({
  944. selector: "with:with:with:",
  945. category: 'instance creation',
  946. fn: function (firstObject,secondObject,thirdObject){
  947. var self=this;
  948. return smalltalk.withContext(function($ctx1) {
  949. var $2,$3,$1;
  950. $2=_st(self)._new();
  951. _st($2)._add_(firstObject);
  952. _st($2)._add_(secondObject);
  953. _st($2)._add_(thirdObject);
  954. $3=_st($2)._yourself();
  955. $1=$3;
  956. return $1;
  957. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject}, smalltalk.Collection.klass)})},
  958. args: ["firstObject", "secondObject", "thirdObject"],
  959. source: "with: firstObject with: secondObject with: thirdObject\x0a\x09 ^self new\x0a\x09\x09add: firstObject;\x0a\x09\x09add: secondObject;\x0a\x09\x09add: thirdObject;\x0a\x09\x09yourself",
  960. messageSends: ["add:", "new", "yourself"],
  961. referencedClasses: []
  962. }),
  963. smalltalk.Collection.klass);
  964. smalltalk.addMethod(
  965. "_withAll_",
  966. smalltalk.method({
  967. selector: "withAll:",
  968. category: 'instance creation',
  969. fn: function (aCollection){
  970. var self=this;
  971. return smalltalk.withContext(function($ctx1) {
  972. var $2,$3,$1;
  973. $2=_st(self)._new();
  974. _st($2)._addAll_(aCollection);
  975. $3=_st($2)._yourself();
  976. $1=$3;
  977. return $1;
  978. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection}, smalltalk.Collection.klass)})},
  979. args: ["aCollection"],
  980. source: "withAll: aCollection\x0a\x09 ^self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  981. messageSends: ["addAll:", "new", "yourself"],
  982. referencedClasses: []
  983. }),
  984. smalltalk.Collection.klass);
  985. smalltalk.addClass('IndexableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  986. smalltalk.addClass('HashedCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  987. smalltalk.HashedCollection.comment="A HashedCollection is a traditional JavaScript object, or a Smalltalk Dictionary.\x0a\x0aUnlike a Dictionary, it can only have strings as keys."
  988. smalltalk.addMethod(
  989. "__comma",
  990. smalltalk.method({
  991. selector: ",",
  992. category: 'copying',
  993. fn: function (aCollection){
  994. var self=this;
  995. return smalltalk.withContext(function($ctx1) {
  996. _st(self)._shouldNotImplement();
  997. return self}, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection}, smalltalk.HashedCollection)})},
  998. args: ["aCollection"],
  999. source: ", aCollection\x0a\x09self shouldNotImplement",
  1000. messageSends: ["shouldNotImplement"],
  1001. referencedClasses: []
  1002. }),
  1003. smalltalk.HashedCollection);
  1004. smalltalk.addMethod(
  1005. "__eq",
  1006. smalltalk.method({
  1007. selector: "=",
  1008. category: 'comparing',
  1009. fn: function (aHashedCollection){
  1010. var self=this;
  1011. return smalltalk.withContext(function($ctx1) {
  1012. var $1,$2,$3;
  1013. $1=_st(_st(self)._class()).__eq(_st(aHashedCollection)._class());
  1014. if(! smalltalk.assert($1)){
  1015. return false;
  1016. };
  1017. $2=_st(_st(self)._size()).__eq(_st(aHashedCollection)._size());
  1018. if(! smalltalk.assert($2)){
  1019. return false;
  1020. };
  1021. $3=_st(_st(self)._associations()).__eq(_st(aHashedCollection)._associations());
  1022. return $3;
  1023. }, function($ctx1) {$ctx1.fill(self,"=",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)})},
  1024. args: ["aHashedCollection"],
  1025. source: "= aHashedCollection\x0a\x09self class = aHashedCollection class ifFalse: [^false].\x0a\x09self size = aHashedCollection size ifFalse: [^false].\x0a\x09^self associations = aHashedCollection associations",
  1026. messageSends: ["ifFalse:", "=", "class", "size", "associations"],
  1027. referencedClasses: []
  1028. }),
  1029. smalltalk.HashedCollection);
  1030. smalltalk.addMethod(
  1031. "_add_",
  1032. smalltalk.method({
  1033. selector: "add:",
  1034. category: 'adding/removing',
  1035. fn: function (anAssociation){
  1036. var self=this;
  1037. return smalltalk.withContext(function($ctx1) {
  1038. _st(self)._at_put_(_st(anAssociation)._key(),_st(anAssociation)._value());
  1039. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation}, smalltalk.HashedCollection)})},
  1040. args: ["anAssociation"],
  1041. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  1042. messageSends: ["at:put:", "key", "value"],
  1043. referencedClasses: []
  1044. }),
  1045. smalltalk.HashedCollection);
  1046. smalltalk.addMethod(
  1047. "_addAll_",
  1048. smalltalk.method({
  1049. selector: "addAll:",
  1050. category: 'adding/removing',
  1051. fn: function (aHashedCollection){
  1052. var self=this;
  1053. return smalltalk.withContext(function($ctx1) {
  1054. var $1;
  1055. smalltalk.IndexedCollection.fn.prototype._addAll_.apply(_st(self), [_st(aHashedCollection)._associations()]);
  1056. $1=aHashedCollection;
  1057. return $1;
  1058. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aHashedCollection:aHashedCollection}, smalltalk.HashedCollection)})},
  1059. args: ["aHashedCollection"],
  1060. source: "addAll: aHashedCollection\x0a\x09super addAll: aHashedCollection associations.\x0a\x09^aHashedCollection",
  1061. messageSends: ["addAll:", "associations"],
  1062. referencedClasses: []
  1063. }),
  1064. smalltalk.HashedCollection);
  1065. smalltalk.addMethod(
  1066. "_asDictionary",
  1067. smalltalk.method({
  1068. selector: "asDictionary",
  1069. category: 'converting',
  1070. fn: function (){
  1071. var self=this;
  1072. return smalltalk.withContext(function($ctx1) {
  1073. var $1;
  1074. $1=_st((smalltalk.Dictionary || Dictionary))._fromPairs_(_st(self)._associations());
  1075. return $1;
  1076. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{}, smalltalk.HashedCollection)})},
  1077. args: [],
  1078. source: "asDictionary\x0a\x09^Dictionary fromPairs: self associations",
  1079. messageSends: ["fromPairs:", "associations"],
  1080. referencedClasses: ["Dictionary"]
  1081. }),
  1082. smalltalk.HashedCollection);
  1083. smalltalk.addMethod(
  1084. "_asJSON",
  1085. smalltalk.method({
  1086. selector: "asJSON",
  1087. category: 'converting',
  1088. fn: function (){
  1089. var self=this;
  1090. var c;
  1091. return smalltalk.withContext(function($ctx1) {
  1092. var $1;
  1093. c=_st(_st(self)._class())._new();
  1094. _st(self)._keysAndValuesDo_((function(key,value){
  1095. return smalltalk.withContext(function($ctx2) {
  1096. return _st(c)._at_put_(key,_st(value)._asJSON());
  1097. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1098. $1=c;
  1099. return $1;
  1100. }, function($ctx1) {$ctx1.fill(self,"asJSON",{c:c}, smalltalk.HashedCollection)})},
  1101. args: [],
  1102. source: "asJSON\x0a\x09| c |\x0a\x09c := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09\x09c at: key put: value asJSON].\x0a\x09^c",
  1103. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "asJSON"],
  1104. referencedClasses: []
  1105. }),
  1106. smalltalk.HashedCollection);
  1107. smalltalk.addMethod(
  1108. "_associations",
  1109. smalltalk.method({
  1110. selector: "associations",
  1111. category: 'accessing',
  1112. fn: function (){
  1113. var self=this;
  1114. var associations;
  1115. return smalltalk.withContext(function($ctx1) {
  1116. var $1;
  1117. associations=[];
  1118. _st(self)._associationsDo_((function(each){
  1119. return smalltalk.withContext(function($ctx2) {
  1120. return _st(associations)._add_(each);
  1121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1122. $1=associations;
  1123. return $1;
  1124. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations}, smalltalk.HashedCollection)})},
  1125. args: [],
  1126. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [:each | associations add: each].\x0a\x09^associations",
  1127. messageSends: ["associationsDo:", "add:"],
  1128. referencedClasses: []
  1129. }),
  1130. smalltalk.HashedCollection);
  1131. smalltalk.addMethod(
  1132. "_associationsDo_",
  1133. smalltalk.method({
  1134. selector: "associationsDo:",
  1135. category: 'enumerating',
  1136. fn: function (aBlock){
  1137. var self=this;
  1138. return smalltalk.withContext(function($ctx1) {
  1139. _st(self)._keysAndValuesDo_((function(key,value){
  1140. return smalltalk.withContext(function($ctx2) {
  1141. return _st(aBlock)._value_(_st((smalltalk.Association || Association))._key_value_(key,value));
  1142. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1143. return self}, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  1144. args: ["aBlock"],
  1145. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 aBlock value: (Association key: key value: value)]\x0a",
  1146. messageSends: ["keysAndValuesDo:", "value:", "key:value:"],
  1147. referencedClasses: ["Association"]
  1148. }),
  1149. smalltalk.HashedCollection);
  1150. smalltalk.addMethod(
  1151. "_at_",
  1152. smalltalk.method({
  1153. selector: "at:",
  1154. category: 'accessing',
  1155. fn: function (aKey){
  1156. var self=this;
  1157. return smalltalk.withContext(function($ctx1) {
  1158. var $1;
  1159. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  1160. return smalltalk.withContext(function($ctx2) {
  1161. return _st(self)._errorNotFound();
  1162. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1163. return $1;
  1164. }, function($ctx1) {$ctx1.fill(self,"at:",{aKey:aKey}, smalltalk.HashedCollection)})},
  1165. args: ["aKey"],
  1166. source: "at: aKey\x0a\x09^self at: aKey ifAbsent: [self errorNotFound]",
  1167. messageSends: ["at:ifAbsent:", "errorNotFound"],
  1168. referencedClasses: []
  1169. }),
  1170. smalltalk.HashedCollection);
  1171. smalltalk.addMethod(
  1172. "_at_ifAbsent_",
  1173. smalltalk.method({
  1174. selector: "at:ifAbsent:",
  1175. category: 'accessing',
  1176. fn: function (aKey,aBlock){
  1177. var self=this;
  1178. return smalltalk.withContext(function($ctx1) {
  1179. var $2,$1;
  1180. $2=_st(self)._includesKey_(aKey);
  1181. $1=_st($2)._ifTrue_ifFalse_((function(){
  1182. return smalltalk.withContext(function($ctx2) {
  1183. return _st(self)._basicAt_(aKey);
  1184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),aBlock);
  1185. return $1;
  1186. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  1187. args: ["aKey", "aBlock"],
  1188. source: "at: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [self basicAt: aKey]\x0a\x09\x09ifFalse: aBlock",
  1189. messageSends: ["ifTrue:ifFalse:", "basicAt:", "includesKey:"],
  1190. referencedClasses: []
  1191. }),
  1192. smalltalk.HashedCollection);
  1193. smalltalk.addMethod(
  1194. "_at_ifAbsentPut_",
  1195. smalltalk.method({
  1196. selector: "at:ifAbsentPut:",
  1197. category: 'accessing',
  1198. fn: function (aKey,aBlock){
  1199. var self=this;
  1200. return smalltalk.withContext(function($ctx1) {
  1201. var $1;
  1202. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  1203. return smalltalk.withContext(function($ctx2) {
  1204. return _st(self)._at_put_(aKey,_st(aBlock)._value());
  1205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1206. return $1;
  1207. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  1208. args: ["aKey", "aBlock"],
  1209. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^self at: aKey ifAbsent: [\x0a\x09 self at: aKey put: aBlock value]",
  1210. messageSends: ["at:ifAbsent:", "at:put:", "value"],
  1211. referencedClasses: []
  1212. }),
  1213. smalltalk.HashedCollection);
  1214. smalltalk.addMethod(
  1215. "_at_ifPresent_",
  1216. smalltalk.method({
  1217. selector: "at:ifPresent:",
  1218. category: 'accessing',
  1219. fn: function (aKey,aBlock){
  1220. var self=this;
  1221. return smalltalk.withContext(function($ctx1) {
  1222. var $2,$1;
  1223. $2=_st(self)._includesKey_(aKey);
  1224. if(smalltalk.assert($2)){
  1225. $1=_st(aBlock)._value_(_st(self)._at_(aKey));
  1226. } else {
  1227. $1=nil;
  1228. };
  1229. return $1;
  1230. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  1231. args: ["aKey", "aBlock"],
  1232. source: "at: aKey ifPresent: aBlock\x0a\x09\x22Lookup the given key in the receiver. \x0a\x09If it is present, answer the value of evaluating the given block with the value associated with the key. \x0a\x09Otherwise, answer nil.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: [ nil ]",
  1233. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  1234. referencedClasses: []
  1235. }),
  1236. smalltalk.HashedCollection);
  1237. smalltalk.addMethod(
  1238. "_at_ifPresent_ifAbsent_",
  1239. smalltalk.method({
  1240. selector: "at:ifPresent:ifAbsent:",
  1241. category: 'accessing',
  1242. fn: function (aKey,aBlock,anotherBlock){
  1243. var self=this;
  1244. return smalltalk.withContext(function($ctx1) {
  1245. var $2,$1;
  1246. $2=_st(self)._includesKey_(aKey);
  1247. $1=_st($2)._ifTrue_ifFalse_((function(){
  1248. return smalltalk.withContext(function($ctx2) {
  1249. return _st(aBlock)._value_(_st(self)._at_(aKey));
  1250. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),anotherBlock);
  1251. return $1;
  1252. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)})},
  1253. args: ["aKey", "aBlock", "anotherBlock"],
  1254. 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 with the value associated with the key, \x0a\x09otherwise answer the value of absentBlock.\x22\x0a\x09^(self includesKey: aKey)\x0a\x09\x09ifTrue: [ aBlock value: (self at: aKey) ]\x0a\x09\x09ifFalse: anotherBlock",
  1255. messageSends: ["ifTrue:ifFalse:", "value:", "at:", "includesKey:"],
  1256. referencedClasses: []
  1257. }),
  1258. smalltalk.HashedCollection);
  1259. smalltalk.addMethod(
  1260. "_at_put_",
  1261. smalltalk.method({
  1262. selector: "at:put:",
  1263. category: 'accessing',
  1264. fn: function (aKey,aValue){
  1265. var self=this;
  1266. return smalltalk.withContext(function($ctx1) {
  1267. var $1;
  1268. $1=_st(self)._basicAt_put_(aKey,aValue);
  1269. return $1;
  1270. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.HashedCollection)})},
  1271. args: ["aKey", "aValue"],
  1272. source: "at: aKey put: aValue\x0a\x09^self basicAt: aKey put: aValue",
  1273. messageSends: ["basicAt:put:"],
  1274. referencedClasses: []
  1275. }),
  1276. smalltalk.HashedCollection);
  1277. smalltalk.addMethod(
  1278. "_collect_",
  1279. smalltalk.method({
  1280. selector: "collect:",
  1281. category: 'enumerating',
  1282. fn: function (aBlock){
  1283. var self=this;
  1284. var newDict;
  1285. return smalltalk.withContext(function($ctx1) {
  1286. var $1;
  1287. newDict=_st(_st(self)._class())._new();
  1288. _st(self)._keysAndValuesDo_((function(key,value){
  1289. return smalltalk.withContext(function($ctx2) {
  1290. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  1291. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1292. $1=newDict;
  1293. return $1;
  1294. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)})},
  1295. args: ["aBlock"],
  1296. source: "collect: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 newDict at: key put: (aBlock value: value)].\x0a\x09^newDict",
  1297. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"],
  1298. referencedClasses: []
  1299. }),
  1300. smalltalk.HashedCollection);
  1301. smalltalk.addMethod(
  1302. "_deepCopy",
  1303. smalltalk.method({
  1304. selector: "deepCopy",
  1305. category: 'copying',
  1306. fn: function (){
  1307. var self=this;
  1308. var copy;
  1309. return smalltalk.withContext(function($ctx1) {
  1310. var $1;
  1311. copy=_st(_st(self)._class())._new();
  1312. _st(self)._keysAndValuesDo_((function(key,value){
  1313. return smalltalk.withContext(function($ctx2) {
  1314. return _st(copy)._at_put_(key,_st(value)._deepCopy());
  1315. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1316. $1=copy;
  1317. return $1;
  1318. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy}, smalltalk.HashedCollection)})},
  1319. args: [],
  1320. source: "deepCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 copy at: key put: value deepCopy].\x0a\x09^copy",
  1321. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"],
  1322. referencedClasses: []
  1323. }),
  1324. smalltalk.HashedCollection);
  1325. smalltalk.addMethod(
  1326. "_detect_ifNone_",
  1327. smalltalk.method({
  1328. selector: "detect:ifNone:",
  1329. category: 'enumerating',
  1330. fn: function (aBlock,anotherBlock){
  1331. var self=this;
  1332. return smalltalk.withContext(function($ctx1) {
  1333. var $1;
  1334. $1=_st(_st(self)._values())._detect_ifNone_(aBlock,anotherBlock);
  1335. return $1;
  1336. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.HashedCollection)})},
  1337. args: ["aBlock", "anotherBlock"],
  1338. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^self values detect: aBlock ifNone: anotherBlock",
  1339. messageSends: ["detect:ifNone:", "values"],
  1340. referencedClasses: []
  1341. }),
  1342. smalltalk.HashedCollection);
  1343. smalltalk.addMethod(
  1344. "_do_",
  1345. smalltalk.method({
  1346. selector: "do:",
  1347. category: 'enumerating',
  1348. fn: function (aBlock){
  1349. var self=this;
  1350. return smalltalk.withContext(function($ctx1) {
  1351. _st(self)._valuesDo_(aBlock);
  1352. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  1353. args: ["aBlock"],
  1354. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  1355. messageSends: ["valuesDo:"],
  1356. referencedClasses: []
  1357. }),
  1358. smalltalk.HashedCollection);
  1359. smalltalk.addMethod(
  1360. "_includes_",
  1361. smalltalk.method({
  1362. selector: "includes:",
  1363. category: 'enumerating',
  1364. fn: function (anObject){
  1365. var self=this;
  1366. return smalltalk.withContext(function($ctx1) {
  1367. var $1;
  1368. $1=_st(_st(self)._values())._includes_(anObject);
  1369. return $1;
  1370. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.HashedCollection)})},
  1371. args: ["anObject"],
  1372. source: "includes: anObject\x0a\x09^self values includes: anObject",
  1373. messageSends: ["includes:", "values"],
  1374. referencedClasses: []
  1375. }),
  1376. smalltalk.HashedCollection);
  1377. smalltalk.addMethod(
  1378. "_includesKey_",
  1379. smalltalk.method({
  1380. selector: "includesKey:",
  1381. category: 'testing',
  1382. fn: function (aKey){
  1383. var self=this;
  1384. return smalltalk.withContext(function($ctx1) {
  1385. return self.hasOwnProperty(aKey);
  1386. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.HashedCollection)})},
  1387. args: ["aKey"],
  1388. source: "includesKey: aKey\x0a\x09<return self.hasOwnProperty(aKey)>",
  1389. messageSends: [],
  1390. referencedClasses: []
  1391. }),
  1392. smalltalk.HashedCollection);
  1393. smalltalk.addMethod(
  1394. "_keys",
  1395. smalltalk.method({
  1396. selector: "keys",
  1397. category: 'accessing',
  1398. fn: function (){
  1399. var self=this;
  1400. return smalltalk.withContext(function($ctx1) {
  1401. if ('function'===typeof Object.keys) return Object.keys(self);
  1402. var keys = [];
  1403. for(var i in self) {
  1404. if(self.hasOwnProperty(i)) {
  1405. keys.push(i);
  1406. }
  1407. };
  1408. return keys;
  1409. ;
  1410. return self}, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.HashedCollection)})},
  1411. args: [],
  1412. source: "keys\x0a\x09<\x0a\x09\x09if ('function'===typeof Object.keys) return Object.keys(self);\x0a\x09\x09var keys = [];\x0a\x09\x09for(var i in self) {\x0a\x09\x09\x09if(self.hasOwnProperty(i)) {\x0a\x09\x09\x09\x09keys.push(i);\x0a\x09\x09\x09}\x0a\x09\x09};\x0a\x09\x09return keys;\x0a\x09>",
  1413. messageSends: [],
  1414. referencedClasses: []
  1415. }),
  1416. smalltalk.HashedCollection);
  1417. smalltalk.addMethod(
  1418. "_keysAndValuesDo_",
  1419. smalltalk.method({
  1420. selector: "keysAndValuesDo:",
  1421. category: 'enumerating',
  1422. fn: function (aBlock){
  1423. var self=this;
  1424. return smalltalk.withContext(function($ctx1) {
  1425. _st(self)._keysDo_((function(each){
  1426. return smalltalk.withContext(function($ctx2) {
  1427. return _st(aBlock)._value_value_(each,_st(self)._at_(each));
  1428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1429. return self}, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  1430. args: ["aBlock"],
  1431. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [:each |\x0a\x09 aBlock value: each value: (self at: each)]\x0a",
  1432. messageSends: ["keysDo:", "value:value:", "at:"],
  1433. referencedClasses: []
  1434. }),
  1435. smalltalk.HashedCollection);
  1436. smalltalk.addMethod(
  1437. "_keysDo_",
  1438. smalltalk.method({
  1439. selector: "keysDo:",
  1440. category: 'enumerating',
  1441. fn: function (aBlock){
  1442. var self=this;
  1443. return smalltalk.withContext(function($ctx1) {
  1444. _st(_st(self)._keys())._do_(aBlock);
  1445. return self}, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  1446. args: ["aBlock"],
  1447. source: "keysDo: aBlock\x0a\x09self keys do: aBlock\x0a",
  1448. messageSends: ["do:", "keys"],
  1449. referencedClasses: []
  1450. }),
  1451. smalltalk.HashedCollection);
  1452. smalltalk.addMethod(
  1453. "_printString",
  1454. smalltalk.method({
  1455. selector: "printString",
  1456. category: 'printing',
  1457. fn: function (){
  1458. var self=this;
  1459. return smalltalk.withContext(function($ctx1) {
  1460. var $1;
  1461. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  1462. return smalltalk.withContext(function($ctx2) {
  1463. _st(aStream)._nextPutAll_(_st(_st("a ").__comma(_st(_st(self)._class())._name())).__comma("("));
  1464. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1465. return smalltalk.withContext(function($ctx3) {
  1466. return _st(each)._storeOn_(aStream);
  1467. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  1468. return smalltalk.withContext(function($ctx3) {
  1469. return _st(aStream)._nextPutAll_(" , ");
  1470. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  1471. return _st(aStream)._nextPutAll_(")");
  1472. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1)})}));
  1473. return $1;
  1474. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.HashedCollection)})},
  1475. args: [],
  1476. source: "printString\x0a\x09\x22print the contents of the HashedCollection into a string and return the string\x22\x0a\x09^String streamContents: [:aStream |\x0a\x09\x09aStream nextPutAll: 'a ', self class name, '('.\x0a\x09\x09self associations\x0a\x09\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09\x09separatedBy: [ aStream nextPutAll: ' , '].\x0a\x09\x09aStream nextPutAll: ')']",
  1477. messageSends: ["streamContents:", "nextPutAll:", ",", "name", "class", "do:separatedBy:", "storeOn:", "associations"],
  1478. referencedClasses: ["String"]
  1479. }),
  1480. smalltalk.HashedCollection);
  1481. smalltalk.addMethod(
  1482. "_remove_ifAbsent_",
  1483. smalltalk.method({
  1484. selector: "remove:ifAbsent:",
  1485. category: 'adding/removing',
  1486. fn: function (aKey,aBlock){
  1487. var self=this;
  1488. return smalltalk.withContext(function($ctx1) {
  1489. var $1;
  1490. $1=_st(self)._removeKey_ifAbsent_(aKey,aBlock);
  1491. return $1;
  1492. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  1493. args: ["aKey", "aBlock"],
  1494. source: "remove: aKey ifAbsent: aBlock\x0a ^self removeKey: aKey ifAbsent: aBlock",
  1495. messageSends: ["removeKey:ifAbsent:"],
  1496. referencedClasses: []
  1497. }),
  1498. smalltalk.HashedCollection);
  1499. smalltalk.addMethod(
  1500. "_removeKey_",
  1501. smalltalk.method({
  1502. selector: "removeKey:",
  1503. category: 'adding/removing',
  1504. fn: function (aKey){
  1505. var self=this;
  1506. return smalltalk.withContext(function($ctx1) {
  1507. var $1;
  1508. $1=_st(self)._remove_(aKey);
  1509. return $1;
  1510. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey}, smalltalk.HashedCollection)})},
  1511. args: ["aKey"],
  1512. source: "removeKey: aKey\x0a ^self remove: aKey",
  1513. messageSends: ["remove:"],
  1514. referencedClasses: []
  1515. }),
  1516. smalltalk.HashedCollection);
  1517. smalltalk.addMethod(
  1518. "_removeKey_ifAbsent_",
  1519. smalltalk.method({
  1520. selector: "removeKey:ifAbsent:",
  1521. category: 'adding/removing',
  1522. fn: function (aKey,aBlock){
  1523. var self=this;
  1524. return smalltalk.withContext(function($ctx1) {
  1525. var $2,$1;
  1526. $2=_st(self)._includesKey_(aKey);
  1527. if(smalltalk.assert($2)){
  1528. $1=_st(self)._basicDelete_(aKey);
  1529. } else {
  1530. $1=_st(aBlock)._value();
  1531. };
  1532. return $1;
  1533. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.HashedCollection)})},
  1534. args: ["aKey", "aBlock"],
  1535. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09^(self includesKey: aKey) \x0a\x09\x09ifFalse: [aBlock value]\x0a\x09\x09ifTrue: [self basicDelete: aKey]",
  1536. messageSends: ["ifFalse:ifTrue:", "value", "basicDelete:", "includesKey:"],
  1537. referencedClasses: []
  1538. }),
  1539. smalltalk.HashedCollection);
  1540. smalltalk.addMethod(
  1541. "_select_",
  1542. smalltalk.method({
  1543. selector: "select:",
  1544. category: 'enumerating',
  1545. fn: function (aBlock){
  1546. var self=this;
  1547. var newDict;
  1548. return smalltalk.withContext(function($ctx1) {
  1549. var $1,$2;
  1550. newDict=_st(_st(self)._class())._new();
  1551. _st(self)._keysAndValuesDo_((function(key,value){
  1552. return smalltalk.withContext(function($ctx2) {
  1553. $1=_st(aBlock)._value_(value);
  1554. if(smalltalk.assert($1)){
  1555. return _st(newDict)._at_put_(key,value);
  1556. };
  1557. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1558. $2=newDict;
  1559. return $2;
  1560. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict}, smalltalk.HashedCollection)})},
  1561. args: ["aBlock"],
  1562. source: "select: aBlock\x0a\x09| newDict |\x0a\x09newDict := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 (aBlock value: value) ifTrue: [newDict at: key put: value]].\x0a\x09^newDict",
  1563. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "at:put:", "value:"],
  1564. referencedClasses: []
  1565. }),
  1566. smalltalk.HashedCollection);
  1567. smalltalk.addMethod(
  1568. "_shallowCopy",
  1569. smalltalk.method({
  1570. selector: "shallowCopy",
  1571. category: 'copying',
  1572. fn: function (){
  1573. var self=this;
  1574. var copy;
  1575. return smalltalk.withContext(function($ctx1) {
  1576. var $1;
  1577. copy=_st(_st(self)._class())._new();
  1578. _st(self)._keysAndValuesDo_((function(key,value){
  1579. return smalltalk.withContext(function($ctx2) {
  1580. return _st(copy)._at_put_(key,value);
  1581. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1582. $1=copy;
  1583. return $1;
  1584. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy}, smalltalk.HashedCollection)})},
  1585. args: [],
  1586. source: "shallowCopy\x0a\x09| copy |\x0a\x09copy := self class new.\x0a\x09self keysAndValuesDo: [:key :value |\x0a\x09 copy at: key put: value].\x0a\x09^copy",
  1587. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"],
  1588. referencedClasses: []
  1589. }),
  1590. smalltalk.HashedCollection);
  1591. smalltalk.addMethod(
  1592. "_size",
  1593. smalltalk.method({
  1594. selector: "size",
  1595. category: 'accessing',
  1596. fn: function (){
  1597. var self=this;
  1598. return smalltalk.withContext(function($ctx1) {
  1599. var $1;
  1600. $1=_st(_st(self)._keys())._size();
  1601. return $1;
  1602. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.HashedCollection)})},
  1603. args: [],
  1604. source: "size\x0a\x09^self keys size",
  1605. messageSends: ["size", "keys"],
  1606. referencedClasses: []
  1607. }),
  1608. smalltalk.HashedCollection);
  1609. smalltalk.addMethod(
  1610. "_storeOn_",
  1611. smalltalk.method({
  1612. selector: "storeOn:",
  1613. category: 'printing',
  1614. fn: function (aStream){
  1615. var self=this;
  1616. return smalltalk.withContext(function($ctx1) {
  1617. _st(aStream)._nextPutAll_("#{");
  1618. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1619. return smalltalk.withContext(function($ctx2) {
  1620. return _st(each)._storeOn_(aStream);
  1621. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  1622. return smalltalk.withContext(function($ctx2) {
  1623. return _st(aStream)._nextPutAll_(". ");
  1624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1625. _st(aStream)._nextPutAll_("}");
  1626. return self}, function($ctx1) {$ctx1.fill(self,"storeOn:",{aStream:aStream}, smalltalk.HashedCollection)})},
  1627. args: ["aStream"],
  1628. source: "storeOn: aStream\x0a\x09aStream nextPutAll: '#{'.\x0a\x09self associations\x0a\x09\x09do: [:each | each storeOn: aStream]\x0a\x09\x09separatedBy: [ aStream nextPutAll: '. '].\x0a\x09aStream nextPutAll: '}'",
  1629. messageSends: ["nextPutAll:", "do:separatedBy:", "storeOn:", "associations"],
  1630. referencedClasses: []
  1631. }),
  1632. smalltalk.HashedCollection);
  1633. smalltalk.addMethod(
  1634. "_values",
  1635. smalltalk.method({
  1636. selector: "values",
  1637. category: 'accessing',
  1638. fn: function (){
  1639. var self=this;
  1640. return smalltalk.withContext(function($ctx1) {
  1641. var $1;
  1642. $1=_st(_st(self)._keys())._collect_((function(each){
  1643. return smalltalk.withContext(function($ctx2) {
  1644. return _st(self)._at_(each);
  1645. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1646. return $1;
  1647. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.HashedCollection)})},
  1648. args: [],
  1649. source: "values\x0a\x09^self keys collect: [:each | self at: each]",
  1650. messageSends: ["collect:", "at:", "keys"],
  1651. referencedClasses: []
  1652. }),
  1653. smalltalk.HashedCollection);
  1654. smalltalk.addMethod(
  1655. "_valuesDo_",
  1656. smalltalk.method({
  1657. selector: "valuesDo:",
  1658. category: 'enumerating',
  1659. fn: function (aBlock){
  1660. var self=this;
  1661. return smalltalk.withContext(function($ctx1) {
  1662. _st(self)._keysAndValuesDo_((function(key,value){
  1663. return smalltalk.withContext(function($ctx2) {
  1664. return _st(aBlock)._value_(value);
  1665. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1)})}));
  1666. return self}, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock}, smalltalk.HashedCollection)})},
  1667. args: ["aBlock"],
  1668. source: "valuesDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value ]\x0a",
  1669. messageSends: ["keysAndValuesDo:", "value:"],
  1670. referencedClasses: []
  1671. }),
  1672. smalltalk.HashedCollection);
  1673. smalltalk.addMethod(
  1674. "_fromPairs_",
  1675. smalltalk.method({
  1676. selector: "fromPairs:",
  1677. category: 'instance creation',
  1678. fn: function (aCollection){
  1679. var self=this;
  1680. var dict;
  1681. return smalltalk.withContext(function($ctx1) {
  1682. var $1;
  1683. dict=_st(self)._new();
  1684. _st(aCollection)._do_((function(each){
  1685. return smalltalk.withContext(function($ctx2) {
  1686. return _st(dict)._add_(each);
  1687. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  1688. $1=dict;
  1689. return $1;
  1690. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection,dict:dict}, smalltalk.HashedCollection.klass)})},
  1691. args: ["aCollection"],
  1692. source: "fromPairs: aCollection\x0a\x09| dict |\x0a\x09dict := self new.\x0a\x09aCollection do: [:each | dict add: each].\x0a\x09^dict",
  1693. messageSends: ["new", "do:", "add:"],
  1694. referencedClasses: []
  1695. }),
  1696. smalltalk.HashedCollection.klass);
  1697. smalltalk.addClass('Dictionary', smalltalk.HashedCollection, ['keys', 'values'], 'Kernel-Collections');
  1698. smalltalk.addMethod(
  1699. "_asHashedCollection",
  1700. smalltalk.method({
  1701. selector: "asHashedCollection",
  1702. category: 'converting',
  1703. fn: function (){
  1704. var self=this;
  1705. return smalltalk.withContext(function($ctx1) {
  1706. var $1;
  1707. $1=_st((smalltalk.HashedCollection || HashedCollection))._fromPairs_(_st(self)._associations());
  1708. return $1;
  1709. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{}, smalltalk.Dictionary)})},
  1710. args: [],
  1711. source: "asHashedCollection\x0a\x09^HashedCollection fromPairs: self associations",
  1712. messageSends: ["fromPairs:", "associations"],
  1713. referencedClasses: ["HashedCollection"]
  1714. }),
  1715. smalltalk.Dictionary);
  1716. smalltalk.addMethod(
  1717. "_asJSON",
  1718. smalltalk.method({
  1719. selector: "asJSON",
  1720. category: 'converting',
  1721. fn: function (){
  1722. var self=this;
  1723. return smalltalk.withContext(function($ctx1) {
  1724. var $1;
  1725. $1=_st(_st(self)._asHashedCollection())._asJSON();
  1726. return $1;
  1727. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Dictionary)})},
  1728. args: [],
  1729. source: "asJSON\x0a\x09^self asHashedCollection asJSON",
  1730. messageSends: ["asJSON", "asHashedCollection"],
  1731. referencedClasses: []
  1732. }),
  1733. smalltalk.Dictionary);
  1734. smalltalk.addMethod(
  1735. "_at_ifAbsent_",
  1736. smalltalk.method({
  1737. selector: "at:ifAbsent:",
  1738. category: 'accessing',
  1739. fn: function (aKey,aBlock){
  1740. var self=this;
  1741. return smalltalk.withContext(function($ctx1) {
  1742. var index = self._positionOfKey_(aKey);
  1743. return index >=0 ? self['@values'][index] : aBlock();
  1744. ;
  1745. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)})},
  1746. args: ["aKey", "aBlock"],
  1747. source: "at: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09return index >>=0 ? self['@values'][index] : aBlock();\x0a\x09>",
  1748. messageSends: [],
  1749. referencedClasses: []
  1750. }),
  1751. smalltalk.Dictionary);
  1752. smalltalk.addMethod(
  1753. "_at_put_",
  1754. smalltalk.method({
  1755. selector: "at:put:",
  1756. category: 'accessing',
  1757. fn: function (aKey,aValue){
  1758. var self=this;
  1759. return smalltalk.withContext(function($ctx1) {
  1760. var index = self._positionOfKey_(aKey);
  1761. if(index === -1) {
  1762. var keys = self['@keys'];
  1763. index = keys.length;
  1764. keys.push(aKey);
  1765. }
  1766. return self['@values'][index] = aValue;
  1767. ;
  1768. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue}, smalltalk.Dictionary)})},
  1769. args: ["aKey", "aValue"],
  1770. 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>",
  1771. messageSends: [],
  1772. referencedClasses: []
  1773. }),
  1774. smalltalk.Dictionary);
  1775. smalltalk.addMethod(
  1776. "_includesKey_",
  1777. smalltalk.method({
  1778. selector: "includesKey:",
  1779. category: 'testing',
  1780. fn: function (aKey){
  1781. var self=this;
  1782. return smalltalk.withContext(function($ctx1) {
  1783. return self._positionOfKey_(aKey) >= 0; ;
  1784. return self}, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey}, smalltalk.Dictionary)})},
  1785. args: ["aKey"],
  1786. source: "includesKey: aKey\x0a\x09< return self._positionOfKey_(aKey) >>= 0; >",
  1787. messageSends: [],
  1788. referencedClasses: []
  1789. }),
  1790. smalltalk.Dictionary);
  1791. smalltalk.addMethod(
  1792. "_initialize",
  1793. smalltalk.method({
  1794. selector: "initialize",
  1795. category: 'initialization',
  1796. fn: function (){
  1797. var self=this;
  1798. return smalltalk.withContext(function($ctx1) {
  1799. smalltalk.HashedCollection.fn.prototype._initialize.apply(_st(self), []);
  1800. self["@keys"]=[];
  1801. self["@values"]=[];
  1802. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Dictionary)})},
  1803. args: [],
  1804. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  1805. messageSends: ["initialize"],
  1806. referencedClasses: []
  1807. }),
  1808. smalltalk.Dictionary);
  1809. smalltalk.addMethod(
  1810. "_keyAtValue_",
  1811. smalltalk.method({
  1812. selector: "keyAtValue:",
  1813. category: 'accessing',
  1814. fn: function (anObject){
  1815. var self=this;
  1816. return smalltalk.withContext(function($ctx1) {
  1817. var $1;
  1818. $1=_st(_st(_st(self)._associations())._detect_ifNone_((function(k,v){
  1819. return smalltalk.withContext(function($ctx2) {
  1820. return _st(v).__eq_eq(anObject);
  1821. }, function($ctx2) {$ctx2.fillBlock({k:k,v:v},$ctx1)})}),(function(){
  1822. return smalltalk.withContext(function($ctx2) {
  1823. return _st(self)._error_("Not found");
  1824. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._key();
  1825. return $1;
  1826. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject}, smalltalk.Dictionary)})},
  1827. args: ["anObject"],
  1828. source: "keyAtValue: anObject\x0a\x0a\x09^ (self associations \x0a \x09detect:[:k :v| v == anObject] \x0a \x09ifNone:[self error: 'Not found']) key",
  1829. messageSends: ["key", "detect:ifNone:", "==", "error:", "associations"],
  1830. referencedClasses: []
  1831. }),
  1832. smalltalk.Dictionary);
  1833. smalltalk.addMethod(
  1834. "_keys",
  1835. smalltalk.method({
  1836. selector: "keys",
  1837. category: 'accessing',
  1838. fn: function (){
  1839. var self=this;
  1840. return smalltalk.withContext(function($ctx1) {
  1841. var $1;
  1842. $1=_st(self["@keys"])._copy();
  1843. return $1;
  1844. }, function($ctx1) {$ctx1.fill(self,"keys",{}, smalltalk.Dictionary)})},
  1845. args: [],
  1846. source: "keys\x0a\x09^keys copy",
  1847. messageSends: ["copy"],
  1848. referencedClasses: []
  1849. }),
  1850. smalltalk.Dictionary);
  1851. smalltalk.addMethod(
  1852. "_keysAndValuesDo_",
  1853. smalltalk.method({
  1854. selector: "keysAndValuesDo:",
  1855. category: 'enumerating',
  1856. fn: function (aBlock){
  1857. var self=this;
  1858. return smalltalk.withContext(function($ctx1) {
  1859. var $1;
  1860. $1=_st(self["@keys"])._with_do_(self["@values"],aBlock);
  1861. return $1;
  1862. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock}, smalltalk.Dictionary)})},
  1863. args: ["aBlock"],
  1864. source: "keysAndValuesDo: aBlock\x0a\x09^keys with: values do: aBlock",
  1865. messageSends: ["with:do:"],
  1866. referencedClasses: []
  1867. }),
  1868. smalltalk.Dictionary);
  1869. smalltalk.addMethod(
  1870. "_keysDo_",
  1871. smalltalk.method({
  1872. selector: "keysDo:",
  1873. category: 'enumerating',
  1874. fn: function (aBlock){
  1875. var self=this;
  1876. return smalltalk.withContext(function($ctx1) {
  1877. var $1;
  1878. $1=_st(self["@keys"])._do_(aBlock);
  1879. return $1;
  1880. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock}, smalltalk.Dictionary)})},
  1881. args: ["aBlock"],
  1882. source: "keysDo: aBlock\x0a\x09^keys do: aBlock",
  1883. messageSends: ["do:"],
  1884. referencedClasses: []
  1885. }),
  1886. smalltalk.Dictionary);
  1887. smalltalk.addMethod(
  1888. "_positionOfKey_",
  1889. smalltalk.method({
  1890. selector: "positionOfKey:",
  1891. category: 'private',
  1892. fn: function (anObject){
  1893. var self=this;
  1894. return smalltalk.withContext(function($ctx1) {
  1895. var keys = self['@keys'];
  1896. for(var i=0;i<keys.length;i++){
  1897. if(keys[i].__eq(anObject)) { return i;}
  1898. }
  1899. return -1;
  1900. ;
  1901. return self}, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject}, smalltalk.Dictionary)})},
  1902. args: ["anObject"],
  1903. 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>",
  1904. messageSends: [],
  1905. referencedClasses: []
  1906. }),
  1907. smalltalk.Dictionary);
  1908. smalltalk.addMethod(
  1909. "_removeKey_ifAbsent_",
  1910. smalltalk.method({
  1911. selector: "removeKey:ifAbsent:",
  1912. category: 'adding/removing',
  1913. fn: function (aKey,aBlock){
  1914. var self=this;
  1915. return smalltalk.withContext(function($ctx1) {
  1916. var index = self._positionOfKey_(aKey);
  1917. if(index === -1) {
  1918. return aBlock()
  1919. } else {
  1920. var keys = self['@keys'], values = self['@values'];
  1921. var value = values[index], l = keys.length;
  1922. keys[index] = keys[l-1];
  1923. keys.pop();
  1924. values[index] = values[l-1];
  1925. values.pop();
  1926. return value;
  1927. }
  1928. ;
  1929. return self}, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock}, smalltalk.Dictionary)})},
  1930. args: ["aKey", "aBlock"],
  1931. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09<\x0a\x09\x09var index = self._positionOfKey_(aKey);\x0a\x09\x09if(index === -1) {\x0a\x09\x09\x09return aBlock()\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>",
  1932. messageSends: [],
  1933. referencedClasses: []
  1934. }),
  1935. smalltalk.Dictionary);
  1936. smalltalk.addMethod(
  1937. "_values",
  1938. smalltalk.method({
  1939. selector: "values",
  1940. category: 'accessing',
  1941. fn: function (){
  1942. var self=this;
  1943. return smalltalk.withContext(function($ctx1) {
  1944. var $1;
  1945. $1=_st(self["@values"])._copy();
  1946. return $1;
  1947. }, function($ctx1) {$ctx1.fill(self,"values",{}, smalltalk.Dictionary)})},
  1948. args: [],
  1949. source: "values\x0a\x09^values copy",
  1950. messageSends: ["copy"],
  1951. referencedClasses: []
  1952. }),
  1953. smalltalk.Dictionary);
  1954. smalltalk.addMethod(
  1955. "_valuesDo_",
  1956. smalltalk.method({
  1957. selector: "valuesDo:",
  1958. category: 'enumerating',
  1959. fn: function (aBlock){
  1960. var self=this;
  1961. return smalltalk.withContext(function($ctx1) {
  1962. var $1;
  1963. $1=_st(self["@values"])._do_(aBlock);
  1964. return $1;
  1965. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock}, smalltalk.Dictionary)})},
  1966. args: ["aBlock"],
  1967. source: "valuesDo: aBlock\x0a\x09^values do: aBlock",
  1968. messageSends: ["do:"],
  1969. referencedClasses: []
  1970. }),
  1971. smalltalk.Dictionary);
  1972. smalltalk.addClass('SequenceableCollection', smalltalk.IndexableCollection, [], 'Kernel-Collections');
  1973. smalltalk.addMethod(
  1974. "__eq",
  1975. smalltalk.method({
  1976. selector: "=",
  1977. category: 'comparing',
  1978. fn: function (aCollection){
  1979. var self=this;
  1980. return smalltalk.withContext(function($ctx1) { var $1,$2;
  1981. var $early={};
  1982. try {
  1983. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  1984. return smalltalk.withContext(function($ctx2) { return _st(_st(self)._size()).__eq(_st(aCollection)._size());
  1985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  1986. if(! smalltalk.assert($1)){
  1987. return false;
  1988. };
  1989. _st(self)._withIndexDo_((function(each,i){
  1990. return smalltalk.withContext(function($ctx2) { $2=_st(_st(aCollection)._at_(i)).__eq(each);
  1991. if(! smalltalk.assert($2)){
  1992. throw $early=[false];
  1993. };
  1994. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  1995. return true;
  1996. }
  1997. catch(e) {if(e===$early)return e[0]; throw e}
  1998. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.SequenceableCollection)})},
  1999. args: ["aCollection"],
  2000. source: "= aCollection\x0a\x09(self class = aCollection class and: [\x0a\x09\x09self size = aCollection size]) ifFalse: [^false].\x0a\x09self withIndexDo: [:each :i |\x0a (aCollection at: i) = each ifFalse: [^false]].\x0a\x09^true",
  2001. messageSends: ["ifFalse:", "and:", "=", "size", "class", "withIndexDo:", "at:"],
  2002. referencedClasses: []
  2003. }),
  2004. smalltalk.SequenceableCollection);
  2005. smalltalk.addMethod(
  2006. "_addLast_",
  2007. smalltalk.method({
  2008. selector: "addLast:",
  2009. category: 'adding',
  2010. fn: function (anObject){
  2011. var self=this;
  2012. return smalltalk.withContext(function($ctx1) { _st(self)._add_(anObject);
  2013. return self}, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject}, smalltalk.SequenceableCollection)})},
  2014. args: ["anObject"],
  2015. source: "addLast: anObject\x0a\x09self add: anObject",
  2016. messageSends: ["add:"],
  2017. referencedClasses: []
  2018. }),
  2019. smalltalk.SequenceableCollection);
  2020. smalltalk.addMethod(
  2021. "_allButFirst",
  2022. smalltalk.method({
  2023. selector: "allButFirst",
  2024. category: 'accessing',
  2025. fn: function (){
  2026. var self=this;
  2027. return smalltalk.withContext(function($ctx1) { var $1;
  2028. $1=_st(self)._copyFrom_to_((2),_st(self)._size());
  2029. return $1;
  2030. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{}, smalltalk.SequenceableCollection)})},
  2031. args: [],
  2032. source: "allButFirst\x0a\x09^self copyFrom: 2 to: self size",
  2033. messageSends: ["copyFrom:to:", "size"],
  2034. referencedClasses: []
  2035. }),
  2036. smalltalk.SequenceableCollection);
  2037. smalltalk.addMethod(
  2038. "_allButLast",
  2039. smalltalk.method({
  2040. selector: "allButLast",
  2041. category: 'accessing',
  2042. fn: function (){
  2043. var self=this;
  2044. return smalltalk.withContext(function($ctx1) { var $1;
  2045. $1=_st(self)._copyFrom_to_((1),_st(_st(self)._size()).__minus((1)));
  2046. return $1;
  2047. }, function($ctx1) {$ctx1.fill(self,"allButLast",{}, smalltalk.SequenceableCollection)})},
  2048. args: [],
  2049. source: "allButLast\x0a\x09^self copyFrom: 1 to: self size - 1",
  2050. messageSends: ["copyFrom:to:", "-", "size"],
  2051. referencedClasses: []
  2052. }),
  2053. smalltalk.SequenceableCollection);
  2054. smalltalk.addMethod(
  2055. "_at_",
  2056. smalltalk.method({
  2057. selector: "at:",
  2058. category: 'accessing',
  2059. fn: function (anIndex){
  2060. var self=this;
  2061. return smalltalk.withContext(function($ctx1) { var $1;
  2062. $1=_st(self)._at_ifAbsent_(anIndex,(function(){
  2063. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  2064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2065. return $1;
  2066. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex}, smalltalk.SequenceableCollection)})},
  2067. args: ["anIndex"],
  2068. source: "at: anIndex\x0a\x09^self at: anIndex ifAbsent: [\x0a\x09 self errorNotFound]",
  2069. messageSends: ["at:ifAbsent:", "errorNotFound"],
  2070. referencedClasses: []
  2071. }),
  2072. smalltalk.SequenceableCollection);
  2073. smalltalk.addMethod(
  2074. "_at_ifAbsent_",
  2075. smalltalk.method({
  2076. selector: "at:ifAbsent:",
  2077. category: 'accessing',
  2078. fn: function (anIndex,aBlock){
  2079. var self=this;
  2080. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  2081. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  2082. args: ["anIndex", "aBlock"],
  2083. source: "at: anIndex ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  2084. messageSends: ["subclassResponsibility"],
  2085. referencedClasses: []
  2086. }),
  2087. smalltalk.SequenceableCollection);
  2088. smalltalk.addMethod(
  2089. "_at_put_",
  2090. smalltalk.method({
  2091. selector: "at:put:",
  2092. category: 'accessing',
  2093. fn: function (anIndex,anObject){
  2094. var self=this;
  2095. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  2096. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.SequenceableCollection)})},
  2097. args: ["anIndex", "anObject"],
  2098. source: "at: anIndex put: anObject\x0a\x09self subclassResponsibility",
  2099. messageSends: ["subclassResponsibility"],
  2100. referencedClasses: []
  2101. }),
  2102. smalltalk.SequenceableCollection);
  2103. smalltalk.addMethod(
  2104. "_atRandom",
  2105. smalltalk.method({
  2106. selector: "atRandom",
  2107. category: 'accessing',
  2108. fn: function (){
  2109. var self=this;
  2110. return smalltalk.withContext(function($ctx1) { var $1;
  2111. $1=_st(self)._at_(_st(_st(self)._size())._atRandom());
  2112. return $1;
  2113. }, function($ctx1) {$ctx1.fill(self,"atRandom",{}, smalltalk.SequenceableCollection)})},
  2114. args: [],
  2115. source: "atRandom\x0a\x09^ self at: self size atRandom",
  2116. messageSends: ["at:", "atRandom", "size"],
  2117. referencedClasses: []
  2118. }),
  2119. smalltalk.SequenceableCollection);
  2120. smalltalk.addMethod(
  2121. "_copyFrom_to_",
  2122. smalltalk.method({
  2123. selector: "copyFrom:to:",
  2124. category: 'copying',
  2125. fn: function (anIndex,anotherIndex){
  2126. var self=this;
  2127. var range,newCollection;
  2128. return smalltalk.withContext(function($ctx1) { var $1;
  2129. range=_st(anIndex)._to_(anotherIndex);
  2130. newCollection=_st(_st(self)._class())._new_(_st(range)._size());
  2131. _st(range)._withIndexDo_((function(each,i){
  2132. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(i,_st(self)._at_(each));
  2133. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1)})}));
  2134. $1=newCollection;
  2135. return $1;
  2136. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex,range:range,newCollection:newCollection}, smalltalk.SequenceableCollection)})},
  2137. args: ["anIndex", "anotherIndex"],
  2138. 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 newCollection at: i put: (self at: each)].\x0a\x09^newCollection",
  2139. messageSends: ["to:", "new:", "size", "class", "withIndexDo:", "at:put:", "at:"],
  2140. referencedClasses: []
  2141. }),
  2142. smalltalk.SequenceableCollection);
  2143. smalltalk.addMethod(
  2144. "_deepCopy",
  2145. smalltalk.method({
  2146. selector: "deepCopy",
  2147. category: 'copying',
  2148. fn: function (){
  2149. var self=this;
  2150. var newCollection;
  2151. return smalltalk.withContext(function($ctx1) { var $1;
  2152. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  2153. _st(self)._withIndexDo_((function(each,index){
  2154. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  2155. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  2156. $1=newCollection;
  2157. return $1;
  2158. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)})},
  2159. args: [],
  2160. 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",
  2161. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:", "deepCopy"],
  2162. referencedClasses: []
  2163. }),
  2164. smalltalk.SequenceableCollection);
  2165. smalltalk.addMethod(
  2166. "_detect_ifNone_",
  2167. smalltalk.method({
  2168. selector: "detect:ifNone:",
  2169. category: 'enumerating',
  2170. fn: function (aBlock,anotherBlock){
  2171. var self=this;
  2172. return smalltalk.withContext(function($ctx1) {
  2173. for(var i = 0; i < self.length; i++)
  2174. if(aBlock(self[i]))
  2175. return self[i];
  2176. return anotherBlock();
  2177. ;
  2178. return self}, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.SequenceableCollection)})},
  2179. args: ["aBlock", "anotherBlock"],
  2180. source: "detect: aBlock ifNone: anotherBlock\x0a\x09<\x0a\x09\x09for(var i = 0; i < self.length; i++)\x0a\x09\x09\x09if(aBlock(self[i]))\x0a\x09\x09\x09\x09return self[i];\x0a\x09\x09return anotherBlock();\x0a\x09>",
  2181. messageSends: [],
  2182. referencedClasses: []
  2183. }),
  2184. smalltalk.SequenceableCollection);
  2185. smalltalk.addMethod(
  2186. "_do_",
  2187. smalltalk.method({
  2188. selector: "do:",
  2189. category: 'enumerating',
  2190. fn: function (aBlock){
  2191. var self=this;
  2192. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i]);};
  2193. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  2194. args: ["aBlock"],
  2195. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i]);}>",
  2196. messageSends: [],
  2197. referencedClasses: []
  2198. }),
  2199. smalltalk.SequenceableCollection);
  2200. smalltalk.addMethod(
  2201. "_first",
  2202. smalltalk.method({
  2203. selector: "first",
  2204. category: 'accessing',
  2205. fn: function (){
  2206. var self=this;
  2207. return smalltalk.withContext(function($ctx1) { var $1;
  2208. $1=_st(self)._at_((1));
  2209. return $1;
  2210. }, function($ctx1) {$ctx1.fill(self,"first",{}, smalltalk.SequenceableCollection)})},
  2211. args: [],
  2212. source: "first\x0a\x09^self at: 1",
  2213. messageSends: ["at:"],
  2214. referencedClasses: []
  2215. }),
  2216. smalltalk.SequenceableCollection);
  2217. smalltalk.addMethod(
  2218. "_first_",
  2219. smalltalk.method({
  2220. selector: "first:",
  2221. category: 'accessing',
  2222. fn: function (n){
  2223. var self=this;
  2224. return smalltalk.withContext(function($ctx1) { var $1;
  2225. $1=_st(self)._copyFrom_to_((1),n);
  2226. return $1;
  2227. }, function($ctx1) {$ctx1.fill(self,"first:",{n:n}, smalltalk.SequenceableCollection)})},
  2228. args: ["n"],
  2229. source: "first: n\x0a\x09\x22Answer the first n elements of the receiver.\x0a\x09Raise an error if there are not enough elements.\x22\x0a\x0a\x09^ self copyFrom: 1 to: n",
  2230. messageSends: ["copyFrom:to:"],
  2231. referencedClasses: []
  2232. }),
  2233. smalltalk.SequenceableCollection);
  2234. smalltalk.addMethod(
  2235. "_fourth",
  2236. smalltalk.method({
  2237. selector: "fourth",
  2238. category: 'accessing',
  2239. fn: function (){
  2240. var self=this;
  2241. return smalltalk.withContext(function($ctx1) { var $1;
  2242. $1=_st(self)._at_((4));
  2243. return $1;
  2244. }, function($ctx1) {$ctx1.fill(self,"fourth",{}, smalltalk.SequenceableCollection)})},
  2245. args: [],
  2246. source: "fourth\x0a\x09^self at: 4",
  2247. messageSends: ["at:"],
  2248. referencedClasses: []
  2249. }),
  2250. smalltalk.SequenceableCollection);
  2251. smalltalk.addMethod(
  2252. "_includes_",
  2253. smalltalk.method({
  2254. selector: "includes:",
  2255. category: 'testing',
  2256. fn: function (anObject){
  2257. var self=this;
  2258. return smalltalk.withContext(function($ctx1) { var $1;
  2259. $1=_st(_st(self)._indexOf_ifAbsent_(anObject,(function(){
  2260. return smalltalk.withContext(function($ctx2) { return nil;
  2261. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})))._notNil();
  2262. return $1;
  2263. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.SequenceableCollection)})},
  2264. args: ["anObject"],
  2265. source: "includes: anObject\x0a\x09^(self indexOf: anObject ifAbsent: [nil]) notNil",
  2266. messageSends: ["notNil", "indexOf:ifAbsent:"],
  2267. referencedClasses: []
  2268. }),
  2269. smalltalk.SequenceableCollection);
  2270. smalltalk.addMethod(
  2271. "_indexOf_",
  2272. smalltalk.method({
  2273. selector: "indexOf:",
  2274. category: 'accessing',
  2275. fn: function (anObject){
  2276. var self=this;
  2277. return smalltalk.withContext(function($ctx1) { var $1;
  2278. $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
  2279. return smalltalk.withContext(function($ctx2) { return _st(self)._errorNotFound();
  2280. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2281. return $1;
  2282. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject}, smalltalk.SequenceableCollection)})},
  2283. args: ["anObject"],
  2284. source: "indexOf: anObject\x0a\x09^self indexOf: anObject ifAbsent: [self errorNotFound]",
  2285. messageSends: ["indexOf:ifAbsent:", "errorNotFound"],
  2286. referencedClasses: []
  2287. }),
  2288. smalltalk.SequenceableCollection);
  2289. smalltalk.addMethod(
  2290. "_indexOf_ifAbsent_",
  2291. smalltalk.method({
  2292. selector: "indexOf:ifAbsent:",
  2293. category: 'accessing',
  2294. fn: function (anObject,aBlock){
  2295. var self=this;
  2296. return smalltalk.withContext(function($ctx1) {
  2297. for(var i=0;i<self.length;i++) {
  2298. if(self[i].__eq(anObject)) {return i+1}
  2299. };
  2300. return aBlock();
  2301. ;
  2302. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  2303. args: ["anObject", "aBlock"],
  2304. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09};\x0a\x09\x09return aBlock();\x0a\x09>",
  2305. messageSends: [],
  2306. referencedClasses: []
  2307. }),
  2308. smalltalk.SequenceableCollection);
  2309. smalltalk.addMethod(
  2310. "_indexOf_startingAt_",
  2311. smalltalk.method({
  2312. selector: "indexOf:startingAt:",
  2313. category: 'accessing',
  2314. fn: function (anObject,start){
  2315. var self=this;
  2316. return smalltalk.withContext(function($ctx1) { var $1;
  2317. $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  2318. return smalltalk.withContext(function($ctx2) { return (0);
  2319. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  2320. return $1;
  2321. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start}, smalltalk.SequenceableCollection)})},
  2322. args: ["anObject", "start"],
  2323. 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]",
  2324. messageSends: ["indexOf:startingAt:ifAbsent:"],
  2325. referencedClasses: []
  2326. }),
  2327. smalltalk.SequenceableCollection);
  2328. smalltalk.addMethod(
  2329. "_indexOf_startingAt_ifAbsent_",
  2330. smalltalk.method({
  2331. selector: "indexOf:startingAt:ifAbsent:",
  2332. category: 'accessing',
  2333. fn: function (anObject,start,aBlock){
  2334. var self=this;
  2335. return smalltalk.withContext(function($ctx1) {
  2336. for(var i=start-1;i<self.length;i++){
  2337. if(self[i].__eq(anObject)) {return i+1}
  2338. }
  2339. return aBlock();
  2340. ;
  2341. return self}, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  2342. args: ["anObject", "start", "aBlock"],
  2343. source: "indexOf: anObject startingAt: start ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=start-1;i<self.length;i++){\x0a\x09\x09\x09if(self[i].__eq(anObject)) {return i+1}\x0a\x09\x09}\x0a\x09\x09return aBlock();\x0a\x09>",
  2344. messageSends: [],
  2345. referencedClasses: []
  2346. }),
  2347. smalltalk.SequenceableCollection);
  2348. smalltalk.addMethod(
  2349. "_last",
  2350. smalltalk.method({
  2351. selector: "last",
  2352. category: 'accessing',
  2353. fn: function (){
  2354. var self=this;
  2355. return smalltalk.withContext(function($ctx1) { var $1;
  2356. $1=_st(self)._at_(_st(self)._size());
  2357. return $1;
  2358. }, function($ctx1) {$ctx1.fill(self,"last",{}, smalltalk.SequenceableCollection)})},
  2359. args: [],
  2360. source: "last\x0a\x09^self at: self size",
  2361. messageSends: ["at:", "size"],
  2362. referencedClasses: []
  2363. }),
  2364. smalltalk.SequenceableCollection);
  2365. smalltalk.addMethod(
  2366. "_removeLast",
  2367. smalltalk.method({
  2368. selector: "removeLast",
  2369. category: 'adding',
  2370. fn: function (){
  2371. var self=this;
  2372. return smalltalk.withContext(function($ctx1) { _st(self)._remove_(_st(self)._last());
  2373. return self}, function($ctx1) {$ctx1.fill(self,"removeLast",{}, smalltalk.SequenceableCollection)})},
  2374. args: [],
  2375. source: "removeLast\x0a\x09self remove: self last",
  2376. messageSends: ["remove:", "last"],
  2377. referencedClasses: []
  2378. }),
  2379. smalltalk.SequenceableCollection);
  2380. smalltalk.addMethod(
  2381. "_reversed",
  2382. smalltalk.method({
  2383. selector: "reversed",
  2384. category: 'converting',
  2385. fn: function (){
  2386. var self=this;
  2387. return smalltalk.withContext(function($ctx1) { _st(self)._subclassResponsibility();
  2388. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.SequenceableCollection)})},
  2389. args: [],
  2390. source: "reversed\x0a\x09self subclassResponsibility",
  2391. messageSends: ["subclassResponsibility"],
  2392. referencedClasses: []
  2393. }),
  2394. smalltalk.SequenceableCollection);
  2395. smalltalk.addMethod(
  2396. "_second",
  2397. smalltalk.method({
  2398. selector: "second",
  2399. category: 'accessing',
  2400. fn: function (){
  2401. var self=this;
  2402. return smalltalk.withContext(function($ctx1) { var $1;
  2403. $1=_st(self)._at_((2));
  2404. return $1;
  2405. }, function($ctx1) {$ctx1.fill(self,"second",{}, smalltalk.SequenceableCollection)})},
  2406. args: [],
  2407. source: "second\x0a\x09^self at: 2",
  2408. messageSends: ["at:"],
  2409. referencedClasses: []
  2410. }),
  2411. smalltalk.SequenceableCollection);
  2412. smalltalk.addMethod(
  2413. "_shallowCopy",
  2414. smalltalk.method({
  2415. selector: "shallowCopy",
  2416. category: 'copying',
  2417. fn: function (){
  2418. var self=this;
  2419. var newCollection;
  2420. return smalltalk.withContext(function($ctx1) { var $1;
  2421. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  2422. _st(self)._withIndexDo_((function(each,index){
  2423. return smalltalk.withContext(function($ctx2) { return _st(newCollection)._at_put_(index,each);
  2424. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1)})}));
  2425. $1=newCollection;
  2426. return $1;
  2427. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{newCollection:newCollection}, smalltalk.SequenceableCollection)})},
  2428. args: [],
  2429. 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",
  2430. messageSends: ["new:", "size", "class", "withIndexDo:", "at:put:"],
  2431. referencedClasses: []
  2432. }),
  2433. smalltalk.SequenceableCollection);
  2434. smalltalk.addMethod(
  2435. "_third",
  2436. smalltalk.method({
  2437. selector: "third",
  2438. category: 'accessing',
  2439. fn: function (){
  2440. var self=this;
  2441. return smalltalk.withContext(function($ctx1) { var $1;
  2442. $1=_st(self)._at_((3));
  2443. return $1;
  2444. }, function($ctx1) {$ctx1.fill(self,"third",{}, smalltalk.SequenceableCollection)})},
  2445. args: [],
  2446. source: "third\x0a\x09^self at: 3",
  2447. messageSends: ["at:"],
  2448. referencedClasses: []
  2449. }),
  2450. smalltalk.SequenceableCollection);
  2451. smalltalk.addMethod(
  2452. "_with_do_",
  2453. smalltalk.method({
  2454. selector: "with:do:",
  2455. category: 'enumerating',
  2456. fn: function (anotherCollection,aBlock){
  2457. var self=this;
  2458. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i], anotherCollection[i]);};
  2459. return self}, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  2460. args: ["anotherCollection", "aBlock"],
  2461. source: "with: anotherCollection do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], anotherCollection[i]);}>",
  2462. messageSends: [],
  2463. referencedClasses: []
  2464. }),
  2465. smalltalk.SequenceableCollection);
  2466. smalltalk.addMethod(
  2467. "_withIndexDo_",
  2468. smalltalk.method({
  2469. selector: "withIndexDo:",
  2470. category: 'enumerating',
  2471. fn: function (aBlock){
  2472. var self=this;
  2473. return smalltalk.withContext(function($ctx1) { for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  2474. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.SequenceableCollection)})},
  2475. args: ["aBlock"],
  2476. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  2477. messageSends: [],
  2478. referencedClasses: []
  2479. }),
  2480. smalltalk.SequenceableCollection);
  2481. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  2482. smalltalk.addMethod(
  2483. "_add_",
  2484. smalltalk.method({
  2485. selector: "add:",
  2486. category: 'adding/removing',
  2487. fn: function (anObject){
  2488. var self=this;
  2489. return smalltalk.withContext(function($ctx1) {
  2490. self.push(anObject); return anObject;;
  2491. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Array)})},
  2492. args: ["anObject"],
  2493. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  2494. messageSends: [],
  2495. referencedClasses: []
  2496. }),
  2497. smalltalk.Array);
  2498. smalltalk.addMethod(
  2499. "_asJavascript",
  2500. smalltalk.method({
  2501. selector: "asJavascript",
  2502. category: 'converting',
  2503. fn: function (){
  2504. var self=this;
  2505. return smalltalk.withContext(function($ctx1) {
  2506. var $1;
  2507. $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
  2508. return smalltalk.withContext(function($ctx2) {
  2509. return _st(each)._asJavascript();
  2510. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})})))._join_(", "))).__comma("]");
  2511. return $1;
  2512. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Array)})},
  2513. args: [],
  2514. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  2515. messageSends: [",", "join:", "collect:", "asJavascript"],
  2516. referencedClasses: []
  2517. }),
  2518. smalltalk.Array);
  2519. smalltalk.addMethod(
  2520. "_at_ifAbsent_",
  2521. smalltalk.method({
  2522. selector: "at:ifAbsent:",
  2523. category: 'accessing',
  2524. fn: function (anIndex,aBlock){
  2525. var self=this;
  2526. return smalltalk.withContext(function($ctx1) {
  2527. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  2528. return self[anIndex - 1];
  2529. ;
  2530. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Array)})},
  2531. args: ["anIndex", "aBlock"],
  2532. source: "at: anIndex ifAbsent: aBlock\x0a\x09<\x0a\x09\x09if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};\x0a\x09\x09return self[anIndex - 1];\x0a\x09>",
  2533. messageSends: [],
  2534. referencedClasses: []
  2535. }),
  2536. smalltalk.Array);
  2537. smalltalk.addMethod(
  2538. "_at_put_",
  2539. smalltalk.method({
  2540. selector: "at:put:",
  2541. category: 'accessing',
  2542. fn: function (anIndex,anObject){
  2543. var self=this;
  2544. return smalltalk.withContext(function($ctx1) {
  2545. return self[anIndex - 1] = anObject;
  2546. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.Array)})},
  2547. args: ["anIndex", "anObject"],
  2548. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  2549. messageSends: [],
  2550. referencedClasses: []
  2551. }),
  2552. smalltalk.Array);
  2553. smalltalk.addMethod(
  2554. "_join_",
  2555. smalltalk.method({
  2556. selector: "join:",
  2557. category: 'enumerating',
  2558. fn: function (aString){
  2559. var self=this;
  2560. return smalltalk.withContext(function($ctx1) {
  2561. return self.join(aString);
  2562. return self}, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString}, smalltalk.Array)})},
  2563. args: ["aString"],
  2564. source: "join: aString\x0a\x09<return self.join(aString)>",
  2565. messageSends: [],
  2566. referencedClasses: []
  2567. }),
  2568. smalltalk.Array);
  2569. smalltalk.addMethod(
  2570. "_remove_ifAbsent_",
  2571. smalltalk.method({
  2572. selector: "remove:ifAbsent:",
  2573. category: 'adding/removing',
  2574. fn: function (anObject,aBlock){
  2575. var self=this;
  2576. return smalltalk.withContext(function($ctx1) {
  2577. for(var i=0;i<self.length;i++) {
  2578. if(self[i] == anObject) {
  2579. self.splice(i,1);
  2580. return self;
  2581. }
  2582. };
  2583. aBlock._value();
  2584. ;
  2585. return self}, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock}, smalltalk.Array)})},
  2586. args: ["anObject", "aBlock"],
  2587. source: "remove: anObject ifAbsent: aBlock\x0a\x09<\x0a\x09\x09for(var i=0;i<self.length;i++) {\x0a\x09\x09\x09if(self[i] == anObject) {\x0a\x09\x09\x09\x09self.splice(i,1);\x0a\x09\x09\x09\x09return self;\x0a\x09\x09\x09}\x0a\x09\x09};\x0a aBlock._value();\x0a\x09>",
  2588. messageSends: [],
  2589. referencedClasses: []
  2590. }),
  2591. smalltalk.Array);
  2592. smalltalk.addMethod(
  2593. "_removeFrom_to_",
  2594. smalltalk.method({
  2595. selector: "removeFrom:to:",
  2596. category: 'adding/removing',
  2597. fn: function (aNumber,anotherNumber){
  2598. var self=this;
  2599. return smalltalk.withContext(function($ctx1) {
  2600. self.splice(aNumber - 1,anotherNumber - 1);
  2601. return self}, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber}, smalltalk.Array)})},
  2602. args: ["aNumber", "anotherNumber"],
  2603. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  2604. messageSends: [],
  2605. referencedClasses: []
  2606. }),
  2607. smalltalk.Array);
  2608. smalltalk.addMethod(
  2609. "_reversed",
  2610. smalltalk.method({
  2611. selector: "reversed",
  2612. category: 'converting',
  2613. fn: function (){
  2614. var self=this;
  2615. return smalltalk.withContext(function($ctx1) {
  2616. return self._copy().reverse();
  2617. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.Array)})},
  2618. args: [],
  2619. source: "reversed\x0a\x09<return self._copy().reverse()>",
  2620. messageSends: [],
  2621. referencedClasses: []
  2622. }),
  2623. smalltalk.Array);
  2624. smalltalk.addMethod(
  2625. "_size",
  2626. smalltalk.method({
  2627. selector: "size",
  2628. category: 'accessing',
  2629. fn: function (){
  2630. var self=this;
  2631. return smalltalk.withContext(function($ctx1) {
  2632. return self.length;
  2633. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Array)})},
  2634. args: [],
  2635. source: "size\x0a\x09<return self.length>",
  2636. messageSends: [],
  2637. referencedClasses: []
  2638. }),
  2639. smalltalk.Array);
  2640. smalltalk.addMethod(
  2641. "_sort",
  2642. smalltalk.method({
  2643. selector: "sort",
  2644. category: 'enumerating',
  2645. fn: function (){
  2646. var self=this;
  2647. return smalltalk.withContext(function($ctx1) {
  2648. var $1;
  2649. $1=_st(self)._basicPerform_("sort");
  2650. return $1;
  2651. }, function($ctx1) {$ctx1.fill(self,"sort",{}, smalltalk.Array)})},
  2652. args: [],
  2653. source: "sort\x0a ^self basicPerform: 'sort'",
  2654. messageSends: ["basicPerform:"],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.Array);
  2658. smalltalk.addMethod(
  2659. "_sort_",
  2660. smalltalk.method({
  2661. selector: "sort:",
  2662. category: 'enumerating',
  2663. fn: function (aBlock){
  2664. var self=this;
  2665. return smalltalk.withContext(function($ctx1) {
  2666. return self.sort(function(a, b) {
  2667. if(aBlock(a,b)) {return -1} else {return 1}
  2668. })
  2669. ;
  2670. return self}, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock}, smalltalk.Array)})},
  2671. args: ["aBlock"],
  2672. source: "sort: aBlock\x0a\x09<\x0a\x09\x09return self.sort(function(a, b) {\x0a\x09\x09\x09if(aBlock(a,b)) {return -1} else {return 1}\x0a\x09\x09})\x0a\x09>",
  2673. messageSends: [],
  2674. referencedClasses: []
  2675. }),
  2676. smalltalk.Array);
  2677. smalltalk.addMethod(
  2678. "_sorted",
  2679. smalltalk.method({
  2680. selector: "sorted",
  2681. category: 'enumerating',
  2682. fn: function (){
  2683. var self=this;
  2684. return smalltalk.withContext(function($ctx1) {
  2685. var $1;
  2686. $1=_st(_st(self)._copy())._sort();
  2687. return $1;
  2688. }, function($ctx1) {$ctx1.fill(self,"sorted",{}, smalltalk.Array)})},
  2689. args: [],
  2690. source: "sorted\x0a\x09^self copy sort",
  2691. messageSends: ["sort", "copy"],
  2692. referencedClasses: []
  2693. }),
  2694. smalltalk.Array);
  2695. smalltalk.addMethod(
  2696. "_sorted_",
  2697. smalltalk.method({
  2698. selector: "sorted:",
  2699. category: 'enumerating',
  2700. fn: function (aBlock){
  2701. var self=this;
  2702. return smalltalk.withContext(function($ctx1) {
  2703. var $1;
  2704. $1=_st(_st(self)._copy())._sort_(aBlock);
  2705. return $1;
  2706. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock}, smalltalk.Array)})},
  2707. args: ["aBlock"],
  2708. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  2709. messageSends: ["sort:", "copy"],
  2710. referencedClasses: []
  2711. }),
  2712. smalltalk.Array);
  2713. smalltalk.addMethod(
  2714. "_new_",
  2715. smalltalk.method({
  2716. selector: "new:",
  2717. category: 'instance creation',
  2718. fn: function (anInteger){
  2719. var self=this;
  2720. return smalltalk.withContext(function($ctx1) {
  2721. return new Array(anInteger);
  2722. return self}, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger}, smalltalk.Array.klass)})},
  2723. args: ["anInteger"],
  2724. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  2725. messageSends: [],
  2726. referencedClasses: []
  2727. }),
  2728. smalltalk.Array.klass);
  2729. smalltalk.addMethod(
  2730. "_with_",
  2731. smalltalk.method({
  2732. selector: "with:",
  2733. category: 'instance creation',
  2734. fn: function (anObject){
  2735. var self=this;
  2736. return smalltalk.withContext(function($ctx1) {
  2737. var $2,$3,$1;
  2738. $2=_st(self)._new_((1));
  2739. _st($2)._at_put_((1),anObject);
  2740. $3=_st($2)._yourself();
  2741. $1=$3;
  2742. return $1;
  2743. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject}, smalltalk.Array.klass)})},
  2744. args: ["anObject"],
  2745. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  2746. messageSends: ["at:put:", "new:", "yourself"],
  2747. referencedClasses: []
  2748. }),
  2749. smalltalk.Array.klass);
  2750. smalltalk.addMethod(
  2751. "_with_with_",
  2752. smalltalk.method({
  2753. selector: "with:with:",
  2754. category: 'instance creation',
  2755. fn: function (anObject,anObject2){
  2756. var self=this;
  2757. return smalltalk.withContext(function($ctx1) {
  2758. var $2,$3,$1;
  2759. $2=_st(self)._new_((2));
  2760. _st($2)._at_put_((1),anObject);
  2761. _st($2)._at_put_((2),anObject2);
  2762. $3=_st($2)._yourself();
  2763. $1=$3;
  2764. return $1;
  2765. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2}, smalltalk.Array.klass)})},
  2766. args: ["anObject", "anObject2"],
  2767. source: "with: anObject with: anObject2\x0a\x09 ^(self new: 2)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09at: 2 put: anObject2;\x0a\x09\x09yourself",
  2768. messageSends: ["at:put:", "new:", "yourself"],
  2769. referencedClasses: []
  2770. }),
  2771. smalltalk.Array.klass);
  2772. smalltalk.addMethod(
  2773. "_with_with_with_",
  2774. smalltalk.method({
  2775. selector: "with:with:with:",
  2776. category: 'instance creation',
  2777. fn: function (anObject,anObject2,anObject3){
  2778. var self=this;
  2779. return smalltalk.withContext(function($ctx1) {
  2780. var $2,$3,$1;
  2781. $2=_st(self)._new_((3));
  2782. _st($2)._at_put_((1),anObject);
  2783. _st($2)._at_put_((2),anObject2);
  2784. _st($2)._at_put_((3),anObject3);
  2785. $3=_st($2)._yourself();
  2786. $1=$3;
  2787. return $1;
  2788. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3}, smalltalk.Array.klass)})},
  2789. args: ["anObject", "anObject2", "anObject3"],
  2790. source: "with: anObject with: anObject2 with: anObject3\x0a\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",
  2791. messageSends: ["at:put:", "new:", "yourself"],
  2792. referencedClasses: []
  2793. }),
  2794. smalltalk.Array.klass);
  2795. smalltalk.addMethod(
  2796. "_withAll_",
  2797. smalltalk.method({
  2798. selector: "withAll:",
  2799. category: 'instance creation',
  2800. fn: function (aCollection){
  2801. var self=this;
  2802. var instance,index;
  2803. return smalltalk.withContext(function($ctx1) {
  2804. var $1;
  2805. index=(1);
  2806. instance=_st(self)._new_(_st(aCollection)._size());
  2807. _st(aCollection)._do_((function(each){
  2808. return smalltalk.withContext(function($ctx2) {
  2809. _st(instance)._at_put_(index,each);
  2810. index=_st(index).__plus((1));
  2811. return index;
  2812. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  2813. $1=instance;
  2814. return $1;
  2815. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index}, smalltalk.Array.klass)})},
  2816. args: ["aCollection"],
  2817. 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",
  2818. messageSends: ["new:", "size", "do:", "at:put:", "+"],
  2819. referencedClasses: []
  2820. }),
  2821. smalltalk.Array.klass);
  2822. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  2823. smalltalk.addMethod(
  2824. "__comma",
  2825. smalltalk.method({
  2826. selector: ",",
  2827. category: 'copying',
  2828. fn: function (aString){
  2829. var self=this;
  2830. return smalltalk.withContext(function($ctx1) {
  2831. var $1;
  2832. $1=_st(_st(self)._asString()).__comma(_st(aString)._asString());
  2833. return $1;
  2834. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.CharacterArray)})},
  2835. args: ["aString"],
  2836. source: ", aString\x0a\x09^self asString, aString asString",
  2837. messageSends: [",", "asString"],
  2838. referencedClasses: []
  2839. }),
  2840. smalltalk.CharacterArray);
  2841. smalltalk.addMethod(
  2842. "_add_",
  2843. smalltalk.method({
  2844. selector: "add:",
  2845. category: 'adding',
  2846. fn: function (anObject){
  2847. var self=this;
  2848. return smalltalk.withContext(function($ctx1) {
  2849. _st(self)._errorReadOnly();
  2850. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.CharacterArray)})},
  2851. args: ["anObject"],
  2852. source: "add: anObject\x0a\x09self errorReadOnly",
  2853. messageSends: ["errorReadOnly"],
  2854. referencedClasses: []
  2855. }),
  2856. smalltalk.CharacterArray);
  2857. smalltalk.addMethod(
  2858. "_asLowercase",
  2859. smalltalk.method({
  2860. selector: "asLowercase",
  2861. category: 'converting',
  2862. fn: function (){
  2863. var self=this;
  2864. return smalltalk.withContext(function($ctx1) {
  2865. var $1;
  2866. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asLowercase());
  2867. return $1;
  2868. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.CharacterArray)})},
  2869. args: [],
  2870. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  2871. messageSends: ["fromString:", "asLowercase", "asString", "class"],
  2872. referencedClasses: []
  2873. }),
  2874. smalltalk.CharacterArray);
  2875. smalltalk.addMethod(
  2876. "_asNumber",
  2877. smalltalk.method({
  2878. selector: "asNumber",
  2879. category: 'converting',
  2880. fn: function (){
  2881. var self=this;
  2882. return smalltalk.withContext(function($ctx1) {
  2883. var $1;
  2884. $1=_st(_st(self)._asString())._asNumber();
  2885. return $1;
  2886. }, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.CharacterArray)})},
  2887. args: [],
  2888. source: "asNumber\x0a\x09^self asString asNumber",
  2889. messageSends: ["asNumber", "asString"],
  2890. referencedClasses: []
  2891. }),
  2892. smalltalk.CharacterArray);
  2893. smalltalk.addMethod(
  2894. "_asString",
  2895. smalltalk.method({
  2896. selector: "asString",
  2897. category: 'converting',
  2898. fn: function (){
  2899. var self=this;
  2900. return smalltalk.withContext(function($ctx1) {
  2901. var $1;
  2902. $1=_st(self)._subclassResponsibility();
  2903. return $1;
  2904. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.CharacterArray)})},
  2905. args: [],
  2906. source: "asString\x0a\x09^self subclassResponsibility",
  2907. messageSends: ["subclassResponsibility"],
  2908. referencedClasses: []
  2909. }),
  2910. smalltalk.CharacterArray);
  2911. smalltalk.addMethod(
  2912. "_asSymbol",
  2913. smalltalk.method({
  2914. selector: "asSymbol",
  2915. category: 'converting',
  2916. fn: function (){
  2917. var self=this;
  2918. return smalltalk.withContext(function($ctx1) {
  2919. var $1;
  2920. $1=_st(self)._subclassResponsibility();
  2921. return $1;
  2922. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.CharacterArray)})},
  2923. args: [],
  2924. source: "asSymbol\x0a\x09^self subclassResponsibility",
  2925. messageSends: ["subclassResponsibility"],
  2926. referencedClasses: []
  2927. }),
  2928. smalltalk.CharacterArray);
  2929. smalltalk.addMethod(
  2930. "_asUppercase",
  2931. smalltalk.method({
  2932. selector: "asUppercase",
  2933. category: 'converting',
  2934. fn: function (){
  2935. var self=this;
  2936. return smalltalk.withContext(function($ctx1) {
  2937. var $1;
  2938. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._asUppercase());
  2939. return $1;
  2940. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.CharacterArray)})},
  2941. args: [],
  2942. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  2943. messageSends: ["fromString:", "asUppercase", "asString", "class"],
  2944. referencedClasses: []
  2945. }),
  2946. smalltalk.CharacterArray);
  2947. smalltalk.addMethod(
  2948. "_at_put_",
  2949. smalltalk.method({
  2950. selector: "at:put:",
  2951. category: 'accessing',
  2952. fn: function (anIndex,anObject){
  2953. var self=this;
  2954. return smalltalk.withContext(function($ctx1) {
  2955. _st(self)._errorReadOnly();
  2956. return self}, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject}, smalltalk.CharacterArray)})},
  2957. args: ["anIndex", "anObject"],
  2958. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  2959. messageSends: ["errorReadOnly"],
  2960. referencedClasses: []
  2961. }),
  2962. smalltalk.CharacterArray);
  2963. smalltalk.addMethod(
  2964. "_errorReadOnly",
  2965. smalltalk.method({
  2966. selector: "errorReadOnly",
  2967. category: 'error handling',
  2968. fn: function (){
  2969. var self=this;
  2970. return smalltalk.withContext(function($ctx1) {
  2971. _st(self)._error_("Object is read-only");
  2972. return self}, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{}, smalltalk.CharacterArray)})},
  2973. args: [],
  2974. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  2975. messageSends: ["error:"],
  2976. referencedClasses: []
  2977. }),
  2978. smalltalk.CharacterArray);
  2979. smalltalk.addMethod(
  2980. "_printString",
  2981. smalltalk.method({
  2982. selector: "printString",
  2983. category: 'printing',
  2984. fn: function (){
  2985. var self=this;
  2986. return smalltalk.withContext(function($ctx1) {
  2987. var $1;
  2988. $1=_st(_st(self)._asString())._printString();
  2989. return $1;
  2990. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.CharacterArray)})},
  2991. args: [],
  2992. source: "printString\x0a\x09^self asString printString",
  2993. messageSends: ["printString", "asString"],
  2994. referencedClasses: []
  2995. }),
  2996. smalltalk.CharacterArray);
  2997. smalltalk.addMethod(
  2998. "_remove_",
  2999. smalltalk.method({
  3000. selector: "remove:",
  3001. category: 'adding',
  3002. fn: function (anObject){
  3003. var self=this;
  3004. return smalltalk.withContext(function($ctx1) {
  3005. _st(self)._errorReadOnly();
  3006. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.CharacterArray)})},
  3007. args: ["anObject"],
  3008. source: "remove: anObject\x0a\x09self errorReadOnly",
  3009. messageSends: ["errorReadOnly"],
  3010. referencedClasses: []
  3011. }),
  3012. smalltalk.CharacterArray);
  3013. smalltalk.addMethod(
  3014. "_fromString_",
  3015. smalltalk.method({
  3016. selector: "fromString:",
  3017. category: 'instance creation',
  3018. fn: function (aString){
  3019. var self=this;
  3020. return smalltalk.withContext(function($ctx1) {
  3021. _st(self)._subclassResponsibility();
  3022. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.CharacterArray.klass)})},
  3023. args: ["aString"],
  3024. source: "fromString: aString\x0a\x09self subclassResponsibility",
  3025. messageSends: ["subclassResponsibility"],
  3026. referencedClasses: []
  3027. }),
  3028. smalltalk.CharacterArray.klass);
  3029. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  3030. smalltalk.addMethod(
  3031. "__comma",
  3032. smalltalk.method({
  3033. selector: ",",
  3034. category: 'copying',
  3035. fn: function (aString){
  3036. var self=this;
  3037. return smalltalk.withContext(function($ctx1) {
  3038. return self + aString;
  3039. return self}, function($ctx1) {$ctx1.fill(self,",",{aString:aString}, smalltalk.String)})},
  3040. args: ["aString"],
  3041. source: ", aString\x0a\x09<return self + aString>",
  3042. messageSends: [],
  3043. referencedClasses: []
  3044. }),
  3045. smalltalk.String);
  3046. smalltalk.addMethod(
  3047. "__lt",
  3048. smalltalk.method({
  3049. selector: "<",
  3050. category: 'comparing',
  3051. fn: function (aString){
  3052. var self=this;
  3053. return smalltalk.withContext(function($ctx1) {
  3054. return String(self) < aString._asString();
  3055. return self}, function($ctx1) {$ctx1.fill(self,"<",{aString:aString}, smalltalk.String)})},
  3056. args: ["aString"],
  3057. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  3058. messageSends: [],
  3059. referencedClasses: []
  3060. }),
  3061. smalltalk.String);
  3062. smalltalk.addMethod(
  3063. "__lt_eq",
  3064. smalltalk.method({
  3065. selector: "<=",
  3066. category: 'comparing',
  3067. fn: function (aString){
  3068. var self=this;
  3069. return smalltalk.withContext(function($ctx1) {
  3070. return String(self) <= aString._asString();
  3071. return self}, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString}, smalltalk.String)})},
  3072. args: ["aString"],
  3073. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  3074. messageSends: [],
  3075. referencedClasses: []
  3076. }),
  3077. smalltalk.String);
  3078. smalltalk.addMethod(
  3079. "__eq",
  3080. smalltalk.method({
  3081. selector: "=",
  3082. category: 'comparing',
  3083. fn: function (aString){
  3084. var self=this;
  3085. return smalltalk.withContext(function($ctx1) {
  3086. if(! aString._isString || ! aString._isString()) {
  3087. return false;
  3088. }
  3089. return String(self) === String(aString)
  3090. ;
  3091. return self}, function($ctx1) {$ctx1.fill(self,"=",{aString:aString}, smalltalk.String)})},
  3092. args: ["aString"],
  3093. source: "= aString\x0a\x09<\x0a \x09if(! aString._isString || ! aString._isString()) {\x0a \x09return false;\x0a }\x0a \x09return String(self) === String(aString)\x0a >",
  3094. messageSends: [],
  3095. referencedClasses: []
  3096. }),
  3097. smalltalk.String);
  3098. smalltalk.addMethod(
  3099. "__eq_eq",
  3100. smalltalk.method({
  3101. selector: "==",
  3102. category: 'comparing',
  3103. fn: function (aString){
  3104. var self=this;
  3105. return smalltalk.withContext(function($ctx1) {
  3106. var $1;
  3107. $1=_st(self).__eq(aString);
  3108. return $1;
  3109. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString}, smalltalk.String)})},
  3110. args: ["aString"],
  3111. source: "== aString\x0a\x09^self = aString",
  3112. messageSends: ["="],
  3113. referencedClasses: []
  3114. }),
  3115. smalltalk.String);
  3116. smalltalk.addMethod(
  3117. "__gt",
  3118. smalltalk.method({
  3119. selector: ">",
  3120. category: 'comparing',
  3121. fn: function (aString){
  3122. var self=this;
  3123. return smalltalk.withContext(function($ctx1) {
  3124. return String(self) > aString._asString();
  3125. return self}, function($ctx1) {$ctx1.fill(self,">",{aString:aString}, smalltalk.String)})},
  3126. args: ["aString"],
  3127. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  3128. messageSends: [],
  3129. referencedClasses: []
  3130. }),
  3131. smalltalk.String);
  3132. smalltalk.addMethod(
  3133. "__gt_eq",
  3134. smalltalk.method({
  3135. selector: ">=",
  3136. category: 'comparing',
  3137. fn: function (aString){
  3138. var self=this;
  3139. return smalltalk.withContext(function($ctx1) {
  3140. return String(self) >= aString._asString();
  3141. return self}, function($ctx1) {$ctx1.fill(self,">=",{aString:aString}, smalltalk.String)})},
  3142. args: ["aString"],
  3143. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  3144. messageSends: [],
  3145. referencedClasses: []
  3146. }),
  3147. smalltalk.String);
  3148. smalltalk.addMethod(
  3149. "_asJSON",
  3150. smalltalk.method({
  3151. selector: "asJSON",
  3152. category: 'converting',
  3153. fn: function (){
  3154. var self=this;
  3155. return smalltalk.withContext(function($ctx1) {
  3156. var $1;
  3157. $1=self;
  3158. return $1;
  3159. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.String)})},
  3160. args: [],
  3161. source: "asJSON\x0a\x09^self",
  3162. messageSends: [],
  3163. referencedClasses: []
  3164. }),
  3165. smalltalk.String);
  3166. smalltalk.addMethod(
  3167. "_asJavaScriptSelector",
  3168. smalltalk.method({
  3169. selector: "asJavaScriptSelector",
  3170. category: 'converting',
  3171. fn: function (){
  3172. var self=this;
  3173. return smalltalk.withContext(function($ctx1) {
  3174. var $1;
  3175. $1=_st(_st(_st(self)._asSelector())._replace_with_("^_",""))._replace_with_("_.*","");
  3176. return $1;
  3177. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSelector",{}, smalltalk.String)})},
  3178. args: [],
  3179. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  3180. messageSends: ["replace:with:", "asSelector"],
  3181. referencedClasses: []
  3182. }),
  3183. smalltalk.String);
  3184. smalltalk.addMethod(
  3185. "_asJavascript",
  3186. smalltalk.method({
  3187. selector: "asJavascript",
  3188. category: 'converting',
  3189. fn: function (){
  3190. var self=this;
  3191. return smalltalk.withContext(function($ctx1) {
  3192. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  3193. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  3194. else
  3195. return "\"" + self + "\"";
  3196. ;
  3197. return self}, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.String)})},
  3198. args: [],
  3199. 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>",
  3200. messageSends: [],
  3201. referencedClasses: []
  3202. }),
  3203. smalltalk.String);
  3204. smalltalk.addMethod(
  3205. "_asLowercase",
  3206. smalltalk.method({
  3207. selector: "asLowercase",
  3208. category: 'converting',
  3209. fn: function (){
  3210. var self=this;
  3211. return smalltalk.withContext(function($ctx1) {
  3212. return self.toLowerCase();
  3213. return self}, function($ctx1) {$ctx1.fill(self,"asLowercase",{}, smalltalk.String)})},
  3214. args: [],
  3215. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  3216. messageSends: [],
  3217. referencedClasses: []
  3218. }),
  3219. smalltalk.String);
  3220. smalltalk.addMethod(
  3221. "_asNumber",
  3222. smalltalk.method({
  3223. selector: "asNumber",
  3224. category: 'converting',
  3225. fn: function (){
  3226. var self=this;
  3227. return smalltalk.withContext(function($ctx1) {
  3228. return Number(self);
  3229. return self}, function($ctx1) {$ctx1.fill(self,"asNumber",{}, smalltalk.String)})},
  3230. args: [],
  3231. source: "asNumber\x0a\x09<return Number(self)>",
  3232. messageSends: [],
  3233. referencedClasses: []
  3234. }),
  3235. smalltalk.String);
  3236. smalltalk.addMethod(
  3237. "_asRegexp",
  3238. smalltalk.method({
  3239. selector: "asRegexp",
  3240. category: 'converting',
  3241. fn: function (){
  3242. var self=this;
  3243. return smalltalk.withContext(function($ctx1) {
  3244. var $1;
  3245. $1=_st((smalltalk.RegularExpression || RegularExpression))._fromString_(self);
  3246. return $1;
  3247. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{}, smalltalk.String)})},
  3248. args: [],
  3249. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  3250. messageSends: ["fromString:"],
  3251. referencedClasses: ["RegularExpression"]
  3252. }),
  3253. smalltalk.String);
  3254. smalltalk.addMethod(
  3255. "_asSelector",
  3256. smalltalk.method({
  3257. selector: "asSelector",
  3258. category: 'converting',
  3259. fn: function (){
  3260. var self=this;
  3261. return smalltalk.withContext(function($ctx1) {
  3262. return smalltalk.selector(self);
  3263. return self}, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.String)})},
  3264. args: [],
  3265. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  3266. messageSends: [],
  3267. referencedClasses: []
  3268. }),
  3269. smalltalk.String);
  3270. smalltalk.addMethod(
  3271. "_asString",
  3272. smalltalk.method({
  3273. selector: "asString",
  3274. category: 'converting',
  3275. fn: function (){
  3276. var self=this;
  3277. return smalltalk.withContext(function($ctx1) {
  3278. var $1;
  3279. $1=self;
  3280. return $1;
  3281. }, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.String)})},
  3282. args: [],
  3283. source: "asString\x0a\x09^self",
  3284. messageSends: [],
  3285. referencedClasses: []
  3286. }),
  3287. smalltalk.String);
  3288. smalltalk.addMethod(
  3289. "_asSymbol",
  3290. smalltalk.method({
  3291. selector: "asSymbol",
  3292. category: 'converting',
  3293. fn: function (){
  3294. var self=this;
  3295. return smalltalk.withContext(function($ctx1) {
  3296. var $1;
  3297. $1=_st((smalltalk.Symbol || Symbol))._lookup_(self);
  3298. return $1;
  3299. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.String)})},
  3300. args: [],
  3301. source: "asSymbol\x0a\x09^Symbol lookup: self",
  3302. messageSends: ["lookup:"],
  3303. referencedClasses: ["Symbol"]
  3304. }),
  3305. smalltalk.String);
  3306. smalltalk.addMethod(
  3307. "_asUppercase",
  3308. smalltalk.method({
  3309. selector: "asUppercase",
  3310. category: 'converting',
  3311. fn: function (){
  3312. var self=this;
  3313. return smalltalk.withContext(function($ctx1) {
  3314. return self.toUpperCase();
  3315. return self}, function($ctx1) {$ctx1.fill(self,"asUppercase",{}, smalltalk.String)})},
  3316. args: [],
  3317. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  3318. messageSends: [],
  3319. referencedClasses: []
  3320. }),
  3321. smalltalk.String);
  3322. smalltalk.addMethod(
  3323. "_asciiValue",
  3324. smalltalk.method({
  3325. selector: "asciiValue",
  3326. category: 'accessing',
  3327. fn: function (){
  3328. var self=this;
  3329. return smalltalk.withContext(function($ctx1) {
  3330. return self.charCodeAt(0);;
  3331. return self}, function($ctx1) {$ctx1.fill(self,"asciiValue",{}, smalltalk.String)})},
  3332. args: [],
  3333. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  3334. messageSends: [],
  3335. referencedClasses: []
  3336. }),
  3337. smalltalk.String);
  3338. smalltalk.addMethod(
  3339. "_at_ifAbsent_",
  3340. smalltalk.method({
  3341. selector: "at:ifAbsent:",
  3342. category: 'accessing',
  3343. fn: function (anIndex,aBlock){
  3344. var self=this;
  3345. return smalltalk.withContext(function($ctx1) {
  3346. return String(self).charAt(anIndex - 1) || aBlock();
  3347. return self}, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.String)})},
  3348. args: ["anIndex", "aBlock"],
  3349. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  3350. messageSends: [],
  3351. referencedClasses: []
  3352. }),
  3353. smalltalk.String);
  3354. smalltalk.addMethod(
  3355. "_copyFrom_to_",
  3356. smalltalk.method({
  3357. selector: "copyFrom:to:",
  3358. category: 'copying',
  3359. fn: function (anIndex,anotherIndex){
  3360. var self=this;
  3361. return smalltalk.withContext(function($ctx1) {
  3362. return self.substring(anIndex - 1, anotherIndex);
  3363. return self}, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.String)})},
  3364. args: ["anIndex", "anotherIndex"],
  3365. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  3366. messageSends: [],
  3367. referencedClasses: []
  3368. }),
  3369. smalltalk.String);
  3370. smalltalk.addMethod(
  3371. "_deepCopy",
  3372. smalltalk.method({
  3373. selector: "deepCopy",
  3374. category: 'copying',
  3375. fn: function (){
  3376. var self=this;
  3377. return smalltalk.withContext(function($ctx1) {
  3378. var $1;
  3379. $1=_st(self)._shallowCopy();
  3380. return $1;
  3381. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.String)})},
  3382. args: [],
  3383. source: "deepCopy\x0a\x09^self shallowCopy",
  3384. messageSends: ["shallowCopy"],
  3385. referencedClasses: []
  3386. }),
  3387. smalltalk.String);
  3388. smalltalk.addMethod(
  3389. "_do_",
  3390. smalltalk.method({
  3391. selector: "do:",
  3392. category: 'enumerating',
  3393. fn: function (aBlock){
  3394. var self=this;
  3395. return smalltalk.withContext(function($ctx1) {
  3396. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  3397. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.String)})},
  3398. args: ["aBlock"],
  3399. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  3400. messageSends: [],
  3401. referencedClasses: []
  3402. }),
  3403. smalltalk.String);
  3404. smalltalk.addMethod(
  3405. "_escaped",
  3406. smalltalk.method({
  3407. selector: "escaped",
  3408. category: 'accessing',
  3409. fn: function (){
  3410. var self=this;
  3411. return smalltalk.withContext(function($ctx1) {
  3412. return escape(self);
  3413. return self}, function($ctx1) {$ctx1.fill(self,"escaped",{}, smalltalk.String)})},
  3414. args: [],
  3415. source: "escaped\x0a\x09<return escape(self)>",
  3416. messageSends: [],
  3417. referencedClasses: []
  3418. }),
  3419. smalltalk.String);
  3420. smalltalk.addMethod(
  3421. "_includesSubString_",
  3422. smalltalk.method({
  3423. selector: "includesSubString:",
  3424. category: 'testing',
  3425. fn: function (subString){
  3426. var self=this;
  3427. return smalltalk.withContext(function($ctx1) {
  3428. return self.indexOf(subString) != -1 ;
  3429. return self}, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString}, smalltalk.String)})},
  3430. args: ["subString"],
  3431. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  3432. messageSends: [],
  3433. referencedClasses: []
  3434. }),
  3435. smalltalk.String);
  3436. smalltalk.addMethod(
  3437. "_isString",
  3438. smalltalk.method({
  3439. selector: "isString",
  3440. category: 'testing',
  3441. fn: function (){
  3442. var self=this;
  3443. return smalltalk.withContext(function($ctx1) {
  3444. return true;
  3445. }, function($ctx1) {$ctx1.fill(self,"isString",{}, smalltalk.String)})},
  3446. args: [],
  3447. source: "isString\x0a\x09^true",
  3448. messageSends: [],
  3449. referencedClasses: []
  3450. }),
  3451. smalltalk.String);
  3452. smalltalk.addMethod(
  3453. "_join_",
  3454. smalltalk.method({
  3455. selector: "join:",
  3456. category: 'split join',
  3457. fn: function (aCollection){
  3458. var self=this;
  3459. return smalltalk.withContext(function($ctx1) {
  3460. var $1;
  3461. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  3462. return smalltalk.withContext(function($ctx2) {
  3463. return _st(aCollection)._do_separatedBy_((function(each){
  3464. return smalltalk.withContext(function($ctx3) {
  3465. return _st(stream)._nextPutAll_(_st(each)._asString());
  3466. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx1)})}),(function(){
  3467. return smalltalk.withContext(function($ctx3) {
  3468. return _st(stream)._nextPutAll_(self);
  3469. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  3470. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  3471. return $1;
  3472. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection}, smalltalk.String)})},
  3473. args: ["aCollection"],
  3474. 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]]",
  3475. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  3476. referencedClasses: ["String"]
  3477. }),
  3478. smalltalk.String);
  3479. smalltalk.addMethod(
  3480. "_lineIndicesDo_",
  3481. smalltalk.method({
  3482. selector: "lineIndicesDo:",
  3483. category: 'split join',
  3484. fn: function (aBlock){
  3485. var self=this;
  3486. var cr,lf,start,sz,nextLF,nextCR;
  3487. return smalltalk.withContext(function($ctx1) {
  3488. var $1,$2,$3,$4;
  3489. var $early={};
  3490. try {
  3491. start=(1);
  3492. sz=_st(self)._size();
  3493. cr=_st((smalltalk.String || String))._cr();
  3494. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  3495. lf=_st((smalltalk.String || String))._lf();
  3496. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  3497. _st((function(){
  3498. return smalltalk.withContext(function($ctx2) {
  3499. return _st(start).__lt_eq(sz);
  3500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  3501. return smalltalk.withContext(function($ctx2) {
  3502. $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  3503. return smalltalk.withContext(function($ctx3) {
  3504. return _st(nextCR).__eq((0));
  3505. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  3506. if(smalltalk.assert($1)){
  3507. _st(aBlock)._value_value_value_(start,sz,sz);
  3508. $2=self;
  3509. throw $early=[$2];
  3510. };
  3511. $3=_st(_st(nextCR).__eq((0)))._or_((function(){
  3512. return smalltalk.withContext(function($ctx3) {
  3513. return _st(_st((0)).__lt(nextLF))._and_((function(){
  3514. return smalltalk.withContext(function($ctx4) {
  3515. return _st(nextLF).__lt(nextCR);
  3516. }, function($ctx4) {$ctx4.fillBlock({},$ctx1)})}));
  3517. }, function($ctx3) {$ctx3.fillBlock({},$ctx1)})}));
  3518. if(smalltalk.assert($3)){
  3519. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  3520. start=_st((1)).__plus(nextLF);
  3521. start;
  3522. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  3523. return nextLF;
  3524. } else {
  3525. $4=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  3526. if(smalltalk.assert($4)){
  3527. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  3528. start=_st((1)).__plus(nextLF);
  3529. start;
  3530. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  3531. nextCR;
  3532. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  3533. return nextLF;
  3534. } else {
  3535. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  3536. start=_st((1)).__plus(nextCR);
  3537. start;
  3538. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  3539. return nextCR;
  3540. };
  3541. };
  3542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  3543. return self}
  3544. catch(e) {if(e===$early)return e[0]; throw e}
  3545. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR}, smalltalk.String)})},
  3546. args: ["aBlock"],
  3547. 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 ]]]",
  3548. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  3549. referencedClasses: ["String"]
  3550. }),
  3551. smalltalk.String);
  3552. smalltalk.addMethod(
  3553. "_lineNumber_",
  3554. smalltalk.method({
  3555. selector: "lineNumber:",
  3556. category: 'split join',
  3557. fn: function (anIndex){
  3558. var self=this;
  3559. var lineCount;
  3560. return smalltalk.withContext(function($ctx1) {
  3561. var $1,$2;
  3562. var $early={};
  3563. try {
  3564. lineCount=(0);
  3565. _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  3566. return smalltalk.withContext(function($ctx2) {
  3567. lineCount=_st(lineCount).__plus((1));
  3568. $1=_st(lineCount).__eq(anIndex);
  3569. if(smalltalk.assert($1)){
  3570. $2=_st(self)._copyFrom_to_(start,endWithoutDelimiters);
  3571. throw $early=[$2];
  3572. };
  3573. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  3574. return nil;
  3575. }
  3576. catch(e) {if(e===$early)return e[0]; throw e}
  3577. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount}, smalltalk.String)})},
  3578. args: ["anIndex"],
  3579. 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",
  3580. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  3581. referencedClasses: []
  3582. }),
  3583. smalltalk.String);
  3584. smalltalk.addMethod(
  3585. "_lines",
  3586. smalltalk.method({
  3587. selector: "lines",
  3588. category: 'split join',
  3589. fn: function (){
  3590. var self=this;
  3591. var lines;
  3592. return smalltalk.withContext(function($ctx1) {
  3593. var $1;
  3594. lines=_st((smalltalk.Array || Array))._new();
  3595. _st(self)._linesDo_((function(aLine){
  3596. return smalltalk.withContext(function($ctx2) {
  3597. return _st(lines)._add_(aLine);
  3598. }, function($ctx2) {$ctx2.fillBlock({aLine:aLine},$ctx1)})}));
  3599. $1=lines;
  3600. return $1;
  3601. }, function($ctx1) {$ctx1.fill(self,"lines",{lines:lines}, smalltalk.String)})},
  3602. args: [],
  3603. 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",
  3604. messageSends: ["new", "linesDo:", "add:"],
  3605. referencedClasses: ["Array"]
  3606. }),
  3607. smalltalk.String);
  3608. smalltalk.addMethod(
  3609. "_linesDo_",
  3610. smalltalk.method({
  3611. selector: "linesDo:",
  3612. category: 'split join',
  3613. fn: function (aBlock){
  3614. var self=this;
  3615. return smalltalk.withContext(function($ctx1) {
  3616. _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  3617. return smalltalk.withContext(function($ctx2) {
  3618. return _st(aBlock)._value_(_st(self)._copyFrom_to_(start,endWithoutDelimiters));
  3619. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1)})}));
  3620. return self}, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock}, smalltalk.String)})},
  3621. args: ["aBlock"],
  3622. 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)]",
  3623. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  3624. referencedClasses: []
  3625. }),
  3626. smalltalk.String);
  3627. smalltalk.addMethod(
  3628. "_match_",
  3629. smalltalk.method({
  3630. selector: "match:",
  3631. category: 'regular expressions',
  3632. fn: function (aRegexp){
  3633. var self=this;
  3634. return smalltalk.withContext(function($ctx1) {
  3635. return self.search(aRegexp) != -1;
  3636. return self}, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp}, smalltalk.String)})},
  3637. args: ["aRegexp"],
  3638. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  3639. messageSends: [],
  3640. referencedClasses: []
  3641. }),
  3642. smalltalk.String);
  3643. smalltalk.addMethod(
  3644. "_matchesOf_",
  3645. smalltalk.method({
  3646. selector: "matchesOf:",
  3647. category: 'regular expressions',
  3648. fn: function (aRegularExpression){
  3649. var self=this;
  3650. return smalltalk.withContext(function($ctx1) {
  3651. return self.match(aRegularExpression);
  3652. return self}, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression}, smalltalk.String)})},
  3653. args: ["aRegularExpression"],
  3654. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  3655. messageSends: [],
  3656. referencedClasses: []
  3657. }),
  3658. smalltalk.String);
  3659. smalltalk.addMethod(
  3660. "_printNl",
  3661. smalltalk.method({
  3662. selector: "printNl",
  3663. category: 'printing',
  3664. fn: function (){
  3665. var self=this;
  3666. return smalltalk.withContext(function($ctx1) {
  3667. console.log(self);
  3668. return self}, function($ctx1) {$ctx1.fill(self,"printNl",{}, smalltalk.String)})},
  3669. args: [],
  3670. source: "printNl\x0a\x09<console.log(self)>",
  3671. messageSends: [],
  3672. referencedClasses: []
  3673. }),
  3674. smalltalk.String);
  3675. smalltalk.addMethod(
  3676. "_printString",
  3677. smalltalk.method({
  3678. selector: "printString",
  3679. category: 'printing',
  3680. fn: function (){
  3681. var self=this;
  3682. return smalltalk.withContext(function($ctx1) {
  3683. var $1;
  3684. $1=_st(_st("'").__comma(self)).__comma("'");
  3685. return $1;
  3686. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.String)})},
  3687. args: [],
  3688. source: "printString\x0a\x09^'''', self, ''''",
  3689. messageSends: [","],
  3690. referencedClasses: []
  3691. }),
  3692. smalltalk.String);
  3693. smalltalk.addMethod(
  3694. "_replace_with_",
  3695. smalltalk.method({
  3696. selector: "replace:with:",
  3697. category: 'regular expressions',
  3698. fn: function (aString,anotherString){
  3699. var self=this;
  3700. return smalltalk.withContext(function($ctx1) {
  3701. var $1;
  3702. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(aString,"g"),anotherString);
  3703. return $1;
  3704. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString}, smalltalk.String)})},
  3705. args: ["aString", "anotherString"],
  3706. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  3707. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  3708. referencedClasses: ["RegularExpression"]
  3709. }),
  3710. smalltalk.String);
  3711. smalltalk.addMethod(
  3712. "_replaceRegexp_with_",
  3713. smalltalk.method({
  3714. selector: "replaceRegexp:with:",
  3715. category: 'regular expressions',
  3716. fn: function (aRegexp,aString){
  3717. var self=this;
  3718. return smalltalk.withContext(function($ctx1) {
  3719. return self.replace(aRegexp, aString);
  3720. return self}, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString}, smalltalk.String)})},
  3721. args: ["aRegexp", "aString"],
  3722. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  3723. messageSends: [],
  3724. referencedClasses: []
  3725. }),
  3726. smalltalk.String);
  3727. smalltalk.addMethod(
  3728. "_reversed",
  3729. smalltalk.method({
  3730. selector: "reversed",
  3731. category: 'converting',
  3732. fn: function (){
  3733. var self=this;
  3734. return smalltalk.withContext(function($ctx1) {
  3735. return self.split("").reverse().join("");
  3736. return self}, function($ctx1) {$ctx1.fill(self,"reversed",{}, smalltalk.String)})},
  3737. args: [],
  3738. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  3739. messageSends: [],
  3740. referencedClasses: []
  3741. }),
  3742. smalltalk.String);
  3743. smalltalk.addMethod(
  3744. "_shallowCopy",
  3745. smalltalk.method({
  3746. selector: "shallowCopy",
  3747. category: 'copying',
  3748. fn: function (){
  3749. var self=this;
  3750. return smalltalk.withContext(function($ctx1) {
  3751. var $1;
  3752. $1=_st(_st(self)._class())._fromString_(self);
  3753. return $1;
  3754. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.String)})},
  3755. args: [],
  3756. source: "shallowCopy\x0a\x09^self class fromString: self",
  3757. messageSends: ["fromString:", "class"],
  3758. referencedClasses: []
  3759. }),
  3760. smalltalk.String);
  3761. smalltalk.addMethod(
  3762. "_size",
  3763. smalltalk.method({
  3764. selector: "size",
  3765. category: 'accessing',
  3766. fn: function (){
  3767. var self=this;
  3768. return smalltalk.withContext(function($ctx1) {
  3769. return self.length;
  3770. return self}, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.String)})},
  3771. args: [],
  3772. source: "size\x0a\x09<return self.length>",
  3773. messageSends: [],
  3774. referencedClasses: []
  3775. }),
  3776. smalltalk.String);
  3777. smalltalk.addMethod(
  3778. "_tokenize_",
  3779. smalltalk.method({
  3780. selector: "tokenize:",
  3781. category: 'converting',
  3782. fn: function (aString){
  3783. var self=this;
  3784. return smalltalk.withContext(function($ctx1) {
  3785. return self.split(aString);
  3786. return self}, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString}, smalltalk.String)})},
  3787. args: ["aString"],
  3788. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  3789. messageSends: [],
  3790. referencedClasses: []
  3791. }),
  3792. smalltalk.String);
  3793. smalltalk.addMethod(
  3794. "_trimBoth",
  3795. smalltalk.method({
  3796. selector: "trimBoth",
  3797. category: 'regular expressions',
  3798. fn: function (){
  3799. var self=this;
  3800. return smalltalk.withContext(function($ctx1) {
  3801. var $1;
  3802. $1=_st(self)._trimBoth_("\x5cs");
  3803. return $1;
  3804. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{}, smalltalk.String)})},
  3805. args: [],
  3806. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  3807. messageSends: ["trimBoth:"],
  3808. referencedClasses: []
  3809. }),
  3810. smalltalk.String);
  3811. smalltalk.addMethod(
  3812. "_trimBoth_",
  3813. smalltalk.method({
  3814. selector: "trimBoth:",
  3815. category: 'regular expressions',
  3816. fn: function (separators){
  3817. var self=this;
  3818. return smalltalk.withContext(function($ctx1) {
  3819. var $1;
  3820. $1=_st(_st(self)._trimLeft_(separators))._trimRight_(separators);
  3821. return $1;
  3822. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators}, smalltalk.String)})},
  3823. args: ["separators"],
  3824. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  3825. messageSends: ["trimRight:", "trimLeft:"],
  3826. referencedClasses: []
  3827. }),
  3828. smalltalk.String);
  3829. smalltalk.addMethod(
  3830. "_trimLeft",
  3831. smalltalk.method({
  3832. selector: "trimLeft",
  3833. category: 'regular expressions',
  3834. fn: function (){
  3835. var self=this;
  3836. return smalltalk.withContext(function($ctx1) {
  3837. var $1;
  3838. $1=_st(self)._trimLeft_("\x5cs");
  3839. return $1;
  3840. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{}, smalltalk.String)})},
  3841. args: [],
  3842. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  3843. messageSends: ["trimLeft:"],
  3844. referencedClasses: []
  3845. }),
  3846. smalltalk.String);
  3847. smalltalk.addMethod(
  3848. "_trimLeft_",
  3849. smalltalk.method({
  3850. selector: "trimLeft:",
  3851. category: 'regular expressions',
  3852. fn: function (separators){
  3853. var self=this;
  3854. return smalltalk.withContext(function($ctx1) {
  3855. var $1;
  3856. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("^[").__comma(separators)).__comma("]+"),"g"),"");
  3857. return $1;
  3858. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators}, smalltalk.String)})},
  3859. args: ["separators"],
  3860. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  3861. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  3862. referencedClasses: ["RegularExpression"]
  3863. }),
  3864. smalltalk.String);
  3865. smalltalk.addMethod(
  3866. "_trimRight",
  3867. smalltalk.method({
  3868. selector: "trimRight",
  3869. category: 'regular expressions',
  3870. fn: function (){
  3871. var self=this;
  3872. return smalltalk.withContext(function($ctx1) {
  3873. var $1;
  3874. $1=_st(self)._trimRight_("\x5cs");
  3875. return $1;
  3876. }, function($ctx1) {$ctx1.fill(self,"trimRight",{}, smalltalk.String)})},
  3877. args: [],
  3878. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  3879. messageSends: ["trimRight:"],
  3880. referencedClasses: []
  3881. }),
  3882. smalltalk.String);
  3883. smalltalk.addMethod(
  3884. "_trimRight_",
  3885. smalltalk.method({
  3886. selector: "trimRight:",
  3887. category: 'regular expressions',
  3888. fn: function (separators){
  3889. var self=this;
  3890. return smalltalk.withContext(function($ctx1) {
  3891. var $1;
  3892. $1=_st(self)._replaceRegexp_with_(_st((smalltalk.RegularExpression || RegularExpression))._fromString_flag_(_st(_st("[").__comma(separators)).__comma("]+$"),"g"),"");
  3893. return $1;
  3894. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators}, smalltalk.String)})},
  3895. args: ["separators"],
  3896. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  3897. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  3898. referencedClasses: ["RegularExpression"]
  3899. }),
  3900. smalltalk.String);
  3901. smalltalk.addMethod(
  3902. "_unescaped",
  3903. smalltalk.method({
  3904. selector: "unescaped",
  3905. category: 'accessing',
  3906. fn: function (){
  3907. var self=this;
  3908. return smalltalk.withContext(function($ctx1) {
  3909. return unescape(self);
  3910. return self}, function($ctx1) {$ctx1.fill(self,"unescaped",{}, smalltalk.String)})},
  3911. args: [],
  3912. source: "unescaped\x0a\x09<return unescape(self)>",
  3913. messageSends: [],
  3914. referencedClasses: []
  3915. }),
  3916. smalltalk.String);
  3917. smalltalk.addMethod(
  3918. "_withIndexDo_",
  3919. smalltalk.method({
  3920. selector: "withIndexDo:",
  3921. category: 'enumerating',
  3922. fn: function (aBlock){
  3923. var self=this;
  3924. return smalltalk.withContext(function($ctx1) {
  3925. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  3926. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.String)})},
  3927. args: ["aBlock"],
  3928. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  3929. messageSends: [],
  3930. referencedClasses: []
  3931. }),
  3932. smalltalk.String);
  3933. smalltalk.addMethod(
  3934. "_cr",
  3935. smalltalk.method({
  3936. selector: "cr",
  3937. category: 'accessing',
  3938. fn: function (){
  3939. var self=this;
  3940. return smalltalk.withContext(function($ctx1) {
  3941. return '\r';
  3942. return self}, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.String.klass)})},
  3943. args: [],
  3944. source: "cr\x0a\x09<return '\x5cr'>",
  3945. messageSends: [],
  3946. referencedClasses: []
  3947. }),
  3948. smalltalk.String.klass);
  3949. smalltalk.addMethod(
  3950. "_crlf",
  3951. smalltalk.method({
  3952. selector: "crlf",
  3953. category: 'accessing',
  3954. fn: function (){
  3955. var self=this;
  3956. return smalltalk.withContext(function($ctx1) {
  3957. return '\r\n';
  3958. return self}, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.String.klass)})},
  3959. args: [],
  3960. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  3961. messageSends: [],
  3962. referencedClasses: []
  3963. }),
  3964. smalltalk.String.klass);
  3965. smalltalk.addMethod(
  3966. "_fromCharCode_",
  3967. smalltalk.method({
  3968. selector: "fromCharCode:",
  3969. category: 'instance creation',
  3970. fn: function (anInteger){
  3971. var self=this;
  3972. return smalltalk.withContext(function($ctx1) {
  3973. return String.fromCharCode(anInteger);
  3974. return self}, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger}, smalltalk.String.klass)})},
  3975. args: ["anInteger"],
  3976. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  3977. messageSends: [],
  3978. referencedClasses: []
  3979. }),
  3980. smalltalk.String.klass);
  3981. smalltalk.addMethod(
  3982. "_fromString_",
  3983. smalltalk.method({
  3984. selector: "fromString:",
  3985. category: 'instance creation',
  3986. fn: function (aString){
  3987. var self=this;
  3988. return smalltalk.withContext(function($ctx1) {
  3989. return new self.fn(aString);
  3990. return self}, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.String.klass)})},
  3991. args: ["aString"],
  3992. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  3993. messageSends: [],
  3994. referencedClasses: []
  3995. }),
  3996. smalltalk.String.klass);
  3997. smalltalk.addMethod(
  3998. "_lf",
  3999. smalltalk.method({
  4000. selector: "lf",
  4001. category: 'accessing',
  4002. fn: function (){
  4003. var self=this;
  4004. return smalltalk.withContext(function($ctx1) {
  4005. return '\n';
  4006. return self}, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.String.klass)})},
  4007. args: [],
  4008. source: "lf\x0a\x09<return '\x5cn'>",
  4009. messageSends: [],
  4010. referencedClasses: []
  4011. }),
  4012. smalltalk.String.klass);
  4013. smalltalk.addMethod(
  4014. "_space",
  4015. smalltalk.method({
  4016. selector: "space",
  4017. category: 'accessing',
  4018. fn: function (){
  4019. var self=this;
  4020. return smalltalk.withContext(function($ctx1) {
  4021. return ' ';
  4022. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.String.klass)})},
  4023. args: [],
  4024. source: "space\x0a\x09<return ' '>",
  4025. messageSends: [],
  4026. referencedClasses: []
  4027. }),
  4028. smalltalk.String.klass);
  4029. smalltalk.addMethod(
  4030. "_streamClass",
  4031. smalltalk.method({
  4032. selector: "streamClass",
  4033. category: 'accessing',
  4034. fn: function (){
  4035. var self=this;
  4036. return smalltalk.withContext(function($ctx1) {
  4037. var $1;
  4038. $1=(smalltalk.StringStream || StringStream);
  4039. return $1;
  4040. }, function($ctx1) {$ctx1.fill(self,"streamClass",{}, smalltalk.String.klass)})},
  4041. args: [],
  4042. source: "streamClass\x0a\x09 ^StringStream",
  4043. messageSends: [],
  4044. referencedClasses: ["StringStream"]
  4045. }),
  4046. smalltalk.String.klass);
  4047. smalltalk.addMethod(
  4048. "_streamContents_",
  4049. smalltalk.method({
  4050. selector: "streamContents:",
  4051. category: 'instance creation',
  4052. fn: function (blockWithArg){
  4053. var self=this;
  4054. var stream;
  4055. return smalltalk.withContext(function($ctx1) {
  4056. var $1;
  4057. stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
  4058. _st(blockWithArg)._value_(stream);
  4059. $1=_st(stream)._contents();
  4060. return $1;
  4061. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{blockWithArg:blockWithArg,stream:stream}, smalltalk.String.klass)})},
  4062. args: ["blockWithArg"],
  4063. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  4064. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  4065. referencedClasses: ["String"]
  4066. }),
  4067. smalltalk.String.klass);
  4068. smalltalk.addMethod(
  4069. "_tab",
  4070. smalltalk.method({
  4071. selector: "tab",
  4072. category: 'accessing',
  4073. fn: function (){
  4074. var self=this;
  4075. return smalltalk.withContext(function($ctx1) {
  4076. return '\t';
  4077. return self}, function($ctx1) {$ctx1.fill(self,"tab",{}, smalltalk.String.klass)})},
  4078. args: [],
  4079. source: "tab\x0a\x09<return '\x5ct'>",
  4080. messageSends: [],
  4081. referencedClasses: []
  4082. }),
  4083. smalltalk.String.klass);
  4084. smalltalk.addMethod(
  4085. "_value_",
  4086. smalltalk.method({
  4087. selector: "value:",
  4088. category: 'instance creation',
  4089. fn: function (aUTFCharCode){
  4090. var self=this;
  4091. return smalltalk.withContext(function($ctx1) {
  4092. return String.fromCharCode(aUTFCharCode);;
  4093. return self}, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode}, smalltalk.String.klass)})},
  4094. args: ["aUTFCharCode"],
  4095. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  4096. messageSends: [],
  4097. referencedClasses: []
  4098. }),
  4099. smalltalk.String.klass);
  4100. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  4101. smalltalk.addMethod(
  4102. "__lt",
  4103. smalltalk.method({
  4104. selector: "<",
  4105. category: 'comparing',
  4106. fn: function (aSymbol){
  4107. var self=this;
  4108. return smalltalk.withContext(function($ctx1) {
  4109. var $1;
  4110. $1=_st(_st(self)._asString()).__lt(_st(aSymbol)._asString());
  4111. return $1;
  4112. }, function($ctx1) {$ctx1.fill(self,"<",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  4113. args: ["aSymbol"],
  4114. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  4115. messageSends: ["<", "asString"],
  4116. referencedClasses: []
  4117. }),
  4118. smalltalk.Symbol);
  4119. smalltalk.addMethod(
  4120. "__lt_eq",
  4121. smalltalk.method({
  4122. selector: "<=",
  4123. category: 'comparing',
  4124. fn: function (aSymbol){
  4125. var self=this;
  4126. return smalltalk.withContext(function($ctx1) {
  4127. var $1;
  4128. $1=_st(_st(self)._asString()).__lt_eq(_st(aSymbol)._asString());
  4129. return $1;
  4130. }, function($ctx1) {$ctx1.fill(self,"<=",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  4131. args: ["aSymbol"],
  4132. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  4133. messageSends: ["<=", "asString"],
  4134. referencedClasses: []
  4135. }),
  4136. smalltalk.Symbol);
  4137. smalltalk.addMethod(
  4138. "__eq",
  4139. smalltalk.method({
  4140. selector: "=",
  4141. category: 'comparing',
  4142. fn: function (aSymbol){
  4143. var self=this;
  4144. return smalltalk.withContext(function($ctx1) {
  4145. var $1,$2;
  4146. $1=_st(_st(aSymbol)._class()).__eq(_st(self)._class());
  4147. if(! smalltalk.assert($1)){
  4148. return false;
  4149. };
  4150. $2=_st(_st(self)._asString()).__eq(_st(aSymbol)._asString());
  4151. return $2;
  4152. }, function($ctx1) {$ctx1.fill(self,"=",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  4153. args: ["aSymbol"],
  4154. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  4155. messageSends: ["ifFalse:", "=", "class", "asString"],
  4156. referencedClasses: []
  4157. }),
  4158. smalltalk.Symbol);
  4159. smalltalk.addMethod(
  4160. "__gt",
  4161. smalltalk.method({
  4162. selector: ">",
  4163. category: 'comparing',
  4164. fn: function (aSymbol){
  4165. var self=this;
  4166. return smalltalk.withContext(function($ctx1) {
  4167. var $1;
  4168. $1=_st(_st(self)._asString()).__gt(_st(aSymbol)._asString());
  4169. return $1;
  4170. }, function($ctx1) {$ctx1.fill(self,">",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  4171. args: ["aSymbol"],
  4172. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  4173. messageSends: [">", "asString"],
  4174. referencedClasses: []
  4175. }),
  4176. smalltalk.Symbol);
  4177. smalltalk.addMethod(
  4178. "__gt_eq",
  4179. smalltalk.method({
  4180. selector: ">=",
  4181. category: 'comparing',
  4182. fn: function (aSymbol){
  4183. var self=this;
  4184. return smalltalk.withContext(function($ctx1) {
  4185. var $1;
  4186. $1=_st(_st(self)._asString()).__gt_eq(_st(aSymbol)._asString());
  4187. return $1;
  4188. }, function($ctx1) {$ctx1.fill(self,">=",{aSymbol:aSymbol}, smalltalk.Symbol)})},
  4189. args: ["aSymbol"],
  4190. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  4191. messageSends: [">=", "asString"],
  4192. referencedClasses: []
  4193. }),
  4194. smalltalk.Symbol);
  4195. smalltalk.addMethod(
  4196. "_asJSON",
  4197. smalltalk.method({
  4198. selector: "asJSON",
  4199. category: 'converting',
  4200. fn: function (){
  4201. var self=this;
  4202. return smalltalk.withContext(function($ctx1) {
  4203. var $1;
  4204. $1=_st(_st(self)._asString())._asJSON();
  4205. return $1;
  4206. }, function($ctx1) {$ctx1.fill(self,"asJSON",{}, smalltalk.Symbol)})},
  4207. args: [],
  4208. source: "asJSON\x0a\x09^self asString asJSON",
  4209. messageSends: ["asJSON", "asString"],
  4210. referencedClasses: []
  4211. }),
  4212. smalltalk.Symbol);
  4213. smalltalk.addMethod(
  4214. "_asJavascript",
  4215. smalltalk.method({
  4216. selector: "asJavascript",
  4217. category: 'converting',
  4218. fn: function (){
  4219. var self=this;
  4220. return smalltalk.withContext(function($ctx1) {
  4221. var $1;
  4222. $1=_st(_st("smalltalk.symbolFor(").__comma(_st(_st(self)._asString())._asJavascript())).__comma(")");
  4223. return $1;
  4224. }, function($ctx1) {$ctx1.fill(self,"asJavascript",{}, smalltalk.Symbol)})},
  4225. args: [],
  4226. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(', self asString asJavascript, ')'",
  4227. messageSends: [",", "asJavascript", "asString"],
  4228. referencedClasses: []
  4229. }),
  4230. smalltalk.Symbol);
  4231. smalltalk.addMethod(
  4232. "_asSelector",
  4233. smalltalk.method({
  4234. selector: "asSelector",
  4235. category: 'converting',
  4236. fn: function (){
  4237. var self=this;
  4238. return smalltalk.withContext(function($ctx1) {
  4239. var $1;
  4240. $1=_st(_st(self)._asString())._asSelector();
  4241. return $1;
  4242. }, function($ctx1) {$ctx1.fill(self,"asSelector",{}, smalltalk.Symbol)})},
  4243. args: [],
  4244. source: "asSelector\x0a\x09^self asString asSelector",
  4245. messageSends: ["asSelector", "asString"],
  4246. referencedClasses: []
  4247. }),
  4248. smalltalk.Symbol);
  4249. smalltalk.addMethod(
  4250. "_asString",
  4251. smalltalk.method({
  4252. selector: "asString",
  4253. category: 'converting',
  4254. fn: function (){
  4255. var self=this;
  4256. return smalltalk.withContext(function($ctx1) {
  4257. return self.value;
  4258. return self}, function($ctx1) {$ctx1.fill(self,"asString",{}, smalltalk.Symbol)})},
  4259. args: [],
  4260. source: "asString\x0a\x09<return self.value>",
  4261. messageSends: [],
  4262. referencedClasses: []
  4263. }),
  4264. smalltalk.Symbol);
  4265. smalltalk.addMethod(
  4266. "_asSuperSelector",
  4267. smalltalk.method({
  4268. selector: "asSuperSelector",
  4269. category: 'converting',
  4270. fn: function (){
  4271. var self=this;
  4272. return smalltalk.withContext(function($ctx1) {
  4273. var $1;
  4274. $1=_st(_st(self)._asString())._asSuperSelector();
  4275. return $1;
  4276. }, function($ctx1) {$ctx1.fill(self,"asSuperSelector",{}, smalltalk.Symbol)})},
  4277. args: [],
  4278. source: "asSuperSelector\x0a\x09^self asString asSuperSelector",
  4279. messageSends: ["asSuperSelector", "asString"],
  4280. referencedClasses: []
  4281. }),
  4282. smalltalk.Symbol);
  4283. smalltalk.addMethod(
  4284. "_asSymbol",
  4285. smalltalk.method({
  4286. selector: "asSymbol",
  4287. category: 'converting',
  4288. fn: function (){
  4289. var self=this;
  4290. return smalltalk.withContext(function($ctx1) {
  4291. var $1;
  4292. $1=self;
  4293. return $1;
  4294. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{}, smalltalk.Symbol)})},
  4295. args: [],
  4296. source: "asSymbol\x0a\x09^self",
  4297. messageSends: [],
  4298. referencedClasses: []
  4299. }),
  4300. smalltalk.Symbol);
  4301. smalltalk.addMethod(
  4302. "_at_ifAbsent_",
  4303. smalltalk.method({
  4304. selector: "at:ifAbsent:",
  4305. category: 'accessing',
  4306. fn: function (anIndex,aBlock){
  4307. var self=this;
  4308. return smalltalk.withContext(function($ctx1) {
  4309. var $1;
  4310. $1=_st(_st(self)._asString())._at_ifAbsent_(anIndex,aBlock);
  4311. return $1;
  4312. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock}, smalltalk.Symbol)})},
  4313. args: ["anIndex", "aBlock"],
  4314. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  4315. messageSends: ["at:ifAbsent:", "asString"],
  4316. referencedClasses: []
  4317. }),
  4318. smalltalk.Symbol);
  4319. smalltalk.addMethod(
  4320. "_collect_",
  4321. smalltalk.method({
  4322. selector: "collect:",
  4323. category: 'enumerating',
  4324. fn: function (aBlock){
  4325. var self=this;
  4326. return smalltalk.withContext(function($ctx1) {
  4327. var $1;
  4328. $1=_st(_st(_st(self)._asString())._collect_(aBlock))._asSymbol();
  4329. return $1;
  4330. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Symbol)})},
  4331. args: ["aBlock"],
  4332. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  4333. messageSends: ["asSymbol", "collect:", "asString"],
  4334. referencedClasses: []
  4335. }),
  4336. smalltalk.Symbol);
  4337. smalltalk.addMethod(
  4338. "_copyFrom_to_",
  4339. smalltalk.method({
  4340. selector: "copyFrom:to:",
  4341. category: 'copying',
  4342. fn: function (anIndex,anotherIndex){
  4343. var self=this;
  4344. return smalltalk.withContext(function($ctx1) {
  4345. var $1;
  4346. $1=_st(_st(self)._class())._fromString_(_st(_st(self)._asString())._copyFrom_to_(anIndex,anotherIndex));
  4347. return $1;
  4348. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex}, smalltalk.Symbol)})},
  4349. args: ["anIndex", "anotherIndex"],
  4350. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  4351. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  4352. referencedClasses: []
  4353. }),
  4354. smalltalk.Symbol);
  4355. smalltalk.addMethod(
  4356. "_deepCopy",
  4357. smalltalk.method({
  4358. selector: "deepCopy",
  4359. category: 'copying',
  4360. fn: function (){
  4361. var self=this;
  4362. return smalltalk.withContext(function($ctx1) {
  4363. var $1;
  4364. $1=self;
  4365. return $1;
  4366. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{}, smalltalk.Symbol)})},
  4367. args: [],
  4368. source: "deepCopy\x0a\x09^self",
  4369. messageSends: [],
  4370. referencedClasses: []
  4371. }),
  4372. smalltalk.Symbol);
  4373. smalltalk.addMethod(
  4374. "_detect_",
  4375. smalltalk.method({
  4376. selector: "detect:",
  4377. category: 'enumerating',
  4378. fn: function (aBlock){
  4379. var self=this;
  4380. return smalltalk.withContext(function($ctx1) {
  4381. var $1;
  4382. $1=_st(_st(self)._asString())._detect_(aBlock);
  4383. return $1;
  4384. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock}, smalltalk.Symbol)})},
  4385. args: ["aBlock"],
  4386. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  4387. messageSends: ["detect:", "asString"],
  4388. referencedClasses: []
  4389. }),
  4390. smalltalk.Symbol);
  4391. smalltalk.addMethod(
  4392. "_do_",
  4393. smalltalk.method({
  4394. selector: "do:",
  4395. category: 'enumerating',
  4396. fn: function (aBlock){
  4397. var self=this;
  4398. return smalltalk.withContext(function($ctx1) {
  4399. _st(_st(self)._asString())._do_(aBlock);
  4400. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Symbol)})},
  4401. args: ["aBlock"],
  4402. source: "do: aBlock\x0a\x09self asString do: aBlock",
  4403. messageSends: ["do:", "asString"],
  4404. referencedClasses: []
  4405. }),
  4406. smalltalk.Symbol);
  4407. smalltalk.addMethod(
  4408. "_isSymbol",
  4409. smalltalk.method({
  4410. selector: "isSymbol",
  4411. category: 'printing',
  4412. fn: function (){
  4413. var self=this;
  4414. return smalltalk.withContext(function($ctx1) {
  4415. return true;
  4416. }, function($ctx1) {$ctx1.fill(self,"isSymbol",{}, smalltalk.Symbol)})},
  4417. args: [],
  4418. source: "isSymbol\x0a\x09^true",
  4419. messageSends: [],
  4420. referencedClasses: []
  4421. }),
  4422. smalltalk.Symbol);
  4423. smalltalk.addMethod(
  4424. "_printString",
  4425. smalltalk.method({
  4426. selector: "printString",
  4427. category: 'printing',
  4428. fn: function (){
  4429. var self=this;
  4430. return smalltalk.withContext(function($ctx1) {
  4431. var $1;
  4432. $1=_st("#").__comma(_st(self)._asString());
  4433. return $1;
  4434. }, function($ctx1) {$ctx1.fill(self,"printString",{}, smalltalk.Symbol)})},
  4435. args: [],
  4436. source: "printString\x0a\x09^'#', self asString",
  4437. messageSends: [",", "asString"],
  4438. referencedClasses: []
  4439. }),
  4440. smalltalk.Symbol);
  4441. smalltalk.addMethod(
  4442. "_select_",
  4443. smalltalk.method({
  4444. selector: "select:",
  4445. category: 'enumerating',
  4446. fn: function (aBlock){
  4447. var self=this;
  4448. return smalltalk.withContext(function($ctx1) {
  4449. var $1;
  4450. $1=_st(_st(_st(self)._asString())._select_(aBlock))._asSymbol();
  4451. return $1;
  4452. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock}, smalltalk.Symbol)})},
  4453. args: ["aBlock"],
  4454. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  4455. messageSends: ["asSymbol", "select:", "asString"],
  4456. referencedClasses: []
  4457. }),
  4458. smalltalk.Symbol);
  4459. smalltalk.addMethod(
  4460. "_shallowCopy",
  4461. smalltalk.method({
  4462. selector: "shallowCopy",
  4463. category: 'copying',
  4464. fn: function (){
  4465. var self=this;
  4466. return smalltalk.withContext(function($ctx1) {
  4467. var $1;
  4468. $1=self;
  4469. return $1;
  4470. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{}, smalltalk.Symbol)})},
  4471. args: [],
  4472. source: "shallowCopy\x0a\x09^self",
  4473. messageSends: [],
  4474. referencedClasses: []
  4475. }),
  4476. smalltalk.Symbol);
  4477. smalltalk.addMethod(
  4478. "_size",
  4479. smalltalk.method({
  4480. selector: "size",
  4481. category: 'accessing',
  4482. fn: function (){
  4483. var self=this;
  4484. return smalltalk.withContext(function($ctx1) {
  4485. var $1;
  4486. $1=_st(_st(self)._asString())._size();
  4487. return $1;
  4488. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Symbol)})},
  4489. args: [],
  4490. source: "size\x0a\x09^self asString size",
  4491. messageSends: ["size", "asString"],
  4492. referencedClasses: []
  4493. }),
  4494. smalltalk.Symbol);
  4495. smalltalk.addMethod(
  4496. "_value_",
  4497. smalltalk.method({
  4498. selector: "value:",
  4499. category: 'evaluating',
  4500. fn: function (anObject){
  4501. var self=this;
  4502. return smalltalk.withContext(function($ctx1) {
  4503. var $1;
  4504. $1=_st(anObject)._perform_(self);
  4505. return $1;
  4506. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject}, smalltalk.Symbol)})},
  4507. args: ["anObject"],
  4508. source: "value: anObject \x0a\x09^anObject perform: self",
  4509. messageSends: ["perform:"],
  4510. referencedClasses: []
  4511. }),
  4512. smalltalk.Symbol);
  4513. smalltalk.addMethod(
  4514. "_withIndexDo_",
  4515. smalltalk.method({
  4516. selector: "withIndexDo:",
  4517. category: 'enumerating',
  4518. fn: function (aBlock){
  4519. var self=this;
  4520. return smalltalk.withContext(function($ctx1) {
  4521. _st(_st(self)._asString())._withIndexDo_(aBlock);
  4522. return self}, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock}, smalltalk.Symbol)})},
  4523. args: ["aBlock"],
  4524. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  4525. messageSends: ["withIndexDo:", "asString"],
  4526. referencedClasses: []
  4527. }),
  4528. smalltalk.Symbol);
  4529. smalltalk.addMethod(
  4530. "_basicNew",
  4531. smalltalk.method({
  4532. selector: "basicNew",
  4533. category: 'instance creation',
  4534. fn: function (){
  4535. var self=this;
  4536. return smalltalk.withContext(function($ctx1) {
  4537. _st(self)._shouldNotImplement();
  4538. return self}, function($ctx1) {$ctx1.fill(self,"basicNew",{}, smalltalk.Symbol.klass)})},
  4539. args: [],
  4540. source: "basicNew\x0a\x09self shouldNotImplement",
  4541. messageSends: ["shouldNotImplement"],
  4542. referencedClasses: []
  4543. }),
  4544. smalltalk.Symbol.klass);
  4545. smalltalk.addMethod(
  4546. "_fromString_",
  4547. smalltalk.method({
  4548. selector: "fromString:",
  4549. category: 'instance creation',
  4550. fn: function (aString){
  4551. var self=this;
  4552. return smalltalk.withContext(function($ctx1) {
  4553. var $1;
  4554. $1=_st(self)._lookup_(aString);
  4555. return $1;
  4556. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.Symbol.klass)})},
  4557. args: ["aString"],
  4558. source: "fromString: aString\x0a\x09^self lookup: aString",
  4559. messageSends: ["lookup:"],
  4560. referencedClasses: []
  4561. }),
  4562. smalltalk.Symbol.klass);
  4563. smalltalk.addMethod(
  4564. "_lookup_",
  4565. smalltalk.method({
  4566. selector: "lookup:",
  4567. category: 'instance creation',
  4568. fn: function (aString){
  4569. var self=this;
  4570. return smalltalk.withContext(function($ctx1) {
  4571. return smalltalk.symbolFor(aString);;
  4572. return self}, function($ctx1) {$ctx1.fill(self,"lookup:",{aString:aString}, smalltalk.Symbol.klass)})},
  4573. args: ["aString"],
  4574. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  4575. messageSends: [],
  4576. referencedClasses: []
  4577. }),
  4578. smalltalk.Symbol.klass);
  4579. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  4580. smalltalk.addMethod(
  4581. "__eq",
  4582. smalltalk.method({
  4583. selector: "=",
  4584. category: 'comparing',
  4585. fn: function (aCollection){
  4586. var self=this;
  4587. return smalltalk.withContext(function($ctx1) {
  4588. var $1,$2,$3;
  4589. var $early={};
  4590. try {
  4591. $1=_st(_st(self)._class()).__eq(_st(aCollection)._class());
  4592. if(! smalltalk.assert($1)){
  4593. return false;
  4594. };
  4595. $2=_st(_st(self)._size()).__eq(_st(aCollection)._size());
  4596. if(! smalltalk.assert($2)){
  4597. return false;
  4598. };
  4599. _st(self)._do_((function(each){
  4600. return smalltalk.withContext(function($ctx2) {
  4601. $3=_st(aCollection)._includes_(each);
  4602. if(! smalltalk.assert($3)){
  4603. throw $early=[false];
  4604. };
  4605. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4606. return true;
  4607. }
  4608. catch(e) {if(e===$early)return e[0]; throw e}
  4609. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection}, smalltalk.Set)})},
  4610. args: ["aCollection"],
  4611. source: "= aCollection\x0a\x09self class = aCollection class ifFalse: [ ^ false ].\x0a self size = aCollection size ifFalse: [ ^ false ].\x0a\x09self do: [:each | (aCollection includes: each) ifFalse: [ ^ false ] ].\x0a\x09^ true",
  4612. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"],
  4613. referencedClasses: []
  4614. }),
  4615. smalltalk.Set);
  4616. smalltalk.addMethod(
  4617. "_add_",
  4618. smalltalk.method({
  4619. selector: "add:",
  4620. category: 'adding/removing',
  4621. fn: function (anObject){
  4622. var self=this;
  4623. return smalltalk.withContext(function($ctx1) {
  4624. var found;
  4625. for(var i=0; i < self['@elements'].length; i++) {
  4626. if(anObject == self['@elements'][i]) {
  4627. found = true;
  4628. break;
  4629. }
  4630. }
  4631. if(!found) {self['@elements'].push(anObject)}
  4632. ;
  4633. return self}, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject}, smalltalk.Set)})},
  4634. args: ["anObject"],
  4635. source: "add: anObject\x0a\x09<\x0a\x09\x09var found;\x0a\x09\x09for(var i=0; i < self['@elements'].length; i++) {\x0a\x09\x09\x09if(anObject == self['@elements'][i]) {\x0a\x09\x09\x09\x09found = true;\x0a\x09\x09\x09\x09break;\x0a\x09\x09\x09}\x0a\x09\x09}\x0a\x09\x09if(!found) {self['@elements'].push(anObject)}\x0a\x09>",
  4636. messageSends: [],
  4637. referencedClasses: []
  4638. }),
  4639. smalltalk.Set);
  4640. smalltalk.addMethod(
  4641. "_asArray",
  4642. smalltalk.method({
  4643. selector: "asArray",
  4644. category: 'converting',
  4645. fn: function (){
  4646. var self=this;
  4647. return smalltalk.withContext(function($ctx1) {
  4648. var $1;
  4649. $1=_st(self["@elements"])._copy();
  4650. return $1;
  4651. }, function($ctx1) {$ctx1.fill(self,"asArray",{}, smalltalk.Set)})},
  4652. args: [],
  4653. source: "asArray\x0a\x09^elements copy",
  4654. messageSends: ["copy"],
  4655. referencedClasses: []
  4656. }),
  4657. smalltalk.Set);
  4658. smalltalk.addMethod(
  4659. "_collect_",
  4660. smalltalk.method({
  4661. selector: "collect:",
  4662. category: 'enumerating',
  4663. fn: function (aBlock){
  4664. var self=this;
  4665. return smalltalk.withContext(function($ctx1) {
  4666. var $1;
  4667. $1=_st(_st(self)._class())._withAll_(_st(self["@elements"])._collect_(aBlock));
  4668. return $1;
  4669. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock}, smalltalk.Set)})},
  4670. args: ["aBlock"],
  4671. source: "collect: aBlock\x0a\x09^self class withAll: (elements collect: aBlock)",
  4672. messageSends: ["withAll:", "collect:", "class"],
  4673. referencedClasses: []
  4674. }),
  4675. smalltalk.Set);
  4676. smalltalk.addMethod(
  4677. "_detect_ifNone_",
  4678. smalltalk.method({
  4679. selector: "detect:ifNone:",
  4680. category: 'enumerating',
  4681. fn: function (aBlock,anotherBlock){
  4682. var self=this;
  4683. return smalltalk.withContext(function($ctx1) {
  4684. var $1;
  4685. $1=_st(self["@elements"])._detect_ifNone_(aBlock,anotherBlock);
  4686. return $1;
  4687. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock}, smalltalk.Set)})},
  4688. args: ["aBlock", "anotherBlock"],
  4689. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  4690. messageSends: ["detect:ifNone:"],
  4691. referencedClasses: []
  4692. }),
  4693. smalltalk.Set);
  4694. smalltalk.addMethod(
  4695. "_do_",
  4696. smalltalk.method({
  4697. selector: "do:",
  4698. category: 'enumerating',
  4699. fn: function (aBlock){
  4700. var self=this;
  4701. return smalltalk.withContext(function($ctx1) {
  4702. _st(self["@elements"])._do_(aBlock);
  4703. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Set)})},
  4704. args: ["aBlock"],
  4705. source: "do: aBlock\x0a\x09elements do: aBlock",
  4706. messageSends: ["do:"],
  4707. referencedClasses: []
  4708. }),
  4709. smalltalk.Set);
  4710. smalltalk.addMethod(
  4711. "_includes_",
  4712. smalltalk.method({
  4713. selector: "includes:",
  4714. category: 'testing',
  4715. fn: function (anObject){
  4716. var self=this;
  4717. return smalltalk.withContext(function($ctx1) {
  4718. var $1;
  4719. $1=_st(self["@elements"])._includes_(anObject);
  4720. return $1;
  4721. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject}, smalltalk.Set)})},
  4722. args: ["anObject"],
  4723. source: "includes: anObject\x0a\x09^elements includes: anObject",
  4724. messageSends: ["includes:"],
  4725. referencedClasses: []
  4726. }),
  4727. smalltalk.Set);
  4728. smalltalk.addMethod(
  4729. "_initialize",
  4730. smalltalk.method({
  4731. selector: "initialize",
  4732. category: 'initialization',
  4733. fn: function (){
  4734. var self=this;
  4735. return smalltalk.withContext(function($ctx1) {
  4736. smalltalk.Collection.fn.prototype._initialize.apply(_st(self), []);
  4737. self["@elements"]=[];
  4738. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Set)})},
  4739. args: [],
  4740. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  4741. messageSends: ["initialize"],
  4742. referencedClasses: []
  4743. }),
  4744. smalltalk.Set);
  4745. smalltalk.addMethod(
  4746. "_remove_",
  4747. smalltalk.method({
  4748. selector: "remove:",
  4749. category: 'adding/removing',
  4750. fn: function (anObject){
  4751. var self=this;
  4752. return smalltalk.withContext(function($ctx1) {
  4753. _st(self["@elements"])._remove_(anObject);
  4754. return self}, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject}, smalltalk.Set)})},
  4755. args: ["anObject"],
  4756. source: "remove: anObject\x0a\x09elements remove: anObject",
  4757. messageSends: ["remove:"],
  4758. referencedClasses: []
  4759. }),
  4760. smalltalk.Set);
  4761. smalltalk.addMethod(
  4762. "_select_",
  4763. smalltalk.method({
  4764. selector: "select:",
  4765. category: 'enumerating',
  4766. fn: function (aBlock){
  4767. var self=this;
  4768. var collection;
  4769. return smalltalk.withContext(function($ctx1) {
  4770. var $1,$2;
  4771. collection=_st(_st(self)._class())._new();
  4772. _st(self)._do_((function(each){
  4773. return smalltalk.withContext(function($ctx2) {
  4774. $1=_st(aBlock)._value_(each);
  4775. if(smalltalk.assert($1)){
  4776. return _st(collection)._add_(each);
  4777. };
  4778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  4779. $2=collection;
  4780. return $2;
  4781. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection}, smalltalk.Set)})},
  4782. args: ["aBlock"],
  4783. 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",
  4784. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  4785. referencedClasses: []
  4786. }),
  4787. smalltalk.Set);
  4788. smalltalk.addMethod(
  4789. "_size",
  4790. smalltalk.method({
  4791. selector: "size",
  4792. category: 'accessing',
  4793. fn: function (){
  4794. var self=this;
  4795. return smalltalk.withContext(function($ctx1) {
  4796. var $1;
  4797. $1=_st(self["@elements"])._size();
  4798. return $1;
  4799. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Set)})},
  4800. args: [],
  4801. source: "size\x0a\x09^elements size",
  4802. messageSends: ["size"],
  4803. referencedClasses: []
  4804. }),
  4805. smalltalk.Set);
  4806. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  4807. smalltalk.Queue.comment="A Queue am a one-sided queue.\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 the Queue; write appending may do data moving\x0awhen growing `write`, but this is left to engine to implement as good as it chooses to."
  4808. smalltalk.addMethod(
  4809. "_back_",
  4810. smalltalk.method({
  4811. selector: "back:",
  4812. category: 'accessing',
  4813. fn: function (anObject){
  4814. var self=this;
  4815. return smalltalk.withContext(function($ctx1) {
  4816. _st(self["@write"])._add_(anObject);
  4817. return self}, function($ctx1) {$ctx1.fill(self,"back:",{anObject:anObject}, smalltalk.Queue)})},
  4818. args: ["anObject"],
  4819. source: "back: anObject\x0a\x09write add: anObject",
  4820. messageSends: ["add:"],
  4821. referencedClasses: []
  4822. }),
  4823. smalltalk.Queue);
  4824. smalltalk.addMethod(
  4825. "_front",
  4826. smalltalk.method({
  4827. selector: "front",
  4828. category: 'accessing',
  4829. fn: function (){
  4830. var self=this;
  4831. return smalltalk.withContext(function($ctx1) {
  4832. var $1;
  4833. $1=_st(self)._frontIfAbsent_((function(){
  4834. return smalltalk.withContext(function($ctx2) {
  4835. return _st(self)._error_("Cannot read from empty Queue.");
  4836. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4837. return $1;
  4838. }, function($ctx1) {$ctx1.fill(self,"front",{}, smalltalk.Queue)})},
  4839. args: [],
  4840. source: "front\x0a ^self frontIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  4841. messageSends: ["frontIfAbsent:", "error:"],
  4842. referencedClasses: []
  4843. }),
  4844. smalltalk.Queue);
  4845. smalltalk.addMethod(
  4846. "_frontIfAbsent_",
  4847. smalltalk.method({
  4848. selector: "frontIfAbsent:",
  4849. category: 'accessing',
  4850. fn: function (aBlock){
  4851. var self=this;
  4852. var result;
  4853. return smalltalk.withContext(function($ctx1) {
  4854. var $1,$2,$3,$4;
  4855. var $early={};
  4856. try {
  4857. result=_st(self["@read"])._at_ifAbsent_(self["@readIndex"],(function(){
  4858. return smalltalk.withContext(function($ctx2) {
  4859. $1=_st(self["@write"])._isEmpty();
  4860. if(smalltalk.assert($1)){
  4861. $2=_st(self["@readIndex"]).__gt((1));
  4862. if(smalltalk.assert($2)){
  4863. self["@read"]=[];
  4864. self["@read"];
  4865. self["@readIndex"]=(1);
  4866. self["@readIndex"];
  4867. };
  4868. $3=_st(aBlock)._value();
  4869. throw $early=[$3];
  4870. };
  4871. self["@read"]=self["@write"];
  4872. self["@read"];
  4873. self["@readIndex"]=(1);
  4874. self["@readIndex"];
  4875. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  4876. self["@write"];
  4877. return _st(self["@read"])._first();
  4878. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  4879. _st(self["@read"])._at_put_(self["@readIndex"],nil);
  4880. self["@readIndex"]=_st(self["@readIndex"]).__plus((1));
  4881. $4=result;
  4882. return $4;
  4883. }
  4884. catch(e) {if(e===$early)return e[0]; throw e}
  4885. }, function($ctx1) {$ctx1.fill(self,"frontIfAbsent:",{aBlock:aBlock,result:result}, smalltalk.Queue)})},
  4886. args: ["aBlock"],
  4887. source: "frontIfAbsent: 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 \x09read := write.\x0a \x09readIndex := 1.\x0a \x09write := OrderedCollection new.\x0a \x09read first ].\x0a read at: readIndex put: nil.\x0a readIndex := readIndex + 1.\x0a ^result",
  4888. messageSends: ["at:ifAbsent:", "ifTrue:", ">", "value", "isEmpty", "new", "first", "at:put:", "+"],
  4889. referencedClasses: ["OrderedCollection"]
  4890. }),
  4891. smalltalk.Queue);
  4892. smalltalk.addMethod(
  4893. "_initialize",
  4894. smalltalk.method({
  4895. selector: "initialize",
  4896. category: 'initialization',
  4897. fn: function (){
  4898. var self=this;
  4899. return smalltalk.withContext(function($ctx1) {
  4900. smalltalk.Object.fn.prototype._initialize.apply(_st(self), []);
  4901. self["@read"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  4902. self["@write"]=_st((smalltalk.OrderedCollection || OrderedCollection))._new();
  4903. self["@readIndex"]=(1);
  4904. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.Queue)})},
  4905. args: [],
  4906. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a write := OrderedCollection new.\x0a readIndex := 1",
  4907. messageSends: ["initialize", "new"],
  4908. referencedClasses: ["OrderedCollection"]
  4909. }),
  4910. smalltalk.Queue);
  4911. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  4912. smalltalk.addMethod(
  4913. "_compile_",
  4914. smalltalk.method({
  4915. selector: "compile:",
  4916. category: 'evaluating',
  4917. fn: function (aString){
  4918. var self=this;
  4919. return smalltalk.withContext(function($ctx1) {
  4920. return self.compile(aString);
  4921. return self}, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString}, smalltalk.RegularExpression)})},
  4922. args: ["aString"],
  4923. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  4924. messageSends: [],
  4925. referencedClasses: []
  4926. }),
  4927. smalltalk.RegularExpression);
  4928. smalltalk.addMethod(
  4929. "_exec_",
  4930. smalltalk.method({
  4931. selector: "exec:",
  4932. category: 'evaluating',
  4933. fn: function (aString){
  4934. var self=this;
  4935. return smalltalk.withContext(function($ctx1) {
  4936. return self.exec(aString) || nil;
  4937. return self}, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString}, smalltalk.RegularExpression)})},
  4938. args: ["aString"],
  4939. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  4940. messageSends: [],
  4941. referencedClasses: []
  4942. }),
  4943. smalltalk.RegularExpression);
  4944. smalltalk.addMethod(
  4945. "_test_",
  4946. smalltalk.method({
  4947. selector: "test:",
  4948. category: 'evaluating',
  4949. fn: function (aString){
  4950. var self=this;
  4951. return smalltalk.withContext(function($ctx1) {
  4952. return self.test(aString);
  4953. return self}, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString}, smalltalk.RegularExpression)})},
  4954. args: ["aString"],
  4955. source: "test: aString\x0a\x09<return self.test(aString)>",
  4956. messageSends: [],
  4957. referencedClasses: []
  4958. }),
  4959. smalltalk.RegularExpression);
  4960. smalltalk.addMethod(
  4961. "_fromString_",
  4962. smalltalk.method({
  4963. selector: "fromString:",
  4964. category: 'instance creation',
  4965. fn: function (aString){
  4966. var self=this;
  4967. return smalltalk.withContext(function($ctx1) {
  4968. var $1;
  4969. $1=_st(self)._fromString_flag_(aString,"");
  4970. return $1;
  4971. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString}, smalltalk.RegularExpression.klass)})},
  4972. args: ["aString"],
  4973. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  4974. messageSends: ["fromString:flag:"],
  4975. referencedClasses: []
  4976. }),
  4977. smalltalk.RegularExpression.klass);
  4978. smalltalk.addMethod(
  4979. "_fromString_flag_",
  4980. smalltalk.method({
  4981. selector: "fromString:flag:",
  4982. category: 'instance creation',
  4983. fn: function (aString,anotherString){
  4984. var self=this;
  4985. return smalltalk.withContext(function($ctx1) {
  4986. return new RegExp(aString, anotherString);
  4987. return self}, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString}, smalltalk.RegularExpression.klass)})},
  4988. args: ["aString", "anotherString"],
  4989. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  4990. messageSends: [],
  4991. referencedClasses: []
  4992. }),
  4993. smalltalk.RegularExpression.klass);
  4994. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  4995. smalltalk.addMethod(
  4996. "_atEnd",
  4997. smalltalk.method({
  4998. selector: "atEnd",
  4999. category: 'testing',
  5000. fn: function (){
  5001. var self=this;
  5002. return smalltalk.withContext(function($ctx1) {
  5003. var $1;
  5004. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  5005. return $1;
  5006. }, function($ctx1) {$ctx1.fill(self,"atEnd",{}, smalltalk.Stream)})},
  5007. args: [],
  5008. source: "atEnd\x0a\x09^self position = self size",
  5009. messageSends: ["=", "size", "position"],
  5010. referencedClasses: []
  5011. }),
  5012. smalltalk.Stream);
  5013. smalltalk.addMethod(
  5014. "_atStart",
  5015. smalltalk.method({
  5016. selector: "atStart",
  5017. category: 'testing',
  5018. fn: function (){
  5019. var self=this;
  5020. return smalltalk.withContext(function($ctx1) {
  5021. var $1;
  5022. $1=_st(_st(self)._position()).__eq((0));
  5023. return $1;
  5024. }, function($ctx1) {$ctx1.fill(self,"atStart",{}, smalltalk.Stream)})},
  5025. args: [],
  5026. source: "atStart\x0a\x09^self position = 0",
  5027. messageSends: ["=", "position"],
  5028. referencedClasses: []
  5029. }),
  5030. smalltalk.Stream);
  5031. smalltalk.addMethod(
  5032. "_close",
  5033. smalltalk.method({
  5034. selector: "close",
  5035. category: 'actions',
  5036. fn: function (){
  5037. var self=this;
  5038. return smalltalk.withContext(function($ctx1) {
  5039. return self}, function($ctx1) {$ctx1.fill(self,"close",{}, smalltalk.Stream)})},
  5040. args: [],
  5041. source: "close",
  5042. messageSends: [],
  5043. referencedClasses: []
  5044. }),
  5045. smalltalk.Stream);
  5046. smalltalk.addMethod(
  5047. "_collection",
  5048. smalltalk.method({
  5049. selector: "collection",
  5050. category: 'accessing',
  5051. fn: function (){
  5052. var self=this;
  5053. return smalltalk.withContext(function($ctx1) {
  5054. var $1;
  5055. $1=self["@collection"];
  5056. return $1;
  5057. }, function($ctx1) {$ctx1.fill(self,"collection",{}, smalltalk.Stream)})},
  5058. args: [],
  5059. source: "collection\x0a\x09^collection",
  5060. messageSends: [],
  5061. referencedClasses: []
  5062. }),
  5063. smalltalk.Stream);
  5064. smalltalk.addMethod(
  5065. "_contents",
  5066. smalltalk.method({
  5067. selector: "contents",
  5068. category: 'accessing',
  5069. fn: function (){
  5070. var self=this;
  5071. return smalltalk.withContext(function($ctx1) {
  5072. var $1;
  5073. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  5074. return $1;
  5075. }, function($ctx1) {$ctx1.fill(self,"contents",{}, smalltalk.Stream)})},
  5076. args: [],
  5077. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  5078. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  5079. referencedClasses: []
  5080. }),
  5081. smalltalk.Stream);
  5082. smalltalk.addMethod(
  5083. "_do_",
  5084. smalltalk.method({
  5085. selector: "do:",
  5086. category: 'enumerating',
  5087. fn: function (aBlock){
  5088. var self=this;
  5089. return smalltalk.withContext(function($ctx1) {
  5090. _st((function(){
  5091. return smalltalk.withContext(function($ctx2) {
  5092. return _st(self)._atEnd();
  5093. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  5094. return smalltalk.withContext(function($ctx2) {
  5095. return _st(aBlock)._value_(_st(self)._next());
  5096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5097. return self}, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock}, smalltalk.Stream)})},
  5098. args: ["aBlock"],
  5099. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  5100. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  5101. referencedClasses: []
  5102. }),
  5103. smalltalk.Stream);
  5104. smalltalk.addMethod(
  5105. "_flush",
  5106. smalltalk.method({
  5107. selector: "flush",
  5108. category: 'actions',
  5109. fn: function (){
  5110. var self=this;
  5111. return smalltalk.withContext(function($ctx1) {
  5112. return self}, function($ctx1) {$ctx1.fill(self,"flush",{}, smalltalk.Stream)})},
  5113. args: [],
  5114. source: "flush",
  5115. messageSends: [],
  5116. referencedClasses: []
  5117. }),
  5118. smalltalk.Stream);
  5119. smalltalk.addMethod(
  5120. "_isEmpty",
  5121. smalltalk.method({
  5122. selector: "isEmpty",
  5123. category: 'testing',
  5124. fn: function (){
  5125. var self=this;
  5126. return smalltalk.withContext(function($ctx1) {
  5127. var $1;
  5128. $1=_st(_st(self)._size()).__eq((0));
  5129. return $1;
  5130. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{}, smalltalk.Stream)})},
  5131. args: [],
  5132. source: "isEmpty\x0a\x09^self size = 0",
  5133. messageSends: ["=", "size"],
  5134. referencedClasses: []
  5135. }),
  5136. smalltalk.Stream);
  5137. smalltalk.addMethod(
  5138. "_next",
  5139. smalltalk.method({
  5140. selector: "next",
  5141. category: 'reading',
  5142. fn: function (){
  5143. var self=this;
  5144. return smalltalk.withContext(function($ctx1) {
  5145. var $2,$1;
  5146. $2=_st(self)._atEnd();
  5147. if(smalltalk.assert($2)){
  5148. $1=nil;
  5149. } else {
  5150. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  5151. $1=_st(self["@collection"])._at_(_st(self)._position());
  5152. };
  5153. return $1;
  5154. }, function($ctx1) {$ctx1.fill(self,"next",{}, smalltalk.Stream)})},
  5155. args: [],
  5156. 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]",
  5157. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  5158. referencedClasses: []
  5159. }),
  5160. smalltalk.Stream);
  5161. smalltalk.addMethod(
  5162. "_next_",
  5163. smalltalk.method({
  5164. selector: "next:",
  5165. category: 'reading',
  5166. fn: function (anInteger){
  5167. var self=this;
  5168. var tempCollection;
  5169. return smalltalk.withContext(function($ctx1) {
  5170. var $1,$2;
  5171. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  5172. _st(anInteger)._timesRepeat_((function(){
  5173. return smalltalk.withContext(function($ctx2) {
  5174. $1=_st(self)._atEnd();
  5175. if(! smalltalk.assert($1)){
  5176. return _st(tempCollection)._add_(_st(self)._next());
  5177. };
  5178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5179. $2=tempCollection;
  5180. return $2;
  5181. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.Stream)})},
  5182. args: ["anInteger"],
  5183. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection add: self next]].\x0a\x09^tempCollection",
  5184. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  5185. referencedClasses: []
  5186. }),
  5187. smalltalk.Stream);
  5188. smalltalk.addMethod(
  5189. "_nextPut_",
  5190. smalltalk.method({
  5191. selector: "nextPut:",
  5192. category: 'writing',
  5193. fn: function (anObject){
  5194. var self=this;
  5195. return smalltalk.withContext(function($ctx1) {
  5196. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  5197. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  5198. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  5199. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject}, smalltalk.Stream)})},
  5200. args: ["anObject"],
  5201. 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)",
  5202. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  5203. referencedClasses: []
  5204. }),
  5205. smalltalk.Stream);
  5206. smalltalk.addMethod(
  5207. "_nextPutAll_",
  5208. smalltalk.method({
  5209. selector: "nextPutAll:",
  5210. category: 'writing',
  5211. fn: function (aCollection){
  5212. var self=this;
  5213. return smalltalk.withContext(function($ctx1) {
  5214. _st(aCollection)._do_((function(each){
  5215. return smalltalk.withContext(function($ctx2) {
  5216. return _st(self)._nextPut_(each);
  5217. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  5218. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection}, smalltalk.Stream)})},
  5219. args: ["aCollection"],
  5220. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  5221. messageSends: ["do:", "nextPut:"],
  5222. referencedClasses: []
  5223. }),
  5224. smalltalk.Stream);
  5225. smalltalk.addMethod(
  5226. "_peek",
  5227. smalltalk.method({
  5228. selector: "peek",
  5229. category: 'reading',
  5230. fn: function (){
  5231. var self=this;
  5232. return smalltalk.withContext(function($ctx1) {
  5233. var $2,$1;
  5234. $2=_st(self)._atEnd();
  5235. if(! smalltalk.assert($2)){
  5236. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  5237. };
  5238. return $1;
  5239. }, function($ctx1) {$ctx1.fill(self,"peek",{}, smalltalk.Stream)})},
  5240. args: [],
  5241. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  5242. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  5243. referencedClasses: []
  5244. }),
  5245. smalltalk.Stream);
  5246. smalltalk.addMethod(
  5247. "_position",
  5248. smalltalk.method({
  5249. selector: "position",
  5250. category: 'accessing',
  5251. fn: function (){
  5252. var self=this;
  5253. return smalltalk.withContext(function($ctx1) {
  5254. var $2,$1;
  5255. $2=self["@position"];
  5256. if(($receiver = $2) == nil || $receiver == undefined){
  5257. self["@position"]=(0);
  5258. $1=self["@position"];
  5259. } else {
  5260. $1=$2;
  5261. };
  5262. return $1;
  5263. }, function($ctx1) {$ctx1.fill(self,"position",{}, smalltalk.Stream)})},
  5264. args: [],
  5265. source: "position\x0a\x09^position ifNil: [position := 0]",
  5266. messageSends: ["ifNil:"],
  5267. referencedClasses: []
  5268. }),
  5269. smalltalk.Stream);
  5270. smalltalk.addMethod(
  5271. "_position_",
  5272. smalltalk.method({
  5273. selector: "position:",
  5274. category: 'accessing',
  5275. fn: function (anInteger){
  5276. var self=this;
  5277. return smalltalk.withContext(function($ctx1) {
  5278. self["@position"]=anInteger;
  5279. return self}, function($ctx1) {$ctx1.fill(self,"position:",{anInteger:anInteger}, smalltalk.Stream)})},
  5280. args: ["anInteger"],
  5281. source: "position: anInteger\x0a\x09position := anInteger",
  5282. messageSends: [],
  5283. referencedClasses: []
  5284. }),
  5285. smalltalk.Stream);
  5286. smalltalk.addMethod(
  5287. "_reset",
  5288. smalltalk.method({
  5289. selector: "reset",
  5290. category: 'actions',
  5291. fn: function (){
  5292. var self=this;
  5293. return smalltalk.withContext(function($ctx1) {
  5294. _st(self)._position_((0));
  5295. return self}, function($ctx1) {$ctx1.fill(self,"reset",{}, smalltalk.Stream)})},
  5296. args: [],
  5297. source: "reset\x0a\x09self position: 0",
  5298. messageSends: ["position:"],
  5299. referencedClasses: []
  5300. }),
  5301. smalltalk.Stream);
  5302. smalltalk.addMethod(
  5303. "_resetContents",
  5304. smalltalk.method({
  5305. selector: "resetContents",
  5306. category: 'actions',
  5307. fn: function (){
  5308. var self=this;
  5309. return smalltalk.withContext(function($ctx1) {
  5310. _st(self)._reset();
  5311. _st(self)._setStreamSize_((0));
  5312. return self}, function($ctx1) {$ctx1.fill(self,"resetContents",{}, smalltalk.Stream)})},
  5313. args: [],
  5314. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  5315. messageSends: ["reset", "setStreamSize:"],
  5316. referencedClasses: []
  5317. }),
  5318. smalltalk.Stream);
  5319. smalltalk.addMethod(
  5320. "_setCollection_",
  5321. smalltalk.method({
  5322. selector: "setCollection:",
  5323. category: 'accessing',
  5324. fn: function (aCollection){
  5325. var self=this;
  5326. return smalltalk.withContext(function($ctx1) {
  5327. self["@collection"]=aCollection;
  5328. return self}, function($ctx1) {$ctx1.fill(self,"setCollection:",{aCollection:aCollection}, smalltalk.Stream)})},
  5329. args: ["aCollection"],
  5330. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  5331. messageSends: [],
  5332. referencedClasses: []
  5333. }),
  5334. smalltalk.Stream);
  5335. smalltalk.addMethod(
  5336. "_setStreamSize_",
  5337. smalltalk.method({
  5338. selector: "setStreamSize:",
  5339. category: 'accessing',
  5340. fn: function (anInteger){
  5341. var self=this;
  5342. return smalltalk.withContext(function($ctx1) {
  5343. self["@streamSize"]=anInteger;
  5344. return self}, function($ctx1) {$ctx1.fill(self,"setStreamSize:",{anInteger:anInteger}, smalltalk.Stream)})},
  5345. args: ["anInteger"],
  5346. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  5347. messageSends: [],
  5348. referencedClasses: []
  5349. }),
  5350. smalltalk.Stream);
  5351. smalltalk.addMethod(
  5352. "_setToEnd",
  5353. smalltalk.method({
  5354. selector: "setToEnd",
  5355. category: 'positioning',
  5356. fn: function (){
  5357. var self=this;
  5358. return smalltalk.withContext(function($ctx1) {
  5359. _st(self)._position_(_st(self)._size());
  5360. return self}, function($ctx1) {$ctx1.fill(self,"setToEnd",{}, smalltalk.Stream)})},
  5361. args: [],
  5362. source: "setToEnd\x0a\x09self position: self size",
  5363. messageSends: ["position:", "size"],
  5364. referencedClasses: []
  5365. }),
  5366. smalltalk.Stream);
  5367. smalltalk.addMethod(
  5368. "_size",
  5369. smalltalk.method({
  5370. selector: "size",
  5371. category: 'accessing',
  5372. fn: function (){
  5373. var self=this;
  5374. return smalltalk.withContext(function($ctx1) {
  5375. var $1;
  5376. $1=_st(self)._streamSize();
  5377. return $1;
  5378. }, function($ctx1) {$ctx1.fill(self,"size",{}, smalltalk.Stream)})},
  5379. args: [],
  5380. source: "size\x0a\x09^self streamSize",
  5381. messageSends: ["streamSize"],
  5382. referencedClasses: []
  5383. }),
  5384. smalltalk.Stream);
  5385. smalltalk.addMethod(
  5386. "_skip_",
  5387. smalltalk.method({
  5388. selector: "skip:",
  5389. category: 'positioning',
  5390. fn: function (anInteger){
  5391. var self=this;
  5392. return smalltalk.withContext(function($ctx1) {
  5393. _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  5394. return self}, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger}, smalltalk.Stream)})},
  5395. args: ["anInteger"],
  5396. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  5397. messageSends: ["position:", "min:max:", "size", "+", "position"],
  5398. referencedClasses: []
  5399. }),
  5400. smalltalk.Stream);
  5401. smalltalk.addMethod(
  5402. "_streamSize",
  5403. smalltalk.method({
  5404. selector: "streamSize",
  5405. category: 'accessing',
  5406. fn: function (){
  5407. var self=this;
  5408. return smalltalk.withContext(function($ctx1) {
  5409. var $1;
  5410. $1=self["@streamSize"];
  5411. return $1;
  5412. }, function($ctx1) {$ctx1.fill(self,"streamSize",{}, smalltalk.Stream)})},
  5413. args: [],
  5414. source: "streamSize\x0a\x09^streamSize",
  5415. messageSends: [],
  5416. referencedClasses: []
  5417. }),
  5418. smalltalk.Stream);
  5419. smalltalk.addMethod(
  5420. "_on_",
  5421. smalltalk.method({
  5422. selector: "on:",
  5423. category: 'instance creation',
  5424. fn: function (aCollection){
  5425. var self=this;
  5426. return smalltalk.withContext(function($ctx1) {
  5427. var $2,$3,$1;
  5428. $2=_st(self)._new();
  5429. _st($2)._setCollection_(aCollection);
  5430. _st($2)._setStreamSize_(_st(aCollection)._size());
  5431. $3=_st($2)._yourself();
  5432. $1=$3;
  5433. return $1;
  5434. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection}, smalltalk.Stream.klass)})},
  5435. args: ["aCollection"],
  5436. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  5437. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  5438. referencedClasses: []
  5439. }),
  5440. smalltalk.Stream.klass);
  5441. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  5442. smalltalk.addMethod(
  5443. "_cr",
  5444. smalltalk.method({
  5445. selector: "cr",
  5446. category: 'writing',
  5447. fn: function (){
  5448. var self=this;
  5449. return smalltalk.withContext(function($ctx1) {
  5450. var $1;
  5451. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr());
  5452. return $1;
  5453. }, function($ctx1) {$ctx1.fill(self,"cr",{}, smalltalk.StringStream)})},
  5454. args: [],
  5455. source: "cr\x0a\x09^self nextPutAll: String cr",
  5456. messageSends: ["nextPutAll:", "cr"],
  5457. referencedClasses: ["String"]
  5458. }),
  5459. smalltalk.StringStream);
  5460. smalltalk.addMethod(
  5461. "_crlf",
  5462. smalltalk.method({
  5463. selector: "crlf",
  5464. category: 'writing',
  5465. fn: function (){
  5466. var self=this;
  5467. return smalltalk.withContext(function($ctx1) {
  5468. var $1;
  5469. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf());
  5470. return $1;
  5471. }, function($ctx1) {$ctx1.fill(self,"crlf",{}, smalltalk.StringStream)})},
  5472. args: [],
  5473. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  5474. messageSends: ["nextPutAll:", "crlf"],
  5475. referencedClasses: ["String"]
  5476. }),
  5477. smalltalk.StringStream);
  5478. smalltalk.addMethod(
  5479. "_lf",
  5480. smalltalk.method({
  5481. selector: "lf",
  5482. category: 'writing',
  5483. fn: function (){
  5484. var self=this;
  5485. return smalltalk.withContext(function($ctx1) {
  5486. var $1;
  5487. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf());
  5488. return $1;
  5489. }, function($ctx1) {$ctx1.fill(self,"lf",{}, smalltalk.StringStream)})},
  5490. args: [],
  5491. source: "lf\x0a\x09^self nextPutAll: String lf",
  5492. messageSends: ["nextPutAll:", "lf"],
  5493. referencedClasses: ["String"]
  5494. }),
  5495. smalltalk.StringStream);
  5496. smalltalk.addMethod(
  5497. "_next_",
  5498. smalltalk.method({
  5499. selector: "next:",
  5500. category: 'reading',
  5501. fn: function (anInteger){
  5502. var self=this;
  5503. var tempCollection;
  5504. return smalltalk.withContext(function($ctx1) {
  5505. var $1,$2;
  5506. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  5507. _st(anInteger)._timesRepeat_((function(){
  5508. return smalltalk.withContext(function($ctx2) {
  5509. $1=_st(self)._atEnd();
  5510. if(! smalltalk.assert($1)){
  5511. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  5512. return tempCollection;
  5513. };
  5514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  5515. $2=tempCollection;
  5516. return $2;
  5517. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection}, smalltalk.StringStream)})},
  5518. args: ["anInteger"],
  5519. source: "next: anInteger\x0a\x09| tempCollection |\x0a\x09tempCollection := self collection class new.\x0a\x09anInteger timesRepeat: [\x0a\x09 self atEnd ifFalse: [\x0a\x09\x09tempCollection := tempCollection, self next]].\x0a\x09^tempCollection",
  5520. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  5521. referencedClasses: []
  5522. }),
  5523. smalltalk.StringStream);
  5524. smalltalk.addMethod(
  5525. "_nextPut_",
  5526. smalltalk.method({
  5527. selector: "nextPut:",
  5528. category: 'writing',
  5529. fn: function (aString){
  5530. var self=this;
  5531. return smalltalk.withContext(function($ctx1) {
  5532. _st(self)._nextPutAll_(aString);
  5533. return self}, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString}, smalltalk.StringStream)})},
  5534. args: ["aString"],
  5535. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  5536. messageSends: ["nextPutAll:"],
  5537. referencedClasses: []
  5538. }),
  5539. smalltalk.StringStream);
  5540. smalltalk.addMethod(
  5541. "_nextPutAll_",
  5542. smalltalk.method({
  5543. selector: "nextPutAll:",
  5544. category: 'writing',
  5545. fn: function (aString){
  5546. var self=this;
  5547. return smalltalk.withContext(function($ctx1) {
  5548. _st(self)._setCollection_(_st(_st(_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._position())).__comma(aString)).__comma(_st(_st(self)._collection())._copyFrom_to_(_st(_st(_st(self)._position()).__plus((1))).__plus(_st(aString)._size()),_st(_st(self)._collection())._size())));
  5549. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  5550. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  5551. return self}, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString}, smalltalk.StringStream)})},
  5552. args: ["aString"],
  5553. source: "nextPutAll: aString\x0a\x09self setCollection: \x0a\x09 (self collection copyFrom: 1 to: self position),\x0a\x09 aString,\x0a\x09 (self collection copyFrom: (self position + 1 + aString size) to: self collection size).\x0a\x09self position: self position + aString size.\x0a\x09self setStreamSize: (self streamSize max: self position)",
  5554. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  5555. referencedClasses: []
  5556. }),
  5557. smalltalk.StringStream);
  5558. smalltalk.addMethod(
  5559. "_space",
  5560. smalltalk.method({
  5561. selector: "space",
  5562. category: 'writing',
  5563. fn: function (){
  5564. var self=this;
  5565. return smalltalk.withContext(function($ctx1) {
  5566. _st(self)._nextPut_(" ");
  5567. return self}, function($ctx1) {$ctx1.fill(self,"space",{}, smalltalk.StringStream)})},
  5568. args: [],
  5569. source: "space\x0a\x09self nextPut: ' '",
  5570. messageSends: ["nextPut:"],
  5571. referencedClasses: []
  5572. }),
  5573. smalltalk.StringStream);