Kernel-Collections.deploy.js 83 KB

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