Kernel-Collections.deploy.js 85 KB

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