1
0

Kernel-Collections.js 132 KB

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