2
0

Kernel-Collections.js 139 KB

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