Kernel-Collections.deploy.js 95 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911
  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($ctx) { var $1;
  10. $1=_st(_st(_st(self)._class()).__eq(_st(anAssociation)._class()))._and_((function(){
  11. return _st(_st(_st(self)._key()).__eq(_st(anAssociation)._key()))._and_((function(){
  12. 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  46. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  47. 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { _st(aCollection)._do_((function(each){
  134. 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($ctx) { 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($ctx) { var $1;
  159. $1=_st(_st(self)._asArray())._collect_((function(each){
  160. 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  197. var stream;
  198. stream=_st(_st(_st(self)._class())._new())._writeStream();
  199. _st(self)._do_((function(each){
  200. return _st(stream)._nextPut_(_st(aBlock)._value_(each));
  201. }));
  202. $1=_st(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($ctx) { 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($ctx) { 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($ctx) { var $1;
  244. $1=_st(self)._reject_((function(each){
  245. 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($ctx) { var $1;
  258. $1=_st(self)._detect_ifNone_(aBlock,(function(){
  259. 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($ctx) {
  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($ctx) { 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($ctx) { var first;
  299. first=true;
  300. _st(self)._do_((function(each){
  301. if(smalltalk.assert(first)){
  302. first=false;
  303. 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) {
  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($ctx) { var result;
  375. result=anObject;
  376. _st(self)._do_((function(each){
  377. result=_st(aBlock)._value_value_(result,each);
  378. return result;
  379. }));
  380. return 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($ctx) { var $1,$2;
  391. var set;
  392. var outputSet;
  393. set=_st(self)._asSet();
  394. outputSet=_st((smalltalk.Set || Set))._new();
  395. _st(aCollection)._do_((function(each){
  396. $1=_st(_st(set)._includes_(each))._and_((function(){
  397. return _st(_st(outputSet)._includes_(each))._not();
  398. }));
  399. if(smalltalk.assert($1)){
  400. return _st(outputSet)._add_(each);
  401. };
  402. }));
  403. $2=_st(_st(self)._class())._withAll_(_st(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($ctx) { 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($ctx) { 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($ctx) { var $1;
  439. var tally;
  440. tally=(0);
  441. _st(self)._do_((function(each){
  442. $1=_st(anObject).__eq(each);
  443. if(smalltalk.assert($1)){
  444. tally=_st(tally).__plus((1));
  445. return tally;
  446. };
  447. }));
  448. return 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($ctx) { var $1;
  459. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  460. _st(aStream)._nextPutAll_(_st(smalltalk.Object.fn.prototype._printString.apply(_st(self), [])).__comma(" ("));
  461. _st(self)._do_separatedBy_((function(each){
  462. return _st(aStream)._nextPutAll_(_st(each)._printString());
  463. }),(function(){
  464. 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($ctx) { 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($ctx) { var $1;
  491. $1=_st(self)._select_((function(each){
  492. 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($ctx) { var $1;
  505. $1=_st(self)._remove_ifAbsent_(anObject,(function(){
  506. 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($ctx) { _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($ctx) { var $1,$2;
  529. var stream;
  530. stream=_st(_st(_st(self)._class())._new())._writeStream();
  531. _st(self)._do_((function(each){
  532. $1=_st(aBlock)._value_(each);
  533. if(smalltalk.assert($1)){
  534. return _st(stream)._nextPut_(each);
  535. };
  536. }));
  537. $2=_st(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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { var c;
  744. c=_st(_st(self)._class())._new();
  745. _st(self)._keysAndValuesDo_((function(key,value){
  746. return _st(c)._at_put_(key,_st(value)._asJSON());
  747. }));
  748. return 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($ctx) { var associations;
  759. associations=[];
  760. _st(_st(self)._keys())._do_((function(each){
  761. return _st(associations)._add_(_st((smalltalk.Association || Association))._key_value_(each,_st(self)._at_(each)));
  762. }));
  763. return 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($ctx) { _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($ctx) { var $1;
  784. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  785. 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($ctx) { var $2,$1;
  798. $2=_st(self)._includesKey_(aKey);
  799. $1=_st($2)._ifTrue_ifFalse_((function(){
  800. 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($ctx) { var $1;
  813. $1=_st(self)._at_ifAbsent_(aKey,(function(){
  814. 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($ctx) { 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($ctx) { var $2,$1;
  844. $2=_st(self)._includesKey_(aKey);
  845. $1=_st($2)._ifTrue_ifFalse_((function(){
  846. 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($ctx) { 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($ctx) { var newDict;
  871. newDict=_st(_st(self)._class())._new();
  872. _st(self)._keysAndValuesDo_((function(key,value){
  873. return _st(newDict)._at_put_(key,_st(aBlock)._value_(value));
  874. }));
  875. return 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($ctx) { _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($ctx) { var copy;
  896. copy=_st(_st(self)._class())._new();
  897. _st(self)._associationsDo_((function(each){
  898. return _st(copy)._at_put_(_st(each)._key(),_st(_st(each)._value())._deepCopy());
  899. }));
  900. return 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($ctx) { 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) {
  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($ctx) { _st(self)._associationsDo_((function(each){
  976. 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($ctx) { var $1;
  988. $1=_st((smalltalk.String || String))._streamContents_((function(aStream){
  989. _st(aStream)._nextPutAll_(_st(_st("a ").__comma(_st(_st(self)._class())._name())).__comma("("));
  990. _st(_st(self)._associations())._do_separatedBy_((function(each){
  991. return _st(each)._storeOn_(aStream);
  992. }),(function(){
  993. 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  1049. var newDict;
  1050. newDict=_st(_st(self)._class())._new();
  1051. _st(self)._keysAndValuesDo_((function(key,value){
  1052. $1=_st(aBlock)._value_(value);
  1053. if(smalltalk.assert($1)){
  1054. return _st(newDict)._at_put_(key,value);
  1055. };
  1056. }));
  1057. return 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($ctx) { var copy;
  1068. copy=_st(_st(self)._class())._new();
  1069. _st(self)._associationsDo_((function(each){
  1070. return _st(copy)._at_put_(_st(each)._key(),_st(each)._value());
  1071. }));
  1072. return 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($ctx) { 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($ctx) { _st(aStream)._nextPutAll_("#{");
  1095. _st(_st(self)._associations())._do_separatedBy_((function(each){
  1096. return _st(each)._storeOn_(aStream);
  1097. }),(function(){
  1098. 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($ctx) { var $1;
  1111. $1=_st(_st(self)._keys())._collect_((function(each){
  1112. 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($ctx) { var dict;
  1125. dict=_st(self)._new();
  1126. _st(aCollection)._do_((function(each){
  1127. return _st(dict)._add_(each);
  1128. }));
  1129. return 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($ctx) { 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($ctx) { 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($ctx) {
  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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) { var $1;
  1230. $1=_st(_st(_st(self)._associations())._detect_ifNone_((function(k,v){
  1231. return _st(v).__eq_eq(anObject);
  1232. }),(function(){
  1233. 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($ctx) { 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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) { var $1,$2;
  1304. var $early={};
  1305. try {
  1306. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  1307. 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. $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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { var $1;
  1365. $1=_st(self)._at_ifAbsent_(anIndex,(function(){
  1366. 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($ctx) { _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($ctx) { _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($ctx) { 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($ctx) { var range;
  1411. var newCollection;
  1412. range=_st(anIndex)._to_(anotherIndex);
  1413. newCollection=_st(_st(self)._class())._new_(_st(range)._size());
  1414. _st(range)._withIndexDo_((function(each,i){
  1415. return _st(newCollection)._at_put_(i,_st(self)._at_(each));
  1416. }));
  1417. return 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($ctx) { var newCollection;
  1428. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  1429. _st(self)._withIndexDo_((function(each,index){
  1430. return _st(newCollection)._at_put_(index,_st(each)._deepCopy());
  1431. }));
  1432. return 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  1479. $1=_st(self)._indexOf_ifAbsent_(anObject,(function(){
  1480. 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($ctx) {
  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($ctx) { var $1;
  1509. $1=_st(self)._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  1510. 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($ctx) {
  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($ctx) { 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($ctx) { _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($ctx) { _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($ctx) { 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($ctx) { var newCollection;
  1583. newCollection=_st(_st(self)._class())._new_(_st(self)._size());
  1584. _st(self)._withIndexDo_((function(each,index){
  1585. return _st(newCollection)._at_put_(index,each);
  1586. }));
  1587. return 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  1633. $1=_st(_st("[").__comma(_st(_st(self)._collect_((function(each){
  1634. 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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { var instance;
  1845. var index;
  1846. index=(1);
  1847. instance=_st(self)._new_(_st(aCollection)._size());
  1848. _st(aCollection)._do_((function(each){
  1849. _st(instance)._at_put_(index,each);
  1850. index=_st(index).__plus((1));
  1851. return index;
  1852. }));
  1853. return 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($ctx) { 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { _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($ctx) { 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($ctx) { _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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  2275. $1=_st((smalltalk.String || String))._streamContents_((function(stream){
  2276. return _st(aCollection)._do_separatedBy_((function(each){
  2277. return _st(stream)._nextPutAll_(_st(each)._asString());
  2278. }),(function(){
  2279. 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($ctx) { var $1,$2,$3;
  2293. var $early={};
  2294. try {
  2295. var cr;
  2296. var lf;
  2297. var start;
  2298. var sz;
  2299. var nextLF;
  2300. var nextCR;
  2301. start=(1);
  2302. sz=_st(self)._size();
  2303. cr=_st((smalltalk.String || String))._cr();
  2304. nextCR=_st(self)._indexOf_startingAt_(cr,(1));
  2305. lf=_st((smalltalk.String || String))._lf();
  2306. nextLF=_st(self)._indexOf_startingAt_(lf,(1));
  2307. _st((function(){
  2308. return _st(start).__lt_eq(sz);
  2309. }))._whileTrue_((function(){
  2310. $1=_st(_st(nextLF).__eq((0)))._and_((function(){
  2311. return _st(nextCR).__eq((0));
  2312. }));
  2313. if(smalltalk.assert($1)){
  2314. _st(aBlock)._value_value_value_(start,sz,sz);
  2315. throw $early=[self];
  2316. };
  2317. $2=_st(_st(nextCR).__eq((0)))._or_((function(){
  2318. return _st(_st((0)).__lt(nextLF))._and_((function(){
  2319. return _st(nextLF).__lt(nextCR);
  2320. }));
  2321. }));
  2322. if(smalltalk.assert($2)){
  2323. _st(aBlock)._value_value_value_(start,_st(nextLF).__minus((1)),nextLF);
  2324. start=_st((1)).__plus(nextLF);
  2325. start;
  2326. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  2327. return nextLF;
  2328. } else {
  2329. $3=_st(_st((1)).__plus(nextCR)).__eq(nextLF);
  2330. if(smalltalk.assert($3)){
  2331. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextLF);
  2332. start=_st((1)).__plus(nextLF);
  2333. start;
  2334. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  2335. nextCR;
  2336. nextLF=_st(self)._indexOf_startingAt_(lf,start);
  2337. return nextLF;
  2338. } else {
  2339. _st(aBlock)._value_value_value_(start,_st(nextCR).__minus((1)),nextCR);
  2340. start=_st((1)).__plus(nextCR);
  2341. start;
  2342. nextCR=_st(self)._indexOf_startingAt_(cr,start);
  2343. return 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($ctx) { var $1,$2;
  2359. var $early={};
  2360. try {
  2361. var lineCount;
  2362. lineCount=(0);
  2363. _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  2364. lineCount=_st(lineCount).__plus((1));
  2365. $1=_st(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($ctx) { var lines;
  2384. lines=_st((smalltalk.Array || Array))._new();
  2385. _st(self)._linesDo_((function(aLine){
  2386. return _st(lines)._add_(aLine);
  2387. }));
  2388. return 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($ctx) { _st(self)._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  2399. 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { var $1;
  2694. var stream;
  2695. stream=_st(_st(self)._streamClass())._on_(_st((smalltalk.String || String))._new());
  2696. _st(blockWithArg)._value_(stream);
  2697. $1=_st(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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { var $1;
  3045. $1=_st(_st(_st(self)._class()).__eq(_st(aCollection)._class()))._and_((function(){
  3046. 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($ctx) {
  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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { 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($ctx) { 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($ctx) { _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($ctx) { var $1;
  3146. var collection;
  3147. collection=_st(_st(self)._class())._new();
  3148. _st(self)._do_((function(each){
  3149. $1=_st(aBlock)._value_(each);
  3150. if(smalltalk.assert($1)){
  3151. return _st(collection)._add_(each);
  3152. };
  3153. }));
  3154. return 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($ctx) { var $1;
  3165. $1=_st(self["@elements"])._size();
  3166. return $1;
  3167. }, self, "size", [], smalltalk.Set)}
  3168. }),
  3169. smalltalk.Set);
  3170. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  3171. smalltalk.addMethod(
  3172. "_compile_",
  3173. smalltalk.method({
  3174. selector: "compile:",
  3175. fn: function (aString){
  3176. var self=this;
  3177. return smalltalk.withContext(function($ctx) { return self.compile(aString);
  3178. ;
  3179. return self}, self, "compile:", [aString], smalltalk.RegularExpression)}
  3180. }),
  3181. smalltalk.RegularExpression);
  3182. smalltalk.addMethod(
  3183. "_exec_",
  3184. smalltalk.method({
  3185. selector: "exec:",
  3186. fn: function (aString){
  3187. var self=this;
  3188. return smalltalk.withContext(function($ctx) { return self.exec(aString) || nil;
  3189. ;
  3190. return self}, self, "exec:", [aString], smalltalk.RegularExpression)}
  3191. }),
  3192. smalltalk.RegularExpression);
  3193. smalltalk.addMethod(
  3194. "_test_",
  3195. smalltalk.method({
  3196. selector: "test:",
  3197. fn: function (aString){
  3198. var self=this;
  3199. return smalltalk.withContext(function($ctx) { return self.test(aString);
  3200. ;
  3201. return self}, self, "test:", [aString], smalltalk.RegularExpression)}
  3202. }),
  3203. smalltalk.RegularExpression);
  3204. smalltalk.addMethod(
  3205. "_fromString_",
  3206. smalltalk.method({
  3207. selector: "fromString:",
  3208. fn: function (aString){
  3209. var self=this;
  3210. return smalltalk.withContext(function($ctx) { var $1;
  3211. $1=_st(self)._fromString_flag_(aString,"");
  3212. return $1;
  3213. }, self, "fromString:", [aString], smalltalk.RegularExpression.klass)}
  3214. }),
  3215. smalltalk.RegularExpression.klass);
  3216. smalltalk.addMethod(
  3217. "_fromString_flag_",
  3218. smalltalk.method({
  3219. selector: "fromString:flag:",
  3220. fn: function (aString,anotherString){
  3221. var self=this;
  3222. return smalltalk.withContext(function($ctx) { return new RegExp(aString, anotherString);
  3223. ;
  3224. return self}, self, "fromString:flag:", [aString,anotherString], smalltalk.RegularExpression.klass)}
  3225. }),
  3226. smalltalk.RegularExpression.klass);
  3227. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  3228. smalltalk.addMethod(
  3229. "_atEnd",
  3230. smalltalk.method({
  3231. selector: "atEnd",
  3232. fn: function (){
  3233. var self=this;
  3234. return smalltalk.withContext(function($ctx) { var $1;
  3235. $1=_st(_st(self)._position()).__eq(_st(self)._size());
  3236. return $1;
  3237. }, self, "atEnd", [], smalltalk.Stream)}
  3238. }),
  3239. smalltalk.Stream);
  3240. smalltalk.addMethod(
  3241. "_atStart",
  3242. smalltalk.method({
  3243. selector: "atStart",
  3244. fn: function (){
  3245. var self=this;
  3246. return smalltalk.withContext(function($ctx) { var $1;
  3247. $1=_st(_st(self)._position()).__eq((0));
  3248. return $1;
  3249. }, self, "atStart", [], smalltalk.Stream)}
  3250. }),
  3251. smalltalk.Stream);
  3252. smalltalk.addMethod(
  3253. "_close",
  3254. smalltalk.method({
  3255. selector: "close",
  3256. fn: function (){
  3257. var self=this;
  3258. return smalltalk.withContext(function($ctx) { return self}, self, "close", [], smalltalk.Stream)}
  3259. }),
  3260. smalltalk.Stream);
  3261. smalltalk.addMethod(
  3262. "_collection",
  3263. smalltalk.method({
  3264. selector: "collection",
  3265. fn: function (){
  3266. var self=this;
  3267. return smalltalk.withContext(function($ctx) { return self["@collection"];
  3268. }, self, "collection", [], smalltalk.Stream)}
  3269. }),
  3270. smalltalk.Stream);
  3271. smalltalk.addMethod(
  3272. "_contents",
  3273. smalltalk.method({
  3274. selector: "contents",
  3275. fn: function (){
  3276. var self=this;
  3277. return smalltalk.withContext(function($ctx) { var $1;
  3278. $1=_st(_st(self)._collection())._copyFrom_to_((1),_st(self)._streamSize());
  3279. return $1;
  3280. }, self, "contents", [], smalltalk.Stream)}
  3281. }),
  3282. smalltalk.Stream);
  3283. smalltalk.addMethod(
  3284. "_do_",
  3285. smalltalk.method({
  3286. selector: "do:",
  3287. fn: function (aBlock){
  3288. var self=this;
  3289. return smalltalk.withContext(function($ctx) { _st((function(){
  3290. return _st(self)._atEnd();
  3291. }))._whileFalse_((function(){
  3292. return _st(aBlock)._value_(_st(self)._next());
  3293. }));
  3294. return self}, self, "do:", [aBlock], smalltalk.Stream)}
  3295. }),
  3296. smalltalk.Stream);
  3297. smalltalk.addMethod(
  3298. "_flush",
  3299. smalltalk.method({
  3300. selector: "flush",
  3301. fn: function (){
  3302. var self=this;
  3303. return smalltalk.withContext(function($ctx) { return self}, self, "flush", [], smalltalk.Stream)}
  3304. }),
  3305. smalltalk.Stream);
  3306. smalltalk.addMethod(
  3307. "_isEmpty",
  3308. smalltalk.method({
  3309. selector: "isEmpty",
  3310. fn: function (){
  3311. var self=this;
  3312. return smalltalk.withContext(function($ctx) { var $1;
  3313. $1=_st(_st(self)._size()).__eq((0));
  3314. return $1;
  3315. }, self, "isEmpty", [], smalltalk.Stream)}
  3316. }),
  3317. smalltalk.Stream);
  3318. smalltalk.addMethod(
  3319. "_next",
  3320. smalltalk.method({
  3321. selector: "next",
  3322. fn: function (){
  3323. var self=this;
  3324. return smalltalk.withContext(function($ctx) { var $2,$1;
  3325. $2=_st(self)._atEnd();
  3326. if(smalltalk.assert($2)){
  3327. $1=nil;
  3328. } else {
  3329. _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  3330. $1=_st(self["@collection"])._at_(_st(self)._position());
  3331. };
  3332. return $1;
  3333. }, self, "next", [], smalltalk.Stream)}
  3334. }),
  3335. smalltalk.Stream);
  3336. smalltalk.addMethod(
  3337. "_next_",
  3338. smalltalk.method({
  3339. selector: "next:",
  3340. fn: function (anInteger){
  3341. var self=this;
  3342. return smalltalk.withContext(function($ctx) { var $1;
  3343. var tempCollection;
  3344. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  3345. _st(anInteger)._timesRepeat_((function(){
  3346. $1=_st(self)._atEnd();
  3347. if(! smalltalk.assert($1)){
  3348. return _st(tempCollection)._add_(_st(self)._next());
  3349. };
  3350. }));
  3351. return tempCollection;
  3352. }, self, "next:", [anInteger], smalltalk.Stream)}
  3353. }),
  3354. smalltalk.Stream);
  3355. smalltalk.addMethod(
  3356. "_nextPut_",
  3357. smalltalk.method({
  3358. selector: "nextPut:",
  3359. fn: function (anObject){
  3360. var self=this;
  3361. return smalltalk.withContext(function($ctx) { _st(self)._position_(_st(_st(self)._position()).__plus((1)));
  3362. _st(_st(self)._collection())._at_put_(_st(self)._position(),anObject);
  3363. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  3364. return self}, self, "nextPut:", [anObject], smalltalk.Stream)}
  3365. }),
  3366. smalltalk.Stream);
  3367. smalltalk.addMethod(
  3368. "_nextPutAll_",
  3369. smalltalk.method({
  3370. selector: "nextPutAll:",
  3371. fn: function (aCollection){
  3372. var self=this;
  3373. return smalltalk.withContext(function($ctx) { _st(aCollection)._do_((function(each){
  3374. return _st(self)._nextPut_(each);
  3375. }));
  3376. return self}, self, "nextPutAll:", [aCollection], smalltalk.Stream)}
  3377. }),
  3378. smalltalk.Stream);
  3379. smalltalk.addMethod(
  3380. "_peek",
  3381. smalltalk.method({
  3382. selector: "peek",
  3383. fn: function (){
  3384. var self=this;
  3385. return smalltalk.withContext(function($ctx) { var $2,$1;
  3386. $2=_st(self)._atEnd();
  3387. if(! smalltalk.assert($2)){
  3388. $1=_st(_st(self)._collection())._at_(_st(_st(self)._position()).__plus((1)));
  3389. };
  3390. return $1;
  3391. }, self, "peek", [], smalltalk.Stream)}
  3392. }),
  3393. smalltalk.Stream);
  3394. smalltalk.addMethod(
  3395. "_position",
  3396. smalltalk.method({
  3397. selector: "position",
  3398. fn: function (){
  3399. var self=this;
  3400. return smalltalk.withContext(function($ctx) { var $1;
  3401. if(($receiver = self["@position"]) == nil || $receiver == undefined){
  3402. self["@position"]=(0);
  3403. $1=self["@position"];
  3404. } else {
  3405. $1=self["@position"];
  3406. };
  3407. return $1;
  3408. }, self, "position", [], smalltalk.Stream)}
  3409. }),
  3410. smalltalk.Stream);
  3411. smalltalk.addMethod(
  3412. "_position_",
  3413. smalltalk.method({
  3414. selector: "position:",
  3415. fn: function (anInteger){
  3416. var self=this;
  3417. return smalltalk.withContext(function($ctx) { self["@position"]=anInteger;
  3418. return self}, self, "position:", [anInteger], smalltalk.Stream)}
  3419. }),
  3420. smalltalk.Stream);
  3421. smalltalk.addMethod(
  3422. "_reset",
  3423. smalltalk.method({
  3424. selector: "reset",
  3425. fn: function (){
  3426. var self=this;
  3427. return smalltalk.withContext(function($ctx) { _st(self)._position_((0));
  3428. return self}, self, "reset", [], smalltalk.Stream)}
  3429. }),
  3430. smalltalk.Stream);
  3431. smalltalk.addMethod(
  3432. "_resetContents",
  3433. smalltalk.method({
  3434. selector: "resetContents",
  3435. fn: function (){
  3436. var self=this;
  3437. return smalltalk.withContext(function($ctx) { _st(self)._reset();
  3438. _st(self)._setStreamSize_((0));
  3439. return self}, self, "resetContents", [], smalltalk.Stream)}
  3440. }),
  3441. smalltalk.Stream);
  3442. smalltalk.addMethod(
  3443. "_setCollection_",
  3444. smalltalk.method({
  3445. selector: "setCollection:",
  3446. fn: function (aCollection){
  3447. var self=this;
  3448. return smalltalk.withContext(function($ctx) { self["@collection"]=aCollection;
  3449. return self}, self, "setCollection:", [aCollection], smalltalk.Stream)}
  3450. }),
  3451. smalltalk.Stream);
  3452. smalltalk.addMethod(
  3453. "_setStreamSize_",
  3454. smalltalk.method({
  3455. selector: "setStreamSize:",
  3456. fn: function (anInteger){
  3457. var self=this;
  3458. return smalltalk.withContext(function($ctx) { self["@streamSize"]=anInteger;
  3459. return self}, self, "setStreamSize:", [anInteger], smalltalk.Stream)}
  3460. }),
  3461. smalltalk.Stream);
  3462. smalltalk.addMethod(
  3463. "_setToEnd",
  3464. smalltalk.method({
  3465. selector: "setToEnd",
  3466. fn: function (){
  3467. var self=this;
  3468. return smalltalk.withContext(function($ctx) { _st(self)._position_(_st(self)._size());
  3469. return self}, self, "setToEnd", [], smalltalk.Stream)}
  3470. }),
  3471. smalltalk.Stream);
  3472. smalltalk.addMethod(
  3473. "_size",
  3474. smalltalk.method({
  3475. selector: "size",
  3476. fn: function (){
  3477. var self=this;
  3478. return smalltalk.withContext(function($ctx) { var $1;
  3479. $1=_st(self)._streamSize();
  3480. return $1;
  3481. }, self, "size", [], smalltalk.Stream)}
  3482. }),
  3483. smalltalk.Stream);
  3484. smalltalk.addMethod(
  3485. "_skip_",
  3486. smalltalk.method({
  3487. selector: "skip:",
  3488. fn: function (anInteger){
  3489. var self=this;
  3490. return smalltalk.withContext(function($ctx) { _st(self)._position_(_st(_st(_st(self)._position()).__plus(anInteger))._min_max_(_st(self)._size(),(0)));
  3491. return self}, self, "skip:", [anInteger], smalltalk.Stream)}
  3492. }),
  3493. smalltalk.Stream);
  3494. smalltalk.addMethod(
  3495. "_streamSize",
  3496. smalltalk.method({
  3497. selector: "streamSize",
  3498. fn: function (){
  3499. var self=this;
  3500. return smalltalk.withContext(function($ctx) { return self["@streamSize"];
  3501. }, self, "streamSize", [], smalltalk.Stream)}
  3502. }),
  3503. smalltalk.Stream);
  3504. smalltalk.addMethod(
  3505. "_on_",
  3506. smalltalk.method({
  3507. selector: "on:",
  3508. fn: function (aCollection){
  3509. var self=this;
  3510. return smalltalk.withContext(function($ctx) { var $2,$3,$1;
  3511. $2=_st(self)._new();
  3512. _st($2)._setCollection_(aCollection);
  3513. _st($2)._setStreamSize_(_st(aCollection)._size());
  3514. $3=_st($2)._yourself();
  3515. $1=$3;
  3516. return $1;
  3517. }, self, "on:", [aCollection], smalltalk.Stream.klass)}
  3518. }),
  3519. smalltalk.Stream.klass);
  3520. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  3521. smalltalk.addMethod(
  3522. "_cr",
  3523. smalltalk.method({
  3524. selector: "cr",
  3525. fn: function (){
  3526. var self=this;
  3527. return smalltalk.withContext(function($ctx) { var $1;
  3528. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._cr());
  3529. return $1;
  3530. }, self, "cr", [], smalltalk.StringStream)}
  3531. }),
  3532. smalltalk.StringStream);
  3533. smalltalk.addMethod(
  3534. "_crlf",
  3535. smalltalk.method({
  3536. selector: "crlf",
  3537. fn: function (){
  3538. var self=this;
  3539. return smalltalk.withContext(function($ctx) { var $1;
  3540. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._crlf());
  3541. return $1;
  3542. }, self, "crlf", [], smalltalk.StringStream)}
  3543. }),
  3544. smalltalk.StringStream);
  3545. smalltalk.addMethod(
  3546. "_lf",
  3547. smalltalk.method({
  3548. selector: "lf",
  3549. fn: function (){
  3550. var self=this;
  3551. return smalltalk.withContext(function($ctx) { var $1;
  3552. $1=_st(self)._nextPutAll_(_st((smalltalk.String || String))._lf());
  3553. return $1;
  3554. }, self, "lf", [], smalltalk.StringStream)}
  3555. }),
  3556. smalltalk.StringStream);
  3557. smalltalk.addMethod(
  3558. "_next_",
  3559. smalltalk.method({
  3560. selector: "next:",
  3561. fn: function (anInteger){
  3562. var self=this;
  3563. return smalltalk.withContext(function($ctx) { var $1;
  3564. var tempCollection;
  3565. tempCollection=_st(_st(_st(self)._collection())._class())._new();
  3566. _st(anInteger)._timesRepeat_((function(){
  3567. $1=_st(self)._atEnd();
  3568. if(! smalltalk.assert($1)){
  3569. tempCollection=_st(tempCollection).__comma(_st(self)._next());
  3570. return tempCollection;
  3571. };
  3572. }));
  3573. return tempCollection;
  3574. }, self, "next:", [anInteger], smalltalk.StringStream)}
  3575. }),
  3576. smalltalk.StringStream);
  3577. smalltalk.addMethod(
  3578. "_nextPut_",
  3579. smalltalk.method({
  3580. selector: "nextPut:",
  3581. fn: function (aString){
  3582. var self=this;
  3583. return smalltalk.withContext(function($ctx) { _st(self)._nextPutAll_(aString);
  3584. return self}, self, "nextPut:", [aString], smalltalk.StringStream)}
  3585. }),
  3586. smalltalk.StringStream);
  3587. smalltalk.addMethod(
  3588. "_nextPutAll_",
  3589. smalltalk.method({
  3590. selector: "nextPutAll:",
  3591. fn: function (aString){
  3592. var self=this;
  3593. return smalltalk.withContext(function($ctx) { _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())));
  3594. _st(self)._position_(_st(_st(self)._position()).__plus(_st(aString)._size()));
  3595. _st(self)._setStreamSize_(_st(_st(self)._streamSize())._max_(_st(self)._position()));
  3596. return self}, self, "nextPutAll:", [aString], smalltalk.StringStream)}
  3597. }),
  3598. smalltalk.StringStream);
  3599. smalltalk.addMethod(
  3600. "_space",
  3601. smalltalk.method({
  3602. selector: "space",
  3603. fn: function (){
  3604. var self=this;
  3605. return smalltalk.withContext(function($ctx) { _st(self)._nextPut_(" ");
  3606. return self}, self, "space", [], smalltalk.StringStream)}
  3607. }),
  3608. smalltalk.StringStream);