Kernel.js 143 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053
  1. smalltalk.addClass('Object', smalltalk.nil, [], 'Kernel');
  2. smalltalk.addMethod(
  3. '__eq',
  4. smalltalk.method({
  5. selector: '=',
  6. category: 'comparing',
  7. fn: function (anObject){
  8. var self=this;
  9. return self == anObject;
  10. return self;},
  11. source: unescape('%3D%20anObject%0A%09%7B%27return%20self%20%3D%3D%20anObject%27%7D%0A')}),
  12. smalltalk.Object);
  13. smalltalk.addMethod(
  14. '_~_eq',
  15. smalltalk.method({
  16. selector: '~=',
  17. category: 'comparing',
  18. fn: function (anObject) {
  19. var self = this;
  20. return self.__eq(anObject).__eq_eq(false);
  21. return self;
  22. },
  23. source: unescape('%7E%3D%20anObject%0A%09%5E%28self%20%3D%20anObject%29%20%3D%3D%20false%0A')}),
  24. smalltalk.Object);
  25. smalltalk.addMethod(
  26. '_initialize',
  27. smalltalk.method({
  28. selector: 'initialize',
  29. category: 'initialization',
  30. fn: function () {
  31. var self = this;
  32. return self;
  33. },
  34. source: unescape('initialize%0A')}),
  35. smalltalk.Object);
  36. smalltalk.addMethod(
  37. '_yourself',
  38. smalltalk.method({
  39. selector: 'yourself',
  40. category: 'accessing',
  41. fn: function () {
  42. var self = this;
  43. return self;
  44. return self;
  45. },
  46. source: unescape('yourself%0A%09%5Eself%0A')}),
  47. smalltalk.Object);
  48. smalltalk.addMethod(
  49. '_class',
  50. smalltalk.method({
  51. selector: 'class',
  52. category: 'accessing',
  53. fn: function (){
  54. var self=this;
  55. return self.klass;
  56. return self;},
  57. source: unescape('class%0A%09%7B%27return%20self.klass%27%7D%0A')}),
  58. smalltalk.Object);
  59. smalltalk.addMethod(
  60. '_size',
  61. smalltalk.method({
  62. selector: 'size',
  63. category: 'accessing',
  64. fn: function () {
  65. var self = this;
  66. self._error_("Object not indexable");
  67. return self;
  68. },
  69. source: unescape('size%0A%09self%20error%3A%20%27Object%20not%20indexable%27%0A')}),
  70. smalltalk.Object);
  71. smalltalk.addMethod(
  72. '_copy',
  73. smalltalk.method({
  74. selector: 'copy',
  75. category: 'copying',
  76. fn: function () {
  77. var self = this;
  78. return self._shallowCopy()._postCopy();
  79. return self;
  80. },
  81. source: unescape('copy%0A%09%5Eself%20shallowCopy%20postCopy%0A')}),
  82. smalltalk.Object);
  83. smalltalk.addMethod(
  84. '_shallowCopy',
  85. smalltalk.method({
  86. selector: 'shallowCopy',
  87. category: 'copying',
  88. fn: function (){
  89. var self=this;
  90. var copy = self.klass._new();
  91. for(var i in self) {
  92. if(/^@.+/.test(i)) {
  93. copy[i] = self[i];
  94. }
  95. }
  96. return copy;
  97. ;
  98. return self;},
  99. source: unescape('shallowCopy%0A%09%7B%27%0A%09%20%20%20%20var%20copy%20%3D%20self.klass._new%28%29%3B%0A%09%20%20%20%20for%28var%20i%20in%20self%29%20%7B%0A%09%09if%28/%5E@.+/.test%28i%29%29%20%7B%0A%09%09%20%20%20%20copy%5Bi%5D%20%3D%20self%5Bi%5D%3B%0A%09%09%7D%0A%09%20%20%20%20%7D%0A%09%20%20%20%20return%20copy%3B%0A%09%27%7D%0A')}),
  100. smalltalk.Object);
  101. smalltalk.addMethod(
  102. '_deepCopy',
  103. smalltalk.method({
  104. selector: 'deepCopy',
  105. category: 'copying',
  106. fn: function () {
  107. var self = this;
  108. (function () {var copy = self.klass._new();for (var i in self) {if (/^@.+/.test(i)) {copy[i] = self[i]._deepCopy();}}return copy;}());
  109. return self;
  110. },
  111. source: unescape('deepCopy%0A%09%7B%27%09%20%20%20%20%0A%09%20%20%20%20var%20copy%20%3D%20self.klass._new%28%29%3B%0A%09%20%20%20%20for%28var%20i%20in%20self%29%20%7B%0A%09%09if%28/%5E@.+/.test%28i%29%29%20%7B%0A%09%09%20%20%20%20copy%5Bi%5D%20%3D%20self%5Bi%5D._deepCopy%28%29%3B%0A%09%09%7D%0A%09%20%20%20%20%7D%0A%09%20%20%20%20return%20copy%3B%0A%09%27%7D.%0A')}),
  112. smalltalk.Object);
  113. smalltalk.addMethod(
  114. '_postCopy',
  115. smalltalk.method({
  116. selector: 'postCopy',
  117. category: 'copying',
  118. fn: function () {
  119. var self = this;
  120. return self;
  121. },
  122. source: unescape('postCopy%0A')}),
  123. smalltalk.Object);
  124. smalltalk.addMethod(
  125. '__minus_gt',
  126. smalltalk.method({
  127. selector: '->',
  128. category: 'converting',
  129. fn: function (anObject) {
  130. var self = this;
  131. return smalltalk.Association._key_value_(self, anObject);
  132. return self;
  133. },
  134. source: unescape('-%3E%20anObject%0A%09%5EAssociation%20key%3A%20self%20value%3A%20anObject%0A')}),
  135. smalltalk.Object);
  136. smalltalk.addMethod(
  137. '_asString',
  138. smalltalk.method({
  139. selector: 'asString',
  140. category: 'converting',
  141. fn: function () {
  142. var self = this;
  143. return self._printString();
  144. return self;
  145. },
  146. source: unescape('asString%0A%09%5Eself%20printString%0A')}),
  147. smalltalk.Object);
  148. smalltalk.addMethod(
  149. '_asJavascript',
  150. smalltalk.method({
  151. selector: 'asJavascript',
  152. category: 'converting',
  153. fn: function () {
  154. var self = this;
  155. return self._asString();
  156. return self;
  157. },
  158. source: unescape('asJavascript%0A%09%5Eself%20asString%0A')}),
  159. smalltalk.Object);
  160. smalltalk.addMethod(
  161. '_perform_',
  162. smalltalk.method({
  163. selector: 'perform:',
  164. category: 'message handling',
  165. fn: function (aSymbol) {
  166. var self = this;
  167. return self._perform_withArguments_(aSymbol, []);
  168. return self;
  169. },
  170. source: unescape('perform%3A%20aSymbol%0A%09%5Eself%20perform%3A%20aSymbol%20withArguments%3A%20%23%28%29%0A')}),
  171. smalltalk.Object);
  172. smalltalk.addMethod(
  173. '_perform_withArguments_',
  174. smalltalk.method({
  175. selector: 'perform:withArguments:',
  176. category: 'message handling',
  177. fn: function (aSymbol, aCollection) {
  178. var self = this;
  179. return self._basicPerform_withArguments_(aSymbol._asSelector(), aCollection);
  180. return self;
  181. },
  182. source: unescape('perform%3A%20aSymbol%20withArguments%3A%20aCollection%0A%09%5Eself%20basicPerform%3A%20aSymbol%20asSelector%20withArguments%3A%20aCollection%0A')}),
  183. smalltalk.Object);
  184. smalltalk.addMethod(
  185. '_instVarAt_',
  186. smalltalk.method({
  187. selector: 'instVarAt:',
  188. category: 'accessing',
  189. fn: function (aString){
  190. var self=this;
  191. var value = self['@'+aString];
  192. if(typeof(value) == 'undefined') {
  193. return nil;
  194. } else {
  195. return value;
  196. }
  197. ;
  198. return self;},
  199. source: unescape('instVarAt%3A%20aString%0A%09%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5B%27%27@%27%27+aString%5D%3B%0A%09%20%20%20%20if%28typeof%28value%29%20%3D%3D%20%27%27undefined%27%27%29%20%7B%0A%09%09return%20nil%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  200. smalltalk.Object);
  201. smalltalk.addMethod(
  202. '_instVarAt_put_',
  203. smalltalk.method({
  204. selector: 'instVarAt:put:',
  205. category: 'accessing',
  206. fn: function (aString, anObject){
  207. var self=this;
  208. self['@' + aString] = anObject;
  209. return self;},
  210. source: unescape('instVarAt%3A%20aString%20put%3A%20anObject%0A%09%7B%27self%5B%27%27@%27%27%20+%20aString%5D%20%3D%20anObject%27%7D%0A')}),
  211. smalltalk.Object);
  212. smalltalk.addMethod(
  213. '_basicAt_',
  214. smalltalk.method({
  215. selector: 'basicAt:',
  216. category: 'accessing',
  217. fn: function (aString){
  218. var self=this;
  219. var value = self[aString];
  220. if(typeof(value) == 'undefined') {
  221. return nil;
  222. } else {
  223. return value;
  224. }
  225. ;
  226. return self;},
  227. source: unescape('basicAt%3A%20aString%0A%09%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5BaString%5D%3B%0A%09%20%20%20%20if%28typeof%28value%29%20%3D%3D%20%27%27undefined%27%27%29%20%7B%0A%09%09return%20nil%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  228. smalltalk.Object);
  229. smalltalk.addMethod(
  230. '_basicAt_put_',
  231. smalltalk.method({
  232. selector: 'basicAt:put:',
  233. category: 'accessing',
  234. fn: function (aString, anObject){
  235. var self=this;
  236. return self[aString] = anObject;
  237. return self;},
  238. source: unescape('basicAt%3A%20aString%20put%3A%20anObject%0A%09%7B%27return%20self%5BaString%5D%20%3D%20anObject%27%7D%0A')}),
  239. smalltalk.Object);
  240. smalltalk.addMethod(
  241. '_error_',
  242. smalltalk.method({
  243. selector: 'error:',
  244. category: 'error handling',
  245. fn: function (aString) {
  246. var self = this;
  247. smalltalk.Error._signal_(aString);
  248. return self;
  249. },
  250. source: unescape('error%3A%20aString%0A%09Error%20signal%3A%20aString%0A')}),
  251. smalltalk.Object);
  252. smalltalk.addMethod(
  253. '_subclassResponsibility',
  254. smalltalk.method({
  255. selector: 'subclassResponsibility',
  256. category: 'error handling',
  257. fn: function () {
  258. var self = this;
  259. self._error_("This method is a responsibility of a subclass");
  260. return self;
  261. },
  262. source: unescape('subclassResponsibility%0A%09self%20error%3A%20%27This%20method%20is%20a%20responsibility%20of%20a%20subclass%27%0A')}),
  263. smalltalk.Object);
  264. smalltalk.addMethod(
  265. '_shouldNotImplement',
  266. smalltalk.method({
  267. selector: 'shouldNotImplement',
  268. category: 'error handling',
  269. fn: function () {
  270. var self = this;
  271. self._error_("This method should not be implemented in ".__comma(self._class()._name()));
  272. return self;
  273. },
  274. source: unescape('shouldNotImplement%0A%09self%20error%3A%20%27This%20method%20should%20not%20be%20implemented%20in%20%27%2C%20self%20class%20name%0A')}),
  275. smalltalk.Object);
  276. smalltalk.addMethod(
  277. '_try_catch_',
  278. smalltalk.method({
  279. selector: 'try:catch:',
  280. category: 'error handling',
  281. fn: function (aBlock, anotherBlock) {
  282. var self = this;
  283. (function () {try {aBlock();} catch (e) {anotherBlock(e);}}());
  284. return self;
  285. },
  286. source: unescape('try%3A%20aBlock%20catch%3A%20anotherBlock%0A%09%7B%27try%7BaBlock%28%29%7D%20catch%28e%29%20%7BanotherBlock%28e%29%7D%27%7D%0A')}),
  287. smalltalk.Object);
  288. smalltalk.addMethod(
  289. '_printString',
  290. smalltalk.method({
  291. selector: 'printString',
  292. category: 'printing',
  293. fn: function () {
  294. var self = this;
  295. return "a ".__comma(self._class()._name());
  296. return self;
  297. },
  298. source: unescape('printString%0A%09%5E%27a%20%27%2C%20self%20class%20name%0A')}),
  299. smalltalk.Object);
  300. smalltalk.addMethod(
  301. '_printNl',
  302. smalltalk.method({
  303. selector: 'printNl',
  304. category: 'printing',
  305. fn: function () {
  306. var self = this;
  307. (function () {console.log(self);}());
  308. return self;
  309. },
  310. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  311. smalltalk.Object);
  312. smalltalk.addMethod(
  313. '_isKindOf_',
  314. smalltalk.method({
  315. selector: 'isKindOf:',
  316. category: 'testing',
  317. fn: function (aClass) {
  318. var self = this;
  319. return self._isMemberOf_(aClass)._ifTrue_ifFalse_(function () {return true;}, function () {return self._class()._inheritsFrom_(aClass);});
  320. return self;
  321. },
  322. source: unescape('isKindOf%3A%20aClass%0A%09%5E%28self%20isMemberOf%3A%20aClass%29%0A%09%20%20%20%20ifTrue%3A%20%5Btrue%5D%0A%09%20%20%20%20ifFalse%3A%20%5Bself%20class%20inheritsFrom%3A%20aClass%5D%0A')}),
  323. smalltalk.Object);
  324. smalltalk.addMethod(
  325. '_isMemberOf_',
  326. smalltalk.method({
  327. selector: 'isMemberOf:',
  328. category: 'testing',
  329. fn: function (aClass) {
  330. var self = this;
  331. return self._class().__eq(aClass);
  332. return self;
  333. },
  334. source: unescape('isMemberOf%3A%20aClass%0A%09%5Eself%20class%20%3D%20aClass%0A')}),
  335. smalltalk.Object);
  336. smalltalk.addMethod(
  337. '_ifNil_',
  338. smalltalk.method({
  339. selector: 'ifNil:',
  340. category: 'testing',
  341. fn: function (aBlock) {
  342. var self = this;
  343. return self;
  344. return self;
  345. },
  346. source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%0A')}),
  347. smalltalk.Object);
  348. smalltalk.addMethod(
  349. '_ifNil_ifNotNil_',
  350. smalltalk.method({
  351. selector: 'ifNil:ifNotNil:',
  352. category: 'testing',
  353. fn: function (aBlock, anotherBlock) {
  354. var self = this;
  355. return anotherBlock._value();
  356. return self;
  357. },
  358. source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value%0A')}),
  359. smalltalk.Object);
  360. smalltalk.addMethod(
  361. '_ifNotNil_',
  362. smalltalk.method({
  363. selector: 'ifNotNil:',
  364. category: 'testing',
  365. fn: function (aBlock) {
  366. var self = this;
  367. return aBlock._value();
  368. return self;
  369. },
  370. source: unescape('ifNotNil%3A%20aBlock%0A%09%5EaBlock%20value%0A')}),
  371. smalltalk.Object);
  372. smalltalk.addMethod(
  373. '_ifNotNil_ifNil_',
  374. smalltalk.method({
  375. selector: 'ifNotNil:ifNil:',
  376. category: 'testing',
  377. fn: function (aBlock, anotherBlock) {
  378. var self = this;
  379. return aBlock._value();
  380. return self;
  381. },
  382. source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EaBlock%20value%0A')}),
  383. smalltalk.Object);
  384. smalltalk.addMethod(
  385. '_isNil',
  386. smalltalk.method({
  387. selector: 'isNil',
  388. category: 'testing',
  389. fn: function () {
  390. var self = this;
  391. return false;
  392. return self;
  393. },
  394. source: unescape('isNil%0A%09%5Efalse%0A')}),
  395. smalltalk.Object);
  396. smalltalk.addMethod(
  397. '_notNil',
  398. smalltalk.method({
  399. selector: 'notNil',
  400. category: 'testing',
  401. fn: function () {
  402. var self = this;
  403. return self._isNil()._not();
  404. return self;
  405. },
  406. source: unescape('notNil%0A%09%5Eself%20isNil%20not%0A')}),
  407. smalltalk.Object);
  408. smalltalk.addMethod(
  409. '_isClass',
  410. smalltalk.method({
  411. selector: 'isClass',
  412. category: 'testing',
  413. fn: function () {
  414. var self = this;
  415. return false;
  416. return self;
  417. },
  418. source: unescape('isClass%0A%09%5Efalse%0A')}),
  419. smalltalk.Object);
  420. smalltalk.addMethod(
  421. '_isMetaclass',
  422. smalltalk.method({
  423. selector: 'isMetaclass',
  424. category: 'testing',
  425. fn: function () {
  426. var self = this;
  427. return false;
  428. return self;
  429. },
  430. source: unescape('isMetaclass%0A%09%5Efalse%0A')}),
  431. smalltalk.Object);
  432. smalltalk.addMethod(
  433. '_isNumber',
  434. smalltalk.method({
  435. selector: 'isNumber',
  436. category: 'testing',
  437. fn: function () {
  438. var self = this;
  439. return false;
  440. return self;
  441. },
  442. source: unescape('isNumber%0A%09%5Efalse%0A')}),
  443. smalltalk.Object);
  444. smalltalk.addMethod(
  445. '_isString',
  446. smalltalk.method({
  447. selector: 'isString',
  448. category: 'testing',
  449. fn: function () {
  450. var self = this;
  451. return false;
  452. return self;
  453. },
  454. source: unescape('isString%0A%09%5Efalse%0A')}),
  455. smalltalk.Object);
  456. smalltalk.addMethod(
  457. '_isParseFailure',
  458. smalltalk.method({
  459. selector: 'isParseFailure',
  460. category: 'testing',
  461. fn: function () {
  462. var self = this;
  463. return false;
  464. return self;
  465. },
  466. source: unescape('isParseFailure%0A%09%5Efalse%0A')}),
  467. smalltalk.Object);
  468. smalltalk.addMethod(
  469. '_basicPerform_',
  470. smalltalk.method({
  471. selector: 'basicPerform:',
  472. category: 'message handling',
  473. fn: function (aSymbol) {
  474. var self = this;
  475. return self._basicPerform_withArguments_(aSymbol, []);
  476. return self;
  477. },
  478. source: unescape('basicPerform%3A%20aSymbol%20%0A%20%20%20%20%5Eself%20basicPerform%3A%20aSymbol%20withArguments%3A%20%23%28%29%0A')}),
  479. smalltalk.Object);
  480. smalltalk.addMethod(
  481. '_basicPerform_withArguments_',
  482. smalltalk.method({
  483. selector: 'basicPerform:withArguments:',
  484. category: 'message handling',
  485. fn: function (aSymbol, aCollection){
  486. var self=this;
  487. return self[aSymbol].apply(self, aCollection);;
  488. return self;},
  489. source: unescape('basicPerform%3A%20aSymbol%20withArguments%3A%20aCollection%0A%09%7B%27return%20self%5BaSymbol%5D.apply%28self%2C%20aCollection%29%3B%27%7D%0A')}),
  490. smalltalk.Object);
  491. smalltalk.addMethod(
  492. '_appendToBrush_',
  493. smalltalk.method({
  494. selector: 'appendToBrush:',
  495. category: '*Canvas',
  496. fn: function (aTagBrush) {
  497. var self = this;
  498. aTagBrush._append_(self._asString());
  499. return self;
  500. },
  501. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20append%3A%20self%20asString%0A')}),
  502. smalltalk.Object);
  503. smalltalk.addMethod(
  504. '_basicDelete_',
  505. smalltalk.method({
  506. selector: 'basicDelete:',
  507. category: 'accessing',
  508. fn: function (aString) {
  509. var self = this;
  510. (function () {delete self[aString];}());
  511. return self;
  512. },
  513. source: unescape('basicDelete%3A%20aString%0A%20%20%20%20%7B%27delete%20self%5BaString%5D%27%7D%0A')}),
  514. smalltalk.Object);
  515. smalltalk.addMethod(
  516. '_inspect',
  517. smalltalk.method({
  518. selector: 'inspect',
  519. category: '*IDE',
  520. fn: function () {
  521. var self = this;
  522. (function ($rec) {$rec._inspect_(self);return $rec._open();}(smalltalk.Inspector._new()));
  523. return self;
  524. },
  525. source: unescape('inspect%0A%09Inspector%20new%20%0A%09%09inspect%3A%20self%3B%0A%09%09open')}),
  526. smalltalk.Object);
  527. smalltalk.addMethod(
  528. '_inspectOn_',
  529. smalltalk.method({
  530. selector: 'inspectOn:',
  531. category: '*IDE',
  532. fn: function (anInspector) {
  533. var self = this;
  534. var variables = nil;
  535. variables = smalltalk.Dictionary._new();
  536. variables._at_put_(unescape("%23self"), self);
  537. self._class()._instanceVariableNames()._do_(function (each) {return variables._at_put_(each, self._instVarAt_(each));});
  538. (function ($rec) {$rec._setLabel_(self._printString());return $rec._setVariables_(variables);}(anInspector));
  539. return self;
  540. },
  541. source: unescape('inspectOn%3A%20anInspector%0A%09%7C%20variables%20%7C%0A%09variables%20%3A%3D%20Dictionary%20new.%0A%09variables%20at%3A%20%27%23self%27%20put%3A%20self.%0A%09self%20class%20instanceVariableNames%20do%3A%20%5B%3Aeach%20%7C%0A%09%09variables%20at%3A%20each%20put%3A%20%28self%20instVarAt%3A%20each%29%5D.%0A%09anInspector%20%0A%09%09setLabel%3A%20self%20printString%3B%0A%09%09setVariables%3A%20variables%0A%09%0A%09')}),
  542. smalltalk.Object);
  543. smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel');
  544. smalltalk.addMethod(
  545. '_classes',
  546. smalltalk.method({
  547. selector: 'classes',
  548. category: 'accessing',
  549. fn: function (){
  550. var self=this;
  551. return self.classes();
  552. return self;},
  553. source: unescape('classes%0A%09%7B%27return%20self.classes%28%29%27%7D')}),
  554. smalltalk.Smalltalk);
  555. smalltalk.Smalltalk.klass.iVarNames = ['current'];
  556. smalltalk.addMethod(
  557. '_current',
  558. smalltalk.method({
  559. selector: 'current',
  560. category: 'accessing',
  561. fn: function (){
  562. var self=this;
  563. return smalltalk;
  564. return self;},
  565. source: unescape('current%0A%09%7B%27return%20smalltalk%27%7D%0A')}),
  566. smalltalk.Smalltalk.klass);
  567. smalltalk.addClass('Behavior', smalltalk.Object, [], 'Kernel');
  568. smalltalk.addMethod(
  569. '_new',
  570. smalltalk.method({
  571. selector: 'new',
  572. category: 'instance creation',
  573. fn: function () {
  574. var self = this;
  575. return function ($rec) {$rec._initialize();return $rec._yourself();}(self._basicNew());
  576. return self;
  577. },
  578. source: unescape('new%0A%09%5Eself%20basicNew%20%0A%09%20%20%20%20initialize%3B%0A%09%20%20%20%20yourself%0A')}),
  579. smalltalk.Behavior);
  580. smalltalk.addMethod(
  581. '_basicNew',
  582. smalltalk.method({
  583. selector: 'basicNew',
  584. category: 'instance creation',
  585. fn: function () {
  586. var self = this;
  587. return function () {return new self.fn;}();
  588. return self;
  589. },
  590. source: unescape('basicNew%0A%09%5E%7B%27return%20new%20self.fn%28%29%3B%27%7D%0A')}),
  591. smalltalk.Behavior);
  592. smalltalk.addMethod(
  593. '_name',
  594. smalltalk.method({
  595. selector: 'name',
  596. category: 'accessing',
  597. fn: function () {
  598. var self = this;
  599. return function () {return self.className || nil;}();
  600. return self;
  601. },
  602. source: unescape('name%0A%09%5E%7B%27return%20self.className%20%7C%7C%20nil%27%7D%0A')}),
  603. smalltalk.Behavior);
  604. smalltalk.addMethod(
  605. '_superclass',
  606. smalltalk.method({
  607. selector: 'superclass',
  608. category: 'accessing',
  609. fn: function () {
  610. var self = this;
  611. return function () {return self.superclass || nil;}();
  612. return self;
  613. },
  614. source: unescape('superclass%0A%09%5E%7B%27return%20self.superclass%20%7C%7C%20nil%27%7D%0A')}),
  615. smalltalk.Behavior);
  616. smalltalk.addMethod(
  617. '_subclasses',
  618. smalltalk.method({
  619. selector: 'subclasses',
  620. category: 'accessing',
  621. fn: function () {
  622. var self = this;
  623. return function () {return smalltalk.subclasses(self);}();
  624. return self;
  625. },
  626. source: unescape('subclasses%0A%09%5E%7B%27return%20smalltalk.subclasses%28self%29%27%7D%0A')}),
  627. smalltalk.Behavior);
  628. smalltalk.addMethod(
  629. '_allSubclasses',
  630. smalltalk.method({
  631. selector: 'allSubclasses',
  632. category: 'accessing',
  633. fn: function () {
  634. var self = this;
  635. var result = nil;
  636. result = self._subclasses();
  637. self._subclasses()._do_(function (each) {return result._addAll_(each._allSubclasses());});
  638. return result;
  639. return self;
  640. },
  641. source: unescape('allSubclasses%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20self%20subclasses.%0A%09self%20subclasses%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20result%20addAll%3A%20each%20allSubclasses%5D.%0A%09%5Eresult%0A')}),
  642. smalltalk.Behavior);
  643. smalltalk.addMethod(
  644. '_withAllSubclasses',
  645. smalltalk.method({
  646. selector: 'withAllSubclasses',
  647. category: 'accessing',
  648. fn: function () {
  649. var self = this;
  650. return function ($rec) {$rec._addAll_(self._allSubclasses());return $rec._yourself();}(smalltalk.Array._with_(self));
  651. return self;
  652. },
  653. source: unescape('withAllSubclasses%0A%09%5E%28Array%20with%3A%20self%29%20addAll%3A%20self%20allSubclasses%3B%20yourself%0A')}),
  654. smalltalk.Behavior);
  655. smalltalk.addMethod(
  656. '_prototype',
  657. smalltalk.method({
  658. selector: 'prototype',
  659. category: 'accessing',
  660. fn: function () {
  661. var self = this;
  662. return function () {return self.fn.prototype;}();
  663. return self;
  664. },
  665. source: unescape('prototype%0A%09%5E%7B%27return%20self.fn.prototype%27%7D%0A')}),
  666. smalltalk.Behavior);
  667. smalltalk.addMethod(
  668. '_methodDictionary',
  669. smalltalk.method({
  670. selector: 'methodDictionary',
  671. category: 'accessing',
  672. fn: function () {
  673. var self = this;
  674. return function () {var dict = smalltalk.Dictionary._new();var methods = self.fn.prototype.methods;for (var i in methods) {if (methods[i].selector) {dict._at_put_(methods[i].selector, methods[i]);}}return dict;}();
  675. return self;
  676. },
  677. source: unescape('methodDictionary%0A%09%5E%7B%27var%20dict%20%3D%20smalltalk.Dictionary._new%28%29%3B%0A%09var%20methods%20%3D%20self.fn.prototype.methods%3B%0A%09for%28var%20i%20in%20methods%29%20%7B%0A%09%09if%28methods%5Bi%5D.selector%29%20%7B%0A%09%09%09dict._at_put_%28methods%5Bi%5D.selector%2C%20methods%5Bi%5D%29%3B%0A%09%09%7D%0A%09%7D%3B%0A%09return%20dict%27%7D%0A')}),
  678. smalltalk.Behavior);
  679. smalltalk.addMethod(
  680. '_instVarNames',
  681. smalltalk.method({
  682. selector: 'instVarNames',
  683. category: '',
  684. fn: function () {
  685. var self = this;
  686. return function () {return self.iVarNames;}();
  687. return self;
  688. },
  689. source: unescape('')}),
  690. smalltalk.Behavior);
  691. smalltalk.addMethod(
  692. '_methodsFor_',
  693. smalltalk.method({
  694. selector: 'methodsFor:',
  695. category: 'accessing',
  696. fn: function (aString) {
  697. var self = this;
  698. return function ($rec) {$rec._class_category_(self, aString);return $rec._yourself();}(smalltalk.ClassCategoryReader._new());
  699. return self;
  700. },
  701. source: unescape('methodsFor%3A%20aString%0A%09%5EClassCategoryReader%20new%0A%09%20%20%20%20class%3A%20self%20category%3A%20aString%3B%0A%09%20%20%20%20yourself%0A')}),
  702. smalltalk.Behavior);
  703. smalltalk.addMethod(
  704. '_addCompiledMethod_',
  705. smalltalk.method({
  706. selector: 'addCompiledMethod:',
  707. category: 'accessing',
  708. fn: function (aMethod) {
  709. var self = this;
  710. (function () {self.fn.prototype[aMethod.selector._asSelector()] = aMethod.fn;self.fn.prototype.methods[aMethod.selector] = aMethod;}());
  711. return self;
  712. },
  713. source: unescape('addCompiledMethod%3A%20aMethod%0A%09%7B%27self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%20%3D%20aMethod.fn%3B%0A%09self.fn.prototype.methods%5BaMethod.selector%5D%20%3D%20aMethod%27%7D%0A')}),
  714. smalltalk.Behavior);
  715. smalltalk.addMethod(
  716. '_instanceVariableNames',
  717. smalltalk.method({
  718. selector: 'instanceVariableNames',
  719. category: 'accessing',
  720. fn: function () {
  721. var self = this;
  722. return function () {return self.iVarNames;}();
  723. return self;
  724. },
  725. source: unescape('instanceVariableNames%0A%09%5E%7B%27return%20self.iVarNames%27%7D%0A')}),
  726. smalltalk.Behavior);
  727. smalltalk.addMethod(
  728. '_comment',
  729. smalltalk.method({
  730. selector: 'comment',
  731. category: 'accessing',
  732. fn: function () {
  733. var self = this;
  734. return self._basicAt_("comment")._ifNil_(function () {return "";});
  735. return self;
  736. },
  737. source: unescape('comment%0A%20%20%20%20%5E%28self%20basicAt%3A%20%27comment%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  738. smalltalk.Behavior);
  739. smalltalk.addMethod(
  740. '_comment_',
  741. smalltalk.method({
  742. selector: 'comment:',
  743. category: 'accessing',
  744. fn: function (aString) {
  745. var self = this;
  746. self._basicAt_put_("comment", aString);
  747. return self;
  748. },
  749. source: unescape('comment%3A%20aString%0A%20%20%20%20self%20basicAt%3A%20%27comment%27%20put%3A%20aString%0A')}),
  750. smalltalk.Behavior);
  751. smalltalk.addMethod(
  752. '_commentStamp',
  753. smalltalk.method({
  754. selector: 'commentStamp',
  755. category: 'accessing',
  756. fn: function () {
  757. var self = this;
  758. return function ($rec) {$rec._class_(self);return $rec._yourself();}(smalltalk.ClassCommentReader._new());
  759. return self;
  760. },
  761. source: unescape('commentStamp%0A%20%20%20%20%5EClassCommentReader%20new%0A%09class%3A%20self%3B%0A%09yourself%0A')}),
  762. smalltalk.Behavior);
  763. smalltalk.addMethod(
  764. '_removeCompiledMethod_',
  765. smalltalk.method({
  766. selector: 'removeCompiledMethod:',
  767. category: 'accessing',
  768. fn: function (aMethod) {
  769. var self = this;
  770. (function () {delete self.fn.prototype[aMethod.selector._asSelector()];delete self.fn.prototype.methods[aMethod.selector];}());
  771. return self;
  772. },
  773. source: unescape('removeCompiledMethod%3A%20aMethod%0A%09%7B%27delete%20self.fn.prototype%5BaMethod.selector._asSelector%28%29%5D%3B%0A%09delete%20self.fn.prototype.methods%5BaMethod.selector%5D%27%7D%0A')}),
  774. smalltalk.Behavior);
  775. smalltalk.addClass('Class', smalltalk.Behavior, [], 'Kernel');
  776. smalltalk.addMethod(
  777. '_category',
  778. smalltalk.method({
  779. selector: 'category',
  780. category: 'accessing',
  781. fn: function (){
  782. var self=this;
  783. return self.category;
  784. return self;},
  785. source: unescape('category%0A%09%7B%27return%20self.category%27%7D')}),
  786. smalltalk.Class);
  787. smalltalk.addMethod(
  788. '_category_',
  789. smalltalk.method({
  790. selector: 'category:',
  791. category: 'accessing',
  792. fn: function (aString) {
  793. var self = this;
  794. (function () {self.category = aString;}());
  795. return self;
  796. },
  797. source: unescape('category%3A%20aString%0A%09%7B%27self.category%20%3D%20aString%27%7D%0A')}),
  798. smalltalk.Class);
  799. smalltalk.addMethod(
  800. '_subclass_instanceVariableNames_',
  801. smalltalk.method({
  802. selector: 'subclass:instanceVariableNames:',
  803. category: 'class creation',
  804. fn: function (aString, anotherString) {
  805. var self = this;
  806. return self._subclass_instanceVariableNames_category_(aString, anotherString, nil);
  807. return self;
  808. },
  809. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20category%3A%20nil%0A')}),
  810. smalltalk.Class);
  811. smalltalk.addMethod(
  812. '_subclass_instanceVariableNames_category_',
  813. smalltalk.method({
  814. selector: 'subclass:instanceVariableNames:category:',
  815. category: 'class creation',
  816. fn: function (aString, aString2, aString3) {
  817. var self = this;
  818. return smalltalk.ClassBuilder._new()._superclass_subclass_instanceVariableNames_category_(self, aString, aString2, aString3);
  819. return self;
  820. },
  821. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A')}),
  822. smalltalk.Class);
  823. smalltalk.addMethod(
  824. '_isClass',
  825. smalltalk.method({
  826. selector: 'isClass',
  827. category: 'testing',
  828. fn: function () {
  829. var self = this;
  830. return true;
  831. return self;
  832. },
  833. source: unescape('isClass%0A%09%5Etrue%0A')}),
  834. smalltalk.Class);
  835. smalltalk.addMethod(
  836. '_printString',
  837. smalltalk.method({
  838. selector: 'printString',
  839. category: 'printing',
  840. fn: function () {
  841. var self = this;
  842. return self._name();
  843. return self;
  844. },
  845. source: unescape('printString%0A%09%5Eself%20name%0A')}),
  846. smalltalk.Class);
  847. smalltalk.addMethod(
  848. '_rename_',
  849. smalltalk.method({
  850. selector: 'rename:',
  851. category: 'accessing',
  852. fn: function (aString) {
  853. var self = this;
  854. (function () {smalltalk[aString] = self;delete smalltalk[self.className];self.className = aString;}());
  855. return self;
  856. },
  857. source: unescape('rename%3A%20aString%0A%09%7B%27%0A%09%09smalltalk%5BaString%5D%20%3D%20self%3B%0A%09%09delete%20smalltalk%5Bself.className%5D%3B%0A%09%09self.className%20%3D%20aString%3B%0A%09%27%7D')}),
  858. smalltalk.Class);
  859. smalltalk.addClass('Metaclass', smalltalk.Behavior, [], 'Kernel');
  860. smalltalk.addMethod(
  861. '_instanceClass',
  862. smalltalk.method({
  863. selector: 'instanceClass',
  864. category: 'accessing',
  865. fn: function (){
  866. var self=this;
  867. return self.instanceClass;
  868. return self;},
  869. source: unescape('instanceClass%0A%09%7B%27return%20self.instanceClass%27%7D')}),
  870. smalltalk.Metaclass);
  871. smalltalk.addMethod(
  872. '_instanceVariableNames_',
  873. smalltalk.method({
  874. selector: 'instanceVariableNames:',
  875. category: 'accessing',
  876. fn: function (aCollection) {
  877. var self = this;
  878. smalltalk.ClassBuilder._new()._class_instanceVariableNames_(self, aCollection);
  879. return self;
  880. },
  881. source: unescape('instanceVariableNames%3A%20aCollection%0A%09ClassBuilder%20new%0A%09%20%20%20%20class%3A%20self%20instanceVariableNames%3A%20aCollection%0A')}),
  882. smalltalk.Metaclass);
  883. smalltalk.addMethod(
  884. '_isMetaclass',
  885. smalltalk.method({
  886. selector: 'isMetaclass',
  887. category: 'testing',
  888. fn: function () {
  889. var self = this;
  890. return true;
  891. return self;
  892. },
  893. source: unescape('isMetaclass%0A%09%5Etrue%0A')}),
  894. smalltalk.Metaclass);
  895. smalltalk.addMethod(
  896. '_printString',
  897. smalltalk.method({
  898. selector: 'printString',
  899. category: 'printing',
  900. fn: function () {
  901. var self = this;
  902. return self._instanceClass()._name().__comma(" class");
  903. return self;
  904. },
  905. source: unescape('printString%0A%09%5Eself%20instanceClass%20name%2C%20%27%20class%27%0A')}),
  906. smalltalk.Metaclass);
  907. smalltalk.addClass('CompiledMethod', smalltalk.Object, [], 'Kernel');
  908. smalltalk.addMethod(
  909. '_source',
  910. smalltalk.method({
  911. selector: 'source',
  912. category: 'accessing',
  913. fn: function () {
  914. var self = this;
  915. return self._basicAt_("source")._ifNil_(function () {return "";});
  916. return self;
  917. },
  918. source: unescape('source%0A%09%5E%28self%20basicAt%3A%20%27source%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  919. smalltalk.CompiledMethod);
  920. smalltalk.addMethod(
  921. '_source_',
  922. smalltalk.method({
  923. selector: 'source:',
  924. category: 'accessing',
  925. fn: function (aString) {
  926. var self = this;
  927. self._basicAt_put_("source", aString);
  928. return self;
  929. },
  930. source: unescape('source%3A%20aString%0A%09self%20basicAt%3A%20%27source%27%20put%3A%20aString%0A')}),
  931. smalltalk.CompiledMethod);
  932. smalltalk.addMethod(
  933. '_category',
  934. smalltalk.method({
  935. selector: 'category',
  936. category: 'accessing',
  937. fn: function () {
  938. var self = this;
  939. return self._basicAt_("category")._ifNil_(function () {return "";});
  940. return self;
  941. },
  942. source: unescape('category%0A%09%5E%28self%20basicAt%3A%20%27category%27%29%20ifNil%3A%20%5B%27%27%5D%0A')}),
  943. smalltalk.CompiledMethod);
  944. smalltalk.addMethod(
  945. '_category_',
  946. smalltalk.method({
  947. selector: 'category:',
  948. category: 'accessing',
  949. fn: function (aString) {
  950. var self = this;
  951. self._basicAt_put_("category", aString);
  952. return self;
  953. },
  954. source: unescape('category%3A%20aString%0A%09self%20basicAt%3A%20%27category%27%20put%3A%20aString%0A')}),
  955. smalltalk.CompiledMethod);
  956. smalltalk.addMethod(
  957. '_selector',
  958. smalltalk.method({
  959. selector: 'selector',
  960. category: 'accessing',
  961. fn: function () {
  962. var self = this;
  963. return self._basicAt_("selector");
  964. return self;
  965. },
  966. source: unescape('selector%0A%09%5Eself%20basicAt%3A%20%27selector%27%0A')}),
  967. smalltalk.CompiledMethod);
  968. smalltalk.addMethod(
  969. '_selector_',
  970. smalltalk.method({
  971. selector: 'selector:',
  972. category: 'accessing',
  973. fn: function (aString) {
  974. var self = this;
  975. self._basicAt_put_("selector", aString);
  976. return self;
  977. },
  978. source: unescape('selector%3A%20aString%0A%09self%20basicAt%3A%20%27selector%27%20put%3A%20aString%0A')}),
  979. smalltalk.CompiledMethod);
  980. smalltalk.addMethod(
  981. '_fn',
  982. smalltalk.method({
  983. selector: 'fn',
  984. category: 'accessing',
  985. fn: function () {
  986. var self = this;
  987. return self._basicAt_("fn");
  988. return self;
  989. },
  990. source: unescape('fn%0A%09%5Eself%20basicAt%3A%20%27fn%27%0A')}),
  991. smalltalk.CompiledMethod);
  992. smalltalk.addMethod(
  993. '_fn_',
  994. smalltalk.method({
  995. selector: 'fn:',
  996. category: 'accessing',
  997. fn: function (aBlock) {
  998. var self = this;
  999. self._basicAt_put_("fn", aBlock);
  1000. return self;
  1001. },
  1002. source: unescape('fn%3A%20aBlock%0A%09self%20basicAt%3A%20%27fn%27%20put%3A%20aBlock%0A')}),
  1003. smalltalk.CompiledMethod);
  1004. smalltalk.addClass('Number', smalltalk.Object, [], 'Kernel');
  1005. smalltalk.addMethod(
  1006. '__eq',
  1007. smalltalk.method({
  1008. selector: '=',
  1009. category: 'comparing',
  1010. fn: function (aNumber){
  1011. var self=this;
  1012. return Number(self) == aNumber;
  1013. return self;},
  1014. source: unescape('%3D%20aNumber%0A%09%7B%27return%20Number%28self%29%20%3D%3D%20aNumber%27%7D')}),
  1015. smalltalk.Number);
  1016. smalltalk.addMethod(
  1017. '__gt',
  1018. smalltalk.method({
  1019. selector: '>',
  1020. category: 'comparing',
  1021. fn: function (aNumber){
  1022. var self=this;
  1023. return self > aNumber;
  1024. return self;},
  1025. source: unescape('%3E%20aNumber%0A%09%7B%27return%20self%20%3E%20aNumber%27%7D')}),
  1026. smalltalk.Number);
  1027. smalltalk.addMethod(
  1028. '__lt',
  1029. smalltalk.method({
  1030. selector: '<',
  1031. category: 'comparing',
  1032. fn: function (aNumber){
  1033. var self=this;
  1034. return self < aNumber;
  1035. return self;},
  1036. source: unescape('%3C%20aNumber%0A%09%7B%27return%20self%20%3C%20aNumber%27%7D')}),
  1037. smalltalk.Number);
  1038. smalltalk.addMethod(
  1039. '__gt_eq',
  1040. smalltalk.method({
  1041. selector: '>=',
  1042. category: 'comparing',
  1043. fn: function (aNumber){
  1044. var self=this;
  1045. return self >= aNumber;
  1046. return self;},
  1047. source: unescape('%3E%3D%20aNumber%0A%09%7B%27return%20self%20%3E%3D%20aNumber%27%7D')}),
  1048. smalltalk.Number);
  1049. smalltalk.addMethod(
  1050. '__lt_eq',
  1051. smalltalk.method({
  1052. selector: '<=',
  1053. category: 'comparing',
  1054. fn: function (aNumber){
  1055. var self=this;
  1056. return self <= aNumber;
  1057. return self;},
  1058. source: unescape('%3C%3D%20aNumber%0A%09%7B%27return%20self%20%3C%3D%20aNumber%27%7D')}),
  1059. smalltalk.Number);
  1060. smalltalk.addMethod(
  1061. '__plus',
  1062. smalltalk.method({
  1063. selector: '+',
  1064. category: 'arithmetic',
  1065. fn: function (aNumber){
  1066. var self=this;
  1067. return self + aNumber;
  1068. return self;},
  1069. source: unescape('+%20aNumber%0A%09%7B%27return%20self%20+%20aNumber%27%7D')}),
  1070. smalltalk.Number);
  1071. smalltalk.addMethod(
  1072. '__minus',
  1073. smalltalk.method({
  1074. selector: '-',
  1075. category: 'arithmetic',
  1076. fn: function (aNumber){
  1077. var self=this;
  1078. return self - aNumber;
  1079. return self;},
  1080. source: unescape('-%20aNumber%0A%09%7B%27return%20self%20-%20aNumber%27%7D')}),
  1081. smalltalk.Number);
  1082. smalltalk.addMethod(
  1083. '__star',
  1084. smalltalk.method({
  1085. selector: '*',
  1086. category: 'arithmetic',
  1087. fn: function (aNumber){
  1088. var self=this;
  1089. return self * aNumber;
  1090. return self;},
  1091. source: unescape('*%20aNumber%0A%09%7B%27return%20self%20*%20aNumber%27%7D')}),
  1092. smalltalk.Number);
  1093. smalltalk.addMethod(
  1094. '__slash',
  1095. smalltalk.method({
  1096. selector: '/',
  1097. category: 'arithmetic',
  1098. fn: function (aNumber){
  1099. var self=this;
  1100. return self / aNumber;
  1101. return self;},
  1102. source: unescape('/%20aNumber%0A%09%7B%27return%20self%20/%20aNumber%27%7D')}),
  1103. smalltalk.Number);
  1104. smalltalk.addMethod(
  1105. '_max_',
  1106. smalltalk.method({
  1107. selector: 'max:',
  1108. category: 'arithmetic',
  1109. fn: function (aNumber){
  1110. var self=this;
  1111. return Math.max(self, aNumber);;
  1112. return self;},
  1113. source: unescape('max%3A%20aNumber%0A%09%7B%27return%20Math.max%28self%2C%20aNumber%29%3B%27%7D')}),
  1114. smalltalk.Number);
  1115. smalltalk.addMethod(
  1116. '_min_',
  1117. smalltalk.method({
  1118. selector: 'min:',
  1119. category: 'arithmetic',
  1120. fn: function (aNumber){
  1121. var self=this;
  1122. return Math.min(self, aNumber);;
  1123. return self;},
  1124. source: unescape('min%3A%20aNumber%0A%09%7B%27return%20Math.min%28self%2C%20aNumber%29%3B%27%7D')}),
  1125. smalltalk.Number);
  1126. smalltalk.addMethod(
  1127. '_rounded',
  1128. smalltalk.method({
  1129. selector: 'rounded',
  1130. category: 'converting',
  1131. fn: function (){
  1132. var self=this;
  1133. return Math.round(self);;
  1134. return self;},
  1135. source: unescape('rounded%0A%09%7B%27return%20Math.round%28self%29%3B%27%7D')}),
  1136. smalltalk.Number);
  1137. smalltalk.addMethod(
  1138. '_truncated',
  1139. smalltalk.method({
  1140. selector: 'truncated',
  1141. category: 'converting',
  1142. fn: function (){
  1143. var self=this;
  1144. return Math.floor(self);;
  1145. return self;},
  1146. source: unescape('truncated%0A%09%7B%27return%20Math.floor%28self%29%3B%27%7D')}),
  1147. smalltalk.Number);
  1148. smalltalk.addMethod(
  1149. '_to_',
  1150. smalltalk.method({
  1151. selector: 'to:',
  1152. category: 'converting',
  1153. fn: function (aNumber) {
  1154. var self = this;
  1155. var array = nil;
  1156. var first = nil;
  1157. var last = nil;
  1158. var count = nil;
  1159. first = self._truncated();
  1160. last = aNumber._truncated().__plus(1);
  1161. count = 1;
  1162. first.__lt_eq(last)._ifFalse_(function () {return self._error_("Wrong interval");});
  1163. array = smalltalk.Array._new();
  1164. last.__minus(first)._timesRepeat_(function () {array._at_put_(count, first);count = count.__plus(1);return first = first.__plus(1);});
  1165. return array;
  1166. return self;
  1167. },
  1168. source: unescape('to%3A%20aNumber%0A%09%7C%20array%20first%20last%20count%20%7C%0A%09first%20%3A%3D%20self%20truncated.%0A%09last%20%3A%3D%20aNumber%20truncated%20+%201.%0A%09count%20%3A%3D%201.%0A%09%28first%20%3C%3D%20last%29%20ifFalse%3A%20%5Bself%20error%3A%20%27Wrong%20interval%27%5D.%0A%09array%20%3A%3D%20Array%20new.%0A%09%28last%20-%20first%29%20timesRepeat%3A%20%5B%0A%09%20%20%20%20array%20at%3A%20count%20put%3A%20first.%0A%09%20%20%20%20count%20%3A%3D%20count%20+%201.%0A%09%20%20%20%20first%20%3A%3D%20first%20+%201%5D.%0A%09%5Earray%0A')}),
  1169. smalltalk.Number);
  1170. smalltalk.addMethod(
  1171. '_timesRepeat_',
  1172. smalltalk.method({
  1173. selector: 'timesRepeat:',
  1174. category: 'enumerating',
  1175. fn: function (aBlock) {
  1176. var self = this;
  1177. var integer = nil;
  1178. var count = nil;
  1179. integer = self._truncated();
  1180. count = 1;
  1181. (function () {return count.__gt(self);}._whileFalse_(function () {aBlock._value();return count = count.__plus(1);}));
  1182. return self;
  1183. },
  1184. source: unescape('timesRepeat%3A%20aBlock%0A%09%7C%20integer%20count%20%7C%0A%09integer%20%3A%3D%20self%20truncated.%0A%09count%20%3A%3D%201.%0A%09%5Bcount%20%3E%20self%5D%20whileFalse%3A%20%5B%0A%09%20%20%20%20aBlock%20value.%0A%09%20%20%20%20count%20%3A%3D%20count%20+%201%5D%0A')}),
  1185. smalltalk.Number);
  1186. smalltalk.addMethod(
  1187. '_to_do_',
  1188. smalltalk.method({
  1189. selector: 'to:do:',
  1190. category: 'enumerating',
  1191. fn: function (aNumber, aBlock) {
  1192. var self = this;
  1193. return self._to_(aNumber)._do_(aBlock);
  1194. return self;
  1195. },
  1196. source: unescape('to%3A%20aNumber%20do%3A%20aBlock%0A%09%5E%28self%20to%3A%20aNumber%29%20do%3A%20aBlock%0A')}),
  1197. smalltalk.Number);
  1198. smalltalk.addMethod(
  1199. '_asString',
  1200. smalltalk.method({
  1201. selector: 'asString',
  1202. category: 'converting',
  1203. fn: function () {
  1204. var self = this;
  1205. return self._printString();
  1206. return self;
  1207. },
  1208. source: unescape('asString%0A%09%5Eself%20printString%0A')}),
  1209. smalltalk.Number);
  1210. smalltalk.addMethod(
  1211. '_asJavascript',
  1212. smalltalk.method({
  1213. selector: 'asJavascript',
  1214. category: 'converting',
  1215. fn: function () {
  1216. var self = this;
  1217. return unescape("%28").__comma(self._printString()).__comma(unescape("%29"));
  1218. return self;
  1219. },
  1220. source: unescape('asJavascript%0A%09%5E%27%28%27%2C%20self%20printString%2C%20%27%29%27%0A')}),
  1221. smalltalk.Number);
  1222. smalltalk.addMethod(
  1223. '_printString',
  1224. smalltalk.method({
  1225. selector: 'printString',
  1226. category: 'printing',
  1227. fn: function (){
  1228. var self=this;
  1229. return String(self);
  1230. return self;},
  1231. source: unescape('printString%0A%09%7B%27return%20String%28self%29%27%7D')}),
  1232. smalltalk.Number);
  1233. smalltalk.addMethod(
  1234. '_isNumber',
  1235. smalltalk.method({
  1236. selector: 'isNumber',
  1237. category: 'testing',
  1238. fn: function () {
  1239. var self = this;
  1240. return true;
  1241. return self;
  1242. },
  1243. source: unescape('isNumber%0A%09%5Etrue%0A')}),
  1244. smalltalk.Number);
  1245. smalltalk.addMethod(
  1246. '_atRandom',
  1247. smalltalk.method({
  1248. selector: 'atRandom',
  1249. category: 'converting',
  1250. fn: function () {
  1251. var self = this;
  1252. return smalltalk.Random._new()._next().__star(self)._truncated().__plus(1);
  1253. return self;
  1254. },
  1255. source: unescape('atRandom%0A%20%20%20%20%5E%28Random%20new%20next%20*%20self%29%20truncated%20+%201%0A')}),
  1256. smalltalk.Number);
  1257. smalltalk.addMethod(
  1258. '__at',
  1259. smalltalk.method({
  1260. selector: '@',
  1261. category: 'converting',
  1262. fn: function (aNumber) {
  1263. var self = this;
  1264. return smalltalk.Point._x_y_(self, aNumber);
  1265. return self;
  1266. },
  1267. source: unescape('@%20aNumber%0A%09%5EPoint%20x%3A%20self%20y%3A%20aNumber')}),
  1268. smalltalk.Number);
  1269. smalltalk.addMethod(
  1270. '_asPoint',
  1271. smalltalk.method({
  1272. selector: 'asPoint',
  1273. category: 'converting',
  1274. fn: function () {
  1275. var self = this;
  1276. return smalltalk.Point._x_y_(self, self);
  1277. return self;
  1278. },
  1279. source: unescape('asPoint%0A%09%5EPoint%20x%3A%20self%20y%3A%20self')}),
  1280. smalltalk.Number);
  1281. smalltalk.addMethod(
  1282. '_clearInterval',
  1283. smalltalk.method({
  1284. selector: 'clearInterval',
  1285. category: 'intervals',
  1286. fn: function () {
  1287. var self = this;
  1288. (function () {clearInterval(Number(self));}());
  1289. return self;
  1290. },
  1291. source: unescape('clearInterval%0A%09%7B%27clearInterval%28Number%28self%29%29%27%7D')}),
  1292. smalltalk.Number);
  1293. smalltalk.addMethod(
  1294. '_pi',
  1295. smalltalk.method({
  1296. selector: 'pi',
  1297. category: 'instance creation',
  1298. fn: function (){
  1299. var self=this;
  1300. return Math.PI;
  1301. return self;},
  1302. source: unescape('pi%0A%09%7B%27return%20Math.PI%27%7D')}),
  1303. smalltalk.Number.klass);
  1304. smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel');
  1305. smalltalk.addMethod(
  1306. '_compiledSource',
  1307. smalltalk.method({
  1308. selector: 'compiledSource',
  1309. category: 'accessing',
  1310. fn: function () {
  1311. var self = this;
  1312. return function () {return self.toString();}();
  1313. return self;
  1314. },
  1315. source: unescape('compiledSource%0A%09%5E%7B%27return%20self.toString%28%29%27%7D%0A')}),
  1316. smalltalk.BlockClosure);
  1317. smalltalk.addMethod(
  1318. '_whileTrue_',
  1319. smalltalk.method({
  1320. selector: 'whileTrue:',
  1321. category: 'controlling',
  1322. fn: function (aBlock) {
  1323. var self = this;
  1324. (function () {while (self()) {aBlock();}}());
  1325. return self;
  1326. },
  1327. source: unescape('whileTrue%3A%20aBlock%0A%09%7B%27while%28self%28%29%29%20%7BaBlock%28%29%7D%27%7D%0A')}),
  1328. smalltalk.BlockClosure);
  1329. smalltalk.addMethod(
  1330. '_whileFalse_',
  1331. smalltalk.method({
  1332. selector: 'whileFalse:',
  1333. category: 'controlling',
  1334. fn: function (aBlock) {
  1335. var self = this;
  1336. (function () {while (!self()) {aBlock();}}());
  1337. return self;
  1338. },
  1339. source: unescape('whileFalse%3A%20aBlock%0A%09%7B%27while%28%21self%28%29%29%20%7BaBlock%28%29%7D%27%7D%0A')}),
  1340. smalltalk.BlockClosure);
  1341. smalltalk.addMethod(
  1342. '_value',
  1343. smalltalk.method({
  1344. selector: 'value',
  1345. category: 'evaluating',
  1346. fn: function () {
  1347. var self = this;
  1348. return function () {return self();}();
  1349. return self;
  1350. },
  1351. source: unescape('value%0A%09%5E%7B%27return%20self%28%29%3B%27%7D%0A')}),
  1352. smalltalk.BlockClosure);
  1353. smalltalk.addMethod(
  1354. '_value_',
  1355. smalltalk.method({
  1356. selector: 'value:',
  1357. category: 'evaluating',
  1358. fn: function (anArg) {
  1359. var self = this;
  1360. return function () {return self(anArg);}();
  1361. return self;
  1362. },
  1363. source: unescape('value%3A%20anArg%0A%09%5E%7B%27return%20self%28anArg%29%3B%27%7D%0A')}),
  1364. smalltalk.BlockClosure);
  1365. smalltalk.addMethod(
  1366. '_value_value_',
  1367. smalltalk.method({
  1368. selector: 'value:value:',
  1369. category: 'evaluating',
  1370. fn: function (firstArg, secondArg) {
  1371. var self = this;
  1372. return function () {return self(firstArg, secondArg);}();
  1373. return self;
  1374. },
  1375. source: unescape('value%3A%20firstArg%20value%3A%20secondArg%0A%09%5E%7B%27return%20self%28firstArg%2C%20secondArg%29%3B%27%7D%0A')}),
  1376. smalltalk.BlockClosure);
  1377. smalltalk.addMethod(
  1378. '_value_value_value_',
  1379. smalltalk.method({
  1380. selector: 'value:value:value:',
  1381. category: 'evaluating',
  1382. fn: function (firstArg, secondArg, thirdArg) {
  1383. var self = this;
  1384. return function () {return self(firstArg, secondArg, thirdArg);}();
  1385. return self;
  1386. },
  1387. source: unescape('value%3A%20firstArg%20value%3A%20secondArg%20value%3A%20thirdArg%0A%09%5E%7B%27return%20self%28firstArg%2C%20secondArg%2C%20thirdArg%29%3B%27%7D%0A')}),
  1388. smalltalk.BlockClosure);
  1389. smalltalk.addMethod(
  1390. '_valueWithPossibleArguments_',
  1391. smalltalk.method({
  1392. selector: 'valueWithPossibleArguments:',
  1393. category: 'evaluating',
  1394. fn: function (aCollection) {
  1395. var self = this;
  1396. return function () {return self.apply(null, aCollection);}();
  1397. return self;
  1398. },
  1399. source: unescape('valueWithPossibleArguments%3A%20aCollection%0A%09%5E%7B%27return%20self.apply%28null%2C%20aCollection%29%3B%27%7D%0A')}),
  1400. smalltalk.BlockClosure);
  1401. smalltalk.addMethod(
  1402. '_on_do_',
  1403. smalltalk.method({
  1404. selector: 'on:do:',
  1405. category: 'error handling',
  1406. fn: function (anErrorClass, aBlock) {
  1407. var self = this;
  1408. self._try_catch_(self, function (error) {return error._isKindOf_(anErrorClass)._ifTrue_ifFalse_(function () {return aBlock._value();}, function () {return error._signal();});});
  1409. return self;
  1410. },
  1411. source: unescape('on%3A%20anErrorClass%20do%3A%20aBlock%0A%09self%20try%3A%20self%20catch%3A%20%5B%3Aerror%20%7C%0A%09%20%20%20%20%28error%20isKindOf%3A%20anErrorClass%29%20%0A%09%20%20%20%20%20ifTrue%3A%20%5BaBlock%20value%5D%0A%09%20%20%20%20%20ifFalse%3A%20%5Berror%20signal%5D%5D%0A')}),
  1412. smalltalk.BlockClosure);
  1413. smalltalk.addMethod(
  1414. '_appendToJQuery_',
  1415. smalltalk.method({
  1416. selector: 'appendToJQuery:',
  1417. category: '*JQuery',
  1418. fn: function (aJQuery) {
  1419. var self = this;
  1420. var canvas = nil;
  1421. canvas = smalltalk.HTMLCanvas._new();
  1422. self._value_(canvas);
  1423. aJQuery._append_(canvas);
  1424. return self;
  1425. },
  1426. source: unescape('appendToJQuery%3A%20aJQuery%0A%09%7C%20canvas%20%7C%0A%09canvas%20%3A%3D%20HTMLCanvas%20new.%0A%09self%20value%3A%20canvas.%0A%09aJQuery%20append%3A%20canvas%0A')}),
  1427. smalltalk.BlockClosure);
  1428. smalltalk.addMethod(
  1429. '_appendToBrush_',
  1430. smalltalk.method({
  1431. selector: 'appendToBrush:',
  1432. category: '*Canvas',
  1433. fn: function (aTagBrush) {
  1434. var self = this;
  1435. aTagBrush._appendBlock_(self);
  1436. return self;
  1437. },
  1438. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendBlock%3A%20self%0A')}),
  1439. smalltalk.BlockClosure);
  1440. smalltalk.addMethod(
  1441. '_valueWithTimeout_',
  1442. smalltalk.method({
  1443. selector: 'valueWithTimeout:',
  1444. category: 'timeout/interval',
  1445. fn: function (aNumber) {
  1446. var self = this;
  1447. (function () {setTimeout(self, aNumber);}());
  1448. return self;
  1449. },
  1450. source: unescape('valueWithTimeout%3A%20aNumber%0A%09%7B%27setTimeout%28self%2C%20aNumber%29%27%7D')}),
  1451. smalltalk.BlockClosure);
  1452. smalltalk.addMethod(
  1453. '_valueWithInterval_',
  1454. smalltalk.method({
  1455. selector: 'valueWithInterval:',
  1456. category: 'timeout/interval',
  1457. fn: function (aNumber) {
  1458. var self = this;
  1459. return function () {return setInterval(self, aNumber);}();
  1460. return self;
  1461. },
  1462. source: unescape('valueWithInterval%3A%20aNumber%0A%09%5E%7B%27return%20setInterval%28self%2C%20aNumber%29%27%7D')}),
  1463. smalltalk.BlockClosure);
  1464. smalltalk.addClass('Boolean', smalltalk.Object, [], 'Kernel');
  1465. smalltalk.addMethod(
  1466. '__eq',
  1467. smalltalk.method({
  1468. selector: '=',
  1469. category: 'comparing',
  1470. fn: function (aBoolean){
  1471. var self=this;
  1472. return Boolean(self == true) == aBoolean;
  1473. return self;},
  1474. source: unescape('%3D%20aBoolean%0A%09%7B%27return%20Boolean%28self%20%3D%3D%20true%29%20%3D%3D%20aBoolean%27%7D')}),
  1475. smalltalk.Boolean);
  1476. smalltalk.addMethod(
  1477. '_shallowCopy',
  1478. smalltalk.method({
  1479. selector: 'shallowCopy',
  1480. category: 'copying',
  1481. fn: function () {
  1482. var self = this;
  1483. return self;
  1484. return self;
  1485. },
  1486. source: unescape('shallowCopy%0A%09%5Eself%0A')}),
  1487. smalltalk.Boolean);
  1488. smalltalk.addMethod(
  1489. '_deepCopy',
  1490. smalltalk.method({
  1491. selector: 'deepCopy',
  1492. category: 'copying',
  1493. fn: function () {
  1494. var self = this;
  1495. return self;
  1496. return self;
  1497. },
  1498. source: unescape('deepCopy%0A%09%5Eself%0A')}),
  1499. smalltalk.Boolean);
  1500. smalltalk.addMethod(
  1501. '_ifTrue_',
  1502. smalltalk.method({
  1503. selector: 'ifTrue:',
  1504. category: 'controlling',
  1505. fn: function (aBlock) {
  1506. var self = this;
  1507. return self._ifTrue_ifFalse_(aBlock, function () {return nil;});
  1508. return self;
  1509. },
  1510. source: unescape('ifTrue%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20aBlock%20ifFalse%3A%20%5B%5D%0A')}),
  1511. smalltalk.Boolean);
  1512. smalltalk.addMethod(
  1513. '_ifFalse_',
  1514. smalltalk.method({
  1515. selector: 'ifFalse:',
  1516. category: 'controlling',
  1517. fn: function (aBlock) {
  1518. var self = this;
  1519. return self._ifTrue_ifFalse_(function () {return nil;}, aBlock);
  1520. return self;
  1521. },
  1522. source: unescape('ifFalse%3A%20aBlock%0A%09%5Eself%20ifTrue%3A%20%5B%5D%20ifFalse%3A%20aBlock%0A')}),
  1523. smalltalk.Boolean);
  1524. smalltalk.addMethod(
  1525. '_ifFalse_ifTrue_',
  1526. smalltalk.method({
  1527. selector: 'ifFalse:ifTrue:',
  1528. category: 'controlling',
  1529. fn: function (aBlock, anotherBlock) {
  1530. var self = this;
  1531. return self._ifTrue_ifFalse_(anotherBlock, aBlock);
  1532. return self;
  1533. },
  1534. source: unescape('ifFalse%3A%20aBlock%20ifTrue%3A%20anotherBlock%0A%09%5Eself%20ifTrue%3A%20anotherBlock%20ifFalse%3A%20aBlock%0A')}),
  1535. smalltalk.Boolean);
  1536. smalltalk.addMethod(
  1537. '_ifTrue_ifFalse_',
  1538. smalltalk.method({
  1539. selector: 'ifTrue:ifFalse:',
  1540. category: 'controlling',
  1541. fn: function (aBlock, anotherBlock){
  1542. var self=this;
  1543. if(self == true) {
  1544. return aBlock();
  1545. } else {
  1546. return anotherBlock();
  1547. }
  1548. ;
  1549. return self;},
  1550. source: unescape('ifTrue%3A%20aBlock%20ifFalse%3A%20anotherBlock%0A%09%7B%27%0A%09%20%20%20%20if%28self%20%3D%3D%20true%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20anotherBlock%28%29%3B%0A%09%20%20%20%20%7D%0A%09%27%7D')}),
  1551. smalltalk.Boolean);
  1552. smalltalk.addMethod(
  1553. '_and_',
  1554. smalltalk.method({
  1555. selector: 'and:',
  1556. category: 'controlling',
  1557. fn: function (aBlock) {
  1558. var self = this;
  1559. return self.__eq(true)._ifTrue_ifFalse_(aBlock, function () {return false;});
  1560. return self;
  1561. },
  1562. source: unescape('and%3A%20aBlock%0A%09%5Eself%20%3D%20true%0A%09%20%20%20%20ifTrue%3A%20aBlock%0A%09%20%20%20%20ifFalse%3A%20%5Bfalse%5D%0A')}),
  1563. smalltalk.Boolean);
  1564. smalltalk.addMethod(
  1565. '_or_',
  1566. smalltalk.method({
  1567. selector: 'or:',
  1568. category: 'controlling',
  1569. fn: function (aBlock) {
  1570. var self = this;
  1571. return self.__eq(true)._ifTrue_ifFalse_(function () {return true;}, aBlock);
  1572. return self;
  1573. },
  1574. source: unescape('or%3A%20aBlock%0A%09%5Eself%20%3D%20true%0A%09%20%20%20%20ifTrue%3A%20%5Btrue%5D%0A%09%20%20%20%20ifFalse%3A%20aBlock%0A')}),
  1575. smalltalk.Boolean);
  1576. smalltalk.addMethod(
  1577. '_not',
  1578. smalltalk.method({
  1579. selector: 'not',
  1580. category: 'controlling',
  1581. fn: function () {
  1582. var self = this;
  1583. return self.__eq(false);
  1584. return self;
  1585. },
  1586. source: unescape('not%0A%09%5Eself%20%3D%20false%0A')}),
  1587. smalltalk.Boolean);
  1588. smalltalk.addMethod(
  1589. '_printString',
  1590. smalltalk.method({
  1591. selector: 'printString',
  1592. category: 'printing',
  1593. fn: function (){
  1594. var self=this;
  1595. return self.toString();
  1596. return self;},
  1597. source: unescape('printString%0A%09%7B%27return%20self.toString%28%29%27%7D')}),
  1598. smalltalk.Boolean);
  1599. smalltalk.addClass('Date', smalltalk.Object, [], 'Kernel');
  1600. smalltalk.Date.comment=unescape('The%20Date%20class%20is%20used%20to%20work%20with%20dates%20and%20times.')
  1601. smalltalk.addMethod(
  1602. '_year',
  1603. smalltalk.method({
  1604. selector: 'year',
  1605. category: 'accessing',
  1606. fn: function (){
  1607. var self=this;
  1608. return self.getFullYear();
  1609. return self;},
  1610. source: unescape('year%0A%09%7B%27return%20self.getFullYear%28%29%27%7D')}),
  1611. smalltalk.Date);
  1612. smalltalk.addMethod(
  1613. '_month',
  1614. smalltalk.method({
  1615. selector: 'month',
  1616. category: 'accessing',
  1617. fn: function (){
  1618. var self=this;
  1619. return self.getMonth() + 1;
  1620. return self;},
  1621. source: unescape('month%0A%09%7B%27return%20self.getMonth%28%29%20+%201%27%7D')}),
  1622. smalltalk.Date);
  1623. smalltalk.addMethod(
  1624. '_month_',
  1625. smalltalk.method({
  1626. selector: 'month:',
  1627. category: 'accessing',
  1628. fn: function (aNumber) {
  1629. var self = this;
  1630. (function () {self.setMonth(aNumber - 1);}());
  1631. return self;
  1632. },
  1633. source: unescape('month%3A%20aNumber%0A%09%7B%27self.setMonth%28aNumber%20-%201%29%27%7D')}),
  1634. smalltalk.Date);
  1635. smalltalk.addMethod(
  1636. '_day',
  1637. smalltalk.method({
  1638. selector: 'day',
  1639. category: 'accessing',
  1640. fn: function () {
  1641. var self = this;
  1642. return self._dayOfWeek();
  1643. return self;
  1644. },
  1645. source: unescape('day%0A%09%5Eself%20dayOfWeek')}),
  1646. smalltalk.Date);
  1647. smalltalk.addMethod(
  1648. '_dayOfWeek',
  1649. smalltalk.method({
  1650. selector: 'dayOfWeek',
  1651. category: 'accessing',
  1652. fn: function (){
  1653. var self=this;
  1654. return self.getDay() + 1;
  1655. return self;},
  1656. source: unescape('dayOfWeek%0A%09%7B%27return%20self.getDay%28%29%20+%201%27%7D')}),
  1657. smalltalk.Date);
  1658. smalltalk.addMethod(
  1659. '_dayOfWeek_',
  1660. smalltalk.method({
  1661. selector: 'dayOfWeek:',
  1662. category: 'accessing',
  1663. fn: function (aNumber){
  1664. var self=this;
  1665. return self.setDay(aNumber - 1);
  1666. return self;},
  1667. source: unescape('dayOfWeek%3A%20aNumber%0A%09%7B%27return%20self.setDay%28aNumber%20-%201%29%27%7D')}),
  1668. smalltalk.Date);
  1669. smalltalk.addMethod(
  1670. '_day_',
  1671. smalltalk.method({
  1672. selector: 'day:',
  1673. category: 'accessing',
  1674. fn: function (aNumber) {
  1675. var self = this;
  1676. self._day_(aNumber);
  1677. return self;
  1678. },
  1679. source: unescape('day%3A%20aNumber%0A%09self%20day%3A%20aNumber')}),
  1680. smalltalk.Date);
  1681. smalltalk.addMethod(
  1682. '_year_',
  1683. smalltalk.method({
  1684. selector: 'year:',
  1685. category: 'accessing',
  1686. fn: function (aNumber) {
  1687. var self = this;
  1688. (function () {self.setFullYear(aNumber);}());
  1689. return self;
  1690. },
  1691. source: unescape('year%3A%20aNumber%0A%09%7B%27self.setFullYear%28aNumber%29%27%7D')}),
  1692. smalltalk.Date);
  1693. smalltalk.addMethod(
  1694. '_dayOfMonth',
  1695. smalltalk.method({
  1696. selector: 'dayOfMonth',
  1697. category: 'accessing',
  1698. fn: function (){
  1699. var self=this;
  1700. return self.getDate();
  1701. return self;},
  1702. source: unescape('dayOfMonth%0A%09%7B%27return%20self.getDate%28%29%27%7D')}),
  1703. smalltalk.Date);
  1704. smalltalk.addMethod(
  1705. '_dayOfMonth_',
  1706. smalltalk.method({
  1707. selector: 'dayOfMonth:',
  1708. category: 'accessing',
  1709. fn: function (aNumber) {
  1710. var self = this;
  1711. (function () {self.setDate(aNumber);}());
  1712. return self;
  1713. },
  1714. source: unescape('dayOfMonth%3A%20aNumber%0A%09%7B%27self.setDate%28aNumber%29%27%7D')}),
  1715. smalltalk.Date);
  1716. smalltalk.addMethod(
  1717. '_asString',
  1718. smalltalk.method({
  1719. selector: 'asString',
  1720. category: 'converting',
  1721. fn: function (){
  1722. var self=this;
  1723. return self.toString();
  1724. return self;},
  1725. source: unescape('asString%0A%09%7B%27return%20self.toString%28%29%27%7D')}),
  1726. smalltalk.Date);
  1727. smalltalk.addMethod(
  1728. '_printString',
  1729. smalltalk.method({
  1730. selector: 'printString',
  1731. category: 'printing',
  1732. fn: function () {
  1733. var self = this;
  1734. return self._asString();
  1735. return self;
  1736. },
  1737. source: unescape('printString%0A%09%5Eself%20asString')}),
  1738. smalltalk.Date);
  1739. smalltalk.addMethod(
  1740. '_asMilliseconds',
  1741. smalltalk.method({
  1742. selector: 'asMilliseconds',
  1743. category: 'converting',
  1744. fn: function () {
  1745. var self = this;
  1746. return self._time();
  1747. return self;
  1748. },
  1749. source: unescape('asMilliseconds%0A%09%5Eself%20time')}),
  1750. smalltalk.Date);
  1751. smalltalk.addMethod(
  1752. '_time',
  1753. smalltalk.method({
  1754. selector: 'time',
  1755. category: 'accessing',
  1756. fn: function (){
  1757. var self=this;
  1758. return self.getTime();
  1759. return self;},
  1760. source: unescape('time%0A%09%7B%27return%20self.getTime%28%29%27%7D')}),
  1761. smalltalk.Date);
  1762. smalltalk.addMethod(
  1763. '_time_',
  1764. smalltalk.method({
  1765. selector: 'time:',
  1766. category: 'accessing',
  1767. fn: function (aNumber) {
  1768. var self = this;
  1769. (function () {self.setTime(aNumber);}());
  1770. return self;
  1771. },
  1772. source: unescape('time%3A%20aNumber%0A%09%7B%27self.setTime%28aNumber%29%27%7D')}),
  1773. smalltalk.Date);
  1774. smalltalk.addMethod(
  1775. '_asDateString',
  1776. smalltalk.method({
  1777. selector: 'asDateString',
  1778. category: 'converting',
  1779. fn: function (){
  1780. var self=this;
  1781. return self.toDateString();
  1782. return self;},
  1783. source: unescape('asDateString%0A%09%7B%27return%20self.toDateString%28%29%27%7D')}),
  1784. smalltalk.Date);
  1785. smalltalk.addMethod(
  1786. '_asTimeString',
  1787. smalltalk.method({
  1788. selector: 'asTimeString',
  1789. category: 'converting',
  1790. fn: function (){
  1791. var self=this;
  1792. return self.toTimeString();
  1793. return self;},
  1794. source: unescape('asTimeString%0A%09%7B%27return%20self.toTimeString%28%29%27%7D')}),
  1795. smalltalk.Date);
  1796. smalltalk.addMethod(
  1797. '_asLocaleString',
  1798. smalltalk.method({
  1799. selector: 'asLocaleString',
  1800. category: 'converting',
  1801. fn: function (){
  1802. var self=this;
  1803. return self.toLocaleString();
  1804. return self;},
  1805. source: unescape('asLocaleString%0A%09%7B%27return%20self.toLocaleString%28%29%27%7D')}),
  1806. smalltalk.Date);
  1807. smalltalk.addMethod(
  1808. '_asNumber',
  1809. smalltalk.method({
  1810. selector: 'asNumber',
  1811. category: 'converting',
  1812. fn: function () {
  1813. var self = this;
  1814. return self._asMilliseconds();
  1815. return self;
  1816. },
  1817. source: unescape('asNumber%0A%09%5Eself%20asMilliseconds')}),
  1818. smalltalk.Date);
  1819. smalltalk.addMethod(
  1820. '_hours_',
  1821. smalltalk.method({
  1822. selector: 'hours:',
  1823. category: 'accessing',
  1824. fn: function (aNumber) {
  1825. var self = this;
  1826. (function () {self.setHours(aNumber);}());
  1827. return self;
  1828. },
  1829. source: unescape('hours%3A%20aNumber%0A%09%7B%27self.setHours%28aNumber%29%27%7D')}),
  1830. smalltalk.Date);
  1831. smalltalk.addMethod(
  1832. '_minutes_',
  1833. smalltalk.method({
  1834. selector: 'minutes:',
  1835. category: 'accessing',
  1836. fn: function (aNumber) {
  1837. var self = this;
  1838. (function () {self.setMinutes(aNumber);}());
  1839. return self;
  1840. },
  1841. source: unescape('minutes%3A%20aNumber%0A%09%7B%27self.setMinutes%28aNumber%29%27%7D')}),
  1842. smalltalk.Date);
  1843. smalltalk.addMethod(
  1844. '_seconds_',
  1845. smalltalk.method({
  1846. selector: 'seconds:',
  1847. category: 'accessing',
  1848. fn: function (aNumber) {
  1849. var self = this;
  1850. (function () {self.setSeconds(aNumber);}());
  1851. return self;
  1852. },
  1853. source: unescape('seconds%3A%20aNumber%0A%09%7B%27self.setSeconds%28aNumber%29%27%7D')}),
  1854. smalltalk.Date);
  1855. smalltalk.addMethod(
  1856. '_milliseconds_',
  1857. smalltalk.method({
  1858. selector: 'milliseconds:',
  1859. category: 'accessing',
  1860. fn: function (aNumber) {
  1861. var self = this;
  1862. (function () {self.setMilliseconds(aNumber);}());
  1863. return self;
  1864. },
  1865. source: unescape('milliseconds%3A%20aNumber%0A%09%7B%27self.setMilliseconds%28aNumber%29%27%7D')}),
  1866. smalltalk.Date);
  1867. smalltalk.addMethod(
  1868. '_hours',
  1869. smalltalk.method({
  1870. selector: 'hours',
  1871. category: 'accessing',
  1872. fn: function (){
  1873. var self=this;
  1874. return self.getHours();
  1875. return self;},
  1876. source: unescape('hours%0A%09%7B%27return%20self.getHours%28%29%27%7D')}),
  1877. smalltalk.Date);
  1878. smalltalk.addMethod(
  1879. '_minutes',
  1880. smalltalk.method({
  1881. selector: 'minutes',
  1882. category: 'accessing',
  1883. fn: function (){
  1884. var self=this;
  1885. return self.getMinutes();
  1886. return self;},
  1887. source: unescape('minutes%0A%09%7B%27return%20self.getMinutes%28%29%27%7D')}),
  1888. smalltalk.Date);
  1889. smalltalk.addMethod(
  1890. '_seconds',
  1891. smalltalk.method({
  1892. selector: 'seconds',
  1893. category: 'accessing',
  1894. fn: function (){
  1895. var self=this;
  1896. return self.getSeconds();
  1897. return self;},
  1898. source: unescape('seconds%0A%09%7B%27return%20self.getSeconds%28%29%27%7D')}),
  1899. smalltalk.Date);
  1900. smalltalk.addMethod(
  1901. '_milliseconds',
  1902. smalltalk.method({
  1903. selector: 'milliseconds',
  1904. category: 'accessing',
  1905. fn: function (){
  1906. var self=this;
  1907. return self.getMilliseconds();
  1908. return self;},
  1909. source: unescape('milliseconds%0A%09%7B%27return%20self.getMilliseconds%28%29%27%7D')}),
  1910. smalltalk.Date);
  1911. smalltalk.addMethod(
  1912. '_inspectOn_',
  1913. smalltalk.method({
  1914. selector: 'inspectOn:',
  1915. category: '*IDE',
  1916. fn: function (anInspector) {
  1917. var self = this;
  1918. var variables = nil;
  1919. variables = smalltalk.Dictionary._new();
  1920. variables._at_put_(unescape("%23self"), self);
  1921. variables._at_put_(unescape("%23year"), self._year());
  1922. variables._at_put_(unescape("%23month"), self._month());
  1923. variables._at_put_(unescape("%23day"), self._day());
  1924. variables._at_put_(unescape("%23hours"), self._hours());
  1925. variables._at_put_(unescape("%23minutes"), self._minutes());
  1926. variables._at_put_(unescape("%23seconds"), self._seconds());
  1927. variables._at_put_(unescape("%23milliseconds"), self._milliseconds());
  1928. (function ($rec) {$rec._setLabel_(self._printString());return $rec._setVariables_(variables);}(anInspector));
  1929. return self;
  1930. },
  1931. source: unescape('inspectOn%3A%20anInspector%0A%09%7C%20variables%20%7C%0A%09variables%20%3A%3D%20Dictionary%20new.%0A%09variables%20at%3A%20%27%23self%27%20put%3A%20self.%0A%09variables%20at%3A%20%27%23year%27%20put%3A%20self%20year.%0A%09variables%20at%3A%20%27%23month%27%20put%3A%20self%20month.%0A%09variables%20at%3A%20%27%23day%27%20put%3A%20self%20day.%0A%09variables%20at%3A%20%27%23hours%27%20put%3A%20self%20hours.%0A%09variables%20at%3A%20%27%23minutes%27%20put%3A%20self%20minutes.%0A%09variables%20at%3A%20%27%23seconds%27%20put%3A%20self%20seconds.%0A%09variables%20at%3A%20%27%23milliseconds%27%20put%3A%20self%20milliseconds.%0A%09anInspector%20%0A%09%09setLabel%3A%20self%20printString%3B%0A%09%09setVariables%3A%20variables%0A%09%0A%09')}),
  1932. smalltalk.Date);
  1933. smalltalk.addMethod(
  1934. '__lt',
  1935. smalltalk.method({
  1936. selector: '<',
  1937. category: 'comparing',
  1938. fn: function (aDate){
  1939. var self=this;
  1940. return self < aDate;
  1941. return self;},
  1942. source: unescape('%3C%20aDate%0A%09%7B%27return%20self%20%3C%20aDate%27%7D')}),
  1943. smalltalk.Date);
  1944. smalltalk.addMethod(
  1945. '__gt',
  1946. smalltalk.method({
  1947. selector: '>',
  1948. category: 'comparing',
  1949. fn: function (aDate){
  1950. var self=this;
  1951. return self > aDate;
  1952. return self;},
  1953. source: unescape('%3E%20aDate%0A%09%7B%27return%20self%20%3E%20aDate%27%7D')}),
  1954. smalltalk.Date);
  1955. smalltalk.addMethod(
  1956. '__lt_eq',
  1957. smalltalk.method({
  1958. selector: '<=',
  1959. category: 'comparing',
  1960. fn: function (aDate){
  1961. var self=this;
  1962. self <= aDate;
  1963. return self;},
  1964. source: unescape('%3C%3D%20aDate%0A%09%7B%27self%20%3C%3D%20aDate%27%7D')}),
  1965. smalltalk.Date);
  1966. smalltalk.addMethod(
  1967. '__gt_eq',
  1968. smalltalk.method({
  1969. selector: '>=',
  1970. category: 'comparing',
  1971. fn: function (aDate){
  1972. var self=this;
  1973. self >= aDate;
  1974. return self;},
  1975. source: unescape('%3E%3D%20aDate%0A%09%7B%27self%20%3E%3D%20aDate%27%7D')}),
  1976. smalltalk.Date);
  1977. smalltalk.addMethod(
  1978. '__minus',
  1979. smalltalk.method({
  1980. selector: '-',
  1981. category: 'arithmetic',
  1982. fn: function (aDate){
  1983. var self=this;
  1984. return self - aDate;
  1985. return self;},
  1986. source: unescape('-%20aDate%0A%09%7B%27return%20self%20-%20aDate%27%7D')}),
  1987. smalltalk.Date);
  1988. smalltalk.addMethod(
  1989. '__plus',
  1990. smalltalk.method({
  1991. selector: '+',
  1992. category: 'arithmetic',
  1993. fn: function (aDate){
  1994. var self=this;
  1995. return self + aDate;
  1996. return self;},
  1997. source: unescape('+%20aDate%0A%09%7B%27return%20self%20+%20aDate%27%7D')}),
  1998. smalltalk.Date);
  1999. smalltalk.addMethod(
  2000. '_new_',
  2001. smalltalk.method({
  2002. selector: 'new:',
  2003. category: 'instance creation',
  2004. fn: function (anObject){
  2005. var self=this;
  2006. return new Date(anObject);
  2007. return self;},
  2008. source: unescape('new%3A%20anObject%0A%09%7B%27return%20new%20Date%28anObject%29%27%7D')}),
  2009. smalltalk.Date.klass);
  2010. smalltalk.addMethod(
  2011. '_fromString_',
  2012. smalltalk.method({
  2013. selector: 'fromString:',
  2014. category: 'instance creation',
  2015. fn: function (aString) {
  2016. var self = this;
  2017. return self._new_(aString);
  2018. return self;
  2019. },
  2020. source: unescape('fromString%3A%20aString%0A%09%22Example%3A%20Date%20fromString%28%272011/04/15%2000%3A00%3A00%27%29%22%0A%09%5Eself%20new%3A%20aString')}),
  2021. smalltalk.Date.klass);
  2022. smalltalk.addMethod(
  2023. '_fromSeconds_',
  2024. smalltalk.method({
  2025. selector: 'fromSeconds:',
  2026. category: 'instance creation',
  2027. fn: function (aNumber) {
  2028. var self = this;
  2029. return self._fromMilliseconds_(aNumber.__star(1000));
  2030. return self;
  2031. },
  2032. source: unescape('fromSeconds%3A%20aNumber%0A%09%5Eself%20fromMilliseconds%3A%20aNumber%20*%201000')}),
  2033. smalltalk.Date.klass);
  2034. smalltalk.addMethod(
  2035. '_fromMilliseconds_',
  2036. smalltalk.method({
  2037. selector: 'fromMilliseconds:',
  2038. category: 'instance creation',
  2039. fn: function (aNumber) {
  2040. var self = this;
  2041. return self._new_(aNumber);
  2042. return self;
  2043. },
  2044. source: unescape('fromMilliseconds%3A%20aNumber%0A%09%5Eself%20new%3A%20aNumber')}),
  2045. smalltalk.Date.klass);
  2046. smalltalk.addMethod(
  2047. '_today',
  2048. smalltalk.method({
  2049. selector: 'today',
  2050. category: 'instance creation',
  2051. fn: function () {
  2052. var self = this;
  2053. return self._new();
  2054. return self;
  2055. },
  2056. source: unescape('today%0A%09%5Eself%20new')}),
  2057. smalltalk.Date.klass);
  2058. smalltalk.addMethod(
  2059. '_now',
  2060. smalltalk.method({
  2061. selector: 'now',
  2062. category: 'instance creation',
  2063. fn: function () {
  2064. var self = this;
  2065. return self._today();
  2066. return self;
  2067. },
  2068. source: unescape('now%0A%09%5Eself%20today')}),
  2069. smalltalk.Date.klass);
  2070. smalltalk.addMethod(
  2071. '_millisecondsToRun_',
  2072. smalltalk.method({
  2073. selector: 'millisecondsToRun:',
  2074. category: 'instance creation',
  2075. fn: function (aBlock){
  2076. var self=this;
  2077. var t=nil;
  2078. t=smalltalk.Date._now();
  2079. aBlock._value();
  2080. return smalltalk.Date._now().__minus(t);
  2081. return self;},
  2082. source: unescape('millisecondsToRun%3A%20aBlock%0A%09%7C%20t%20%7C%0A%09t%20%3A%3D%20Date%20now.%0A%09aBlock%20value.%0A%09%5EDate%20now%20-%20t')}),
  2083. smalltalk.Date.klass);
  2084. smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel');
  2085. smalltalk.addMethod(
  2086. '_subclass_instanceVariableNames_',
  2087. smalltalk.method({
  2088. selector: 'subclass:instanceVariableNames:',
  2089. category: 'class creation',
  2090. fn: function (aString, anotherString) {
  2091. var self = this;
  2092. return self._subclass_instanceVariableNames_category_(aString, anotherString, nil);
  2093. return self;
  2094. },
  2095. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%0A%09%5Eself%20subclass%3A%20aString%20instanceVariableNames%3A%20anotherString%20category%3A%20nil%0A')}),
  2096. smalltalk.UndefinedObject);
  2097. smalltalk.addMethod(
  2098. '_subclass_instanceVariableNames_category_',
  2099. smalltalk.method({
  2100. selector: 'subclass:instanceVariableNames:category:',
  2101. category: 'class creation',
  2102. fn: function (aString, aString2, aString3) {
  2103. var self = this;
  2104. return smalltalk.ClassBuilder._new()._superclass_subclass_instanceVariableNames_category_(self, aString, aString2, aString3);
  2105. return self;
  2106. },
  2107. source: unescape('subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%5EClassBuilder%20new%0A%09%20%20%20%20superclass%3A%20self%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A')}),
  2108. smalltalk.UndefinedObject);
  2109. smalltalk.addMethod(
  2110. '_shallowCopy',
  2111. smalltalk.method({
  2112. selector: 'shallowCopy',
  2113. category: 'copying',
  2114. fn: function () {
  2115. var self = this;
  2116. return self;
  2117. return self;
  2118. },
  2119. source: unescape('shallowCopy%0A%09%5Eself%0A')}),
  2120. smalltalk.UndefinedObject);
  2121. smalltalk.addMethod(
  2122. '_deepCopy',
  2123. smalltalk.method({
  2124. selector: 'deepCopy',
  2125. category: 'copying',
  2126. fn: function () {
  2127. var self = this;
  2128. return self;
  2129. return self;
  2130. },
  2131. source: unescape('deepCopy%0A%09%5Eself%0A')}),
  2132. smalltalk.UndefinedObject);
  2133. smalltalk.addMethod(
  2134. '_ifNil_',
  2135. smalltalk.method({
  2136. selector: 'ifNil:',
  2137. category: 'testing',
  2138. fn: function (aBlock) {
  2139. var self = this;
  2140. return self._ifNil_ifNotNil_(aBlock, function () {return nil;});
  2141. return self;
  2142. },
  2143. source: unescape('ifNil%3A%20aBlock%0A%09%5Eself%20ifNil%3A%20aBlock%20ifNotNil%3A%20%5B%5D%0A')}),
  2144. smalltalk.UndefinedObject);
  2145. smalltalk.addMethod(
  2146. '_ifNotNil_',
  2147. smalltalk.method({
  2148. selector: 'ifNotNil:',
  2149. category: 'testing',
  2150. fn: function (aBlock) {
  2151. var self = this;
  2152. return self;
  2153. return self;
  2154. },
  2155. source: unescape('ifNotNil%3A%20aBlock%0A%09%5Eself%0A')}),
  2156. smalltalk.UndefinedObject);
  2157. smalltalk.addMethod(
  2158. '_ifNil_ifNotNil_',
  2159. smalltalk.method({
  2160. selector: 'ifNil:ifNotNil:',
  2161. category: 'testing',
  2162. fn: function (aBlock, anotherBlock) {
  2163. var self = this;
  2164. return aBlock._value();
  2165. return self;
  2166. },
  2167. source: unescape('ifNil%3A%20aBlock%20ifNotNil%3A%20anotherBlock%0A%09%5EaBlock%20value%0A')}),
  2168. smalltalk.UndefinedObject);
  2169. smalltalk.addMethod(
  2170. '_ifNotNil_ifNil_',
  2171. smalltalk.method({
  2172. selector: 'ifNotNil:ifNil:',
  2173. category: 'testing',
  2174. fn: function (aBlock, anotherBlock) {
  2175. var self = this;
  2176. return anotherBlock._value();
  2177. return self;
  2178. },
  2179. source: unescape('ifNotNil%3A%20aBlock%20ifNil%3A%20anotherBlock%0A%09%5EanotherBlock%20value%0A')}),
  2180. smalltalk.UndefinedObject);
  2181. smalltalk.addMethod(
  2182. '_isNil',
  2183. smalltalk.method({
  2184. selector: 'isNil',
  2185. category: 'testing',
  2186. fn: function () {
  2187. var self = this;
  2188. return true;
  2189. return self;
  2190. },
  2191. source: unescape('isNil%0A%09%5Etrue%0A')}),
  2192. smalltalk.UndefinedObject);
  2193. smalltalk.addMethod(
  2194. '_notNil',
  2195. smalltalk.method({
  2196. selector: 'notNil',
  2197. category: 'testing',
  2198. fn: function () {
  2199. var self = this;
  2200. return false;
  2201. return self;
  2202. },
  2203. source: unescape('notNil%0A%09%5Efalse%0A')}),
  2204. smalltalk.UndefinedObject);
  2205. smalltalk.addMethod(
  2206. '_printString',
  2207. smalltalk.method({
  2208. selector: 'printString',
  2209. category: 'printing',
  2210. fn: function () {
  2211. var self = this;
  2212. return "nil";
  2213. return self;
  2214. },
  2215. source: unescape('printString%0A%20%20%20%20%5E%27nil%27%0A')}),
  2216. smalltalk.UndefinedObject);
  2217. smalltalk.addMethod(
  2218. '_new',
  2219. smalltalk.method({
  2220. selector: 'new',
  2221. category: 'instance creation',
  2222. fn: function () {
  2223. var self = this;
  2224. self._error_("You cannot create new instances of UndefinedObject. Use nil");
  2225. return self;
  2226. },
  2227. source: unescape('new%0A%09%20%20%20%20self%20error%3A%20%27You%20cannot%20create%20new%20instances%20of%20UndefinedObject.%20Use%20nil%27%0A')}),
  2228. smalltalk.UndefinedObject.klass);
  2229. smalltalk.addClass('Collection', smalltalk.Object, [], 'Kernel');
  2230. smalltalk.addMethod(
  2231. '_size',
  2232. smalltalk.method({
  2233. selector: 'size',
  2234. category: 'accessing',
  2235. fn: function () {
  2236. var self = this;
  2237. self._subclassResponsibility();
  2238. return self;
  2239. },
  2240. source: unescape('size%0A%09self%20subclassResponsibility%0A')}),
  2241. smalltalk.Collection);
  2242. smalltalk.addMethod(
  2243. '_at_',
  2244. smalltalk.method({
  2245. selector: 'at:',
  2246. category: 'accessing',
  2247. fn: function (anIndex) {
  2248. var self = this;
  2249. return self._at_ifAbsent_(anIndex, function () {return self._errorNotFound();});
  2250. return self;
  2251. },
  2252. source: unescape('at%3A%20anIndex%0A%09%5Eself%20at%3A%20anIndex%20ifAbsent%3A%20%5B%0A%09%20%20%20%20self%20errorNotFound%5D%0A')}),
  2253. smalltalk.Collection);
  2254. smalltalk.addMethod(
  2255. '_at_put_',
  2256. smalltalk.method({
  2257. selector: 'at:put:',
  2258. category: 'accessing',
  2259. fn: function (anIndex, anObject) {
  2260. var self = this;
  2261. self._subclassResponsibility();
  2262. return self;
  2263. },
  2264. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09self%20subclassResponsibility%0A')}),
  2265. smalltalk.Collection);
  2266. smalltalk.addMethod(
  2267. '_at_ifAbsent_',
  2268. smalltalk.method({
  2269. selector: 'at:ifAbsent:',
  2270. category: 'accessing',
  2271. fn: function (anIndex, aBlock) {
  2272. var self = this;
  2273. self._subclassResponsibility();
  2274. return self;
  2275. },
  2276. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%09self%20subclassResponsibility%0A')}),
  2277. smalltalk.Collection);
  2278. smalltalk.addMethod(
  2279. '_first',
  2280. smalltalk.method({
  2281. selector: 'first',
  2282. category: 'accessing',
  2283. fn: function () {
  2284. var self = this;
  2285. return self._at_(1);
  2286. return self;
  2287. },
  2288. source: unescape('first%0A%09%5Eself%20at%3A%201%0A')}),
  2289. smalltalk.Collection);
  2290. smalltalk.addMethod(
  2291. '_second',
  2292. smalltalk.method({
  2293. selector: 'second',
  2294. category: 'accessing',
  2295. fn: function () {
  2296. var self = this;
  2297. return self._at_(2);
  2298. return self;
  2299. },
  2300. source: unescape('second%0A%09%5Eself%20at%3A%202%0A')}),
  2301. smalltalk.Collection);
  2302. smalltalk.addMethod(
  2303. '_third',
  2304. smalltalk.method({
  2305. selector: 'third',
  2306. category: 'accessing',
  2307. fn: function () {
  2308. var self = this;
  2309. return self._at_(3);
  2310. return self;
  2311. },
  2312. source: unescape('third%0A%09%5Eself%20at%3A%203%0A')}),
  2313. smalltalk.Collection);
  2314. smalltalk.addMethod(
  2315. '_fourth',
  2316. smalltalk.method({
  2317. selector: 'fourth',
  2318. category: 'accessing',
  2319. fn: function () {
  2320. var self = this;
  2321. return self._at_(4);
  2322. return self;
  2323. },
  2324. source: unescape('fourth%0A%09%5Eself%20at%3A%204%0A')}),
  2325. smalltalk.Collection);
  2326. smalltalk.addMethod(
  2327. '_last',
  2328. smalltalk.method({
  2329. selector: 'last',
  2330. category: 'accessing',
  2331. fn: function () {
  2332. var self = this;
  2333. return self._at_(self._size());
  2334. return self;
  2335. },
  2336. source: unescape('last%0A%09%5Eself%20at%3A%20self%20size%0A')}),
  2337. smalltalk.Collection);
  2338. smalltalk.addMethod(
  2339. '_readStream',
  2340. smalltalk.method({
  2341. selector: 'readStream',
  2342. category: 'accessing',
  2343. fn: function () {
  2344. var self = this;
  2345. return self._stream();
  2346. return self;
  2347. },
  2348. source: unescape('readStream%0A%09%5Eself%20stream%0A')}),
  2349. smalltalk.Collection);
  2350. smalltalk.addMethod(
  2351. '_writeStream',
  2352. smalltalk.method({
  2353. selector: 'writeStream',
  2354. category: 'accessing',
  2355. fn: function () {
  2356. var self = this;
  2357. return self._stream();
  2358. return self;
  2359. },
  2360. source: unescape('writeStream%0A%09%5Eself%20stream%0A')}),
  2361. smalltalk.Collection);
  2362. smalltalk.addMethod(
  2363. '_stream',
  2364. smalltalk.method({
  2365. selector: 'stream',
  2366. category: 'accessing',
  2367. fn: function () {
  2368. var self = this;
  2369. return self._streamClass()._on_(self);
  2370. return self;
  2371. },
  2372. source: unescape('stream%0A%09%5Eself%20streamClass%20on%3A%20self%0A')}),
  2373. smalltalk.Collection);
  2374. smalltalk.addMethod(
  2375. '_streamClass',
  2376. smalltalk.method({
  2377. selector: 'streamClass',
  2378. category: 'accessing',
  2379. fn: function () {
  2380. var self = this;
  2381. return self._class()._streamClass();
  2382. return self;
  2383. },
  2384. source: unescape('streamClass%0A%09%5Eself%20class%20streamClass%0A')}),
  2385. smalltalk.Collection);
  2386. smalltalk.addMethod(
  2387. '_add_',
  2388. smalltalk.method({
  2389. selector: 'add:',
  2390. category: 'adding/removing',
  2391. fn: function (anObject) {
  2392. var self = this;
  2393. self._subclassResponsibility();
  2394. return self;
  2395. },
  2396. source: unescape('add%3A%20anObject%0A%09self%20subclassResponsibility%0A')}),
  2397. smalltalk.Collection);
  2398. smalltalk.addMethod(
  2399. '_addAll_',
  2400. smalltalk.method({
  2401. selector: 'addAll:',
  2402. category: 'adding/removing',
  2403. fn: function (aCollection) {
  2404. var self = this;
  2405. aCollection._do_(function (each) {return self._add_(each);});
  2406. return aCollection;
  2407. return self;
  2408. },
  2409. source: unescape('addAll%3A%20aCollection%0A%09aCollection%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20add%3A%20each%5D.%0A%09%5EaCollection%0A')}),
  2410. smalltalk.Collection);
  2411. smalltalk.addMethod(
  2412. '__comma',
  2413. smalltalk.method({
  2414. selector: ',',
  2415. category: 'copying',
  2416. fn: function (aCollection) {
  2417. var self = this;
  2418. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._copy());
  2419. return self;
  2420. },
  2421. source: unescape('%2C%20aCollection%0A%09%5Eself%20copy%20%0A%09%20%20%20%20addAll%3A%20aCollection%3B%20%0A%09%20%20%20%20yourself%0A')}),
  2422. smalltalk.Collection);
  2423. smalltalk.addMethod(
  2424. '_copyFrom_to_',
  2425. smalltalk.method({
  2426. selector: 'copyFrom:to:',
  2427. category: 'copying',
  2428. fn: function (anIndex, anotherIndex) {
  2429. var self = this;
  2430. self._subclassResponsibility();
  2431. return self;
  2432. },
  2433. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20subclassResponsibility%0A')}),
  2434. smalltalk.Collection);
  2435. smalltalk.addMethod(
  2436. '_copyWith_',
  2437. smalltalk.method({
  2438. selector: 'copyWith:',
  2439. category: 'copying',
  2440. fn: function (anObject) {
  2441. var self = this;
  2442. return function ($rec) {$rec._add_(anObject);return $rec._yourself();}(self._copy());
  2443. return self;
  2444. },
  2445. source: unescape('copyWith%3A%20anObject%0A%09%5Eself%20copy%20add%3A%20anObject%3B%20yourself%0A')}),
  2446. smalltalk.Collection);
  2447. smalltalk.addMethod(
  2448. '_copyWithAll_',
  2449. smalltalk.method({
  2450. selector: 'copyWithAll:',
  2451. category: 'copying',
  2452. fn: function (aCollection) {
  2453. var self = this;
  2454. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._copy());
  2455. return self;
  2456. },
  2457. source: unescape('copyWithAll%3A%20aCollection%0A%09%5Eself%20copy%20addAll%3A%20aCollection%3B%20yourself%0A')}),
  2458. smalltalk.Collection);
  2459. smalltalk.addMethod(
  2460. '_asArray',
  2461. smalltalk.method({
  2462. selector: 'asArray',
  2463. category: 'converting',
  2464. fn: function () {
  2465. var self = this;
  2466. var array = nil;
  2467. var index = nil;
  2468. array = smalltalk.Array._new();
  2469. index = 0;
  2470. self._do_(function (each) {index = index.__plus(1);return array._at_put_(index, each);});
  2471. return array;
  2472. return self;
  2473. },
  2474. source: unescape('asArray%0A%09%7C%20array%20index%20%7C%0A%09array%20%3A%3D%20Array%20new.%0A%09index%20%3A%3D%200.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20index%20%3A%3D%20index%20+%201.%0A%09%20%20%20%20array%20at%3A%20index%20put%3A%20each%5D.%0A%09%5Earray%0A')}),
  2475. smalltalk.Collection);
  2476. smalltalk.addMethod(
  2477. '_do_',
  2478. smalltalk.method({
  2479. selector: 'do:',
  2480. category: 'enumerating',
  2481. fn: function (aBlock) {
  2482. var self = this;
  2483. (function () {for (var i = 0; i < self.length; i++) {aBlock(self[i]);}}());
  2484. return self;
  2485. },
  2486. source: unescape('do%3A%20aBlock%0A%09%7B%27for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%7BaBlock%28self%5Bi%5D%29%3B%7D%27%7D%0A')}),
  2487. smalltalk.Collection);
  2488. smalltalk.addMethod(
  2489. '_collect_',
  2490. smalltalk.method({
  2491. selector: 'collect:',
  2492. category: 'enumerating',
  2493. fn: function (aBlock) {
  2494. var self = this;
  2495. var stream = nil;
  2496. stream = self._class()._new()._writeStream();
  2497. self._do_(function (each) {return stream._nextPut_(aBlock._value_(each));});
  2498. return stream._contents();
  2499. return self;
  2500. },
  2501. source: unescape('collect%3A%20aBlock%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20self%20class%20new%20writeStream.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20stream%20nextPut%3A%20%28aBlock%20value%3A%20each%29%5D.%0A%09%5Estream%20contents%0A')}),
  2502. smalltalk.Collection);
  2503. smalltalk.addMethod(
  2504. '_detect_',
  2505. smalltalk.method({
  2506. selector: 'detect:',
  2507. category: 'enumerating',
  2508. fn: function (aBlock) {
  2509. var self = this;
  2510. return self._detect_ifNone_(aBlock, function () {return self._errorNotFound();});
  2511. return self;
  2512. },
  2513. source: unescape('detect%3A%20aBlock%0A%09%5Eself%20detect%3A%20aBlock%20ifNone%3A%20%5Bself%20errorNotFound%5D%0A')}),
  2514. smalltalk.Collection);
  2515. smalltalk.addMethod(
  2516. '_detect_ifNone_',
  2517. smalltalk.method({
  2518. selector: 'detect:ifNone:',
  2519. category: 'enumerating',
  2520. fn: function (aBlock, anotherBlock){
  2521. var self=this;
  2522. for(var i = 0; i < self.length; i++)
  2523. if(aBlock(self[i]))
  2524. return self[i];
  2525. return anotherBlock();
  2526. ;
  2527. return self;},
  2528. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%7B%27%0A%09%09for%28var%20i%20%3D%200%3B%20i%20%3C%20self.length%3B%20i++%29%0A%09%09%09if%28aBlock%28self%5Bi%5D%29%29%0A%09%09%09%09return%20self%5Bi%5D%3B%0A%09%09return%20anotherBlock%28%29%3B%0A%09%27%7D')}),
  2529. smalltalk.Collection);
  2530. smalltalk.addMethod(
  2531. '_do_separatedBy_',
  2532. smalltalk.method({
  2533. selector: 'do:separatedBy:',
  2534. category: 'enumerating',
  2535. fn: function (aBlock, anotherBlock) {
  2536. var self = this;
  2537. var first = nil;
  2538. first = true;
  2539. self._do_(function (each) {first._ifTrue_ifFalse_(function () {return first = false;}, function () {return anotherBlock._value();});return aBlock._value_(each);});
  2540. return self;
  2541. },
  2542. source: unescape('do%3A%20aBlock%20separatedBy%3A%20anotherBlock%0A%20%20%20%20%09%7C%20first%20%7C%0A%20%20%20%20%09first%20%3A%3D%20true.%0A%20%20%20%20%09self%20do%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%09%20%20%20%20first%0A%20%20%20%20%09%09ifTrue%3A%20%5Bfirst%20%3A%3D%20false%5D%0A%20%20%20%20%09%09ifFalse%3A%20%5BanotherBlock%20value%5D.%0A%20%20%20%20%09%20%20%20%20aBlock%20value%3A%20each%5D%0A')}),
  2543. smalltalk.Collection);
  2544. smalltalk.addMethod(
  2545. '_inject_into_',
  2546. smalltalk.method({
  2547. selector: 'inject:into:',
  2548. category: 'enumerating',
  2549. fn: function (anObject, aBlock) {
  2550. var self = this;
  2551. var result = nil;
  2552. result = anObject;
  2553. self._do_(function (each) {return result = aBlock._value_value_(result, each);});
  2554. return result;
  2555. return self;
  2556. },
  2557. source: unescape('inject%3A%20anObject%20into%3A%20aBlock%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20anObject.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20%0A%09%20%20%20%20result%20%3A%3D%20aBlock%20value%3A%20result%20value%3A%20each%5D.%0A%09%5Eresult%0A')}),
  2558. smalltalk.Collection);
  2559. smalltalk.addMethod(
  2560. '_reject_',
  2561. smalltalk.method({
  2562. selector: 'reject:',
  2563. category: 'enumerating',
  2564. fn: function (aBlock) {
  2565. var self = this;
  2566. return self._select_(function (each) {return aBlock._value_(each).__eq(false);});
  2567. return self;
  2568. },
  2569. source: unescape('reject%3A%20aBlock%0A%09%5Eself%20select%3A%20%5B%3Aeach%20%7C%20%28aBlock%20value%3A%20each%29%20%3D%20false%5D%0A')}),
  2570. smalltalk.Collection);
  2571. smalltalk.addMethod(
  2572. '_select_',
  2573. smalltalk.method({
  2574. selector: 'select:',
  2575. category: 'enumerating',
  2576. fn: function (aBlock) {
  2577. var self = this;
  2578. var stream = nil;
  2579. stream = self._class()._new()._writeStream();
  2580. self._do_(function (each) {return aBlock._value_(each)._ifTrue_(function () {return stream._nextPut_(each);});});
  2581. return stream._contents();
  2582. return self;
  2583. },
  2584. source: unescape('select%3A%20aBlock%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20self%20class%20new%20writeStream.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20%28aBlock%20value%3A%20each%29%20ifTrue%3A%20%5B%0A%09%09stream%20nextPut%3A%20each%5D%5D.%0A%09%5Estream%20contents%0A')}),
  2585. smalltalk.Collection);
  2586. smalltalk.addMethod(
  2587. '_errorNotFound',
  2588. smalltalk.method({
  2589. selector: 'errorNotFound',
  2590. category: 'error handling',
  2591. fn: function () {
  2592. var self = this;
  2593. self._error_("Object is not in the collection");
  2594. return self;
  2595. },
  2596. source: unescape('errorNotFound%0A%09self%20error%3A%20%27Object%20is%20not%20in%20the%20collection%27%0A')}),
  2597. smalltalk.Collection);
  2598. smalltalk.addMethod(
  2599. '_includes_',
  2600. smalltalk.method({
  2601. selector: 'includes:',
  2602. category: 'testing',
  2603. fn: function (anObject) {
  2604. var self = this;
  2605. return function () {var i = self.length;while (i--) {if (self[i].__eq(anObject)) {return true;}}return false;}();
  2606. return self;
  2607. },
  2608. source: unescape('includes%3A%20anObject%0A%09%5E%7B%27%0A%09%09var%20i%20%3D%20self.length%3B%0A%09%09while%20%28i--%29%20%7B%0A%09%09%09if%20%28self%5Bi%5D.__eq%28anObject%29%29%20%7B%0A%09%09%09%09return%20true%3B%0A%09%09%09%7D%09%0A%09%09%7D%0A%09%09return%20false%3B%0A%0A%09%27%7D%0A')}),
  2609. smalltalk.Collection);
  2610. smalltalk.addMethod(
  2611. '_notEmpty',
  2612. smalltalk.method({
  2613. selector: 'notEmpty',
  2614. category: 'testing',
  2615. fn: function () {
  2616. var self = this;
  2617. return self._isEmpty()._not();
  2618. return self;
  2619. },
  2620. source: unescape('notEmpty%0A%09%5Eself%20isEmpty%20not%0A')}),
  2621. smalltalk.Collection);
  2622. smalltalk.addMethod(
  2623. '_isEmpty',
  2624. smalltalk.method({
  2625. selector: 'isEmpty',
  2626. category: 'testing',
  2627. fn: function () {
  2628. var self = this;
  2629. return self._size().__eq(0);
  2630. return self;
  2631. },
  2632. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  2633. smalltalk.Collection);
  2634. smalltalk.addMethod(
  2635. '_remove_',
  2636. smalltalk.method({
  2637. selector: 'remove:',
  2638. category: 'adding/removing',
  2639. fn: function (anObject) {
  2640. var self = this;
  2641. self._subclassResponsibility();
  2642. return self;
  2643. },
  2644. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20subclassResponsibility%0A')}),
  2645. smalltalk.Collection);
  2646. smalltalk.addMethod(
  2647. '_removeLast',
  2648. smalltalk.method({
  2649. selector: 'removeLast',
  2650. category: 'adding/removing',
  2651. fn: function () {
  2652. var self = this;
  2653. self._remove_(self._last());
  2654. return self;
  2655. },
  2656. source: unescape('removeLast%0A%09self%20remove%3A%20self%20last')}),
  2657. smalltalk.Collection);
  2658. smalltalk.addMethod(
  2659. '_inspectOn_',
  2660. smalltalk.method({
  2661. selector: 'inspectOn:',
  2662. category: '*IDE',
  2663. fn: function (anInspector) {
  2664. var self = this;
  2665. var variables = nil;
  2666. variables = smalltalk.Dictionary._new();
  2667. variables._at_put_(unescape("%23self"), self);
  2668. self._withIndexDo_(function (each, i) {return variables._at_put_(i, each);});
  2669. (function ($rec) {$rec._setLabel_(self._printString());return $rec._setVariables_(variables);}(anInspector));
  2670. return self;
  2671. },
  2672. source: unescape('inspectOn%3A%20anInspector%0A%09%7C%20variables%20%7C%0A%09variables%20%3A%3D%20Dictionary%20new.%0A%09variables%20at%3A%20%27%23self%27%20put%3A%20self.%0A%09self%20withIndexDo%3A%20%5B%3Aeach%20%3Ai%20%7C%0A%09%09variables%20at%3A%20i%20put%3A%20each%5D.%0A%09anInspector%20%0A%09%09setLabel%3A%20self%20printString%3B%0A%09%09setVariables%3A%20variables')}),
  2673. smalltalk.Collection);
  2674. smalltalk.addMethod(
  2675. '_withIndexDo_',
  2676. smalltalk.method({
  2677. selector: 'withIndexDo:',
  2678. category: 'enumerating',
  2679. fn: function (aBlock) {
  2680. var self = this;
  2681. (function () {for (var i = 0; i < self.length; i++) {aBlock(self[i], i + 1);}}());
  2682. return self;
  2683. },
  2684. source: unescape('withIndexDo%3A%20aBlock%0A%09%7B%27for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%7BaBlock%28self%5Bi%5D%2C%20i+1%29%3B%7D%27%7D%0A')}),
  2685. smalltalk.Collection);
  2686. smalltalk.addMethod(
  2687. '_streamClass',
  2688. smalltalk.method({
  2689. selector: 'streamClass',
  2690. category: 'accessing',
  2691. fn: function () {
  2692. var self = this;
  2693. return smalltalk.Stream;
  2694. return self;
  2695. },
  2696. source: unescape('streamClass%0A%09%20%20%20%20%5EStream%0A')}),
  2697. smalltalk.Collection.klass);
  2698. smalltalk.addMethod(
  2699. '_with_',
  2700. smalltalk.method({
  2701. selector: 'with:',
  2702. category: 'instance creation',
  2703. fn: function (anObject) {
  2704. var self = this;
  2705. return function ($rec) {$rec._add_(anObject);return $rec._yourself();}(self._new());
  2706. return self;
  2707. },
  2708. source: unescape('with%3A%20anObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09yourself%0A')}),
  2709. smalltalk.Collection.klass);
  2710. smalltalk.addMethod(
  2711. '_with_with_',
  2712. smalltalk.method({
  2713. selector: 'with:with:',
  2714. category: 'instance creation',
  2715. fn: function (anObject, anotherObject) {
  2716. var self = this;
  2717. return function ($rec) {$rec._add_(anObject);$rec._add_(anotherObject);return $rec._yourself();}(self._new());
  2718. return self;
  2719. },
  2720. source: unescape('with%3A%20anObject%20with%3A%20anotherObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20anObject%3B%0A%09%09add%3A%20anotherObject%3B%0A%09%09yourself%0A')}),
  2721. smalltalk.Collection.klass);
  2722. smalltalk.addMethod(
  2723. '_with_with_with_',
  2724. smalltalk.method({
  2725. selector: 'with:with:with:',
  2726. category: 'instance creation',
  2727. fn: function (firstObject, secondObject, thirdObject) {
  2728. var self = this;
  2729. return function ($rec) {$rec._add_(firstObject);$rec._add_(secondObject);$rec._add_(thirdObject);return $rec._yourself();}(self._new());
  2730. return self;
  2731. },
  2732. source: unescape('with%3A%20firstObject%20with%3A%20secondObject%20with%3A%20thirdObject%0A%09%20%20%20%20%5Eself%20new%0A%09%09add%3A%20firstObject%3B%0A%09%09add%3A%20secondObject%3B%0A%09%09add%3A%20thirdObject%3B%0A%09%09yourself%0A')}),
  2733. smalltalk.Collection.klass);
  2734. smalltalk.addMethod(
  2735. '_withAll_',
  2736. smalltalk.method({
  2737. selector: 'withAll:',
  2738. category: 'instance creation',
  2739. fn: function (aCollection) {
  2740. var self = this;
  2741. return function ($rec) {$rec._addAll_(aCollection);return $rec._yourself();}(self._new());
  2742. return self;
  2743. },
  2744. source: unescape('withAll%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%0A%09%09addAll%3A%20aCollection%3B%0A%09%09yourself%0A')}),
  2745. smalltalk.Collection.klass);
  2746. smalltalk.addClass('String', smalltalk.Collection, [], 'Kernel');
  2747. smalltalk.addMethod(
  2748. '__eq',
  2749. smalltalk.method({
  2750. selector: '=',
  2751. category: 'comparing',
  2752. fn: function (aString){
  2753. var self=this;
  2754. return String(self) == aString;
  2755. return self;},
  2756. source: unescape('%3D%20aString%0A%09%7B%27return%20String%28self%29%20%3D%3D%20aString%27%7D')}),
  2757. smalltalk.String);
  2758. smalltalk.addMethod(
  2759. '_size',
  2760. smalltalk.method({
  2761. selector: 'size',
  2762. category: 'accessing',
  2763. fn: function (){
  2764. var self=this;
  2765. return self.length;
  2766. return self;},
  2767. source: unescape('size%0A%09%7B%27return%20self.length%27%7D%0A')}),
  2768. smalltalk.String);
  2769. smalltalk.addMethod(
  2770. '_at_',
  2771. smalltalk.method({
  2772. selector: 'at:',
  2773. category: 'accessing',
  2774. fn: function (anIndex){
  2775. var self=this;
  2776. return self[anIndex - 1] || nil;;
  2777. return self;},
  2778. source: unescape('at%3A%20anIndex%0A%09%7B%27return%20self%5BanIndex%20-%201%5D%20%7C%7C%20nil%3B%27%7D')}),
  2779. smalltalk.String);
  2780. smalltalk.addMethod(
  2781. '_at_put_',
  2782. smalltalk.method({
  2783. selector: 'at:put:',
  2784. category: 'accessing',
  2785. fn: function (anIndex, anObject) {
  2786. var self = this;
  2787. self._errorReadOnly();
  2788. return self;
  2789. },
  2790. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2791. smalltalk.String);
  2792. smalltalk.addMethod(
  2793. '_at_ifAbsent_',
  2794. smalltalk.method({
  2795. selector: 'at:ifAbsent:',
  2796. category: 'accessing',
  2797. fn: function (anIndex, aBlock) {
  2798. var self = this;
  2799. self._at_(anIndex)._ifNil_(function () {return aBlock;});
  2800. return self;
  2801. },
  2802. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%20%20%20%20%09%28self%20at%3A%20anIndex%29%20ifNil%3A%20%5BaBlock%5D%0A')}),
  2803. smalltalk.String);
  2804. smalltalk.addMethod(
  2805. '_escaped',
  2806. smalltalk.method({
  2807. selector: 'escaped',
  2808. category: 'accessing',
  2809. fn: function (){
  2810. var self=this;
  2811. return escape(self);
  2812. return self;},
  2813. source: unescape('escaped%0A%09%7B%27return%20escape%28self%29%27%7D%0A')}),
  2814. smalltalk.String);
  2815. smalltalk.addMethod(
  2816. '_unescaped',
  2817. smalltalk.method({
  2818. selector: 'unescaped',
  2819. category: 'accessing',
  2820. fn: function (){
  2821. var self=this;
  2822. return unescape(self);
  2823. return self;},
  2824. source: unescape('unescaped%0A%09%7B%27return%20unescape%28self%29%27%7D')}),
  2825. smalltalk.String);
  2826. smalltalk.addMethod(
  2827. '_add_',
  2828. smalltalk.method({
  2829. selector: 'add:',
  2830. category: 'adding',
  2831. fn: function (anObject) {
  2832. var self = this;
  2833. self._errorReadOnly();
  2834. return self;
  2835. },
  2836. source: unescape('add%3A%20anObject%0A%20%20%20%20%09self%20errorReadOnly%0A')}),
  2837. smalltalk.String);
  2838. smalltalk.addMethod(
  2839. '__comma',
  2840. smalltalk.method({
  2841. selector: ',',
  2842. category: 'copying',
  2843. fn: function (aString){
  2844. var self=this;
  2845. return self + aString;
  2846. return self;},
  2847. source: unescape('%2C%20aString%0A%09%7B%27return%20self%20+%20aString%27%7D')}),
  2848. smalltalk.String);
  2849. smalltalk.addMethod(
  2850. '_copyFrom_to_',
  2851. smalltalk.method({
  2852. selector: 'copyFrom:to:',
  2853. category: 'copying',
  2854. fn: function (anIndex, anotherIndex){
  2855. var self=this;
  2856. return self.substring(anIndex - 1, anotherIndex);;
  2857. return self;},
  2858. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09%7B%27return%20self.substring%28anIndex%20-%201%2C%20anotherIndex%29%3B%27%7D%0A')}),
  2859. smalltalk.String);
  2860. smalltalk.addMethod(
  2861. '_shallowCopy',
  2862. smalltalk.method({
  2863. selector: 'shallowCopy',
  2864. category: 'copying',
  2865. fn: function () {
  2866. var self = this;
  2867. return self._class()._fromString_(self);
  2868. return self;
  2869. },
  2870. source: unescape('shallowCopy%0A%20%20%20%20%09%5Eself%20class%20fromString%3A%20self%0A')}),
  2871. smalltalk.String);
  2872. smalltalk.addMethod(
  2873. '_deepCopy',
  2874. smalltalk.method({
  2875. selector: 'deepCopy',
  2876. category: 'copying',
  2877. fn: function () {
  2878. var self = this;
  2879. return self._shallowCopy();
  2880. return self;
  2881. },
  2882. source: unescape('deepCopy%0A%20%20%20%20%09%5Eself%20shallowCopy%0A')}),
  2883. smalltalk.String);
  2884. smalltalk.addMethod(
  2885. '_asSelector',
  2886. smalltalk.method({
  2887. selector: 'asSelector',
  2888. category: 'converting',
  2889. fn: function () {
  2890. var self = this;
  2891. var selector = nil;
  2892. selector = "_".__comma(self);
  2893. selector = selector._replace_with_(":", "_");
  2894. selector = selector._replace_with_(unescape("%5B+%5D"), "_plus");
  2895. selector = selector._replace_with_(unescape("-"), "_minus");
  2896. selector = selector._replace_with_(unescape("%5B*%5D"), "_star");
  2897. selector = selector._replace_with_(unescape("%5B/%5D"), "_slash");
  2898. selector = selector._replace_with_(unescape("%3E"), "_gt");
  2899. selector = selector._replace_with_(unescape("%3C"), "_lt");
  2900. selector = selector._replace_with_(unescape("%3D"), "_eq");
  2901. selector = selector._replace_with_(unescape("%2C"), "_comma");
  2902. selector = selector._replace_with_(unescape("%5B@%5D"), "_at");
  2903. return selector;
  2904. return self;
  2905. },
  2906. source: unescape('asSelector%0A%09%7C%20selector%20%7C%0A%09selector%20%3A%3D%20%27_%27%2C%20self.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3A%27%20with%3A%20%27_%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B+%5D%27%20with%3A%20%27_plus%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27-%27%20with%3A%20%27_minus%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B*%5D%27%20with%3A%20%27_star%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B/%5D%27%20with%3A%20%27_slash%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3E%27%20with%3A%20%27_gt%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3C%27%20with%3A%20%27_lt%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%3D%27%20with%3A%20%27_eq%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%2C%27%20with%3A%20%27_comma%27.%0A%20%20%20%20%09selector%20%3A%3D%20selector%20replace%3A%20%27%5B@%5D%27%20with%3A%20%27_at%27.%0A%09%5Eselector%0A')}),
  2907. smalltalk.String);
  2908. smalltalk.addMethod(
  2909. '_asJavascript',
  2910. smalltalk.method({
  2911. selector: 'asJavascript',
  2912. category: 'converting',
  2913. fn: function (){
  2914. var self=this;
  2915. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  2916. return "unescape(\"" + escape(self) + "\")";
  2917. else
  2918. return "\"" + self + "\"";
  2919. ;
  2920. return self;},
  2921. source: unescape('asJavascript%0A%09%7B%27%0A%09%09if%28self.search%28/%5E%5Ba-zA-Z0-9_%3A.%24%20%5D*%24/%29%20%3D%3D%20-1%29%0A%09%09%09return%20%22unescape%28%5C%22%22%20+%20escape%28self%29%20+%20%22%5C%22%29%22%3B%0A%09%09else%0A%09%09%09return%20%22%5C%22%22%20+%20self%20+%20%22%5C%22%22%3B%0A%09%27%7D')}),
  2922. smalltalk.String);
  2923. smalltalk.addMethod(
  2924. '_replace_with_',
  2925. smalltalk.method({
  2926. selector: 'replace:with:',
  2927. category: 'regular expressions',
  2928. fn: function (aString, anotherString) {
  2929. var self = this;
  2930. return self._replaceRegexp_with_(smalltalk.RegularExpression._fromString_flag_(aString, "g"), anotherString);
  2931. return self;
  2932. },
  2933. source: unescape('replace%3A%20aString%20with%3A%20anotherString%0A%20%20%20%20%09%5Eself%20replaceRegexp%3A%20%28RegularExpression%20fromString%3A%20aString%20flag%3A%20%27g%27%29%20with%3A%20anotherString%0A')}),
  2934. smalltalk.String);
  2935. smalltalk.addMethod(
  2936. '_replaceRegexp_with_',
  2937. smalltalk.method({
  2938. selector: 'replaceRegexp:with:',
  2939. category: 'regular expressions',
  2940. fn: function (aRegexp, aString){
  2941. var self=this;
  2942. return self.replace(aRegexp, aString);;
  2943. return self;},
  2944. source: unescape('replaceRegexp%3A%20aRegexp%20with%3A%20aString%0A%09%7B%27return%20self.replace%28aRegexp%2C%20aString%29%3B%27%7D%0A')}),
  2945. smalltalk.String);
  2946. smalltalk.addMethod(
  2947. '_tokenize_',
  2948. smalltalk.method({
  2949. selector: 'tokenize:',
  2950. category: 'converting',
  2951. fn: function (aString){
  2952. var self=this;
  2953. return self.split(aString);
  2954. return self;},
  2955. source: unescape('tokenize%3A%20aString%0A%09%7B%27return%20self.split%28aString%29%27%7D')}),
  2956. smalltalk.String);
  2957. smalltalk.addMethod(
  2958. '_match_',
  2959. smalltalk.method({
  2960. selector: 'match:',
  2961. category: 'regular expressions',
  2962. fn: function (aRegexp){
  2963. var self=this;
  2964. return self.search(aRegexp) != -1;
  2965. return self;},
  2966. source: unescape('match%3A%20aRegexp%0A%09%7B%27return%20self.search%28aRegexp%29%20%21%3D%20-1%27%7D%0A')}),
  2967. smalltalk.String);
  2968. smalltalk.addMethod(
  2969. '_asString',
  2970. smalltalk.method({
  2971. selector: 'asString',
  2972. category: 'converting',
  2973. fn: function () {
  2974. var self = this;
  2975. return self;
  2976. return self;
  2977. },
  2978. source: unescape('asString%0A%20%20%20%20%09%5Eself%0A')}),
  2979. smalltalk.String);
  2980. smalltalk.addMethod(
  2981. '_asNumber',
  2982. smalltalk.method({
  2983. selector: 'asNumber',
  2984. category: 'converting',
  2985. fn: function (){
  2986. var self=this;
  2987. return Number(self);;
  2988. return self;},
  2989. source: unescape('asNumber%0A%09%7B%27return%20Number%28self%29%3B%27%7D')}),
  2990. smalltalk.String);
  2991. smalltalk.addMethod(
  2992. '_asParser',
  2993. smalltalk.method({
  2994. selector: 'asParser',
  2995. category: 'converting',
  2996. fn: function () {
  2997. var self = this;
  2998. return smalltalk.PPStringParser._new()._string_(self);
  2999. return self;
  3000. },
  3001. source: unescape('asParser%0A%20%20%20%20%09%5EPPStringParser%20new%20string%3A%20self%0A')}),
  3002. smalltalk.String);
  3003. smalltalk.addMethod(
  3004. '_asChoiceParser',
  3005. smalltalk.method({
  3006. selector: 'asChoiceParser',
  3007. category: 'converting',
  3008. fn: function () {
  3009. var self = this;
  3010. return smalltalk.PPChoiceParser._withAll_(self._asArray()._collect_(function (each) {return each._asParser();}));
  3011. return self;
  3012. },
  3013. source: unescape('asChoiceParser%0A%20%20%20%20%09%5EPPChoiceParser%20withAll%3A%20%28self%20asArray%20collect%3A%20%5B%3Aeach%20%7C%20each%20asParser%5D%29%0A')}),
  3014. smalltalk.String);
  3015. smalltalk.addMethod(
  3016. '_asCharacterParser',
  3017. smalltalk.method({
  3018. selector: 'asCharacterParser',
  3019. category: 'converting',
  3020. fn: function () {
  3021. var self = this;
  3022. return smalltalk.PPCharacterParser._new()._string_(self);
  3023. return self;
  3024. },
  3025. source: unescape('asCharacterParser%0A%20%20%20%20%09%5EPPCharacterParser%20new%20string%3A%20self%0A')}),
  3026. smalltalk.String);
  3027. smalltalk.addMethod(
  3028. '_errorReadOnly',
  3029. smalltalk.method({
  3030. selector: 'errorReadOnly',
  3031. category: 'error handling',
  3032. fn: function () {
  3033. var self = this;
  3034. self._error_(unescape("Object%20is%20read-only"));
  3035. return self;
  3036. },
  3037. source: unescape('errorReadOnly%0A%20%20%20%20%09self%20error%3A%20%27Object%20is%20read-only%27%0A')}),
  3038. smalltalk.String);
  3039. smalltalk.addMethod(
  3040. '_printString',
  3041. smalltalk.method({
  3042. selector: 'printString',
  3043. category: 'printing',
  3044. fn: function () {
  3045. var self = this;
  3046. return unescape("%27").__comma(self).__comma(unescape("%27"));
  3047. return self;
  3048. },
  3049. source: unescape('printString%0A%20%20%20%20%09%5E%27%27%27%27%2C%20self%2C%20%27%27%27%27%0A')}),
  3050. smalltalk.String);
  3051. smalltalk.addMethod(
  3052. '_printNl',
  3053. smalltalk.method({
  3054. selector: 'printNl',
  3055. category: 'printing',
  3056. fn: function () {
  3057. var self = this;
  3058. (function () {console.log(self);}());
  3059. return self;
  3060. },
  3061. source: unescape('printNl%0A%09%7B%27console.log%28self%29%27%7D%0A')}),
  3062. smalltalk.String);
  3063. smalltalk.addMethod(
  3064. '_isString',
  3065. smalltalk.method({
  3066. selector: 'isString',
  3067. category: 'testing',
  3068. fn: function () {
  3069. var self = this;
  3070. return true;
  3071. return self;
  3072. },
  3073. source: unescape('isString%0A%20%20%20%20%09%5Etrue%0A')}),
  3074. smalltalk.String);
  3075. smalltalk.addMethod(
  3076. '_asJQuery',
  3077. smalltalk.method({
  3078. selector: 'asJQuery',
  3079. category: '*JQuery',
  3080. fn: function () {
  3081. var self = this;
  3082. return smalltalk.JQuery._fromString_(self);
  3083. return self;
  3084. },
  3085. source: unescape('asJQuery%0A%20%20%20%20%5EJQuery%20fromString%3A%20self%0A')}),
  3086. smalltalk.String);
  3087. smalltalk.addMethod(
  3088. '_appendToJQuery_',
  3089. smalltalk.method({
  3090. selector: 'appendToJQuery:',
  3091. category: '*JQuery',
  3092. fn: function (aJQuery) {
  3093. var self = this;
  3094. (function () {aJQuery._appendElement_(String(self));}());
  3095. return self;
  3096. },
  3097. source: unescape('appendToJQuery%3A%20aJQuery%0A%20%20%20%20%7B%27aJQuery._appendElement_%28String%28self%29%29%27%7D%0A')}),
  3098. smalltalk.String);
  3099. smalltalk.addMethod(
  3100. '_appendToBrush_',
  3101. smalltalk.method({
  3102. selector: 'appendToBrush:',
  3103. category: '*Canvas',
  3104. fn: function (aTagBrush) {
  3105. var self = this;
  3106. aTagBrush._appendString_(self);
  3107. return self;
  3108. },
  3109. source: unescape('appendToBrush%3A%20aTagBrush%0A%20%20%20%20aTagBrush%20appendString%3A%20self%0A')}),
  3110. smalltalk.String);
  3111. smalltalk.addMethod(
  3112. '__gt',
  3113. smalltalk.method({
  3114. selector: '>',
  3115. category: 'comparing',
  3116. fn: function (aString){
  3117. var self=this;
  3118. return String(self) > aString;
  3119. return self;},
  3120. source: unescape('%3E%20aString%0A%09%7B%27return%20String%28self%29%20%3E%20aString%27%7D%0A')}),
  3121. smalltalk.String);
  3122. smalltalk.addMethod(
  3123. '__lt',
  3124. smalltalk.method({
  3125. selector: '<',
  3126. category: 'comparing',
  3127. fn: function (aString){
  3128. var self=this;
  3129. return String(self) < aString;
  3130. return self;},
  3131. source: unescape('%3C%20aString%0A%09%7B%27return%20String%28self%29%20%3C%20aString%27%7D%0A')}),
  3132. smalltalk.String);
  3133. smalltalk.addMethod(
  3134. '__gt_eq',
  3135. smalltalk.method({
  3136. selector: '>=',
  3137. category: 'comparing',
  3138. fn: function (aString){
  3139. var self=this;
  3140. return String(self) >= aString;
  3141. return self;},
  3142. source: unescape('%3E%3D%20aString%0A%09%7B%27return%20String%28self%29%20%3E%3D%20aString%27%7D%0A')}),
  3143. smalltalk.String);
  3144. smalltalk.addMethod(
  3145. '__lt_eq',
  3146. smalltalk.method({
  3147. selector: '<=',
  3148. category: 'comparing',
  3149. fn: function (aString){
  3150. var self=this;
  3151. return String(self) <= aString;
  3152. return self;},
  3153. source: unescape('%3C%3D%20aString%0A%09%7B%27return%20String%28self%29%20%3C%3D%20aString%27%7D')}),
  3154. smalltalk.String);
  3155. smalltalk.addMethod(
  3156. '_remove_',
  3157. smalltalk.method({
  3158. selector: 'remove:',
  3159. category: 'adding',
  3160. fn: function (anObject) {
  3161. var self = this;
  3162. self._errorReadOnly();
  3163. return self;
  3164. },
  3165. source: unescape('remove%3A%20anObject%0A%20%20%20%20self%20errorReadOnly%0A')}),
  3166. smalltalk.String);
  3167. smalltalk.addMethod(
  3168. '_streamClass',
  3169. smalltalk.method({
  3170. selector: 'streamClass',
  3171. category: 'accessing',
  3172. fn: function () {
  3173. var self = this;
  3174. return smalltalk.StringStream;
  3175. return self;
  3176. },
  3177. source: unescape('streamClass%0A%09%20%20%20%20%5EStringStream%0A')}),
  3178. smalltalk.String.klass);
  3179. smalltalk.addMethod(
  3180. '_fromString_',
  3181. smalltalk.method({
  3182. selector: 'fromString:',
  3183. category: 'instance creation',
  3184. fn: function (aString) {
  3185. var self = this;
  3186. return function () {return new self.fn(aString);}();
  3187. return self;
  3188. },
  3189. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5E%7B%27return%20new%20self.fn%28aString%29%3B%27%7D%0A')}),
  3190. smalltalk.String.klass);
  3191. smalltalk.addMethod(
  3192. '_cr',
  3193. smalltalk.method({
  3194. selector: 'cr',
  3195. category: 'accessing',
  3196. fn: function (){
  3197. var self=this;
  3198. return '\n';;
  3199. return self;},
  3200. source: unescape('cr%0A%09%7B%27return%20%27%27%5Cn%27%27%3B%27%7D')}),
  3201. smalltalk.String.klass);
  3202. smalltalk.addMethod(
  3203. '_lf',
  3204. smalltalk.method({
  3205. selector: 'lf',
  3206. category: 'accessing',
  3207. fn: function (){
  3208. var self=this;
  3209. return '\r';;
  3210. return self;},
  3211. source: unescape('lf%0A%09%7B%27return%20%27%27%5Cr%27%27%3B%27%7D%0A')}),
  3212. smalltalk.String.klass);
  3213. smalltalk.addMethod(
  3214. '_space',
  3215. smalltalk.method({
  3216. selector: 'space',
  3217. category: 'accessing',
  3218. fn: function (){
  3219. var self=this;
  3220. return ' ';;
  3221. return self;},
  3222. source: unescape('space%0A%09%7B%27return%20%27%27%20%27%27%3B%27%7D%0A')}),
  3223. smalltalk.String.klass);
  3224. smalltalk.addMethod(
  3225. '_tab',
  3226. smalltalk.method({
  3227. selector: 'tab',
  3228. category: 'accessing',
  3229. fn: function (){
  3230. var self=this;
  3231. return '\t';;
  3232. return self;},
  3233. source: unescape('tab%0A%09%7B%27return%20%27%27%5Ct%27%27%3B%27%7D')}),
  3234. smalltalk.String.klass);
  3235. smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel');
  3236. smalltalk.addMethod(
  3237. '_compile_',
  3238. smalltalk.method({
  3239. selector: 'compile:',
  3240. category: 'evaluating',
  3241. fn: function (aString){
  3242. var self=this;
  3243. return self.compile(aString);;
  3244. return self;},
  3245. source: unescape('compile%3A%20aString%0A%09%7B%27return%20self.compile%28aString%29%3B%27%7D')}),
  3246. smalltalk.RegularExpression);
  3247. smalltalk.addMethod(
  3248. '_exec_',
  3249. smalltalk.method({
  3250. selector: 'exec:',
  3251. category: 'evaluating',
  3252. fn: function (aString){
  3253. var self=this;
  3254. return self.exec(aString);;
  3255. return self;},
  3256. source: unescape('exec%3A%20aString%0A%09%7B%27return%20self.exec%28aString%29%3B%27%7D')}),
  3257. smalltalk.RegularExpression);
  3258. smalltalk.addMethod(
  3259. '_test_',
  3260. smalltalk.method({
  3261. selector: 'test:',
  3262. category: 'evaluating',
  3263. fn: function (aString){
  3264. var self=this;
  3265. return self.test(aString);;
  3266. return self;},
  3267. source: unescape('test%3A%20aString%0A%09%7B%27return%20self.test%28aString%29%3B%27%7D')}),
  3268. smalltalk.RegularExpression);
  3269. smalltalk.addMethod(
  3270. '_fromString_flag_',
  3271. smalltalk.method({
  3272. selector: 'fromString:flag:',
  3273. category: 'instance creation',
  3274. fn: function (aString, anotherString){
  3275. var self=this;
  3276. return new RegExp(aString, anotherString);;
  3277. return self;},
  3278. source: unescape('fromString%3A%20aString%20flag%3A%20anotherString%0A%09%7B%27return%20new%20RegExp%28aString%2C%20anotherString%29%3B%27%7D%0A')}),
  3279. smalltalk.RegularExpression.klass);
  3280. smalltalk.addMethod(
  3281. '_fromString_',
  3282. smalltalk.method({
  3283. selector: 'fromString:',
  3284. category: 'instance creation',
  3285. fn: function (aString) {
  3286. var self = this;
  3287. return self._fromString_flag_(aString, "");
  3288. return self;
  3289. },
  3290. source: unescape('fromString%3A%20aString%0A%09%20%20%20%20%5Eself%20fromString%3A%20aString%20flag%3A%20%27%27%0A')}),
  3291. smalltalk.RegularExpression.klass);
  3292. smalltalk.addClass('Array', smalltalk.Collection, [], 'Kernel');
  3293. smalltalk.addMethod(
  3294. '_size',
  3295. smalltalk.method({
  3296. selector: 'size',
  3297. category: 'accessing',
  3298. fn: function (){
  3299. var self=this;
  3300. return self.length;
  3301. return self;},
  3302. source: unescape('size%0A%09%7B%27return%20self.length%27%7D')}),
  3303. smalltalk.Array);
  3304. smalltalk.addMethod(
  3305. '_at_put_',
  3306. smalltalk.method({
  3307. selector: 'at:put:',
  3308. category: 'accessing',
  3309. fn: function (anIndex, anObject){
  3310. var self=this;
  3311. return self[anIndex - 1] = anObject;
  3312. return self;},
  3313. source: unescape('at%3A%20anIndex%20put%3A%20anObject%0A%09%7B%27return%20self%5BanIndex%20-%201%5D%20%3D%20anObject%27%7D%0A')}),
  3314. smalltalk.Array);
  3315. smalltalk.addMethod(
  3316. '_at_ifAbsent_',
  3317. smalltalk.method({
  3318. selector: 'at:ifAbsent:',
  3319. category: 'accessing',
  3320. fn: function (anIndex, aBlock){
  3321. var self=this;
  3322. var value = self[anIndex - 1];
  3323. if(value === undefined) {
  3324. return aBlock();
  3325. } else {
  3326. return value;
  3327. }
  3328. ;
  3329. return self;},
  3330. source: unescape('at%3A%20anIndex%20ifAbsent%3A%20aBlock%0A%09%7B%27%0A%09%20%20%20%20var%20value%20%3D%20self%5BanIndex%20-%201%5D%3B%0A%09%20%20%20%20if%28value%20%3D%3D%3D%20undefined%29%20%7B%0A%09%09return%20aBlock%28%29%3B%0A%09%20%20%20%20%7D%20else%20%7B%0A%09%09return%20value%3B%0A%09%20%20%20%20%7D%0A%09%27%7D%0A')}),
  3331. smalltalk.Array);
  3332. smalltalk.addMethod(
  3333. '_add_',
  3334. smalltalk.method({
  3335. selector: 'add:',
  3336. category: 'adding',
  3337. fn: function (anObject){
  3338. var self=this;
  3339. self.push(anObject); return anObject;;
  3340. return self;},
  3341. source: unescape('add%3A%20anObject%0A%09%7B%27self.push%28anObject%29%3B%20return%20anObject%3B%27%7D%0A')}),
  3342. smalltalk.Array);
  3343. smalltalk.addMethod(
  3344. '_addLast_',
  3345. smalltalk.method({
  3346. selector: 'addLast:',
  3347. category: 'adding',
  3348. fn: function (anObject) {
  3349. var self = this;
  3350. return self._add_(anObject);
  3351. return self;
  3352. },
  3353. source: unescape('addLast%3A%20anObject%0A%09%5Eself%20add%3A%20anObject%0A')}),
  3354. smalltalk.Array);
  3355. smalltalk.addMethod(
  3356. '_shallowCopy',
  3357. smalltalk.method({
  3358. selector: 'shallowCopy',
  3359. category: 'copying',
  3360. fn: function () {
  3361. var self = this;
  3362. var newCollection = nil;
  3363. newCollection = self._class()._new();
  3364. self._do_(function (each) {return newCollection._add_(each);});
  3365. return newCollection;
  3366. return self;
  3367. },
  3368. source: unescape('shallowCopy%0A%09%7C%20newCollection%20%7C%0A%09newCollection%20%3A%3D%20self%20class%20new.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20newCollection%20add%3A%20each%5D.%0A%09%5EnewCollection%0A')}),
  3369. smalltalk.Array);
  3370. smalltalk.addMethod(
  3371. '_deepCopy',
  3372. smalltalk.method({
  3373. selector: 'deepCopy',
  3374. category: 'copying',
  3375. fn: function () {
  3376. var self = this;
  3377. var newCollection = nil;
  3378. newCollection = self._class()._new();
  3379. self._do_(function (each) {return newCollection._add_(each._deepCopy());});
  3380. return newCollection;
  3381. return self;
  3382. },
  3383. source: unescape('deepCopy%0A%09%7C%20newCollection%20%7C%0A%09newCollection%20%3A%3D%20self%20class%20new.%0A%09self%20do%3A%20%5B%3Aeach%20%7C%20newCollection%20add%3A%20each%20deepCopy%5D.%0A%09%5EnewCollection%0A')}),
  3384. smalltalk.Array);
  3385. smalltalk.addMethod(
  3386. '_copyFrom_to_',
  3387. smalltalk.method({
  3388. selector: 'copyFrom:to:',
  3389. category: 'copying',
  3390. fn: function (anIndex, anotherIndex) {
  3391. var self = this;
  3392. var array = nil;
  3393. array = self._class()._new();
  3394. anIndex._to_do_(anotherIndex, function (each) {return array._add_(self._at_(each));});
  3395. return array;
  3396. return self;
  3397. },
  3398. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09%7C%20array%20%7C%0A%09array%20%3A%3D%20self%20class%20new.%0A%09anIndex%20to%3A%20anotherIndex%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20array%20add%3A%20%28self%20at%3A%20each%29%5D.%0A%09%5Earray%0A')}),
  3399. smalltalk.Array);
  3400. smalltalk.addMethod(
  3401. '_join_',
  3402. smalltalk.method({
  3403. selector: 'join:',
  3404. category: 'enumerating',
  3405. fn: function (aString){
  3406. var self=this;
  3407. return self.join(aString);;
  3408. return self;},
  3409. source: unescape('join%3A%20aString%0A%09%7B%27return%20self.join%28aString%29%3B%27%7D')}),
  3410. smalltalk.Array);
  3411. smalltalk.addMethod(
  3412. '_asJavascript',
  3413. smalltalk.method({
  3414. selector: 'asJavascript',
  3415. category: 'converting',
  3416. fn: function () {
  3417. var self = this;
  3418. return unescape("%5B").__comma(self._collect_(function (each) {return each._asJavascript();})._join_(unescape("%2C%20"))).__comma(unescape("%5D"));
  3419. return self;
  3420. },
  3421. source: unescape('asJavascript%0A%09%5E%27%5B%27%2C%20%28%28self%20collect%3A%20%5B%3Aeach%20%7C%20each%20asJavascript%5D%29%20join%3A%20%27%2C%20%27%29%2C%20%20%27%5D%27%0A')}),
  3422. smalltalk.Array);
  3423. smalltalk.addMethod(
  3424. '_sort',
  3425. smalltalk.method({
  3426. selector: 'sort',
  3427. category: 'enumerating',
  3428. fn: function () {
  3429. var self = this;
  3430. return self._basicPerform_("sort");
  3431. return self;
  3432. },
  3433. source: unescape('sort%0A%20%20%20%20%5Eself%20basicPerform%3A%20%27sort%27%0A')}),
  3434. smalltalk.Array);
  3435. smalltalk.addMethod(
  3436. '_sort_',
  3437. smalltalk.method({
  3438. selector: 'sort:',
  3439. category: 'enumerating',
  3440. fn: function (aBlock){
  3441. var self=this;
  3442. return self.sort(function(a, b) {
  3443. if(aBlock(a,b)) {return 1} else {return -1}
  3444. })
  3445. ;
  3446. return self;},
  3447. source: unescape('sort%3A%20aBlock%0A%09%7B%27%0A%09%09return%20self.sort%28function%28a%2C%20b%29%20%7B%0A%09%09%09if%28aBlock%28a%2Cb%29%29%20%7Breturn%201%7D%20else%20%7Breturn%20-1%7D%0A%09%09%7D%29%0A%09%27%7D')}),
  3448. smalltalk.Array);
  3449. smalltalk.addMethod(
  3450. '_remove_',
  3451. smalltalk.method({
  3452. selector: 'remove:',
  3453. category: 'adding',
  3454. fn: function (anObject){
  3455. var self=this;
  3456. for(var i=0;i<self.length;i++) {
  3457. if(self[i] == anObject) {
  3458. self.splice(i,1);
  3459. break;
  3460. }
  3461. }
  3462. ;
  3463. return self;},
  3464. source: unescape('remove%3A%20anObject%0A%09%7B%27%0A%09%09for%28var%20i%3D0%3Bi%3Cself.length%3Bi++%29%20%7B%0A%09%09%09if%28self%5Bi%5D%20%3D%3D%20anObject%29%20%7B%0A%09%09%09%09self.splice%28i%2C1%29%3B%0A%09%09%09%09break%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%27%7D%0A')}),
  3465. smalltalk.Array);
  3466. smalltalk.addMethod(
  3467. '_sorted',
  3468. smalltalk.method({
  3469. selector: 'sorted',
  3470. category: 'enumerating',
  3471. fn: function () {
  3472. var self = this;
  3473. return self._copy()._sort();
  3474. return self;
  3475. },
  3476. source: unescape('sorted%0A%09%5Eself%20copy%20sort')}),
  3477. smalltalk.Array);
  3478. smalltalk.addMethod(
  3479. '_sorted_',
  3480. smalltalk.method({
  3481. selector: 'sorted:',
  3482. category: 'enumerating',
  3483. fn: function (aBlock) {
  3484. var self = this;
  3485. return self._copy()._sorted_(aBlock);
  3486. return self;
  3487. },
  3488. source: unescape('sorted%3A%20aBlock%0A%09%5Eself%20copy%20sorted%3A%20aBlock')}),
  3489. smalltalk.Array);
  3490. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel');
  3491. smalltalk.addMethod(
  3492. '_messageText',
  3493. smalltalk.method({
  3494. selector: 'messageText',
  3495. category: 'accessing',
  3496. fn: function () {
  3497. var self = this;
  3498. return self['@messageText'];
  3499. return self;
  3500. },
  3501. source: unescape('messageText%0A%09%5EmessageText%0A')}),
  3502. smalltalk.Error);
  3503. smalltalk.addMethod(
  3504. '_messageText_',
  3505. smalltalk.method({
  3506. selector: 'messageText:',
  3507. category: 'accessing',
  3508. fn: function (aString) {
  3509. var self = this;
  3510. self['@messageText'] = aString;
  3511. return self;
  3512. },
  3513. source: unescape('messageText%3A%20aString%0A%09messageText%20%3A%3D%20aString%0A')}),
  3514. smalltalk.Error);
  3515. smalltalk.addMethod(
  3516. '_signal',
  3517. smalltalk.method({
  3518. selector: 'signal',
  3519. category: 'signaling',
  3520. fn: function (){
  3521. var self=this;
  3522. throw({smalltalkError: self});
  3523. return self;},
  3524. source: unescape('signal%0A%09%7B%27throw%28%7BsmalltalkError%3A%20self%7D%29%27%7D')}),
  3525. smalltalk.Error);
  3526. smalltalk.addMethod(
  3527. '_signal_',
  3528. smalltalk.method({
  3529. selector: 'signal:',
  3530. category: 'instance creation',
  3531. fn: function (aString) {
  3532. var self = this;
  3533. return function ($rec) {$rec._messageText_(aString);return $rec._signal();}(self._new());
  3534. return self;
  3535. },
  3536. source: unescape('signal%3A%20aString%0A%09%20%20%20%20%5Eself%20new%0A%09%09messageText%3A%20aString%3B%0A%09%09signal%0A')}),
  3537. smalltalk.Error.klass);
  3538. smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel');
  3539. smalltalk.addMethod(
  3540. '__eq',
  3541. smalltalk.method({
  3542. selector: '=',
  3543. category: 'comparing',
  3544. fn: function (anAssociation) {
  3545. var self = this;
  3546. return self._class().__eq(anAssociation._class())._and_(function () {return self._key().__eq(anAssociation._key())._and_(function () {return self._value().__eq(anAssociation._value());});});
  3547. return self;
  3548. },
  3549. source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D%0A')}),
  3550. smalltalk.Association);
  3551. smalltalk.addMethod(
  3552. '_key_',
  3553. smalltalk.method({
  3554. selector: 'key:',
  3555. category: 'accessing',
  3556. fn: function (aKey) {
  3557. var self = this;
  3558. self['@key'] = aKey;
  3559. return self;
  3560. },
  3561. source: unescape('key%3A%20aKey%0A%09key%20%3A%3D%20aKey%0A')}),
  3562. smalltalk.Association);
  3563. smalltalk.addMethod(
  3564. '_key',
  3565. smalltalk.method({
  3566. selector: 'key',
  3567. category: 'accessing',
  3568. fn: function () {
  3569. var self = this;
  3570. return self['@key'];
  3571. return self;
  3572. },
  3573. source: unescape('key%0A%09%5Ekey%0A')}),
  3574. smalltalk.Association);
  3575. smalltalk.addMethod(
  3576. '_value_',
  3577. smalltalk.method({
  3578. selector: 'value:',
  3579. category: 'accessing',
  3580. fn: function (aValue) {
  3581. var self = this;
  3582. self['@value'] = aValue;
  3583. return self;
  3584. },
  3585. source: unescape('value%3A%20aValue%0A%09value%20%3A%3D%20aValue%0A')}),
  3586. smalltalk.Association);
  3587. smalltalk.addMethod(
  3588. '_value',
  3589. smalltalk.method({
  3590. selector: 'value',
  3591. category: 'accessing',
  3592. fn: function () {
  3593. var self = this;
  3594. return self['@value'];
  3595. return self;
  3596. },
  3597. source: unescape('value%0A%09%5Evalue%0A')}),
  3598. smalltalk.Association);
  3599. smalltalk.addMethod(
  3600. '_key_value_',
  3601. smalltalk.method({
  3602. selector: 'key:value:',
  3603. category: 'instance creation',
  3604. fn: function (aKey, aValue) {
  3605. var self = this;
  3606. return function ($rec) {$rec._key_(aKey);$rec._value_(aValue);return $rec._yourself();}(self._new());
  3607. return self;
  3608. },
  3609. source: unescape('key%3A%20aKey%20value%3A%20aValue%0A%09%20%20%20%20%5Eself%20new%0A%09%09key%3A%20aKey%3B%0A%09%09value%3A%20aValue%3B%0A%09%09yourself%0A')}),
  3610. smalltalk.Association.klass);
  3611. smalltalk.addClass('Dictionary', smalltalk.Collection, ['keys'], 'Kernel');
  3612. smalltalk.addMethod(
  3613. '__eq',
  3614. smalltalk.method({
  3615. selector: '=',
  3616. category: 'comparing',
  3617. fn: function (aDictionary) {
  3618. var self = this;
  3619. try {
  3620. self._class().__eq(aDictionary._class())._ifFalse_(function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();});
  3621. self._associationsDo_(function (assoc) {return aDictionary._at_ifAbsent_(assoc._key(), function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();}).__eq(assoc._value())._ifFalse_(function () {return function () {throw {name: "stReturn", selector: "__eq", fn: function () {return false;}};}();});});
  3622. (function () {throw {name: "stReturn", selector: "__eq", fn: function () {return true;}};}());
  3623. return self;
  3624. } catch (e) {
  3625. if (e.name === "stReturn" && e.selector === "__eq") {
  3626. return e.fn();
  3627. }
  3628. throw e;
  3629. }
  3630. },
  3631. source: unescape('%3D%20aDictionary%0A%09self%20class%20%3D%20aDictionary%20class%20ifFalse%3A%20%5B%5Efalse%5D.%0A%09self%20associationsDo%3A%20%5B%3Aassoc%20%7C%0A%09%20%20%20%20%28aDictionary%20at%3A%20assoc%20key%20ifAbsent%3A%20%5B%5Efalse%5D%29%20%3D%20assoc%20value%20%0A%09%09ifFalse%3A%20%5B%5Efalse%5D%5D.%0A%09%5Etrue%0A')}),
  3632. smalltalk.Dictionary);
  3633. smalltalk.addMethod(
  3634. '_shallowCopy',
  3635. smalltalk.method({
  3636. selector: 'shallowCopy',
  3637. category: 'copying',
  3638. fn: function () {
  3639. var self = this;
  3640. var copy = nil;
  3641. copy = self._class()._new();
  3642. self._associationsDo_(function (each) {return copy._at_put_(each._key(), each._value());});
  3643. return copy;
  3644. return self;
  3645. },
  3646. source: unescape('shallowCopy%0A%09%7C%20copy%20%7C%0A%09copy%20%3A%3D%20self%20class%20new.%0A%09self%20associationsDo%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20copy%20at%3A%20each%20key%20%20put%3A%20each%20value%5D.%0A%09%5Ecopy%0A')}),
  3647. smalltalk.Dictionary);
  3648. smalltalk.addMethod(
  3649. '_initialize',
  3650. smalltalk.method({
  3651. selector: 'initialize',
  3652. category: 'initialization',
  3653. fn: function () {
  3654. var self = this;
  3655. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  3656. self['@keys'] = [];
  3657. return self;
  3658. },
  3659. source: unescape('initialize%0A%20%20%20%20%09super%20initialize.%0A%20%20%20%20%09keys%20%3A%3D%20%23%28%29%0A')}),
  3660. smalltalk.Dictionary);
  3661. smalltalk.addMethod(
  3662. '_size',
  3663. smalltalk.method({
  3664. selector: 'size',
  3665. category: 'accessing',
  3666. fn: function () {
  3667. var self = this;
  3668. return self['@keys']._size();
  3669. return self;
  3670. },
  3671. source: unescape('size%0A%09%5Ekeys%20size%0A')}),
  3672. smalltalk.Dictionary);
  3673. smalltalk.addMethod(
  3674. '_associations',
  3675. smalltalk.method({
  3676. selector: 'associations',
  3677. category: 'accessing',
  3678. fn: function () {
  3679. var self = this;
  3680. var associations = nil;
  3681. associations = [];
  3682. self['@keys']._do_(function (each) {return associations._add_(smalltalk.Association._key_value_(each, self._at_(each)));});
  3683. return associations;
  3684. return self;
  3685. },
  3686. source: unescape('associations%0A%09%7C%20associations%20%7C%0A%09associations%20%3A%3D%20%23%28%29.%0A%09keys%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20associations%20add%3A%20%28Association%20key%3A%20each%20value%3A%20%28self%20at%3A%20each%29%29%5D.%0A%09%5Eassociations%0A')}),
  3687. smalltalk.Dictionary);
  3688. smalltalk.addMethod(
  3689. '_keys',
  3690. smalltalk.method({
  3691. selector: 'keys',
  3692. category: 'accessing',
  3693. fn: function () {
  3694. var self = this;
  3695. return self['@keys']._copy();
  3696. return self;
  3697. },
  3698. source: unescape('keys%0A%09%5Ekeys%20copy%0A')}),
  3699. smalltalk.Dictionary);
  3700. smalltalk.addMethod(
  3701. '_values',
  3702. smalltalk.method({
  3703. selector: 'values',
  3704. category: 'accessing',
  3705. fn: function () {
  3706. var self = this;
  3707. return self['@keys']._collect_(function (each) {return self._at_(each);});
  3708. return self;
  3709. },
  3710. source: unescape('values%0A%20%20%20%20%09%5Ekeys%20collect%3A%20%5B%3Aeach%20%7C%20self%20at%3A%20each%5D%0A')}),
  3711. smalltalk.Dictionary);
  3712. smalltalk.addMethod(
  3713. '_at_put_',
  3714. smalltalk.method({
  3715. selector: 'at:put:',
  3716. category: 'accessing',
  3717. fn: function (aKey, aValue) {
  3718. var self = this;
  3719. self['@keys']._includes_(aKey)._ifFalse_(function () {return self['@keys']._add_(aKey);});
  3720. return self._basicAt_put_(aKey, aValue);
  3721. return self;
  3722. },
  3723. source: unescape('at%3A%20aKey%20put%3A%20aValue%0A%09%28keys%20includes%3A%20aKey%29%20ifFalse%3A%20%5Bkeys%20add%3A%20aKey%5D.%0A%09%5Eself%20basicAt%3A%20aKey%20put%3A%20aValue%0A')}),
  3724. smalltalk.Dictionary);
  3725. smalltalk.addMethod(
  3726. '_at_ifAbsent_',
  3727. smalltalk.method({
  3728. selector: 'at:ifAbsent:',
  3729. category: 'accessing',
  3730. fn: function (aKey, aBlock) {
  3731. var self = this;
  3732. return self._keys()._includes_(aKey)._ifTrue_ifFalse_(function () {return self._basicAt_(aKey);}, aBlock);
  3733. return self;
  3734. },
  3735. source: unescape('at%3A%20aKey%20ifAbsent%3A%20aBlock%0A%09%5E%28self%20keys%20includes%3A%20aKey%29%0A%09%09ifTrue%3A%20%5Bself%20basicAt%3A%20aKey%5D%0A%09%09ifFalse%3A%20aBlock')}),
  3736. smalltalk.Dictionary);
  3737. smalltalk.addMethod(
  3738. '_at_ifAbsentPut_',
  3739. smalltalk.method({
  3740. selector: 'at:ifAbsentPut:',
  3741. category: 'accessing',
  3742. fn: function (aKey, aBlock) {
  3743. var self = this;
  3744. return self._at_ifAbsent_(aKey, function () {return self._at_put_(aKey, aBlock._value());});
  3745. return self;
  3746. },
  3747. source: unescape('at%3A%20aKey%20ifAbsentPut%3A%20aBlock%0A%20%20%20%20%09%5Eself%20at%3A%20aKey%20ifAbsent%3A%20%5B%0A%20%20%20%20%09%20%20%20%20self%20at%3A%20aKey%20put%3A%20aBlock%20value%5D%0A')}),
  3748. smalltalk.Dictionary);
  3749. smalltalk.addMethod(
  3750. '_at_ifPresent_',
  3751. smalltalk.method({
  3752. selector: 'at:ifPresent:',
  3753. category: 'accessing',
  3754. fn: function (aKey, aBlock) {
  3755. var self = this;
  3756. return self._basicAt_(aKey)._ifNotNil_(function () {return aBlock._value_(self._at_(aKey));});
  3757. return self;
  3758. },
  3759. source: unescape('at%3A%20aKey%20ifPresent%3A%20aBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%20ifNotNil%3A%20%5BaBlock%20value%3A%20%28self%20at%3A%20aKey%29%5D%0A')}),
  3760. smalltalk.Dictionary);
  3761. smalltalk.addMethod(
  3762. '_at_ifPresent_ifAbsent_',
  3763. smalltalk.method({
  3764. selector: 'at:ifPresent:ifAbsent:',
  3765. category: 'accessing',
  3766. fn: function (aKey, aBlock, anotherBlock) {
  3767. var self = this;
  3768. return self._basicAt_(aKey)._ifNil_ifNotNil_(anotherBlock, function () {return aBlock._value_(self._at_(aKey));});
  3769. return self;
  3770. },
  3771. source: unescape('at%3A%20aKey%20ifPresent%3A%20aBlock%20ifAbsent%3A%20anotherBlock%0A%09%5E%28self%20basicAt%3A%20aKey%29%0A%09%20%20%20%20ifNil%3A%20anotherBlock%0A%09%20%20%20%20ifNotNil%3A%20%5BaBlock%20value%3A%20%28self%20at%3A%20aKey%29%5D%0A')}),
  3772. smalltalk.Dictionary);
  3773. smalltalk.addMethod(
  3774. '_add_',
  3775. smalltalk.method({
  3776. selector: 'add:',
  3777. category: 'adding/removing',
  3778. fn: function (anAssociation) {
  3779. var self = this;
  3780. self._at_put_(anAssociation._key(), anAssociation._value());
  3781. return self;
  3782. },
  3783. source: unescape('add%3A%20anAssociation%0A%20%20%20%20%09self%20at%3A%20anAssociation%20key%20put%3A%20anAssociation%20value%0A')}),
  3784. smalltalk.Dictionary);
  3785. smalltalk.addMethod(
  3786. '_addAll_',
  3787. smalltalk.method({
  3788. selector: 'addAll:',
  3789. category: 'adding/removing',
  3790. fn: function (aDictionary) {
  3791. var self = this;
  3792. self.klass.superclass.fn.prototype._addAll_.apply(self, [aDictionary._associations()]);
  3793. return aDictionary;
  3794. return self;
  3795. },
  3796. source: unescape('addAll%3A%20aDictionary%0A%20%20%20%20%09super%20addAll%3A%20aDictionary%20associations.%0A%20%20%20%20%09%5EaDictionary%0A')}),
  3797. smalltalk.Dictionary);
  3798. smalltalk.addMethod(
  3799. '__comma',
  3800. smalltalk.method({
  3801. selector: ',',
  3802. category: 'copying',
  3803. fn: function (aCollection) {
  3804. var self = this;
  3805. self._shouldNotImplement();
  3806. return self;
  3807. },
  3808. source: unescape('%2C%20aCollection%0A%09self%20shouldNotImplement%0A')}),
  3809. smalltalk.Dictionary);
  3810. smalltalk.addMethod(
  3811. '_copyFrom_to_',
  3812. smalltalk.method({
  3813. selector: 'copyFrom:to:',
  3814. category: 'copying',
  3815. fn: function (anIndex, anotherIndex) {
  3816. var self = this;
  3817. self._shouldNotImplement();
  3818. return self;
  3819. },
  3820. source: unescape('copyFrom%3A%20anIndex%20to%3A%20anotherIndex%0A%09self%20shouldNotImplement%0A')}),
  3821. smalltalk.Dictionary);
  3822. smalltalk.addMethod(
  3823. '_associationsDo_',
  3824. smalltalk.method({
  3825. selector: 'associationsDo:',
  3826. category: 'enumerating',
  3827. fn: function (aBlock) {
  3828. var self = this;
  3829. self._associations()._do_(aBlock);
  3830. return self;
  3831. },
  3832. source: unescape('associationsDo%3A%20aBlock%0A%20%20%20%20%09self%20associations%20do%3A%20aBlock%0A')}),
  3833. smalltalk.Dictionary);
  3834. smalltalk.addMethod(
  3835. '_keysAndValuesDo_',
  3836. smalltalk.method({
  3837. selector: 'keysAndValuesDo:',
  3838. category: 'enumerating',
  3839. fn: function (aBlock) {
  3840. var self = this;
  3841. self._associationsDo_(function (each) {return aBlock._value_value_(each._key(), each._value());});
  3842. return self;
  3843. },
  3844. source: unescape('keysAndValuesDo%3A%20aBlock%0A%20%20%20%20%09self%20associationsDo%3A%20%5B%3Aeach%20%7C%0A%20%20%20%20%09%20%20%20%20aBlock%20value%3A%20each%20key%20value%3A%20each%20value%5D%0A')}),
  3845. smalltalk.Dictionary);
  3846. smalltalk.addMethod(
  3847. '_do_',
  3848. smalltalk.method({
  3849. selector: 'do:',
  3850. category: 'enumerating',
  3851. fn: function (aBlock) {
  3852. var self = this;
  3853. self._values()._do_(aBlock);
  3854. return self;
  3855. },
  3856. source: unescape('do%3A%20aBlock%0A%20%20%20%20%09self%20values%20do%3A%20aBlock%0A')}),
  3857. smalltalk.Dictionary);
  3858. smalltalk.addMethod(
  3859. '_select_',
  3860. smalltalk.method({
  3861. selector: 'select:',
  3862. category: 'enumerating',
  3863. fn: function (aBlock) {
  3864. var self = this;
  3865. var newDict = nil;
  3866. newDict = self._class()._new();
  3867. self._keysAndValuesDo_(function (key, value) {return aBlock._value_(value)._ifTrue_(function () {return newDict._at_put_(key, value);});});
  3868. return newDict;
  3869. return self;
  3870. },
  3871. source: unescape('select%3A%20aBlock%0A%20%20%20%20%09%7C%20newDict%20%7C%0A%20%20%20%20%09newDict%20%3A%3D%20self%20class%20new.%0A%20%20%20%20%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%20%20%20%20%09%20%20%20%20%28aBlock%20value%3A%20value%29%20ifTrue%3A%20%5BnewDict%20at%3A%20key%20put%3A%20value%5D%5D.%0A%20%20%20%20%09%5EnewDict%0A')}),
  3872. smalltalk.Dictionary);
  3873. smalltalk.addMethod(
  3874. '_collect_',
  3875. smalltalk.method({
  3876. selector: 'collect:',
  3877. category: 'enumerating',
  3878. fn: function (aBlock) {
  3879. var self = this;
  3880. var newDict = nil;
  3881. newDict = self._class()._new();
  3882. self._keysAndValuesDo_(function (key, value) {return aBlock._value_(value)._ifTrue_(function () {return newDict._at_put_(key, value);});});
  3883. return newDict;
  3884. return self;
  3885. },
  3886. source: unescape('collect%3A%20aBlock%0A%20%20%20%20%09%7C%20newDict%20%7C%0A%20%20%20%20%09newDict%20%3A%3D%20self%20class%20new.%0A%20%20%20%20%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%20%20%20%20%09%20%20%20%20%28aBlock%20value%3A%20value%29%20ifTrue%3A%20%5BnewDict%20at%3A%20key%20put%3A%20value%5D%5D.%0A%20%20%20%20%09%5EnewDict%0A')}),
  3887. smalltalk.Dictionary);
  3888. smalltalk.addMethod(
  3889. '_detect_ifNone_',
  3890. smalltalk.method({
  3891. selector: 'detect:ifNone:',
  3892. category: 'enumerating',
  3893. fn: function (aBlock, anotherBlock) {
  3894. var self = this;
  3895. return self._values()._detect_ifNone_(aBlock, anotherBlock);
  3896. return self;
  3897. },
  3898. source: unescape('detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A%09%5Eself%20values%20detect%3A%20aBlock%20ifNone%3A%20anotherBlock%0A')}),
  3899. smalltalk.Dictionary);
  3900. smalltalk.addMethod(
  3901. '_includes_',
  3902. smalltalk.method({
  3903. selector: 'includes:',
  3904. category: 'enumerating',
  3905. fn: function (anObject) {
  3906. var self = this;
  3907. return self._values()._includes_(anObject);
  3908. return self;
  3909. },
  3910. source: unescape('includes%3A%20anObject%0A%09%5Eself%20values%20includes%3A%20anObject%0A')}),
  3911. smalltalk.Dictionary);
  3912. smalltalk.addMethod(
  3913. '_remove_',
  3914. smalltalk.method({
  3915. selector: 'remove:',
  3916. category: 'adding/removing',
  3917. fn: function (aKey) {
  3918. var self = this;
  3919. self._removeKey_(aKey);
  3920. return self;
  3921. },
  3922. source: unescape('remove%3A%20aKey%0A%20%20%20%20self%20removeKey%3A%20aKey%0A')}),
  3923. smalltalk.Dictionary);
  3924. smalltalk.addMethod(
  3925. '_removeKey_',
  3926. smalltalk.method({
  3927. selector: 'removeKey:',
  3928. category: 'adding/removing',
  3929. fn: function (aKey) {
  3930. var self = this;
  3931. self['@keys']._remove_(aKey);
  3932. return self;
  3933. },
  3934. source: unescape('removeKey%3A%20aKey%0A%20%20%20%20keys%20remove%3A%20aKey%0A')}),
  3935. smalltalk.Dictionary);
  3936. smalltalk.addMethod(
  3937. '_inspectOn_',
  3938. smalltalk.method({
  3939. selector: 'inspectOn:',
  3940. category: '*IDE',
  3941. fn: function (anInspector) {
  3942. var self = this;
  3943. var variables = nil;
  3944. variables = smalltalk.Dictionary._new();
  3945. variables._at_put_(unescape("%23self"), self);
  3946. variables._at_put_(unescape("%23keys"), self._keys());
  3947. self._keysAndValuesDo_(function (key, value) {return variables._at_put_(key, value);});
  3948. (function ($rec) {$rec._setLabel_(self._printString());return $rec._setVariables_(variables);}(anInspector));
  3949. return self;
  3950. },
  3951. source: unescape('inspectOn%3A%20anInspector%0A%09%7C%20variables%20%7C%0A%09variables%20%3A%3D%20Dictionary%20new.%0A%09variables%20at%3A%20%27%23self%27%20put%3A%20self.%0A%09variables%20at%3A%20%27%23keys%27%20put%3A%20self%20keys.%0A%09self%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%09%09variables%20at%3A%20key%20put%3A%20value%5D.%0A%09anInspector%20%0A%09%09setLabel%3A%20self%20printString%3B%0A%09%09setVariables%3A%20variables')}),
  3952. smalltalk.Dictionary);
  3953. smalltalk.addClass('ClassBuilder', smalltalk.Object, [], 'Kernel');
  3954. smalltalk.addMethod(
  3955. '_superclass_subclass_',
  3956. smalltalk.method({
  3957. selector: 'superclass:subclass:',
  3958. category: 'class creation',
  3959. fn: function (aClass, aString) {
  3960. var self = this;
  3961. self._superclass_subclass_instanceVariableNames_category_(aClass, aString, "", nil);
  3962. return self;
  3963. },
  3964. source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%0A%09self%20superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20%27%27%20category%3A%20nil%0A')}),
  3965. smalltalk.ClassBuilder);
  3966. smalltalk.addMethod(
  3967. '_superclass_subclass_instanceVariableNames_category_',
  3968. smalltalk.method({
  3969. selector: 'superclass:subclass:instanceVariableNames:category:',
  3970. category: 'class creation',
  3971. fn: function (aClass, aString, aString2, aString3) {
  3972. var self = this;
  3973. var newClass = nil;
  3974. newClass = self._addSubclassOf_named_instanceVariableNames_(aClass, aString, self._instanceVariableNamesFor_(aString2));
  3975. self._setupClass_(newClass);
  3976. newClass._category_(aString3._ifNil_(function () {return "unclassified";}));
  3977. return self;
  3978. },
  3979. source: unescape('superclass%3A%20aClass%20subclass%3A%20aString%20instanceVariableNames%3A%20aString2%20category%3A%20aString3%0A%09%7C%20newClass%20%7C%0A%09newClass%20%3A%3D%20self%20addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20%28self%20instanceVariableNamesFor%3A%20aString2%29.%0A%09self%20setupClass%3A%20newClass.%0A%09newClass%20category%3A%20%28aString3%20ifNil%3A%20%5B%27unclassified%27%5D%29%0A')}),
  3980. smalltalk.ClassBuilder);
  3981. smalltalk.addMethod(
  3982. '_class_instanceVariableNames_',
  3983. smalltalk.method({
  3984. selector: 'class:instanceVariableNames:',
  3985. category: 'class creation',
  3986. fn: function (aClass, aString) {
  3987. var self = this;
  3988. aClass._isMetaclass()._ifFalse_(function () {return self._error_(aClass._name().__comma(" is not a metaclass"));});
  3989. aClass._basicAt_put_("iVarNames", self._instanceVariableNamesFor_(aString));
  3990. self._setupClass_(aClass);
  3991. return self;
  3992. },
  3993. source: unescape('class%3A%20aClass%20instanceVariableNames%3A%20aString%0A%09aClass%20isMetaclass%20ifFalse%3A%20%5Bself%20error%3A%20aClass%20name%2C%20%27%20is%20not%20a%20metaclass%27%5D.%0A%09aClass%20basicAt%3A%20%27iVarNames%27%20put%3A%20%28self%20instanceVariableNamesFor%3A%20aString%29.%0A%09self%20setupClass%3A%20aClass%0A')}),
  3994. smalltalk.ClassBuilder);
  3995. smalltalk.addMethod(
  3996. '_instanceVariableNamesFor_',
  3997. smalltalk.method({
  3998. selector: 'instanceVariableNamesFor:',
  3999. category: 'private',
  4000. fn: function (aString) {
  4001. var self = this;
  4002. return aString._tokenize_(" ")._reject_(function (each) {return each._isEmpty();});
  4003. return self;
  4004. },
  4005. source: unescape('instanceVariableNamesFor%3A%20aString%0A%09%5E%28aString%20tokenize%3A%20%27%20%27%29%20reject%3A%20%5B%3Aeach%20%7C%20each%20isEmpty%5D%0A')}),
  4006. smalltalk.ClassBuilder);
  4007. smalltalk.addMethod(
  4008. '_addSubclassOf_named_instanceVariableNames_',
  4009. smalltalk.method({
  4010. selector: 'addSubclassOf:named:instanceVariableNames:',
  4011. category: 'private',
  4012. fn: function (aClass, aString, aCollection){
  4013. var self=this;
  4014. smalltalk.addClass(aString, aClass, aCollection);
  4015. return smalltalk[aString];
  4016. return self;},
  4017. source: unescape('addSubclassOf%3A%20aClass%20named%3A%20aString%20instanceVariableNames%3A%20aCollection%0A%09%7B%27smalltalk.addClass%28aString%2C%20aClass%2C%20aCollection%29%3B%0A%09%20%20%20%20return%20smalltalk%5BaString%5D%27%7D')}),
  4018. smalltalk.ClassBuilder);
  4019. smalltalk.addMethod(
  4020. '_setupClass_',
  4021. smalltalk.method({
  4022. selector: 'setupClass:',
  4023. category: 'private',
  4024. fn: function (aClass) {
  4025. var self = this;
  4026. (function () {smalltalk.init(aClass);}());
  4027. return self;
  4028. },
  4029. source: unescape('setupClass%3A%20aClass%0A%09%7B%27smalltalk.init%28aClass%29%3B%27%7D%0A')}),
  4030. smalltalk.ClassBuilder);
  4031. smalltalk.addClass('ClassCategoryReader', smalltalk.Object, ['class', 'category', 'chunkParser'], 'Kernel');
  4032. smalltalk.addMethod(
  4033. '_initialize',
  4034. smalltalk.method({
  4035. selector: 'initialize',
  4036. category: 'initialization',
  4037. fn: function () {
  4038. var self = this;
  4039. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  4040. self['@chunkParser'] = smalltalk.ChunkParser._new();
  4041. return self;
  4042. },
  4043. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  4044. smalltalk.ClassCategoryReader);
  4045. smalltalk.addMethod(
  4046. '_class_category_',
  4047. smalltalk.method({
  4048. selector: 'class:category:',
  4049. category: 'accessing',
  4050. fn: function (aClass, aString) {
  4051. var self = this;
  4052. self['@class'] = aClass;
  4053. self['@category'] = aString;
  4054. return self;
  4055. },
  4056. source: unescape('class%3A%20aClass%20category%3A%20aString%0A%09class%20%3A%3D%20aClass.%0A%09category%20%3A%3D%20aString%0A')}),
  4057. smalltalk.ClassCategoryReader);
  4058. smalltalk.addMethod(
  4059. '_scanFrom_',
  4060. smalltalk.method({
  4061. selector: 'scanFrom:',
  4062. category: 'fileIn',
  4063. fn: function (aStream) {
  4064. var self = this;
  4065. var nextChunk = nil;
  4066. nextChunk = self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  4067. nextChunk._isEmptyChunk()._ifFalse_(function () {self._compileMethod_(nextChunk._contents());return self._scanFrom_(aStream);});
  4068. return self;
  4069. },
  4070. source: unescape('scanFrom%3A%20aStream%0A%09%7C%20nextChunk%20%7C%0A%09nextChunk%20%3A%3D%20%28chunkParser%20emptyChunk%20/%20chunkParser%20chunk%29%20parse%3A%20aStream.%0A%09nextChunk%20isEmptyChunk%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20compileMethod%3A%20nextChunk%20contents.%0A%09%20%20%20%20self%20scanFrom%3A%20aStream%5D.%0A')}),
  4071. smalltalk.ClassCategoryReader);
  4072. smalltalk.addMethod(
  4073. '_compileMethod_',
  4074. smalltalk.method({
  4075. selector: 'compileMethod:',
  4076. category: 'private',
  4077. fn: function (aString) {
  4078. var self = this;
  4079. var method = nil;
  4080. method = smalltalk.Compiler._new()._load_forClass_(aString, self['@class']);
  4081. method._category_(self['@category']);
  4082. self['@class']._addCompiledMethod_(method);
  4083. return self;
  4084. },
  4085. source: unescape('compileMethod%3A%20aString%0A%09%7C%20method%20%7C%0A%09method%20%3A%3D%20Compiler%20new%20load%3A%20aString%20forClass%3A%20class.%0A%09method%20category%3A%20category.%0A%09class%20addCompiledMethod%3A%20method%0A')}),
  4086. smalltalk.ClassCategoryReader);
  4087. smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel');
  4088. smalltalk.addMethod(
  4089. '_collection',
  4090. smalltalk.method({
  4091. selector: 'collection',
  4092. category: 'accessing',
  4093. fn: function () {
  4094. var self = this;
  4095. return self['@collection'];
  4096. return self;
  4097. },
  4098. source: unescape('collection%0A%09%5Ecollection%0A')}),
  4099. smalltalk.Stream);
  4100. smalltalk.addMethod(
  4101. '_setCollection_',
  4102. smalltalk.method({
  4103. selector: 'setCollection:',
  4104. category: 'accessing',
  4105. fn: function (aCollection) {
  4106. var self = this;
  4107. self['@collection'] = aCollection;
  4108. return self;
  4109. },
  4110. source: unescape('setCollection%3A%20aCollection%0A%09collection%20%3A%3D%20aCollection%0A')}),
  4111. smalltalk.Stream);
  4112. smalltalk.addMethod(
  4113. '_position',
  4114. smalltalk.method({
  4115. selector: 'position',
  4116. category: 'accessing',
  4117. fn: function () {
  4118. var self = this;
  4119. return self['@position']._ifNil_(function () {return self['@position'] = 0;});
  4120. return self;
  4121. },
  4122. source: unescape('position%0A%09%5Eposition%20ifNil%3A%20%5Bposition%20%3A%3D%200%5D%0A')}),
  4123. smalltalk.Stream);
  4124. smalltalk.addMethod(
  4125. '_position_',
  4126. smalltalk.method({
  4127. selector: 'position:',
  4128. category: 'accessing',
  4129. fn: function (anInteger) {
  4130. var self = this;
  4131. self['@position'] = anInteger;
  4132. return self;
  4133. },
  4134. source: unescape('position%3A%20anInteger%0A%09position%20%3A%3D%20anInteger%0A')}),
  4135. smalltalk.Stream);
  4136. smalltalk.addMethod(
  4137. '_streamSize',
  4138. smalltalk.method({
  4139. selector: 'streamSize',
  4140. category: 'accessing',
  4141. fn: function () {
  4142. var self = this;
  4143. return self['@streamSize'];
  4144. return self;
  4145. },
  4146. source: unescape('streamSize%0A%09%5EstreamSize%0A')}),
  4147. smalltalk.Stream);
  4148. smalltalk.addMethod(
  4149. '_setStreamSize_',
  4150. smalltalk.method({
  4151. selector: 'setStreamSize:',
  4152. category: 'accessing',
  4153. fn: function (anInteger) {
  4154. var self = this;
  4155. self['@streamSize'] = anInteger;
  4156. return self;
  4157. },
  4158. source: unescape('setStreamSize%3A%20anInteger%0A%09streamSize%20%3A%3D%20anInteger%0A')}),
  4159. smalltalk.Stream);
  4160. smalltalk.addMethod(
  4161. '_contents',
  4162. smalltalk.method({
  4163. selector: 'contents',
  4164. category: 'accessing',
  4165. fn: function () {
  4166. var self = this;
  4167. return self._collection()._copyFrom_to_(1, self._streamSize());
  4168. return self;
  4169. },
  4170. source: unescape('contents%0A%09%5Eself%20collection%0A%09%20%20%20%20copyFrom%3A%201%20%0A%09%20%20%20%20to%3A%20self%20streamSize%0A')}),
  4171. smalltalk.Stream);
  4172. smalltalk.addMethod(
  4173. '_size',
  4174. smalltalk.method({
  4175. selector: 'size',
  4176. category: 'accessing',
  4177. fn: function () {
  4178. var self = this;
  4179. return self._streamSize();
  4180. return self;
  4181. },
  4182. source: unescape('size%0A%09%5Eself%20streamSize%0A')}),
  4183. smalltalk.Stream);
  4184. smalltalk.addMethod(
  4185. '_reset',
  4186. smalltalk.method({
  4187. selector: 'reset',
  4188. category: 'actions',
  4189. fn: function () {
  4190. var self = this;
  4191. self._position_(0);
  4192. return self;
  4193. },
  4194. source: unescape('reset%0A%09self%20position%3A%200%0A')}),
  4195. smalltalk.Stream);
  4196. smalltalk.addMethod(
  4197. '_close',
  4198. smalltalk.method({
  4199. selector: 'close',
  4200. category: 'actions',
  4201. fn: function () {
  4202. var self = this;
  4203. return self;
  4204. },
  4205. source: unescape('close%0A')}),
  4206. smalltalk.Stream);
  4207. smalltalk.addMethod(
  4208. '_flush',
  4209. smalltalk.method({
  4210. selector: 'flush',
  4211. category: 'actions',
  4212. fn: function () {
  4213. var self = this;
  4214. return self;
  4215. },
  4216. source: unescape('flush%0A')}),
  4217. smalltalk.Stream);
  4218. smalltalk.addMethod(
  4219. '_resetContents',
  4220. smalltalk.method({
  4221. selector: 'resetContents',
  4222. category: 'actions',
  4223. fn: function () {
  4224. var self = this;
  4225. self._reset();
  4226. self._setStreamSize_(0);
  4227. return self;
  4228. },
  4229. source: unescape('resetContents%0A%09self%20reset.%0A%09self%20setStreamSize%3A%200%0A')}),
  4230. smalltalk.Stream);
  4231. smalltalk.addMethod(
  4232. '_do_',
  4233. smalltalk.method({
  4234. selector: 'do:',
  4235. category: 'enumerating',
  4236. fn: function (aBlock) {
  4237. var self = this;
  4238. (function () {return self._atEnd();}._whileFalse_(function () {return aBlock._value_(self._next());}));
  4239. return self;
  4240. },
  4241. source: unescape('do%3A%20aBlock%0A%09%5Bself%20atEnd%5D%20whileFalse%3A%20%5BaBlock%20value%3A%20self%20next%5D%0A')}),
  4242. smalltalk.Stream);
  4243. smalltalk.addMethod(
  4244. '_setToEnd',
  4245. smalltalk.method({
  4246. selector: 'setToEnd',
  4247. category: 'positioning',
  4248. fn: function () {
  4249. var self = this;
  4250. self._position_(self._size());
  4251. return self;
  4252. },
  4253. source: unescape('setToEnd%0A%09self%20position%3A%20self%20size%0A')}),
  4254. smalltalk.Stream);
  4255. smalltalk.addMethod(
  4256. '_skip_',
  4257. smalltalk.method({
  4258. selector: 'skip:',
  4259. category: 'positioning',
  4260. fn: function (anInteger) {
  4261. var self = this;
  4262. self._position_(self._position().__plus(anInteger)._min_max_(self._size(), 0));
  4263. return self;
  4264. },
  4265. source: unescape('skip%3A%20anInteger%0A%09self%20position%3A%20%28%28self%20position%20+%20anInteger%29%20min%3A%20self%20size%20max%3A%200%29%0A')}),
  4266. smalltalk.Stream);
  4267. smalltalk.addMethod(
  4268. '_next',
  4269. smalltalk.method({
  4270. selector: 'next',
  4271. category: 'reading',
  4272. fn: function () {
  4273. var self = this;
  4274. self._position_(self._position().__plus(1));
  4275. return self['@collection']._at_(self._position());
  4276. return self;
  4277. },
  4278. source: unescape('next%0A%09self%20position%3A%20self%20position%20+%201.%20%0A%09%5Ecollection%20at%3A%20self%20position%0A')}),
  4279. smalltalk.Stream);
  4280. smalltalk.addMethod(
  4281. '_next_',
  4282. smalltalk.method({
  4283. selector: 'next:',
  4284. category: 'reading',
  4285. fn: function (anInteger) {
  4286. var self = this;
  4287. var tempCollection = nil;
  4288. tempCollection = self._collection()._class()._new();
  4289. anInteger._timesRepeat_(function () {return self._atEnd()._ifFalse_(function () {return tempCollection._add_(self._next());});});
  4290. return tempCollection;
  4291. return self;
  4292. },
  4293. source: unescape('next%3A%20anInteger%0A%09%7C%20tempCollection%20%7C%0A%09tempCollection%20%3A%3D%20self%20collection%20class%20new.%0A%09anInteger%20timesRepeat%3A%20%5B%0A%09%20%20%20%20self%20atEnd%20ifFalse%3A%20%5B%0A%09%09tempCollection%20add%3A%20self%20next%5D%5D.%0A%09%5EtempCollection%0A')}),
  4294. smalltalk.Stream);
  4295. smalltalk.addMethod(
  4296. '_nextPut_',
  4297. smalltalk.method({
  4298. selector: 'nextPut:',
  4299. category: 'writing',
  4300. fn: function (anObject) {
  4301. var self = this;
  4302. self._position_(self._position().__plus(1));
  4303. self._collection()._at_put_(self._position(), anObject);
  4304. self._setStreamSize_(self._streamSize()._max_(self._position()));
  4305. return self;
  4306. },
  4307. source: unescape('nextPut%3A%20anObject%0A%09self%20position%3A%20self%20position%20+%201.%0A%09self%20collection%20at%3A%20self%20position%20put%3A%20anObject.%0A%09self%20setStreamSize%3A%20%28self%20streamSize%20max%3A%20self%20position%29%0A')}),
  4308. smalltalk.Stream);
  4309. smalltalk.addMethod(
  4310. '_nextPutAll_',
  4311. smalltalk.method({
  4312. selector: 'nextPutAll:',
  4313. category: 'writing',
  4314. fn: function (aCollection) {
  4315. var self = this;
  4316. aCollection._do_(function (each) {return self._nextPut_(each);});
  4317. return self;
  4318. },
  4319. source: unescape('nextPutAll%3A%20aCollection%0A%09aCollection%20do%3A%20%5B%3Aeach%20%7C%0A%09%20%20%20%20self%20nextPut%3A%20each%5D%0A')}),
  4320. smalltalk.Stream);
  4321. smalltalk.addMethod(
  4322. '_peek',
  4323. smalltalk.method({
  4324. selector: 'peek',
  4325. category: 'reading',
  4326. fn: function () {
  4327. var self = this;
  4328. return self._atEnd()._ifFalse_(function () {return self._collection()._at_(self._position().__plus(1));});
  4329. return self;
  4330. },
  4331. source: unescape('peek%0A%09%5Eself%20atEnd%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20collection%20at%3A%20self%20position%20+%201%5D%0A')}),
  4332. smalltalk.Stream);
  4333. smalltalk.addMethod(
  4334. '_atEnd',
  4335. smalltalk.method({
  4336. selector: 'atEnd',
  4337. category: 'testing',
  4338. fn: function () {
  4339. var self = this;
  4340. return self._position().__eq(self._size());
  4341. return self;
  4342. },
  4343. source: unescape('atEnd%0A%09%5Eself%20position%20%3D%20self%20size%0A')}),
  4344. smalltalk.Stream);
  4345. smalltalk.addMethod(
  4346. '_atStart',
  4347. smalltalk.method({
  4348. selector: 'atStart',
  4349. category: 'testing',
  4350. fn: function () {
  4351. var self = this;
  4352. return self._position().__eq(0);
  4353. return self;
  4354. },
  4355. source: unescape('atStart%0A%09%5Eself%20position%20%3D%200%0A')}),
  4356. smalltalk.Stream);
  4357. smalltalk.addMethod(
  4358. '_isEmpty',
  4359. smalltalk.method({
  4360. selector: 'isEmpty',
  4361. category: 'testing',
  4362. fn: function () {
  4363. var self = this;
  4364. return self._size().__eq(0);
  4365. return self;
  4366. },
  4367. source: unescape('isEmpty%0A%09%5Eself%20size%20%3D%200%0A')}),
  4368. smalltalk.Stream);
  4369. smalltalk.addMethod(
  4370. '_on_',
  4371. smalltalk.method({
  4372. selector: 'on:',
  4373. category: 'instance creation',
  4374. fn: function (aCollection) {
  4375. var self = this;
  4376. return function ($rec) {$rec._setCollection_(aCollection);$rec._setStreamSize_(aCollection._size());return $rec._yourself();}(self._new());
  4377. return self;
  4378. },
  4379. source: unescape('on%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%20%0A%09%09setCollection%3A%20aCollection%3B%0A%09%09setStreamSize%3A%20aCollection%20size%3B%0A%09%09yourself%0A')}),
  4380. smalltalk.Stream.klass);
  4381. smalltalk.addClass('StringStream', smalltalk.Stream, [], 'Kernel');
  4382. smalltalk.addMethod(
  4383. '_next_',
  4384. smalltalk.method({
  4385. selector: 'next:',
  4386. category: 'reading',
  4387. fn: function (anInteger) {
  4388. var self = this;
  4389. var tempCollection = nil;
  4390. tempCollection = self._collection()._class()._new();
  4391. anInteger._timesRepeat_(function () {return self._atEnd()._ifFalse_(function () {return tempCollection = tempCollection.__comma(self._next());});});
  4392. return tempCollection;
  4393. return self;
  4394. },
  4395. source: unescape('next%3A%20anInteger%0A%09%7C%20tempCollection%20%7C%0A%09tempCollection%20%3A%3D%20self%20collection%20class%20new.%0A%09anInteger%20timesRepeat%3A%20%5B%0A%09%20%20%20%20self%20atEnd%20ifFalse%3A%20%5B%0A%09%09tempCollection%20%3A%3D%20tempCollection%2C%20self%20next%5D%5D.%0A%09%5EtempCollection%0A')}),
  4396. smalltalk.StringStream);
  4397. smalltalk.addMethod(
  4398. '_nextPut_',
  4399. smalltalk.method({
  4400. selector: 'nextPut:',
  4401. category: 'writing',
  4402. fn: function (aString) {
  4403. var self = this;
  4404. self._nextPutAll_(aString);
  4405. return self;
  4406. },
  4407. source: unescape('nextPut%3A%20aString%0A%09self%20nextPutAll%3A%20aString%0A')}),
  4408. smalltalk.StringStream);
  4409. smalltalk.addMethod(
  4410. '_nextPutAll_',
  4411. smalltalk.method({
  4412. selector: 'nextPutAll:',
  4413. category: 'writing',
  4414. fn: function (aString) {
  4415. var self = this;
  4416. self._setCollection_(self._collection()._copyFrom_to_(1, self._position()).__comma(aString).__comma(self._collection()._copyFrom_to_(self._position().__plus(1).__plus(aString._size()), self._collection()._size())));
  4417. self._position_(self._position().__plus(aString._size()));
  4418. self._setStreamSize_(self._streamSize()._max_(self._position()));
  4419. return self;
  4420. },
  4421. source: unescape('nextPutAll%3A%20aString%0A%09self%20setCollection%3A%20%0A%09%20%20%20%20%28self%20collection%20copyFrom%3A%201%20to%3A%20self%20position%29%2C%0A%09%20%20%20%20aString%2C%0A%09%20%20%20%20%28self%20collection%20copyFrom%3A%20%28self%20position%20+%201%20+%20aString%20size%29%20to%3A%20self%20collection%20size%29.%0A%09self%20position%3A%20self%20position%20+%20aString%20size.%0A%09self%20setStreamSize%3A%20%28self%20streamSize%20max%3A%20self%20position%29%0A')}),
  4422. smalltalk.StringStream);
  4423. smalltalk.addClass('ClassCommentReader', smalltalk.Object, ['class', 'chunkParser'], 'Kernel');
  4424. smalltalk.addMethod(
  4425. '_class_',
  4426. smalltalk.method({
  4427. selector: 'class:',
  4428. category: 'accessing',
  4429. fn: function (aClass) {
  4430. var self = this;
  4431. self['@class'] = aClass;
  4432. return self;
  4433. },
  4434. source: unescape('class%3A%20aClass%0A%09class%20%3A%3D%20aClass%0A')}),
  4435. smalltalk.ClassCommentReader);
  4436. smalltalk.addMethod(
  4437. '_scanFrom_',
  4438. smalltalk.method({
  4439. selector: 'scanFrom:',
  4440. category: 'fileIn',
  4441. fn: function (aStream) {
  4442. var self = this;
  4443. var nextChunk = nil;
  4444. nextChunk = self['@chunkParser']._emptyChunk().__slash(self['@chunkParser']._chunk())._parse_(aStream);
  4445. nextChunk._isEmptyChunk()._ifFalse_(function () {return self._setComment_(nextChunk._contents());});
  4446. return self;
  4447. },
  4448. source: unescape('scanFrom%3A%20aStream%0A%09%7C%20nextChunk%20%7C%0A%09nextChunk%20%3A%3D%20%28chunkParser%20emptyChunk%20/%20chunkParser%20chunk%29%20parse%3A%20aStream.%0A%09nextChunk%20isEmptyChunk%20ifFalse%3A%20%5B%0A%09%20%20%20%20self%20setComment%3A%20nextChunk%20contents%5D.%0A')}),
  4449. smalltalk.ClassCommentReader);
  4450. smalltalk.addMethod(
  4451. '_initialize',
  4452. smalltalk.method({
  4453. selector: 'initialize',
  4454. category: 'initialization',
  4455. fn: function () {
  4456. var self = this;
  4457. self.klass.superclass.fn.prototype._initialize.apply(self, []);
  4458. self['@chunkParser'] = smalltalk.ChunkParser._new();
  4459. return self;
  4460. },
  4461. source: unescape('initialize%0A%09super%20initialize.%0A%09chunkParser%20%3A%3D%20ChunkParser%20new.%0A')}),
  4462. smalltalk.ClassCommentReader);
  4463. smalltalk.addMethod(
  4464. '_setComment_',
  4465. smalltalk.method({
  4466. selector: 'setComment:',
  4467. category: 'private',
  4468. fn: function (aString) {
  4469. var self = this;
  4470. self['@class']._comment_(aString);
  4471. return self;
  4472. },
  4473. source: unescape('setComment%3A%20aString%0A%20%20%20%20class%20comment%3A%20aString%0A')}),
  4474. smalltalk.ClassCommentReader);
  4475. smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel');
  4476. smalltalk.addMethod(
  4477. '_next',
  4478. smalltalk.method({
  4479. selector: 'next',
  4480. category: 'accessing',
  4481. fn: function (){
  4482. var self=this;
  4483. return Math.random();
  4484. return self;},
  4485. source: unescape('next%0A%09%7B%27return%20Math.random%28%29%27%7D%0A')}),
  4486. smalltalk.Random);
  4487. smalltalk.addMethod(
  4488. '_next_',
  4489. smalltalk.method({
  4490. selector: 'next:',
  4491. category: 'accessing',
  4492. fn: function (anInteger) {
  4493. var self = this;
  4494. return (1)._to_collect_(anInteger, function (each) {return self._next();});
  4495. return self;
  4496. },
  4497. source: unescape('next%3A%20anInteger%0A%20%20%20%20%5E1%20to%3A%20anInteger%20collect%3A%20%5B%3Aeach%20%7C%20self%20next%5D%0A')}),
  4498. smalltalk.Random);
  4499. smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel');
  4500. smalltalk.addMethod(
  4501. '_x',
  4502. smalltalk.method({
  4503. selector: 'x',
  4504. category: 'accessing',
  4505. fn: function () {
  4506. var self = this;
  4507. return self['@x'];
  4508. return self;
  4509. },
  4510. source: unescape('x%0A%09%5Ex')}),
  4511. smalltalk.Point);
  4512. smalltalk.addMethod(
  4513. '_y',
  4514. smalltalk.method({
  4515. selector: 'y',
  4516. category: 'accessing',
  4517. fn: function () {
  4518. var self = this;
  4519. return self['@y'];
  4520. return self;
  4521. },
  4522. source: unescape('y%0A%09%5Ey')}),
  4523. smalltalk.Point);
  4524. smalltalk.addMethod(
  4525. '_y_',
  4526. smalltalk.method({
  4527. selector: 'y:',
  4528. category: 'accessing',
  4529. fn: function (aNumber) {
  4530. var self = this;
  4531. self['@y'] = aNumber;
  4532. return self;
  4533. },
  4534. source: unescape('y%3A%20aNumber%0A%09y%20%3A%3D%20aNumber')}),
  4535. smalltalk.Point);
  4536. smalltalk.addMethod(
  4537. '_x_',
  4538. smalltalk.method({
  4539. selector: 'x:',
  4540. category: 'accessing',
  4541. fn: function (aNumber) {
  4542. var self = this;
  4543. self['@x'] = aNumber;
  4544. return self;
  4545. },
  4546. source: unescape('x%3A%20aNumber%0A%09x%20%3A%3D%20aNumber')}),
  4547. smalltalk.Point);
  4548. smalltalk.addMethod(
  4549. '__star',
  4550. smalltalk.method({
  4551. selector: '*',
  4552. category: 'arithmetic',
  4553. fn: function (aPoint) {
  4554. var self = this;
  4555. return smalltalk.Point._x_y_(self._x().__star(aPoint._asPoint()._x()), self._y().__star(aPoint._asPoint()._y()));
  4556. return self;
  4557. },
  4558. source: unescape('*%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20*%20aPoint%20asPoint%20x%20y%3A%20self%20y%20*%20aPoint%20asPoint%20y')}),
  4559. smalltalk.Point);
  4560. smalltalk.addMethod(
  4561. '__plus',
  4562. smalltalk.method({
  4563. selector: '+',
  4564. category: 'arithmetic',
  4565. fn: function (aPoint) {
  4566. var self = this;
  4567. return smalltalk.Point._x_y_(self._x().__plus(aPoint._asPoint()._x()), self._y().__plus(aPoint._asPoint()._y()));
  4568. return self;
  4569. },
  4570. source: unescape('+%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20+%20aPoint%20asPoint%20x%20y%3A%20self%20y%20+%20aPoint%20asPoint%20y')}),
  4571. smalltalk.Point);
  4572. smalltalk.addMethod(
  4573. '__minus',
  4574. smalltalk.method({
  4575. selector: '-',
  4576. category: 'arithmetic',
  4577. fn: function (aPoint) {
  4578. var self = this;
  4579. return smalltalk.Point._x_y_(self._x().__minus(aPoint._asPoint()._x()), self._y().__minus(aPoint._asPoint()._y()));
  4580. return self;
  4581. },
  4582. source: unescape('-%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20-%20aPoint%20asPoint%20x%20y%3A%20self%20y%20-%20aPoint%20asPoint%20y')}),
  4583. smalltalk.Point);
  4584. smalltalk.addMethod(
  4585. '__slash',
  4586. smalltalk.method({
  4587. selector: '/',
  4588. category: 'arithmetic',
  4589. fn: function (aPoint) {
  4590. var self = this;
  4591. return smalltalk.Point._x_y_(self._x().__slash(aPoint._asPoint()._x()), self._y().__slash(aPoint._asPoint()._y()));
  4592. return self;
  4593. },
  4594. source: unescape('/%20aPoint%0A%09%5EPoint%20x%3A%20self%20x%20/%20aPoint%20asPoint%20x%20y%3A%20self%20y%20/%20aPoint%20asPoint%20y')}),
  4595. smalltalk.Point);
  4596. smalltalk.addMethod(
  4597. '_asPoint',
  4598. smalltalk.method({
  4599. selector: 'asPoint',
  4600. category: 'converting',
  4601. fn: function () {
  4602. var self = this;
  4603. return self;
  4604. return self;
  4605. },
  4606. source: unescape('asPoint%0A%09%5Eself')}),
  4607. smalltalk.Point);
  4608. smalltalk.addMethod(
  4609. '_x_y_',
  4610. smalltalk.method({
  4611. selector: 'x:y:',
  4612. category: 'instance creation',
  4613. fn: function (aNumber, anotherNumber) {
  4614. var self = this;
  4615. return function ($rec) {$rec._x_(aNumber);$rec._y_(anotherNumber);return $rec._yourself();}(self._new());
  4616. return self;
  4617. },
  4618. source: unescape('x%3A%20aNumber%20y%3A%20anotherNumber%0A%09%5Eself%20new%0A%09%09x%3A%20aNumber%3B%0A%09%09y%3A%20anotherNumber%3B%0A%09%09yourself')}),
  4619. smalltalk.Point.klass);