mdbe 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/app.rb +182 -0
- data/bin/mdbe +5 -0
- data/config.ru +2 -0
- data/environment.rb +8 -0
- data/lib/mdbe.rb +39 -0
- data/lib/mdbe/action_controller_debug_patch.rb +12 -0
- data/lib/mdbe/code_evaluation.rb +46 -0
- data/lib/mdbe/database_views.rb +24 -0
- data/lib/mdbe/database_views/abstract_dictionary.rb +69 -0
- data/lib/mdbe/database_views/abstract_exception.rb +25 -0
- data/lib/mdbe/database_views/array.rb +28 -0
- data/lib/mdbe/database_views/boolean.rb +12 -0
- data/lib/mdbe/database_views/class.rb +46 -0
- data/lib/mdbe/database_views/exception.rb +3 -0
- data/lib/mdbe/database_views/execblock.rb +5 -0
- data/lib/mdbe/database_views/fixnum.rb +5 -0
- data/lib/mdbe/database_views/float.rb +5 -0
- data/lib/mdbe/database_views/globals.rb +2 -0
- data/lib/mdbe/database_views/gsnmethod.rb +29 -0
- data/lib/mdbe/database_views/hash.rb +5 -0
- data/lib/mdbe/database_views/maglev_record.rb +42 -0
- data/lib/mdbe/database_views/module.rb +103 -0
- data/lib/mdbe/database_views/nilclass.rb +5 -0
- data/lib/mdbe/database_views/object.rb +80 -0
- data/lib/mdbe/database_views/proc.rb +3 -0
- data/lib/mdbe/database_views/repository.rb +3 -0
- data/lib/mdbe/database_views/ruby_workspace.rb +5 -0
- data/lib/mdbe/database_views/smalltalk_classes.rb +34 -0
- data/lib/mdbe/database_views/smalltalk_classes.st +60 -0
- data/lib/mdbe/database_views/string.rb +31 -0
- data/lib/mdbe/database_views/symbol.rb +32 -0
- data/lib/mdbe/database_views/system.rb +61 -0
- data/lib/mdbe/database_views/thread.rb +101 -0
- data/lib/mdbe/debug_server.rb +22 -0
- data/lib/mdbe/halt.rb +42 -0
- data/lib/mdbe/ruby_workspace.rb +29 -0
- data/lib/mdbe/version.rb +3 -0
- data/lib/tasks/maglev-database-explorer_tasks.rake +4 -0
- data/public/LICENSE +35 -0
- data/public/amber/CHANGELOG +65 -0
- data/public/amber/LICENSE +22 -0
- data/public/amber/Makefile +53 -0
- data/public/amber/README.md +30 -0
- data/public/amber/bin/amber +3 -0
- data/public/amber/bin/amberc +352 -0
- data/public/amber/bin/nodecompile.js +33 -0
- data/public/amber/bin/server +3 -0
- data/public/amber/bin/server.bat +3 -0
- data/public/amber/css/amber-normalize.css +468 -0
- data/public/amber/css/amber-normalize.less +501 -0
- data/public/amber/css/amber.css +539 -0
- data/public/amber/css/documentation.css +84 -0
- data/public/amber/css/profstef.css +75 -0
- data/public/amber/css/style.css +313 -0
- data/public/amber/documentation.html +37 -0
- data/public/amber/examples/Makefile +23 -0
- data/public/amber/examples/README +4 -0
- data/public/amber/examples/android/helloamber/AndroidManifest.xml +19 -0
- data/public/amber/examples/android/helloamber/HelloAmber.st +13 -0
- data/public/amber/examples/android/helloamber/Makefile +56 -0
- data/public/amber/examples/android/helloamber/README.md +80 -0
- data/public/amber/examples/android/helloamber/ant.properties +17 -0
- data/public/amber/examples/android/helloamber/assets/index.html +15 -0
- data/public/amber/examples/android/helloamber/assets/jquery-1.7.2.min.js +4 -0
- data/public/amber/examples/android/helloamber/build.xml +83 -0
- data/public/amber/examples/android/helloamber/local.properties +10 -0
- data/public/amber/examples/android/helloamber/proguard-project.txt +20 -0
- data/public/amber/examples/android/helloamber/project.properties +14 -0
- data/public/amber/examples/android/helloamber/res/layout/main.xml +6 -0
- data/public/amber/examples/android/helloamber/res/values/strings.xml +4 -0
- data/public/amber/examples/android/helloamber/src/org/amberlang/android/helloamber/HelloAmber.java +59 -0
- data/public/amber/examples/myproject/index.html +16 -0
- data/public/amber/examples/nodejs/README +9 -0
- data/public/amber/examples/nodejs/benchfib/Benchfib.st +124 -0
- data/public/amber/examples/nodejs/benchfib/Makefile +8 -0
- data/public/amber/examples/nodejs/benchfib/benchfib +1 -0
- data/public/amber/examples/nodejs/hello/Hello.st +9 -0
- data/public/amber/examples/nodejs/hello/Makefile +8 -0
- data/public/amber/examples/nodejs/hello/README +13 -0
- data/public/amber/examples/nodejs/hello/hello +1 -0
- data/public/amber/examples/nodejs/meta/Makefile +8 -0
- data/public/amber/examples/nodejs/meta/MyScript.st +27 -0
- data/public/amber/examples/nodejs/meta/meta +1 -0
- data/public/amber/examples/nodejs/pystone/Makefile +8 -0
- data/public/amber/examples/nodejs/pystone/Pystone.st +306 -0
- data/public/amber/examples/nodejs/pystone/pystone +1 -0
- data/public/amber/examples/nodejs/trivialserver/Makefile +8 -0
- data/public/amber/examples/nodejs/trivialserver/TrivialServer.st +51 -0
- data/public/amber/examples/nodejs/trivialserver/trivial +1 -0
- data/public/amber/examples/presentation/esug2011/images/asterix.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_box.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/devices.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/enyo.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/ide_star_wars.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/terminal.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/webos.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/amber.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/ambrhino.jpg +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/pharo.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/php.gif +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/rails.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-next.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-prev.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/closedhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/openhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-back.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-forward.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.css +100 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.js +1232 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.min.js +13 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.easing.1.3.js +38 -0
- data/public/amber/examples/presentation/index.html +17 -0
- data/public/amber/examples/presentation/js/Presentation.deploy.js +1922 -0
- data/public/amber/examples/presentation/js/Presentation.js +2712 -0
- data/public/amber/examples/presentation/st/Presentation.st +1996 -0
- data/public/amber/examples/trysmalltalk/index.html +18 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.deploy.js +837 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.js +1206 -0
- data/public/amber/examples/trysmalltalk/st/TrySmalltalk.st +964 -0
- data/public/amber/examples/twitterwall/css/twitterwall.css +19 -0
- data/public/amber/examples/twitterwall/index.html +35 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.deploy.js +116 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.js +146 -0
- data/public/amber/examples/twitterwall/st/TwitterWall.st +91 -0
- data/public/amber/examples/webos/README +11 -0
- data/public/amber/examples/webos/eris/DuckQwaq.wav +0 -0
- data/public/amber/examples/webos/eris/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/eris/Eris.css +0 -0
- data/public/amber/examples/webos/eris/Eris.st +86 -0
- data/public/amber/examples/webos/eris/Makefile +37 -0
- data/public/amber/examples/webos/eris/README +3 -0
- data/public/amber/examples/webos/eris/appinfo.json +10 -0
- data/public/amber/examples/webos/eris/index.html +12 -0
- data/public/amber/examples/webos/helloamber/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/helloamber/HelloAmber.st +86 -0
- data/public/amber/examples/webos/helloamber/Makefile +38 -0
- data/public/amber/examples/webos/helloamber/README +5 -0
- data/public/amber/examples/webos/helloamber/appinfo.json +10 -0
- data/public/amber/examples/webos/helloamber/index.html +12 -0
- data/public/amber/favicon.ico +0 -0
- data/public/amber/images/amber.png +0 -0
- data/public/amber/images/amber.svg +706 -0
- data/public/amber/images/amber_small.png +0 -0
- data/public/amber/images/off.amber.png +0 -0
- data/public/amber/images/off.png +0 -0
- data/public/amber/images/offHover.amber.png +0 -0
- data/public/amber/images/offHover.png +0 -0
- data/public/amber/images/presentation.png +0 -0
- data/public/amber/images/profstef.png +0 -0
- data/public/amber/images/sprite.amber.png +0 -0
- data/public/amber/images/sprite.png +0 -0
- data/public/amber/images/tinylogo.amber.png +0 -0
- data/public/amber/images/tinylogo.png +0 -0
- data/public/amber/images/twitterwall.png +0 -0
- data/public/amber/index.html +55 -0
- data/public/amber/js/Additional-Examples.deploy.js +15 -0
- data/public/amber/js/Additional-Examples.js +21 -0
- data/public/amber/js/Benchfib.deploy.js +132 -0
- data/public/amber/js/Benchfib.js +167 -0
- data/public/amber/js/Canvas.deploy.js +2446 -0
- data/public/amber/js/Canvas.js +3547 -0
- data/public/amber/js/Compiler-Tests.deploy.js +97 -0
- data/public/amber/js/Compiler-Tests.js +137 -0
- data/public/amber/js/Compiler.deploy.js +1877 -0
- data/public/amber/js/Compiler.js +2622 -0
- data/public/amber/js/Documentation.deploy.js +961 -0
- data/public/amber/js/Documentation.js +1376 -0
- data/public/amber/js/Examples.deploy.js +53 -0
- data/public/amber/js/Examples.js +73 -0
- data/public/amber/js/IDE.deploy.js +3557 -0
- data/public/amber/js/IDE.js +5002 -0
- data/public/amber/js/Kernel-Announcements.deploy.js +107 -0
- data/public/amber/js/Kernel-Announcements.js +152 -0
- data/public/amber/js/Kernel-Classes.deploy.js +774 -0
- data/public/amber/js/Kernel-Classes.js +1095 -0
- data/public/amber/js/Kernel-Collections.deploy.js +3121 -0
- data/public/amber/js/Kernel-Collections.js +4427 -0
- data/public/amber/js/Kernel-Exceptions.deploy.js +244 -0
- data/public/amber/js/Kernel-Exceptions.js +349 -0
- data/public/amber/js/Kernel-Methods.deploy.js +573 -0
- data/public/amber/js/Kernel-Methods.js +807 -0
- data/public/amber/js/Kernel-Objects.deploy.js +2877 -0
- data/public/amber/js/Kernel-Objects.js +4107 -0
- data/public/amber/js/Kernel-Tests.deploy.js +1513 -0
- data/public/amber/js/Kernel-Tests.js +2053 -0
- data/public/amber/js/Kernel-Transcript.deploy.js +142 -0
- data/public/amber/js/Kernel-Transcript.js +202 -0
- data/public/amber/js/Maglev-Core.deploy.js +2996 -0
- data/public/amber/js/Maglev-Core.js +4246 -0
- data/public/amber/js/Maglev-Database-Explorer.deploy.js +4476 -0
- data/public/amber/js/Maglev-Database-Explorer.js +6232 -0
- data/public/amber/js/Maglev-Vendor.deploy.js +350 -0
- data/public/amber/js/Maglev-Vendor.js +465 -0
- data/public/amber/js/README.md +5 -0
- data/public/amber/js/SUnit.deploy.js +351 -0
- data/public/amber/js/SUnit.js +501 -0
- data/public/amber/js/amber.js +273 -0
- data/public/amber/js/boot.js +602 -0
- data/public/amber/js/compat.js +22 -0
- data/public/amber/js/init.js +9 -0
- data/public/amber/js/lib/CodeMirror/LICENSE +19 -0
- data/public/amber/js/lib/CodeMirror/active-line.js +39 -0
- data/public/amber/js/lib/CodeMirror/amber.css +21 -0
- data/public/amber/js/lib/CodeMirror/codemirror.css +67 -0
- data/public/amber/js/lib/CodeMirror/codemirror.js +2144 -0
- data/public/amber/js/lib/CodeMirror/smalltalk.js +134 -0
- data/public/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
- data/public/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
- data/public/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
- data/public/amber/js/lib/jQuery/jquery.textarea.js +267 -0
- data/public/amber/js/lib/peg-0.6.2.min.js +2 -0
- data/public/amber/js/lib/showdown.js +419 -0
- data/public/amber/js/parser.js +4222 -0
- data/public/amber/js/parser.pegjs +223 -0
- data/public/amber/learn.html +40 -0
- data/public/amber/repl/Makefile +8 -0
- data/public/amber/repl/REPL.js +124 -0
- data/public/amber/repl/REPL.st +56 -0
- data/public/amber/repl/amber.js +18085 -0
- data/public/amber/server/FileServer.st +576 -0
- data/public/amber/server/Makefile +8 -0
- data/public/amber/server/server.js +13049 -0
- data/public/amber/st/Benchfib.js +297 -0
- data/public/amber/st/Benchfib.st +124 -0
- data/public/amber/st/Canvas.st +968 -0
- data/public/amber/st/Compiler-Tests.st +471 -0
- data/public/amber/st/Compiler.st +1445 -0
- data/public/amber/st/Documentation.st +758 -0
- data/public/amber/st/Examples.js +100 -0
- data/public/amber/st/Examples.st +38 -0
- data/public/amber/st/IDE.st +2404 -0
- data/public/amber/st/Kernel-Announcements.st +61 -0
- data/public/amber/st/Kernel-Classes.st +462 -0
- data/public/amber/st/Kernel-Collections.st +1611 -0
- data/public/amber/st/Kernel-Exceptions.st +124 -0
- data/public/amber/st/Kernel-Methods.st +291 -0
- data/public/amber/st/Kernel-Objects.st +1587 -0
- data/public/amber/st/Kernel-Tests.st +953 -0
- data/public/amber/st/Kernel-Transcript.st +70 -0
- data/public/amber/st/Maglev-Core.st +1694 -0
- data/public/amber/st/Maglev-Database-Explorer.st +3148 -0
- data/public/amber/st/Maglev-Vendor.st +151 -0
- data/public/amber/st/Makefile +104 -0
- data/public/amber/st/README.md +4 -0
- data/public/amber/st/SUnit.st +172 -0
- data/public/css/bootstrap-combined.no-icons.min.css +731 -0
- data/public/css/bootstrap.css +6811 -0
- data/public/css/images/animated-overlay.gif +0 -0
- data/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/public/css/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/css/jquery-ui.min.css +5 -0
- data/public/css/smalltalk_code.css +42 -0
- data/public/css/style.css +210 -0
- data/public/images/bg_tile.png +0 -0
- data/public/images/maglev-logo.gif +0 -0
- data/public/images/mchammer.gif +0 -0
- data/public/images/rails_tiny.png +0 -0
- data/public/images/ruby.png +0 -0
- data/public/images/ruby_smalltalk_bridge.png +0 -0
- data/public/images/smalltalk.png +0 -0
- data/public/img/glyphicons-halflings.png +0 -0
- data/public/index.html +118 -0
- data/public/libs/bootstrap.min.js +7 -0
- data/public/libs/codemirror/CONTRIBUTING.md +72 -0
- data/public/libs/codemirror/LICENSE +23 -0
- data/public/libs/codemirror/README.md +11 -0
- data/public/libs/codemirror/addon/dialog/dialog.css +32 -0
- data/public/libs/codemirror/addon/dialog/dialog.js +80 -0
- data/public/libs/codemirror/addon/display/placeholder.js +54 -0
- data/public/libs/codemirror/addon/edit/closebrackets.js +54 -0
- data/public/libs/codemirror/addon/edit/closetag.js +86 -0
- data/public/libs/codemirror/addon/edit/continuecomment.js +44 -0
- data/public/libs/codemirror/addon/edit/continuelist.js +25 -0
- data/public/libs/codemirror/addon/edit/matchbrackets.js +82 -0
- data/public/libs/codemirror/addon/fold/brace-fold.js +31 -0
- data/public/libs/codemirror/addon/fold/foldcode.js +32 -0
- data/public/libs/codemirror/addon/fold/indent-fold.js +11 -0
- data/public/libs/codemirror/addon/fold/xml-fold.js +64 -0
- data/public/libs/codemirror/addon/hint/html-hint.js +582 -0
- data/public/libs/codemirror/addon/hint/javascript-hint.js +142 -0
- data/public/libs/codemirror/addon/hint/pig-hint.js +117 -0
- data/public/libs/codemirror/addon/hint/python-hint.js +93 -0
- data/public/libs/codemirror/addon/hint/show-hint.css +38 -0
- data/public/libs/codemirror/addon/hint/show-hint.js +180 -0
- data/public/libs/codemirror/addon/hint/xml-hint.js +118 -0
- data/public/libs/codemirror/addon/lint/javascript-lint.js +127 -0
- data/public/libs/codemirror/addon/lint/json-lint.js +14 -0
- data/public/libs/codemirror/addon/lint/lint.css +96 -0
- data/public/libs/codemirror/addon/lint/lint.js +197 -0
- data/public/libs/codemirror/addon/mode/loadmode.js +51 -0
- data/public/libs/codemirror/addon/mode/multiplex.js +95 -0
- data/public/libs/codemirror/addon/mode/overlay.js +59 -0
- data/public/libs/codemirror/addon/runmode/colorize.js +29 -0
- data/public/libs/codemirror/addon/runmode/runmode-standalone.js +130 -0
- data/public/libs/codemirror/addon/runmode/runmode.js +52 -0
- data/public/libs/codemirror/addon/runmode/runmode.node.js +89 -0
- data/public/libs/codemirror/addon/search/match-highlighter.js +60 -0
- data/public/libs/codemirror/addon/search/search.js +131 -0
- data/public/libs/codemirror/addon/search/searchcursor.js +133 -0
- data/public/libs/codemirror/addon/selection/active-line.js +39 -0
- data/public/libs/codemirror/addon/selection/mark-selection.js +34 -0
- data/public/libs/codemirror/bin/compress +91 -0
- data/public/libs/codemirror/bin/lint +11 -0
- data/public/libs/codemirror/demo/activeline.html +70 -0
- data/public/libs/codemirror/demo/bidi.html +61 -0
- data/public/libs/codemirror/demo/btree.html +87 -0
- data/public/libs/codemirror/demo/buffers.html +98 -0
- data/public/libs/codemirror/demo/changemode.html +50 -0
- data/public/libs/codemirror/demo/closebrackets.html +63 -0
- data/public/libs/codemirror/demo/closetag.html +37 -0
- data/public/libs/codemirror/demo/complete.html +70 -0
- data/public/libs/codemirror/demo/emacs.html +60 -0
- data/public/libs/codemirror/demo/folding.html +69 -0
- data/public/libs/codemirror/demo/fullscreen.html +147 -0
- data/public/libs/codemirror/demo/html5complete.html +92 -0
- data/public/libs/codemirror/demo/indentwrap.html +49 -0
- data/public/libs/codemirror/demo/lint.html +90 -0
- data/public/libs/codemirror/demo/loadmode.html +40 -0
- data/public/libs/codemirror/demo/marker.html +59 -0
- data/public/libs/codemirror/demo/markselection.html +36 -0
- data/public/libs/codemirror/demo/matchhighlighter.html +38 -0
- data/public/libs/codemirror/demo/multiplex.html +60 -0
- data/public/libs/codemirror/demo/mustache.html +59 -0
- data/public/libs/codemirror/demo/placeholder.html +36 -0
- data/public/libs/codemirror/demo/preview.html +76 -0
- data/public/libs/codemirror/demo/resize.html +49 -0
- data/public/libs/codemirror/demo/runmode.html +50 -0
- data/public/libs/codemirror/demo/search.html +85 -0
- data/public/libs/codemirror/demo/spanaffectswrapping_shim.html +73 -0
- data/public/libs/codemirror/demo/theme.html +89 -0
- data/public/libs/codemirror/demo/variableheight.html +52 -0
- data/public/libs/codemirror/demo/vim.html +65 -0
- data/public/libs/codemirror/demo/visibletabs.html +53 -0
- data/public/libs/codemirror/demo/widget.html +74 -0
- data/public/libs/codemirror/demo/xmlcomplete.html +81 -0
- data/public/libs/codemirror/index.html +487 -0
- data/public/libs/codemirror/keymap/emacs.js +30 -0
- data/public/libs/codemirror/keymap/vim.js +3044 -0
- data/public/libs/codemirror/lib/codemirror.css +253 -0
- data/public/libs/codemirror/lib/codemirror.js +5585 -0
- data/public/libs/codemirror/mode/apl/apl.js +160 -0
- data/public/libs/codemirror/mode/apl/index.html +61 -0
- data/public/libs/codemirror/mode/asterisk/asterisk.js +183 -0
- data/public/libs/codemirror/mode/asterisk/index.html +142 -0
- data/public/libs/codemirror/mode/clike/clike.js +302 -0
- data/public/libs/codemirror/mode/clike/index.html +103 -0
- data/public/libs/codemirror/mode/clike/scala.html +767 -0
- data/public/libs/codemirror/mode/clojure/clojure.js +222 -0
- data/public/libs/codemirror/mode/clojure/index.html +76 -0
- data/public/libs/codemirror/mode/coffeescript/LICENSE +22 -0
- data/public/libs/codemirror/mode/coffeescript/coffeescript.js +346 -0
- data/public/libs/codemirror/mode/coffeescript/index.html +728 -0
- data/public/libs/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/public/libs/codemirror/mode/commonlisp/index.html +165 -0
- data/public/libs/codemirror/mode/css/css.js +567 -0
- data/public/libs/codemirror/mode/css/index.html +58 -0
- data/public/libs/codemirror/mode/css/scss.html +145 -0
- data/public/libs/codemirror/mode/css/scss_test.js +80 -0
- data/public/libs/codemirror/mode/css/test.js +113 -0
- data/public/libs/codemirror/mode/d/d.js +205 -0
- data/public/libs/codemirror/mode/d/index.html +262 -0
- data/public/libs/codemirror/mode/diff/diff.js +32 -0
- data/public/libs/codemirror/mode/diff/index.html +105 -0
- data/public/libs/codemirror/mode/ecl/ecl.js +192 -0
- data/public/libs/codemirror/mode/ecl/index.html +39 -0
- data/public/libs/codemirror/mode/erlang/erlang.js +463 -0
- data/public/libs/codemirror/mode/erlang/index.html +64 -0
- data/public/libs/codemirror/mode/gas/gas.js +326 -0
- data/public/libs/codemirror/mode/gas/index.html +57 -0
- data/public/libs/codemirror/mode/gfm/gfm.js +96 -0
- data/public/libs/codemirror/mode/gfm/index.html +74 -0
- data/public/libs/codemirror/mode/gfm/test.js +112 -0
- data/public/libs/codemirror/mode/go/go.js +165 -0
- data/public/libs/codemirror/mode/go/index.html +74 -0
- data/public/libs/codemirror/mode/groovy/groovy.js +210 -0
- data/public/libs/codemirror/mode/groovy/index.html +73 -0
- data/public/libs/codemirror/mode/haskell/haskell.js +242 -0
- data/public/libs/codemirror/mode/haskell/index.html +62 -0
- data/public/libs/codemirror/mode/haxe/haxe.js +429 -0
- data/public/libs/codemirror/mode/haxe/index.html +90 -0
- data/public/libs/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/public/libs/codemirror/mode/htmlembedded/index.html +49 -0
- data/public/libs/codemirror/mode/htmlmixed/htmlmixed.js +104 -0
- data/public/libs/codemirror/mode/htmlmixed/index.html +73 -0
- data/public/libs/codemirror/mode/http/http.js +98 -0
- data/public/libs/codemirror/mode/http/index.html +32 -0
- data/public/libs/codemirror/mode/javascript/index.html +92 -0
- data/public/libs/codemirror/mode/javascript/javascript.js +467 -0
- data/public/libs/codemirror/mode/javascript/typescript.html +48 -0
- data/public/libs/codemirror/mode/jinja2/index.html +38 -0
- data/public/libs/codemirror/mode/jinja2/jinja2.js +42 -0
- data/public/libs/codemirror/mode/less/index.html +741 -0
- data/public/libs/codemirror/mode/less/less.js +266 -0
- data/public/libs/codemirror/mode/livescript/LICENSE +23 -0
- data/public/libs/codemirror/mode/livescript/index.html +446 -0
- data/public/libs/codemirror/mode/livescript/livescript.js +267 -0
- data/public/libs/codemirror/mode/livescript/livescript.ls +266 -0
- data/public/libs/codemirror/mode/lua/index.html +74 -0
- data/public/libs/codemirror/mode/lua/lua.js +140 -0
- data/public/libs/codemirror/mode/markdown/index.html +344 -0
- data/public/libs/codemirror/mode/markdown/markdown.js +526 -0
- data/public/libs/codemirror/mode/markdown/test.js +636 -0
- data/public/libs/codemirror/mode/meta.js +75 -0
- data/public/libs/codemirror/mode/mirc/index.html +149 -0
- data/public/libs/codemirror/mode/mirc/mirc.js +177 -0
- data/public/libs/codemirror/mode/ntriples/index.html +33 -0
- data/public/libs/codemirror/mode/ntriples/ntriples.js +170 -0
- data/public/libs/codemirror/mode/ocaml/index.html +131 -0
- data/public/libs/codemirror/mode/ocaml/ocaml.js +113 -0
- data/public/libs/codemirror/mode/pascal/LICENSE +7 -0
- data/public/libs/codemirror/mode/pascal/index.html +48 -0
- data/public/libs/codemirror/mode/pascal/pascal.js +94 -0
- data/public/libs/codemirror/mode/perl/LICENSE +19 -0
- data/public/libs/codemirror/mode/perl/index.html +62 -0
- data/public/libs/codemirror/mode/perl/perl.js +816 -0
- data/public/libs/codemirror/mode/php/index.html +51 -0
- data/public/libs/codemirror/mode/php/php.js +129 -0
- data/public/libs/codemirror/mode/pig/index.html +42 -0
- data/public/libs/codemirror/mode/pig/pig.js +171 -0
- data/public/libs/codemirror/mode/properties/index.html +41 -0
- data/public/libs/codemirror/mode/properties/properties.js +63 -0
- data/public/libs/codemirror/mode/python/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/python/index.html +135 -0
- data/public/libs/codemirror/mode/python/python.js +340 -0
- data/public/libs/codemirror/mode/q/index.html +131 -0
- data/public/libs/codemirror/mode/q/q.js +124 -0
- data/public/libs/codemirror/mode/r/LICENSE +24 -0
- data/public/libs/codemirror/mode/r/index.html +74 -0
- data/public/libs/codemirror/mode/r/r.js +141 -0
- data/public/libs/codemirror/mode/rpm/changes/changes.js +19 -0
- data/public/libs/codemirror/mode/rpm/changes/index.html +53 -0
- data/public/libs/codemirror/mode/rpm/spec/index.html +99 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.css +5 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.js +66 -0
- data/public/libs/codemirror/mode/rst/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/rst/index.html +524 -0
- data/public/libs/codemirror/mode/rst/rst.js +550 -0
- data/public/libs/codemirror/mode/ruby/LICENSE +24 -0
- data/public/libs/codemirror/mode/ruby/index.html +173 -0
- data/public/libs/codemirror/mode/ruby/ruby.js +197 -0
- data/public/libs/codemirror/mode/rust/index.html +48 -0
- data/public/libs/codemirror/mode/rust/rust.js +432 -0
- data/public/libs/codemirror/mode/sass/index.html +54 -0
- data/public/libs/codemirror/mode/sass/sass.js +349 -0
- data/public/libs/codemirror/mode/scheme/index.html +65 -0
- data/public/libs/codemirror/mode/scheme/scheme.js +230 -0
- data/public/libs/codemirror/mode/shell/index.html +51 -0
- data/public/libs/codemirror/mode/shell/shell.js +118 -0
- data/public/libs/codemirror/mode/sieve/LICENSE +19 -0
- data/public/libs/codemirror/mode/sieve/index.html +81 -0
- data/public/libs/codemirror/mode/sieve/sieve.js +183 -0
- data/public/libs/codemirror/mode/smalltalk/index.html +57 -0
- data/public/libs/codemirror/mode/smalltalk/smalltalk.js +141 -0
- data/public/libs/codemirror/mode/smarty/index.html +83 -0
- data/public/libs/codemirror/mode/smarty/smarty.js +148 -0
- data/public/libs/codemirror/mode/sparql/index.html +42 -0
- data/public/libs/codemirror/mode/sparql/sparql.js +143 -0
- data/public/libs/codemirror/mode/sql/index.html +68 -0
- data/public/libs/codemirror/mode/sql/sql.js +268 -0
- data/public/libs/codemirror/mode/stex/index.html +98 -0
- data/public/libs/codemirror/mode/stex/stex.js +246 -0
- data/public/libs/codemirror/mode/stex/test.js +117 -0
- data/public/libs/codemirror/mode/tcl/index.html +129 -0
- data/public/libs/codemirror/mode/tcl/tcl.js +131 -0
- data/public/libs/codemirror/mode/tiddlywiki/index.html +142 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/public/libs/codemirror/mode/tiki/index.html +81 -0
- data/public/libs/codemirror/mode/tiki/tiki.css +26 -0
- data/public/libs/codemirror/mode/tiki/tiki.js +308 -0
- data/public/libs/codemirror/mode/turtle/index.html +39 -0
- data/public/libs/codemirror/mode/turtle/turtle.js +145 -0
- data/public/libs/codemirror/mode/vb/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/vb/index.html +88 -0
- data/public/libs/codemirror/mode/vb/vb.js +259 -0
- data/public/libs/codemirror/mode/vbscript/index.html +42 -0
- data/public/libs/codemirror/mode/vbscript/vbscript.js +26 -0
- data/public/libs/codemirror/mode/velocity/index.html +103 -0
- data/public/libs/codemirror/mode/velocity/velocity.js +144 -0
- data/public/libs/codemirror/mode/verilog/index.html +121 -0
- data/public/libs/codemirror/mode/verilog/verilog.js +182 -0
- data/public/libs/codemirror/mode/xml/index.html +45 -0
- data/public/libs/codemirror/mode/xml/xml.js +328 -0
- data/public/libs/codemirror/mode/xquery/LICENSE +20 -0
- data/public/libs/codemirror/mode/xquery/index.html +221 -0
- data/public/libs/codemirror/mode/xquery/test.js +64 -0
- data/public/libs/codemirror/mode/xquery/xquery.js +450 -0
- data/public/libs/codemirror/mode/yaml/index.html +68 -0
- data/public/libs/codemirror/mode/yaml/yaml.js +95 -0
- data/public/libs/codemirror/mode/z80/index.html +39 -0
- data/public/libs/codemirror/mode/z80/z80.js +85 -0
- data/public/libs/codemirror/package.json +21 -0
- data/public/libs/codemirror/test/doc_test.js +329 -0
- data/public/libs/codemirror/test/driver.js +138 -0
- data/public/libs/codemirror/test/index.html +182 -0
- data/public/libs/codemirror/test/lint/acorn.js +1593 -0
- data/public/libs/codemirror/test/lint/lint.js +112 -0
- data/public/libs/codemirror/test/lint/parse-js.js +1372 -0
- data/public/libs/codemirror/test/lint/walk.js +216 -0
- data/public/libs/codemirror/test/mode_test.css +10 -0
- data/public/libs/codemirror/test/mode_test.js +192 -0
- data/public/libs/codemirror/test/phantom_driver.js +31 -0
- data/public/libs/codemirror/test/run.js +33 -0
- data/public/libs/codemirror/test/test.js +1400 -0
- data/public/libs/codemirror/test/vim_test.js +1688 -0
- data/public/libs/codemirror/theme/ambiance-mobile.css +5 -0
- data/public/libs/codemirror/theme/ambiance.css +75 -0
- data/public/libs/codemirror/theme/blackboard.css +25 -0
- data/public/libs/codemirror/theme/cobalt.css +18 -0
- data/public/libs/codemirror/theme/eclipse.css +25 -0
- data/public/libs/codemirror/theme/elegant.css +10 -0
- data/public/libs/codemirror/theme/erlang-dark.css +21 -0
- data/public/libs/codemirror/theme/lesser-dark.css +44 -0
- data/public/libs/codemirror/theme/midnight.css +52 -0
- data/public/libs/codemirror/theme/monokai.css +28 -0
- data/public/libs/codemirror/theme/neat.css +9 -0
- data/public/libs/codemirror/theme/night.css +21 -0
- data/public/libs/codemirror/theme/rubyblue.css +21 -0
- data/public/libs/codemirror/theme/solarized.css +207 -0
- data/public/libs/codemirror/theme/twilight.css +26 -0
- data/public/libs/codemirror/theme/vibrant-ink.css +27 -0
- data/public/libs/codemirror/theme/xq-dark.css +46 -0
- data/public/libs/codemirror/theme/xq-light.css +43 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.css +983 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.min.css +24 -0
- data/public/libs/font-awesome/css/font-awesome.css +1268 -0
- data/public/libs/font-awesome/css/font-awesome.min.css +24 -0
- data/public/libs/font-awesome/font/FontAwesome.otf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.eot +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.svg +339 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.ttf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.woff +0 -0
- data/public/libs/font-awesome/less/bootstrap.less +78 -0
- data/public/libs/font-awesome/less/core.less +132 -0
- data/public/libs/font-awesome/less/extras.less +79 -0
- data/public/libs/font-awesome/less/font-awesome-ie7.less +413 -0
- data/public/libs/font-awesome/less/font-awesome.less +32 -0
- data/public/libs/font-awesome/less/icons.less +330 -0
- data/public/libs/font-awesome/less/mixins.less +34 -0
- data/public/libs/font-awesome/less/path.less +15 -0
- data/public/libs/font-awesome/less/variables.less +9 -0
- data/public/libs/jquery-1.10.0.min.js +6 -0
- data/public/libs/jquery-ui.min.js +12 -0
- data/public/libs/jquery.jsPlumb-1.4.0-all.js +9571 -0
- data/public/libs/jquery.livequery.js +226 -0
- data/public/libs/jsPlumbInitializer.js +72 -0
- data/public/libs/jstree/README.txt +10 -0
- data/public/libs/jstree/_demo/_dump.sql +20 -0
- data/public/libs/jstree/_demo/_inc/__mysql_errors.log +0 -0
- data/public/libs/jstree/_demo/_inc/class._database.php +146 -0
- data/public/libs/jstree/_demo/_inc/class._database_i.php +152 -0
- data/public/libs/jstree/_demo/_inc/class.tree.php +602 -0
- data/public/libs/jstree/_demo/_install.txt +6 -0
- data/public/libs/jstree/_demo/config.php +14 -0
- data/public/libs/jstree/_demo/file.png +0 -0
- data/public/libs/jstree/_demo/folder.png +0 -0
- data/public/libs/jstree/_demo/index.html +461 -0
- data/public/libs/jstree/_demo/root.png +0 -0
- data/public/libs/jstree/_demo/server.php +69 -0
- data/public/libs/jstree/_docs/!style.css +48 -0
- data/public/libs/jstree/_docs/_drive.png +0 -0
- data/public/libs/jstree/_docs/_html_data.html +2 -0
- data/public/libs/jstree/_docs/_json_data.json +4 -0
- data/public/libs/jstree/_docs/_search_data.json +6 -0
- data/public/libs/jstree/_docs/_search_result.json +1 -0
- data/public/libs/jstree/_docs/_xml_flat.xml +12 -0
- data/public/libs/jstree/_docs/_xml_nest.xml +18 -0
- data/public/libs/jstree/_docs/checkbox.html +171 -0
- data/public/libs/jstree/_docs/contextmenu.html +121 -0
- data/public/libs/jstree/_docs/cookies.html +97 -0
- data/public/libs/jstree/_docs/core.html +689 -0
- data/public/libs/jstree/_docs/crrm.html +316 -0
- data/public/libs/jstree/_docs/dnd.html +199 -0
- data/public/libs/jstree/_docs/hotkeys.html +82 -0
- data/public/libs/jstree/_docs/html_data.html +175 -0
- data/public/libs/jstree/_docs/index.html +86 -0
- data/public/libs/jstree/_docs/json_data.html +249 -0
- data/public/libs/jstree/_docs/languages.html +152 -0
- data/public/libs/jstree/_docs/logo.png +0 -0
- data/public/libs/jstree/_docs/search.html +153 -0
- data/public/libs/jstree/_docs/sort.html +85 -0
- data/public/libs/jstree/_docs/syntax/!script.js +2232 -0
- data/public/libs/jstree/_docs/syntax/!style.css +511 -0
- data/public/libs/jstree/_docs/syntax/clipboard.swf +0 -0
- data/public/libs/jstree/_docs/syntax/help.png +0 -0
- data/public/libs/jstree/_docs/syntax/magnifier.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_code.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_copy.png +0 -0
- data/public/libs/jstree/_docs/syntax/printer.png +0 -0
- data/public/libs/jstree/_docs/syntax/wrapping.png +0 -0
- data/public/libs/jstree/_docs/themeroller.html +107 -0
- data/public/libs/jstree/_docs/themes.html +127 -0
- data/public/libs/jstree/_docs/types.html +178 -0
- data/public/libs/jstree/_docs/ui.html +197 -0
- data/public/libs/jstree/_docs/unique.html +85 -0
- data/public/libs/jstree/_docs/xml_data.html +218 -0
- data/public/libs/jstree/_lib/jquery.cookie.js +96 -0
- data/public/libs/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/libs/jstree/_lib/jquery.js +5 -0
- data/public/libs/jstree/jquery.jstree.js +4564 -0
- data/public/libs/jstree/themes/apple/bg.jpg +0 -0
- data/public/libs/jstree/themes/apple/d.png +0 -0
- data/public/libs/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/apple/style.css +61 -0
- data/public/libs/jstree/themes/apple/throbber.gif +0 -0
- data/public/libs/jstree/themes/classic/d.gif +0 -0
- data/public/libs/jstree/themes/classic/d.png +0 -0
- data/public/libs/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/classic/style.css +77 -0
- data/public/libs/jstree/themes/classic/throbber.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.png +0 -0
- data/public/libs/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/style.css +84 -0
- data/public/libs/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/libs/jstree/themes/default/d.gif +0 -0
- data/public/libs/jstree/themes/default/d.png +0 -0
- data/public/libs/jstree/themes/default/style.css +74 -0
- data/public/libs/jstree/themes/default/throbber.gif +0 -0
- data/public/themes/geo-bootstrap/README.md +25 -0
- data/public/themes/geo-bootstrap/img/flames.gif +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings.png +0 -0
- data/public/themes/geo-bootstrap/img/microfab.gif +0 -0
- data/public/themes/geo-bootstrap/img/progress.gif +0 -0
- data/public/themes/geo-bootstrap/img/rainbow.gif +0 -0
- data/public/themes/geo-bootstrap/img/stars.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/7upspot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/americanflag.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/community.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer-01.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/construction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider1.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider3.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider4.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/drudgesiren.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/emailme.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/funky.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/geocities.jpg +0 -0
- data/public/themes/geo-bootstrap/img/test/hacker.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/heart.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/hot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ie_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mailkitten.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mchammer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/noframes.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/notepad.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ns_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/sign-in.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/spinningearth.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/underconstruction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/wabwalk.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/webtrips.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/yahooweek.gif +0 -0
- data/public/themes/geo-bootstrap/package.json +21 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.css +1109 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.min.css +9 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.css +6462 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.min.css +9 -0
- metadata +791 -0
@@ -0,0 +1,1611 @@
|
|
1
|
+
Smalltalk current createPackage: 'Kernel-Collections' properties: #{}!
|
2
|
+
Object subclass: #Association
|
3
|
+
instanceVariableNames: 'key value'
|
4
|
+
package: 'Kernel-Collections'!
|
5
|
+
|
6
|
+
!Association methodsFor: 'accessing'!
|
7
|
+
|
8
|
+
key
|
9
|
+
^key
|
10
|
+
!
|
11
|
+
|
12
|
+
key: aKey
|
13
|
+
key := aKey
|
14
|
+
!
|
15
|
+
|
16
|
+
value
|
17
|
+
^value
|
18
|
+
!
|
19
|
+
|
20
|
+
value: aValue
|
21
|
+
value := aValue
|
22
|
+
! !
|
23
|
+
|
24
|
+
!Association methodsFor: 'comparing'!
|
25
|
+
|
26
|
+
= anAssociation
|
27
|
+
^self class = anAssociation class and: [
|
28
|
+
self key = anAssociation key and: [
|
29
|
+
self value = anAssociation value]]
|
30
|
+
!
|
31
|
+
|
32
|
+
storeOn: aStream
|
33
|
+
"Store in the format (key->value)"
|
34
|
+
|
35
|
+
"aStream nextPutAll: '('."
|
36
|
+
key storeOn: aStream.
|
37
|
+
aStream nextPutAll: '->'.
|
38
|
+
value storeOn: aStream.
|
39
|
+
"aStream nextPutAll: ')'"
|
40
|
+
! !
|
41
|
+
|
42
|
+
!Association methodsFor: 'testing'!
|
43
|
+
|
44
|
+
isAssociation
|
45
|
+
^ true
|
46
|
+
! !
|
47
|
+
|
48
|
+
!Association class methodsFor: 'instance creation'!
|
49
|
+
|
50
|
+
key: aKey value: aValue
|
51
|
+
^self new
|
52
|
+
key: aKey;
|
53
|
+
value: aValue;
|
54
|
+
yourself
|
55
|
+
! !
|
56
|
+
|
57
|
+
Object subclass: #Collection
|
58
|
+
instanceVariableNames: ''
|
59
|
+
package: 'Kernel-Collections'!
|
60
|
+
|
61
|
+
!Collection methodsFor: 'accessing'!
|
62
|
+
|
63
|
+
readStream
|
64
|
+
^self stream
|
65
|
+
!
|
66
|
+
|
67
|
+
size
|
68
|
+
self subclassResponsibility
|
69
|
+
!
|
70
|
+
|
71
|
+
stream
|
72
|
+
^self streamClass on: self
|
73
|
+
!
|
74
|
+
|
75
|
+
streamClass
|
76
|
+
^self class streamClass
|
77
|
+
!
|
78
|
+
|
79
|
+
writeStream
|
80
|
+
^self stream
|
81
|
+
! !
|
82
|
+
|
83
|
+
!Collection methodsFor: 'adding/removing'!
|
84
|
+
|
85
|
+
add: anObject
|
86
|
+
self subclassResponsibility
|
87
|
+
!
|
88
|
+
|
89
|
+
addAll: aCollection
|
90
|
+
aCollection do: [:each |
|
91
|
+
self add: each].
|
92
|
+
^aCollection
|
93
|
+
!
|
94
|
+
|
95
|
+
remove: anObject
|
96
|
+
^self remove: anObject ifAbsent: [self errorNotFound]
|
97
|
+
!
|
98
|
+
|
99
|
+
remove: anObject ifAbsent: aBlock
|
100
|
+
self subclassResponsibility
|
101
|
+
! !
|
102
|
+
|
103
|
+
!Collection methodsFor: 'converting'!
|
104
|
+
|
105
|
+
asArray
|
106
|
+
^Array withAll: self
|
107
|
+
!
|
108
|
+
|
109
|
+
asJSON
|
110
|
+
^self asArray collect: [:each | each asJSON]
|
111
|
+
!
|
112
|
+
|
113
|
+
asOrderedCollection
|
114
|
+
^self asArray
|
115
|
+
!
|
116
|
+
|
117
|
+
asSet
|
118
|
+
^Set withAll: self
|
119
|
+
! !
|
120
|
+
|
121
|
+
!Collection methodsFor: 'copying'!
|
122
|
+
|
123
|
+
, aCollection
|
124
|
+
^self copy
|
125
|
+
addAll: aCollection;
|
126
|
+
yourself
|
127
|
+
!
|
128
|
+
|
129
|
+
copyWith: anObject
|
130
|
+
^self copy add: anObject; yourself
|
131
|
+
!
|
132
|
+
|
133
|
+
copyWithAll: aCollection
|
134
|
+
^self copy addAll: aCollection; yourself
|
135
|
+
!
|
136
|
+
|
137
|
+
copyWithoutAll: aCollection
|
138
|
+
"Answer a copy of the receiver that does not contain any elements
|
139
|
+
equal to those in aCollection."
|
140
|
+
|
141
|
+
^ self reject: [:each | aCollection includes: each]
|
142
|
+
! !
|
143
|
+
|
144
|
+
!Collection methodsFor: 'enumerating'!
|
145
|
+
|
146
|
+
collect: aBlock
|
147
|
+
| newCollection |
|
148
|
+
newCollection := self class new.
|
149
|
+
self do: [:each |
|
150
|
+
newCollection add: (aBlock value: each)].
|
151
|
+
^newCollection
|
152
|
+
!
|
153
|
+
|
154
|
+
detect: aBlock
|
155
|
+
^self detect: aBlock ifNone: [self errorNotFound]
|
156
|
+
!
|
157
|
+
|
158
|
+
detect: aBlock ifNone: anotherBlock
|
159
|
+
<
|
160
|
+
for(var i = 0; i < self.length; i++)
|
161
|
+
if(aBlock(self[i]))
|
162
|
+
return self[i];
|
163
|
+
return anotherBlock();
|
164
|
+
>
|
165
|
+
!
|
166
|
+
|
167
|
+
do: aBlock
|
168
|
+
<for(var i=0;i<self.length;i++){aBlock(self[i]);}>
|
169
|
+
!
|
170
|
+
|
171
|
+
do: aBlock separatedBy: anotherBlock
|
172
|
+
| first |
|
173
|
+
first := true.
|
174
|
+
self do: [:each |
|
175
|
+
first
|
176
|
+
ifTrue: [first := false]
|
177
|
+
ifFalse: [anotherBlock value].
|
178
|
+
aBlock value: each]
|
179
|
+
!
|
180
|
+
|
181
|
+
inject: anObject into: aBlock
|
182
|
+
| result |
|
183
|
+
result := anObject.
|
184
|
+
self do: [:each |
|
185
|
+
result := aBlock value: result value: each].
|
186
|
+
^result
|
187
|
+
!
|
188
|
+
|
189
|
+
reject: aBlock
|
190
|
+
^self select: [:each | (aBlock value: each) = false]
|
191
|
+
!
|
192
|
+
|
193
|
+
select: aBlock
|
194
|
+
| stream |
|
195
|
+
stream := self class new writeStream.
|
196
|
+
self do: [:each |
|
197
|
+
(aBlock value: each) ifTrue: [
|
198
|
+
stream nextPut: each]].
|
199
|
+
^stream contents
|
200
|
+
! !
|
201
|
+
|
202
|
+
!Collection methodsFor: 'error handling'!
|
203
|
+
|
204
|
+
errorNotFound
|
205
|
+
self error: 'Object is not in the collection'
|
206
|
+
! !
|
207
|
+
|
208
|
+
!Collection methodsFor: 'testing'!
|
209
|
+
|
210
|
+
ifEmpty: aBlock
|
211
|
+
"Evaluate 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:
|
212
|
+
(myProtocol ifEmpty: ['As yet unclassified'])"
|
213
|
+
^ self isEmpty
|
214
|
+
ifTrue: [ aBlock value ]
|
215
|
+
ifFalse: [ self ]
|
216
|
+
!
|
217
|
+
|
218
|
+
ifNotEmpty: aBlock
|
219
|
+
self notEmpty ifTrue: aBlock.
|
220
|
+
!
|
221
|
+
|
222
|
+
includes: anObject
|
223
|
+
<
|
224
|
+
var i = self.length;
|
225
|
+
while (i--) {
|
226
|
+
if (smalltalk.send(self[i], "__eq", [anObject])) {return true;}
|
227
|
+
}
|
228
|
+
return false
|
229
|
+
>
|
230
|
+
!
|
231
|
+
|
232
|
+
isEmpty
|
233
|
+
^self size = 0
|
234
|
+
!
|
235
|
+
|
236
|
+
notEmpty
|
237
|
+
^self isEmpty not
|
238
|
+
! !
|
239
|
+
|
240
|
+
!Collection class methodsFor: 'accessing'!
|
241
|
+
|
242
|
+
streamClass
|
243
|
+
^Stream
|
244
|
+
! !
|
245
|
+
|
246
|
+
!Collection class methodsFor: 'instance creation'!
|
247
|
+
|
248
|
+
new: anInteger
|
249
|
+
^self new
|
250
|
+
!
|
251
|
+
|
252
|
+
with: anObject
|
253
|
+
^self new
|
254
|
+
add: anObject;
|
255
|
+
yourself
|
256
|
+
!
|
257
|
+
|
258
|
+
with: anObject with: anotherObject
|
259
|
+
^self new
|
260
|
+
add: anObject;
|
261
|
+
add: anotherObject;
|
262
|
+
yourself
|
263
|
+
!
|
264
|
+
|
265
|
+
with: firstObject with: secondObject with: thirdObject
|
266
|
+
^self new
|
267
|
+
add: firstObject;
|
268
|
+
add: secondObject;
|
269
|
+
add: thirdObject;
|
270
|
+
yourself
|
271
|
+
!
|
272
|
+
|
273
|
+
withAll: aCollection
|
274
|
+
^self new
|
275
|
+
addAll: aCollection;
|
276
|
+
yourself
|
277
|
+
! !
|
278
|
+
|
279
|
+
Collection subclass: #HashedCollection
|
280
|
+
instanceVariableNames: ''
|
281
|
+
package: 'Kernel-Collections'!
|
282
|
+
!HashedCollection commentStamp!
|
283
|
+
A HashedCollection is a traditional JavaScript object, or a Smalltalk Dictionary.
|
284
|
+
|
285
|
+
Unlike a Dictionary, it can only have strings as keys.!
|
286
|
+
|
287
|
+
!HashedCollection methodsFor: 'accessing'!
|
288
|
+
|
289
|
+
associations
|
290
|
+
| associations |
|
291
|
+
associations := #().
|
292
|
+
self keys do: [:each |
|
293
|
+
associations add: (Association key: each value: (self at: each))].
|
294
|
+
^associations
|
295
|
+
!
|
296
|
+
|
297
|
+
at: aKey
|
298
|
+
^self at: aKey ifAbsent: [self errorNotFound]
|
299
|
+
!
|
300
|
+
|
301
|
+
at: aKey ifAbsent: aBlock
|
302
|
+
^(self includesKey: aKey)
|
303
|
+
ifTrue: [self basicAt: aKey]
|
304
|
+
ifFalse: aBlock
|
305
|
+
!
|
306
|
+
|
307
|
+
at: aKey ifAbsentPut: aBlock
|
308
|
+
^self at: aKey ifAbsent: [
|
309
|
+
self at: aKey put: aBlock value]
|
310
|
+
!
|
311
|
+
|
312
|
+
at: aKey ifPresent: aBlock
|
313
|
+
^(self basicAt: aKey) ifNotNil: [aBlock value: (self at: aKey)]
|
314
|
+
!
|
315
|
+
|
316
|
+
at: aKey ifPresent: aBlock ifAbsent: anotherBlock
|
317
|
+
^(self basicAt: aKey)
|
318
|
+
ifNil: anotherBlock
|
319
|
+
ifNotNil: [aBlock value: (self at: aKey)]
|
320
|
+
!
|
321
|
+
|
322
|
+
at: aKey put: aValue
|
323
|
+
^self basicAt: aKey put: aValue
|
324
|
+
!
|
325
|
+
|
326
|
+
keys
|
327
|
+
<
|
328
|
+
var keys = [];
|
329
|
+
for(var i in self) {
|
330
|
+
if(self.hasOwnProperty(i)) {
|
331
|
+
keys.push(i);
|
332
|
+
}
|
333
|
+
};
|
334
|
+
return keys;
|
335
|
+
>
|
336
|
+
!
|
337
|
+
|
338
|
+
size
|
339
|
+
^self keys size
|
340
|
+
!
|
341
|
+
|
342
|
+
values
|
343
|
+
^self keys collect: [:each | self at: each]
|
344
|
+
! !
|
345
|
+
|
346
|
+
!HashedCollection methodsFor: 'adding/removing'!
|
347
|
+
|
348
|
+
add: anAssociation
|
349
|
+
self at: anAssociation key put: anAssociation value
|
350
|
+
!
|
351
|
+
|
352
|
+
addAll: aHashedCollection
|
353
|
+
super addAll: aHashedCollection associations.
|
354
|
+
^aHashedCollection
|
355
|
+
!
|
356
|
+
|
357
|
+
remove: aKey ifAbsent: aBlock
|
358
|
+
^self removeKey: aKey ifAbsent: aBlock
|
359
|
+
!
|
360
|
+
|
361
|
+
removeKey: aKey
|
362
|
+
^self remove: aKey
|
363
|
+
!
|
364
|
+
|
365
|
+
removeKey: aKey ifAbsent: aBlock
|
366
|
+
^(self includesKey: aKey)
|
367
|
+
ifFalse: [aBlock value]
|
368
|
+
ifTrue: [self basicDelete: aKey]
|
369
|
+
! !
|
370
|
+
|
371
|
+
!HashedCollection methodsFor: 'comparing'!
|
372
|
+
|
373
|
+
= aHashedCollection
|
374
|
+
self class = aHashedCollection class ifFalse: [^false].
|
375
|
+
self size = aHashedCollection size ifFalse: [^false].
|
376
|
+
^self associations = aHashedCollection associations
|
377
|
+
! !
|
378
|
+
|
379
|
+
!HashedCollection methodsFor: 'converting'!
|
380
|
+
|
381
|
+
asDictionary
|
382
|
+
^Dictionary fromPairs: self associations
|
383
|
+
!
|
384
|
+
|
385
|
+
asJSON
|
386
|
+
| c |
|
387
|
+
c := self class new.
|
388
|
+
self keysAndValuesDo: [:key :value |
|
389
|
+
c at: key put: value asJSON].
|
390
|
+
^c
|
391
|
+
! !
|
392
|
+
|
393
|
+
!HashedCollection methodsFor: 'copying'!
|
394
|
+
|
395
|
+
, aCollection
|
396
|
+
self shouldNotImplement
|
397
|
+
!
|
398
|
+
|
399
|
+
copyFrom: anIndex to: anotherIndex
|
400
|
+
self shouldNotImplement
|
401
|
+
!
|
402
|
+
|
403
|
+
deepCopy
|
404
|
+
| copy |
|
405
|
+
copy := self class new.
|
406
|
+
self associationsDo: [:each |
|
407
|
+
copy at: each key put: each value deepCopy].
|
408
|
+
^copy
|
409
|
+
!
|
410
|
+
|
411
|
+
shallowCopy
|
412
|
+
| copy |
|
413
|
+
copy := self class new.
|
414
|
+
self associationsDo: [:each |
|
415
|
+
copy at: each key put: each value].
|
416
|
+
^copy
|
417
|
+
! !
|
418
|
+
|
419
|
+
!HashedCollection methodsFor: 'enumerating'!
|
420
|
+
|
421
|
+
associationsDo: aBlock
|
422
|
+
self associations do: aBlock
|
423
|
+
!
|
424
|
+
|
425
|
+
collect: aBlock
|
426
|
+
| newDict |
|
427
|
+
newDict := self class new.
|
428
|
+
self keysAndValuesDo: [:key :value |
|
429
|
+
newDict at: key put: (aBlock value: value)].
|
430
|
+
^newDict
|
431
|
+
!
|
432
|
+
|
433
|
+
detect: aBlock ifNone: anotherBlock
|
434
|
+
^self values detect: aBlock ifNone: anotherBlock
|
435
|
+
!
|
436
|
+
|
437
|
+
do: aBlock
|
438
|
+
self values do: aBlock
|
439
|
+
!
|
440
|
+
|
441
|
+
includes: anObject
|
442
|
+
^self values includes: anObject
|
443
|
+
!
|
444
|
+
|
445
|
+
keysAndValuesDo: aBlock
|
446
|
+
self associationsDo: [:each |
|
447
|
+
aBlock value: each key value: each value]
|
448
|
+
!
|
449
|
+
|
450
|
+
select: aBlock
|
451
|
+
| newDict |
|
452
|
+
newDict := self class new.
|
453
|
+
self keysAndValuesDo: [:key :value |
|
454
|
+
(aBlock value: value) ifTrue: [newDict at: key put: value]].
|
455
|
+
^newDict
|
456
|
+
! !
|
457
|
+
|
458
|
+
!HashedCollection methodsFor: 'printing'!
|
459
|
+
|
460
|
+
printString
|
461
|
+
^String streamContents: [:aStream|
|
462
|
+
aStream
|
463
|
+
nextPutAll: super printString;
|
464
|
+
nextPutAll: '('.
|
465
|
+
self associations
|
466
|
+
do: [:anAssociation|
|
467
|
+
aStream
|
468
|
+
nextPutAll: anAssociation key printString;
|
469
|
+
nextPutAll: ' -> ';
|
470
|
+
nextPutAll: anAssociation value printString]
|
471
|
+
separatedBy: [aStream nextPutAll: ' , '].
|
472
|
+
aStream nextPutAll: ')']
|
473
|
+
!
|
474
|
+
|
475
|
+
storeOn: aStream
|
476
|
+
aStream nextPutAll: '#{'.
|
477
|
+
self associations
|
478
|
+
do: [:each | each storeOn: aStream]
|
479
|
+
separatedBy: [ aStream nextPutAll: '. '].
|
480
|
+
aStream nextPutAll: '}'
|
481
|
+
! !
|
482
|
+
|
483
|
+
!HashedCollection methodsFor: 'testing'!
|
484
|
+
|
485
|
+
includesKey: aKey
|
486
|
+
<return self.hasOwnProperty(aKey)>
|
487
|
+
! !
|
488
|
+
|
489
|
+
!HashedCollection class methodsFor: 'instance creation'!
|
490
|
+
|
491
|
+
fromPairs: aCollection
|
492
|
+
| dict |
|
493
|
+
dict := self new.
|
494
|
+
aCollection do: [:each | dict add: each].
|
495
|
+
^dict
|
496
|
+
! !
|
497
|
+
|
498
|
+
HashedCollection subclass: #Dictionary
|
499
|
+
instanceVariableNames: 'keys values'
|
500
|
+
package: 'Kernel-Collections'!
|
501
|
+
|
502
|
+
!Dictionary methodsFor: 'accessing'!
|
503
|
+
|
504
|
+
at: aKey ifAbsent: aBlock
|
505
|
+
<
|
506
|
+
var index;
|
507
|
+
for(var i=0;i<self['@keys'].length;i++){
|
508
|
+
if(self['@keys'][i].__eq(aKey)) {index = i;}
|
509
|
+
};
|
510
|
+
if(typeof index === 'undefined') {
|
511
|
+
return aBlock();
|
512
|
+
} else {
|
513
|
+
return self['@values'][index];
|
514
|
+
}
|
515
|
+
>
|
516
|
+
!
|
517
|
+
|
518
|
+
at: aKey put: aValue
|
519
|
+
<
|
520
|
+
var index = self['@keys'].indexOf(aKey);
|
521
|
+
if(index === -1) {
|
522
|
+
self['@values'].push(aValue);
|
523
|
+
self['@keys'].push(aKey);
|
524
|
+
} else {
|
525
|
+
self['@values'][index] = aValue;
|
526
|
+
};
|
527
|
+
|
528
|
+
return aValue;
|
529
|
+
>
|
530
|
+
!
|
531
|
+
|
532
|
+
keys
|
533
|
+
^keys copy
|
534
|
+
!
|
535
|
+
|
536
|
+
values
|
537
|
+
^values copy
|
538
|
+
! !
|
539
|
+
|
540
|
+
!Dictionary methodsFor: 'adding/removing'!
|
541
|
+
|
542
|
+
removeKey: aKey ifAbsent: aBlock
|
543
|
+
<
|
544
|
+
var index = self['@keys'].indexOf(aKey);
|
545
|
+
if(index === -1) {
|
546
|
+
return aBlock()
|
547
|
+
} else {
|
548
|
+
var value;
|
549
|
+
self['@keys'].splice(index, 1);
|
550
|
+
value = self['@values'].splice(index, 1);
|
551
|
+
return value[0];
|
552
|
+
};
|
553
|
+
>
|
554
|
+
! !
|
555
|
+
|
556
|
+
!Dictionary methodsFor: 'converting'!
|
557
|
+
|
558
|
+
asHashedCollection
|
559
|
+
^HashedCollection fromPairs: self associations
|
560
|
+
!
|
561
|
+
|
562
|
+
asJSON
|
563
|
+
^self asHashedCollection asJSON
|
564
|
+
! !
|
565
|
+
|
566
|
+
!Dictionary methodsFor: 'initialization'!
|
567
|
+
|
568
|
+
initialize
|
569
|
+
super initialize.
|
570
|
+
keys := #().
|
571
|
+
values := #()
|
572
|
+
! !
|
573
|
+
|
574
|
+
!Dictionary methodsFor: 'testing'!
|
575
|
+
|
576
|
+
includesKey: aKey
|
577
|
+
^keys includes: aKey
|
578
|
+
! !
|
579
|
+
|
580
|
+
Collection subclass: #SequenceableCollection
|
581
|
+
instanceVariableNames: ''
|
582
|
+
package: 'Kernel-Collections'!
|
583
|
+
|
584
|
+
!SequenceableCollection methodsFor: 'accessing'!
|
585
|
+
|
586
|
+
allButFirst
|
587
|
+
^self copyFrom: 2 to: self size
|
588
|
+
!
|
589
|
+
|
590
|
+
allButLast
|
591
|
+
^self copyFrom: 1 to: self size - 1
|
592
|
+
!
|
593
|
+
|
594
|
+
at: anIndex
|
595
|
+
^self at: anIndex ifAbsent: [
|
596
|
+
self errorNotFound]
|
597
|
+
!
|
598
|
+
|
599
|
+
at: anIndex ifAbsent: aBlock
|
600
|
+
self subclassResponsibility
|
601
|
+
!
|
602
|
+
|
603
|
+
at: anIndex put: anObject
|
604
|
+
self subclassResponsibility
|
605
|
+
!
|
606
|
+
|
607
|
+
atRandom
|
608
|
+
^ self at: self size atRandom
|
609
|
+
!
|
610
|
+
|
611
|
+
first
|
612
|
+
^self at: 1
|
613
|
+
!
|
614
|
+
|
615
|
+
first: n
|
616
|
+
"Answer the first n elements of the receiver.
|
617
|
+
Raise an error if there are not enough elements."
|
618
|
+
|
619
|
+
^ self copyFrom: 1 to: n
|
620
|
+
!
|
621
|
+
|
622
|
+
fourth
|
623
|
+
^self at: 4
|
624
|
+
!
|
625
|
+
|
626
|
+
indexOf: anObject
|
627
|
+
^self indexOf: anObject ifAbsent: [self errorNotFound]
|
628
|
+
!
|
629
|
+
|
630
|
+
indexOf: anObject ifAbsent: aBlock
|
631
|
+
<
|
632
|
+
for(var i=0;i<self.length;i++){
|
633
|
+
if(self[i].__eq(anObject)) {return i+1}
|
634
|
+
}
|
635
|
+
return aBlock();
|
636
|
+
>
|
637
|
+
!
|
638
|
+
|
639
|
+
indexOf: anObject startingAt: start
|
640
|
+
"Answer the index of the first occurence of anElement after start
|
641
|
+
within the receiver. If the receiver does not contain anElement,
|
642
|
+
answer 0."
|
643
|
+
^self indexOf: anObject startingAt: start ifAbsent: [0]
|
644
|
+
!
|
645
|
+
|
646
|
+
indexOf: anObject startingAt: start ifAbsent: aBlock
|
647
|
+
<
|
648
|
+
for(var i=start-1;i<self.length;i++){
|
649
|
+
if(self[i].__eq(anObject)) {return i+1}
|
650
|
+
}
|
651
|
+
return aBlock();
|
652
|
+
>
|
653
|
+
!
|
654
|
+
|
655
|
+
last
|
656
|
+
^self at: self size
|
657
|
+
!
|
658
|
+
|
659
|
+
second
|
660
|
+
^self at: 2
|
661
|
+
!
|
662
|
+
|
663
|
+
third
|
664
|
+
^self at: 3
|
665
|
+
! !
|
666
|
+
|
667
|
+
!SequenceableCollection methodsFor: 'adding'!
|
668
|
+
|
669
|
+
addLast: anObject
|
670
|
+
self add: anObject
|
671
|
+
!
|
672
|
+
|
673
|
+
removeLast
|
674
|
+
self remove: self last
|
675
|
+
! !
|
676
|
+
|
677
|
+
!SequenceableCollection methodsFor: 'comparing'!
|
678
|
+
|
679
|
+
= aCollection
|
680
|
+
(self class = aCollection class and: [
|
681
|
+
self size = aCollection size]) ifFalse: [^false].
|
682
|
+
self withIndexDo: [:each :i |
|
683
|
+
(aCollection at: i) = each ifFalse: [^false]].
|
684
|
+
^true
|
685
|
+
! !
|
686
|
+
|
687
|
+
!SequenceableCollection methodsFor: 'converting'!
|
688
|
+
|
689
|
+
reversed
|
690
|
+
self subclassResponsibility
|
691
|
+
! !
|
692
|
+
|
693
|
+
!SequenceableCollection methodsFor: 'copying'!
|
694
|
+
|
695
|
+
copyFrom: anIndex to: anotherIndex
|
696
|
+
| range newCollection |
|
697
|
+
range := anIndex to: anotherIndex.
|
698
|
+
newCollection := self class new: range size.
|
699
|
+
range withIndexDo: [:each :i |
|
700
|
+
newCollection at: i put: (self at: each)].
|
701
|
+
^newCollection
|
702
|
+
!
|
703
|
+
|
704
|
+
deepCopy
|
705
|
+
| newCollection |
|
706
|
+
newCollection := self class new: self size.
|
707
|
+
self withIndexDo: [:each :index |
|
708
|
+
newCollection at: index put: each deepCopy].
|
709
|
+
^newCollection
|
710
|
+
!
|
711
|
+
|
712
|
+
shallowCopy
|
713
|
+
| newCollection |
|
714
|
+
newCollection := self class new: self size.
|
715
|
+
self withIndexDo: [ :each :index |
|
716
|
+
newCollection at: index put: each].
|
717
|
+
^newCollection
|
718
|
+
! !
|
719
|
+
|
720
|
+
!SequenceableCollection methodsFor: 'enumerating'!
|
721
|
+
|
722
|
+
withIndexDo: aBlock
|
723
|
+
<for(var i=0;i<self.length;i++){aBlock(self[i], i+1);}>
|
724
|
+
! !
|
725
|
+
|
726
|
+
!SequenceableCollection methodsFor: 'printing'!
|
727
|
+
|
728
|
+
printString
|
729
|
+
| str |
|
730
|
+
str := '' writeStream.
|
731
|
+
str nextPutAll: super printString, ' ('.
|
732
|
+
self
|
733
|
+
do: [:each | str nextPutAll: each printString]
|
734
|
+
separatedBy: [str nextPutAll: ' '].
|
735
|
+
str nextPutAll: ')'.
|
736
|
+
^str contents
|
737
|
+
! !
|
738
|
+
|
739
|
+
SequenceableCollection subclass: #Array
|
740
|
+
instanceVariableNames: ''
|
741
|
+
package: 'Kernel-Collections'!
|
742
|
+
|
743
|
+
!Array methodsFor: 'accessing'!
|
744
|
+
|
745
|
+
at: anIndex ifAbsent: aBlock
|
746
|
+
<
|
747
|
+
var value = self[anIndex - 1];
|
748
|
+
if(value === undefined) {
|
749
|
+
return aBlock();
|
750
|
+
} else {
|
751
|
+
return value;
|
752
|
+
}
|
753
|
+
>
|
754
|
+
!
|
755
|
+
|
756
|
+
at: anIndex put: anObject
|
757
|
+
<return self[anIndex - 1] = anObject>
|
758
|
+
!
|
759
|
+
|
760
|
+
size
|
761
|
+
<return self.length>
|
762
|
+
! !
|
763
|
+
|
764
|
+
!Array methodsFor: 'adding/removing'!
|
765
|
+
|
766
|
+
add: anObject
|
767
|
+
<self.push(anObject); return anObject;>
|
768
|
+
!
|
769
|
+
|
770
|
+
remove: anObject
|
771
|
+
<
|
772
|
+
for(var i=0;i<self.length;i++) {
|
773
|
+
if(self[i] == anObject) {
|
774
|
+
self.splice(i,1);
|
775
|
+
break;
|
776
|
+
}
|
777
|
+
}
|
778
|
+
>
|
779
|
+
!
|
780
|
+
|
781
|
+
removeFrom: aNumber to: anotherNumber
|
782
|
+
<self.splice(aNumber - 1,anotherNumber - 1)>
|
783
|
+
! !
|
784
|
+
|
785
|
+
!Array methodsFor: 'converting'!
|
786
|
+
|
787
|
+
asJavascript
|
788
|
+
^'[', ((self collect: [:each | each asJavascript]) join: ', '), ']'
|
789
|
+
!
|
790
|
+
|
791
|
+
reversed
|
792
|
+
<return self._copy().reverse()>
|
793
|
+
! !
|
794
|
+
|
795
|
+
!Array methodsFor: 'enumerating'!
|
796
|
+
|
797
|
+
join: aString
|
798
|
+
<return self.join(aString)>
|
799
|
+
!
|
800
|
+
|
801
|
+
sort
|
802
|
+
^self basicPerform: 'sort'
|
803
|
+
!
|
804
|
+
|
805
|
+
sort: aBlock
|
806
|
+
<
|
807
|
+
return self.sort(function(a, b) {
|
808
|
+
if(aBlock(a,b)) {return -1} else {return 1}
|
809
|
+
})
|
810
|
+
>
|
811
|
+
!
|
812
|
+
|
813
|
+
sorted
|
814
|
+
^self copy sort
|
815
|
+
!
|
816
|
+
|
817
|
+
sorted: aBlock
|
818
|
+
^self copy sort: aBlock
|
819
|
+
! !
|
820
|
+
|
821
|
+
!Array class methodsFor: 'instance creation'!
|
822
|
+
|
823
|
+
new: anInteger
|
824
|
+
<return new Array(anInteger)>
|
825
|
+
!
|
826
|
+
|
827
|
+
with: anObject
|
828
|
+
^(self new: 1)
|
829
|
+
at: 1 put: anObject;
|
830
|
+
yourself
|
831
|
+
!
|
832
|
+
|
833
|
+
with: anObject with: anObject2
|
834
|
+
^(self new: 2)
|
835
|
+
at: 1 put: anObject;
|
836
|
+
at: 2 put: anObject2;
|
837
|
+
yourself
|
838
|
+
!
|
839
|
+
|
840
|
+
with: anObject with: anObject2 with: anObject3
|
841
|
+
^(self new: 3)
|
842
|
+
at: 1 put: anObject;
|
843
|
+
at: 2 put: anObject2;
|
844
|
+
at: 3 put: anObject3;
|
845
|
+
yourself
|
846
|
+
!
|
847
|
+
|
848
|
+
withAll: aCollection
|
849
|
+
| instance |
|
850
|
+
instance := self new: aCollection size.
|
851
|
+
aCollection withIndexDo: [:each :index |
|
852
|
+
instance at: index put: each].
|
853
|
+
^instance
|
854
|
+
! !
|
855
|
+
|
856
|
+
SequenceableCollection subclass: #CharacterArray
|
857
|
+
instanceVariableNames: ''
|
858
|
+
package: 'Kernel-Collections'!
|
859
|
+
|
860
|
+
!CharacterArray methodsFor: 'accessing'!
|
861
|
+
|
862
|
+
at: anIndex put: anObject
|
863
|
+
self errorReadOnly
|
864
|
+
! !
|
865
|
+
|
866
|
+
!CharacterArray methodsFor: 'adding'!
|
867
|
+
|
868
|
+
add: anObject
|
869
|
+
self errorReadOnly
|
870
|
+
!
|
871
|
+
|
872
|
+
remove: anObject
|
873
|
+
self errorReadOnly
|
874
|
+
! !
|
875
|
+
|
876
|
+
!CharacterArray methodsFor: 'converting'!
|
877
|
+
|
878
|
+
asLowercase
|
879
|
+
^self class fromString: self asString asLowercase
|
880
|
+
!
|
881
|
+
|
882
|
+
asNumber
|
883
|
+
^self asString asNumber
|
884
|
+
!
|
885
|
+
|
886
|
+
asString
|
887
|
+
^self subclassResponsibility
|
888
|
+
!
|
889
|
+
|
890
|
+
asSymbol
|
891
|
+
^self subclassResponsibility
|
892
|
+
!
|
893
|
+
|
894
|
+
asUppercase
|
895
|
+
^self class fromString: self asString asUppercase
|
896
|
+
! !
|
897
|
+
|
898
|
+
!CharacterArray methodsFor: 'copying'!
|
899
|
+
|
900
|
+
, aString
|
901
|
+
^self asString, aString asString
|
902
|
+
! !
|
903
|
+
|
904
|
+
!CharacterArray methodsFor: 'error handling'!
|
905
|
+
|
906
|
+
errorReadOnly
|
907
|
+
self error: 'Object is read-only'
|
908
|
+
! !
|
909
|
+
|
910
|
+
!CharacterArray methodsFor: 'printing'!
|
911
|
+
|
912
|
+
printString
|
913
|
+
^self asString printString
|
914
|
+
! !
|
915
|
+
|
916
|
+
!CharacterArray class methodsFor: 'instance creation'!
|
917
|
+
|
918
|
+
fromString: aString
|
919
|
+
self subclassResponsibility
|
920
|
+
! !
|
921
|
+
|
922
|
+
CharacterArray subclass: #String
|
923
|
+
instanceVariableNames: ''
|
924
|
+
package: 'Kernel-Collections'!
|
925
|
+
|
926
|
+
!String methodsFor: 'accessing'!
|
927
|
+
|
928
|
+
asciiValue
|
929
|
+
<return self.charCodeAt(0);>
|
930
|
+
!
|
931
|
+
|
932
|
+
at: anIndex ifAbsent: aBlock
|
933
|
+
<return self[anIndex - 1] || aBlock()>
|
934
|
+
!
|
935
|
+
|
936
|
+
escaped
|
937
|
+
<return escape(self)>
|
938
|
+
!
|
939
|
+
|
940
|
+
size
|
941
|
+
<return self.length>
|
942
|
+
!
|
943
|
+
|
944
|
+
unescaped
|
945
|
+
<return unescape(self)>
|
946
|
+
! !
|
947
|
+
|
948
|
+
!String methodsFor: 'comparing'!
|
949
|
+
|
950
|
+
< aString
|
951
|
+
<return String(self) < aString._asString()>
|
952
|
+
!
|
953
|
+
|
954
|
+
<= aString
|
955
|
+
<return String(self) <= aString._asString()>
|
956
|
+
!
|
957
|
+
|
958
|
+
= aString
|
959
|
+
aString class = self class ifFalse: [^false].
|
960
|
+
<return String(self) === String(aString)>
|
961
|
+
!
|
962
|
+
|
963
|
+
> aString
|
964
|
+
<return String(self) >> aString._asString()>
|
965
|
+
!
|
966
|
+
|
967
|
+
>= aString
|
968
|
+
<return String(self) >>= aString._asString()>
|
969
|
+
! !
|
970
|
+
|
971
|
+
!String methodsFor: 'converting'!
|
972
|
+
|
973
|
+
asJSON
|
974
|
+
^self
|
975
|
+
!
|
976
|
+
|
977
|
+
asJavaScriptSelector
|
978
|
+
^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.
|
979
|
+
!
|
980
|
+
|
981
|
+
asJavascript
|
982
|
+
<
|
983
|
+
if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
|
984
|
+
return "unescape(\"" + escape(self) + "\")";
|
985
|
+
else
|
986
|
+
return "\"" + self + "\"";
|
987
|
+
>
|
988
|
+
!
|
989
|
+
|
990
|
+
asLowercase
|
991
|
+
<return self.toLowerCase()>
|
992
|
+
!
|
993
|
+
|
994
|
+
asNumber
|
995
|
+
<return Number(self)>
|
996
|
+
!
|
997
|
+
|
998
|
+
asSelector
|
999
|
+
"If you change this method, change smalltalk.convertSelector too (see js/boot.js file)"
|
1000
|
+
|
1001
|
+
| selector |
|
1002
|
+
selector := '_', self.
|
1003
|
+
selector := selector replace: ':' with: '_'.
|
1004
|
+
selector := selector replace: '[+]' with: '_plus'.
|
1005
|
+
selector := selector replace: '-' with: '_minus'.
|
1006
|
+
selector := selector replace: '[*]' with: '_star'.
|
1007
|
+
selector := selector replace: '[/]' with: '_slash'.
|
1008
|
+
selector := selector replace: '>' with: '_gt'.
|
1009
|
+
selector := selector replace: '<' with: '_lt'.
|
1010
|
+
selector := selector replace: '=' with: '_eq'.
|
1011
|
+
selector := selector replace: ',' with: '_comma'.
|
1012
|
+
selector := selector replace: '[@]' with: '_at'.
|
1013
|
+
^selector
|
1014
|
+
!
|
1015
|
+
|
1016
|
+
asString
|
1017
|
+
^self
|
1018
|
+
!
|
1019
|
+
|
1020
|
+
asSymbol
|
1021
|
+
^Symbol lookup: self
|
1022
|
+
!
|
1023
|
+
|
1024
|
+
asUppercase
|
1025
|
+
<return self.toUpperCase()>
|
1026
|
+
!
|
1027
|
+
|
1028
|
+
escapedString
|
1029
|
+
^ self replace: '''' with: ''''''
|
1030
|
+
!
|
1031
|
+
|
1032
|
+
reversed
|
1033
|
+
<return self.split("").reverse().join("")>
|
1034
|
+
!
|
1035
|
+
|
1036
|
+
tokenize: aString
|
1037
|
+
<return self.split(aString)>
|
1038
|
+
! !
|
1039
|
+
|
1040
|
+
!String methodsFor: 'copying'!
|
1041
|
+
|
1042
|
+
, aString
|
1043
|
+
<return self + aString>
|
1044
|
+
!
|
1045
|
+
|
1046
|
+
copyFrom: anIndex to: anotherIndex
|
1047
|
+
<return self.substring(anIndex - 1, anotherIndex)>
|
1048
|
+
!
|
1049
|
+
|
1050
|
+
deepCopy
|
1051
|
+
^self shallowCopy
|
1052
|
+
!
|
1053
|
+
|
1054
|
+
shallowCopy
|
1055
|
+
^self class fromString: self
|
1056
|
+
! !
|
1057
|
+
|
1058
|
+
!String methodsFor: 'printing'!
|
1059
|
+
|
1060
|
+
printNl
|
1061
|
+
<console.log(self)>
|
1062
|
+
!
|
1063
|
+
|
1064
|
+
printString
|
1065
|
+
^'''', self, ''''
|
1066
|
+
! !
|
1067
|
+
|
1068
|
+
!String methodsFor: 'regular expressions'!
|
1069
|
+
|
1070
|
+
match: aRegexp
|
1071
|
+
<return self.search(aRegexp) !!= -1>
|
1072
|
+
!
|
1073
|
+
|
1074
|
+
replace: aString with: anotherString
|
1075
|
+
^self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString
|
1076
|
+
!
|
1077
|
+
|
1078
|
+
replaceRegexp: aRegexp with: aString
|
1079
|
+
<return self.replace(aRegexp, aString)>
|
1080
|
+
!
|
1081
|
+
|
1082
|
+
trimBoth
|
1083
|
+
^self trimBoth: '\s'
|
1084
|
+
!
|
1085
|
+
|
1086
|
+
trimBoth: separators
|
1087
|
+
|
1088
|
+
^(self trimLeft: separators) trimRight: separators
|
1089
|
+
!
|
1090
|
+
|
1091
|
+
trimLeft
|
1092
|
+
^self trimLeft: '\s'
|
1093
|
+
!
|
1094
|
+
|
1095
|
+
trimLeft: separators
|
1096
|
+
|
1097
|
+
^self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''
|
1098
|
+
!
|
1099
|
+
|
1100
|
+
trimRight
|
1101
|
+
^self trimRight: '\s'
|
1102
|
+
!
|
1103
|
+
|
1104
|
+
trimRight: separators
|
1105
|
+
|
1106
|
+
^self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''
|
1107
|
+
! !
|
1108
|
+
|
1109
|
+
!String methodsFor: 'split join'!
|
1110
|
+
|
1111
|
+
join: aCollection
|
1112
|
+
^ String
|
1113
|
+
streamContents: [:stream | aCollection
|
1114
|
+
do: [:each | stream nextPutAll: each asString]
|
1115
|
+
separatedBy: [stream nextPutAll: self]]
|
1116
|
+
!
|
1117
|
+
|
1118
|
+
lineIndicesDo: aBlock
|
1119
|
+
"execute aBlock with 3 arguments for each line:
|
1120
|
+
- start index of line
|
1121
|
+
- end index of line without line delimiter
|
1122
|
+
- end index of line including line delimiter(s) CR, LF or CRLF"
|
1123
|
+
|
1124
|
+
| cr lf start sz nextLF nextCR |
|
1125
|
+
start := 1.
|
1126
|
+
sz := self size.
|
1127
|
+
cr := String cr.
|
1128
|
+
nextCR := self indexOf: cr startingAt: 1.
|
1129
|
+
lf := String lf.
|
1130
|
+
nextLF := self indexOf: lf startingAt: 1.
|
1131
|
+
[ start <= sz ] whileTrue: [
|
1132
|
+
(nextLF = 0 and: [ nextCR = 0 ])
|
1133
|
+
ifTrue: [ "No more CR, nor LF, the string is over"
|
1134
|
+
aBlock value: start value: sz value: sz.
|
1135
|
+
^self ].
|
1136
|
+
(nextCR = 0 or: [ 0 < nextLF and: [ nextLF < nextCR ] ])
|
1137
|
+
ifTrue: [ "Found a LF"
|
1138
|
+
aBlock value: start value: nextLF - 1 value: nextLF.
|
1139
|
+
start := 1 + nextLF.
|
1140
|
+
nextLF := self indexOf: lf startingAt: start ]
|
1141
|
+
ifFalse: [ 1 + nextCR = nextLF
|
1142
|
+
ifTrue: [ "Found a CR-LF pair"
|
1143
|
+
aBlock value: start value: nextCR - 1 value: nextLF.
|
1144
|
+
start := 1 + nextLF.
|
1145
|
+
nextCR := self indexOf: cr startingAt: start.
|
1146
|
+
nextLF := self indexOf: lf startingAt: start ]
|
1147
|
+
ifFalse: [ "Found a CR"
|
1148
|
+
aBlock value: start value: nextCR - 1 value: nextCR.
|
1149
|
+
start := 1 + nextCR.
|
1150
|
+
nextCR := self indexOf: cr startingAt: start ]]]
|
1151
|
+
!
|
1152
|
+
|
1153
|
+
lineNumber: anIndex
|
1154
|
+
"Answer a string containing the characters in the given line number."
|
1155
|
+
|
1156
|
+
| lineCount |
|
1157
|
+
lineCount := 0.
|
1158
|
+
self lineIndicesDo: [:start :endWithoutDelimiters :end |
|
1159
|
+
(lineCount := lineCount + 1) = anIndex ifTrue: [^self copyFrom: start to: endWithoutDelimiters]].
|
1160
|
+
^nil
|
1161
|
+
!
|
1162
|
+
|
1163
|
+
lines
|
1164
|
+
"Answer an array of lines composing this receiver without the line ending delimiters."
|
1165
|
+
|
1166
|
+
| lines |
|
1167
|
+
lines := Array new.
|
1168
|
+
self linesDo: [:aLine | lines add: aLine].
|
1169
|
+
^lines
|
1170
|
+
!
|
1171
|
+
|
1172
|
+
linesDo: aBlock
|
1173
|
+
"Execute aBlock with each line in this string. The terminating line
|
1174
|
+
delimiters CR, LF or CRLF pairs are not included in what is passed to aBlock"
|
1175
|
+
|
1176
|
+
self lineIndicesDo: [:start :endWithoutDelimiters :end |
|
1177
|
+
aBlock value: (self copyFrom: start to: endWithoutDelimiters)]
|
1178
|
+
! !
|
1179
|
+
|
1180
|
+
!String methodsFor: 'testing'!
|
1181
|
+
|
1182
|
+
includesSubString: subString
|
1183
|
+
< return self.indexOf(subString) !!= -1 >
|
1184
|
+
!
|
1185
|
+
|
1186
|
+
isString
|
1187
|
+
^true
|
1188
|
+
! !
|
1189
|
+
|
1190
|
+
!String class methodsFor: 'accessing'!
|
1191
|
+
|
1192
|
+
cr
|
1193
|
+
<return '\r'>
|
1194
|
+
!
|
1195
|
+
|
1196
|
+
crlf
|
1197
|
+
<return '\r\n'>
|
1198
|
+
!
|
1199
|
+
|
1200
|
+
lf
|
1201
|
+
<return '\n'>
|
1202
|
+
!
|
1203
|
+
|
1204
|
+
space
|
1205
|
+
<return ' '>
|
1206
|
+
!
|
1207
|
+
|
1208
|
+
streamClass
|
1209
|
+
^StringStream
|
1210
|
+
!
|
1211
|
+
|
1212
|
+
tab
|
1213
|
+
<return '\t'>
|
1214
|
+
! !
|
1215
|
+
|
1216
|
+
!String class methodsFor: 'instance creation'!
|
1217
|
+
|
1218
|
+
fromString: aString
|
1219
|
+
<return new self.fn(aString)>
|
1220
|
+
!
|
1221
|
+
|
1222
|
+
streamContents: blockWithArg
|
1223
|
+
|stream|
|
1224
|
+
stream := (self streamClass on: String new).
|
1225
|
+
blockWithArg value: stream.
|
1226
|
+
^ stream contents
|
1227
|
+
!
|
1228
|
+
|
1229
|
+
value: aUTFCharCode
|
1230
|
+
|
1231
|
+
<return String.fromCharCode(aUTFCharCode);>
|
1232
|
+
! !
|
1233
|
+
|
1234
|
+
CharacterArray subclass: #Symbol
|
1235
|
+
instanceVariableNames: ''
|
1236
|
+
package: 'Kernel-Collections'!
|
1237
|
+
|
1238
|
+
!Symbol methodsFor: 'accessing'!
|
1239
|
+
|
1240
|
+
at: anIndex ifAbsent: aBlock
|
1241
|
+
^self asString at: anIndex ifAbsent: aBlock
|
1242
|
+
!
|
1243
|
+
|
1244
|
+
size
|
1245
|
+
^self asString size
|
1246
|
+
! !
|
1247
|
+
|
1248
|
+
!Symbol methodsFor: 'comparing'!
|
1249
|
+
|
1250
|
+
< aSymbol
|
1251
|
+
^self asString < aSymbol asString
|
1252
|
+
!
|
1253
|
+
|
1254
|
+
<= aSymbol
|
1255
|
+
^self asString <= aSymbol asString
|
1256
|
+
!
|
1257
|
+
|
1258
|
+
= aSymbol
|
1259
|
+
aSymbol class = self class ifFalse: [^false].
|
1260
|
+
^self asString = aSymbol asString
|
1261
|
+
!
|
1262
|
+
|
1263
|
+
> aSymbol
|
1264
|
+
^self asString > aSymbol asString
|
1265
|
+
!
|
1266
|
+
|
1267
|
+
>= aSymbol
|
1268
|
+
^self asString >= aSymbol asString
|
1269
|
+
! !
|
1270
|
+
|
1271
|
+
!Symbol methodsFor: 'converting'!
|
1272
|
+
|
1273
|
+
asJSON
|
1274
|
+
^self asString asJSON
|
1275
|
+
!
|
1276
|
+
|
1277
|
+
asJavascript
|
1278
|
+
^'smalltalk.symbolFor("', self asString, '")'
|
1279
|
+
!
|
1280
|
+
|
1281
|
+
asSelector
|
1282
|
+
^self asString asSelector
|
1283
|
+
!
|
1284
|
+
|
1285
|
+
asString
|
1286
|
+
<return self.value>
|
1287
|
+
!
|
1288
|
+
|
1289
|
+
asSymbol
|
1290
|
+
^self
|
1291
|
+
! !
|
1292
|
+
|
1293
|
+
!Symbol methodsFor: 'copying'!
|
1294
|
+
|
1295
|
+
copyFrom: anIndex to: anotherIndex
|
1296
|
+
^self class fromString: (self asString copyFrom: anIndex to: anotherIndex)
|
1297
|
+
!
|
1298
|
+
|
1299
|
+
deepCopy
|
1300
|
+
^self
|
1301
|
+
!
|
1302
|
+
|
1303
|
+
shallowCopy
|
1304
|
+
^self
|
1305
|
+
! !
|
1306
|
+
|
1307
|
+
!Symbol methodsFor: 'printing'!
|
1308
|
+
|
1309
|
+
isSymbol
|
1310
|
+
^true
|
1311
|
+
!
|
1312
|
+
|
1313
|
+
printString
|
1314
|
+
^'#', self asString
|
1315
|
+
! !
|
1316
|
+
|
1317
|
+
!Symbol class methodsFor: 'instance creation'!
|
1318
|
+
|
1319
|
+
basicNew
|
1320
|
+
self shouldNotImplement
|
1321
|
+
!
|
1322
|
+
|
1323
|
+
fromString: aString
|
1324
|
+
^self lookup: aString
|
1325
|
+
!
|
1326
|
+
|
1327
|
+
lookup: aString
|
1328
|
+
<return smalltalk.symbolFor(aString);>
|
1329
|
+
! !
|
1330
|
+
|
1331
|
+
Collection subclass: #Set
|
1332
|
+
instanceVariableNames: 'elements'
|
1333
|
+
package: 'Kernel-Collections'!
|
1334
|
+
|
1335
|
+
!Set methodsFor: 'accessing'!
|
1336
|
+
|
1337
|
+
size
|
1338
|
+
^elements size
|
1339
|
+
! !
|
1340
|
+
|
1341
|
+
!Set methodsFor: 'adding/removing'!
|
1342
|
+
|
1343
|
+
add: anObject
|
1344
|
+
<
|
1345
|
+
var found;
|
1346
|
+
for(var i=0; i < self['@elements'].length; i++) {
|
1347
|
+
if(anObject == self['@elements'][i]) {
|
1348
|
+
found = true;
|
1349
|
+
break;
|
1350
|
+
}
|
1351
|
+
}
|
1352
|
+
if(!!found) {self['@elements'].push(anObject)}
|
1353
|
+
>
|
1354
|
+
!
|
1355
|
+
|
1356
|
+
remove: anObject
|
1357
|
+
elements remove: anObject
|
1358
|
+
! !
|
1359
|
+
|
1360
|
+
!Set methodsFor: 'comparing'!
|
1361
|
+
|
1362
|
+
= aCollection
|
1363
|
+
^self class = aCollection class and: [
|
1364
|
+
elements = aCollection asArray]
|
1365
|
+
! !
|
1366
|
+
|
1367
|
+
!Set methodsFor: 'converting'!
|
1368
|
+
|
1369
|
+
asArray
|
1370
|
+
^elements copy
|
1371
|
+
! !
|
1372
|
+
|
1373
|
+
!Set methodsFor: 'enumerating'!
|
1374
|
+
|
1375
|
+
detect: aBlock ifNone: anotherBlock
|
1376
|
+
^elements detect: aBlock ifNone: anotherBlock
|
1377
|
+
!
|
1378
|
+
|
1379
|
+
do: aBlock
|
1380
|
+
elements do: aBlock
|
1381
|
+
!
|
1382
|
+
|
1383
|
+
select: aBlock
|
1384
|
+
| collection |
|
1385
|
+
collection := self class new.
|
1386
|
+
self do: [:each |
|
1387
|
+
(aBlock value: each) ifTrue: [
|
1388
|
+
collection add: each]].
|
1389
|
+
^collection
|
1390
|
+
! !
|
1391
|
+
|
1392
|
+
!Set methodsFor: 'initialization'!
|
1393
|
+
|
1394
|
+
initialize
|
1395
|
+
super initialize.
|
1396
|
+
elements := #()
|
1397
|
+
! !
|
1398
|
+
|
1399
|
+
!Set methodsFor: 'testing'!
|
1400
|
+
|
1401
|
+
includes: anObject
|
1402
|
+
^elements includes: anObject
|
1403
|
+
! !
|
1404
|
+
|
1405
|
+
Object subclass: #RegularExpression
|
1406
|
+
instanceVariableNames: ''
|
1407
|
+
package: 'Kernel-Collections'!
|
1408
|
+
|
1409
|
+
!RegularExpression methodsFor: 'evaluating'!
|
1410
|
+
|
1411
|
+
compile: aString
|
1412
|
+
<return self.compile(aString)>
|
1413
|
+
!
|
1414
|
+
|
1415
|
+
exec: aString
|
1416
|
+
<return self.exec(aString) || nil>
|
1417
|
+
!
|
1418
|
+
|
1419
|
+
test: aString
|
1420
|
+
<return self.test(aString)>
|
1421
|
+
! !
|
1422
|
+
|
1423
|
+
!RegularExpression class methodsFor: 'instance creation'!
|
1424
|
+
|
1425
|
+
fromString: aString
|
1426
|
+
^self fromString: aString flag: ''
|
1427
|
+
!
|
1428
|
+
|
1429
|
+
fromString: aString flag: anotherString
|
1430
|
+
<return new RegExp(aString, anotherString)>
|
1431
|
+
! !
|
1432
|
+
|
1433
|
+
Object subclass: #Stream
|
1434
|
+
instanceVariableNames: 'collection position streamSize'
|
1435
|
+
package: 'Kernel-Collections'!
|
1436
|
+
|
1437
|
+
!Stream methodsFor: 'accessing'!
|
1438
|
+
|
1439
|
+
collection
|
1440
|
+
^collection
|
1441
|
+
!
|
1442
|
+
|
1443
|
+
contents
|
1444
|
+
^self collection
|
1445
|
+
copyFrom: 1
|
1446
|
+
to: self streamSize
|
1447
|
+
!
|
1448
|
+
|
1449
|
+
position
|
1450
|
+
^position ifNil: [position := 0]
|
1451
|
+
!
|
1452
|
+
|
1453
|
+
position: anInteger
|
1454
|
+
position := anInteger
|
1455
|
+
!
|
1456
|
+
|
1457
|
+
setCollection: aCollection
|
1458
|
+
collection := aCollection
|
1459
|
+
!
|
1460
|
+
|
1461
|
+
setStreamSize: anInteger
|
1462
|
+
streamSize := anInteger
|
1463
|
+
!
|
1464
|
+
|
1465
|
+
size
|
1466
|
+
^self streamSize
|
1467
|
+
!
|
1468
|
+
|
1469
|
+
streamSize
|
1470
|
+
^streamSize
|
1471
|
+
! !
|
1472
|
+
|
1473
|
+
!Stream methodsFor: 'actions'!
|
1474
|
+
|
1475
|
+
close
|
1476
|
+
!
|
1477
|
+
|
1478
|
+
flush
|
1479
|
+
!
|
1480
|
+
|
1481
|
+
reset
|
1482
|
+
self position: 0
|
1483
|
+
!
|
1484
|
+
|
1485
|
+
resetContents
|
1486
|
+
self reset.
|
1487
|
+
self setStreamSize: 0
|
1488
|
+
! !
|
1489
|
+
|
1490
|
+
!Stream methodsFor: 'enumerating'!
|
1491
|
+
|
1492
|
+
do: aBlock
|
1493
|
+
[self atEnd] whileFalse: [aBlock value: self next]
|
1494
|
+
! !
|
1495
|
+
|
1496
|
+
!Stream methodsFor: 'positioning'!
|
1497
|
+
|
1498
|
+
setToEnd
|
1499
|
+
self position: self size
|
1500
|
+
!
|
1501
|
+
|
1502
|
+
skip: anInteger
|
1503
|
+
self position: ((self position + anInteger) min: self size max: 0)
|
1504
|
+
! !
|
1505
|
+
|
1506
|
+
!Stream methodsFor: 'reading'!
|
1507
|
+
|
1508
|
+
next
|
1509
|
+
^self atEnd
|
1510
|
+
ifTrue: [nil]
|
1511
|
+
ifFalse: [
|
1512
|
+
self position: self position + 1.
|
1513
|
+
collection at: self position]
|
1514
|
+
!
|
1515
|
+
|
1516
|
+
next: anInteger
|
1517
|
+
| tempCollection |
|
1518
|
+
tempCollection := self collection class new.
|
1519
|
+
anInteger timesRepeat: [
|
1520
|
+
self atEnd ifFalse: [
|
1521
|
+
tempCollection add: self next]].
|
1522
|
+
^tempCollection
|
1523
|
+
!
|
1524
|
+
|
1525
|
+
peek
|
1526
|
+
^self atEnd ifFalse: [
|
1527
|
+
self collection at: self position + 1]
|
1528
|
+
! !
|
1529
|
+
|
1530
|
+
!Stream methodsFor: 'testing'!
|
1531
|
+
|
1532
|
+
atEnd
|
1533
|
+
^self position = self size
|
1534
|
+
!
|
1535
|
+
|
1536
|
+
atStart
|
1537
|
+
^self position = 0
|
1538
|
+
!
|
1539
|
+
|
1540
|
+
isEmpty
|
1541
|
+
^self size = 0
|
1542
|
+
! !
|
1543
|
+
|
1544
|
+
!Stream methodsFor: 'writing'!
|
1545
|
+
|
1546
|
+
nextPut: anObject
|
1547
|
+
self position: self position + 1.
|
1548
|
+
self collection at: self position put: anObject.
|
1549
|
+
self setStreamSize: (self streamSize max: self position)
|
1550
|
+
!
|
1551
|
+
|
1552
|
+
nextPutAll: aCollection
|
1553
|
+
aCollection do: [:each |
|
1554
|
+
self nextPut: each]
|
1555
|
+
! !
|
1556
|
+
|
1557
|
+
!Stream class methodsFor: 'instance creation'!
|
1558
|
+
|
1559
|
+
on: aCollection
|
1560
|
+
^self new
|
1561
|
+
setCollection: aCollection;
|
1562
|
+
setStreamSize: aCollection size;
|
1563
|
+
yourself
|
1564
|
+
! !
|
1565
|
+
|
1566
|
+
Stream subclass: #StringStream
|
1567
|
+
instanceVariableNames: ''
|
1568
|
+
package: 'Kernel-Collections'!
|
1569
|
+
|
1570
|
+
!StringStream methodsFor: 'reading'!
|
1571
|
+
|
1572
|
+
next: anInteger
|
1573
|
+
| tempCollection |
|
1574
|
+
tempCollection := self collection class new.
|
1575
|
+
anInteger timesRepeat: [
|
1576
|
+
self atEnd ifFalse: [
|
1577
|
+
tempCollection := tempCollection, self next]].
|
1578
|
+
^tempCollection
|
1579
|
+
! !
|
1580
|
+
|
1581
|
+
!StringStream methodsFor: 'writing'!
|
1582
|
+
|
1583
|
+
cr
|
1584
|
+
^self nextPutAll: String cr
|
1585
|
+
!
|
1586
|
+
|
1587
|
+
crlf
|
1588
|
+
^self nextPutAll: String crlf
|
1589
|
+
!
|
1590
|
+
|
1591
|
+
lf
|
1592
|
+
^self nextPutAll: String lf
|
1593
|
+
!
|
1594
|
+
|
1595
|
+
nextPut: aString
|
1596
|
+
self nextPutAll: aString
|
1597
|
+
!
|
1598
|
+
|
1599
|
+
nextPutAll: aString
|
1600
|
+
self setCollection:
|
1601
|
+
(self collection copyFrom: 1 to: self position),
|
1602
|
+
aString,
|
1603
|
+
(self collection copyFrom: (self position + 1 + aString size) to: self collection size).
|
1604
|
+
self position: self position + aString size.
|
1605
|
+
self setStreamSize: (self streamSize max: self position)
|
1606
|
+
!
|
1607
|
+
|
1608
|
+
space
|
1609
|
+
self nextPut: ' '
|
1610
|
+
! !
|
1611
|
+
|