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