pione 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +94 -0
- data/Rakefile +118 -0
- data/bin/pione-broker +5 -0
- data/bin/pione-clean +5 -0
- data/bin/pione-client +5 -0
- data/bin/pione-eval +111 -0
- data/bin/pione-relay +5 -0
- data/bin/pione-relay-account-db +5 -0
- data/bin/pione-relay-client-db +5 -0
- data/bin/pione-search-log +30 -0
- data/bin/pione-syntax-checker +5 -0
- data/bin/pione-task-worker +5 -0
- data/bin/pione-tuple-space-provider +5 -0
- data/bin/pione-tuple-space-receiver +5 -0
- data/bin/pione-tuple-space-viewer +5 -0
- data/demo/demo.rb +311 -0
- data/demo/public/base.css +94 -0
- data/demo/public/demo.js +107 -0
- data/demo/public/index.html +91 -0
- data/demo/public/jquery-1.8.3.min.js +2 -0
- data/example/CountChar/CountChar.pione +64 -0
- data/example/CountChar/misc/CountChar.rb +22 -0
- data/example/CountChar/text/aidokushono_insho.txt +32 -0
- data/example/CountChar/text/aikokuka_shokan.txt +108 -0
- data/example/CountChar/text/carlyle_hakubutsukan.txt +58 -0
- data/example/CountChar/text/dark_minister.txt +2440 -0
- data/example/CountChar/text/kaikano_otto.txt +61 -0
- data/example/CountChar/text/kaikon.txt +30 -0
- data/example/CountChar/text/nagashimano_shi.txt +45 -0
- data/example/CountChar/text/saikachibuchi.txt +80 -0
- data/example/CountChar/text/saikonihonno_josei.txt +91 -0
- data/example/CountChar/text/taishojugonenno_bundan.txt +21 -0
- data/example/FeatureExample/FeatureExample.pione +7 -0
- data/example/Fib/Fib.pione +56 -0
- data/example/Fib/FibBC.pione +56 -0
- data/example/HelloWorld/HelloWorld.pione +5 -0
- data/example/LucasNumber/LucasNumber.pione +64 -0
- data/example/MakePair/MakePair.pione +14 -0
- data/example/MakePair/data/1.i +0 -0
- data/example/MakePair/data/2.i +0 -0
- data/example/MakePair/data/3.i +0 -0
- data/example/MakePair/data/4.i +0 -0
- data/example/MakePair/data/5.i +0 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +61 -0
- data/example/SingleParticlesWithRef/Makefile +289 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.Makefile +153 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +116 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRefFull.pione +400 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift.pdb +3381 -0
- data/example/SingleParticlesWithRef/data/all.ref2d +0 -0
- data/example/SingleParticlesWithRef/data/all.ref3d +0 -0
- data/example/Sum/Sum.pione +52 -0
- data/example/SyntaxError/call_rule_error.pione +6 -0
- data/example/SyntaxError/feature_line_error.pione +7 -0
- data/example/SyntaxError/flow_block_error.pione +5 -0
- data/example/SyntaxError/input_line_error.pione +6 -0
- data/example/SyntaxError/invalid_rule_name.pione +6 -0
- data/example/SyntaxError/param_line_error.pione +7 -0
- data/example/SyntaxError/variable-binding-error.pione +11 -0
- data/lib/pione.rb +241 -0
- data/lib/pione/agent/basic-agent.rb +333 -0
- data/lib/pione/agent/broker.rb +274 -0
- data/lib/pione/agent/command-listener.rb +47 -0
- data/lib/pione/agent/input-generator.rb +194 -0
- data/lib/pione/agent/logger.rb +65 -0
- data/lib/pione/agent/process-manager.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +64 -0
- data/lib/pione/agent/task-worker.rb +274 -0
- data/lib/pione/agent/trivial-routine-worker.rb +28 -0
- data/lib/pione/agent/tuple-space-client.rb +146 -0
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +29 -0
- data/lib/pione/command-option/basic-option.rb +42 -0
- data/lib/pione/command-option/child-process-option.rb +17 -0
- data/lib/pione/command-option/common-option.rb +29 -0
- data/lib/pione/command-option/daemon-option.rb +12 -0
- data/lib/pione/command-option/presence-notifier-option.rb +15 -0
- data/lib/pione/command-option/task-worker-owner-option.rb +17 -0
- data/lib/pione/command-option/tuple-space-provider-option.rb +26 -0
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +16 -0
- data/lib/pione/command-option/tuple-space-receiver-option.rb +12 -0
- data/lib/pione/command/basic-command.rb +126 -0
- data/lib/pione/command/child-process.rb +43 -0
- data/lib/pione/command/daemon-process.rb +18 -0
- data/lib/pione/command/front-owner-command.rb +37 -0
- data/lib/pione/command/pione-broker.rb +53 -0
- data/lib/pione/command/pione-clean.rb +16 -0
- data/lib/pione/command/pione-client.rb +273 -0
- data/lib/pione/command/pione-relay-account-db.rb +85 -0
- data/lib/pione/command/pione-relay-client-db.rb +80 -0
- data/lib/pione/command/pione-relay.rb +47 -0
- data/lib/pione/command/pione-syntax-checker.rb +103 -0
- data/lib/pione/command/pione-task-worker.rb +123 -0
- data/lib/pione/command/pione-tuple-space-provider.rb +87 -0
- data/lib/pione/command/pione-tuple-space-receiver.rb +55 -0
- data/lib/pione/command/pione-tuple-space-viewer.rb +151 -0
- data/lib/pione/command/tuple-space-provider-owner.rb +6 -0
- data/lib/pione/front/basic-front.rb +64 -0
- data/lib/pione/front/broker-front.rb +30 -0
- data/lib/pione/front/client-front.rb +28 -0
- data/lib/pione/front/relay-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +16 -0
- data/lib/pione/front/task-worker-owner.rb +42 -0
- data/lib/pione/front/tuple-space-provider-front.rb +22 -0
- data/lib/pione/front/tuple-space-provider-owner.rb +11 -0
- data/lib/pione/front/tuple-space-receiver-front.rb +18 -0
- data/lib/pione/model/assignment.rb +89 -0
- data/lib/pione/model/basic-model.rb +395 -0
- data/lib/pione/model/binary-operator.rb +80 -0
- data/lib/pione/model/block.rb +233 -0
- data/lib/pione/model/boolean.rb +138 -0
- data/lib/pione/model/call-rule.rb +69 -0
- data/lib/pione/model/data-expr.rb +360 -0
- data/lib/pione/model/feature-expr.rb +794 -0
- data/lib/pione/model/float.rb +107 -0
- data/lib/pione/model/integer.rb +140 -0
- data/lib/pione/model/list.rb +104 -0
- data/lib/pione/model/message.rb +80 -0
- data/lib/pione/model/package.rb +48 -0
- data/lib/pione/model/parameters.rb +282 -0
- data/lib/pione/model/rule-expr.rb +120 -0
- data/lib/pione/model/rule-io.rb +166 -0
- data/lib/pione/model/rule.rb +294 -0
- data/lib/pione/model/string.rb +111 -0
- data/lib/pione/model/undefined-value.rb +24 -0
- data/lib/pione/model/variable-table.rb +315 -0
- data/lib/pione/model/variable.rb +87 -0
- data/lib/pione/parser/block-parser.rb +83 -0
- data/lib/pione/parser/common-parser.rb +145 -0
- data/lib/pione/parser/document-parser.rb +58 -0
- data/lib/pione/parser/error-message.yml +4 -0
- data/lib/pione/parser/expr-parser.rb +266 -0
- data/lib/pione/parser/feature-expr-parser.rb +105 -0
- data/lib/pione/parser/flow-element-parser.rb +181 -0
- data/lib/pione/parser/literal-parser.rb +182 -0
- data/lib/pione/parser/rule-definition-parser.rb +163 -0
- data/lib/pione/parser/syntax-error.rb +61 -0
- data/lib/pione/patch/array-patch.rb +3 -0
- data/lib/pione/patch/drb-patch.rb +467 -0
- data/lib/pione/patch/monitor-patch.rb +16 -0
- data/lib/pione/patch/rinda-patch.rb +759 -0
- data/lib/pione/patch/uri-patch.rb +66 -0
- data/lib/pione/relay/receiver-socket.rb +69 -0
- data/lib/pione/relay/relay-account-db.rb +55 -0
- data/lib/pione/relay/relay-client-db.rb +53 -0
- data/lib/pione/relay/relay-socket.rb +215 -0
- data/lib/pione/relay/trampoline.rb +22 -0
- data/lib/pione/relay/transmitter-socket.rb +167 -0
- data/lib/pione/resource/basic-resource.rb +92 -0
- data/lib/pione/resource/dropbox-resource.rb +106 -0
- data/lib/pione/resource/ftp.rb +84 -0
- data/lib/pione/resource/local.rb +113 -0
- data/lib/pione/rule-handler/action-handler.rb +184 -0
- data/lib/pione/rule-handler/basic-handler.rb +217 -0
- data/lib/pione/rule-handler/flow-handler.rb +339 -0
- data/lib/pione/rule-handler/root-handler.rb +23 -0
- data/lib/pione/rule-handler/system-handler.rb +13 -0
- data/lib/pione/system/common.rb +22 -0
- data/lib/pione/system/config.rb +20 -0
- data/lib/pione/system/document.rb +81 -0
- data/lib/pione/system/file-cache.rb +150 -0
- data/lib/pione/system/global.rb +346 -0
- data/lib/pione/system/identifier.rb +61 -0
- data/lib/pione/system/init.rb +16 -0
- data/lib/pione/system/object.rb +35 -0
- data/lib/pione/transformer/block-transformer.rb +23 -0
- data/lib/pione/transformer/document-transformer.rb +36 -0
- data/lib/pione/transformer/expr-transformer.rb +89 -0
- data/lib/pione/transformer/feature-expr-transformer.rb +56 -0
- data/lib/pione/transformer/flow-element-transformer.rb +66 -0
- data/lib/pione/transformer/literal-transformer.rb +76 -0
- data/lib/pione/transformer/rule-definition-transformer.rb +62 -0
- data/lib/pione/transformer/transformer-module.rb +37 -0
- data/lib/pione/tuple-space/data-finder.rb +165 -0
- data/lib/pione/tuple-space/presence-notifier.rb +83 -0
- data/lib/pione/tuple-space/relay.rb +9 -0
- data/lib/pione/tuple-space/tuple-space-provider.rb +85 -0
- data/lib/pione/tuple-space/tuple-space-receiver.rb +140 -0
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +60 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +156 -0
- data/lib/pione/tuple-space/update-criteria.rb +96 -0
- data/lib/pione/tuple/agent-tuple.rb +10 -0
- data/lib/pione/tuple/attribute-tuple.rb +7 -0
- data/lib/pione/tuple/base-uri-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +317 -0
- data/lib/pione/tuple/bye-tuple.rb +9 -0
- data/lib/pione/tuple/command-tuple.rb +9 -0
- data/lib/pione/tuple/data-tuple.rb +18 -0
- data/lib/pione/tuple/dry-run-tuple.rb +8 -0
- data/lib/pione/tuple/exception-tuple.rb +11 -0
- data/lib/pione/tuple/finished-tuple.rb +17 -0
- data/lib/pione/tuple/foreground-tuple.rb +7 -0
- data/lib/pione/tuple/log-tuple.rb +14 -0
- data/lib/pione/tuple/process-info-tuple.rb +9 -0
- data/lib/pione/tuple/request-rule-tuple.rb +9 -0
- data/lib/pione/tuple/rule-tuple.rb +10 -0
- data/lib/pione/tuple/shift-tuple.rb +13 -0
- data/lib/pione/tuple/task-tuple.rb +36 -0
- data/lib/pione/tuple/task-worker-resource-tuple.rb +9 -0
- data/lib/pione/tuple/working-tuple.rb +13 -0
- data/lib/pione/uri-scheme/basic-scheme.rb +40 -0
- data/lib/pione/uri-scheme/broadcast-scheme.rb +11 -0
- data/lib/pione/uri-scheme/dropbox-scheme.rb +9 -0
- data/lib/pione/uri-scheme/local-scheme.rb +28 -0
- data/lib/pione/util/error-report.rb +12 -0
- data/lib/pione/util/log.rb +79 -0
- data/lib/pione/util/message.rb +155 -0
- data/lib/pione/util/misc.rb +73 -0
- data/lib/pione/util/terminal.rb +78 -0
- data/lib/pione/util/waiter-table.rb +53 -0
- data/lib/pione/version.rb +3 -0
- data/misc/env.sh +2 -0
- data/misc/test-drb-stop-service.rb +34 -0
- data/misc/test-ensure-and-thread-kill.rb +40 -0
- data/misc/test-many-waiters-client.rb +56 -0
- data/misc/test-many-waiters-server.rb +14 -0
- data/misc/write_and_take_test.png +0 -0
- data/misc/write_and_take_test.rb +36 -0
- data/pione.gemspec +49 -0
- data/test/agent/spec_basic-agent.rb +170 -0
- data/test/agent/spec_broker.rb +36 -0
- data/test/agent/spec_command-listener.rb +30 -0
- data/test/agent/spec_input-generator.rb +123 -0
- data/test/agent/spec_logger.rb +71 -0
- data/test/agent/spec_rule-provider.rb +65 -0
- data/test/agent/spec_task-worker.rb +307 -0
- data/test/agent/spec_tuple-space-client.rb +30 -0
- data/test/model/spec_assignment.rb +51 -0
- data/test/model/spec_binary-operator.rb +39 -0
- data/test/model/spec_block.rb +154 -0
- data/test/model/spec_boolean.rb +115 -0
- data/test/model/spec_call-rule.rb +23 -0
- data/test/model/spec_data-expr.rb +312 -0
- data/test/model/spec_feature-expr.rb +359 -0
- data/test/model/spec_feature-expr.yml +16 -0
- data/test/model/spec_float.rb +141 -0
- data/test/model/spec_integer.rb +141 -0
- data/test/model/spec_list.rb +26 -0
- data/test/model/spec_message.rb +42 -0
- data/test/model/spec_package.rb +15 -0
- data/test/model/spec_parameters.rb +148 -0
- data/test/model/spec_rule-expr.rb +66 -0
- data/test/model/spec_rule-io.rb +32 -0
- data/test/model/spec_rule.rb +158 -0
- data/test/model/spec_string.rb +106 -0
- data/test/model/spec_variable-table.rb +117 -0
- data/test/model/spec_variable.rb +84 -0
- data/test/parser/spec_block-parser.rb +5 -0
- data/test/parser/spec_block-parser.yml +85 -0
- data/test/parser/spec_common-parser.rb +281 -0
- data/test/parser/spec_expr-parser.rb +6 -0
- data/test/parser/spec_expr-parser.yml +82 -0
- data/test/parser/spec_feature-expr-parser.rb +32 -0
- data/test/parser/spec_feature-expr-parser.yml +25 -0
- data/test/parser/spec_flow-element-parser.rb +5 -0
- data/test/parser/spec_flow-element-parser.yml +180 -0
- data/test/parser/spec_literal-parser.rb +5 -0
- data/test/parser/spec_literal-parser.yml +123 -0
- data/test/parser/spec_rule-definition-parser.rb +5 -0
- data/test/parser/spec_rule-definition-parser.yml +93 -0
- data/test/patch/spec_rinda-patch.rb +32 -0
- data/test/patch/spec_uri-patch.rb +23 -0
- data/test/rule-handler/spec_action-handler.rb +135 -0
- data/test/rule-handler/spec_flow-handler.rb +127 -0
- data/test/spec_common.rb +14 -0
- data/test/spec_data-finder.rb +88 -0
- data/test/spec_data-finder.yml +115 -0
- data/test/spec_document.rb +76 -0
- data/test/spec_identifier.rb +29 -0
- data/test/spec_log.rb +52 -0
- data/test/spec_object.rb +20 -0
- data/test/spec_resource.rb +73 -0
- data/test/spec_update-criteria.rb +83 -0
- data/test/test-util.rb +223 -0
- data/test/transformer/spec_block-transformer.rb +26 -0
- data/test/transformer/spec_expr-transformer.rb +106 -0
- data/test/transformer/spec_feature-expr-transformer.rb +21 -0
- data/test/transformer/spec_flow-element-transformer.rb +154 -0
- data/test/transformer/spec_literal-transformer.rb +58 -0
- data/test/transformer/spec_rule-definition-transformer.rb +168 -0
- data/test/tuple-space/spec_tuple-space-provider.rb +36 -0
- data/test/tuple-space/spec_tuple-space-receiver.rb +32 -0
- data/test/tuple-space/spec_tuple-space-server.rb +49 -0
- data/test/tuple/spec_basic-tuple.rb +87 -0
- data/test/tuple/spec_data-tuple.rb +85 -0
- data/test/tuple/spec_finished-tuple.rb +61 -0
- data/test/tuple/spec_task-tuple.rb +127 -0
- data/test/tuple/spec_working-tuple.rb +58 -0
- data/test/uri-scheme/spec_broadcast-scheme.rb +40 -0
- data/test/uri-scheme/spec_dropbox-scheme.rb +31 -0
- data/test/uri-scheme/spec_local-scheme.rb +69 -0
- metadata +660 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
module Pione
|
|
2
|
+
module Model
|
|
3
|
+
# PioneModelTypeError represents type mismatch error in PIONE modle object system.
|
|
4
|
+
class PioneModelTypeError < StandardError
|
|
5
|
+
# Creates an exception.
|
|
6
|
+
# @param [BasicModel] obj PIONE model object
|
|
7
|
+
# @param [Type] type expected type
|
|
8
|
+
def initialize(obj, type)
|
|
9
|
+
@obj = obj
|
|
10
|
+
@type = type
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @api private
|
|
14
|
+
def message
|
|
15
|
+
args = [
|
|
16
|
+
@type.type_string,
|
|
17
|
+
@obj.pione_model_type.type_string,
|
|
18
|
+
@obj.line,
|
|
19
|
+
@obj.column
|
|
20
|
+
]
|
|
21
|
+
"expected %s, but got %s(line: %s, column: %s)" % args
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# MethodNotFound is an exception class for the case of method missing.
|
|
26
|
+
class MethodNotFound < StandardError
|
|
27
|
+
attr_reader :name
|
|
28
|
+
attr_reader :obj
|
|
29
|
+
|
|
30
|
+
# Creates an exception.
|
|
31
|
+
# @param [String, Symbol] name
|
|
32
|
+
# method name
|
|
33
|
+
# @param [BasicModel] obj
|
|
34
|
+
# method reciever
|
|
35
|
+
def initialize(name, obj)
|
|
36
|
+
@name = name
|
|
37
|
+
@obj = obj
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @api private
|
|
41
|
+
def message
|
|
42
|
+
str = nil
|
|
43
|
+
begin
|
|
44
|
+
str = @obj.call_pione_method("as_string")
|
|
45
|
+
rescue => e
|
|
46
|
+
str = @obj.to_s
|
|
47
|
+
end
|
|
48
|
+
"method \"%s\" is not found in %s" % [@name, str]
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Type is a class for type expression of PIONE model objects.
|
|
53
|
+
class Type < System::PioneObject
|
|
54
|
+
attr_reader :type_string
|
|
55
|
+
attr_reader :method_interface
|
|
56
|
+
attr_reader :method_body
|
|
57
|
+
|
|
58
|
+
# Creates a type for PIONE model object.
|
|
59
|
+
# @param [Symbol] type_string
|
|
60
|
+
# PIONE model type
|
|
61
|
+
def initialize(type_string)
|
|
62
|
+
@type_string = type_string
|
|
63
|
+
@method_interface = {}
|
|
64
|
+
@method_body = {}
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Return true if the type or the pione model object matches.
|
|
68
|
+
# @param [Type, BasicModel] other
|
|
69
|
+
# type or object for match test target
|
|
70
|
+
# @return [Boolean]
|
|
71
|
+
# true if it matches, or false
|
|
72
|
+
def match(other)
|
|
73
|
+
case other
|
|
74
|
+
when Type
|
|
75
|
+
other == TypeAny || @type_string == other.type_string
|
|
76
|
+
when BasicModel
|
|
77
|
+
match(other.pione_model_type)
|
|
78
|
+
when nil
|
|
79
|
+
# do nothing
|
|
80
|
+
else
|
|
81
|
+
raise ArgumentError.new(other)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Defines PIONE model object methods.
|
|
86
|
+
# @param [String] name
|
|
87
|
+
# method name
|
|
88
|
+
# @param [Array<Type>] inputs
|
|
89
|
+
# input types of the method
|
|
90
|
+
# @param [Type] output
|
|
91
|
+
# output type of the method
|
|
92
|
+
# @param [Proc] b
|
|
93
|
+
# @return [void]
|
|
94
|
+
def define_pione_method(name, inputs, output, &b)
|
|
95
|
+
raise ArgumentError.new(inputs) unless inputs.kind_of?(Array)
|
|
96
|
+
raise ArgumentError.new(inputs) unless inputs.all?{|input|
|
|
97
|
+
input.kind_of?(Type)
|
|
98
|
+
}
|
|
99
|
+
raise ArgumentError.new(output) unless output.kind_of?(Type)
|
|
100
|
+
@method_interface[name] = PioneMethodInterface.new(inputs, output)
|
|
101
|
+
@method_body[name] = b
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Returns true if the data has the type.
|
|
105
|
+
# @return [void]
|
|
106
|
+
def check(data)
|
|
107
|
+
unless match(data.pione_model_type)
|
|
108
|
+
raise PioneModelTypeError.new(data, self)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# @api private
|
|
113
|
+
def to_s
|
|
114
|
+
"#<Type %s>" % @type_string
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# @api private
|
|
118
|
+
def ==(other)
|
|
119
|
+
@type_string == other.type_string
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# @api private
|
|
123
|
+
def hash
|
|
124
|
+
@type_string.hash
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
class VariableType
|
|
129
|
+
def initialize(name)
|
|
130
|
+
@name = name
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# TypeList represetnts list type of element type.
|
|
135
|
+
class TypeList < Type
|
|
136
|
+
attr_reader :element_type
|
|
137
|
+
|
|
138
|
+
# @api private
|
|
139
|
+
@table = {}
|
|
140
|
+
|
|
141
|
+
class << self
|
|
142
|
+
def [](type)
|
|
143
|
+
if @table.has_key?(type)
|
|
144
|
+
return @table[type]
|
|
145
|
+
else
|
|
146
|
+
t = new(type)
|
|
147
|
+
@table[type] = t
|
|
148
|
+
return t
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def initialize(element_type)
|
|
154
|
+
@element_type = element_type
|
|
155
|
+
super("[%s]" % [element_type.type_string])
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def match(other)
|
|
159
|
+
return false unless other.kind_of?(TypeList)
|
|
160
|
+
@element_type.match(other.element_type)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def method_body
|
|
164
|
+
if self == self.class[TypeAny]
|
|
165
|
+
@method_body
|
|
166
|
+
else
|
|
167
|
+
self.class[TypeAny].method_body
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def method_interface
|
|
172
|
+
if self == self.class[TypeAny]
|
|
173
|
+
@method_interface
|
|
174
|
+
else
|
|
175
|
+
self.class[TypeAny].method_interface
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# PioneMethodInterface represents type of PIONE object's methods.
|
|
181
|
+
class PioneMethodInterface < Pione::PioneObject
|
|
182
|
+
attr_reader :inputs
|
|
183
|
+
attr_reader :output
|
|
184
|
+
|
|
185
|
+
# Creates an interface for a pione method.
|
|
186
|
+
# @param [Array<Type>] inputs
|
|
187
|
+
# inputs type definition
|
|
188
|
+
# @param [Type] output
|
|
189
|
+
# ouutput type definition
|
|
190
|
+
def initialize(inputs, output)
|
|
191
|
+
@inputs = inputs
|
|
192
|
+
@output = output
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Validates inputs data types for the method.
|
|
196
|
+
# @return [void]
|
|
197
|
+
def validate_inputs(*args)
|
|
198
|
+
@inputs.each_with_index do |input, i|
|
|
199
|
+
unless input.match(args[i].pione_model_type)
|
|
200
|
+
raise PioneModelTypeError.new(args[i], input)
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Validates output data type for the method.
|
|
206
|
+
# @return [void]
|
|
207
|
+
def validate_output(value)
|
|
208
|
+
@output.match(value.pione_model_type)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# boolean type for PIONE system
|
|
213
|
+
TypeBoolean = Type.new("boolean")
|
|
214
|
+
|
|
215
|
+
# integer type for PIONE system
|
|
216
|
+
TypeInteger = Type.new("integer")
|
|
217
|
+
|
|
218
|
+
# float type for PIONE system
|
|
219
|
+
TypeFloat = Type.new("float")
|
|
220
|
+
|
|
221
|
+
# string type for PIONE system
|
|
222
|
+
TypeString = Type.new("string")
|
|
223
|
+
|
|
224
|
+
# data expression type for PIONE system
|
|
225
|
+
TypeDataExpr = Type.new("data-expr")
|
|
226
|
+
|
|
227
|
+
# feature type for PIONE system
|
|
228
|
+
TypeFeature = Type.new("feature")
|
|
229
|
+
|
|
230
|
+
# rule expression type for PIONE system
|
|
231
|
+
TypeRuleExpr = Type.new("rule-expr")
|
|
232
|
+
|
|
233
|
+
# parameters type for PIONE system
|
|
234
|
+
TypeParameters = Type.new("parameters")
|
|
235
|
+
|
|
236
|
+
# assignment type for PIONE system
|
|
237
|
+
TypeAssignment = Type.new("assignment")
|
|
238
|
+
|
|
239
|
+
# variable table type for PIONE system
|
|
240
|
+
TypeVariableTable = Type.new("variable-table")
|
|
241
|
+
|
|
242
|
+
# package type for PIONE system
|
|
243
|
+
TypePackage = Type.new("package")
|
|
244
|
+
|
|
245
|
+
# undefined value type for PIONE system
|
|
246
|
+
TypeUndefinedValue = Type.new("undefined-value")
|
|
247
|
+
|
|
248
|
+
# rule io list type for PIONE system
|
|
249
|
+
TypeRuleIOList = Type.new("rule-io-list")
|
|
250
|
+
|
|
251
|
+
# rule io element type for PIONE system
|
|
252
|
+
TypeRuleIOElement = Type.new("rule-io-element")
|
|
253
|
+
|
|
254
|
+
# any type for PIONE system
|
|
255
|
+
TypeAny = Type.new("any")
|
|
256
|
+
|
|
257
|
+
def TypeAny.match(other)
|
|
258
|
+
true
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
TypeAny.instance_eval do
|
|
262
|
+
define_pione_method("==", [TypeAny], TypeBoolean) do |res, other|
|
|
263
|
+
if other.pione_model_type == TypeAny && res.name == other.name
|
|
264
|
+
PioneBoolean.true
|
|
265
|
+
else
|
|
266
|
+
raise UnboundVariableError.new(res)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
define_pione_method("!=", [TypeAny], TypeBoolean) do |res, other|
|
|
271
|
+
PioneBoolean.not(res.call_pione_method("==", other))
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# BasicModel is a class for pione model object.
|
|
276
|
+
class BasicModel < Pione::PioneObject
|
|
277
|
+
class << self
|
|
278
|
+
# Sets pione model type of the model.
|
|
279
|
+
# @param [Symbol] type
|
|
280
|
+
# pione model type
|
|
281
|
+
# @return [void]
|
|
282
|
+
def set_pione_model_type(type)
|
|
283
|
+
raise ArgumentError unless type.kind_of?(Type)
|
|
284
|
+
@pione_model_type = type
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Returns the pione model type of the model.
|
|
288
|
+
# @return [Symbol]
|
|
289
|
+
# pione model type
|
|
290
|
+
def pione_model_type
|
|
291
|
+
@pione_model_type
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Defines a pione method.
|
|
295
|
+
# @return [void]
|
|
296
|
+
def define_pione_method(*args, &b)
|
|
297
|
+
@pione_model_type.define_pione_method(*args, &b)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# @api private
|
|
301
|
+
def inherited(subclass)
|
|
302
|
+
if @pione_model_type
|
|
303
|
+
subclass.set_pione_model_type @pione_model_type
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Creates a model object.
|
|
309
|
+
def initialize(&b)
|
|
310
|
+
instance_eval(&b) if block_given?
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# Returns PIONE model type.
|
|
314
|
+
# @return [Symbol]
|
|
315
|
+
# PIONE model type
|
|
316
|
+
def pione_model_type
|
|
317
|
+
self.class.pione_model_type
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# Evaluates the model object in the variable table.
|
|
321
|
+
# @param [VariableTable] vtable
|
|
322
|
+
# variable table for evaluation
|
|
323
|
+
# @return [BasicModel]
|
|
324
|
+
# evaluated object
|
|
325
|
+
def eval(vtable=VariableTable.new)
|
|
326
|
+
return self
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# Returns true if the object is atomic.
|
|
330
|
+
# @return [Boolean]
|
|
331
|
+
# true if the object is atom, or false.
|
|
332
|
+
def atomic?
|
|
333
|
+
true
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Returns true if the object has pione variables.
|
|
337
|
+
# @return [Boolean]
|
|
338
|
+
# true if the object has pione variables, or false
|
|
339
|
+
def include_variable?
|
|
340
|
+
false
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Returns rule definition document path.
|
|
344
|
+
# @return [void]
|
|
345
|
+
def set_document_path(path)
|
|
346
|
+
@__document_path__ = path
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
# Sets line and column number of the definition.
|
|
350
|
+
# @return [void]
|
|
351
|
+
def set_line_and_column(line_and_column)
|
|
352
|
+
@__line__, @__column__ = line_and_column
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
# Returns line number of the model in definition document.
|
|
356
|
+
# @return [Integer]
|
|
357
|
+
# line number
|
|
358
|
+
def line
|
|
359
|
+
@__line__
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Returns coloumn number of the model in definition document.
|
|
363
|
+
# @return [Integer]
|
|
364
|
+
# column number
|
|
365
|
+
def column
|
|
366
|
+
@__column__
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
# Calls pione model object method.
|
|
370
|
+
# @param [String] name
|
|
371
|
+
# method name
|
|
372
|
+
# @param [Array] args
|
|
373
|
+
# method's arguments
|
|
374
|
+
# @return [Object]
|
|
375
|
+
# method's result
|
|
376
|
+
def call_pione_method(name, *args)
|
|
377
|
+
name = name.to_s
|
|
378
|
+
if method = pione_model_type.method_interface[name]
|
|
379
|
+
method.validate_inputs(*args)
|
|
380
|
+
output = pione_model_type.method_body[name].call(self, *args)
|
|
381
|
+
pione_model_type.method_interface[name].validate_output(output)
|
|
382
|
+
return output
|
|
383
|
+
else
|
|
384
|
+
raise MethodNotFound.new(name, self)
|
|
385
|
+
end
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
# Returns itself.
|
|
389
|
+
# @return [BasicModel]
|
|
390
|
+
def to_pione
|
|
391
|
+
self
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
end
|
|
395
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
module Pione::Model
|
|
2
|
+
|
|
3
|
+
# BinaryOperator represents applications between Pione model objects.
|
|
4
|
+
# @example
|
|
5
|
+
# 1 + 1
|
|
6
|
+
# @example
|
|
7
|
+
# true == false
|
|
8
|
+
# @example
|
|
9
|
+
# $X * $Y
|
|
10
|
+
class BinaryOperator < BasicModel
|
|
11
|
+
attr_reader :symbol
|
|
12
|
+
attr_reader :left
|
|
13
|
+
attr_reader :right
|
|
14
|
+
|
|
15
|
+
# Create a binary operator.
|
|
16
|
+
# @param [String] symbol
|
|
17
|
+
# operator's symbol
|
|
18
|
+
# @param [BasicModel] left
|
|
19
|
+
# left operand
|
|
20
|
+
# @param [BasicModel] right
|
|
21
|
+
# right operand
|
|
22
|
+
def initialize(symbol, left, right)
|
|
23
|
+
@symbol = symbol
|
|
24
|
+
@left = left
|
|
25
|
+
@right = right
|
|
26
|
+
super()
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns false because Message has complex form.
|
|
30
|
+
# @return [Boolean]
|
|
31
|
+
# false
|
|
32
|
+
def atomic?
|
|
33
|
+
false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Returns true if the left or right expression includes variable.
|
|
37
|
+
# @return [Boolean]
|
|
38
|
+
# true if the left or right expression includes variable
|
|
39
|
+
def include_variable?
|
|
40
|
+
@left.include_variable? or @right.include_variable?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @api private
|
|
44
|
+
def pione_model_type
|
|
45
|
+
@left.pione_model_type.method_interface[@symbol].output
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Evaluates the application expression and returns application result.
|
|
49
|
+
# @param [VariableTable] vtable
|
|
50
|
+
# variable table for the evaluation
|
|
51
|
+
# @return [BasicModel]
|
|
52
|
+
# evaluation result object
|
|
53
|
+
def eval(vtable)
|
|
54
|
+
left = @left.eval(vtable)
|
|
55
|
+
right = @right.eval(vtable)
|
|
56
|
+
left.call_pione_method(@symbol, right)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @api private
|
|
60
|
+
def textize
|
|
61
|
+
"%s%s%s" % [@left.textize, @symbol.to_s, @right.textize]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @api private
|
|
65
|
+
def ==(other)
|
|
66
|
+
return false unless other.kind_of?(self.class)
|
|
67
|
+
return false unless @symbol == other.symbol
|
|
68
|
+
return false unless @left == other.left
|
|
69
|
+
return false unless @right == other.right
|
|
70
|
+
return true
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
alias :eql? :"=="
|
|
74
|
+
|
|
75
|
+
# @api private
|
|
76
|
+
def hash
|
|
77
|
+
@symbol.hash + @left.hash + @right.hash
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|