Kernel-Collections.deploy.js 76 KB

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