2
0

Kernel-Collections.deploy.js 76 KB

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