Kernel-Collections.js 139 KB

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