Kernel-Collections.deploy.js 78 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992
  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. "_keyAtValue_",
  1220. smalltalk.method({
  1221. selector: "keyAtValue:",
  1222. fn: function (anObject){
  1223. var self=this;
  1224. var $1;
  1225. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_associations",[]),"_detect_ifNone_",[(function(k,v){
  1226. return smalltalk.send(v,"__eq_eq",[anObject]);
  1227. }),(function(){
  1228. return smalltalk.send(self,"_error_",["Not found"]);
  1229. })]),"_key",[]);
  1230. return $1;
  1231. }
  1232. }),
  1233. smalltalk.Dictionary);
  1234. smalltalk.addMethod(
  1235. "_keys",
  1236. smalltalk.method({
  1237. selector: "keys",
  1238. fn: function (){
  1239. var self=this;
  1240. var $1;
  1241. $1=smalltalk.send(self["@keys"],"_copy",[]);
  1242. return $1;
  1243. }
  1244. }),
  1245. smalltalk.Dictionary);
  1246. smalltalk.addMethod(
  1247. "_removeKey_ifAbsent_",
  1248. smalltalk.method({
  1249. selector: "removeKey:ifAbsent:",
  1250. fn: function (aKey,aBlock){
  1251. var self=this;
  1252. var index = self['@keys'].indexOf(aKey);
  1253. if(index === -1) {
  1254. return aBlock()
  1255. } else {
  1256. var value;
  1257. self['@keys'].splice(index, 1);
  1258. value = self['@values'].splice(index, 1);
  1259. return value[0];
  1260. };
  1261. ;
  1262. ;
  1263. return self}
  1264. }),
  1265. smalltalk.Dictionary);
  1266. smalltalk.addMethod(
  1267. "_valueAt_",
  1268. smalltalk.method({
  1269. selector: "valueAt:",
  1270. fn: function (anObject){
  1271. var self=this;
  1272. var $1;
  1273. $1=smalltalk.send(self,"_associationsDo_",[(2)]);
  1274. return $1;
  1275. }
  1276. }),
  1277. smalltalk.Dictionary);
  1278. smalltalk.addMethod(
  1279. "_values",
  1280. smalltalk.method({
  1281. selector: "values",
  1282. fn: function (){
  1283. var self=this;
  1284. var $1;
  1285. $1=smalltalk.send(self["@values"],"_copy",[]);
  1286. return $1;
  1287. }
  1288. }),
  1289. smalltalk.Dictionary);
  1290. smalltalk.addClass('SequenceableCollection', smalltalk.Collection, [], 'Kernel-Collections');
  1291. smalltalk.addMethod(
  1292. "__eq",
  1293. smalltalk.method({
  1294. selector: "=",
  1295. fn: function (aCollection){
  1296. var self=this;
  1297. var $1,$2;
  1298. var $early={};
  1299. try {
  1300. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  1301. return smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[smalltalk.send(aCollection,"_size",[])]);
  1302. })]);
  1303. if(! smalltalk.assert($1)){
  1304. return false;
  1305. };
  1306. smalltalk.send(self,"_withIndexDo_",[(function(each,i){
  1307. $2=smalltalk.send(smalltalk.send(aCollection,"_at_",[i]),"__eq",[each]);
  1308. if(! smalltalk.assert($2)){
  1309. throw $early=[false];
  1310. };
  1311. })]);
  1312. return true;
  1313. }
  1314. catch(e) {if(e===$early)return e[0]; throw e}
  1315. }
  1316. }),
  1317. smalltalk.SequenceableCollection);
  1318. smalltalk.addMethod(
  1319. "_addLast_",
  1320. smalltalk.method({
  1321. selector: "addLast:",
  1322. fn: function (anObject){
  1323. var self=this;
  1324. smalltalk.send(self,"_add_",[anObject]);
  1325. return self}
  1326. }),
  1327. smalltalk.SequenceableCollection);
  1328. smalltalk.addMethod(
  1329. "_allButFirst",
  1330. smalltalk.method({
  1331. selector: "allButFirst",
  1332. fn: function (){
  1333. var self=this;
  1334. var $1;
  1335. $1=smalltalk.send(self,"_copyFrom_to_",[(2),smalltalk.send(self,"_size",[])]);
  1336. return $1;
  1337. }
  1338. }),
  1339. smalltalk.SequenceableCollection);
  1340. smalltalk.addMethod(
  1341. "_allButLast",
  1342. smalltalk.method({
  1343. selector: "allButLast",
  1344. fn: function (){
  1345. var self=this;
  1346. var $1;
  1347. $1=smalltalk.send(self,"_copyFrom_to_",[(1),smalltalk.send(smalltalk.send(self,"_size",[]),"__minus",[(1)])]);
  1348. return $1;
  1349. }
  1350. }),
  1351. smalltalk.SequenceableCollection);
  1352. smalltalk.addMethod(
  1353. "_at_",
  1354. smalltalk.method({
  1355. selector: "at:",
  1356. fn: function (anIndex){
  1357. var self=this;
  1358. var $1;
  1359. $1=smalltalk.send(self,"_at_ifAbsent_",[anIndex,(function(){
  1360. return smalltalk.send(self,"_errorNotFound",[]);
  1361. })]);
  1362. return $1;
  1363. }
  1364. }),
  1365. smalltalk.SequenceableCollection);
  1366. smalltalk.addMethod(
  1367. "_at_ifAbsent_",
  1368. smalltalk.method({
  1369. selector: "at:ifAbsent:",
  1370. fn: function (anIndex,aBlock){
  1371. var self=this;
  1372. smalltalk.send(self,"_subclassResponsibility",[]);
  1373. return self}
  1374. }),
  1375. smalltalk.SequenceableCollection);
  1376. smalltalk.addMethod(
  1377. "_at_put_",
  1378. smalltalk.method({
  1379. selector: "at:put:",
  1380. fn: function (anIndex,anObject){
  1381. var self=this;
  1382. smalltalk.send(self,"_subclassResponsibility",[]);
  1383. return self}
  1384. }),
  1385. smalltalk.SequenceableCollection);
  1386. smalltalk.addMethod(
  1387. "_atRandom",
  1388. smalltalk.method({
  1389. selector: "atRandom",
  1390. fn: function (){
  1391. var self=this;
  1392. var $1;
  1393. $1=smalltalk.send(self,"_at_",[smalltalk.send(smalltalk.send(self,"_size",[]),"_atRandom",[])]);
  1394. return $1;
  1395. }
  1396. }),
  1397. smalltalk.SequenceableCollection);
  1398. smalltalk.addMethod(
  1399. "_copyFrom_to_",
  1400. smalltalk.method({
  1401. selector: "copyFrom:to:",
  1402. fn: function (anIndex,anotherIndex){
  1403. var self=this;
  1404. var range;
  1405. var newCollection;
  1406. range=smalltalk.send(anIndex,"_to_",[anotherIndex]);
  1407. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(range,"_size",[])]);
  1408. smalltalk.send(range,"_withIndexDo_",[(function(each,i){
  1409. return smalltalk.send(newCollection,"_at_put_",[i,smalltalk.send(self,"_at_",[each])]);
  1410. })]);
  1411. return newCollection;
  1412. }
  1413. }),
  1414. smalltalk.SequenceableCollection);
  1415. smalltalk.addMethod(
  1416. "_deepCopy",
  1417. smalltalk.method({
  1418. selector: "deepCopy",
  1419. fn: function (){
  1420. var self=this;
  1421. var newCollection;
  1422. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  1423. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  1424. return smalltalk.send(newCollection,"_at_put_",[index,smalltalk.send(each,"_deepCopy",[])]);
  1425. })]);
  1426. return newCollection;
  1427. }
  1428. }),
  1429. smalltalk.SequenceableCollection);
  1430. smalltalk.addMethod(
  1431. "_first",
  1432. smalltalk.method({
  1433. selector: "first",
  1434. fn: function (){
  1435. var self=this;
  1436. var $1;
  1437. $1=smalltalk.send(self,"_at_",[(1)]);
  1438. return $1;
  1439. }
  1440. }),
  1441. smalltalk.SequenceableCollection);
  1442. smalltalk.addMethod(
  1443. "_first_",
  1444. smalltalk.method({
  1445. selector: "first:",
  1446. fn: function (n){
  1447. var self=this;
  1448. var $1;
  1449. $1=smalltalk.send(self,"_copyFrom_to_",[(1),n]);
  1450. return $1;
  1451. }
  1452. }),
  1453. smalltalk.SequenceableCollection);
  1454. smalltalk.addMethod(
  1455. "_fourth",
  1456. smalltalk.method({
  1457. selector: "fourth",
  1458. fn: function (){
  1459. var self=this;
  1460. var $1;
  1461. $1=smalltalk.send(self,"_at_",[(4)]);
  1462. return $1;
  1463. }
  1464. }),
  1465. smalltalk.SequenceableCollection);
  1466. smalltalk.addMethod(
  1467. "_indexOf_",
  1468. smalltalk.method({
  1469. selector: "indexOf:",
  1470. fn: function (anObject){
  1471. var self=this;
  1472. var $1;
  1473. $1=smalltalk.send(self,"_indexOf_ifAbsent_",[anObject,(function(){
  1474. return smalltalk.send(self,"_errorNotFound",[]);
  1475. })]);
  1476. return $1;
  1477. }
  1478. }),
  1479. smalltalk.SequenceableCollection);
  1480. smalltalk.addMethod(
  1481. "_indexOf_ifAbsent_",
  1482. smalltalk.method({
  1483. selector: "indexOf:ifAbsent:",
  1484. fn: function (anObject,aBlock){
  1485. var self=this;
  1486. for(var i=0;i<self.length;i++) {
  1487. if(smalltalk.send(self[i], '__eq', [anObject])) {return i+1}
  1488. };
  1489. return aBlock();
  1490. ;
  1491. ;
  1492. return self}
  1493. }),
  1494. smalltalk.SequenceableCollection);
  1495. smalltalk.addMethod(
  1496. "_indexOf_startingAt_",
  1497. smalltalk.method({
  1498. selector: "indexOf:startingAt:",
  1499. fn: function (anObject,start){
  1500. var self=this;
  1501. var $1;
  1502. $1=smalltalk.send(self,"_indexOf_startingAt_ifAbsent_",[anObject,start,(function(){
  1503. return (0);
  1504. })]);
  1505. return $1;
  1506. }
  1507. }),
  1508. smalltalk.SequenceableCollection);
  1509. smalltalk.addMethod(
  1510. "_indexOf_startingAt_ifAbsent_",
  1511. smalltalk.method({
  1512. selector: "indexOf:startingAt:ifAbsent:",
  1513. fn: function (anObject,start,aBlock){
  1514. var self=this;
  1515. for(var i=start-1;i<self.length;i++){
  1516. if(self[i].__eq(anObject)) {return i+1}
  1517. }
  1518. return aBlock();
  1519. ;
  1520. ;
  1521. return self}
  1522. }),
  1523. smalltalk.SequenceableCollection);
  1524. smalltalk.addMethod(
  1525. "_last",
  1526. smalltalk.method({
  1527. selector: "last",
  1528. fn: function (){
  1529. var self=this;
  1530. var $1;
  1531. $1=smalltalk.send(self,"_at_",[smalltalk.send(self,"_size",[])]);
  1532. return $1;
  1533. }
  1534. }),
  1535. smalltalk.SequenceableCollection);
  1536. smalltalk.addMethod(
  1537. "_removeLast",
  1538. smalltalk.method({
  1539. selector: "removeLast",
  1540. fn: function (){
  1541. var self=this;
  1542. smalltalk.send(self,"_remove_",[smalltalk.send(self,"_last",[])]);
  1543. return self}
  1544. }),
  1545. smalltalk.SequenceableCollection);
  1546. smalltalk.addMethod(
  1547. "_reversed",
  1548. smalltalk.method({
  1549. selector: "reversed",
  1550. fn: function (){
  1551. var self=this;
  1552. smalltalk.send(self,"_subclassResponsibility",[]);
  1553. return self}
  1554. }),
  1555. smalltalk.SequenceableCollection);
  1556. smalltalk.addMethod(
  1557. "_second",
  1558. smalltalk.method({
  1559. selector: "second",
  1560. fn: function (){
  1561. var self=this;
  1562. var $1;
  1563. $1=smalltalk.send(self,"_at_",[(2)]);
  1564. return $1;
  1565. }
  1566. }),
  1567. smalltalk.SequenceableCollection);
  1568. smalltalk.addMethod(
  1569. "_shallowCopy",
  1570. smalltalk.method({
  1571. selector: "shallowCopy",
  1572. fn: function (){
  1573. var self=this;
  1574. var newCollection;
  1575. newCollection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new_",[smalltalk.send(self,"_size",[])]);
  1576. smalltalk.send(self,"_withIndexDo_",[(function(each,index){
  1577. return smalltalk.send(newCollection,"_at_put_",[index,each]);
  1578. })]);
  1579. return newCollection;
  1580. }
  1581. }),
  1582. smalltalk.SequenceableCollection);
  1583. smalltalk.addMethod(
  1584. "_third",
  1585. smalltalk.method({
  1586. selector: "third",
  1587. fn: function (){
  1588. var self=this;
  1589. var $1;
  1590. $1=smalltalk.send(self,"_at_",[(3)]);
  1591. return $1;
  1592. }
  1593. }),
  1594. smalltalk.SequenceableCollection);
  1595. smalltalk.addMethod(
  1596. "_withIndexDo_",
  1597. smalltalk.method({
  1598. selector: "withIndexDo:",
  1599. fn: function (aBlock){
  1600. var self=this;
  1601. for(var i=0;i<self.length;i++){aBlock(self[i], i+1);};
  1602. ;
  1603. return self}
  1604. }),
  1605. smalltalk.SequenceableCollection);
  1606. smalltalk.addClass('Array', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1607. smalltalk.addMethod(
  1608. "_add_",
  1609. smalltalk.method({
  1610. selector: "add:",
  1611. fn: function (anObject){
  1612. var self=this;
  1613. self.push(anObject); return anObject;;
  1614. ;
  1615. return self}
  1616. }),
  1617. smalltalk.Array);
  1618. smalltalk.addMethod(
  1619. "_asJavascript",
  1620. smalltalk.method({
  1621. selector: "asJavascript",
  1622. fn: function (){
  1623. var self=this;
  1624. var $1;
  1625. $1=smalltalk.send(smalltalk.send("[","__comma",[smalltalk.send(smalltalk.send(self,"_collect_",[(function(each){
  1626. return smalltalk.send(each,"_asJavascript",[]);
  1627. })]),"_join_",[", "])]),"__comma",["]"]);
  1628. return $1;
  1629. }
  1630. }),
  1631. smalltalk.Array);
  1632. smalltalk.addMethod(
  1633. "_at_ifAbsent_",
  1634. smalltalk.method({
  1635. selector: "at:ifAbsent:",
  1636. fn: function (anIndex,aBlock){
  1637. var self=this;
  1638. if((anIndex < 1) || (self.length < anIndex)) {return aBlock()};
  1639. return self[anIndex - 1];
  1640. ;
  1641. ;
  1642. return self}
  1643. }),
  1644. smalltalk.Array);
  1645. smalltalk.addMethod(
  1646. "_at_put_",
  1647. smalltalk.method({
  1648. selector: "at:put:",
  1649. fn: function (anIndex,anObject){
  1650. var self=this;
  1651. return self[anIndex - 1] = anObject;
  1652. ;
  1653. return self}
  1654. }),
  1655. smalltalk.Array);
  1656. smalltalk.addMethod(
  1657. "_join_",
  1658. smalltalk.method({
  1659. selector: "join:",
  1660. fn: function (aString){
  1661. var self=this;
  1662. return self.join(aString);
  1663. ;
  1664. return self}
  1665. }),
  1666. smalltalk.Array);
  1667. smalltalk.addMethod(
  1668. "_remove_ifAbsent_",
  1669. smalltalk.method({
  1670. selector: "remove:ifAbsent:",
  1671. fn: function (anObject,aBlock){
  1672. var self=this;
  1673. for(var i=0;i<self.length;i++) {
  1674. if(self[i] == anObject) {
  1675. self.splice(i,1);
  1676. return self;
  1677. }
  1678. }
  1679. ;
  1680. ;
  1681. smalltalk.send(aBlock,"_value",[]);
  1682. return self}
  1683. }),
  1684. smalltalk.Array);
  1685. smalltalk.addMethod(
  1686. "_removeFrom_to_",
  1687. smalltalk.method({
  1688. selector: "removeFrom:to:",
  1689. fn: function (aNumber,anotherNumber){
  1690. var self=this;
  1691. self.splice(aNumber - 1,anotherNumber - 1);
  1692. ;
  1693. return self}
  1694. }),
  1695. smalltalk.Array);
  1696. smalltalk.addMethod(
  1697. "_reversed",
  1698. smalltalk.method({
  1699. selector: "reversed",
  1700. fn: function (){
  1701. var self=this;
  1702. return self._copy().reverse();
  1703. ;
  1704. return self}
  1705. }),
  1706. smalltalk.Array);
  1707. smalltalk.addMethod(
  1708. "_size",
  1709. smalltalk.method({
  1710. selector: "size",
  1711. fn: function (){
  1712. var self=this;
  1713. return self.length;
  1714. ;
  1715. return self}
  1716. }),
  1717. smalltalk.Array);
  1718. smalltalk.addMethod(
  1719. "_sort",
  1720. smalltalk.method({
  1721. selector: "sort",
  1722. fn: function (){
  1723. var self=this;
  1724. var $1;
  1725. $1=smalltalk.send(self,"_basicPerform_",["sort"]);
  1726. return $1;
  1727. }
  1728. }),
  1729. smalltalk.Array);
  1730. smalltalk.addMethod(
  1731. "_sort_",
  1732. smalltalk.method({
  1733. selector: "sort:",
  1734. fn: function (aBlock){
  1735. var self=this;
  1736. return self.sort(function(a, b) {
  1737. if(aBlock(a,b)) {return -1} else {return 1}
  1738. })
  1739. ;
  1740. ;
  1741. return self}
  1742. }),
  1743. smalltalk.Array);
  1744. smalltalk.addMethod(
  1745. "_sorted",
  1746. smalltalk.method({
  1747. selector: "sorted",
  1748. fn: function (){
  1749. var self=this;
  1750. var $1;
  1751. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort",[]);
  1752. return $1;
  1753. }
  1754. }),
  1755. smalltalk.Array);
  1756. smalltalk.addMethod(
  1757. "_sorted_",
  1758. smalltalk.method({
  1759. selector: "sorted:",
  1760. fn: function (aBlock){
  1761. var self=this;
  1762. var $1;
  1763. $1=smalltalk.send(smalltalk.send(self,"_copy",[]),"_sort_",[aBlock]);
  1764. return $1;
  1765. }
  1766. }),
  1767. smalltalk.Array);
  1768. smalltalk.addMethod(
  1769. "_new_",
  1770. smalltalk.method({
  1771. selector: "new:",
  1772. fn: function (anInteger){
  1773. var self=this;
  1774. return new Array(anInteger);
  1775. ;
  1776. return self}
  1777. }),
  1778. smalltalk.Array.klass);
  1779. smalltalk.addMethod(
  1780. "_with_",
  1781. smalltalk.method({
  1782. selector: "with:",
  1783. fn: function (anObject){
  1784. var self=this;
  1785. var $2,$3,$1;
  1786. $2=smalltalk.send(self,"_new_",[(1)]);
  1787. smalltalk.send($2,"_at_put_",[(1),anObject]);
  1788. $3=smalltalk.send($2,"_yourself",[]);
  1789. $1=$3;
  1790. return $1;
  1791. }
  1792. }),
  1793. smalltalk.Array.klass);
  1794. smalltalk.addMethod(
  1795. "_with_with_",
  1796. smalltalk.method({
  1797. selector: "with:with:",
  1798. fn: function (anObject,anObject2){
  1799. var self=this;
  1800. var $2,$3,$1;
  1801. $2=smalltalk.send(self,"_new_",[(2)]);
  1802. smalltalk.send($2,"_at_put_",[(1),anObject]);
  1803. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  1804. $3=smalltalk.send($2,"_yourself",[]);
  1805. $1=$3;
  1806. return $1;
  1807. }
  1808. }),
  1809. smalltalk.Array.klass);
  1810. smalltalk.addMethod(
  1811. "_with_with_with_",
  1812. smalltalk.method({
  1813. selector: "with:with:with:",
  1814. fn: function (anObject,anObject2,anObject3){
  1815. var self=this;
  1816. var $2,$3,$1;
  1817. $2=smalltalk.send(self,"_new_",[(3)]);
  1818. smalltalk.send($2,"_at_put_",[(1),anObject]);
  1819. smalltalk.send($2,"_at_put_",[(2),anObject2]);
  1820. smalltalk.send($2,"_at_put_",[(3),anObject3]);
  1821. $3=smalltalk.send($2,"_yourself",[]);
  1822. $1=$3;
  1823. return $1;
  1824. }
  1825. }),
  1826. smalltalk.Array.klass);
  1827. smalltalk.addMethod(
  1828. "_withAll_",
  1829. smalltalk.method({
  1830. selector: "withAll:",
  1831. fn: function (aCollection){
  1832. var self=this;
  1833. var instance;
  1834. var index;
  1835. index=(1);
  1836. instance=smalltalk.send(self,"_new_",[smalltalk.send(aCollection,"_size",[])]);
  1837. smalltalk.send(aCollection,"_do_",[(function(each){
  1838. smalltalk.send(instance,"_at_put_",[index,each]);
  1839. index=smalltalk.send(index,"__plus",[(1)]);
  1840. return index;
  1841. })]);
  1842. return instance;
  1843. }
  1844. }),
  1845. smalltalk.Array.klass);
  1846. smalltalk.addClass('CharacterArray', smalltalk.SequenceableCollection, [], 'Kernel-Collections');
  1847. smalltalk.addMethod(
  1848. "__comma",
  1849. smalltalk.method({
  1850. selector: ",",
  1851. fn: function (aString){
  1852. var self=this;
  1853. var $1;
  1854. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__comma",[smalltalk.send(aString,"_asString",[])]);
  1855. return $1;
  1856. }
  1857. }),
  1858. smalltalk.CharacterArray);
  1859. smalltalk.addMethod(
  1860. "_add_",
  1861. smalltalk.method({
  1862. selector: "add:",
  1863. fn: function (anObject){
  1864. var self=this;
  1865. smalltalk.send(self,"_errorReadOnly",[]);
  1866. return self}
  1867. }),
  1868. smalltalk.CharacterArray);
  1869. smalltalk.addMethod(
  1870. "_asLowercase",
  1871. smalltalk.method({
  1872. selector: "asLowercase",
  1873. fn: function (){
  1874. var self=this;
  1875. var $1;
  1876. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asLowercase",[])]);
  1877. return $1;
  1878. }
  1879. }),
  1880. smalltalk.CharacterArray);
  1881. smalltalk.addMethod(
  1882. "_asNumber",
  1883. smalltalk.method({
  1884. selector: "asNumber",
  1885. fn: function (){
  1886. var self=this;
  1887. var $1;
  1888. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asNumber",[]);
  1889. return $1;
  1890. }
  1891. }),
  1892. smalltalk.CharacterArray);
  1893. smalltalk.addMethod(
  1894. "_asString",
  1895. smalltalk.method({
  1896. selector: "asString",
  1897. fn: function (){
  1898. var self=this;
  1899. var $1;
  1900. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  1901. return $1;
  1902. }
  1903. }),
  1904. smalltalk.CharacterArray);
  1905. smalltalk.addMethod(
  1906. "_asSymbol",
  1907. smalltalk.method({
  1908. selector: "asSymbol",
  1909. fn: function (){
  1910. var self=this;
  1911. var $1;
  1912. $1=smalltalk.send(self,"_subclassResponsibility",[]);
  1913. return $1;
  1914. }
  1915. }),
  1916. smalltalk.CharacterArray);
  1917. smalltalk.addMethod(
  1918. "_asUppercase",
  1919. smalltalk.method({
  1920. selector: "asUppercase",
  1921. fn: function (){
  1922. var self=this;
  1923. var $1;
  1924. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_asUppercase",[])]);
  1925. return $1;
  1926. }
  1927. }),
  1928. smalltalk.CharacterArray);
  1929. smalltalk.addMethod(
  1930. "_at_put_",
  1931. smalltalk.method({
  1932. selector: "at:put:",
  1933. fn: function (anIndex,anObject){
  1934. var self=this;
  1935. smalltalk.send(self,"_errorReadOnly",[]);
  1936. return self}
  1937. }),
  1938. smalltalk.CharacterArray);
  1939. smalltalk.addMethod(
  1940. "_errorReadOnly",
  1941. smalltalk.method({
  1942. selector: "errorReadOnly",
  1943. fn: function (){
  1944. var self=this;
  1945. smalltalk.send(self,"_error_",["Object is read-only"]);
  1946. return self}
  1947. }),
  1948. smalltalk.CharacterArray);
  1949. smalltalk.addMethod(
  1950. "_printString",
  1951. smalltalk.method({
  1952. selector: "printString",
  1953. fn: function (){
  1954. var self=this;
  1955. var $1;
  1956. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_printString",[]);
  1957. return $1;
  1958. }
  1959. }),
  1960. smalltalk.CharacterArray);
  1961. smalltalk.addMethod(
  1962. "_remove_",
  1963. smalltalk.method({
  1964. selector: "remove:",
  1965. fn: function (anObject){
  1966. var self=this;
  1967. smalltalk.send(self,"_errorReadOnly",[]);
  1968. return self}
  1969. }),
  1970. smalltalk.CharacterArray);
  1971. smalltalk.addMethod(
  1972. "_fromString_",
  1973. smalltalk.method({
  1974. selector: "fromString:",
  1975. fn: function (aString){
  1976. var self=this;
  1977. smalltalk.send(self,"_subclassResponsibility",[]);
  1978. return self}
  1979. }),
  1980. smalltalk.CharacterArray.klass);
  1981. smalltalk.addClass('String', smalltalk.CharacterArray, [], 'Kernel-Collections');
  1982. smalltalk.addMethod(
  1983. "__comma",
  1984. smalltalk.method({
  1985. selector: ",",
  1986. fn: function (aString){
  1987. var self=this;
  1988. return self + aString;
  1989. ;
  1990. return self}
  1991. }),
  1992. smalltalk.String);
  1993. smalltalk.addMethod(
  1994. "__lt",
  1995. smalltalk.method({
  1996. selector: "<",
  1997. fn: function (aString){
  1998. var self=this;
  1999. return String(self) < aString._asString();
  2000. ;
  2001. return self}
  2002. }),
  2003. smalltalk.String);
  2004. smalltalk.addMethod(
  2005. "__lt_eq",
  2006. smalltalk.method({
  2007. selector: "<=",
  2008. fn: function (aString){
  2009. var self=this;
  2010. return String(self) <= aString._asString();
  2011. ;
  2012. return self}
  2013. }),
  2014. smalltalk.String);
  2015. smalltalk.addMethod(
  2016. "__eq",
  2017. smalltalk.method({
  2018. selector: "=",
  2019. fn: function (aString){
  2020. var self=this;
  2021. var $1;
  2022. $1=smalltalk.send(smalltalk.send(aString,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  2023. if(! smalltalk.assert($1)){
  2024. return false;
  2025. };
  2026. return String(self) === String(aString);
  2027. ;
  2028. return self}
  2029. }),
  2030. smalltalk.String);
  2031. smalltalk.addMethod(
  2032. "__eq_eq",
  2033. smalltalk.method({
  2034. selector: "==",
  2035. fn: function (aString){
  2036. var self=this;
  2037. var $1;
  2038. $1=smalltalk.send(self,"__eq",[aString]);
  2039. return $1;
  2040. }
  2041. }),
  2042. smalltalk.String);
  2043. smalltalk.addMethod(
  2044. "__gt",
  2045. smalltalk.method({
  2046. selector: ">",
  2047. fn: function (aString){
  2048. var self=this;
  2049. return String(self) > aString._asString();
  2050. ;
  2051. return self}
  2052. }),
  2053. smalltalk.String);
  2054. smalltalk.addMethod(
  2055. "__gt_eq",
  2056. smalltalk.method({
  2057. selector: ">=",
  2058. fn: function (aString){
  2059. var self=this;
  2060. return String(self) >= aString._asString();
  2061. ;
  2062. return self}
  2063. }),
  2064. smalltalk.String);
  2065. smalltalk.addMethod(
  2066. "_asJSON",
  2067. smalltalk.method({
  2068. selector: "asJSON",
  2069. fn: function (){
  2070. var self=this;
  2071. return self;
  2072. }
  2073. }),
  2074. smalltalk.String);
  2075. smalltalk.addMethod(
  2076. "_asJavaScriptSelector",
  2077. smalltalk.method({
  2078. selector: "asJavaScriptSelector",
  2079. fn: function (){
  2080. var self=this;
  2081. var $1;
  2082. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asSelector",[]),"_replace_with_",["^_",""]),"_replace_with_",["_.*",""]);
  2083. return $1;
  2084. }
  2085. }),
  2086. smalltalk.String);
  2087. smalltalk.addMethod(
  2088. "_asJavascript",
  2089. smalltalk.method({
  2090. selector: "asJavascript",
  2091. fn: function (){
  2092. var self=this;
  2093. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2094. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  2095. else
  2096. return "\"" + self + "\"";
  2097. ;
  2098. ;
  2099. return self}
  2100. }),
  2101. smalltalk.String);
  2102. smalltalk.addMethod(
  2103. "_asLowercase",
  2104. smalltalk.method({
  2105. selector: "asLowercase",
  2106. fn: function (){
  2107. var self=this;
  2108. return self.toLowerCase();
  2109. ;
  2110. return self}
  2111. }),
  2112. smalltalk.String);
  2113. smalltalk.addMethod(
  2114. "_asNumber",
  2115. smalltalk.method({
  2116. selector: "asNumber",
  2117. fn: function (){
  2118. var self=this;
  2119. return Number(self);
  2120. ;
  2121. return self}
  2122. }),
  2123. smalltalk.String);
  2124. smalltalk.addMethod(
  2125. "_asSelector",
  2126. smalltalk.method({
  2127. selector: "asSelector",
  2128. fn: function (){
  2129. var self=this;
  2130. var selector;
  2131. selector=smalltalk.send("_","__comma",[self]);
  2132. selector=smalltalk.send(selector,"_replace_with_",[":","_"]);
  2133. selector=smalltalk.send(selector,"_replace_with_",["[+]","_plus"]);
  2134. selector=smalltalk.send(selector,"_replace_with_",["-","_minus"]);
  2135. selector=smalltalk.send(selector,"_replace_with_",["[*]","_star"]);
  2136. selector=smalltalk.send(selector,"_replace_with_",["[/]","_slash"]);
  2137. selector=smalltalk.send(selector,"_replace_with_",[">","_gt"]);
  2138. selector=smalltalk.send(selector,"_replace_with_",["<","_lt"]);
  2139. selector=smalltalk.send(selector,"_replace_with_",["=","_eq"]);
  2140. selector=smalltalk.send(selector,"_replace_with_",[",","_comma"]);
  2141. selector=smalltalk.send(selector,"_replace_with_",["[@]","_at"]);
  2142. return selector;
  2143. }
  2144. }),
  2145. smalltalk.String);
  2146. smalltalk.addMethod(
  2147. "_asString",
  2148. smalltalk.method({
  2149. selector: "asString",
  2150. fn: function (){
  2151. var self=this;
  2152. return self;
  2153. }
  2154. }),
  2155. smalltalk.String);
  2156. smalltalk.addMethod(
  2157. "_asSymbol",
  2158. smalltalk.method({
  2159. selector: "asSymbol",
  2160. fn: function (){
  2161. var self=this;
  2162. var $1;
  2163. $1=smalltalk.send((smalltalk.Symbol || Symbol),"_lookup_",[self]);
  2164. return $1;
  2165. }
  2166. }),
  2167. smalltalk.String);
  2168. smalltalk.addMethod(
  2169. "_asUppercase",
  2170. smalltalk.method({
  2171. selector: "asUppercase",
  2172. fn: function (){
  2173. var self=this;
  2174. return self.toUpperCase();
  2175. ;
  2176. return self}
  2177. }),
  2178. smalltalk.String);
  2179. smalltalk.addMethod(
  2180. "_asciiValue",
  2181. smalltalk.method({
  2182. selector: "asciiValue",
  2183. fn: function (){
  2184. var self=this;
  2185. return self.charCodeAt(0);;
  2186. ;
  2187. return self}
  2188. }),
  2189. smalltalk.String);
  2190. smalltalk.addMethod(
  2191. "_at_ifAbsent_",
  2192. smalltalk.method({
  2193. selector: "at:ifAbsent:",
  2194. fn: function (anIndex,aBlock){
  2195. var self=this;
  2196. return String(self).charAt(anIndex - 1) || aBlock();
  2197. ;
  2198. return self}
  2199. }),
  2200. smalltalk.String);
  2201. smalltalk.addMethod(
  2202. "_copyFrom_to_",
  2203. smalltalk.method({
  2204. selector: "copyFrom:to:",
  2205. fn: function (anIndex,anotherIndex){
  2206. var self=this;
  2207. return self.substring(anIndex - 1, anotherIndex);
  2208. ;
  2209. return self}
  2210. }),
  2211. smalltalk.String);
  2212. smalltalk.addMethod(
  2213. "_deepCopy",
  2214. smalltalk.method({
  2215. selector: "deepCopy",
  2216. fn: function (){
  2217. var self=this;
  2218. var $1;
  2219. $1=smalltalk.send(self,"_shallowCopy",[]);
  2220. return $1;
  2221. }
  2222. }),
  2223. smalltalk.String);
  2224. smalltalk.addMethod(
  2225. "_do_",
  2226. smalltalk.method({
  2227. selector: "do:",
  2228. fn: function (aBlock){
  2229. var self=this;
  2230. for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
  2231. ;
  2232. return self}
  2233. }),
  2234. smalltalk.String);
  2235. smalltalk.addMethod(
  2236. "_escaped",
  2237. smalltalk.method({
  2238. selector: "escaped",
  2239. fn: function (){
  2240. var self=this;
  2241. return escape(self);
  2242. ;
  2243. return self}
  2244. }),
  2245. smalltalk.String);
  2246. smalltalk.addMethod(
  2247. "_includesSubString_",
  2248. smalltalk.method({
  2249. selector: "includesSubString:",
  2250. fn: function (subString){
  2251. var self=this;
  2252. return self.indexOf(subString) != -1 ;
  2253. ;
  2254. return self}
  2255. }),
  2256. smalltalk.String);
  2257. smalltalk.addMethod(
  2258. "_isString",
  2259. smalltalk.method({
  2260. selector: "isString",
  2261. fn: function (){
  2262. var self=this;
  2263. return true;
  2264. }
  2265. }),
  2266. smalltalk.String);
  2267. smalltalk.addMethod(
  2268. "_join_",
  2269. smalltalk.method({
  2270. selector: "join:",
  2271. fn: function (aCollection){
  2272. var self=this;
  2273. var $1;
  2274. $1=smalltalk.send((smalltalk.String || String),"_streamContents_",[(function(stream){
  2275. return smalltalk.send(aCollection,"_do_separatedBy_",[(function(each){
  2276. return smalltalk.send(stream,"_nextPutAll_",[smalltalk.send(each,"_asString",[])]);
  2277. }),(function(){
  2278. return smalltalk.send(stream,"_nextPutAll_",[self]);
  2279. })]);
  2280. })]);
  2281. return $1;
  2282. }
  2283. }),
  2284. smalltalk.String);
  2285. smalltalk.addMethod(
  2286. "_lineIndicesDo_",
  2287. smalltalk.method({
  2288. selector: "lineIndicesDo:",
  2289. fn: function (aBlock){
  2290. var self=this;
  2291. var $1,$2,$3;
  2292. var $early={};
  2293. try {
  2294. var cr;
  2295. var lf;
  2296. var start;
  2297. var sz;
  2298. var nextLF;
  2299. var nextCR;
  2300. start=(1);
  2301. sz=smalltalk.send(self,"_size",[]);
  2302. cr=smalltalk.send((smalltalk.String || String),"_cr",[]);
  2303. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,(1)]);
  2304. lf=smalltalk.send((smalltalk.String || String),"_lf",[]);
  2305. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,(1)]);
  2306. smalltalk.send((function(){
  2307. return smalltalk.send(start,"__lt_eq",[sz]);
  2308. }),"_whileTrue_",[(function(){
  2309. $1=smalltalk.send(smalltalk.send(nextLF,"__eq",[(0)]),"_and_",[(function(){
  2310. return smalltalk.send(nextCR,"__eq",[(0)]);
  2311. })]);
  2312. if(smalltalk.assert($1)){
  2313. smalltalk.send(aBlock,"_value_value_value_",[start,sz,sz]);
  2314. throw $early=[self];
  2315. };
  2316. $2=smalltalk.send(smalltalk.send(nextCR,"__eq",[(0)]),"_or_",[(function(){
  2317. return smalltalk.send(smalltalk.send((0),"__lt",[nextLF]),"_and_",[(function(){
  2318. return smalltalk.send(nextLF,"__lt",[nextCR]);
  2319. })]);
  2320. })]);
  2321. if(smalltalk.assert($2)){
  2322. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextLF,"__minus",[(1)]),nextLF]);
  2323. start=smalltalk.send((1),"__plus",[nextLF]);
  2324. start;
  2325. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  2326. return nextLF;
  2327. } else {
  2328. $3=smalltalk.send(smalltalk.send((1),"__plus",[nextCR]),"__eq",[nextLF]);
  2329. if(smalltalk.assert($3)){
  2330. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextLF]);
  2331. start=smalltalk.send((1),"__plus",[nextLF]);
  2332. start;
  2333. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  2334. nextCR;
  2335. nextLF=smalltalk.send(self,"_indexOf_startingAt_",[lf,start]);
  2336. return nextLF;
  2337. } else {
  2338. smalltalk.send(aBlock,"_value_value_value_",[start,smalltalk.send(nextCR,"__minus",[(1)]),nextCR]);
  2339. start=smalltalk.send((1),"__plus",[nextCR]);
  2340. start;
  2341. nextCR=smalltalk.send(self,"_indexOf_startingAt_",[cr,start]);
  2342. return nextCR;
  2343. };
  2344. };
  2345. })]);
  2346. return self}
  2347. catch(e) {if(e===$early)return e[0]; throw e}
  2348. }
  2349. }),
  2350. smalltalk.String);
  2351. smalltalk.addMethod(
  2352. "_lineNumber_",
  2353. smalltalk.method({
  2354. selector: "lineNumber:",
  2355. fn: function (anIndex){
  2356. var self=this;
  2357. var $1,$2;
  2358. var $early={};
  2359. try {
  2360. var lineCount;
  2361. lineCount=(0);
  2362. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  2363. lineCount=smalltalk.send(lineCount,"__plus",[(1)]);
  2364. $1=smalltalk.send(lineCount,"__eq",[anIndex]);
  2365. if(smalltalk.assert($1)){
  2366. $2=smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters]);
  2367. throw $early=[$2];
  2368. };
  2369. })]);
  2370. return nil;
  2371. }
  2372. catch(e) {if(e===$early)return e[0]; throw e}
  2373. }
  2374. }),
  2375. smalltalk.String);
  2376. smalltalk.addMethod(
  2377. "_lines",
  2378. smalltalk.method({
  2379. selector: "lines",
  2380. fn: function (){
  2381. var self=this;
  2382. var lines;
  2383. lines=smalltalk.send((smalltalk.Array || Array),"_new",[]);
  2384. smalltalk.send(self,"_linesDo_",[(function(aLine){
  2385. return smalltalk.send(lines,"_add_",[aLine]);
  2386. })]);
  2387. return lines;
  2388. }
  2389. }),
  2390. smalltalk.String);
  2391. smalltalk.addMethod(
  2392. "_linesDo_",
  2393. smalltalk.method({
  2394. selector: "linesDo:",
  2395. fn: function (aBlock){
  2396. var self=this;
  2397. smalltalk.send(self,"_lineIndicesDo_",[(function(start,endWithoutDelimiters,end){
  2398. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_copyFrom_to_",[start,endWithoutDelimiters])]);
  2399. })]);
  2400. return self}
  2401. }),
  2402. smalltalk.String);
  2403. smalltalk.addMethod(
  2404. "_match_",
  2405. smalltalk.method({
  2406. selector: "match:",
  2407. fn: function (aRegexp){
  2408. var self=this;
  2409. return self.search(aRegexp) != -1;
  2410. ;
  2411. return self}
  2412. }),
  2413. smalltalk.String);
  2414. smalltalk.addMethod(
  2415. "_matchesOf_",
  2416. smalltalk.method({
  2417. selector: "matchesOf:",
  2418. fn: function (aRegularExpression){
  2419. var self=this;
  2420. return self.match(aRegularExpression);
  2421. ;
  2422. return self}
  2423. }),
  2424. smalltalk.String);
  2425. smalltalk.addMethod(
  2426. "_printNl",
  2427. smalltalk.method({
  2428. selector: "printNl",
  2429. fn: function (){
  2430. var self=this;
  2431. console.log(self);
  2432. ;
  2433. return self}
  2434. }),
  2435. smalltalk.String);
  2436. smalltalk.addMethod(
  2437. "_printString",
  2438. smalltalk.method({
  2439. selector: "printString",
  2440. fn: function (){
  2441. var self=this;
  2442. var $1;
  2443. $1=smalltalk.send(smalltalk.send("'","__comma",[self]),"__comma",["'"]);
  2444. return $1;
  2445. }
  2446. }),
  2447. smalltalk.String);
  2448. smalltalk.addMethod(
  2449. "_replace_with_",
  2450. smalltalk.method({
  2451. selector: "replace:with:",
  2452. fn: function (aString,anotherString){
  2453. var self=this;
  2454. var $1;
  2455. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[aString,"g"]),anotherString]);
  2456. return $1;
  2457. }
  2458. }),
  2459. smalltalk.String);
  2460. smalltalk.addMethod(
  2461. "_replaceRegexp_with_",
  2462. smalltalk.method({
  2463. selector: "replaceRegexp:with:",
  2464. fn: function (aRegexp,aString){
  2465. var self=this;
  2466. return self.replace(aRegexp, aString);
  2467. ;
  2468. return self}
  2469. }),
  2470. smalltalk.String);
  2471. smalltalk.addMethod(
  2472. "_reversed",
  2473. smalltalk.method({
  2474. selector: "reversed",
  2475. fn: function (){
  2476. var self=this;
  2477. return self.split("").reverse().join("");
  2478. ;
  2479. return self}
  2480. }),
  2481. smalltalk.String);
  2482. smalltalk.addMethod(
  2483. "_shallowCopy",
  2484. smalltalk.method({
  2485. selector: "shallowCopy",
  2486. fn: function (){
  2487. var self=this;
  2488. var $1;
  2489. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[self]);
  2490. return $1;
  2491. }
  2492. }),
  2493. smalltalk.String);
  2494. smalltalk.addMethod(
  2495. "_size",
  2496. smalltalk.method({
  2497. selector: "size",
  2498. fn: function (){
  2499. var self=this;
  2500. return self.length;
  2501. ;
  2502. return self}
  2503. }),
  2504. smalltalk.String);
  2505. smalltalk.addMethod(
  2506. "_tokenize_",
  2507. smalltalk.method({
  2508. selector: "tokenize:",
  2509. fn: function (aString){
  2510. var self=this;
  2511. return self.split(aString);
  2512. ;
  2513. return self}
  2514. }),
  2515. smalltalk.String);
  2516. smalltalk.addMethod(
  2517. "_trimBoth",
  2518. smalltalk.method({
  2519. selector: "trimBoth",
  2520. fn: function (){
  2521. var self=this;
  2522. var $1;
  2523. $1=smalltalk.send(self,"_trimBoth_",["\x5cs"]);
  2524. return $1;
  2525. }
  2526. }),
  2527. smalltalk.String);
  2528. smalltalk.addMethod(
  2529. "_trimBoth_",
  2530. smalltalk.method({
  2531. selector: "trimBoth:",
  2532. fn: function (separators){
  2533. var self=this;
  2534. var $1;
  2535. $1=smalltalk.send(smalltalk.send(self,"_trimLeft_",[separators]),"_trimRight_",[separators]);
  2536. return $1;
  2537. }
  2538. }),
  2539. smalltalk.String);
  2540. smalltalk.addMethod(
  2541. "_trimLeft",
  2542. smalltalk.method({
  2543. selector: "trimLeft",
  2544. fn: function (){
  2545. var self=this;
  2546. var $1;
  2547. $1=smalltalk.send(self,"_trimLeft_",["\x5cs"]);
  2548. return $1;
  2549. }
  2550. }),
  2551. smalltalk.String);
  2552. smalltalk.addMethod(
  2553. "_trimLeft_",
  2554. smalltalk.method({
  2555. selector: "trimLeft:",
  2556. fn: function (separators){
  2557. var self=this;
  2558. var $1;
  2559. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("^[","__comma",[separators]),"__comma",["]+"]),"g"]),""]);
  2560. return $1;
  2561. }
  2562. }),
  2563. smalltalk.String);
  2564. smalltalk.addMethod(
  2565. "_trimRight",
  2566. smalltalk.method({
  2567. selector: "trimRight",
  2568. fn: function (){
  2569. var self=this;
  2570. var $1;
  2571. $1=smalltalk.send(self,"_trimRight_",["\x5cs"]);
  2572. return $1;
  2573. }
  2574. }),
  2575. smalltalk.String);
  2576. smalltalk.addMethod(
  2577. "_trimRight_",
  2578. smalltalk.method({
  2579. selector: "trimRight:",
  2580. fn: function (separators){
  2581. var self=this;
  2582. var $1;
  2583. $1=smalltalk.send(self,"_replaceRegexp_with_",[smalltalk.send((smalltalk.RegularExpression || RegularExpression),"_fromString_flag_",[smalltalk.send(smalltalk.send("[","__comma",[separators]),"__comma",["]+$"]),"g"]),""]);
  2584. return $1;
  2585. }
  2586. }),
  2587. smalltalk.String);
  2588. smalltalk.addMethod(
  2589. "_unescaped",
  2590. smalltalk.method({
  2591. selector: "unescaped",
  2592. fn: function (){
  2593. var self=this;
  2594. return unescape(self);
  2595. ;
  2596. return self}
  2597. }),
  2598. smalltalk.String);
  2599. smalltalk.addMethod(
  2600. "_withIndexDo_",
  2601. smalltalk.method({
  2602. selector: "withIndexDo:",
  2603. fn: function (aBlock){
  2604. var self=this;
  2605. for(var i=0;i<self.length;i++){aBlock(self.charAt(i), i+1);};
  2606. ;
  2607. return self}
  2608. }),
  2609. smalltalk.String);
  2610. smalltalk.addMethod(
  2611. "_cr",
  2612. smalltalk.method({
  2613. selector: "cr",
  2614. fn: function (){
  2615. var self=this;
  2616. return '\r';
  2617. ;
  2618. return self}
  2619. }),
  2620. smalltalk.String.klass);
  2621. smalltalk.addMethod(
  2622. "_crlf",
  2623. smalltalk.method({
  2624. selector: "crlf",
  2625. fn: function (){
  2626. var self=this;
  2627. return '\r\n';
  2628. ;
  2629. return self}
  2630. }),
  2631. smalltalk.String.klass);
  2632. smalltalk.addMethod(
  2633. "_fromCharCode_",
  2634. smalltalk.method({
  2635. selector: "fromCharCode:",
  2636. fn: function (anInteger){
  2637. var self=this;
  2638. return String.fromCharCode(anInteger);
  2639. ;
  2640. return self}
  2641. }),
  2642. smalltalk.String.klass);
  2643. smalltalk.addMethod(
  2644. "_fromString_",
  2645. smalltalk.method({
  2646. selector: "fromString:",
  2647. fn: function (aString){
  2648. var self=this;
  2649. return new self.fn(aString);
  2650. ;
  2651. return self}
  2652. }),
  2653. smalltalk.String.klass);
  2654. smalltalk.addMethod(
  2655. "_lf",
  2656. smalltalk.method({
  2657. selector: "lf",
  2658. fn: function (){
  2659. var self=this;
  2660. return '\n';
  2661. ;
  2662. return self}
  2663. }),
  2664. smalltalk.String.klass);
  2665. smalltalk.addMethod(
  2666. "_space",
  2667. smalltalk.method({
  2668. selector: "space",
  2669. fn: function (){
  2670. var self=this;
  2671. return ' ';
  2672. ;
  2673. return self}
  2674. }),
  2675. smalltalk.String.klass);
  2676. smalltalk.addMethod(
  2677. "_streamClass",
  2678. smalltalk.method({
  2679. selector: "streamClass",
  2680. fn: function (){
  2681. var self=this;
  2682. return (smalltalk.StringStream || StringStream);
  2683. }
  2684. }),
  2685. smalltalk.String.klass);
  2686. smalltalk.addMethod(
  2687. "_streamContents_",
  2688. smalltalk.method({
  2689. selector: "streamContents:",
  2690. fn: function (blockWithArg){
  2691. var self=this;
  2692. var $1;
  2693. var stream;
  2694. stream=smalltalk.send(smalltalk.send(self,"_streamClass",[]),"_on_",[smalltalk.send((smalltalk.String || String),"_new",[])]);
  2695. smalltalk.send(blockWithArg,"_value_",[stream]);
  2696. $1=smalltalk.send(stream,"_contents",[]);
  2697. return $1;
  2698. }
  2699. }),
  2700. smalltalk.String.klass);
  2701. smalltalk.addMethod(
  2702. "_tab",
  2703. smalltalk.method({
  2704. selector: "tab",
  2705. fn: function (){
  2706. var self=this;
  2707. return '\t';
  2708. ;
  2709. return self}
  2710. }),
  2711. smalltalk.String.klass);
  2712. smalltalk.addMethod(
  2713. "_value_",
  2714. smalltalk.method({
  2715. selector: "value:",
  2716. fn: function (aUTFCharCode){
  2717. var self=this;
  2718. return String.fromCharCode(aUTFCharCode);;
  2719. ;
  2720. return self}
  2721. }),
  2722. smalltalk.String.klass);
  2723. smalltalk.addClass('Symbol', smalltalk.CharacterArray, [], 'Kernel-Collections');
  2724. smalltalk.addMethod(
  2725. "__lt",
  2726. smalltalk.method({
  2727. selector: "<",
  2728. fn: function (aSymbol){
  2729. var self=this;
  2730. var $1;
  2731. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt",[smalltalk.send(aSymbol,"_asString",[])]);
  2732. return $1;
  2733. }
  2734. }),
  2735. smalltalk.Symbol);
  2736. smalltalk.addMethod(
  2737. "__lt_eq",
  2738. smalltalk.method({
  2739. selector: "<=",
  2740. fn: function (aSymbol){
  2741. var self=this;
  2742. var $1;
  2743. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__lt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  2744. return $1;
  2745. }
  2746. }),
  2747. smalltalk.Symbol);
  2748. smalltalk.addMethod(
  2749. "__eq",
  2750. smalltalk.method({
  2751. selector: "=",
  2752. fn: function (aSymbol){
  2753. var self=this;
  2754. var $1,$2;
  2755. $1=smalltalk.send(smalltalk.send(aSymbol,"_class",[]),"__eq",[smalltalk.send(self,"_class",[])]);
  2756. if(! smalltalk.assert($1)){
  2757. return false;
  2758. };
  2759. $2=smalltalk.send(smalltalk.send(self,"_asString",[]),"__eq",[smalltalk.send(aSymbol,"_asString",[])]);
  2760. return $2;
  2761. }
  2762. }),
  2763. smalltalk.Symbol);
  2764. smalltalk.addMethod(
  2765. "__gt",
  2766. smalltalk.method({
  2767. selector: ">",
  2768. fn: function (aSymbol){
  2769. var self=this;
  2770. var $1;
  2771. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt",[smalltalk.send(aSymbol,"_asString",[])]);
  2772. return $1;
  2773. }
  2774. }),
  2775. smalltalk.Symbol);
  2776. smalltalk.addMethod(
  2777. "__gt_eq",
  2778. smalltalk.method({
  2779. selector: ">=",
  2780. fn: function (aSymbol){
  2781. var self=this;
  2782. var $1;
  2783. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"__gt_eq",[smalltalk.send(aSymbol,"_asString",[])]);
  2784. return $1;
  2785. }
  2786. }),
  2787. smalltalk.Symbol);
  2788. smalltalk.addMethod(
  2789. "_asJSON",
  2790. smalltalk.method({
  2791. selector: "asJSON",
  2792. fn: function (){
  2793. var self=this;
  2794. var $1;
  2795. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asJSON",[]);
  2796. return $1;
  2797. }
  2798. }),
  2799. smalltalk.Symbol);
  2800. smalltalk.addMethod(
  2801. "_asJavascript",
  2802. smalltalk.method({
  2803. selector: "asJavascript",
  2804. fn: function (){
  2805. var self=this;
  2806. var $1;
  2807. $1=smalltalk.send(smalltalk.send("smalltalk.symbolFor(\x22","__comma",[smalltalk.send(self,"_asString",[])]),"__comma",["\x22)"]);
  2808. return $1;
  2809. }
  2810. }),
  2811. smalltalk.Symbol);
  2812. smalltalk.addMethod(
  2813. "_asSelector",
  2814. smalltalk.method({
  2815. selector: "asSelector",
  2816. fn: function (){
  2817. var self=this;
  2818. var $1;
  2819. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_asSelector",[]);
  2820. return $1;
  2821. }
  2822. }),
  2823. smalltalk.Symbol);
  2824. smalltalk.addMethod(
  2825. "_asString",
  2826. smalltalk.method({
  2827. selector: "asString",
  2828. fn: function (){
  2829. var self=this;
  2830. return self.value;
  2831. ;
  2832. return self}
  2833. }),
  2834. smalltalk.Symbol);
  2835. smalltalk.addMethod(
  2836. "_asSymbol",
  2837. smalltalk.method({
  2838. selector: "asSymbol",
  2839. fn: function (){
  2840. var self=this;
  2841. return self;
  2842. }
  2843. }),
  2844. smalltalk.Symbol);
  2845. smalltalk.addMethod(
  2846. "_at_ifAbsent_",
  2847. smalltalk.method({
  2848. selector: "at:ifAbsent:",
  2849. fn: function (anIndex,aBlock){
  2850. var self=this;
  2851. var $1;
  2852. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_at_ifAbsent_",[anIndex,aBlock]);
  2853. return $1;
  2854. }
  2855. }),
  2856. smalltalk.Symbol);
  2857. smalltalk.addMethod(
  2858. "_collect_",
  2859. smalltalk.method({
  2860. selector: "collect:",
  2861. fn: function (aBlock){
  2862. var self=this;
  2863. var $1;
  2864. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_collect_",[aBlock]),"_asSymbol",[]);
  2865. return $1;
  2866. }
  2867. }),
  2868. smalltalk.Symbol);
  2869. smalltalk.addMethod(
  2870. "_copyFrom_to_",
  2871. smalltalk.method({
  2872. selector: "copyFrom:to:",
  2873. fn: function (anIndex,anotherIndex){
  2874. var self=this;
  2875. var $1;
  2876. $1=smalltalk.send(smalltalk.send(self,"_class",[]),"_fromString_",[smalltalk.send(smalltalk.send(self,"_asString",[]),"_copyFrom_to_",[anIndex,anotherIndex])]);
  2877. return $1;
  2878. }
  2879. }),
  2880. smalltalk.Symbol);
  2881. smalltalk.addMethod(
  2882. "_deepCopy",
  2883. smalltalk.method({
  2884. selector: "deepCopy",
  2885. fn: function (){
  2886. var self=this;
  2887. return self;
  2888. }
  2889. }),
  2890. smalltalk.Symbol);
  2891. smalltalk.addMethod(
  2892. "_detect_",
  2893. smalltalk.method({
  2894. selector: "detect:",
  2895. fn: function (aBlock){
  2896. var self=this;
  2897. var $1;
  2898. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_detect_",[aBlock]);
  2899. return $1;
  2900. }
  2901. }),
  2902. smalltalk.Symbol);
  2903. smalltalk.addMethod(
  2904. "_do_",
  2905. smalltalk.method({
  2906. selector: "do:",
  2907. fn: function (aBlock){
  2908. var self=this;
  2909. smalltalk.send(smalltalk.send(self,"_asString",[]),"_do_",[aBlock]);
  2910. return self}
  2911. }),
  2912. smalltalk.Symbol);
  2913. smalltalk.addMethod(
  2914. "_isSymbol",
  2915. smalltalk.method({
  2916. selector: "isSymbol",
  2917. fn: function (){
  2918. var self=this;
  2919. return true;
  2920. }
  2921. }),
  2922. smalltalk.Symbol);
  2923. smalltalk.addMethod(
  2924. "_printString",
  2925. smalltalk.method({
  2926. selector: "printString",
  2927. fn: function (){
  2928. var self=this;
  2929. var $1;
  2930. $1=smalltalk.send("#","__comma",[smalltalk.send(self,"_asString",[])]);
  2931. return $1;
  2932. }
  2933. }),
  2934. smalltalk.Symbol);
  2935. smalltalk.addMethod(
  2936. "_select_",
  2937. smalltalk.method({
  2938. selector: "select:",
  2939. fn: function (aBlock){
  2940. var self=this;
  2941. var $1;
  2942. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_asString",[]),"_select_",[aBlock]),"_asSymbol",[]);
  2943. return $1;
  2944. }
  2945. }),
  2946. smalltalk.Symbol);
  2947. smalltalk.addMethod(
  2948. "_shallowCopy",
  2949. smalltalk.method({
  2950. selector: "shallowCopy",
  2951. fn: function (){
  2952. var self=this;
  2953. return self;
  2954. }
  2955. }),
  2956. smalltalk.Symbol);
  2957. smalltalk.addMethod(
  2958. "_size",
  2959. smalltalk.method({
  2960. selector: "size",
  2961. fn: function (){
  2962. var self=this;
  2963. var $1;
  2964. $1=smalltalk.send(smalltalk.send(self,"_asString",[]),"_size",[]);
  2965. return $1;
  2966. }
  2967. }),
  2968. smalltalk.Symbol);
  2969. smalltalk.addMethod(
  2970. "_value_",
  2971. smalltalk.method({
  2972. selector: "value:",
  2973. fn: function (anObject){
  2974. var self=this;
  2975. var $1;
  2976. $1=smalltalk.send(anObject,"_perform_",[self]);
  2977. return $1;
  2978. }
  2979. }),
  2980. smalltalk.Symbol);
  2981. smalltalk.addMethod(
  2982. "_withIndexDo_",
  2983. smalltalk.method({
  2984. selector: "withIndexDo:",
  2985. fn: function (aBlock){
  2986. var self=this;
  2987. smalltalk.send(smalltalk.send(self,"_asString",[]),"_withIndexDo_",[aBlock]);
  2988. return self}
  2989. }),
  2990. smalltalk.Symbol);
  2991. smalltalk.addMethod(
  2992. "_basicNew",
  2993. smalltalk.method({
  2994. selector: "basicNew",
  2995. fn: function (){
  2996. var self=this;
  2997. smalltalk.send(self,"_shouldNotImplement",[]);
  2998. return self}
  2999. }),
  3000. smalltalk.Symbol.klass);
  3001. smalltalk.addMethod(
  3002. "_fromString_",
  3003. smalltalk.method({
  3004. selector: "fromString:",
  3005. fn: function (aString){
  3006. var self=this;
  3007. var $1;
  3008. $1=smalltalk.send(self,"_lookup_",[aString]);
  3009. return $1;
  3010. }
  3011. }),
  3012. smalltalk.Symbol.klass);
  3013. smalltalk.addMethod(
  3014. "_lookup_",
  3015. smalltalk.method({
  3016. selector: "lookup:",
  3017. fn: function (aString){
  3018. var self=this;
  3019. return smalltalk.symbolFor(aString);;
  3020. ;
  3021. return self}
  3022. }),
  3023. smalltalk.Symbol.klass);
  3024. smalltalk.addClass('Set', smalltalk.Collection, ['elements'], 'Kernel-Collections');
  3025. smalltalk.addMethod(
  3026. "__eq",
  3027. smalltalk.method({
  3028. selector: "=",
  3029. fn: function (aCollection){
  3030. var self=this;
  3031. var $1;
  3032. $1=smalltalk.send(smalltalk.send(smalltalk.send(self,"_class",[]),"__eq",[smalltalk.send(aCollection,"_class",[])]),"_and_",[(function(){
  3033. return smalltalk.send(self["@elements"],"__eq",[smalltalk.send(aCollection,"_asArray",[])]);
  3034. })]);
  3035. return $1;
  3036. }
  3037. }),
  3038. smalltalk.Set);
  3039. smalltalk.addMethod(
  3040. "_add_",
  3041. smalltalk.method({
  3042. selector: "add:",
  3043. fn: function (anObject){
  3044. var self=this;
  3045. var found;
  3046. for(var i=0; i < self['@elements'].length; i++) {
  3047. if(anObject == self['@elements'][i]) {
  3048. found = true;
  3049. break;
  3050. }
  3051. }
  3052. if(!found) {self['@elements'].push(anObject)}
  3053. ;
  3054. ;
  3055. return self}
  3056. }),
  3057. smalltalk.Set);
  3058. smalltalk.addMethod(
  3059. "_asArray",
  3060. smalltalk.method({
  3061. selector: "asArray",
  3062. fn: function (){
  3063. var self=this;
  3064. var $1;
  3065. $1=smalltalk.send(self["@elements"],"_copy",[]);
  3066. return $1;
  3067. }
  3068. }),
  3069. smalltalk.Set);
  3070. smalltalk.addMethod(
  3071. "_detect_ifNone_",
  3072. smalltalk.method({
  3073. selector: "detect:ifNone:",
  3074. fn: function (aBlock,anotherBlock){
  3075. var self=this;
  3076. var $1;
  3077. $1=smalltalk.send(self["@elements"],"_detect_ifNone_",[aBlock,anotherBlock]);
  3078. return $1;
  3079. }
  3080. }),
  3081. smalltalk.Set);
  3082. smalltalk.addMethod(
  3083. "_do_",
  3084. smalltalk.method({
  3085. selector: "do:",
  3086. fn: function (aBlock){
  3087. var self=this;
  3088. smalltalk.send(self["@elements"],"_do_",[aBlock]);
  3089. return self}
  3090. }),
  3091. smalltalk.Set);
  3092. smalltalk.addMethod(
  3093. "_includes_",
  3094. smalltalk.method({
  3095. selector: "includes:",
  3096. fn: function (anObject){
  3097. var self=this;
  3098. var $1;
  3099. $1=smalltalk.send(self["@elements"],"_includes_",[anObject]);
  3100. return $1;
  3101. }
  3102. }),
  3103. smalltalk.Set);
  3104. smalltalk.addMethod(
  3105. "_initialize",
  3106. smalltalk.method({
  3107. selector: "initialize",
  3108. fn: function (){
  3109. var self=this;
  3110. smalltalk.send(self,"_initialize",[],smalltalk.Collection);
  3111. self["@elements"]=[];
  3112. return self}
  3113. }),
  3114. smalltalk.Set);
  3115. smalltalk.addMethod(
  3116. "_remove_",
  3117. smalltalk.method({
  3118. selector: "remove:",
  3119. fn: function (anObject){
  3120. var self=this;
  3121. smalltalk.send(self["@elements"],"_remove_",[anObject]);
  3122. return self}
  3123. }),
  3124. smalltalk.Set);
  3125. smalltalk.addMethod(
  3126. "_select_",
  3127. smalltalk.method({
  3128. selector: "select:",
  3129. fn: function (aBlock){
  3130. var self=this;
  3131. var $1;
  3132. var collection;
  3133. collection=smalltalk.send(smalltalk.send(self,"_class",[]),"_new",[]);
  3134. smalltalk.send(self,"_do_",[(function(each){
  3135. $1=smalltalk.send(aBlock,"_value_",[each]);
  3136. if(smalltalk.assert($1)){
  3137. return smalltalk.send(collection,"_add_",[each]);
  3138. };
  3139. })]);
  3140. return collection;
  3141. }
  3142. }),
  3143. smalltalk.Set);
  3144. smalltalk.addMethod(
  3145. "_size",
  3146. smalltalk.method({
  3147. selector: "size",
  3148. fn: function (){
  3149. var self=this;
  3150. var $1;
  3151. $1=smalltalk.send(self["@elements"],"_size",[]);
  3152. return $1;
  3153. }
  3154. }),
  3155. smalltalk.Set);
  3156. smalltalk.addClass('Queue', smalltalk.Object, ['read', 'readIndex', 'write'], 'Kernel-Collections');
  3157. smalltalk.addMethod(
  3158. "_back_",
  3159. smalltalk.method({
  3160. selector: "back:",
  3161. fn: function (anObject){
  3162. var self=this;
  3163. smalltalk.send(self["@write"],"_add_",[anObject]);
  3164. return self}
  3165. }),
  3166. smalltalk.Queue);
  3167. smalltalk.addMethod(
  3168. "_front",
  3169. smalltalk.method({
  3170. selector: "front",
  3171. fn: function (){
  3172. var self=this;
  3173. var $1;
  3174. $1=smalltalk.send(self,"_frontIfAbsent_",[(function(){
  3175. return smalltalk.send(self,"_error_",["Cannot read from empty Queue."]);
  3176. })]);
  3177. return $1;
  3178. }
  3179. }),
  3180. smalltalk.Queue);
  3181. smalltalk.addMethod(
  3182. "_frontIfAbsent_",
  3183. smalltalk.method({
  3184. selector: "frontIfAbsent:",
  3185. fn: function (aBlock){
  3186. var self=this;
  3187. var $1,$2,$3;
  3188. var $early={};
  3189. try {
  3190. var result;
  3191. result=smalltalk.send(self["@read"],"_at_ifAbsent_",[self["@readIndex"],(function(){
  3192. $1=smalltalk.send(self["@write"],"_isEmpty",[]);
  3193. if(smalltalk.assert($1)){
  3194. $2=smalltalk.send(self["@readIndex"],"__gt",[(1)]);
  3195. if(smalltalk.assert($2)){
  3196. self["@read"]=[];
  3197. self["@read"];
  3198. self["@readIndex"]=(1);
  3199. self["@readIndex"];
  3200. };
  3201. $3=smalltalk.send(aBlock,"_value",[]);
  3202. throw $early=[$3];
  3203. };
  3204. self["@read"]=self["@write"];
  3205. self["@read"];
  3206. self["@readIndex"]=(1);
  3207. self["@readIndex"];
  3208. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  3209. self["@write"];
  3210. return smalltalk.send(self["@read"],"_first",[]);
  3211. })]);
  3212. smalltalk.send(self["@read"],"_at_put_",[self["@readIndex"],nil]);
  3213. self["@readIndex"]=smalltalk.send(self["@readIndex"],"__plus",[(1)]);
  3214. return result;
  3215. }
  3216. catch(e) {if(e===$early)return e[0]; throw e}
  3217. }
  3218. }),
  3219. smalltalk.Queue);
  3220. smalltalk.addMethod(
  3221. "_initialize",
  3222. smalltalk.method({
  3223. selector: "initialize",
  3224. fn: function (){
  3225. var self=this;
  3226. smalltalk.send(self,"_initialize",[],smalltalk.Object);
  3227. self["@read"]=[];
  3228. self["@readIndex"]=(1);
  3229. self["@write"]=smalltalk.send((smalltalk.OrderedCollection || OrderedCollection),"_new",[]);
  3230. return self}
  3231. }),
  3232. smalltalk.Queue);
  3233. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
  3234. smalltalk.addMethod(
  3235. "_compile_",
  3236. smalltalk.method({
  3237. selector: "compile:",
  3238. fn: function (aString){
  3239. var self=this;
  3240. return self.compile(aString);
  3241. ;
  3242. return self}
  3243. }),
  3244. smalltalk.RegularExpression);
  3245. smalltalk.addMethod(
  3246. "_exec_",
  3247. smalltalk.method({
  3248. selector: "exec:",
  3249. fn: function (aString){
  3250. var self=this;
  3251. return self.exec(aString) || nil;
  3252. ;
  3253. return self}
  3254. }),
  3255. smalltalk.RegularExpression);
  3256. smalltalk.addMethod(
  3257. "_test_",
  3258. smalltalk.method({
  3259. selector: "test:",
  3260. fn: function (aString){
  3261. var self=this;
  3262. return self.test(aString);
  3263. ;
  3264. return self}
  3265. }),
  3266. smalltalk.RegularExpression);
  3267. smalltalk.addMethod(
  3268. "_fromString_",
  3269. smalltalk.method({
  3270. selector: "fromString:",
  3271. fn: function (aString){
  3272. var self=this;
  3273. var $1;
  3274. $1=smalltalk.send(self,"_fromString_flag_",[aString,""]);
  3275. return $1;
  3276. }
  3277. }),
  3278. smalltalk.RegularExpression.klass);
  3279. smalltalk.addMethod(
  3280. "_fromString_flag_",
  3281. smalltalk.method({
  3282. selector: "fromString:flag:",
  3283. fn: function (aString,anotherString){
  3284. var self=this;
  3285. return new RegExp(aString, anotherString);
  3286. ;
  3287. return self}
  3288. }),
  3289. smalltalk.RegularExpression.klass);
  3290. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
  3291. smalltalk.addMethod(
  3292. "_atEnd",
  3293. smalltalk.method({
  3294. selector: "atEnd",
  3295. fn: function (){
  3296. var self=this;
  3297. var $1;
  3298. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[smalltalk.send(self,"_size",[])]);
  3299. return $1;
  3300. }
  3301. }),
  3302. smalltalk.Stream);
  3303. smalltalk.addMethod(
  3304. "_atStart",
  3305. smalltalk.method({
  3306. selector: "atStart",
  3307. fn: function (){
  3308. var self=this;
  3309. var $1;
  3310. $1=smalltalk.send(smalltalk.send(self,"_position",[]),"__eq",[(0)]);
  3311. return $1;
  3312. }
  3313. }),
  3314. smalltalk.Stream);
  3315. smalltalk.addMethod(
  3316. "_close",
  3317. smalltalk.method({
  3318. selector: "close",
  3319. fn: function (){
  3320. var self=this;
  3321. return self}
  3322. }),
  3323. smalltalk.Stream);
  3324. smalltalk.addMethod(
  3325. "_collection",
  3326. smalltalk.method({
  3327. selector: "collection",
  3328. fn: function (){
  3329. var self=this;
  3330. return self["@collection"];
  3331. }
  3332. }),
  3333. smalltalk.Stream);
  3334. smalltalk.addMethod(
  3335. "_contents",
  3336. smalltalk.method({
  3337. selector: "contents",
  3338. fn: function (){
  3339. var self=this;
  3340. var $1;
  3341. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_copyFrom_to_",[(1),smalltalk.send(self,"_streamSize",[])]);
  3342. return $1;
  3343. }
  3344. }),
  3345. smalltalk.Stream);
  3346. smalltalk.addMethod(
  3347. "_do_",
  3348. smalltalk.method({
  3349. selector: "do:",
  3350. fn: function (aBlock){
  3351. var self=this;
  3352. smalltalk.send((function(){
  3353. return smalltalk.send(self,"_atEnd",[]);
  3354. }),"_whileFalse_",[(function(){
  3355. return smalltalk.send(aBlock,"_value_",[smalltalk.send(self,"_next",[])]);
  3356. })]);
  3357. return self}
  3358. }),
  3359. smalltalk.Stream);
  3360. smalltalk.addMethod(
  3361. "_flush",
  3362. smalltalk.method({
  3363. selector: "flush",
  3364. fn: function (){
  3365. var self=this;
  3366. return self}
  3367. }),
  3368. smalltalk.Stream);
  3369. smalltalk.addMethod(
  3370. "_isEmpty",
  3371. smalltalk.method({
  3372. selector: "isEmpty",
  3373. fn: function (){
  3374. var self=this;
  3375. var $1;
  3376. $1=smalltalk.send(smalltalk.send(self,"_size",[]),"__eq",[(0)]);
  3377. return $1;
  3378. }
  3379. }),
  3380. smalltalk.Stream);
  3381. smalltalk.addMethod(
  3382. "_next",
  3383. smalltalk.method({
  3384. selector: "next",
  3385. fn: function (){
  3386. var self=this;
  3387. var $2,$1;
  3388. $2=smalltalk.send(self,"_atEnd",[]);
  3389. if(smalltalk.assert($2)){
  3390. $1=nil;
  3391. } else {
  3392. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  3393. $1=smalltalk.send(self["@collection"],"_at_",[smalltalk.send(self,"_position",[])]);
  3394. };
  3395. return $1;
  3396. }
  3397. }),
  3398. smalltalk.Stream);
  3399. smalltalk.addMethod(
  3400. "_next_",
  3401. smalltalk.method({
  3402. selector: "next:",
  3403. fn: function (anInteger){
  3404. var self=this;
  3405. var $1;
  3406. var tempCollection;
  3407. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  3408. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  3409. $1=smalltalk.send(self,"_atEnd",[]);
  3410. if(! smalltalk.assert($1)){
  3411. return smalltalk.send(tempCollection,"_add_",[smalltalk.send(self,"_next",[])]);
  3412. };
  3413. })]);
  3414. return tempCollection;
  3415. }
  3416. }),
  3417. smalltalk.Stream);
  3418. smalltalk.addMethod(
  3419. "_nextPut_",
  3420. smalltalk.method({
  3421. selector: "nextPut:",
  3422. fn: function (anObject){
  3423. var self=this;
  3424. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  3425. smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_put_",[smalltalk.send(self,"_position",[]),anObject]);
  3426. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  3427. return self}
  3428. }),
  3429. smalltalk.Stream);
  3430. smalltalk.addMethod(
  3431. "_nextPutAll_",
  3432. smalltalk.method({
  3433. selector: "nextPutAll:",
  3434. fn: function (aCollection){
  3435. var self=this;
  3436. smalltalk.send(aCollection,"_do_",[(function(each){
  3437. return smalltalk.send(self,"_nextPut_",[each]);
  3438. })]);
  3439. return self}
  3440. }),
  3441. smalltalk.Stream);
  3442. smalltalk.addMethod(
  3443. "_peek",
  3444. smalltalk.method({
  3445. selector: "peek",
  3446. fn: function (){
  3447. var self=this;
  3448. var $2,$1;
  3449. $2=smalltalk.send(self,"_atEnd",[]);
  3450. if(! smalltalk.assert($2)){
  3451. $1=smalltalk.send(smalltalk.send(self,"_collection",[]),"_at_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[(1)])]);
  3452. };
  3453. return $1;
  3454. }
  3455. }),
  3456. smalltalk.Stream);
  3457. smalltalk.addMethod(
  3458. "_position",
  3459. smalltalk.method({
  3460. selector: "position",
  3461. fn: function (){
  3462. var self=this;
  3463. var $1;
  3464. if(($receiver = self["@position"]) == nil || $receiver == undefined){
  3465. self["@position"]=(0);
  3466. $1=self["@position"];
  3467. } else {
  3468. $1=self["@position"];
  3469. };
  3470. return $1;
  3471. }
  3472. }),
  3473. smalltalk.Stream);
  3474. smalltalk.addMethod(
  3475. "_position_",
  3476. smalltalk.method({
  3477. selector: "position:",
  3478. fn: function (anInteger){
  3479. var self=this;
  3480. self["@position"]=anInteger;
  3481. return self}
  3482. }),
  3483. smalltalk.Stream);
  3484. smalltalk.addMethod(
  3485. "_reset",
  3486. smalltalk.method({
  3487. selector: "reset",
  3488. fn: function (){
  3489. var self=this;
  3490. smalltalk.send(self,"_position_",[(0)]);
  3491. return self}
  3492. }),
  3493. smalltalk.Stream);
  3494. smalltalk.addMethod(
  3495. "_resetContents",
  3496. smalltalk.method({
  3497. selector: "resetContents",
  3498. fn: function (){
  3499. var self=this;
  3500. smalltalk.send(self,"_reset",[]);
  3501. smalltalk.send(self,"_setStreamSize_",[(0)]);
  3502. return self}
  3503. }),
  3504. smalltalk.Stream);
  3505. smalltalk.addMethod(
  3506. "_setCollection_",
  3507. smalltalk.method({
  3508. selector: "setCollection:",
  3509. fn: function (aCollection){
  3510. var self=this;
  3511. self["@collection"]=aCollection;
  3512. return self}
  3513. }),
  3514. smalltalk.Stream);
  3515. smalltalk.addMethod(
  3516. "_setStreamSize_",
  3517. smalltalk.method({
  3518. selector: "setStreamSize:",
  3519. fn: function (anInteger){
  3520. var self=this;
  3521. self["@streamSize"]=anInteger;
  3522. return self}
  3523. }),
  3524. smalltalk.Stream);
  3525. smalltalk.addMethod(
  3526. "_setToEnd",
  3527. smalltalk.method({
  3528. selector: "setToEnd",
  3529. fn: function (){
  3530. var self=this;
  3531. smalltalk.send(self,"_position_",[smalltalk.send(self,"_size",[])]);
  3532. return self}
  3533. }),
  3534. smalltalk.Stream);
  3535. smalltalk.addMethod(
  3536. "_size",
  3537. smalltalk.method({
  3538. selector: "size",
  3539. fn: function (){
  3540. var self=this;
  3541. var $1;
  3542. $1=smalltalk.send(self,"_streamSize",[]);
  3543. return $1;
  3544. }
  3545. }),
  3546. smalltalk.Stream);
  3547. smalltalk.addMethod(
  3548. "_skip_",
  3549. smalltalk.method({
  3550. selector: "skip:",
  3551. fn: function (anInteger){
  3552. var self=this;
  3553. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[anInteger]),"_min_max_",[smalltalk.send(self,"_size",[]),(0)])]);
  3554. return self}
  3555. }),
  3556. smalltalk.Stream);
  3557. smalltalk.addMethod(
  3558. "_streamSize",
  3559. smalltalk.method({
  3560. selector: "streamSize",
  3561. fn: function (){
  3562. var self=this;
  3563. return self["@streamSize"];
  3564. }
  3565. }),
  3566. smalltalk.Stream);
  3567. smalltalk.addMethod(
  3568. "_on_",
  3569. smalltalk.method({
  3570. selector: "on:",
  3571. fn: function (aCollection){
  3572. var self=this;
  3573. var $2,$3,$1;
  3574. $2=smalltalk.send(self,"_new",[]);
  3575. smalltalk.send($2,"_setCollection_",[aCollection]);
  3576. smalltalk.send($2,"_setStreamSize_",[smalltalk.send(aCollection,"_size",[])]);
  3577. $3=smalltalk.send($2,"_yourself",[]);
  3578. $1=$3;
  3579. return $1;
  3580. }
  3581. }),
  3582. smalltalk.Stream.klass);
  3583. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel-Collections');
  3584. smalltalk.addMethod(
  3585. "_cr",
  3586. smalltalk.method({
  3587. selector: "cr",
  3588. fn: function (){
  3589. var self=this;
  3590. var $1;
  3591. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  3592. return $1;
  3593. }
  3594. }),
  3595. smalltalk.StringStream);
  3596. smalltalk.addMethod(
  3597. "_crlf",
  3598. smalltalk.method({
  3599. selector: "crlf",
  3600. fn: function (){
  3601. var self=this;
  3602. var $1;
  3603. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_crlf",[])]);
  3604. return $1;
  3605. }
  3606. }),
  3607. smalltalk.StringStream);
  3608. smalltalk.addMethod(
  3609. "_lf",
  3610. smalltalk.method({
  3611. selector: "lf",
  3612. fn: function (){
  3613. var self=this;
  3614. var $1;
  3615. $1=smalltalk.send(self,"_nextPutAll_",[smalltalk.send((smalltalk.String || String),"_lf",[])]);
  3616. return $1;
  3617. }
  3618. }),
  3619. smalltalk.StringStream);
  3620. smalltalk.addMethod(
  3621. "_next_",
  3622. smalltalk.method({
  3623. selector: "next:",
  3624. fn: function (anInteger){
  3625. var self=this;
  3626. var $1;
  3627. var tempCollection;
  3628. tempCollection=smalltalk.send(smalltalk.send(smalltalk.send(self,"_collection",[]),"_class",[]),"_new",[]);
  3629. smalltalk.send(anInteger,"_timesRepeat_",[(function(){
  3630. $1=smalltalk.send(self,"_atEnd",[]);
  3631. if(! smalltalk.assert($1)){
  3632. tempCollection=smalltalk.send(tempCollection,"__comma",[smalltalk.send(self,"_next",[])]);
  3633. return tempCollection;
  3634. };
  3635. })]);
  3636. return tempCollection;
  3637. }
  3638. }),
  3639. smalltalk.StringStream);
  3640. smalltalk.addMethod(
  3641. "_nextPut_",
  3642. smalltalk.method({
  3643. selector: "nextPut:",
  3644. fn: function (aString){
  3645. var self=this;
  3646. smalltalk.send(self,"_nextPutAll_",[aString]);
  3647. return self}
  3648. }),
  3649. smalltalk.StringStream);
  3650. smalltalk.addMethod(
  3651. "_nextPutAll_",
  3652. smalltalk.method({
  3653. selector: "nextPutAll:",
  3654. fn: function (aString){
  3655. var self=this;
  3656. 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",[])])])]);
  3657. smalltalk.send(self,"_position_",[smalltalk.send(smalltalk.send(self,"_position",[]),"__plus",[smalltalk.send(aString,"_size",[])])]);
  3658. smalltalk.send(self,"_setStreamSize_",[smalltalk.send(smalltalk.send(self,"_streamSize",[]),"_max_",[smalltalk.send(self,"_position",[])])]);
  3659. return self}
  3660. }),
  3661. smalltalk.StringStream);
  3662. smalltalk.addMethod(
  3663. "_space",
  3664. smalltalk.method({
  3665. selector: "space",
  3666. fn: function (){
  3667. var self=this;
  3668. smalltalk.send(self,"_nextPut_",[" "]);
  3669. return self}
  3670. }),
  3671. smalltalk.StringStream);