1
0

Kernel-Collections.js 134 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292
  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. return smalltalk.selector(self);
  2923. ;
  2924. return self},
  2925. args: [],
  2926. source: "asSelector\x0a\x09<return smalltalk.selector(self)>",
  2927. messageSends: [],
  2928. referencedClasses: []
  2929. }),
  2930. smalltalk.String);
  2931. smalltalk.addMethod(
  2932. "_asString",
  2933. smalltalk.method({
  2934. selector: "asString",
  2935. category: 'converting',
  2936. fn: function (){
  2937. var self=this;
  2938. return self;
  2939. },
  2940. args: [],
  2941. source: "asString\x0a\x09^self",
  2942. messageSends: [],
  2943. referencedClasses: []
  2944. }),
  2945. smalltalk.String);
  2946. smalltalk.addMethod(
  2947. "_asSymbol",
  2948. smalltalk.method({
  2949. selector: "asSymbol",
  2950. category: 'converting',
  2951. fn: function (){
  2952. var self=this;
  2953. var $1;
  2954. $1=smalltalk.send((smalltalk.Symbol || Symbol),"_lookup_",[self]);
  2955. return $1;
  2956. },
  2957. args: [],
  2958. source: "asSymbol\x0a\x09^Symbol lookup: self",
  2959. messageSends: ["lookup:"],
  2960. referencedClasses: ["Symbol"]
  2961. }),
  2962. smalltalk.String);
  2963. smalltalk.addMethod(
  2964. "_asUppercase",
  2965. smalltalk.method({
  2966. selector: "asUppercase",
  2967. category: 'converting',
  2968. fn: function (){
  2969. var self=this;
  2970. return self.toUpperCase();
  2971. ;
  2972. return self},
  2973. args: [],
  2974. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  2975. messageSends: [],
  2976. referencedClasses: []
  2977. }),
  2978. smalltalk.String);
  2979. smalltalk.addMethod(
  2980. "_asciiValue",
  2981. smalltalk.method({
  2982. selector: "asciiValue",
  2983. category: 'accessing',
  2984. fn: function (){
  2985. var self=this;
  2986. return self.charCodeAt(0);;
  2987. ;
  2988. return self},
  2989. args: [],
  2990. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  2991. messageSends: [],
  2992. referencedClasses: []
  2993. }),
  2994. smalltalk.String);
  2995. smalltalk.addMethod(
  2996. "_at_ifAbsent_",
  2997. smalltalk.method({
  2998. selector: "at:ifAbsent:",
  2999. category: 'accessing',
  3000. fn: function (anIndex,aBlock){
  3001. var self=this;
  3002. return String(self).charAt(anIndex - 1) || aBlock();
  3003. ;
  3004. return self},
  3005. args: ["anIndex", "aBlock"],
  3006. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return String(self).charAt(anIndex - 1) || aBlock()>",
  3007. messageSends: [],
  3008. referencedClasses: []
  3009. }),
  3010. smalltalk.String);
  3011. smalltalk.addMethod(
  3012. "_copyFrom_to_",
  3013. smalltalk.method({
  3014. selector: "copyFrom:to:",
  3015. category: 'copying',
  3016. fn: function (anIndex,anotherIndex){
  3017. var self=this;
  3018. return self.substring(anIndex - 1, anotherIndex);
  3019. ;
  3020. return self},
  3021. args: ["anIndex", "anotherIndex"],
  3022. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  3023. messageSends: [],
  3024. referencedClasses: []
  3025. }),
  3026. smalltalk.String);
  3027. smalltalk.addMethod(
  3028. "_deepCopy",
  3029. smalltalk.method({
  3030. selector: "deepCopy",
  3031. category: 'copying',
  3032. fn: function (){
  3033. var self=this;
  3034. var $1;
  3035. $1=smalltalk.send(self,"_shallowCopy",[]);
  3036. return $1;
  3037. },
  3038. args: [],
  3039. source: "deepCopy\x0a\x09^self shallowCopy",
  3040. messageSends: ["shallowCopy"],
  3041. referencedClasses: []
  3042. }),
  3043. smalltalk.String);
  3044. smalltalk.addMethod(
  3045. "_do_",
  3046. smalltalk.method({
  3047. selector: "do:",
  3048. category: 'enumerating',
  3049. fn: function (aBlock){
  3050. var self=this;
  3051. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  3052. ;
  3053. return self},
  3054. args: ["aBlock"],
  3055. source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
  3056. messageSends: [],
  3057. referencedClasses: []
  3058. }),
  3059. smalltalk.String);
  3060. smalltalk.addMethod(
  3061. "_escaped",
  3062. smalltalk.method({
  3063. selector: "escaped",
  3064. category: 'accessing',
  3065. fn: function (){
  3066. var self=this;
  3067. return escape(self);
  3068. ;
  3069. return self},
  3070. args: [],
  3071. source: "escaped\x0a\x09<return escape(self)>",
  3072. messageSends: [],
  3073. referencedClasses: []
  3074. }),
  3075. smalltalk.String);
  3076. smalltalk.addMethod(
  3077. "_includesSubString_",
  3078. smalltalk.method({
  3079. selector: "includesSubString:",
  3080. category: 'testing',
  3081. fn: function (subString){
  3082. var self=this;
  3083. return self.indexOf(subString) != -1 ;
  3084. ;
  3085. return self},
  3086. args: ["subString"],
  3087. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  3088. messageSends: [],
  3089. referencedClasses: []
  3090. }),
  3091. smalltalk.String);
  3092. smalltalk.addMethod(
  3093. "_isString",
  3094. smalltalk.method({
  3095. selector: "isString",
  3096. category: 'testing',
  3097. fn: function (){
  3098. var self=this;
  3099. return true;
  3100. },
  3101. args: [],
  3102. source: "isString\x0a\x09^true",
  3103. messageSends: [],
  3104. referencedClasses: []
  3105. }),
  3106. smalltalk.String);
  3107. smalltalk.addMethod(
  3108. "_join_",
  3109. smalltalk.method({
  3110. selector: "join:",
  3111. category: 'split join',
  3112. fn: function (aCollection){
  3113. var self=this;
  3114. var $1;
  3115. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  3116. return smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  3117. return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(each,"_asString",[])]);
  3118. }),(function(){
  3119. return smalltalk.send(stream,"_nextPutAll_",[self]);
  3120. })]);
  3121. })]);
  3122. return $1;
  3123. },
  3124. args: ["aCollection"],
  3125. 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]]",
  3126. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  3127. referencedClasses: ["String"]
  3128. }),
  3129. smalltalk.String);
  3130. smalltalk.addMethod(
  3131. "_lineIndicesDo_",
  3132. smalltalk.method({
  3133. selector: "lineIndicesDo:",
  3134. category: 'split join',
  3135. fn: function (aBlock){
  3136. var self=this;
  3137. var $1,$2,$3;
  3138. var $early={};
  3139. try {
  3140. var cr;
  3141. var lf;
  3142. var start;
  3143. var sz;
  3144. var nextLF;
  3145. var nextCR;
  3146. start=(1);
  3147. sz=smalltalk.send(self,"_size",[]);
  3148. cr=smalltalk.send((smalltalk.String || String),"_cr",[]);
  3149. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,(1)]);
  3150. lf=smalltalk.send((smalltalk.String || String),"_lf",[]);
  3151. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,(1)]);
  3152. smalltalk.send((function(){
  3153. return smalltalk.send(start,"__lt_eq",[sz]);
  3154. }),"_whileTrue_",[(function(){
  3155. $1=smalltalk.send(smalltalk.send(nextLF,"__eq",[(0)]),"_and_",[(function(){
  3156. return smalltalk.send(nextCR,"__eq",[(0)]);
  3157. })]);
  3158. if(smalltalk.assert($1)){
  3159. smalltalk.send(aBlock,"_value_value_value_",[start,sz,sz]);
  3160. throw $early=[self];
  3161. };
  3162. $2=smalltalk.send(smalltalk.send(nextCR,"__eq",[(0)]),"_or_",[(function(){
  3163. return smalltalk.send(smalltalk.send((0),"__lt",[nextLF]),"_and_",[(function(){
  3164. return smalltalk.send(nextLF,"__lt",[nextCR]);
  3165. })]);
  3166. })]);
  3167. if(smalltalk.assert($2)){
  3168. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextLF,"__minus",[(1)]),nextLF]);
  3169. start=smalltalk.send((1),"__plus",[nextLF]);
  3170. start;
  3171. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  3172. return nextLF;
  3173. } else {
  3174. $3=smalltalk.send(smalltalk.send((1),"__plus",[nextCR]),"__eq",[nextLF]);
  3175. if(smalltalk.assert($3)){
  3176. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextLF]);
  3177. start=smalltalk.send((1),"__plus",[nextLF]);
  3178. start;
  3179. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  3180. nextCR;
  3181. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  3182. return nextLF;
  3183. } else {
  3184. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextCR]);
  3185. start=smalltalk.send((1),"__plus",[nextCR]);
  3186. start;
  3187. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  3188. return nextCR;
  3189. };
  3190. };
  3191. })]);
  3192. return self}
  3193. catch(e) {if(e===$early)return e[0]; throw e}
  3194. },
  3195. args: ["aBlock"],
  3196. 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 ]]]",
  3197. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "ifTrue:", "value:value:value:", "and:", "=", "ifTrue:ifFalse:", "-", "+", "or:", "<", "<="],
  3198. referencedClasses: ["String"]
  3199. }),
  3200. smalltalk.String);
  3201. smalltalk.addMethod(
  3202. "_lineNumber_",
  3203. smalltalk.method({
  3204. selector: "lineNumber:",
  3205. category: 'split join',
  3206. fn: function (anIndex){
  3207. var self=this;
  3208. var $1,$2;
  3209. var $early={};
  3210. try {
  3211. var lineCount;
  3212. lineCount=(0);
  3213. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  3214. lineCount=smalltalk.send(lineCount,"__plus",[(1)]);
  3215. $1=smalltalk.send(lineCount,"__eq",[anIndex]);
  3216. if(smalltalk.assert($1)){
  3217. $2=smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters]);
  3218. throw $early=[$2];
  3219. };
  3220. })]);
  3221. return nil;
  3222. }
  3223. catch(e) {if(e===$early)return e[0]; throw e}
  3224. },
  3225. args: ["anIndex"],
  3226. 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",
  3227. messageSends: ["lineIndicesDo:", "ifTrue:", "copyFrom:to:", "=", "+"],
  3228. referencedClasses: []
  3229. }),
  3230. smalltalk.String);
  3231. smalltalk.addMethod(
  3232. "_lines",
  3233. smalltalk.method({
  3234. selector: "lines",
  3235. category: 'split join',
  3236. fn: function (){
  3237. var self=this;
  3238. var lines;
  3239. lines=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  3240. smalltalk.send(self,"_linesDo_",[(function(aLine){
  3241. return smalltalk.send(lines,"_add_",[aLine]);
  3242. })]);
  3243. return lines;
  3244. },
  3245. args: [],
  3246. 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",
  3247. messageSends: ["new", "linesDo:", "add:"],
  3248. referencedClasses: ["Array"]
  3249. }),
  3250. smalltalk.String);
  3251. smalltalk.addMethod(
  3252. "_linesDo_",
  3253. smalltalk.method({
  3254. selector: "linesDo:",
  3255. category: 'split join',
  3256. fn: function (aBlock){
  3257. var self=this;
  3258. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  3259. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters])]);
  3260. })]);
  3261. return self},
  3262. args: ["aBlock"],
  3263. 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)]",
  3264. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  3265. referencedClasses: []
  3266. }),
  3267. smalltalk.String);
  3268. smalltalk.addMethod(
  3269. "_match_",
  3270. smalltalk.method({
  3271. selector: "match:",
  3272. category: 'regular expressions',
  3273. fn: function (aRegexp){
  3274. var self=this;
  3275. return self.search(aRegexp) != -1;
  3276. ;
  3277. return self},
  3278. args: ["aRegexp"],
  3279. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  3280. messageSends: [],
  3281. referencedClasses: []
  3282. }),
  3283. smalltalk.String);
  3284. smalltalk.addMethod(
  3285. "_matchesOf_",
  3286. smalltalk.method({
  3287. selector: "matchesOf:",
  3288. category: 'regular expressions',
  3289. fn: function (aRegularExpression){
  3290. var self=this;
  3291. return self.match(aRegularExpression);
  3292. ;
  3293. return self},
  3294. args: ["aRegularExpression"],
  3295. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  3296. messageSends: [],
  3297. referencedClasses: []
  3298. }),
  3299. smalltalk.String);
  3300. smalltalk.addMethod(
  3301. "_printNl",
  3302. smalltalk.method({
  3303. selector: "printNl",
  3304. category: 'printing',
  3305. fn: function (){
  3306. var self=this;
  3307. console.log(self);
  3308. ;
  3309. return self},
  3310. args: [],
  3311. source: "printNl\x0a\x09<console.log(self)>",
  3312. messageSends: [],
  3313. referencedClasses: []
  3314. }),
  3315. smalltalk.String);
  3316. smalltalk.addMethod(
  3317. "_printString",
  3318. smalltalk.method({
  3319. selector: "printString",
  3320. category: 'printing',
  3321. fn: function (){
  3322. var self=this;
  3323. var $1;
  3324. $1=smalltalk.send(smalltalk.send("'","__comma",[self]),"__comma",["'"]);
  3325. return $1;
  3326. },
  3327. args: [],
  3328. source: "printString\x0a\x09^'''', self, ''''",
  3329. messageSends: [","],
  3330. referencedClasses: []
  3331. }),
  3332. smalltalk.String);
  3333. smalltalk.addMethod(
  3334. "_replace_with_",
  3335. smalltalk.method({
  3336. selector: "replace:with:",
  3337. category: 'regular expressions',
  3338. fn: function (aString,anotherString){
  3339. var self=this;
  3340. var $1;
  3341. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[aString,"g"]),anotherString]);
  3342. return $1;
  3343. },
  3344. args: ["aString", "anotherString"],
  3345. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  3346. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  3347. referencedClasses: ["RegularExpression"]
  3348. }),
  3349. smalltalk.String);
  3350. smalltalk.addMethod(
  3351. "_replaceRegexp_with_",
  3352. smalltalk.method({
  3353. selector: "replaceRegexp:with:",
  3354. category: 'regular expressions',
  3355. fn: function (aRegexp,aString){
  3356. var self=this;
  3357. return self.replace(aRegexp, aString);
  3358. ;
  3359. return self},
  3360. args: ["aRegexp", "aString"],
  3361. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  3362. messageSends: [],
  3363. referencedClasses: []
  3364. }),
  3365. smalltalk.String);
  3366. smalltalk.addMethod(
  3367. "_reversed",
  3368. smalltalk.method({
  3369. selector: "reversed",
  3370. category: 'converting',
  3371. fn: function (){
  3372. var self=this;
  3373. return self.split("").reverse().join("");
  3374. ;
  3375. return self},
  3376. args: [],
  3377. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  3378. messageSends: [],
  3379. referencedClasses: []
  3380. }),
  3381. smalltalk.String);
  3382. smalltalk.addMethod(
  3383. "_shallowCopy",
  3384. smalltalk.method({
  3385. selector: "shallowCopy",
  3386. category: 'copying',
  3387. fn: function (){
  3388. var self=this;
  3389. var $1;
  3390. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[self]);
  3391. return $1;
  3392. },
  3393. args: [],
  3394. source: "shallowCopy\x0a\x09^self class fromString: self",
  3395. messageSends: ["fromString:", "class"],
  3396. referencedClasses: []
  3397. }),
  3398. smalltalk.String);
  3399. smalltalk.addMethod(
  3400. "_size",
  3401. smalltalk.method({
  3402. selector: "size",
  3403. category: 'accessing',
  3404. fn: function (){
  3405. var self=this;
  3406. return self.length;
  3407. ;
  3408. return self},
  3409. args: [],
  3410. source: "size\x0a\x09<return self.length>",
  3411. messageSends: [],
  3412. referencedClasses: []
  3413. }),
  3414. smalltalk.String);
  3415. smalltalk.addMethod(
  3416. "_tokenize_",
  3417. smalltalk.method({
  3418. selector: "tokenize:",
  3419. category: 'converting',
  3420. fn: function (aString){
  3421. var self=this;
  3422. return self.split(aString);
  3423. ;
  3424. return self},
  3425. args: ["aString"],
  3426. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  3427. messageSends: [],
  3428. referencedClasses: []
  3429. }),
  3430. smalltalk.String);
  3431. smalltalk.addMethod(
  3432. "_trimBoth",
  3433. smalltalk.method({
  3434. selector: "trimBoth",
  3435. category: 'regular expressions',
  3436. fn: function (){
  3437. var self=this;
  3438. var $1;
  3439. $1=smalltalk.send(self,"_trimBoth_",["\x5cs"]);
  3440. return $1;
  3441. },
  3442. args: [],
  3443. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  3444. messageSends: ["trimBoth:"],
  3445. referencedClasses: []
  3446. }),
  3447. smalltalk.String);
  3448. smalltalk.addMethod(
  3449. "_trimBoth_",
  3450. smalltalk.method({
  3451. selector: "trimBoth:",
  3452. category: 'regular expressions',
  3453. fn: function (separators){
  3454. var self=this;
  3455. var $1;
  3456. $1=smalltalk.send(smalltalk.send(self,"_trimLeft_",[separators]),"_trimRight_",[separators]);
  3457. return $1;
  3458. },
  3459. args: ["separators"],
  3460. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  3461. messageSends: ["trimRight:", "trimLeft:"],
  3462. referencedClasses: []
  3463. }),
  3464. smalltalk.String);
  3465. smalltalk.addMethod(
  3466. "_trimLeft",
  3467. smalltalk.method({
  3468. selector: "trimLeft",
  3469. category: 'regular expressions',
  3470. fn: function (){
  3471. var self=this;
  3472. var $1;
  3473. $1=smalltalk.send(self,"_trimLeft_",["\x5cs"]);
  3474. return $1;
  3475. },
  3476. args: [],
  3477. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  3478. messageSends: ["trimLeft:"],
  3479. referencedClasses: []
  3480. }),
  3481. smalltalk.String);
  3482. smalltalk.addMethod(
  3483. "_trimLeft_",
  3484. smalltalk.method({
  3485. selector: "trimLeft:",
  3486. category: 'regular expressions',
  3487. fn: function (separators){
  3488. var self=this;
  3489. var $1;
  3490. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("^[","__comma",[separators]),"__comma",["]+"]),"g"]),""]);
  3491. return $1;
  3492. },
  3493. args: ["separators"],
  3494. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  3495. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  3496. referencedClasses: ["RegularExpression"]
  3497. }),
  3498. smalltalk.String);
  3499. smalltalk.addMethod(
  3500. "_trimRight",
  3501. smalltalk.method({
  3502. selector: "trimRight",
  3503. category: 'regular expressions',
  3504. fn: function (){
  3505. var self=this;
  3506. var $1;
  3507. $1=smalltalk.send(self,"_trimRight_",["\x5cs"]);
  3508. return $1;
  3509. },
  3510. args: [],
  3511. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  3512. messageSends: ["trimRight:"],
  3513. referencedClasses: []
  3514. }),
  3515. smalltalk.String);
  3516. smalltalk.addMethod(
  3517. "_trimRight_",
  3518. smalltalk.method({
  3519. selector: "trimRight:",
  3520. category: 'regular expressions',
  3521. fn: function (separators){
  3522. var self=this;
  3523. var $1;
  3524. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("[","__comma",[separators]),"__comma",["]+$"]),"g"]),""]);
  3525. return $1;
  3526. },
  3527. args: ["separators"],
  3528. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  3529. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  3530. referencedClasses: ["RegularExpression"]
  3531. }),
  3532. smalltalk.String);
  3533. smalltalk.addMethod(
  3534. "_unescaped",
  3535. smalltalk.method({
  3536. selector: "unescaped",
  3537. category: 'accessing',
  3538. fn: function (){
  3539. var self=this;
  3540. return unescape(self);
  3541. ;
  3542. return self},
  3543. args: [],
  3544. source: "unescaped\x0a\x09<return unescape(self)>",
  3545. messageSends: [],
  3546. referencedClasses: []
  3547. }),
  3548. smalltalk.String);
  3549. smalltalk.addMethod(
  3550. "_withIndexDo_",
  3551. smalltalk.method({
  3552. selector: "withIndexDo:",
  3553. category: 'enumerating',
  3554. fn: function (aBlock){
  3555. var self=this;
  3556. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  3557. ;
  3558. return self},
  3559. args: ["aBlock"],
  3560. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);}>",
  3561. messageSends: [],
  3562. referencedClasses: []
  3563. }),
  3564. smalltalk.String);
  3565. smalltalk.addMethod(
  3566. "_cr",
  3567. smalltalk.method({
  3568. selector: "cr",
  3569. category: 'accessing',
  3570. fn: function (){
  3571. var self=this;
  3572. return '\r';
  3573. ;
  3574. return self},
  3575. args: [],
  3576. source: "cr\x0a\x09<return '\x5cr'>",
  3577. messageSends: [],
  3578. referencedClasses: []
  3579. }),
  3580. smalltalk.String.klass);
  3581. smalltalk.addMethod(
  3582. "_crlf",
  3583. smalltalk.method({
  3584. selector: "crlf",
  3585. category: 'accessing',
  3586. fn: function (){
  3587. var self=this;
  3588. return '\r\n';
  3589. ;
  3590. return self},
  3591. args: [],
  3592. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  3593. messageSends: [],
  3594. referencedClasses: []
  3595. }),
  3596. smalltalk.String.klass);
  3597. smalltalk.addMethod(
  3598. "_fromCharCode_",
  3599. smalltalk.method({
  3600. selector: "fromCharCode:",
  3601. category: 'instance creation',
  3602. fn: function (anInteger){
  3603. var self=this;
  3604. return String.fromCharCode(anInteger);
  3605. ;
  3606. return self},
  3607. args: ["anInteger"],
  3608. source: "fromCharCode: anInteger\x0a\x09<return String.fromCharCode(anInteger)>",
  3609. messageSends: [],
  3610. referencedClasses: []
  3611. }),
  3612. smalltalk.String.klass);
  3613. smalltalk.addMethod(
  3614. "_fromString_",
  3615. smalltalk.method({
  3616. selector: "fromString:",
  3617. category: 'instance creation',
  3618. fn: function (aString){
  3619. var self=this;
  3620. return new self.fn(aString);
  3621. ;
  3622. return self},
  3623. args: ["aString"],
  3624. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  3625. messageSends: [],
  3626. referencedClasses: []
  3627. }),
  3628. smalltalk.String.klass);
  3629. smalltalk.addMethod(
  3630. "_lf",
  3631. smalltalk.method({
  3632. selector: "lf",
  3633. category: 'accessing',
  3634. fn: function (){
  3635. var self=this;
  3636. return '\n';
  3637. ;
  3638. return self},
  3639. args: [],
  3640. source: "lf\x0a\x09<return '\x5cn'>",
  3641. messageSends: [],
  3642. referencedClasses: []
  3643. }),
  3644. smalltalk.String.klass);
  3645. smalltalk.addMethod(
  3646. "_space",
  3647. smalltalk.method({
  3648. selector: "space",
  3649. category: 'accessing',
  3650. fn: function (){
  3651. var self=this;
  3652. return ' ';
  3653. ;
  3654. return self},
  3655. args: [],
  3656. source: "space\x0a\x09<return ' '>",
  3657. messageSends: [],
  3658. referencedClasses: []
  3659. }),
  3660. smalltalk.String.klass);
  3661. smalltalk.addMethod(
  3662. "_streamClass",
  3663. smalltalk.method({
  3664. selector: "streamClass",
  3665. category: 'accessing',
  3666. fn: function (){
  3667. var self=this;
  3668. return (smalltalk.StringStream || StringStream);
  3669. },
  3670. args: [],
  3671. source: "streamClass\x0a\x09 ^StringStream",
  3672. messageSends: [],
  3673. referencedClasses: ["StringStream"]
  3674. }),
  3675. smalltalk.String.klass);
  3676. smalltalk.addMethod(
  3677. "_streamContents_",
  3678. smalltalk.method({
  3679. selector: "streamContents:",
  3680. category: 'instance creation',
  3681. fn: function (blockWithArg){
  3682. var self=this;
  3683. var $1;
  3684. var stream;
  3685. stream=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[smalltalk.send((smalltalk.String || String),"_new",[])]);
  3686. smalltalk.send(blockWithArg,"_value_",[stream]);
  3687. $1=smalltalk.send(stream,"_contents",[]);
  3688. return $1;
  3689. },
  3690. args: ["blockWithArg"],
  3691. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  3692. messageSends: ["on:", "new", "streamClass", "value:", "contents"],
  3693. referencedClasses: ["String"]
  3694. }),
  3695. smalltalk.String.klass);
  3696. smalltalk.addMethod(
  3697. "_tab",
  3698. smalltalk.method({
  3699. selector: "tab",
  3700. category: 'accessing',
  3701. fn: function (){
  3702. var self=this;
  3703. return '\t';
  3704. ;
  3705. return self},
  3706. args: [],
  3707. source: "tab\x0a\x09<return '\x5ct'>",
  3708. messageSends: [],
  3709. referencedClasses: []
  3710. }),
  3711. smalltalk.String.klass);
  3712. smalltalk.addMethod(
  3713. "_value_",
  3714. smalltalk.method({
  3715. selector: "value:",
  3716. category: 'instance creation',
  3717. fn: function (aUTFCharCode){
  3718. var self=this;
  3719. return String.fromCharCode(aUTFCharCode);;
  3720. ;
  3721. return self},
  3722. args: ["aUTFCharCode"],
  3723. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  3724. messageSends: [],
  3725. referencedClasses: []
  3726. }),
  3727. smalltalk.String.klass);
  3728. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  3729. smalltalk.addMethod(
  3730. "__lt",
  3731. smalltalk.method({
  3732. selector: "<",
  3733. category: 'comparing',
  3734. fn: function (aSymbol){
  3735. var self=this;
  3736. var $1;
  3737. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt",[smalltalk.send(aSymbol,"_asString",[])]);
  3738. return $1;
  3739. },
  3740. args: ["aSymbol"],
  3741. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  3742. messageSends: ["<", "asString"],
  3743. referencedClasses: []
  3744. }),
  3745. smalltalk.Symbol);
  3746. smalltalk.addMethod(
  3747. "__lt_eq",
  3748. smalltalk.method({
  3749. selector: "<=",
  3750. category: 'comparing',
  3751. fn: function (aSymbol){
  3752. var self=this;
  3753. var $1;
  3754. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  3755. return $1;
  3756. },
  3757. args: ["aSymbol"],
  3758. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  3759. messageSends: ["<=", "asString"],
  3760. referencedClasses: []
  3761. }),
  3762. smalltalk.Symbol);
  3763. smalltalk.addMethod(
  3764. "__eq",
  3765. smalltalk.method({
  3766. selector: "=",
  3767. category: 'comparing',
  3768. fn: function (aSymbol){
  3769. var self=this;
  3770. var $1,$2;
  3771. $1=smalltalk.send(smalltalk.send(aSymbol,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  3772. if(! smalltalk.assert($1)){
  3773. return false;
  3774. };
  3775. $2=smalltalk.send(smalltalk.send(self,"_asString",[]),"__eq",[smalltalk.send(aSymbol,"_asString",[])]);
  3776. return $2;
  3777. },
  3778. args: ["aSymbol"],
  3779. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  3780. messageSends: ["ifFalse:", "=", "class", "asString"],
  3781. referencedClasses: []
  3782. }),
  3783. smalltalk.Symbol);
  3784. smalltalk.addMethod(
  3785. "__gt",
  3786. smalltalk.method({
  3787. selector: ">",
  3788. category: 'comparing',
  3789. fn: function (aSymbol){
  3790. var self=this;
  3791. var $1;
  3792. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt",[smalltalk.send(aSymbol,"_asString",[])]);
  3793. return $1;
  3794. },
  3795. args: ["aSymbol"],
  3796. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  3797. messageSends: [">", "asString"],
  3798. referencedClasses: []
  3799. }),
  3800. smalltalk.Symbol);
  3801. smalltalk.addMethod(
  3802. "__gt_eq",
  3803. smalltalk.method({
  3804. selector: ">=",
  3805. category: 'comparing',
  3806. fn: function (aSymbol){
  3807. var self=this;
  3808. var $1;
  3809. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  3810. return $1;
  3811. },
  3812. args: ["aSymbol"],
  3813. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  3814. messageSends: [">=", "asString"],
  3815. referencedClasses: []
  3816. }),
  3817. smalltalk.Symbol);
  3818. smalltalk.addMethod(
  3819. "_asJSON",
  3820. smalltalk.method({
  3821. selector: "asJSON",
  3822. category: 'converting',
  3823. fn: function (){
  3824. var self=this;
  3825. var $1;
  3826. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asJSON",[]);
  3827. return $1;
  3828. },
  3829. args: [],
  3830. source: "asJSON\x0a\x09^self asString asJSON",
  3831. messageSends: ["asJSON", "asString"],
  3832. referencedClasses: []
  3833. }),
  3834. smalltalk.Symbol);
  3835. smalltalk.addMethod(
  3836. "_asJavascript",
  3837. smalltalk.method({
  3838. selector: "asJavascript",
  3839. category: 'converting',
  3840. fn: function (){
  3841. var self=this;
  3842. var $1;
  3843. $1=smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22","__comma",[smalltalk.send(self,"_asString",[])]),"__comma",["\x22)"]);
  3844. return $1;
  3845. },
  3846. args: [],
  3847. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(\x22', self asString, '\x22)'",
  3848. messageSends: [",", "asString"],
  3849. referencedClasses: []
  3850. }),
  3851. smalltalk.Symbol);
  3852. smalltalk.addMethod(
  3853. "_asSelector",
  3854. smalltalk.method({
  3855. selector: "asSelector",
  3856. category: 'converting',
  3857. fn: function (){
  3858. var self=this;
  3859. var $1;
  3860. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asSelector",[]);
  3861. return $1;
  3862. },
  3863. args: [],
  3864. source: "asSelector\x0a\x09^self asString asSelector",
  3865. messageSends: ["asSelector", "asString"],
  3866. referencedClasses: []
  3867. }),
  3868. smalltalk.Symbol);
  3869. smalltalk.addMethod(
  3870. "_asString",
  3871. smalltalk.method({
  3872. selector: "asString",
  3873. category: 'converting',
  3874. fn: function (){
  3875. var self=this;
  3876. return self.value;
  3877. ;
  3878. return self},
  3879. args: [],
  3880. source: "asString\x0a\x09<return self.value>",
  3881. messageSends: [],
  3882. referencedClasses: []
  3883. }),
  3884. smalltalk.Symbol);
  3885. smalltalk.addMethod(
  3886. "_asSuperSelector",
  3887. smalltalk.method({
  3888. selector: "asSuperSelector",
  3889. category: 'converting',
  3890. fn: function (){
  3891. var self=this;
  3892. var $1;
  3893. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asSuperSelector",[]);
  3894. return $1;
  3895. },
  3896. args: [],
  3897. source: "asSuperSelector\x0a\x09^self asString asSuperSelector",
  3898. messageSends: ["asSuperSelector", "asString"],
  3899. referencedClasses: []
  3900. }),
  3901. smalltalk.Symbol);
  3902. smalltalk.addMethod(
  3903. "_asSymbol",
  3904. smalltalk.method({
  3905. selector: "asSymbol",
  3906. category: 'converting',
  3907. fn: function (){
  3908. var self=this;
  3909. return self;
  3910. },
  3911. args: [],
  3912. source: "asSymbol\x0a\x09^self",
  3913. messageSends: [],
  3914. referencedClasses: []
  3915. }),
  3916. smalltalk.Symbol);
  3917. smalltalk.addMethod(
  3918. "_at_ifAbsent_",
  3919. smalltalk.method({
  3920. selector: "at:ifAbsent:",
  3921. category: 'accessing',
  3922. fn: function (anIndex,aBlock){
  3923. var self=this;
  3924. var $1;
  3925. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_at_ifAbsent_",[anIndex,aBlock]);
  3926. return $1;
  3927. },
  3928. args: ["anIndex", "aBlock"],
  3929. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  3930. messageSends: ["at:ifAbsent:", "asString"],
  3931. referencedClasses: []
  3932. }),
  3933. smalltalk.Symbol);
  3934. smalltalk.addMethod(
  3935. "_collect_",
  3936. smalltalk.method({
  3937. selector: "collect:",
  3938. category: 'enumerating',
  3939. fn: function (aBlock){
  3940. var self=this;
  3941. var $1;
  3942. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_collect_",[aBlock]),"_asSymbol",[]);
  3943. return $1;
  3944. },
  3945. args: ["aBlock"],
  3946. source: "collect: aBlock\x0a\x09^ (self asString collect: aBlock) asSymbol",
  3947. messageSends: ["asSymbol", "collect:", "asString"],
  3948. referencedClasses: []
  3949. }),
  3950. smalltalk.Symbol);
  3951. smalltalk.addMethod(
  3952. "_copyFrom_to_",
  3953. smalltalk.method({
  3954. selector: "copyFrom:to:",
  3955. category: 'copying',
  3956. fn: function (anIndex,anotherIndex){
  3957. var self=this;
  3958. var $1;
  3959. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_copyFrom_to_",[anIndex,anotherIndex])]);
  3960. return $1;
  3961. },
  3962. args: ["anIndex", "anotherIndex"],
  3963. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  3964. messageSends: ["fromString:", "copyFrom:to:", "asString", "class"],
  3965. referencedClasses: []
  3966. }),
  3967. smalltalk.Symbol);
  3968. smalltalk.addMethod(
  3969. "_deepCopy",
  3970. smalltalk.method({
  3971. selector: "deepCopy",
  3972. category: 'copying',
  3973. fn: function (){
  3974. var self=this;
  3975. return self;
  3976. },
  3977. args: [],
  3978. source: "deepCopy\x0a\x09^self",
  3979. messageSends: [],
  3980. referencedClasses: []
  3981. }),
  3982. smalltalk.Symbol);
  3983. smalltalk.addMethod(
  3984. "_detect_",
  3985. smalltalk.method({
  3986. selector: "detect:",
  3987. category: 'enumerating',
  3988. fn: function (aBlock){
  3989. var self=this;
  3990. var $1;
  3991. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_detect_",[aBlock]);
  3992. return $1;
  3993. },
  3994. args: ["aBlock"],
  3995. source: "detect: aBlock\x0a\x09^ self asString detect: aBlock",
  3996. messageSends: ["detect:", "asString"],
  3997. referencedClasses: []
  3998. }),
  3999. smalltalk.Symbol);
  4000. smalltalk.addMethod(
  4001. "_do_",
  4002. smalltalk.method({
  4003. selector: "do:",
  4004. category: 'enumerating',
  4005. fn: function (aBlock){
  4006. var self=this;
  4007. smalltalk.send(smalltalk.send(self,"_asString",[]),"_do_",[aBlock]);
  4008. return self},
  4009. args: ["aBlock"],
  4010. source: "do: aBlock\x0a\x09self asString do: aBlock",
  4011. messageSends: ["do:", "asString"],
  4012. referencedClasses: []
  4013. }),
  4014. smalltalk.Symbol);
  4015. smalltalk.addMethod(
  4016. "_isSymbol",
  4017. smalltalk.method({
  4018. selector: "isSymbol",
  4019. category: 'printing',
  4020. fn: function (){
  4021. var self=this;
  4022. return true;
  4023. },
  4024. args: [],
  4025. source: "isSymbol\x0a\x09^true",
  4026. messageSends: [],
  4027. referencedClasses: []
  4028. }),
  4029. smalltalk.Symbol);
  4030. smalltalk.addMethod(
  4031. "_printString",
  4032. smalltalk.method({
  4033. selector: "printString",
  4034. category: 'printing',
  4035. fn: function (){
  4036. var self=this;
  4037. var $1;
  4038. $1=smalltalk.send("#","__comma",[smalltalk.send(self,"_asString",[])]);
  4039. return $1;
  4040. },
  4041. args: [],
  4042. source: "printString\x0a\x09^'#', self asString",
  4043. messageSends: [",", "asString"],
  4044. referencedClasses: []
  4045. }),
  4046. smalltalk.Symbol);
  4047. smalltalk.addMethod(
  4048. "_select_",
  4049. smalltalk.method({
  4050. selector: "select:",
  4051. category: 'enumerating',
  4052. fn: function (aBlock){
  4053. var self=this;
  4054. var $1;
  4055. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_select_",[aBlock]),"_asSymbol",[]);
  4056. return $1;
  4057. },
  4058. args: ["aBlock"],
  4059. source: "select: aBlock\x0a\x09^ (self asString select: aBlock) asSymbol",
  4060. messageSends: ["asSymbol", "select:", "asString"],
  4061. referencedClasses: []
  4062. }),
  4063. smalltalk.Symbol);
  4064. smalltalk.addMethod(
  4065. "_shallowCopy",
  4066. smalltalk.method({
  4067. selector: "shallowCopy",
  4068. category: 'copying',
  4069. fn: function (){
  4070. var self=this;
  4071. return self;
  4072. },
  4073. args: [],
  4074. source: "shallowCopy\x0a\x09^self",
  4075. messageSends: [],
  4076. referencedClasses: []
  4077. }),
  4078. smalltalk.Symbol);
  4079. smalltalk.addMethod(
  4080. "_size",
  4081. smalltalk.method({
  4082. selector: "size",
  4083. category: 'accessing',
  4084. fn: function (){
  4085. var self=this;
  4086. var $1;
  4087. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_size",[]);
  4088. return $1;
  4089. },
  4090. args: [],
  4091. source: "size\x0a\x09^self asString size",
  4092. messageSends: ["size", "asString"],
  4093. referencedClasses: []
  4094. }),
  4095. smalltalk.Symbol);
  4096. smalltalk.addMethod(
  4097. "_value_",
  4098. smalltalk.method({
  4099. selector: "value:",
  4100. category: 'evaluating',
  4101. fn: function (anObject){
  4102. var self=this;
  4103. var $1;
  4104. $1=smalltalk.send(anObject,"_perform_",[self]);
  4105. return $1;
  4106. },
  4107. args: ["anObject"],
  4108. source: "value: anObject \x0a\x09^anObject perform: self",
  4109. messageSends: ["perform:"],
  4110. referencedClasses: []
  4111. }),
  4112. smalltalk.Symbol);
  4113. smalltalk.addMethod(
  4114. "_withIndexDo_",
  4115. smalltalk.method({
  4116. selector: "withIndexDo:",
  4117. category: 'enumerating',
  4118. fn: function (aBlock){
  4119. var self=this;
  4120. smalltalk.send(smalltalk.send(self,"_asString",[]),"_withIndexDo_",[aBlock]);
  4121. return self},
  4122. args: ["aBlock"],
  4123. source: "withIndexDo: aBlock\x0a\x09self asString withIndexDo: aBlock",
  4124. messageSends: ["withIndexDo:", "asString"],
  4125. referencedClasses: []
  4126. }),
  4127. smalltalk.Symbol);
  4128. smalltalk.addMethod(
  4129. "_basicNew",
  4130. smalltalk.method({
  4131. selector: "basicNew",
  4132. category: 'instance creation',
  4133. fn: function (){
  4134. var self=this;
  4135. smalltalk.send(self,"_shouldNotImplement",[]);
  4136. return self},
  4137. args: [],
  4138. source: "basicNew\x0a\x09self shouldNotImplement",
  4139. messageSends: ["shouldNotImplement"],
  4140. referencedClasses: []
  4141. }),
  4142. smalltalk.Symbol.klass);
  4143. smalltalk.addMethod(
  4144. "_fromString_",
  4145. smalltalk.method({
  4146. selector: "fromString:",
  4147. category: 'instance creation',
  4148. fn: function (aString){
  4149. var self=this;
  4150. var $1;
  4151. $1=smalltalk.send(self,"_lookup_",[aString]);
  4152. return $1;
  4153. },
  4154. args: ["aString"],
  4155. source: "fromString: aString\x0a\x09^self lookup: aString",
  4156. messageSends: ["lookup:"],
  4157. referencedClasses: []
  4158. }),
  4159. smalltalk.Symbol.klass);
  4160. smalltalk.addMethod(
  4161. "_lookup_",
  4162. smalltalk.method({
  4163. selector: "lookup:",
  4164. category: 'instance creation',
  4165. fn: function (aString){
  4166. var self=this;
  4167. return smalltalk.symbolFor(aString);;
  4168. ;
  4169. return self},
  4170. args: ["aString"],
  4171. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  4172. messageSends: [],
  4173. referencedClasses: []
  4174. }),
  4175. smalltalk.Symbol.klass);
  4176. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  4177. smalltalk.addMethod(
  4178. "__eq",
  4179. smalltalk.method({
  4180. selector: "=",
  4181. category: 'comparing',
  4182. fn: function (aCollection){
  4183. var self=this;
  4184. var $1;
  4185. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  4186. return smalltalk.send(self["@elements"],"__eq",[smalltalk.send(aCollection,"_asArray",[])]);
  4187. })]);
  4188. return $1;
  4189. },
  4190. args: ["aCollection"],
  4191. source: "= aCollection\x0a\x09^self class = aCollection class and: [\x0a\x09\x09elements = aCollection asArray]",
  4192. messageSends: ["and:", "=", "asArray", "class"],
  4193. referencedClasses: []
  4194. }),
  4195. smalltalk.Set);
  4196. smalltalk.addMethod(
  4197. "_add_",
  4198. smalltalk.method({
  4199. selector: "add:",
  4200. category: 'adding/removing',
  4201. fn: function (anObject){
  4202. var self=this;
  4203. var found;
  4204. for(var i=0; i < self['@elements'].length; i++) {
  4205. if(anObject == self['@elements'][i]) {
  4206. found = true;
  4207. break;
  4208. }
  4209. }
  4210. if(!found) {self['@elements'].push(anObject)}
  4211. ;
  4212. ;
  4213. return self},
  4214. args: ["anObject"],
  4215. 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>",
  4216. messageSends: [],
  4217. referencedClasses: []
  4218. }),
  4219. smalltalk.Set);
  4220. smalltalk.addMethod(
  4221. "_asArray",
  4222. smalltalk.method({
  4223. selector: "asArray",
  4224. category: 'converting',
  4225. fn: function (){
  4226. var self=this;
  4227. var $1;
  4228. $1=smalltalk.send(self["@elements"],"_copy",[]);
  4229. return $1;
  4230. },
  4231. args: [],
  4232. source: "asArray\x0a\x09^elements copy",
  4233. messageSends: ["copy"],
  4234. referencedClasses: []
  4235. }),
  4236. smalltalk.Set);
  4237. smalltalk.addMethod(
  4238. "_detect_ifNone_",
  4239. smalltalk.method({
  4240. selector: "detect:ifNone:",
  4241. category: 'enumerating',
  4242. fn: function (aBlock,anotherBlock){
  4243. var self=this;
  4244. var $1;
  4245. $1=smalltalk.send(self["@elements"],"_detect_ifNone_",[aBlock,anotherBlock]);
  4246. return $1;
  4247. },
  4248. args: ["aBlock", "anotherBlock"],
  4249. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  4250. messageSends: ["detect:ifNone:"],
  4251. referencedClasses: []
  4252. }),
  4253. smalltalk.Set);
  4254. smalltalk.addMethod(
  4255. "_do_",
  4256. smalltalk.method({
  4257. selector: "do:",
  4258. category: 'enumerating',
  4259. fn: function (aBlock){
  4260. var self=this;
  4261. smalltalk.send(self["@elements"],"_do_",[aBlock]);
  4262. return self},
  4263. args: ["aBlock"],
  4264. source: "do: aBlock\x0a\x09elements do: aBlock",
  4265. messageSends: ["do:"],
  4266. referencedClasses: []
  4267. }),
  4268. smalltalk.Set);
  4269. smalltalk.addMethod(
  4270. "_includes_",
  4271. smalltalk.method({
  4272. selector: "includes:",
  4273. category: 'testing',
  4274. fn: function (anObject){
  4275. var self=this;
  4276. var $1;
  4277. $1=smalltalk.send(self["@elements"],"_includes_",[anObject]);
  4278. return $1;
  4279. },
  4280. args: ["anObject"],
  4281. source: "includes: anObject\x0a\x09^elements includes: anObject",
  4282. messageSends: ["includes:"],
  4283. referencedClasses: []
  4284. }),
  4285. smalltalk.Set);
  4286. smalltalk.addMethod(
  4287. "_initialize",
  4288. smalltalk.method({
  4289. selector: "initialize",
  4290. category: 'initialization',
  4291. fn: function (){
  4292. var self=this;
  4293. smalltalk.send(self,"_initialize",[],smalltalk.Collection);
  4294. self["@elements"]=[];
  4295. return self},
  4296. args: [],
  4297. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  4298. messageSends: ["initialize"],
  4299. referencedClasses: []
  4300. }),
  4301. smalltalk.Set);
  4302. smalltalk.addMethod(
  4303. "_remove_",
  4304. smalltalk.method({
  4305. selector: "remove:",
  4306. category: 'adding/removing',
  4307. fn: function (anObject){
  4308. var self=this;
  4309. smalltalk.send(self["@elements"],"_remove_",[anObject]);
  4310. return self},
  4311. args: ["anObject"],
  4312. source: "remove: anObject\x0a\x09elements remove: anObject",
  4313. messageSends: ["remove:"],
  4314. referencedClasses: []
  4315. }),
  4316. smalltalk.Set);
  4317. smalltalk.addMethod(
  4318. "_select_",
  4319. smalltalk.method({
  4320. selector: "select:",
  4321. category: 'enumerating',
  4322. fn: function (aBlock){
  4323. var self=this;
  4324. var $1;
  4325. var collection;
  4326. collection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  4327. smalltalk.send(self,"_do_",[(function(each){
  4328. $1=smalltalk.send(aBlock,"_value_",[each]);
  4329. if(smalltalk.assert($1)){
  4330. return smalltalk.send(collection,"_add_",[each]);
  4331. };
  4332. })]);
  4333. return collection;
  4334. },
  4335. args: ["aBlock"],
  4336. 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",
  4337. messageSends: ["new", "class", "do:", "ifTrue:", "add:", "value:"],
  4338. referencedClasses: []
  4339. }),
  4340. smalltalk.Set);
  4341. smalltalk.addMethod(
  4342. "_size",
  4343. smalltalk.method({
  4344. selector: "size",
  4345. category: 'accessing',
  4346. fn: function (){
  4347. var self=this;
  4348. var $1;
  4349. $1=smalltalk.send(self["@elements"],"_size",[]);
  4350. return $1;
  4351. },
  4352. args: [],
  4353. source: "size\x0a\x09^elements size",
  4354. messageSends: ["size"],
  4355. referencedClasses: []
  4356. }),
  4357. smalltalk.Set);
  4358. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  4359. smalltalk.addMethod(
  4360. "_compile_",
  4361. smalltalk.method({
  4362. selector: "compile:",
  4363. category: 'evaluating',
  4364. fn: function (aString){
  4365. var self=this;
  4366. return self.compile(aString);
  4367. ;
  4368. return self},
  4369. args: ["aString"],
  4370. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  4371. messageSends: [],
  4372. referencedClasses: []
  4373. }),
  4374. smalltalk.RegularExpression);
  4375. smalltalk.addMethod(
  4376. "_exec_",
  4377. smalltalk.method({
  4378. selector: "exec:",
  4379. category: 'evaluating',
  4380. fn: function (aString){
  4381. var self=this;
  4382. return self.exec(aString) || nil;
  4383. ;
  4384. return self},
  4385. args: ["aString"],
  4386. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  4387. messageSends: [],
  4388. referencedClasses: []
  4389. }),
  4390. smalltalk.RegularExpression);
  4391. smalltalk.addMethod(
  4392. "_test_",
  4393. smalltalk.method({
  4394. selector: "test:",
  4395. category: 'evaluating',
  4396. fn: function (aString){
  4397. var self=this;
  4398. return self.test(aString);
  4399. ;
  4400. return self},
  4401. args: ["aString"],
  4402. source: "test: aString\x0a\x09<return self.test(aString)>",
  4403. messageSends: [],
  4404. referencedClasses: []
  4405. }),
  4406. smalltalk.RegularExpression);
  4407. smalltalk.addMethod(
  4408. "_fromString_",
  4409. smalltalk.method({
  4410. selector: "fromString:",
  4411. category: 'instance creation',
  4412. fn: function (aString){
  4413. var self=this;
  4414. var $1;
  4415. $1=smalltalk.send(self,"_fromString_flag_",[aString,""]);
  4416. return $1;
  4417. },
  4418. args: ["aString"],
  4419. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  4420. messageSends: ["fromString:flag:"],
  4421. referencedClasses: []
  4422. }),
  4423. smalltalk.RegularExpression.klass);
  4424. smalltalk.addMethod(
  4425. "_fromString_flag_",
  4426. smalltalk.method({
  4427. selector: "fromString:flag:",
  4428. category: 'instance creation',
  4429. fn: function (aString,anotherString){
  4430. var self=this;
  4431. return new RegExp(aString, anotherString);
  4432. ;
  4433. return self},
  4434. args: ["aString", "anotherString"],
  4435. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  4436. messageSends: [],
  4437. referencedClasses: []
  4438. }),
  4439. smalltalk.RegularExpression.klass);
  4440. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  4441. smalltalk.addMethod(
  4442. "_atEnd",
  4443. smalltalk.method({
  4444. selector: "atEnd",
  4445. category: 'testing',
  4446. fn: function (){
  4447. var self=this;
  4448. var $1;
  4449. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[smalltalk.send(self,"_size",[])]);
  4450. return $1;
  4451. },
  4452. args: [],
  4453. source: "atEnd\x0a\x09^self position = self size",
  4454. messageSends: ["=", "size", "position"],
  4455. referencedClasses: []
  4456. }),
  4457. smalltalk.Stream);
  4458. smalltalk.addMethod(
  4459. "_atStart",
  4460. smalltalk.method({
  4461. selector: "atStart",
  4462. category: 'testing',
  4463. fn: function (){
  4464. var self=this;
  4465. var $1;
  4466. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[(0)]);
  4467. return $1;
  4468. },
  4469. args: [],
  4470. source: "atStart\x0a\x09^self position = 0",
  4471. messageSends: ["=", "position"],
  4472. referencedClasses: []
  4473. }),
  4474. smalltalk.Stream);
  4475. smalltalk.addMethod(
  4476. "_close",
  4477. smalltalk.method({
  4478. selector: "close",
  4479. category: 'actions',
  4480. fn: function (){
  4481. var self=this;
  4482. return self},
  4483. args: [],
  4484. source: "close",
  4485. messageSends: [],
  4486. referencedClasses: []
  4487. }),
  4488. smalltalk.Stream);
  4489. smalltalk.addMethod(
  4490. "_collection",
  4491. smalltalk.method({
  4492. selector: "collection",
  4493. category: 'accessing',
  4494. fn: function (){
  4495. var self=this;
  4496. return self["@collection"];
  4497. },
  4498. args: [],
  4499. source: "collection\x0a\x09^collection",
  4500. messageSends: [],
  4501. referencedClasses: []
  4502. }),
  4503. smalltalk.Stream);
  4504. smalltalk.addMethod(
  4505. "_contents",
  4506. smalltalk.method({
  4507. selector: "contents",
  4508. category: 'accessing',
  4509. fn: function (){
  4510. var self=this;
  4511. var $1;
  4512. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[(1),smalltalk.send(self,"_streamSize",[])]);
  4513. return $1;
  4514. },
  4515. args: [],
  4516. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  4517. messageSends: ["copyFrom:to:", "streamSize", "collection"],
  4518. referencedClasses: []
  4519. }),
  4520. smalltalk.Stream);
  4521. smalltalk.addMethod(
  4522. "_do_",
  4523. smalltalk.method({
  4524. selector: "do:",
  4525. category: 'enumerating',
  4526. fn: function (aBlock){
  4527. var self=this;
  4528. smalltalk.send((function(){
  4529. return smalltalk.send(self,"_atEnd",[]);
  4530. }),"_whileFalse_",[(function(){
  4531. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_next",[])]);
  4532. })]);
  4533. return self},
  4534. args: ["aBlock"],
  4535. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  4536. messageSends: ["whileFalse:", "value:", "next", "atEnd"],
  4537. referencedClasses: []
  4538. }),
  4539. smalltalk.Stream);
  4540. smalltalk.addMethod(
  4541. "_flush",
  4542. smalltalk.method({
  4543. selector: "flush",
  4544. category: 'actions',
  4545. fn: function (){
  4546. var self=this;
  4547. return self},
  4548. args: [],
  4549. source: "flush",
  4550. messageSends: [],
  4551. referencedClasses: []
  4552. }),
  4553. smalltalk.Stream);
  4554. smalltalk.addMethod(
  4555. "_isEmpty",
  4556. smalltalk.method({
  4557. selector: "isEmpty",
  4558. category: 'testing',
  4559. fn: function (){
  4560. var self=this;
  4561. var $1;
  4562. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  4563. return $1;
  4564. },
  4565. args: [],
  4566. source: "isEmpty\x0a\x09^self size = 0",
  4567. messageSends: ["=", "size"],
  4568. referencedClasses: []
  4569. }),
  4570. smalltalk.Stream);
  4571. smalltalk.addMethod(
  4572. "_next",
  4573. smalltalk.method({
  4574. selector: "next",
  4575. category: 'reading',
  4576. fn: function (){
  4577. var self=this;
  4578. var $2,$1;
  4579. $2=smalltalk.send(self,"_atEnd",[]);
  4580. if(smalltalk.assert($2)){
  4581. $1=nil;
  4582. } else {
  4583. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  4584. $1=smalltalk.send(self["@collection"],"_at_",[smalltalk.send(self,"_position",[])]);
  4585. };
  4586. return $1;
  4587. },
  4588. args: [],
  4589. 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]",
  4590. messageSends: ["ifTrue:ifFalse:", "position:", "+", "position", "at:", "atEnd"],
  4591. referencedClasses: []
  4592. }),
  4593. smalltalk.Stream);
  4594. smalltalk.addMethod(
  4595. "_next_",
  4596. smalltalk.method({
  4597. selector: "next:",
  4598. category: 'reading',
  4599. fn: function (anInteger){
  4600. var self=this;
  4601. var $1;
  4602. var tempCollection;
  4603. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  4604. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  4605. $1=smalltalk.send(self,"_atEnd",[]);
  4606. if(! smalltalk.assert($1)){
  4607. return smalltalk.send(tempCollection,"_add_",[smalltalk.send(self,"_next",[])]);
  4608. };
  4609. })]);
  4610. return tempCollection;
  4611. },
  4612. args: ["anInteger"],
  4613. 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",
  4614. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "add:", "next", "atEnd"],
  4615. referencedClasses: []
  4616. }),
  4617. smalltalk.Stream);
  4618. smalltalk.addMethod(
  4619. "_nextPut_",
  4620. smalltalk.method({
  4621. selector: "nextPut:",
  4622. category: 'writing',
  4623. fn: function (anObject){
  4624. var self=this;
  4625. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  4626. smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_put_",[smalltalk.send(self,"_position",[]),anObject]);
  4627. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  4628. return self},
  4629. args: ["anObject"],
  4630. 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)",
  4631. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  4632. referencedClasses: []
  4633. }),
  4634. smalltalk.Stream);
  4635. smalltalk.addMethod(
  4636. "_nextPutAll_",
  4637. smalltalk.method({
  4638. selector: "nextPutAll:",
  4639. category: 'writing',
  4640. fn: function (aCollection){
  4641. var self=this;
  4642. smalltalk.send(aCollection,"_do_",[(function(each){
  4643. return smalltalk.send(self,"_nextPut_",[each]);
  4644. })]);
  4645. return self},
  4646. args: ["aCollection"],
  4647. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  4648. messageSends: ["do:", "nextPut:"],
  4649. referencedClasses: []
  4650. }),
  4651. smalltalk.Stream);
  4652. smalltalk.addMethod(
  4653. "_peek",
  4654. smalltalk.method({
  4655. selector: "peek",
  4656. category: 'reading',
  4657. fn: function (){
  4658. var self=this;
  4659. var $2,$1;
  4660. $2=smalltalk.send(self,"_atEnd",[]);
  4661. if(! smalltalk.assert($2)){
  4662. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  4663. };
  4664. return $1;
  4665. },
  4666. args: [],
  4667. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  4668. messageSends: ["ifFalse:", "at:", "+", "position", "collection", "atEnd"],
  4669. referencedClasses: []
  4670. }),
  4671. smalltalk.Stream);
  4672. smalltalk.addMethod(
  4673. "_position",
  4674. smalltalk.method({
  4675. selector: "position",
  4676. category: 'accessing',
  4677. fn: function (){
  4678. var self=this;
  4679. var $1;
  4680. if(($receiver = self["@position"]) == nil || $receiver == undefined){
  4681. self["@position"]=(0);
  4682. $1=self["@position"];
  4683. } else {
  4684. $1=self["@position"];
  4685. };
  4686. return $1;
  4687. },
  4688. args: [],
  4689. source: "position\x0a\x09^position ifNil: [position := 0]",
  4690. messageSends: ["ifNil:"],
  4691. referencedClasses: []
  4692. }),
  4693. smalltalk.Stream);
  4694. smalltalk.addMethod(
  4695. "_position_",
  4696. smalltalk.method({
  4697. selector: "position:",
  4698. category: 'accessing',
  4699. fn: function (anInteger){
  4700. var self=this;
  4701. self["@position"]=anInteger;
  4702. return self},
  4703. args: ["anInteger"],
  4704. source: "position: anInteger\x0a\x09position := anInteger",
  4705. messageSends: [],
  4706. referencedClasses: []
  4707. }),
  4708. smalltalk.Stream);
  4709. smalltalk.addMethod(
  4710. "_reset",
  4711. smalltalk.method({
  4712. selector: "reset",
  4713. category: 'actions',
  4714. fn: function (){
  4715. var self=this;
  4716. smalltalk.send(self,"_position_",[(0)]);
  4717. return self},
  4718. args: [],
  4719. source: "reset\x0a\x09self position: 0",
  4720. messageSends: ["position:"],
  4721. referencedClasses: []
  4722. }),
  4723. smalltalk.Stream);
  4724. smalltalk.addMethod(
  4725. "_resetContents",
  4726. smalltalk.method({
  4727. selector: "resetContents",
  4728. category: 'actions',
  4729. fn: function (){
  4730. var self=this;
  4731. smalltalk.send(self,"_reset",[]);
  4732. smalltalk.send(self,"_setStreamSize_",[(0)]);
  4733. return self},
  4734. args: [],
  4735. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  4736. messageSends: ["reset", "setStreamSize:"],
  4737. referencedClasses: []
  4738. }),
  4739. smalltalk.Stream);
  4740. smalltalk.addMethod(
  4741. "_setCollection_",
  4742. smalltalk.method({
  4743. selector: "setCollection:",
  4744. category: 'accessing',
  4745. fn: function (aCollection){
  4746. var self=this;
  4747. self["@collection"]=aCollection;
  4748. return self},
  4749. args: ["aCollection"],
  4750. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  4751. messageSends: [],
  4752. referencedClasses: []
  4753. }),
  4754. smalltalk.Stream);
  4755. smalltalk.addMethod(
  4756. "_setStreamSize_",
  4757. smalltalk.method({
  4758. selector: "setStreamSize:",
  4759. category: 'accessing',
  4760. fn: function (anInteger){
  4761. var self=this;
  4762. self["@streamSize"]=anInteger;
  4763. return self},
  4764. args: ["anInteger"],
  4765. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  4766. messageSends: [],
  4767. referencedClasses: []
  4768. }),
  4769. smalltalk.Stream);
  4770. smalltalk.addMethod(
  4771. "_setToEnd",
  4772. smalltalk.method({
  4773. selector: "setToEnd",
  4774. category: 'positioning',
  4775. fn: function (){
  4776. var self=this;
  4777. smalltalk.send(self,"_position_",[smalltalk.send(self,"_size",[])]);
  4778. return self},
  4779. args: [],
  4780. source: "setToEnd\x0a\x09self position: self size",
  4781. messageSends: ["position:", "size"],
  4782. referencedClasses: []
  4783. }),
  4784. smalltalk.Stream);
  4785. smalltalk.addMethod(
  4786. "_size",
  4787. smalltalk.method({
  4788. selector: "size",
  4789. category: 'accessing',
  4790. fn: function (){
  4791. var self=this;
  4792. var $1;
  4793. $1=smalltalk.send(self,"_streamSize",[]);
  4794. return $1;
  4795. },
  4796. args: [],
  4797. source: "size\x0a\x09^self streamSize",
  4798. messageSends: ["streamSize"],
  4799. referencedClasses: []
  4800. }),
  4801. smalltalk.Stream);
  4802. smalltalk.addMethod(
  4803. "_skip_",
  4804. smalltalk.method({
  4805. selector: "skip:",
  4806. category: 'positioning',
  4807. fn: function (anInteger){
  4808. var self=this;
  4809. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[anInteger]),"_min_max_",[smalltalk.send(self,"_size",[]),(0)])]);
  4810. return self},
  4811. args: ["anInteger"],
  4812. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  4813. messageSends: ["position:", "min:max:", "size", "+", "position"],
  4814. referencedClasses: []
  4815. }),
  4816. smalltalk.Stream);
  4817. smalltalk.addMethod(
  4818. "_streamSize",
  4819. smalltalk.method({
  4820. selector: "streamSize",
  4821. category: 'accessing',
  4822. fn: function (){
  4823. var self=this;
  4824. return self["@streamSize"];
  4825. },
  4826. args: [],
  4827. source: "streamSize\x0a\x09^streamSize",
  4828. messageSends: [],
  4829. referencedClasses: []
  4830. }),
  4831. smalltalk.Stream);
  4832. smalltalk.addMethod(
  4833. "_on_",
  4834. smalltalk.method({
  4835. selector: "on:",
  4836. category: 'instance creation',
  4837. fn: function (aCollection){
  4838. var self=this;
  4839. var $2,$3,$1;
  4840. $2=smalltalk.send(self,"_new",[]);
  4841. smalltalk.send($2,"_setCollection_",[aCollection]);
  4842. smalltalk.send($2,"_setStreamSize_",[smalltalk.send(aCollection,"_size",[])]);
  4843. $3=smalltalk.send($2,"_yourself",[]);
  4844. $1=$3;
  4845. return $1;
  4846. },
  4847. args: ["aCollection"],
  4848. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  4849. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"],
  4850. referencedClasses: []
  4851. }),
  4852. smalltalk.Stream.klass);
  4853. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  4854. smalltalk.addMethod(
  4855. "_cr",
  4856. smalltalk.method({
  4857. selector: "cr",
  4858. category: 'writing',
  4859. fn: function (){
  4860. var self=this;
  4861. var $1;
  4862. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  4863. return $1;
  4864. },
  4865. args: [],
  4866. source: "cr\x0a\x09^self nextPutAll: String cr",
  4867. messageSends: ["nextPutAll:", "cr"],
  4868. referencedClasses: ["String"]
  4869. }),
  4870. smalltalk.StringStream);
  4871. smalltalk.addMethod(
  4872. "_crlf",
  4873. smalltalk.method({
  4874. selector: "crlf",
  4875. category: 'writing',
  4876. fn: function (){
  4877. var self=this;
  4878. var $1;
  4879. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_crlf",[])]);
  4880. return $1;
  4881. },
  4882. args: [],
  4883. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  4884. messageSends: ["nextPutAll:", "crlf"],
  4885. referencedClasses: ["String"]
  4886. }),
  4887. smalltalk.StringStream);
  4888. smalltalk.addMethod(
  4889. "_lf",
  4890. smalltalk.method({
  4891. selector: "lf",
  4892. category: 'writing',
  4893. fn: function (){
  4894. var self=this;
  4895. var $1;
  4896. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_lf",[])]);
  4897. return $1;
  4898. },
  4899. args: [],
  4900. source: "lf\x0a\x09^self nextPutAll: String lf",
  4901. messageSends: ["nextPutAll:", "lf"],
  4902. referencedClasses: ["String"]
  4903. }),
  4904. smalltalk.StringStream);
  4905. smalltalk.addMethod(
  4906. "_next_",
  4907. smalltalk.method({
  4908. selector: "next:",
  4909. category: 'reading',
  4910. fn: function (anInteger){
  4911. var self=this;
  4912. var $1;
  4913. var tempCollection;
  4914. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  4915. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  4916. $1=smalltalk.send(self,"_atEnd",[]);
  4917. if(! smalltalk.assert($1)){
  4918. tempCollection=smalltalk.send(tempCollection,"__comma",[smalltalk.send(self,"_next",[])]);
  4919. return tempCollection;
  4920. };
  4921. })]);
  4922. return tempCollection;
  4923. },
  4924. args: ["anInteger"],
  4925. 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",
  4926. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", ",", "next", "atEnd"],
  4927. referencedClasses: []
  4928. }),
  4929. smalltalk.StringStream);
  4930. smalltalk.addMethod(
  4931. "_nextPut_",
  4932. smalltalk.method({
  4933. selector: "nextPut:",
  4934. category: 'writing',
  4935. fn: function (aString){
  4936. var self=this;
  4937. smalltalk.send(self,"_nextPutAll_",[aString]);
  4938. return self},
  4939. args: ["aString"],
  4940. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  4941. messageSends: ["nextPutAll:"],
  4942. referencedClasses: []
  4943. }),
  4944. smalltalk.StringStream);
  4945. smalltalk.addMethod(
  4946. "_nextPutAll_",
  4947. smalltalk.method({
  4948. selector: "nextPutAll:",
  4949. category: 'writing',
  4950. fn: function (aString){
  4951. var self=this;
  4952. 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",[])])])]);
  4953. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[smalltalk.send(aString,"_size",[])])]);
  4954. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  4955. return self},
  4956. args: ["aString"],
  4957. 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)",
  4958. messageSends: ["setCollection:", ",", "copyFrom:to:", "+", "size", "position", "collection", "position:", "setStreamSize:", "max:", "streamSize"],
  4959. referencedClasses: []
  4960. }),
  4961. smalltalk.StringStream);
  4962. smalltalk.addMethod(
  4963. "_space",
  4964. smalltalk.method({
  4965. selector: "space",
  4966. category: 'writing',
  4967. fn: function (){
  4968. var self=this;
  4969. smalltalk.send(self,"_nextPut_",[" "]);
  4970. return self},
  4971. args: [],
  4972. source: "space\x0a\x09self nextPut: ' '",
  4973. messageSends: ["nextPut:"],
  4974. referencedClasses: []
  4975. }),
  4976. smalltalk.StringStream);