Kernel-Collections.js 135 KB

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