1
0

Kernel-Collections.deploy.js 75 KB

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