Kernel-Collections.deploy.js 103 KB

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