2
0

Kernel-Collections.js 137 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414
  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=function(){return false}})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=function(){return false}})();})]));
  713. ((($receiver = smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [smalltalk.send(aHashedCollection, "_size", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=function(){return false}})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=function(){return 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(); 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.Collection);
  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.Collection)]);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^String streamContents: [:aStream| \x0a\x09\x09aStream \x0a\x09\x09\x09nextPutAll: super printString;\x0a\x09\x09\x09nextPutAll: '('.\x0a\x09\x09\x09\x09self associations \x0a\x09\x09\x09\x09\x09do: [:anAssociation| \x0a\x09\x09\x09\x09\x09\x09aStream \x0a\x09\x09\x09\x09\x09\x09\x09nextPutAll: anAssociation key printString;\x0a\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: ' -> ';\x0a\x09\x09\x09\x09\x09\x09\x09\x09nextPutAll: anAssociation value printString]\x0a\x09\x09\x09\x09\x09\x09\x09separatedBy: [aStream nextPutAll: ' , '].\x0a\x09\x09\x09\x09\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.HashedCollection);
  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=function(){return false}})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=function(){return 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=function(){return false}})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=function(){return false}})();})]));})]);
  1395. return true;
  1396. return self;
  1397. } catch(e) {if(e===$early)return e(); 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. var str=nil;
  1683. (str=smalltalk.send("", "_writeStream", []));
  1684. smalltalk.send(str, "_nextPutAll_", [smalltalk.send(smalltalk.send(self, "_printString", [], smalltalk.Collection), "__comma", [" ("])]);
  1685. smalltalk.send(self, "_do_separatedBy_", [(function(each){return smalltalk.send(str, "_nextPutAll_", [smalltalk.send(each, "_printString", [])]);}), (function(){return smalltalk.send(str, "_nextPutAll_", [" "]);})]);
  1686. smalltalk.send(str, "_nextPutAll_", [")"]);
  1687. return smalltalk.send(str, "_contents", []);
  1688. return self;},
  1689. args: [],
  1690. source: "printString\x0a\x09| str |\x0a\x09str := '' writeStream.\x0a\x09str nextPutAll: super printString, ' ('.\x0a\x09self \x0a\x09\x09do: [:each | str nextPutAll: each printString]\x0a\x09\x09separatedBy: [str nextPutAll: ' '].\x0a\x09str nextPutAll: ')'.\x0a\x09^str contents",
  1691. messageSends: ["writeStream", "nextPutAll:", ",", "printString", "do:separatedBy:", "contents"],
  1692. referencedClasses: []
  1693. }),
  1694. smalltalk.SequenceableCollection);
  1695. smalltalk.addMethod(
  1696. "_removeLast",
  1697. smalltalk.method({
  1698. selector: "removeLast",
  1699. category: 'adding',
  1700. fn: function () {
  1701. var self=this;
  1702. smalltalk.send(self, "_remove_", [smalltalk.send(self, "_last", [])]);
  1703. return self;},
  1704. args: [],
  1705. source: "removeLast\x0a\x09self remove: self last",
  1706. messageSends: ["remove:", "last"],
  1707. referencedClasses: []
  1708. }),
  1709. smalltalk.SequenceableCollection);
  1710. smalltalk.addMethod(
  1711. "_reversed",
  1712. smalltalk.method({
  1713. selector: "reversed",
  1714. category: 'converting',
  1715. fn: function () {
  1716. var self=this;
  1717. smalltalk.send(self, "_subclassResponsibility", []);
  1718. return self;},
  1719. args: [],
  1720. source: "reversed\x0a\x09self subclassResponsibility",
  1721. messageSends: ["subclassResponsibility"],
  1722. referencedClasses: []
  1723. }),
  1724. smalltalk.SequenceableCollection);
  1725. smalltalk.addMethod(
  1726. "_second",
  1727. smalltalk.method({
  1728. selector: "second",
  1729. category: 'accessing',
  1730. fn: function () {
  1731. var self=this;
  1732. return smalltalk.send(self, "_at_", [(2)]);
  1733. return self;},
  1734. args: [],
  1735. source: "second\x0a\x09^self at: 2",
  1736. messageSends: ["at:"],
  1737. referencedClasses: []
  1738. }),
  1739. smalltalk.SequenceableCollection);
  1740. smalltalk.addMethod(
  1741. "_shallowCopy",
  1742. smalltalk.method({
  1743. selector: "shallowCopy",
  1744. category: 'copying',
  1745. fn: function () {
  1746. var self=this;
  1747. var newCollection=nil;
  1748. (newCollection=smalltalk.send(smalltalk.send(self, "_class", []), "_new_", [smalltalk.send(self, "_size", [])]));
  1749. smalltalk.send(self, "_withIndexDo_", [(function(each, index){return smalltalk.send(newCollection, "_at_put_", [index, each]);})]);
  1750. return newCollection;
  1751. return self;},
  1752. args: [],
  1753. 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",
  1754. messageSends: ["new:", "class", "size", "withIndexDo:", "at:put:"],
  1755. referencedClasses: []
  1756. }),
  1757. smalltalk.SequenceableCollection);
  1758. smalltalk.addMethod(
  1759. "_third",
  1760. smalltalk.method({
  1761. selector: "third",
  1762. category: 'accessing',
  1763. fn: function () {
  1764. var self=this;
  1765. return smalltalk.send(self, "_at_", [(3)]);
  1766. return self;},
  1767. args: [],
  1768. source: "third\x0a\x09^self at: 3",
  1769. messageSends: ["at:"],
  1770. referencedClasses: []
  1771. }),
  1772. smalltalk.SequenceableCollection);
  1773. smalltalk.addMethod(
  1774. "_withIndexDo_",
  1775. smalltalk.method({
  1776. selector: "withIndexDo:",
  1777. category: 'enumerating',
  1778. fn: function (aBlock) {
  1779. var self=this;
  1780. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  1781. return self;},
  1782. args: ["aBlock"],
  1783. source: "withIndexDo: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>",
  1784. messageSends: [],
  1785. referencedClasses: []
  1786. }),
  1787. smalltalk.SequenceableCollection);
  1788. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1789. smalltalk.addMethod(
  1790. "_add_",
  1791. smalltalk.method({
  1792. selector: "add:",
  1793. category: 'adding/removing',
  1794. fn: function (anObject) {
  1795. var self=this;
  1796. self.push(anObject); return anObject;;
  1797. return self;},
  1798. args: ["anObject"],
  1799. source: "add: anObject\x0a\x09<self.push(anObject); return anObject;>",
  1800. messageSends: [],
  1801. referencedClasses: []
  1802. }),
  1803. smalltalk.Array);
  1804. smalltalk.addMethod(
  1805. "_asJavascript",
  1806. smalltalk.method({
  1807. selector: "asJavascript",
  1808. category: 'converting',
  1809. fn: function () {
  1810. var self=this;
  1811. return smalltalk.send(smalltalk.send("[", "__comma", [smalltalk.send(smalltalk.send(self, "_collect_", [(function(each){return smalltalk.send(each, "_asJavascript", []);})]), "_join_", [", "])]), "__comma", ["]"]);
  1812. return self;},
  1813. args: [],
  1814. source: "asJavascript\x0a\x09^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'",
  1815. messageSends: [",", "join:", "collect:", "asJavascript"],
  1816. referencedClasses: []
  1817. }),
  1818. smalltalk.Array);
  1819. smalltalk.addMethod(
  1820. "_at_ifAbsent_",
  1821. smalltalk.method({
  1822. selector: "at:ifAbsent:",
  1823. category: 'accessing',
  1824. fn: function (anIndex, aBlock) {
  1825. var self=this;
  1826. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  1827. return self[anIndex - 1];
  1828. ;
  1829. return self;},
  1830. args: ["anIndex", "aBlock"],
  1831. 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>",
  1832. messageSends: [],
  1833. referencedClasses: []
  1834. }),
  1835. smalltalk.Array);
  1836. smalltalk.addMethod(
  1837. "_at_put_",
  1838. smalltalk.method({
  1839. selector: "at:put:",
  1840. category: 'accessing',
  1841. fn: function (anIndex, anObject) {
  1842. var self=this;
  1843. return self[anIndex - 1] = anObject;
  1844. return self;},
  1845. args: ["anIndex", "anObject"],
  1846. source: "at: anIndex put: anObject\x0a\x09<return self[anIndex - 1] = anObject>",
  1847. messageSends: [],
  1848. referencedClasses: []
  1849. }),
  1850. smalltalk.Array);
  1851. smalltalk.addMethod(
  1852. "_join_",
  1853. smalltalk.method({
  1854. selector: "join:",
  1855. category: 'enumerating',
  1856. fn: function (aString) {
  1857. var self=this;
  1858. return self.join(aString);
  1859. return self;},
  1860. args: ["aString"],
  1861. source: "join: aString\x0a\x09<return self.join(aString)>",
  1862. messageSends: [],
  1863. referencedClasses: []
  1864. }),
  1865. smalltalk.Array);
  1866. smalltalk.addMethod(
  1867. "_remove_",
  1868. smalltalk.method({
  1869. selector: "remove:",
  1870. category: 'adding/removing',
  1871. fn: function (anObject) {
  1872. var self=this;
  1873. for(var i=0;i<self.length;i++) {
  1874. if(self[i] == anObject) {
  1875. self.splice(i,1);
  1876. break;
  1877. }
  1878. }
  1879. ;
  1880. return self;},
  1881. args: ["anObject"],
  1882. 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>",
  1883. messageSends: [],
  1884. referencedClasses: []
  1885. }),
  1886. smalltalk.Array);
  1887. smalltalk.addMethod(
  1888. "_removeFrom_to_",
  1889. smalltalk.method({
  1890. selector: "removeFrom:to:",
  1891. category: 'adding/removing',
  1892. fn: function (aNumber, anotherNumber) {
  1893. var self=this;
  1894. self.splice(aNumber - 1,anotherNumber - 1);
  1895. return self;},
  1896. args: ["aNumber", "anotherNumber"],
  1897. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<self.splice(aNumber - 1,anotherNumber - 1)>",
  1898. messageSends: [],
  1899. referencedClasses: []
  1900. }),
  1901. smalltalk.Array);
  1902. smalltalk.addMethod(
  1903. "_reversed",
  1904. smalltalk.method({
  1905. selector: "reversed",
  1906. category: 'converting',
  1907. fn: function () {
  1908. var self=this;
  1909. return self._copy().reverse();
  1910. return self;},
  1911. args: [],
  1912. source: "reversed\x0a\x09<return self._copy().reverse()>",
  1913. messageSends: [],
  1914. referencedClasses: []
  1915. }),
  1916. smalltalk.Array);
  1917. smalltalk.addMethod(
  1918. "_size",
  1919. smalltalk.method({
  1920. selector: "size",
  1921. category: 'accessing',
  1922. fn: function () {
  1923. var self=this;
  1924. return self.length;
  1925. return self;},
  1926. args: [],
  1927. source: "size\x0a\x09<return self.length>",
  1928. messageSends: [],
  1929. referencedClasses: []
  1930. }),
  1931. smalltalk.Array);
  1932. smalltalk.addMethod(
  1933. "_sort",
  1934. smalltalk.method({
  1935. selector: "sort",
  1936. category: 'enumerating',
  1937. fn: function () {
  1938. var self=this;
  1939. return smalltalk.send(self, "_basicPerform_", ["sort"]);
  1940. return self;},
  1941. args: [],
  1942. source: "sort\x0a ^self basicPerform: 'sort'",
  1943. messageSends: ["basicPerform:"],
  1944. referencedClasses: []
  1945. }),
  1946. smalltalk.Array);
  1947. smalltalk.addMethod(
  1948. "_sort_",
  1949. smalltalk.method({
  1950. selector: "sort:",
  1951. category: 'enumerating',
  1952. fn: function (aBlock) {
  1953. var self=this;
  1954. return self.sort(function(a, b) {
  1955. if(aBlock(a,b)) {return -1} else {return 1}
  1956. })
  1957. ;
  1958. return self;},
  1959. args: ["aBlock"],
  1960. 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>",
  1961. messageSends: [],
  1962. referencedClasses: []
  1963. }),
  1964. smalltalk.Array);
  1965. smalltalk.addMethod(
  1966. "_sorted",
  1967. smalltalk.method({
  1968. selector: "sorted",
  1969. category: 'enumerating',
  1970. fn: function () {
  1971. var self=this;
  1972. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort", []);
  1973. return self;},
  1974. args: [],
  1975. source: "sorted\x0a\x09^self copy sort",
  1976. messageSends: ["sort", "copy"],
  1977. referencedClasses: []
  1978. }),
  1979. smalltalk.Array);
  1980. smalltalk.addMethod(
  1981. "_sorted_",
  1982. smalltalk.method({
  1983. selector: "sorted:",
  1984. category: 'enumerating',
  1985. fn: function (aBlock) {
  1986. var self=this;
  1987. return smalltalk.send(smalltalk.send(self, "_copy", []), "_sort_", [aBlock]);
  1988. return self;},
  1989. args: ["aBlock"],
  1990. source: "sorted: aBlock\x0a\x09^self copy sort: aBlock",
  1991. messageSends: ["sort:", "copy"],
  1992. referencedClasses: []
  1993. }),
  1994. smalltalk.Array);
  1995. smalltalk.addMethod(
  1996. "_new_",
  1997. smalltalk.method({
  1998. selector: "new:",
  1999. category: 'instance creation',
  2000. fn: function (anInteger) {
  2001. var self=this;
  2002. return new Array(anInteger);
  2003. return self;},
  2004. args: ["anInteger"],
  2005. source: "new: anInteger\x0a\x09<return new Array(anInteger)>",
  2006. messageSends: [],
  2007. referencedClasses: []
  2008. }),
  2009. smalltalk.Array.klass);
  2010. smalltalk.addMethod(
  2011. "_with_",
  2012. smalltalk.method({
  2013. selector: "with:",
  2014. category: 'instance creation',
  2015. fn: function (anObject) {
  2016. var self=this;
  2017. return (function($rec){smalltalk.send($rec, "_at_put_", [(1), anObject]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new_", [(1)]));
  2018. return self;},
  2019. args: ["anObject"],
  2020. source: "with: anObject\x0a\x09 ^(self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  2021. messageSends: ["at:put:", "yourself", "new:"],
  2022. referencedClasses: []
  2023. }),
  2024. smalltalk.Array.klass);
  2025. smalltalk.addMethod(
  2026. "_with_with_",
  2027. smalltalk.method({
  2028. selector: "with:with:",
  2029. category: 'instance creation',
  2030. fn: function (anObject, anObject2) {
  2031. var self=this;
  2032. 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)]));
  2033. return self;},
  2034. args: ["anObject", "anObject2"],
  2035. 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",
  2036. messageSends: ["at:put:", "yourself", "new:"],
  2037. referencedClasses: []
  2038. }),
  2039. smalltalk.Array.klass);
  2040. smalltalk.addMethod(
  2041. "_with_with_with_",
  2042. smalltalk.method({
  2043. selector: "with:with:with:",
  2044. category: 'instance creation',
  2045. fn: function (anObject, anObject2, anObject3) {
  2046. var self=this;
  2047. 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)]));
  2048. return self;},
  2049. args: ["anObject", "anObject2", "anObject3"],
  2050. 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",
  2051. messageSends: ["at:put:", "yourself", "new:"],
  2052. referencedClasses: []
  2053. }),
  2054. smalltalk.Array.klass);
  2055. smalltalk.addMethod(
  2056. "_withAll_",
  2057. smalltalk.method({
  2058. selector: "withAll:",
  2059. category: 'instance creation',
  2060. fn: function (aCollection) {
  2061. var self=this;
  2062. var instance=nil;
  2063. (instance=smalltalk.send(self, "_new_", [smalltalk.send(aCollection, "_size", [])]));
  2064. smalltalk.send(aCollection, "_withIndexDo_", [(function(each, index){return smalltalk.send(instance, "_at_put_", [index, each]);})]);
  2065. return instance;
  2066. return self;},
  2067. args: ["aCollection"],
  2068. 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",
  2069. messageSends: ["new:", "size", "withIndexDo:", "at:put:"],
  2070. referencedClasses: []
  2071. }),
  2072. smalltalk.Array.klass);
  2073. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  2074. smalltalk.addMethod(
  2075. "__comma",
  2076. smalltalk.method({
  2077. selector: ",",
  2078. category: 'copying',
  2079. fn: function (aString) {
  2080. var self=this;
  2081. return smalltalk.send(smalltalk.send(self, "_asString", []), "__comma", [smalltalk.send(aString, "_asString", [])]);
  2082. return self;},
  2083. args: ["aString"],
  2084. source: ", aString\x0a\x09^self asString, aString asString",
  2085. messageSends: [",", "asString"],
  2086. referencedClasses: []
  2087. }),
  2088. smalltalk.CharacterArray);
  2089. smalltalk.addMethod(
  2090. "_add_",
  2091. smalltalk.method({
  2092. selector: "add:",
  2093. category: 'adding',
  2094. fn: function (anObject) {
  2095. var self=this;
  2096. smalltalk.send(self, "_errorReadOnly", []);
  2097. return self;},
  2098. args: ["anObject"],
  2099. source: "add: anObject\x0a\x09self errorReadOnly",
  2100. messageSends: ["errorReadOnly"],
  2101. referencedClasses: []
  2102. }),
  2103. smalltalk.CharacterArray);
  2104. smalltalk.addMethod(
  2105. "_asLowercase",
  2106. smalltalk.method({
  2107. selector: "asLowercase",
  2108. category: 'converting',
  2109. fn: function () {
  2110. var self=this;
  2111. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asLowercase", [])]);
  2112. return self;},
  2113. args: [],
  2114. source: "asLowercase\x0a\x09^self class fromString: self asString asLowercase",
  2115. messageSends: ["fromString:", "class", "asLowercase", "asString"],
  2116. referencedClasses: []
  2117. }),
  2118. smalltalk.CharacterArray);
  2119. smalltalk.addMethod(
  2120. "_asNumber",
  2121. smalltalk.method({
  2122. selector: "asNumber",
  2123. category: 'converting',
  2124. fn: function () {
  2125. var self=this;
  2126. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asNumber", []);
  2127. return self;},
  2128. args: [],
  2129. source: "asNumber\x0a\x09^self asString asNumber",
  2130. messageSends: ["asNumber", "asString"],
  2131. referencedClasses: []
  2132. }),
  2133. smalltalk.CharacterArray);
  2134. smalltalk.addMethod(
  2135. "_asString",
  2136. smalltalk.method({
  2137. selector: "asString",
  2138. category: 'converting',
  2139. fn: function () {
  2140. var self=this;
  2141. return smalltalk.send(self, "_subclassResponsibility", []);
  2142. return self;},
  2143. args: [],
  2144. source: "asString\x0a\x09^self subclassResponsibility",
  2145. messageSends: ["subclassResponsibility"],
  2146. referencedClasses: []
  2147. }),
  2148. smalltalk.CharacterArray);
  2149. smalltalk.addMethod(
  2150. "_asSymbol",
  2151. smalltalk.method({
  2152. selector: "asSymbol",
  2153. category: 'converting',
  2154. fn: function () {
  2155. var self=this;
  2156. return smalltalk.send(self, "_subclassResponsibility", []);
  2157. return self;},
  2158. args: [],
  2159. source: "asSymbol\x0a\x09^self subclassResponsibility",
  2160. messageSends: ["subclassResponsibility"],
  2161. referencedClasses: []
  2162. }),
  2163. smalltalk.CharacterArray);
  2164. smalltalk.addMethod(
  2165. "_asUppercase",
  2166. smalltalk.method({
  2167. selector: "asUppercase",
  2168. category: 'converting',
  2169. fn: function () {
  2170. var self=this;
  2171. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_asUppercase", [])]);
  2172. return self;},
  2173. args: [],
  2174. source: "asUppercase\x0a\x09^self class fromString: self asString asUppercase",
  2175. messageSends: ["fromString:", "class", "asUppercase", "asString"],
  2176. referencedClasses: []
  2177. }),
  2178. smalltalk.CharacterArray);
  2179. smalltalk.addMethod(
  2180. "_at_put_",
  2181. smalltalk.method({
  2182. selector: "at:put:",
  2183. category: 'accessing',
  2184. fn: function (anIndex, anObject) {
  2185. var self=this;
  2186. smalltalk.send(self, "_errorReadOnly", []);
  2187. return self;},
  2188. args: ["anIndex", "anObject"],
  2189. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  2190. messageSends: ["errorReadOnly"],
  2191. referencedClasses: []
  2192. }),
  2193. smalltalk.CharacterArray);
  2194. smalltalk.addMethod(
  2195. "_errorReadOnly",
  2196. smalltalk.method({
  2197. selector: "errorReadOnly",
  2198. category: 'error handling',
  2199. fn: function () {
  2200. var self=this;
  2201. smalltalk.send(self, "_error_", ["Object is read-only"]);
  2202. return self;},
  2203. args: [],
  2204. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  2205. messageSends: ["error:"],
  2206. referencedClasses: []
  2207. }),
  2208. smalltalk.CharacterArray);
  2209. smalltalk.addMethod(
  2210. "_printString",
  2211. smalltalk.method({
  2212. selector: "printString",
  2213. category: 'printing',
  2214. fn: function () {
  2215. var self=this;
  2216. return smalltalk.send(smalltalk.send(self, "_asString", []), "_printString", []);
  2217. return self;},
  2218. args: [],
  2219. source: "printString\x0a\x09^self asString printString",
  2220. messageSends: ["printString", "asString"],
  2221. referencedClasses: []
  2222. }),
  2223. smalltalk.CharacterArray);
  2224. smalltalk.addMethod(
  2225. "_remove_",
  2226. smalltalk.method({
  2227. selector: "remove:",
  2228. category: 'adding',
  2229. fn: function (anObject) {
  2230. var self=this;
  2231. smalltalk.send(self, "_errorReadOnly", []);
  2232. return self;},
  2233. args: ["anObject"],
  2234. source: "remove: anObject\x0a\x09self errorReadOnly",
  2235. messageSends: ["errorReadOnly"],
  2236. referencedClasses: []
  2237. }),
  2238. smalltalk.CharacterArray);
  2239. smalltalk.addMethod(
  2240. "_fromString_",
  2241. smalltalk.method({
  2242. selector: "fromString:",
  2243. category: 'instance creation',
  2244. fn: function (aString) {
  2245. var self=this;
  2246. smalltalk.send(self, "_subclassResponsibility", []);
  2247. return self;},
  2248. args: ["aString"],
  2249. source: "fromString: aString\x0a\x09self subclassResponsibility",
  2250. messageSends: ["subclassResponsibility"],
  2251. referencedClasses: []
  2252. }),
  2253. smalltalk.CharacterArray.klass);
  2254. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2255. smalltalk.addMethod(
  2256. "__comma",
  2257. smalltalk.method({
  2258. selector: ",",
  2259. category: 'copying',
  2260. fn: function (aString) {
  2261. var self=this;
  2262. return self + aString;
  2263. return self;},
  2264. args: ["aString"],
  2265. source: ", aString\x0a\x09<return self + aString>",
  2266. messageSends: [],
  2267. referencedClasses: []
  2268. }),
  2269. smalltalk.String);
  2270. smalltalk.addMethod(
  2271. "__lt",
  2272. smalltalk.method({
  2273. selector: "<",
  2274. category: 'comparing',
  2275. fn: function (aString) {
  2276. var self=this;
  2277. return String(self) < aString._asString();
  2278. return self;},
  2279. args: ["aString"],
  2280. source: "< aString\x0a\x09<return String(self) < aString._asString()>",
  2281. messageSends: [],
  2282. referencedClasses: []
  2283. }),
  2284. smalltalk.String);
  2285. smalltalk.addMethod(
  2286. "__lt_eq",
  2287. smalltalk.method({
  2288. selector: "<=",
  2289. category: 'comparing',
  2290. fn: function (aString) {
  2291. var self=this;
  2292. return String(self) <= aString._asString();
  2293. return self;},
  2294. args: ["aString"],
  2295. source: "<= aString\x0a\x09<return String(self) <= aString._asString()>",
  2296. messageSends: [],
  2297. referencedClasses: []
  2298. }),
  2299. smalltalk.String);
  2300. smalltalk.addMethod(
  2301. "__eq",
  2302. smalltalk.method({
  2303. selector: "=",
  2304. category: 'comparing',
  2305. fn: function (aString) {
  2306. var self=this;
  2307. var $early={};
  2308. try{((($receiver = smalltalk.send(smalltalk.send(aString, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=function(){return false}})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=function(){return false}})();})]));
  2309. return String(self) === String(aString);
  2310. return self;
  2311. } catch(e) {if(e===$early)return e(); throw e}},
  2312. args: ["aString"],
  2313. source: "= aString\x0a\x09aString class = self class ifFalse: [^false].\x0a\x09<return String(self) === String(aString)>",
  2314. messageSends: ["ifFalse:", "=", "class"],
  2315. referencedClasses: []
  2316. }),
  2317. smalltalk.String);
  2318. smalltalk.addMethod(
  2319. "__gt",
  2320. smalltalk.method({
  2321. selector: ">",
  2322. category: 'comparing',
  2323. fn: function (aString) {
  2324. var self=this;
  2325. return String(self) > aString._asString();
  2326. return self;},
  2327. args: ["aString"],
  2328. source: "> aString\x0a\x09<return String(self) >> aString._asString()>",
  2329. messageSends: [],
  2330. referencedClasses: []
  2331. }),
  2332. smalltalk.String);
  2333. smalltalk.addMethod(
  2334. "__gt_eq",
  2335. smalltalk.method({
  2336. selector: ">=",
  2337. category: 'comparing',
  2338. fn: function (aString) {
  2339. var self=this;
  2340. return String(self) >= aString._asString();
  2341. return self;},
  2342. args: ["aString"],
  2343. source: ">= aString\x0a\x09<return String(self) >>= aString._asString()>",
  2344. messageSends: [],
  2345. referencedClasses: []
  2346. }),
  2347. smalltalk.String);
  2348. smalltalk.addMethod(
  2349. "_asJSON",
  2350. smalltalk.method({
  2351. selector: "asJSON",
  2352. category: 'converting',
  2353. fn: function () {
  2354. var self=this;
  2355. return self;
  2356. return self;},
  2357. args: [],
  2358. source: "asJSON\x0a\x09^self",
  2359. messageSends: [],
  2360. referencedClasses: []
  2361. }),
  2362. smalltalk.String);
  2363. smalltalk.addMethod(
  2364. "_asJavaScriptSelector",
  2365. smalltalk.method({
  2366. selector: "asJavaScriptSelector",
  2367. category: 'converting',
  2368. fn: function () {
  2369. var self=this;
  2370. return smalltalk.send(smalltalk.send(smalltalk.send(self, "_asSelector", []), "_replace_with_", ["^_", ""]), "_replace_with_", ["_.*", ""]);
  2371. return self;},
  2372. args: [],
  2373. source: "asJavaScriptSelector\x0a\x09^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.",
  2374. messageSends: ["replace:with:", "asSelector"],
  2375. referencedClasses: []
  2376. }),
  2377. smalltalk.String);
  2378. smalltalk.addMethod(
  2379. "_asJavascript",
  2380. smalltalk.method({
  2381. selector: "asJavascript",
  2382. category: 'converting',
  2383. fn: function () {
  2384. var self=this;
  2385. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2386. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  2387. else
  2388. return "\"" + self + "\"";
  2389. ;
  2390. return self;},
  2391. args: [],
  2392. 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>",
  2393. messageSends: [],
  2394. referencedClasses: []
  2395. }),
  2396. smalltalk.String);
  2397. smalltalk.addMethod(
  2398. "_asLowercase",
  2399. smalltalk.method({
  2400. selector: "asLowercase",
  2401. category: 'converting',
  2402. fn: function () {
  2403. var self=this;
  2404. return self.toLowerCase();
  2405. return self;},
  2406. args: [],
  2407. source: "asLowercase\x0a\x09<return self.toLowerCase()>",
  2408. messageSends: [],
  2409. referencedClasses: []
  2410. }),
  2411. smalltalk.String);
  2412. smalltalk.addMethod(
  2413. "_asNumber",
  2414. smalltalk.method({
  2415. selector: "asNumber",
  2416. category: 'converting',
  2417. fn: function () {
  2418. var self=this;
  2419. return Number(self);
  2420. return self;},
  2421. args: [],
  2422. source: "asNumber\x0a\x09<return Number(self)>",
  2423. messageSends: [],
  2424. referencedClasses: []
  2425. }),
  2426. smalltalk.String);
  2427. smalltalk.addMethod(
  2428. "_asSelector",
  2429. smalltalk.method({
  2430. selector: "asSelector",
  2431. category: 'converting',
  2432. fn: function () {
  2433. var self=this;
  2434. var selector=nil;
  2435. (selector=smalltalk.send("_", "__comma", [self]));
  2436. (selector=smalltalk.send(selector, "_replace_with_", [":", "_"]));
  2437. (selector=smalltalk.send(selector, "_replace_with_", ["[+]", "_plus"]));
  2438. (selector=smalltalk.send(selector, "_replace_with_", ["-", "_minus"]));
  2439. (selector=smalltalk.send(selector, "_replace_with_", ["[*]", "_star"]));
  2440. (selector=smalltalk.send(selector, "_replace_with_", ["[/]", "_slash"]));
  2441. (selector=smalltalk.send(selector, "_replace_with_", [">", "_gt"]));
  2442. (selector=smalltalk.send(selector, "_replace_with_", ["<", "_lt"]));
  2443. (selector=smalltalk.send(selector, "_replace_with_", ["=", "_eq"]));
  2444. (selector=smalltalk.send(selector, "_replace_with_", [",", "_comma"]));
  2445. (selector=smalltalk.send(selector, "_replace_with_", ["[@]", "_at"]));
  2446. return selector;
  2447. return self;},
  2448. args: [],
  2449. 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",
  2450. messageSends: [",", "replace:with:"],
  2451. referencedClasses: []
  2452. }),
  2453. smalltalk.String);
  2454. smalltalk.addMethod(
  2455. "_asString",
  2456. smalltalk.method({
  2457. selector: "asString",
  2458. category: 'converting',
  2459. fn: function () {
  2460. var self=this;
  2461. return self;
  2462. return self;},
  2463. args: [],
  2464. source: "asString\x0a\x09^self",
  2465. messageSends: [],
  2466. referencedClasses: []
  2467. }),
  2468. smalltalk.String);
  2469. smalltalk.addMethod(
  2470. "_asSymbol",
  2471. smalltalk.method({
  2472. selector: "asSymbol",
  2473. category: 'converting',
  2474. fn: function () {
  2475. var self=this;
  2476. return smalltalk.send((smalltalk.Symbol || Symbol), "_lookup_", [self]);
  2477. return self;},
  2478. args: [],
  2479. source: "asSymbol\x0a\x09^Symbol lookup: self",
  2480. messageSends: ["lookup:"],
  2481. referencedClasses: ["Symbol"]
  2482. }),
  2483. smalltalk.String);
  2484. smalltalk.addMethod(
  2485. "_asUppercase",
  2486. smalltalk.method({
  2487. selector: "asUppercase",
  2488. category: 'converting',
  2489. fn: function () {
  2490. var self=this;
  2491. return self.toUpperCase();
  2492. return self;},
  2493. args: [],
  2494. source: "asUppercase\x0a\x09<return self.toUpperCase()>",
  2495. messageSends: [],
  2496. referencedClasses: []
  2497. }),
  2498. smalltalk.String);
  2499. smalltalk.addMethod(
  2500. "_asciiValue",
  2501. smalltalk.method({
  2502. selector: "asciiValue",
  2503. category: 'accessing',
  2504. fn: function () {
  2505. var self=this;
  2506. return self.charCodeAt(0);;
  2507. return self;},
  2508. args: [],
  2509. source: "asciiValue\x0a\x09<return self.charCodeAt(0);>",
  2510. messageSends: [],
  2511. referencedClasses: []
  2512. }),
  2513. smalltalk.String);
  2514. smalltalk.addMethod(
  2515. "_at_ifAbsent_",
  2516. smalltalk.method({
  2517. selector: "at:ifAbsent:",
  2518. category: 'accessing',
  2519. fn: function (anIndex, aBlock) {
  2520. var self=this;
  2521. return self[anIndex - 1] || aBlock();
  2522. return self;},
  2523. args: ["anIndex", "aBlock"],
  2524. source: "at: anIndex ifAbsent: aBlock\x0a\x09<return self[anIndex - 1] || aBlock()>",
  2525. messageSends: [],
  2526. referencedClasses: []
  2527. }),
  2528. smalltalk.String);
  2529. smalltalk.addMethod(
  2530. "_copyFrom_to_",
  2531. smalltalk.method({
  2532. selector: "copyFrom:to:",
  2533. category: 'copying',
  2534. fn: function (anIndex, anotherIndex) {
  2535. var self=this;
  2536. return self.substring(anIndex - 1, anotherIndex);
  2537. return self;},
  2538. args: ["anIndex", "anotherIndex"],
  2539. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<return self.substring(anIndex - 1, anotherIndex)>",
  2540. messageSends: [],
  2541. referencedClasses: []
  2542. }),
  2543. smalltalk.String);
  2544. smalltalk.addMethod(
  2545. "_deepCopy",
  2546. smalltalk.method({
  2547. selector: "deepCopy",
  2548. category: 'copying',
  2549. fn: function () {
  2550. var self=this;
  2551. return smalltalk.send(self, "_shallowCopy", []);
  2552. return self;},
  2553. args: [],
  2554. source: "deepCopy\x0a\x09^self shallowCopy",
  2555. messageSends: ["shallowCopy"],
  2556. referencedClasses: []
  2557. }),
  2558. smalltalk.String);
  2559. smalltalk.addMethod(
  2560. "_escaped",
  2561. smalltalk.method({
  2562. selector: "escaped",
  2563. category: 'accessing',
  2564. fn: function () {
  2565. var self=this;
  2566. return escape(self);
  2567. return self;},
  2568. args: [],
  2569. source: "escaped\x0a\x09<return escape(self)>",
  2570. messageSends: [],
  2571. referencedClasses: []
  2572. }),
  2573. smalltalk.String);
  2574. smalltalk.addMethod(
  2575. "_includesSubString_",
  2576. smalltalk.method({
  2577. selector: "includesSubString:",
  2578. category: 'testing',
  2579. fn: function (subString) {
  2580. var self=this;
  2581. return self.indexOf(subString) != -1 ;
  2582. return self;},
  2583. args: ["subString"],
  2584. source: "includesSubString: subString\x0a\x09< return self.indexOf(subString) != -1 >",
  2585. messageSends: [],
  2586. referencedClasses: []
  2587. }),
  2588. smalltalk.String);
  2589. smalltalk.addMethod(
  2590. "_isString",
  2591. smalltalk.method({
  2592. selector: "isString",
  2593. category: 'testing',
  2594. fn: function () {
  2595. var self=this;
  2596. return true;
  2597. return self;},
  2598. args: [],
  2599. source: "isString\x0a\x09^true",
  2600. messageSends: [],
  2601. referencedClasses: []
  2602. }),
  2603. smalltalk.String);
  2604. smalltalk.addMethod(
  2605. "_join_",
  2606. smalltalk.method({
  2607. selector: "join:",
  2608. category: 'split join',
  2609. fn: function (aCollection) {
  2610. var self=this;
  2611. 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]);})]);})]);
  2612. return self;},
  2613. args: ["aCollection"],
  2614. 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]]",
  2615. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"],
  2616. referencedClasses: ["String"]
  2617. }),
  2618. smalltalk.String);
  2619. smalltalk.addMethod(
  2620. "_lineIndicesDo_",
  2621. smalltalk.method({
  2622. selector: "lineIndicesDo:",
  2623. category: 'split join',
  2624. fn: function (aBlock) {
  2625. var self=this;
  2626. var $early={};
  2627. try{var cr=nil;
  2628. var lf=nil;
  2629. var start=nil;
  2630. var sz=nil;
  2631. var nextLF=nil;
  2632. var nextCR=nil;
  2633. (start=(1));
  2634. (sz=smalltalk.send(self, "_size", []));
  2635. (cr=smalltalk.send((smalltalk.String || String), "_cr", []));
  2636. (nextCR=smalltalk.send(self, "_indexOf_startingAt_", [cr, (1)]));
  2637. (lf=smalltalk.send((smalltalk.String || String), "_lf", []));
  2638. (nextLF=smalltalk.send(self, "_indexOf_startingAt_", [lf, (1)]));
  2639. (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=function(){return self}})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){smalltalk.send(aBlock, "_value_value_value_", [start, sz, sz]);return (function(){throw $early=function(){return 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]));})]));})]));})()}})();
  2640. return self;
  2641. } catch(e) {if(e===$early)return e(); throw e}},
  2642. args: ["aBlock"],
  2643. 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 ]]]",
  2644. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"],
  2645. referencedClasses: ["String"]
  2646. }),
  2647. smalltalk.String);
  2648. smalltalk.addMethod(
  2649. "_lineNumber_",
  2650. smalltalk.method({
  2651. selector: "lineNumber:",
  2652. category: 'split join',
  2653. fn: function (anIndex) {
  2654. var self=this;
  2655. var $early={};
  2656. try{var lineCount=nil;
  2657. (lineCount=(0));
  2658. 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=function(){return smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])}})();})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return (function(){throw $early=function(){return smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])}})();})]));})]);
  2659. return nil;
  2660. return self;
  2661. } catch(e) {if(e===$early)return e(); throw e}},
  2662. args: ["anIndex"],
  2663. 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",
  2664. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"],
  2665. referencedClasses: []
  2666. }),
  2667. smalltalk.String);
  2668. smalltalk.addMethod(
  2669. "_lines",
  2670. smalltalk.method({
  2671. selector: "lines",
  2672. category: 'split join',
  2673. fn: function () {
  2674. var self=this;
  2675. var lines=nil;
  2676. (lines=smalltalk.send((smalltalk.Array || Array), "_new", []));
  2677. smalltalk.send(self, "_linesDo_", [(function(aLine){return smalltalk.send(lines, "_add_", [aLine]);})]);
  2678. return lines;
  2679. return self;},
  2680. args: [],
  2681. 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",
  2682. messageSends: ["new", "linesDo:", "add:"],
  2683. referencedClasses: ["Array"]
  2684. }),
  2685. smalltalk.String);
  2686. smalltalk.addMethod(
  2687. "_linesDo_",
  2688. smalltalk.method({
  2689. selector: "linesDo:",
  2690. category: 'split join',
  2691. fn: function (aBlock) {
  2692. var self=this;
  2693. smalltalk.send(self, "_lineIndicesDo_", [(function(start, endWithoutDelimiters, end){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_copyFrom_to_", [start, endWithoutDelimiters])]);})]);
  2694. return self;},
  2695. args: ["aBlock"],
  2696. 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)]",
  2697. messageSends: ["lineIndicesDo:", "value:", "copyFrom:to:"],
  2698. referencedClasses: []
  2699. }),
  2700. smalltalk.String);
  2701. smalltalk.addMethod(
  2702. "_match_",
  2703. smalltalk.method({
  2704. selector: "match:",
  2705. category: 'regular expressions',
  2706. fn: function (aRegexp) {
  2707. var self=this;
  2708. return self.search(aRegexp) != -1;
  2709. return self;},
  2710. args: ["aRegexp"],
  2711. source: "match: aRegexp\x0a\x09<return self.search(aRegexp) != -1>",
  2712. messageSends: [],
  2713. referencedClasses: []
  2714. }),
  2715. smalltalk.String);
  2716. smalltalk.addMethod(
  2717. "_matchesOf_",
  2718. smalltalk.method({
  2719. selector: "matchesOf:",
  2720. category: 'regular expressions',
  2721. fn: function (aRegularExpression) {
  2722. var self=this;
  2723. return self.match(aRegularExpression);
  2724. return self;},
  2725. args: ["aRegularExpression"],
  2726. source: "matchesOf: aRegularExpression\x0a <return self.match(aRegularExpression)>",
  2727. messageSends: [],
  2728. referencedClasses: []
  2729. }),
  2730. smalltalk.String);
  2731. smalltalk.addMethod(
  2732. "_printNl",
  2733. smalltalk.method({
  2734. selector: "printNl",
  2735. category: 'printing',
  2736. fn: function () {
  2737. var self=this;
  2738. console.log(self);
  2739. return self;},
  2740. args: [],
  2741. source: "printNl\x0a\x09<console.log(self)>",
  2742. messageSends: [],
  2743. referencedClasses: []
  2744. }),
  2745. smalltalk.String);
  2746. smalltalk.addMethod(
  2747. "_printString",
  2748. smalltalk.method({
  2749. selector: "printString",
  2750. category: 'printing',
  2751. fn: function () {
  2752. var self=this;
  2753. return smalltalk.send(smalltalk.send("'", "__comma", [self]), "__comma", ["'"]);
  2754. return self;},
  2755. args: [],
  2756. source: "printString\x0a\x09^'''', self, ''''",
  2757. messageSends: [","],
  2758. referencedClasses: []
  2759. }),
  2760. smalltalk.String);
  2761. smalltalk.addMethod(
  2762. "_replace_with_",
  2763. smalltalk.method({
  2764. selector: "replace:with:",
  2765. category: 'regular expressions',
  2766. fn: function (aString, anotherString) {
  2767. var self=this;
  2768. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [aString, "g"]), anotherString]);
  2769. return self;},
  2770. args: ["aString", "anotherString"],
  2771. source: "replace: aString with: anotherString\x0a\x09^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  2772. messageSends: ["replaceRegexp:with:", "fromString:flag:"],
  2773. referencedClasses: ["RegularExpression"]
  2774. }),
  2775. smalltalk.String);
  2776. smalltalk.addMethod(
  2777. "_replaceRegexp_with_",
  2778. smalltalk.method({
  2779. selector: "replaceRegexp:with:",
  2780. category: 'regular expressions',
  2781. fn: function (aRegexp, aString) {
  2782. var self=this;
  2783. return self.replace(aRegexp, aString);
  2784. return self;},
  2785. args: ["aRegexp", "aString"],
  2786. source: "replaceRegexp: aRegexp with: aString\x0a\x09<return self.replace(aRegexp, aString)>",
  2787. messageSends: [],
  2788. referencedClasses: []
  2789. }),
  2790. smalltalk.String);
  2791. smalltalk.addMethod(
  2792. "_reversed",
  2793. smalltalk.method({
  2794. selector: "reversed",
  2795. category: 'converting',
  2796. fn: function () {
  2797. var self=this;
  2798. return self.split("").reverse().join("");
  2799. return self;},
  2800. args: [],
  2801. source: "reversed\x0a\x09<return self.split(\x22\x22).reverse().join(\x22\x22)>",
  2802. messageSends: [],
  2803. referencedClasses: []
  2804. }),
  2805. smalltalk.String);
  2806. smalltalk.addMethod(
  2807. "_shallowCopy",
  2808. smalltalk.method({
  2809. selector: "shallowCopy",
  2810. category: 'copying',
  2811. fn: function () {
  2812. var self=this;
  2813. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [self]);
  2814. return self;},
  2815. args: [],
  2816. source: "shallowCopy\x0a\x09^self class fromString: self",
  2817. messageSends: ["fromString:", "class"],
  2818. referencedClasses: []
  2819. }),
  2820. smalltalk.String);
  2821. smalltalk.addMethod(
  2822. "_size",
  2823. smalltalk.method({
  2824. selector: "size",
  2825. category: 'accessing',
  2826. fn: function () {
  2827. var self=this;
  2828. return self.length;
  2829. return self;},
  2830. args: [],
  2831. source: "size\x0a\x09<return self.length>",
  2832. messageSends: [],
  2833. referencedClasses: []
  2834. }),
  2835. smalltalk.String);
  2836. smalltalk.addMethod(
  2837. "_tokenize_",
  2838. smalltalk.method({
  2839. selector: "tokenize:",
  2840. category: 'converting',
  2841. fn: function (aString) {
  2842. var self=this;
  2843. return self.split(aString);
  2844. return self;},
  2845. args: ["aString"],
  2846. source: "tokenize: aString\x0a\x09<return self.split(aString)>",
  2847. messageSends: [],
  2848. referencedClasses: []
  2849. }),
  2850. smalltalk.String);
  2851. smalltalk.addMethod(
  2852. "_trimBoth",
  2853. smalltalk.method({
  2854. selector: "trimBoth",
  2855. category: 'regular expressions',
  2856. fn: function () {
  2857. var self=this;
  2858. return smalltalk.send(self, "_trimBoth_", ["\x5cs"]);
  2859. return self;},
  2860. args: [],
  2861. source: "trimBoth\x0a\x09^self trimBoth: '\x5cs'",
  2862. messageSends: ["trimBoth:"],
  2863. referencedClasses: []
  2864. }),
  2865. smalltalk.String);
  2866. smalltalk.addMethod(
  2867. "_trimBoth_",
  2868. smalltalk.method({
  2869. selector: "trimBoth:",
  2870. category: 'regular expressions',
  2871. fn: function (separators) {
  2872. var self=this;
  2873. return smalltalk.send(smalltalk.send(self, "_trimLeft_", [separators]), "_trimRight_", [separators]);
  2874. return self;},
  2875. args: ["separators"],
  2876. source: "trimBoth: separators\x0a\x0a\x09^(self trimLeft: separators) trimRight: separators",
  2877. messageSends: ["trimRight:", "trimLeft:"],
  2878. referencedClasses: []
  2879. }),
  2880. smalltalk.String);
  2881. smalltalk.addMethod(
  2882. "_trimLeft",
  2883. smalltalk.method({
  2884. selector: "trimLeft",
  2885. category: 'regular expressions',
  2886. fn: function () {
  2887. var self=this;
  2888. return smalltalk.send(self, "_trimLeft_", ["\x5cs"]);
  2889. return self;},
  2890. args: [],
  2891. source: "trimLeft\x0a\x09^self trimLeft: '\x5cs'",
  2892. messageSends: ["trimLeft:"],
  2893. referencedClasses: []
  2894. }),
  2895. smalltalk.String);
  2896. smalltalk.addMethod(
  2897. "_trimLeft_",
  2898. smalltalk.method({
  2899. selector: "trimLeft:",
  2900. category: 'regular expressions',
  2901. fn: function (separators) {
  2902. var self=this;
  2903. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("^[", "__comma", [separators]), "__comma", ["]+"]), "g"]), ""]);
  2904. return self;},
  2905. args: ["separators"],
  2906. source: "trimLeft: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  2907. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  2908. referencedClasses: ["RegularExpression"]
  2909. }),
  2910. smalltalk.String);
  2911. smalltalk.addMethod(
  2912. "_trimRight",
  2913. smalltalk.method({
  2914. selector: "trimRight",
  2915. category: 'regular expressions',
  2916. fn: function () {
  2917. var self=this;
  2918. return smalltalk.send(self, "_trimRight_", ["\x5cs"]);
  2919. return self;},
  2920. args: [],
  2921. source: "trimRight\x0a\x09^self trimRight: '\x5cs'",
  2922. messageSends: ["trimRight:"],
  2923. referencedClasses: []
  2924. }),
  2925. smalltalk.String);
  2926. smalltalk.addMethod(
  2927. "_trimRight_",
  2928. smalltalk.method({
  2929. selector: "trimRight:",
  2930. category: 'regular expressions',
  2931. fn: function (separators) {
  2932. var self=this;
  2933. return smalltalk.send(self, "_replaceRegexp_with_", [smalltalk.send((smalltalk.RegularExpression || RegularExpression), "_fromString_flag_", [smalltalk.send(smalltalk.send("[", "__comma", [separators]), "__comma", ["]+$"]), "g"]), ""]);
  2934. return self;},
  2935. args: ["separators"],
  2936. source: "trimRight: separators\x0a\x0a\x09^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  2937. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","],
  2938. referencedClasses: ["RegularExpression"]
  2939. }),
  2940. smalltalk.String);
  2941. smalltalk.addMethod(
  2942. "_unescaped",
  2943. smalltalk.method({
  2944. selector: "unescaped",
  2945. category: 'accessing',
  2946. fn: function () {
  2947. var self=this;
  2948. return unescape(self);
  2949. return self;},
  2950. args: [],
  2951. source: "unescaped\x0a\x09<return unescape(self)>",
  2952. messageSends: [],
  2953. referencedClasses: []
  2954. }),
  2955. smalltalk.String);
  2956. smalltalk.addMethod(
  2957. "_cr",
  2958. smalltalk.method({
  2959. selector: "cr",
  2960. category: 'accessing',
  2961. fn: function () {
  2962. var self=this;
  2963. return '\r';
  2964. return self;},
  2965. args: [],
  2966. source: "cr\x0a\x09<return '\x5cr'>",
  2967. messageSends: [],
  2968. referencedClasses: []
  2969. }),
  2970. smalltalk.String.klass);
  2971. smalltalk.addMethod(
  2972. "_crlf",
  2973. smalltalk.method({
  2974. selector: "crlf",
  2975. category: 'accessing',
  2976. fn: function () {
  2977. var self=this;
  2978. return '\r\n';
  2979. return self;},
  2980. args: [],
  2981. source: "crlf\x0a\x09<return '\x5cr\x5cn'>",
  2982. messageSends: [],
  2983. referencedClasses: []
  2984. }),
  2985. smalltalk.String.klass);
  2986. smalltalk.addMethod(
  2987. "_fromString_",
  2988. smalltalk.method({
  2989. selector: "fromString:",
  2990. category: 'instance creation',
  2991. fn: function (aString) {
  2992. var self=this;
  2993. return new self.fn(aString);
  2994. return self;},
  2995. args: ["aString"],
  2996. source: "fromString: aString\x0a\x09 <return new self.fn(aString)>",
  2997. messageSends: [],
  2998. referencedClasses: []
  2999. }),
  3000. smalltalk.String.klass);
  3001. smalltalk.addMethod(
  3002. "_lf",
  3003. smalltalk.method({
  3004. selector: "lf",
  3005. category: 'accessing',
  3006. fn: function () {
  3007. var self=this;
  3008. return '\n';
  3009. return self;},
  3010. args: [],
  3011. source: "lf\x0a\x09<return '\x5cn'>",
  3012. messageSends: [],
  3013. referencedClasses: []
  3014. }),
  3015. smalltalk.String.klass);
  3016. smalltalk.addMethod(
  3017. "_space",
  3018. smalltalk.method({
  3019. selector: "space",
  3020. category: 'accessing',
  3021. fn: function () {
  3022. var self=this;
  3023. return ' ';
  3024. return self;},
  3025. args: [],
  3026. source: "space\x0a\x09<return ' '>",
  3027. messageSends: [],
  3028. referencedClasses: []
  3029. }),
  3030. smalltalk.String.klass);
  3031. smalltalk.addMethod(
  3032. "_streamClass",
  3033. smalltalk.method({
  3034. selector: "streamClass",
  3035. category: 'accessing',
  3036. fn: function () {
  3037. var self=this;
  3038. return (smalltalk.StringStream || StringStream);
  3039. return self;},
  3040. args: [],
  3041. source: "streamClass\x0a\x09 ^StringStream",
  3042. messageSends: [],
  3043. referencedClasses: ["StringStream"]
  3044. }),
  3045. smalltalk.String.klass);
  3046. smalltalk.addMethod(
  3047. "_streamContents_",
  3048. smalltalk.method({
  3049. selector: "streamContents:",
  3050. category: 'instance creation',
  3051. fn: function (blockWithArg) {
  3052. var self=this;
  3053. var stream=nil;
  3054. (stream=smalltalk.send(smalltalk.send(self, "_streamClass", []), "_on_", [smalltalk.send((smalltalk.String || String), "_new", [])]));
  3055. smalltalk.send(blockWithArg, "_value_", [stream]);
  3056. return smalltalk.send(stream, "_contents", []);
  3057. return self;},
  3058. args: ["blockWithArg"],
  3059. source: "streamContents: blockWithArg\x0a\x09|stream|\x0a\x09stream := (self streamClass on: String new).\x0a\x09blockWithArg value: stream.\x0a\x09^ stream contents",
  3060. messageSends: ["on:", "streamClass", "new", "value:", "contents"],
  3061. referencedClasses: ["String"]
  3062. }),
  3063. smalltalk.String.klass);
  3064. smalltalk.addMethod(
  3065. "_tab",
  3066. smalltalk.method({
  3067. selector: "tab",
  3068. category: 'accessing',
  3069. fn: function () {
  3070. var self=this;
  3071. return '\t';
  3072. return self;},
  3073. args: [],
  3074. source: "tab\x0a\x09<return '\x5ct'>",
  3075. messageSends: [],
  3076. referencedClasses: []
  3077. }),
  3078. smalltalk.String.klass);
  3079. smalltalk.addMethod(
  3080. "_value_",
  3081. smalltalk.method({
  3082. selector: "value:",
  3083. category: 'instance creation',
  3084. fn: function (aUTFCharCode) {
  3085. var self=this;
  3086. return String.fromCharCode(aUTFCharCode);;
  3087. return self;},
  3088. args: ["aUTFCharCode"],
  3089. source: "value: aUTFCharCode\x0a\x0a\x09<return String.fromCharCode(aUTFCharCode);>",
  3090. messageSends: [],
  3091. referencedClasses: []
  3092. }),
  3093. smalltalk.String.klass);
  3094. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  3095. smalltalk.addMethod(
  3096. "__lt",
  3097. smalltalk.method({
  3098. selector: "<",
  3099. category: 'comparing',
  3100. fn: function (aSymbol) {
  3101. var self=this;
  3102. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt", [smalltalk.send(aSymbol, "_asString", [])]));
  3103. return self;},
  3104. args: ["aSymbol"],
  3105. source: "< aSymbol\x0a\x09^self asString < aSymbol asString",
  3106. messageSends: ["<", "asString"],
  3107. referencedClasses: []
  3108. }),
  3109. smalltalk.Symbol);
  3110. smalltalk.addMethod(
  3111. "__lt_eq",
  3112. smalltalk.method({
  3113. selector: "<=",
  3114. category: 'comparing',
  3115. fn: function (aSymbol) {
  3116. var self=this;
  3117. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver <=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__lt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  3118. return self;},
  3119. args: ["aSymbol"],
  3120. source: "<= aSymbol\x0a\x09^self asString <= aSymbol asString",
  3121. messageSends: ["<=", "asString"],
  3122. referencedClasses: []
  3123. }),
  3124. smalltalk.Symbol);
  3125. smalltalk.addMethod(
  3126. "__eq",
  3127. smalltalk.method({
  3128. selector: "=",
  3129. category: 'comparing',
  3130. fn: function (aSymbol) {
  3131. var self=this;
  3132. var $early={};
  3133. try{((($receiver = smalltalk.send(smalltalk.send(aSymbol, "_class", []), "__eq", [smalltalk.send(self, "_class", [])])).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return (function(){throw $early=function(){return false}})();})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return (function(){throw $early=function(){return false}})();})]));
  3134. return smalltalk.send(smalltalk.send(self, "_asString", []), "__eq", [smalltalk.send(aSymbol, "_asString", [])]);
  3135. return self;
  3136. } catch(e) {if(e===$early)return e(); throw e}},
  3137. args: ["aSymbol"],
  3138. source: "= aSymbol\x0a\x09aSymbol class = self class ifFalse: [^false].\x0a\x09^self asString = aSymbol asString",
  3139. messageSends: ["ifFalse:", "=", "class", "asString"],
  3140. referencedClasses: []
  3141. }),
  3142. smalltalk.Symbol);
  3143. smalltalk.addMethod(
  3144. "__gt",
  3145. smalltalk.method({
  3146. selector: ">",
  3147. category: 'comparing',
  3148. fn: function (aSymbol) {
  3149. var self=this;
  3150. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt", [smalltalk.send(aSymbol, "_asString", [])]));
  3151. return self;},
  3152. args: ["aSymbol"],
  3153. source: "> aSymbol\x0a\x09^self asString > aSymbol asString",
  3154. messageSends: [">", "asString"],
  3155. referencedClasses: []
  3156. }),
  3157. smalltalk.Symbol);
  3158. smalltalk.addMethod(
  3159. "__gt_eq",
  3160. smalltalk.method({
  3161. selector: ">=",
  3162. category: 'comparing',
  3163. fn: function (aSymbol) {
  3164. var self=this;
  3165. return ((($receiver = smalltalk.send(self, "_asString", [])).klass === smalltalk.Number) ? $receiver >=smalltalk.send(aSymbol, "_asString", []) : smalltalk.send($receiver, "__gt_eq", [smalltalk.send(aSymbol, "_asString", [])]));
  3166. return self;},
  3167. args: ["aSymbol"],
  3168. source: ">= aSymbol\x0a\x09^self asString >= aSymbol asString",
  3169. messageSends: [">=", "asString"],
  3170. referencedClasses: []
  3171. }),
  3172. smalltalk.Symbol);
  3173. smalltalk.addMethod(
  3174. "_asJSON",
  3175. smalltalk.method({
  3176. selector: "asJSON",
  3177. category: 'converting',
  3178. fn: function () {
  3179. var self=this;
  3180. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asJSON", []);
  3181. return self;},
  3182. args: [],
  3183. source: "asJSON\x0a\x09^self asString asJSON",
  3184. messageSends: ["asJSON", "asString"],
  3185. referencedClasses: []
  3186. }),
  3187. smalltalk.Symbol);
  3188. smalltalk.addMethod(
  3189. "_asJavascript",
  3190. smalltalk.method({
  3191. selector: "asJavascript",
  3192. category: 'converting',
  3193. fn: function () {
  3194. var self=this;
  3195. return smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22", "__comma", [smalltalk.send(self, "_asString", [])]), "__comma", ["\x22)"]);
  3196. return self;},
  3197. args: [],
  3198. source: "asJavascript\x0a\x09^'smalltalk.symbolFor(\x22', self asString, '\x22)'",
  3199. messageSends: [",", "asString"],
  3200. referencedClasses: []
  3201. }),
  3202. smalltalk.Symbol);
  3203. smalltalk.addMethod(
  3204. "_asSelector",
  3205. smalltalk.method({
  3206. selector: "asSelector",
  3207. category: 'converting',
  3208. fn: function () {
  3209. var self=this;
  3210. return smalltalk.send(smalltalk.send(self, "_asString", []), "_asSelector", []);
  3211. return self;},
  3212. args: [],
  3213. source: "asSelector\x0a\x09^self asString asSelector",
  3214. messageSends: ["asSelector", "asString"],
  3215. referencedClasses: []
  3216. }),
  3217. smalltalk.Symbol);
  3218. smalltalk.addMethod(
  3219. "_asString",
  3220. smalltalk.method({
  3221. selector: "asString",
  3222. category: 'converting',
  3223. fn: function () {
  3224. var self=this;
  3225. return self.value;
  3226. return self;},
  3227. args: [],
  3228. source: "asString\x0a\x09<return self.value>",
  3229. messageSends: [],
  3230. referencedClasses: []
  3231. }),
  3232. smalltalk.Symbol);
  3233. smalltalk.addMethod(
  3234. "_asSymbol",
  3235. smalltalk.method({
  3236. selector: "asSymbol",
  3237. category: 'converting',
  3238. fn: function () {
  3239. var self=this;
  3240. return self;
  3241. return self;},
  3242. args: [],
  3243. source: "asSymbol\x0a\x09^self",
  3244. messageSends: [],
  3245. referencedClasses: []
  3246. }),
  3247. smalltalk.Symbol);
  3248. smalltalk.addMethod(
  3249. "_at_ifAbsent_",
  3250. smalltalk.method({
  3251. selector: "at:ifAbsent:",
  3252. category: 'accessing',
  3253. fn: function (anIndex, aBlock) {
  3254. var self=this;
  3255. return smalltalk.send(smalltalk.send(self, "_asString", []), "_at_ifAbsent_", [anIndex, aBlock]);
  3256. return self;},
  3257. args: ["anIndex", "aBlock"],
  3258. source: "at: anIndex ifAbsent: aBlock\x0a\x09^self asString at: anIndex ifAbsent: aBlock",
  3259. messageSends: ["at:ifAbsent:", "asString"],
  3260. referencedClasses: []
  3261. }),
  3262. smalltalk.Symbol);
  3263. smalltalk.addMethod(
  3264. "_copyFrom_to_",
  3265. smalltalk.method({
  3266. selector: "copyFrom:to:",
  3267. category: 'copying',
  3268. fn: function (anIndex, anotherIndex) {
  3269. var self=this;
  3270. return smalltalk.send(smalltalk.send(self, "_class", []), "_fromString_", [smalltalk.send(smalltalk.send(self, "_asString", []), "_copyFrom_to_", [anIndex, anotherIndex])]);
  3271. return self;},
  3272. args: ["anIndex", "anotherIndex"],
  3273. source: "copyFrom: anIndex to: anotherIndex\x0a\x09^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)",
  3274. messageSends: ["fromString:", "class", "copyFrom:to:", "asString"],
  3275. referencedClasses: []
  3276. }),
  3277. smalltalk.Symbol);
  3278. smalltalk.addMethod(
  3279. "_deepCopy",
  3280. smalltalk.method({
  3281. selector: "deepCopy",
  3282. category: 'copying',
  3283. fn: function () {
  3284. var self=this;
  3285. return self;
  3286. return self;},
  3287. args: [],
  3288. source: "deepCopy\x0a\x09^self",
  3289. messageSends: [],
  3290. referencedClasses: []
  3291. }),
  3292. smalltalk.Symbol);
  3293. smalltalk.addMethod(
  3294. "_isSymbol",
  3295. smalltalk.method({
  3296. selector: "isSymbol",
  3297. category: 'printing',
  3298. fn: function () {
  3299. var self=this;
  3300. return true;
  3301. return self;},
  3302. args: [],
  3303. source: "isSymbol\x0a\x09^true",
  3304. messageSends: [],
  3305. referencedClasses: []
  3306. }),
  3307. smalltalk.Symbol);
  3308. smalltalk.addMethod(
  3309. "_printString",
  3310. smalltalk.method({
  3311. selector: "printString",
  3312. category: 'printing',
  3313. fn: function () {
  3314. var self=this;
  3315. return smalltalk.send("#", "__comma", [smalltalk.send(self, "_asString", [])]);
  3316. return self;},
  3317. args: [],
  3318. source: "printString\x0a\x09^'#', self asString",
  3319. messageSends: [",", "asString"],
  3320. referencedClasses: []
  3321. }),
  3322. smalltalk.Symbol);
  3323. smalltalk.addMethod(
  3324. "_shallowCopy",
  3325. smalltalk.method({
  3326. selector: "shallowCopy",
  3327. category: 'copying',
  3328. fn: function () {
  3329. var self=this;
  3330. return self;
  3331. return self;},
  3332. args: [],
  3333. source: "shallowCopy\x0a\x09^self",
  3334. messageSends: [],
  3335. referencedClasses: []
  3336. }),
  3337. smalltalk.Symbol);
  3338. smalltalk.addMethod(
  3339. "_size",
  3340. smalltalk.method({
  3341. selector: "size",
  3342. category: 'accessing',
  3343. fn: function () {
  3344. var self=this;
  3345. return smalltalk.send(smalltalk.send(self, "_asString", []), "_size", []);
  3346. return self;},
  3347. args: [],
  3348. source: "size\x0a\x09^self asString size",
  3349. messageSends: ["size", "asString"],
  3350. referencedClasses: []
  3351. }),
  3352. smalltalk.Symbol);
  3353. smalltalk.addMethod(
  3354. "_basicNew",
  3355. smalltalk.method({
  3356. selector: "basicNew",
  3357. category: 'instance creation',
  3358. fn: function () {
  3359. var self=this;
  3360. smalltalk.send(self, "_shouldNotImplement", []);
  3361. return self;},
  3362. args: [],
  3363. source: "basicNew\x0a\x09self shouldNotImplement",
  3364. messageSends: ["shouldNotImplement"],
  3365. referencedClasses: []
  3366. }),
  3367. smalltalk.Symbol.klass);
  3368. smalltalk.addMethod(
  3369. "_fromString_",
  3370. smalltalk.method({
  3371. selector: "fromString:",
  3372. category: 'instance creation',
  3373. fn: function (aString) {
  3374. var self=this;
  3375. return smalltalk.send(self, "_lookup_", [aString]);
  3376. return self;},
  3377. args: ["aString"],
  3378. source: "fromString: aString\x0a\x09^self lookup: aString",
  3379. messageSends: ["lookup:"],
  3380. referencedClasses: []
  3381. }),
  3382. smalltalk.Symbol.klass);
  3383. smalltalk.addMethod(
  3384. "_lookup_",
  3385. smalltalk.method({
  3386. selector: "lookup:",
  3387. category: 'instance creation',
  3388. fn: function (aString) {
  3389. var self=this;
  3390. return smalltalk.symbolFor(aString);;
  3391. return self;},
  3392. args: ["aString"],
  3393. source: "lookup: aString\x0a\x09<return smalltalk.symbolFor(aString);>",
  3394. messageSends: [],
  3395. referencedClasses: []
  3396. }),
  3397. smalltalk.Symbol.klass);
  3398. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  3399. smalltalk.addMethod(
  3400. "__eq",
  3401. smalltalk.method({
  3402. selector: "=",
  3403. category: 'comparing',
  3404. fn: function (aCollection) {
  3405. var self=this;
  3406. 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", [])]);})]);
  3407. return self;},
  3408. args: ["aCollection"],
  3409. source: "= aCollection\x0a\x09^self class = aCollection class and: [\x0a\x09\x09elements = aCollection asArray]",
  3410. messageSends: ["and:", "=", "class", "asArray"],
  3411. referencedClasses: []
  3412. }),
  3413. smalltalk.Set);
  3414. smalltalk.addMethod(
  3415. "_add_",
  3416. smalltalk.method({
  3417. selector: "add:",
  3418. category: 'adding/removing',
  3419. fn: function (anObject) {
  3420. var self=this;
  3421. var found;
  3422. for(var i=0; i < self['@elements'].length; i++) {
  3423. if(anObject == self['@elements'][i]) {
  3424. found = true;
  3425. break;
  3426. }
  3427. }
  3428. if(!found) {self['@elements'].push(anObject)}
  3429. ;
  3430. return self;},
  3431. args: ["anObject"],
  3432. 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>",
  3433. messageSends: [],
  3434. referencedClasses: []
  3435. }),
  3436. smalltalk.Set);
  3437. smalltalk.addMethod(
  3438. "_asArray",
  3439. smalltalk.method({
  3440. selector: "asArray",
  3441. category: 'converting',
  3442. fn: function () {
  3443. var self=this;
  3444. return smalltalk.send(self['@elements'], "_copy", []);
  3445. return self;},
  3446. args: [],
  3447. source: "asArray\x0a\x09^elements copy",
  3448. messageSends: ["copy"],
  3449. referencedClasses: []
  3450. }),
  3451. smalltalk.Set);
  3452. smalltalk.addMethod(
  3453. "_detect_ifNone_",
  3454. smalltalk.method({
  3455. selector: "detect:ifNone:",
  3456. category: 'enumerating',
  3457. fn: function (aBlock, anotherBlock) {
  3458. var self=this;
  3459. return smalltalk.send(self['@elements'], "_detect_ifNone_", [aBlock, anotherBlock]);
  3460. return self;},
  3461. args: ["aBlock", "anotherBlock"],
  3462. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^elements detect: aBlock ifNone: anotherBlock",
  3463. messageSends: ["detect:ifNone:"],
  3464. referencedClasses: []
  3465. }),
  3466. smalltalk.Set);
  3467. smalltalk.addMethod(
  3468. "_do_",
  3469. smalltalk.method({
  3470. selector: "do:",
  3471. category: 'enumerating',
  3472. fn: function (aBlock) {
  3473. var self=this;
  3474. smalltalk.send(self['@elements'], "_do_", [aBlock]);
  3475. return self;},
  3476. args: ["aBlock"],
  3477. source: "do: aBlock\x0a\x09elements do: aBlock",
  3478. messageSends: ["do:"],
  3479. referencedClasses: []
  3480. }),
  3481. smalltalk.Set);
  3482. smalltalk.addMethod(
  3483. "_includes_",
  3484. smalltalk.method({
  3485. selector: "includes:",
  3486. category: 'testing',
  3487. fn: function (anObject) {
  3488. var self=this;
  3489. return smalltalk.send(self['@elements'], "_includes_", [anObject]);
  3490. return self;},
  3491. args: ["anObject"],
  3492. source: "includes: anObject\x0a\x09^elements includes: anObject",
  3493. messageSends: ["includes:"],
  3494. referencedClasses: []
  3495. }),
  3496. smalltalk.Set);
  3497. smalltalk.addMethod(
  3498. "_initialize",
  3499. smalltalk.method({
  3500. selector: "initialize",
  3501. category: 'initialization',
  3502. fn: function () {
  3503. var self=this;
  3504. smalltalk.send(self, "_initialize", [], smalltalk.Collection);
  3505. (self['@elements']=[]);
  3506. return self;},
  3507. args: [],
  3508. source: "initialize\x0a\x09super initialize.\x0a\x09elements := #()",
  3509. messageSends: ["initialize"],
  3510. referencedClasses: []
  3511. }),
  3512. smalltalk.Set);
  3513. smalltalk.addMethod(
  3514. "_remove_",
  3515. smalltalk.method({
  3516. selector: "remove:",
  3517. category: 'adding/removing',
  3518. fn: function (anObject) {
  3519. var self=this;
  3520. smalltalk.send(self['@elements'], "_remove_", [anObject]);
  3521. return self;},
  3522. args: ["anObject"],
  3523. source: "remove: anObject\x0a\x09elements remove: anObject",
  3524. messageSends: ["remove:"],
  3525. referencedClasses: []
  3526. }),
  3527. smalltalk.Set);
  3528. smalltalk.addMethod(
  3529. "_select_",
  3530. smalltalk.method({
  3531. selector: "select:",
  3532. category: 'enumerating',
  3533. fn: function (aBlock) {
  3534. var self=this;
  3535. var collection=nil;
  3536. (collection=smalltalk.send(smalltalk.send(self, "_class", []), "_new", []));
  3537. 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]);})]));})]);
  3538. return collection;
  3539. return self;},
  3540. args: ["aBlock"],
  3541. 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",
  3542. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"],
  3543. referencedClasses: []
  3544. }),
  3545. smalltalk.Set);
  3546. smalltalk.addMethod(
  3547. "_size",
  3548. smalltalk.method({
  3549. selector: "size",
  3550. category: 'accessing',
  3551. fn: function () {
  3552. var self=this;
  3553. return smalltalk.send(self['@elements'], "_size", []);
  3554. return self;},
  3555. args: [],
  3556. source: "size\x0a\x09^elements size",
  3557. messageSends: ["size"],
  3558. referencedClasses: []
  3559. }),
  3560. smalltalk.Set);
  3561. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  3562. smalltalk.addMethod(
  3563. "_compile_",
  3564. smalltalk.method({
  3565. selector: "compile:",
  3566. category: 'evaluating',
  3567. fn: function (aString) {
  3568. var self=this;
  3569. return self.compile(aString);
  3570. return self;},
  3571. args: ["aString"],
  3572. source: "compile: aString\x0a\x09<return self.compile(aString)>",
  3573. messageSends: [],
  3574. referencedClasses: []
  3575. }),
  3576. smalltalk.RegularExpression);
  3577. smalltalk.addMethod(
  3578. "_exec_",
  3579. smalltalk.method({
  3580. selector: "exec:",
  3581. category: 'evaluating',
  3582. fn: function (aString) {
  3583. var self=this;
  3584. return self.exec(aString) || nil;
  3585. return self;},
  3586. args: ["aString"],
  3587. source: "exec: aString\x0a\x09<return self.exec(aString) || nil>",
  3588. messageSends: [],
  3589. referencedClasses: []
  3590. }),
  3591. smalltalk.RegularExpression);
  3592. smalltalk.addMethod(
  3593. "_test_",
  3594. smalltalk.method({
  3595. selector: "test:",
  3596. category: 'evaluating',
  3597. fn: function (aString) {
  3598. var self=this;
  3599. return self.test(aString);
  3600. return self;},
  3601. args: ["aString"],
  3602. source: "test: aString\x0a\x09<return self.test(aString)>",
  3603. messageSends: [],
  3604. referencedClasses: []
  3605. }),
  3606. smalltalk.RegularExpression);
  3607. smalltalk.addMethod(
  3608. "_fromString_",
  3609. smalltalk.method({
  3610. selector: "fromString:",
  3611. category: 'instance creation',
  3612. fn: function (aString) {
  3613. var self=this;
  3614. return smalltalk.send(self, "_fromString_flag_", [aString, ""]);
  3615. return self;},
  3616. args: ["aString"],
  3617. source: "fromString: aString\x0a\x09 ^self fromString: aString flag: ''",
  3618. messageSends: ["fromString:flag:"],
  3619. referencedClasses: []
  3620. }),
  3621. smalltalk.RegularExpression.klass);
  3622. smalltalk.addMethod(
  3623. "_fromString_flag_",
  3624. smalltalk.method({
  3625. selector: "fromString:flag:",
  3626. category: 'instance creation',
  3627. fn: function (aString, anotherString) {
  3628. var self=this;
  3629. return new RegExp(aString, anotherString);
  3630. return self;},
  3631. args: ["aString", "anotherString"],
  3632. source: "fromString: aString flag: anotherString\x0a\x09<return new RegExp(aString, anotherString)>",
  3633. messageSends: [],
  3634. referencedClasses: []
  3635. }),
  3636. smalltalk.RegularExpression.klass);
  3637. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  3638. smalltalk.addMethod(
  3639. "_atEnd",
  3640. smalltalk.method({
  3641. selector: "atEnd",
  3642. category: 'testing',
  3643. fn: function () {
  3644. var self=this;
  3645. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [smalltalk.send(self, "_size", [])]);
  3646. return self;},
  3647. args: [],
  3648. source: "atEnd\x0a\x09^self position = self size",
  3649. messageSends: ["=", "position", "size"],
  3650. referencedClasses: []
  3651. }),
  3652. smalltalk.Stream);
  3653. smalltalk.addMethod(
  3654. "_atStart",
  3655. smalltalk.method({
  3656. selector: "atStart",
  3657. category: 'testing',
  3658. fn: function () {
  3659. var self=this;
  3660. return smalltalk.send(smalltalk.send(self, "_position", []), "__eq", [(0)]);
  3661. return self;},
  3662. args: [],
  3663. source: "atStart\x0a\x09^self position = 0",
  3664. messageSends: ["=", "position"],
  3665. referencedClasses: []
  3666. }),
  3667. smalltalk.Stream);
  3668. smalltalk.addMethod(
  3669. "_close",
  3670. smalltalk.method({
  3671. selector: "close",
  3672. category: 'actions',
  3673. fn: function () {
  3674. var self=this;
  3675. return self;},
  3676. args: [],
  3677. source: "close",
  3678. messageSends: [],
  3679. referencedClasses: []
  3680. }),
  3681. smalltalk.Stream);
  3682. smalltalk.addMethod(
  3683. "_collection",
  3684. smalltalk.method({
  3685. selector: "collection",
  3686. category: 'accessing',
  3687. fn: function () {
  3688. var self=this;
  3689. return self['@collection'];
  3690. return self;},
  3691. args: [],
  3692. source: "collection\x0a\x09^collection",
  3693. messageSends: [],
  3694. referencedClasses: []
  3695. }),
  3696. smalltalk.Stream);
  3697. smalltalk.addMethod(
  3698. "_contents",
  3699. smalltalk.method({
  3700. selector: "contents",
  3701. category: 'accessing',
  3702. fn: function () {
  3703. var self=this;
  3704. return smalltalk.send(smalltalk.send(self, "_collection", []), "_copyFrom_to_", [(1), smalltalk.send(self, "_streamSize", [])]);
  3705. return self;},
  3706. args: [],
  3707. source: "contents\x0a\x09^self collection\x0a\x09 copyFrom: 1 \x0a\x09 to: self streamSize",
  3708. messageSends: ["copyFrom:to:", "collection", "streamSize"],
  3709. referencedClasses: []
  3710. }),
  3711. smalltalk.Stream);
  3712. smalltalk.addMethod(
  3713. "_do_",
  3714. smalltalk.method({
  3715. selector: "do:",
  3716. category: 'enumerating',
  3717. fn: function (aBlock) {
  3718. var self=this;
  3719. (function(){while(!(function(){return smalltalk.send(self, "_atEnd", []);})()) {(function(){return smalltalk.send(aBlock, "_value_", [smalltalk.send(self, "_next", [])]);})()}})();
  3720. return self;},
  3721. args: ["aBlock"],
  3722. source: "do: aBlock\x0a\x09[self atEnd] whileFalse: [aBlock value: self next]",
  3723. messageSends: ["whileFalse:", "atEnd", "value:", "next"],
  3724. referencedClasses: []
  3725. }),
  3726. smalltalk.Stream);
  3727. smalltalk.addMethod(
  3728. "_flush",
  3729. smalltalk.method({
  3730. selector: "flush",
  3731. category: 'actions',
  3732. fn: function () {
  3733. var self=this;
  3734. return self;},
  3735. args: [],
  3736. source: "flush",
  3737. messageSends: [],
  3738. referencedClasses: []
  3739. }),
  3740. smalltalk.Stream);
  3741. smalltalk.addMethod(
  3742. "_isEmpty",
  3743. smalltalk.method({
  3744. selector: "isEmpty",
  3745. category: 'testing',
  3746. fn: function () {
  3747. var self=this;
  3748. return smalltalk.send(smalltalk.send(self, "_size", []), "__eq", [(0)]);
  3749. return self;},
  3750. args: [],
  3751. source: "isEmpty\x0a\x09^self size = 0",
  3752. messageSends: ["=", "size"],
  3753. referencedClasses: []
  3754. }),
  3755. smalltalk.Stream);
  3756. smalltalk.addMethod(
  3757. "_next",
  3758. smalltalk.method({
  3759. selector: "next",
  3760. category: 'reading',
  3761. fn: function () {
  3762. var self=this;
  3763. 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", [])]);})]));
  3764. return self;},
  3765. args: [],
  3766. 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]",
  3767. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"],
  3768. referencedClasses: []
  3769. }),
  3770. smalltalk.Stream);
  3771. smalltalk.addMethod(
  3772. "_next_",
  3773. smalltalk.method({
  3774. selector: "next:",
  3775. category: 'reading',
  3776. fn: function (anInteger) {
  3777. var self=this;
  3778. var tempCollection=nil;
  3779. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  3780. 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", [])]);})]));})]);
  3781. return tempCollection;
  3782. return self;},
  3783. args: ["anInteger"],
  3784. 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",
  3785. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"],
  3786. referencedClasses: []
  3787. }),
  3788. smalltalk.Stream);
  3789. smalltalk.addMethod(
  3790. "_nextPut_",
  3791. smalltalk.method({
  3792. selector: "nextPut:",
  3793. category: 'writing',
  3794. fn: function (anObject) {
  3795. var self=this;
  3796. smalltalk.send(self, "_position_", [((($receiver = smalltalk.send(self, "_position", [])).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]))]);
  3797. smalltalk.send(smalltalk.send(self, "_collection", []), "_at_put_", [smalltalk.send(self, "_position", []), anObject]);
  3798. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  3799. return self;},
  3800. args: ["anObject"],
  3801. 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)",
  3802. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"],
  3803. referencedClasses: []
  3804. }),
  3805. smalltalk.Stream);
  3806. smalltalk.addMethod(
  3807. "_nextPutAll_",
  3808. smalltalk.method({
  3809. selector: "nextPutAll:",
  3810. category: 'writing',
  3811. fn: function (aCollection) {
  3812. var self=this;
  3813. smalltalk.send(aCollection, "_do_", [(function(each){return smalltalk.send(self, "_nextPut_", [each]);})]);
  3814. return self;},
  3815. args: ["aCollection"],
  3816. source: "nextPutAll: aCollection\x0a\x09aCollection do: [:each |\x0a\x09 self nextPut: each]",
  3817. messageSends: ["do:", "nextPut:"],
  3818. referencedClasses: []
  3819. }),
  3820. smalltalk.Stream);
  3821. smalltalk.addMethod(
  3822. "_peek",
  3823. smalltalk.method({
  3824. selector: "peek",
  3825. category: 'reading',
  3826. fn: function () {
  3827. var self=this;
  3828. 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)]))]);})]));
  3829. return self;},
  3830. args: [],
  3831. source: "peek\x0a\x09^self atEnd ifFalse: [\x0a\x09 self collection at: self position + 1]",
  3832. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"],
  3833. referencedClasses: []
  3834. }),
  3835. smalltalk.Stream);
  3836. smalltalk.addMethod(
  3837. "_position",
  3838. smalltalk.method({
  3839. selector: "position",
  3840. category: 'accessing',
  3841. fn: function () {
  3842. var self=this;
  3843. return (($receiver = self['@position']) == nil || $receiver == undefined) ? (function(){return (self['@position']=(0));})() : $receiver;
  3844. return self;},
  3845. args: [],
  3846. source: "position\x0a\x09^position ifNil: [position := 0]",
  3847. messageSends: ["ifNil:"],
  3848. referencedClasses: []
  3849. }),
  3850. smalltalk.Stream);
  3851. smalltalk.addMethod(
  3852. "_position_",
  3853. smalltalk.method({
  3854. selector: "position:",
  3855. category: 'accessing',
  3856. fn: function (anInteger) {
  3857. var self=this;
  3858. (self['@position']=anInteger);
  3859. return self;},
  3860. args: ["anInteger"],
  3861. source: "position: anInteger\x0a\x09position := anInteger",
  3862. messageSends: [],
  3863. referencedClasses: []
  3864. }),
  3865. smalltalk.Stream);
  3866. smalltalk.addMethod(
  3867. "_reset",
  3868. smalltalk.method({
  3869. selector: "reset",
  3870. category: 'actions',
  3871. fn: function () {
  3872. var self=this;
  3873. smalltalk.send(self, "_position_", [(0)]);
  3874. return self;},
  3875. args: [],
  3876. source: "reset\x0a\x09self position: 0",
  3877. messageSends: ["position:"],
  3878. referencedClasses: []
  3879. }),
  3880. smalltalk.Stream);
  3881. smalltalk.addMethod(
  3882. "_resetContents",
  3883. smalltalk.method({
  3884. selector: "resetContents",
  3885. category: 'actions',
  3886. fn: function () {
  3887. var self=this;
  3888. smalltalk.send(self, "_reset", []);
  3889. smalltalk.send(self, "_setStreamSize_", [(0)]);
  3890. return self;},
  3891. args: [],
  3892. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  3893. messageSends: ["reset", "setStreamSize:"],
  3894. referencedClasses: []
  3895. }),
  3896. smalltalk.Stream);
  3897. smalltalk.addMethod(
  3898. "_setCollection_",
  3899. smalltalk.method({
  3900. selector: "setCollection:",
  3901. category: 'accessing',
  3902. fn: function (aCollection) {
  3903. var self=this;
  3904. (self['@collection']=aCollection);
  3905. return self;},
  3906. args: ["aCollection"],
  3907. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  3908. messageSends: [],
  3909. referencedClasses: []
  3910. }),
  3911. smalltalk.Stream);
  3912. smalltalk.addMethod(
  3913. "_setStreamSize_",
  3914. smalltalk.method({
  3915. selector: "setStreamSize:",
  3916. category: 'accessing',
  3917. fn: function (anInteger) {
  3918. var self=this;
  3919. (self['@streamSize']=anInteger);
  3920. return self;},
  3921. args: ["anInteger"],
  3922. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  3923. messageSends: [],
  3924. referencedClasses: []
  3925. }),
  3926. smalltalk.Stream);
  3927. smalltalk.addMethod(
  3928. "_setToEnd",
  3929. smalltalk.method({
  3930. selector: "setToEnd",
  3931. category: 'positioning',
  3932. fn: function () {
  3933. var self=this;
  3934. smalltalk.send(self, "_position_", [smalltalk.send(self, "_size", [])]);
  3935. return self;},
  3936. args: [],
  3937. source: "setToEnd\x0a\x09self position: self size",
  3938. messageSends: ["position:", "size"],
  3939. referencedClasses: []
  3940. }),
  3941. smalltalk.Stream);
  3942. smalltalk.addMethod(
  3943. "_size",
  3944. smalltalk.method({
  3945. selector: "size",
  3946. category: 'accessing',
  3947. fn: function () {
  3948. var self=this;
  3949. return smalltalk.send(self, "_streamSize", []);
  3950. return self;},
  3951. args: [],
  3952. source: "size\x0a\x09^self streamSize",
  3953. messageSends: ["streamSize"],
  3954. referencedClasses: []
  3955. }),
  3956. smalltalk.Stream);
  3957. smalltalk.addMethod(
  3958. "_skip_",
  3959. smalltalk.method({
  3960. selector: "skip:",
  3961. category: 'positioning',
  3962. fn: function (anInteger) {
  3963. var self=this;
  3964. 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)])]);
  3965. return self;},
  3966. args: ["anInteger"],
  3967. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  3968. messageSends: ["position:", "min:max:", "+", "position", "size"],
  3969. referencedClasses: []
  3970. }),
  3971. smalltalk.Stream);
  3972. smalltalk.addMethod(
  3973. "_streamSize",
  3974. smalltalk.method({
  3975. selector: "streamSize",
  3976. category: 'accessing',
  3977. fn: function () {
  3978. var self=this;
  3979. return self['@streamSize'];
  3980. return self;},
  3981. args: [],
  3982. source: "streamSize\x0a\x09^streamSize",
  3983. messageSends: [],
  3984. referencedClasses: []
  3985. }),
  3986. smalltalk.Stream);
  3987. smalltalk.addMethod(
  3988. "_on_",
  3989. smalltalk.method({
  3990. selector: "on:",
  3991. category: 'instance creation',
  3992. fn: function (aCollection) {
  3993. var self=this;
  3994. 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", []));
  3995. return self;},
  3996. args: ["aCollection"],
  3997. source: "on: aCollection\x0a\x09 ^self new \x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  3998. messageSends: ["setCollection:", "setStreamSize:", "size", "yourself", "new"],
  3999. referencedClasses: []
  4000. }),
  4001. smalltalk.Stream.klass);
  4002. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  4003. smalltalk.addMethod(
  4004. "_cr",
  4005. smalltalk.method({
  4006. selector: "cr",
  4007. category: 'writing',
  4008. fn: function () {
  4009. var self=this;
  4010. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
  4011. return self;},
  4012. args: [],
  4013. source: "cr\x0a\x09^self nextPutAll: String cr",
  4014. messageSends: ["nextPutAll:", "cr"],
  4015. referencedClasses: ["String"]
  4016. }),
  4017. smalltalk.StringStream);
  4018. smalltalk.addMethod(
  4019. "_crlf",
  4020. smalltalk.method({
  4021. selector: "crlf",
  4022. category: 'writing',
  4023. fn: function () {
  4024. var self=this;
  4025. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_crlf", [])]);
  4026. return self;},
  4027. args: [],
  4028. source: "crlf\x0a\x09^self nextPutAll: String crlf",
  4029. messageSends: ["nextPutAll:", "crlf"],
  4030. referencedClasses: ["String"]
  4031. }),
  4032. smalltalk.StringStream);
  4033. smalltalk.addMethod(
  4034. "_lf",
  4035. smalltalk.method({
  4036. selector: "lf",
  4037. category: 'writing',
  4038. fn: function () {
  4039. var self=this;
  4040. return smalltalk.send(self, "_nextPutAll_", [smalltalk.send((smalltalk.String || String), "_lf", [])]);
  4041. return self;},
  4042. args: [],
  4043. source: "lf\x0a\x09^self nextPutAll: String lf",
  4044. messageSends: ["nextPutAll:", "lf"],
  4045. referencedClasses: ["String"]
  4046. }),
  4047. smalltalk.StringStream);
  4048. smalltalk.addMethod(
  4049. "_next_",
  4050. smalltalk.method({
  4051. selector: "next:",
  4052. category: 'reading',
  4053. fn: function (anInteger) {
  4054. var self=this;
  4055. var tempCollection=nil;
  4056. (tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self, "_collection", []), "_class", []), "_new", []));
  4057. 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", [])]));})]));})]);
  4058. return tempCollection;
  4059. return self;},
  4060. args: ["anInteger"],
  4061. 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",
  4062. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"],
  4063. referencedClasses: []
  4064. }),
  4065. smalltalk.StringStream);
  4066. smalltalk.addMethod(
  4067. "_nextPut_",
  4068. smalltalk.method({
  4069. selector: "nextPut:",
  4070. category: 'writing',
  4071. fn: function (aString) {
  4072. var self=this;
  4073. smalltalk.send(self, "_nextPutAll_", [aString]);
  4074. return self;},
  4075. args: ["aString"],
  4076. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  4077. messageSends: ["nextPutAll:"],
  4078. referencedClasses: []
  4079. }),
  4080. smalltalk.StringStream);
  4081. smalltalk.addMethod(
  4082. "_nextPutAll_",
  4083. smalltalk.method({
  4084. selector: "nextPutAll:",
  4085. category: 'writing',
  4086. fn: function (aString) {
  4087. var self=this;
  4088. 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", [])])])]);
  4089. 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", [])]))]);
  4090. smalltalk.send(self, "_setStreamSize_", [smalltalk.send(smalltalk.send(self, "_streamSize", []), "_max_", [smalltalk.send(self, "_position", [])])]);
  4091. return self;},
  4092. args: ["aString"],
  4093. 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)",
  4094. messageSends: ["setCollection:", ",", "copyFrom:to:", "collection", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"],
  4095. referencedClasses: []
  4096. }),
  4097. smalltalk.StringStream);
  4098. smalltalk.addMethod(
  4099. "_space",
  4100. smalltalk.method({
  4101. selector: "space",
  4102. category: 'writing',
  4103. fn: function () {
  4104. var self=this;
  4105. smalltalk.send(self, "_nextPut_", [" "]);
  4106. return self;},
  4107. args: [],
  4108. source: "space\x0a\x09self nextPut: ' '",
  4109. messageSends: ["nextPut:"],
  4110. referencedClasses: []
  4111. }),
  4112. smalltalk.StringStream);