2
0

Kernel-Collections.deploy.js 82 KB

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