Kernel-Collections.deploy.js 70 KB

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