2
0

Kernel-Collections.deploy.js 75 KB

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