jiji 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +58 -0
- data/README +1 -0
- data/base/agents/moving_average_agent.rb +78 -0
- data/base/shared_lib/moving_average.rb +35 -0
- data/base/shared_lib/system/cross.rb +76 -0
- data/base/shared_lib/system/position_manager.rb +160 -0
- data/base/shared_lib/system/signal.rb +347 -0
- data/bin/jiji +5 -0
- data/html/css/calendar.css +432 -0
- data/html/css/datatable.css +299 -0
- data/html/css/default.css +627 -0
- data/html/css/dialog.css +77 -0
- data/html/css/treeview.css +205 -0
- data/html/img/auto_trade_off.gif +0 -0
- data/html/img/auto_trade_on.gif +0 -0
- data/html/img/back_bottom.gif +0 -0
- data/html/img/back_middle.gif +0 -0
- data/html/img/back_top.gif +0 -0
- data/html/img/bin_closed.png +0 -0
- data/html/img/bin_empty.png +0 -0
- data/html/img/bt-create-title-1.gif +0 -0
- data/html/img/bt-create-title-2.gif +0 -0
- data/html/img/bt-create-title-3.gif +0 -0
- data/html/img/button_add.gif +0 -0
- data/html/img/button_add_gray.gif +0 -0
- data/html/img/button_add_over.gif +0 -0
- data/html/img/button_add_small.gif +0 -0
- data/html/img/button_add_small_gray.gif +0 -0
- data/html/img/button_add_small_over.gif +0 -0
- data/html/img/button_apply.gif +0 -0
- data/html/img/button_apply_gray.gif +0 -0
- data/html/img/button_apply_over.gif +0 -0
- data/html/img/button_calendar.gif +0 -0
- data/html/img/button_calendar_over.gif +0 -0
- data/html/img/button_cancel.gif +0 -0
- data/html/img/button_cancel.jpg +0 -0
- data/html/img/button_cancel_gray.gif +0 -0
- data/html/img/button_cancel_over.gif +0 -0
- data/html/img/button_cancel_over.jpg +0 -0
- data/html/img/button_close.gif +0 -0
- data/html/img/button_close_gray.gif +0 -0
- data/html/img/button_close_over.gif +0 -0
- data/html/img/button_mkcol.gif +0 -0
- data/html/img/button_mkcol_gray.gif +0 -0
- data/html/img/button_mkcol_over.gif +0 -0
- data/html/img/button_no.gif +0 -0
- data/html/img/button_no_gray.gif +0 -0
- data/html/img/button_no_over.gif +0 -0
- data/html/img/button_ok.gif +0 -0
- data/html/img/button_ok_gray.gif +0 -0
- data/html/img/button_ok_over.gif +0 -0
- data/html/img/button_remove.gif +0 -0
- data/html/img/button_remove_gray.gif +0 -0
- data/html/img/button_remove_over.gif +0 -0
- data/html/img/button_remove_small.gif +0 -0
- data/html/img/button_remove_small_gray.gif +0 -0
- data/html/img/button_remove_small_over.gif +0 -0
- data/html/img/button_rename.gif +0 -0
- data/html/img/button_rename_gray.gif +0 -0
- data/html/img/button_rename_over.gif +0 -0
- data/html/img/button_save.gif +0 -0
- data/html/img/button_save_gray.gif +0 -0
- data/html/img/button_save_over.gif +0 -0
- data/html/img/button_start.gif +0 -0
- data/html/img/button_start_over.gif +0 -0
- data/html/img/button_update.gif +0 -0
- data/html/img/button_update_gray.gif +0 -0
- data/html/img/button_update_over.gif +0 -0
- data/html/img/button_update_s.gif +0 -0
- data/html/img/button_update_s_gray.gif +0 -0
- data/html/img/button_update_s_over.gif +0 -0
- data/html/img/button_yes.gif +0 -0
- data/html/img/button_yes_gray.gif +0 -0
- data/html/img/button_yes_over.gif +0 -0
- data/html/img/circle.gif +0 -0
- data/html/img/control_play.png +0 -0
- data/html/img/control_play_blue.png +0 -0
- data/html/img/delta.gif +0 -0
- data/html/img/dialog_info.jpg +0 -0
- data/html/img/dialog_input.jpg +0 -0
- data/html/img/dialog_warn.jpg +0 -0
- data/html/img/dt-arrow-dn.png +0 -0
- data/html/img/dt-arrow-up.png +0 -0
- data/html/img/folder.png +0 -0
- data/html/img/folder_brick.png +0 -0
- data/html/img/folder_user.png +0 -0
- data/html/img/foot.jpg +0 -0
- data/html/img/goto.gif +0 -0
- data/html/img/goto_o.gif +0 -0
- data/html/img/h3_bt-create_0.gif +0 -0
- data/html/img/h3_bt-create_1.gif +0 -0
- data/html/img/h3_bt-create_2.gif +0 -0
- data/html/img/h3_result_0.gif +0 -0
- data/html/img/h3_result_1.gif +0 -0
- data/html/img/h3_result_2.gif +0 -0
- data/html/img/h3_result_3.gif +0 -0
- data/html/img/h3_result_4.gif +0 -0
- data/html/img/h3_result_5.gif +0 -0
- data/html/img/h3_result_6.gif +0 -0
- data/html/img/h3_rt-setting_0.gif +0 -0
- data/html/img/h3_rt-setting_1.gif +0 -0
- data/html/img/head.jpg +0 -0
- data/html/img/line-numbers.png +0 -0
- data/html/img/line_white.gif +0 -0
- data/html/img/loading.gif +0 -0
- data/html/img/page_white_ruby.png +0 -0
- data/html/img/panel_100_bottom.gif +0 -0
- data/html/img/panel_100_middle.gif +0 -0
- data/html/img/panel_100_top.gif +0 -0
- data/html/img/panel_140_650_b.gif +0 -0
- data/html/img/panel_140_650_m.gif +0 -0
- data/html/img/panel_140_650_t.gif +0 -0
- data/html/img/panel_140_660_b.gif +0 -0
- data/html/img/panel_140_660_m.gif +0 -0
- data/html/img/panel_140_660_t.gif +0 -0
- data/html/img/panel_140_b.gif +0 -0
- data/html/img/panel_140_m.gif +0 -0
- data/html/img/panel_140_t.gif +0 -0
- data/html/img/panel_260_b.gif +0 -0
- data/html/img/panel_260_m.gif +0 -0
- data/html/img/panel_260_t.gif +0 -0
- data/html/img/panel_300_b.gif +0 -0
- data/html/img/panel_300_m.gif +0 -0
- data/html/img/panel_300_t.gif +0 -0
- data/html/img/panel_320_b.gif +0 -0
- data/html/img/panel_320_m.gif +0 -0
- data/html/img/panel_320_t.gif +0 -0
- data/html/img/panel_360_b.gif +0 -0
- data/html/img/panel_360_m.gif +0 -0
- data/html/img/panel_360_t.gif +0 -0
- data/html/img/panel_380_b.gif +0 -0
- data/html/img/panel_380_m.gif +0 -0
- data/html/img/panel_380_t.gif +0 -0
- data/html/img/panel_500_b.gif +0 -0
- data/html/img/panel_500_m.gif +0 -0
- data/html/img/panel_500_t.gif +0 -0
- data/html/img/panel_620_b.gif +0 -0
- data/html/img/panel_620_m.gif +0 -0
- data/html/img/panel_620_t.gif +0 -0
- data/html/img/panel_780_b.gif +0 -0
- data/html/img/panel_780_m.gif +0 -0
- data/html/img/panel_780_t.gif +0 -0
- data/html/img/problem.gif +0 -0
- data/html/img/progressbar.gif +0 -0
- data/html/img/result-title-1-1.gif +0 -0
- data/html/img/result-title-1-2.gif +0 -0
- data/html/img/result-title-2-1.gif +0 -0
- data/html/img/result-title-2-2.gif +0 -0
- data/html/img/result-title-3-1.gif +0 -0
- data/html/img/result-title-4-1.gif +0 -0
- data/html/img/rt-setting-title-1.gif +0 -0
- data/html/img/rt-setting-title-2.gif +0 -0
- data/html/img/s.gif +0 -0
- data/html/img/scroll.gif +0 -0
- data/html/img/separator.gif +0 -0
- data/html/img/sidebar_agent.png +0 -0
- data/html/img/sidebar_agent_edit.png +0 -0
- data/html/img/sidebar_agent_edit_agent.png +0 -0
- data/html/img/sidebar_agent_edit_agent_over.png +0 -0
- data/html/img/sidebar_agent_edit_agent_s.png +0 -0
- data/html/img/sidebar_agent_edit_over.png +0 -0
- data/html/img/sidebar_agent_edit_s.png +0 -0
- data/html/img/sidebar_agent_edit_shared_lib.png +0 -0
- data/html/img/sidebar_agent_edit_shared_lib_over.png +0 -0
- data/html/img/sidebar_agent_edit_shared_lib_s.png +0 -0
- data/html/img/sidebar_back.gif +0 -0
- data/html/img/sidebar_bt.png +0 -0
- data/html/img/sidebar_bt_create.png +0 -0
- data/html/img/sidebar_bt_create_over.png +0 -0
- data/html/img/sidebar_bt_create_s.png +0 -0
- data/html/img/sidebar_bt_result.png +0 -0
- data/html/img/sidebar_bt_result_over.png +0 -0
- data/html/img/sidebar_bt_result_s.png +0 -0
- data/html/img/sidebar_result_rmt.png +0 -0
- data/html/img/sidebar_result_rmt_over.png +0 -0
- data/html/img/sidebar_result_rmt_s.png +0 -0
- data/html/img/sidebar_rt.png +0 -0
- data/html/img/sidebar_rt_setting.png +0 -0
- data/html/img/sidebar_rt_setting_over.png +0 -0
- data/html/img/sidebar_rt_setting_s.png +0 -0
- data/html/img/sprite.png +0 -0
- data/html/img/submenu_agents.png +0 -0
- data/html/img/submenu_agents_over.png +0 -0
- data/html/img/submenu_agents_s.png +0 -0
- data/html/img/submenu_graph.png +0 -0
- data/html/img/submenu_graph_over.png +0 -0
- data/html/img/submenu_graph_s.png +0 -0
- data/html/img/submenu_info.png +0 -0
- data/html/img/submenu_info_over.png +0 -0
- data/html/img/submenu_info_s.png +0 -0
- data/html/img/submenu_log.png +0 -0
- data/html/img/submenu_log_over.png +0 -0
- data/html/img/submenu_log_s.png +0 -0
- data/html/img/submenu_operation.png +0 -0
- data/html/img/submenu_operation_over.png +0 -0
- data/html/img/submenu_operation_s.png +0 -0
- data/html/img/submenu_trade.png +0 -0
- data/html/img/submenu_trade_over.png +0 -0
- data/html/img/submenu_trade_s.png +0 -0
- data/html/img/td_over.gif +0 -0
- data/html/img/td_over_d.gif +0 -0
- data/html/img/td_selected.gif +0 -0
- data/html/img/thead.gif +0 -0
- data/html/img/transparent.gif +0 -0
- data/html/img/yui/treeview-sprite.gif +0 -0
- data/html/index.html +492 -0
- data/html/js/agent-editor/agent-editor-page.js +324 -0
- data/html/js/agent-editor/agent-editor.js +363 -0
- data/html/js/agent-editor/agent-list-tree.js +251 -0
- data/html/js/agent-selector.js +666 -0
- data/html/js/app.js +198 -0
- data/html/js/bt-create-page.js +205 -0
- data/html/js/container-min.js +1 -0
- data/html/js/container-utils.js +78 -0
- data/html/js/container.js +944 -0
- data/html/js/dialog.js +279 -0
- data/html/js/edit_area/autocompletion.js +491 -0
- data/html/js/edit_area/edit_area.css +546 -0
- data/html/js/edit_area/edit_area.js +539 -0
- data/html/js/edit_area/edit_area_compressor.php +408 -0
- data/html/js/edit_area/edit_area_full.gz +0 -0
- data/html/js/edit_area/edit_area_full.js +38 -0
- data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
- data/html/js/edit_area/edit_area_full_with_plugins.js +39 -0
- data/html/js/edit_area/edit_area_functions.js +1205 -0
- data/html/js/edit_area/edit_area_loader.js +1082 -0
- data/html/js/edit_area/elements_functions.js +334 -0
- data/html/js/edit_area/highlight.js +391 -0
- data/html/js/edit_area/images/autocompletion.gif +0 -0
- data/html/js/edit_area/images/close.gif +0 -0
- data/html/js/edit_area/images/fullscreen.gif +0 -0
- data/html/js/edit_area/images/go_to_line.gif +0 -0
- data/html/js/edit_area/images/goto.png +0 -0
- data/html/js/edit_area/images/help.gif +0 -0
- data/html/js/edit_area/images/help.png +0 -0
- data/html/js/edit_area/images/highlight.gif +0 -0
- data/html/js/edit_area/images/load.gif +0 -0
- data/html/js/edit_area/images/move.gif +0 -0
- data/html/js/edit_area/images/newdocument.gif +0 -0
- data/html/js/edit_area/images/opacity.png +0 -0
- data/html/js/edit_area/images/processing.gif +0 -0
- data/html/js/edit_area/images/redo.gif +0 -0
- data/html/js/edit_area/images/redo.png +0 -0
- data/html/js/edit_area/images/reset_highlight.gif +0 -0
- data/html/js/edit_area/images/save.gif +0 -0
- data/html/js/edit_area/images/save.png +0 -0
- data/html/js/edit_area/images/search.gif +0 -0
- data/html/js/edit_area/images/search.png +0 -0
- data/html/js/edit_area/images/smooth_selection.gif +0 -0
- data/html/js/edit_area/images/spacer.gif +0 -0
- data/html/js/edit_area/images/statusbar_resize.gif +0 -0
- data/html/js/edit_area/images/undo.gif +0 -0
- data/html/js/edit_area/images/undo.png +0 -0
- data/html/js/edit_area/images/word_wrap.gif +0 -0
- data/html/js/edit_area/keyboard.js +145 -0
- data/html/js/edit_area/langs/bg.js +73 -0
- data/html/js/edit_area/langs/cs.js +67 -0
- data/html/js/edit_area/langs/de.js +67 -0
- data/html/js/edit_area/langs/dk.js +67 -0
- data/html/js/edit_area/langs/en.js +67 -0
- data/html/js/edit_area/langs/eo.js +67 -0
- data/html/js/edit_area/langs/es.js +64 -0
- data/html/js/edit_area/langs/fi.js +67 -0
- data/html/js/edit_area/langs/fr.js +67 -0
- data/html/js/edit_area/langs/hr.js +67 -0
- data/html/js/edit_area/langs/it.js +67 -0
- data/html/js/edit_area/langs/ja.js +67 -0
- data/html/js/edit_area/langs/mk.js +67 -0
- data/html/js/edit_area/langs/nl.js +67 -0
- data/html/js/edit_area/langs/pl.js +67 -0
- data/html/js/edit_area/langs/pt.js +67 -0
- data/html/js/edit_area/langs/ru.js +67 -0
- data/html/js/edit_area/langs/sk.js +67 -0
- data/html/js/edit_area/langs/zh.js +67 -0
- data/html/js/edit_area/license_apache.txt +7 -0
- data/html/js/edit_area/license_bsd.txt +10 -0
- data/html/js/edit_area/license_lgpl.txt +458 -0
- data/html/js/edit_area/manage_area.js +623 -0
- data/html/js/edit_area/plugins/charmap/charmap.js +90 -0
- data/html/js/edit_area/plugins/charmap/css/charmap.css +64 -0
- data/html/js/edit_area/plugins/charmap/images/charmap.gif +0 -0
- data/html/js/edit_area/plugins/charmap/jscripts/map.js +373 -0
- data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
- data/html/js/edit_area/plugins/charmap/langs/cs.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/de.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/dk.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/en.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/eo.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/es.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/fr.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/hr.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/it.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/ja.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/mk.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/nl.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/pl.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/pt.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/ru.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/sk.js +6 -0
- data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
- data/html/js/edit_area/plugins/charmap/popup.html +24 -0
- data/html/js/edit_area/plugins/test/css/test.css +3 -0
- data/html/js/edit_area/plugins/test/images/Thumbs.db +0 -0
- data/html/js/edit_area/plugins/test/images/test.gif +0 -0
- data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
- data/html/js/edit_area/plugins/test/langs/cs.js +4 -0
- data/html/js/edit_area/plugins/test/langs/de.js +4 -0
- data/html/js/edit_area/plugins/test/langs/dk.js +4 -0
- data/html/js/edit_area/plugins/test/langs/en.js +4 -0
- data/html/js/edit_area/plugins/test/langs/eo.js +4 -0
- data/html/js/edit_area/plugins/test/langs/es.js +4 -0
- data/html/js/edit_area/plugins/test/langs/fr.js +4 -0
- data/html/js/edit_area/plugins/test/langs/hr.js +4 -0
- data/html/js/edit_area/plugins/test/langs/it.js +4 -0
- data/html/js/edit_area/plugins/test/langs/ja.js +4 -0
- data/html/js/edit_area/plugins/test/langs/mk.js +4 -0
- data/html/js/edit_area/plugins/test/langs/nl.js +4 -0
- data/html/js/edit_area/plugins/test/langs/pl.js +4 -0
- data/html/js/edit_area/plugins/test/langs/pt.js +4 -0
- data/html/js/edit_area/plugins/test/langs/ru.js +4 -0
- data/html/js/edit_area/plugins/test/langs/sk.js +4 -0
- data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
- data/html/js/edit_area/plugins/test/test.js +110 -0
- data/html/js/edit_area/plugins/test/test2.js +1 -0
- data/html/js/edit_area/reg_syntax/basic.js +69 -0
- data/html/js/edit_area/reg_syntax/brainfuck.js +44 -0
- data/html/js/edit_area/reg_syntax/c.js +62 -0
- data/html/js/edit_area/reg_syntax/coldfusion.js +119 -0
- data/html/js/edit_area/reg_syntax/cpp.js +65 -0
- data/html/js/edit_area/reg_syntax/css.js +84 -0
- data/html/js/edit_area/reg_syntax/html.js +50 -0
- data/html/js/edit_area/reg_syntax/java.js +56 -0
- data/html/js/edit_area/reg_syntax/js.js +93 -0
- data/html/js/edit_area/reg_syntax/pas.js +82 -0
- data/html/js/edit_area/reg_syntax/perl.js +88 -0
- data/html/js/edit_area/reg_syntax/php.js +156 -0
- data/html/js/edit_area/reg_syntax/python.js +144 -0
- data/html/js/edit_area/reg_syntax/robotstxt.js +24 -0
- data/html/js/edit_area/reg_syntax/ruby.js +67 -0
- data/html/js/edit_area/reg_syntax/sql.js +55 -0
- data/html/js/edit_area/reg_syntax/tsql.js +87 -0
- data/html/js/edit_area/reg_syntax/vb.js +52 -0
- data/html/js/edit_area/reg_syntax/xml.js +56 -0
- data/html/js/edit_area/reg_syntax.js +166 -0
- data/html/js/edit_area/regexp.js +139 -0
- data/html/js/edit_area/resize_area.js +78 -0
- data/html/js/edit_area/search_replace.js +174 -0
- data/html/js/edit_area/template.html +101 -0
- data/html/js/json-broker-client.js +67 -0
- data/html/js/page-manager.js +93 -0
- data/html/js/prototype.js +4184 -0
- data/html/js/result-page.js +775 -0
- data/html/js/rt-setting-page.js +152 -0
- data/html/js/sidebar.js +263 -0
- data/html/js/templates.js +386 -0
- data/html/js/utils.js +890 -0
- data/html/js/uuid.js +103 -0
- data/html/js/yui/treeview.js +3671 -0
- data/html/swf/chart.swf +0 -0
- data/html/test/agent_editor_spec.js +815 -0
- data/html/test/index.html +40 -0
- data/html/test/jsspec/JSSpec.css +224 -0
- data/html/test/jsspec/JSSpec.js +1549 -0
- data/html/test/jsspec/diff_match_patch.js +1 -0
- data/html/test/utils_spec.js +111 -0
- data/lib/jiji/agent/agent.rb +149 -0
- data/lib/jiji/agent/agent_manager.rb +138 -0
- data/lib/jiji/agent/agent_registry.rb +165 -0
- data/lib/jiji/agent/permitter.rb +128 -0
- data/lib/jiji/agent/util.rb +16 -0
- data/lib/jiji/collector.rb +226 -0
- data/lib/jiji/command.rb +204 -0
- data/lib/jiji/configuration.rb +86 -0
- data/lib/jiji/dao/file_system_dao.rb +158 -0
- data/lib/jiji/dao/rate_dao.rb +149 -0
- data/lib/jiji/dao/timed_data_dao.rb +336 -0
- data/lib/jiji/dao/trade_result_dao.rb +128 -0
- data/lib/jiji/error.rb +49 -0
- data/lib/jiji/migration/migrator.rb +50 -0
- data/lib/jiji/migration/migrator1_0_3.rb +26 -0
- data/lib/jiji/migration/migrator1_1_0.rb +46 -0
- data/lib/jiji/migration/migrator1_2_0.rb +67 -0
- data/lib/jiji/models.rb +223 -0
- data/lib/jiji/observer.rb +105 -0
- data/lib/jiji/operator.rb +396 -0
- data/lib/jiji/output.rb +221 -0
- data/lib/jiji/output_manager.rb +84 -0
- data/lib/jiji/plugin/embedded/click_securities_demo_plugin.rb +141 -0
- data/lib/jiji/plugin/embedded/single_click_client.rb +116 -0
- data/lib/jiji/plugin/plugin_loader.rb +53 -0
- data/lib/jiji/plugin/securities_plugin.rb +134 -0
- data/lib/jiji/process.rb +234 -0
- data/lib/jiji/process_manager.rb +290 -0
- data/lib/jiji/registry.rb +349 -0
- data/lib/jiji/server.rb +127 -0
- data/lib/jiji/service/agent_service.rb +230 -0
- data/lib/jiji/service/hello_service.rb +10 -0
- data/lib/jiji/service/output_service.rb +82 -0
- data/lib/jiji/service/process_service.rb +76 -0
- data/lib/jiji/service/rate_service.rb +38 -0
- data/lib/jiji/service/system_service.rb +14 -0
- data/lib/jiji/service/trade_result_service.rb +31 -0
- data/lib/jiji/util/backtester.rb +116 -0
- data/lib/jiji/util/block_to_session.rb +70 -0
- data/lib/jiji/util/cache.rb +79 -0
- data/lib/jiji/util/csv_append_support.rb +15 -0
- data/lib/jiji/util/file_lock.rb +86 -0
- data/lib/jiji/util/fix_yaml_bug.rb +11 -0
- data/lib/jiji/util/include_proxy.rb +17 -0
- data/lib/jiji/util/iterator.rb +70 -0
- data/lib/jiji/util/json_broker.rb +55 -0
- data/lib/jiji/util/json_rpc_requestor.rb +30 -0
- data/lib/jiji/util/rate_data_importer.rb +219 -0
- data/lib/jiji/util/synchronize_interceptor.rb +41 -0
- data/lib/jiji/util/thread_use_generator.rb +52 -0
- data/lib/jiji/util/util.rb +112 -0
- data/lib/jiji_plugin.rb +6 -0
- data/swf/build.xml +23 -0
- data/swf/chart/FxChart-config.xml +9 -0
- data/swf/chart/FxChart.mxml +17 -0
- data/swf/chart/fx/chart/Chart.as +173 -0
- data/swf/chart/fx/chart/ctrl/AutoUpdate.as +96 -0
- data/swf/chart/fx/chart/ctrl/Controller.as +270 -0
- data/swf/chart/fx/chart/ctrl/Event.as +75 -0
- data/swf/chart/fx/chart/model/Model.as +228 -0
- data/swf/chart/fx/chart/model/TimedData.as +40 -0
- data/swf/chart/fx/chart/ui/AbstractChartUI.as +59 -0
- data/swf/chart/fx/chart/ui/AbstractDrawChartUI.as +63 -0
- data/swf/chart/fx/chart/ui/Constants.as +233 -0
- data/swf/chart/fx/chart/ui/InformationWindow.as +228 -0
- data/swf/chart/fx/chart/ui/LayerManager.as +95 -0
- data/swf/chart/fx/chart/ui/Loading.as +32 -0
- data/swf/chart/fx/chart/ui/Pointer.as +61 -0
- data/swf/chart/fx/chart/ui/RangeInfoWindow.as +84 -0
- data/swf/chart/fx/chart/ui/RenderingContext.as +54 -0
- data/swf/chart/fx/chart/ui/ScaleSelector.as +84 -0
- data/swf/chart/fx/chart/ui/Scroll.as +241 -0
- data/swf/chart/fx/chart/ui/ScrollBar.as +378 -0
- data/swf/chart/fx/chart/ui/Stage.as +97 -0
- data/swf/chart/fx/chart/ui/TradeDetailWindow.as +147 -0
- data/swf/chart/fx/chart/ui/TradeResult.as +330 -0
- data/swf/chart/fx/chart/ui/Window.as +96 -0
- data/swf/chart/fx/chart/ui/candle/Axis.as +112 -0
- data/swf/chart/fx/chart/ui/candle/Candle.as +79 -0
- data/swf/chart/fx/chart/ui/candle/CandleChart.as +81 -0
- data/swf/chart/fx/chart/ui/graph/Graph.as +200 -0
- data/swf/chart/fx/chart/ui/graph/GraphManager.as +192 -0
- data/swf/chart/fx/chart/ui/resource/buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/cursor_hand.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/diff_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_buy_3.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/down_sell_3.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/draw_buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/draw_sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/end_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/fixed.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/loading.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/max_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/min_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_handle.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_handle_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_handle_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_left.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_left_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_left_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_right.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_right_a.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_bar_right_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_handle.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_info_handle.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_d.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_down.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_g.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_left_button_up.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_outer.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_outer_left.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_outer_right.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_d.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_down.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_g.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_o.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_right_button_up.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_slider_left.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/scroll_slider_right.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/start_label.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/stripe.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/stripe_b.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/stripe_r.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/unfixed.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_buy_3.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell_1.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell_2.gif +0 -0
- data/swf/chart/fx/chart/ui/resource/up_sell_3.gif +0 -0
- data/swf/chart/fx/net/StubFactory.as +113 -0
- data/swf/chart/fx/util/ListenerSupport.as +55 -0
- data/swf/chart/fx/util/PositionManager.as +95 -0
- data/swf/chart/fx/util/ScaleFormatter.as +156 -0
- data/swf/chart/fx/util/Util.as +61 -0
- data/swf/chart/log.as +40 -0
- data/swf/lib/corelib.swc +0 -0
- data/test/BackCollectorTest/basic/2008-08-04/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-04/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-04/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-05/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-05/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-05/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-06/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-06/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-06/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-07/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-07/USDJPY.csv +5 -0
- data/test/BackCollectorTest/basic/2008-08-07/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-05.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/basic/AUDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-05.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/basic/USDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-05.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/basic/ZARJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-04/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-04/USDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-04/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-06/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-06/USDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-06/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-07/AUDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-07/USDJPY.csv +5 -0
- data/test/BackCollectorTest/lack/2008-08-07/ZARJPY.csv +5 -0
- data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/lack/AUDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/lack/USDJPY/raw/2008-08-07.csv +5 -0
- data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-04.csv +5 -0
- data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-06.csv +5 -0
- data/test/BackCollectorTest/lack/ZARJPY/raw/2008-08-07.csv +5 -0
- data/test/OutputregistryTest/conf/configuration.yaml +3 -0
- data/test/ProcessManagerTest/agents/moving_average.rb +95 -0
- data/test/ProcessManagerTest/conf/configuration.yaml +6 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-21.csv +5853 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-22.csv +5821 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-23.csv +5921 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-24.csv +5956 -0
- data/test/ProcessManagerTest/rate_datas/EURJPY/raw/2008-08-25.csv +5796 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-21.csv +5853 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-22.csv +5821 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-23.csv +5921 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-24.csv +5956 -0
- data/test/ProcessManagerTest/rate_datas/USDJPY/raw/2008-08-25.csv +5796 -0
- data/test/ProcessTest/agents/foo.rb +10 -0
- data/test/ProcessTest/conf/configuration.yaml +3 -0
- data/test/agent/agent_tests.rb +10 -0
- data/test/agent/test_AgentManager.rb +321 -0
- data/test/agent/test_AgentRegistry.rb +662 -0
- data/test/agent/test_PeriodicallyAgent.rb +180 -0
- data/test/agent/test_Permitter.rb +217 -0
- data/test/all_tests.rb +24 -0
- data/test/dao/dao_tests.rb +9 -0
- data/test/dao/test_FileSystemDao.rb +431 -0
- data/test/dao/test_RateDao.rb +695 -0
- data/test/dao/test_TradeResultDao.rb +487 -0
- data/test/jiji_plugin.rb +7 -0
- data/test/migration/migration_tests.rb +10 -0
- data/test/migration/migrator1_0_3test_data/rmt/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75YuV5bmz5Z2H57ea/meta.yaml +12 -0
- data/test/migration/migrator1_0_3test_data/rmt/out/NjM5YWFhZmQtNDFjNy00NjUxLWIwYmItNTc3ZjAyZTg5ODA5/56e75Yuasdwqdd/meta.yaml +12 -0
- data/test/migration/migrator1_1_0test_data/configuration.yaml +11 -0
- data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +10 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-05.csv +20 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-06.csv +20 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +18 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +10 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-05.csv +20 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-06.csv +20 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +18 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
- data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +1 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-04.csv +10 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-05.csv +20 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-06.csv +20 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/1d/2009-07.csv +18 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/test_Migrator.rb +117 -0
- data/test/migration/test_Migrator1_0_3.rb +118 -0
- data/test/migration/test_Migrator1_1_0.rb +56 -0
- data/test/migration/test_Migrator1_2_0.rb +94 -0
- data/test/plugin/embedded/test_SingleClickClient.rb +144 -0
- data/test/plugin/error_test/jiji_plugin.rb +2 -0
- data/test/plugin/plugin_tests.rb +8 -0
- data/test/plugin/test/foo_plugin.rb +1 -0
- data/test/plugin/test/jiji_plugin.rb +2 -0
- data/test/plugin/test_Loader.rb +33 -0
- data/test/plugin/test_gem/a/jiji_plugin_test_gem_a-1.0.0.gem +0 -0
- data/test/plugin/test_gem/a/jiji_plugin_test_gem_a.gemspec +10 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin.rb +2 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +6 -0
- data/test/plugin/test_gem/b/jiji_plugin_test_gem_b-1.0.0.gem +0 -0
- data/test/plugin/test_gem/b/jiji_plugin_test_gem_b.gemspec +9 -0
- data/test/plugin/test_gem/b/lib/jiji_plugin.rb +2 -0
- data/test/service/all_service_tests.rb +10 -0
- data/test/service/test_AgentService.rb +185 -0
- data/test/service/test_OutputService.rb +33 -0
- data/test/service/test_RateService.rb +56 -0
- data/test/shared/rate.csv +144 -0
- data/test/shared/shared_tests.rb +9 -0
- data/test/shared/test_Cross.rb +144 -0
- data/test/shared/test_PositionManager.rb +285 -0
- data/test/shared/test_Signal.rb +65 -0
- data/test/test_BackTestCollector.rb +273 -0
- data/test/test_Collector.rb +230 -0
- data/test/test_Configuration.rb +61 -0
- data/test/test_Configuration_a.yaml +6 -0
- data/test/test_Operator.rb +501 -0
- data/test/test_Output.rb +175 -0
- data/test/test_OutputManager.rb +162 -0
- data/test/test_Output_registry.rb +42 -0
- data/test/test_Process.rb +557 -0
- data/test/test_ProcessManager.rb +723 -0
- data/test/test_utils.rb +112 -0
- data/test/util/test_BlockToSession.rb +121 -0
- data/test/util/test_CSV.rb +84 -0
- data/test/util/test_SynchronizeInterceptor.rb +76 -0
- data/test/util/util_tests.rb +9 -0
- metadata +941 -0
@@ -0,0 +1 @@
|
|
1
|
+
function diff_match_patch(){this.Diff_Timeout=1.0;this.Diff_EditCost=4;this.Diff_DualThreshold=32;this.Match_Balance=0.5;this.Match_Threshold=0.5;this.Match_MinLength=100;this.Match_MaxLength=1000;this.Patch_Margin=4;function getMaxBits(){var maxbits=0;var oldi=1;var newi=2;while(oldi!=newi){maxbits++;oldi=newi;newi=newi<<1}return maxbits}this.Match_MaxBits=getMaxBits()}var DIFF_DELETE=-1;var DIFF_INSERT=1;var DIFF_EQUAL=0;diff_match_patch.prototype.diff_main=function(text1,text2,opt_checklines){if(text1==text2){return[[DIFF_EQUAL,text1]]}if(typeof opt_checklines=='undefined'){opt_checklines=true}var checklines=opt_checklines;var commonlength=this.diff_commonPrefix(text1,text2);var commonprefix=text1.substring(0,commonlength);text1=text1.substring(commonlength);text2=text2.substring(commonlength);commonlength=this.diff_commonSuffix(text1,text2);var commonsuffix=text1.substring(text1.length-commonlength);text1=text1.substring(0,text1.length-commonlength);text2=text2.substring(0,text2.length-commonlength);var diffs=this.diff_compute(text1,text2,checklines);if(commonprefix){diffs.unshift([DIFF_EQUAL,commonprefix])}if(commonsuffix){diffs.push([DIFF_EQUAL,commonsuffix])}this.diff_cleanupMerge(diffs);return diffs};diff_match_patch.prototype.diff_compute=function(text1,text2,checklines){var diffs;if(!text1){return[[DIFF_INSERT,text2]]}if(!text2){return[[DIFF_DELETE,text1]]}var longtext=text1.length>text2.length?text1:text2;var shorttext=text1.length>text2.length?text2:text1;var i=longtext.indexOf(shorttext);if(i!=-1){diffs=[[DIFF_INSERT,longtext.substring(0,i)],[DIFF_EQUAL,shorttext],[DIFF_INSERT,longtext.substring(i+shorttext.length)]];if(text1.length>text2.length){diffs[0][0]=diffs[2][0]=DIFF_DELETE}return diffs}longtext=shorttext=null;var hm=this.diff_halfMatch(text1,text2);if(hm){var text1_a=hm[0];var text1_b=hm[1];var text2_a=hm[2];var text2_b=hm[3];var mid_common=hm[4];var diffs_a=this.diff_main(text1_a,text2_a,checklines);var diffs_b=this.diff_main(text1_b,text2_b,checklines);return diffs_a.concat([[DIFF_EQUAL,mid_common]],diffs_b)}if(checklines&&text1.length+text2.length<250){checklines=false}var linearray;if(checklines){var a=this.diff_linesToChars(text1,text2);text1=a[0];text2=a[1];linearray=a[2]}diffs=this.diff_map(text1,text2);if(!diffs){diffs=[[DIFF_DELETE,text1],[DIFF_INSERT,text2]]}if(checklines){this.diff_charsToLines(diffs,linearray);this.diff_cleanupSemantic(diffs);diffs.push([DIFF_EQUAL,'']);var pointer=0;var count_delete=0;var count_insert=0;var text_delete='';var text_insert='';while(pointer<diffs.length){if(diffs[pointer][0]==DIFF_INSERT){count_insert++;text_insert+=diffs[pointer][1]}else if(diffs[pointer][0]==DIFF_DELETE){count_delete++;text_delete+=diffs[pointer][1]}else{if(count_delete>=1&&count_insert>=1){var a=this.diff_main(text_delete,text_insert,false);diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert);pointer=pointer-count_delete-count_insert;for(var j=a.length-1;j>=0;j--){diffs.splice(pointer,0,a[j])}pointer=pointer+a.length}count_insert=0;count_delete=0;text_delete='';text_insert=''}pointer++}diffs.pop()}return diffs};diff_match_patch.prototype.diff_linesToChars=function(text1,text2){var linearray=[];var linehash={};linearray.push('');function diff_linesToCharsMunge(text){var chars='';while(text){var i=text.indexOf('\n');if(i==-1){i=text.length}var line=text.substring(0,i+1);text=text.substring(i+1);if(linehash.hasOwnProperty?linehash.hasOwnProperty(line):(linehash[line]!==undefined)){chars+=String.fromCharCode(linehash[line])}else{linearray.push(line);linehash[line]=linearray.length-1;chars+=String.fromCharCode(linearray.length-1)}}return chars}var chars1=diff_linesToCharsMunge(text1);var chars2=diff_linesToCharsMunge(text2);return[chars1,chars2,linearray]};diff_match_patch.prototype.diff_charsToLines=function(diffs,linearray){for(var x=0;x<diffs.length;x++){var chars=diffs[x][1];var text=[];for(var y=0;y<chars.length;y++){text.push(linearray[chars.charCodeAt(y)])}diffs[x][1]=text.join('')}};diff_match_patch.prototype.diff_map=function(text1,text2){var ms_end=(new Date()).getTime()+this.Diff_Timeout*1000;var max_d=text1.length+text2.length-1;var doubleEnd=this.Diff_DualThreshold*2<max_d;var v_map1=[];var v_map2=[];var v1={};var v2={};v1[1]=0;v2[1]=0;var x,y;var footstep;var footsteps={};var done=false;var hasOwnProperty=!!(footsteps.hasOwnProperty);var front=(text1.length+text2.length)%2;for(var d=0;d<max_d;d++){if(this.Diff_Timeout>0&&(new Date()).getTime()>ms_end){return null}v_map1[d]={};for(var k=-d;k<=d;k+=2){if(k==-d||k!=d&&v1[k-1]<v1[k+1]){x=v1[k+1]}else{x=v1[k-1]+1}y=x-k;if(doubleEnd){footstep=x+','+y;if(front&&(hasOwnProperty?footsteps.hasOwnProperty(footstep):(footsteps[footstep]!==undefined))){done=true}if(!front){footsteps[footstep]=d}}while(!done&&x<text1.length&&y<text2.length&&text1.charAt(x)==text2.charAt(y)){x++;y++;if(doubleEnd){footstep=x+','+y;if(front&&(hasOwnProperty?footsteps.hasOwnProperty(footstep):(footsteps[footstep]!==undefined))){done=true}if(!front){footsteps[footstep]=d}}}v1[k]=x;v_map1[d][x+','+y]=true;if(x==text1.length&&y==text2.length){return this.diff_path1(v_map1,text1,text2)}else if(done){v_map2=v_map2.slice(0,footsteps[footstep]+1);var a=this.diff_path1(v_map1,text1.substring(0,x),text2.substring(0,y));return a.concat(this.diff_path2(v_map2,text1.substring(x),text2.substring(y)))}}if(doubleEnd){v_map2[d]={};for(var k=-d;k<=d;k+=2){if(k==-d||k!=d&&v2[k-1]<v2[k+1]){x=v2[k+1]}else{x=v2[k-1]+1}y=x-k;footstep=(text1.length-x)+','+(text2.length-y);if(!front&&(hasOwnProperty?footsteps.hasOwnProperty(footstep):(footsteps[footstep]!==undefined))){done=true}if(front){footsteps[footstep]=d}while(!done&&x<text1.length&&y<text2.length&&text1.charAt(text1.length-x-1)==text2.charAt(text2.length-y-1)){x++;y++;footstep=(text1.length-x)+','+(text2.length-y);if(!front&&(hasOwnProperty?footsteps.hasOwnProperty(footstep):(footsteps[footstep]!==undefined))){done=true}if(front){footsteps[footstep]=d}}v2[k]=x;v_map2[d][x+','+y]=true;if(done){v_map1=v_map1.slice(0,footsteps[footstep]+1);var a=this.diff_path1(v_map1,text1.substring(0,text1.length-x),text2.substring(0,text2.length-y));return a.concat(this.diff_path2(v_map2,text1.substring(text1.length-x),text2.substring(text2.length-y)))}}}}return null};diff_match_patch.prototype.diff_path1=function(v_map,text1,text2){var path=[];var x=text1.length;var y=text2.length;var last_op=null;for(var d=v_map.length-2;d>=0;d--){while(1){if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty((x-1)+','+y):(v_map[d][(x-1)+','+y]!==undefined)){x--;if(last_op===DIFF_DELETE){path[0][1]=text1.charAt(x)+path[0][1]}else{path.unshift([DIFF_DELETE,text1.charAt(x)])}last_op=DIFF_DELETE;break}else if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty(x+','+(y-1)):(v_map[d][x+','+(y-1)]!==undefined)){y--;if(last_op===DIFF_INSERT){path[0][1]=text2.charAt(y)+path[0][1]}else{path.unshift([DIFF_INSERT,text2.charAt(y)])}last_op=DIFF_INSERT;break}else{x--;y--;if(last_op===DIFF_EQUAL){path[0][1]=text1.charAt(x)+path[0][1]}else{path.unshift([DIFF_EQUAL,text1.charAt(x)])}last_op=DIFF_EQUAL}}}return path};diff_match_patch.prototype.diff_path2=function(v_map,text1,text2){var path=[];var x=text1.length;var y=text2.length;var last_op=null;for(var d=v_map.length-2;d>=0;d--){while(1){if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty((x-1)+','+y):(v_map[d][(x-1)+','+y]!==undefined)){x--;if(last_op===DIFF_DELETE){path[path.length-1][1]+=text1.charAt(text1.length-x-1)}else{path.push([DIFF_DELETE,text1.charAt(text1.length-x-1)])}last_op=DIFF_DELETE;break}else if(v_map[d].hasOwnProperty?v_map[d].hasOwnProperty(x+','+(y-1)):(v_map[d][x+','+(y-1)]!==undefined)){y--;if(last_op===DIFF_INSERT){path[path.length-1][1]+=text2.charAt(text2.length-y-1)}else{path.push([DIFF_INSERT,text2.charAt(text2.length-y-1)])}last_op=DIFF_INSERT;break}else{x--;y--;if(last_op===DIFF_EQUAL){path[path.length-1][1]+=text1.charAt(text1.length-x-1)}else{path.push([DIFF_EQUAL,text1.charAt(text1.length-x-1)])}last_op=DIFF_EQUAL}}}return path};diff_match_patch.prototype.diff_commonPrefix=function(text1,text2){if(!text1||!text2||text1.charCodeAt(0)!==text2.charCodeAt(0)){return 0}var pointermin=0;var pointermax=Math.min(text1.length,text2.length);var pointermid=pointermax;var pointerstart=0;while(pointermin<pointermid){if(text1.substring(pointerstart,pointermid)==text2.substring(pointerstart,pointermid)){pointermin=pointermid;pointerstart=pointermin}else{pointermax=pointermid}pointermid=Math.floor((pointermax-pointermin)/2+pointermin)}return pointermid};diff_match_patch.prototype.diff_commonSuffix=function(text1,text2){if(!text1||!text2||text1.charCodeAt(text1.length-1)!==text2.charCodeAt(text2.length-1)){return 0}var pointermin=0;var pointermax=Math.min(text1.length,text2.length);var pointermid=pointermax;var pointerend=0;while(pointermin<pointermid){if(text1.substring(text1.length-pointermid,text1.length-pointerend)==text2.substring(text2.length-pointermid,text2.length-pointerend)){pointermin=pointermid;pointerend=pointermin}else{pointermax=pointermid}pointermid=Math.floor((pointermax-pointermin)/2+pointermin)}return pointermid};diff_match_patch.prototype.diff_halfMatch=function(text1,text2){var longtext=text1.length>text2.length?text1:text2;var shorttext=text1.length>text2.length?text2:text1;if(longtext.length<10||shorttext.length<1){return null}var dmp=this;function diff_halfMatchI(longtext,shorttext,i){var seed=longtext.substring(i,i+Math.floor(longtext.length/4));var j=-1;var best_common='';var best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b;while((j=shorttext.indexOf(seed,j+1))!=-1){var prefixLength=dmp.diff_commonPrefix(longtext.substring(i),shorttext.substring(j));var suffixLength=dmp.diff_commonSuffix(longtext.substring(0,i),shorttext.substring(0,j));if(best_common.length<suffixLength+prefixLength){best_common=shorttext.substring(j-suffixLength,j)+shorttext.substring(j,j+prefixLength);best_longtext_a=longtext.substring(0,i-suffixLength);best_longtext_b=longtext.substring(i+prefixLength);best_shorttext_a=shorttext.substring(0,j-suffixLength);best_shorttext_b=shorttext.substring(j+prefixLength)}}if(best_common.length>=longtext.length/2){return[best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,best_common]}else{return null}}var hm1=diff_halfMatchI(longtext,shorttext,Math.ceil(longtext.length/4));var hm2=diff_halfMatchI(longtext,shorttext,Math.ceil(longtext.length/2));var hm;if(!hm1&&!hm2){return null}else if(!hm2){hm=hm1}else if(!hm1){hm=hm2}else{hm=hm1[4].length>hm2[4].length?hm1:hm2}var text1_a,text1_b,text2_a,text2_b;if(text1.length>text2.length){text1_a=hm[0];text1_b=hm[1];text2_a=hm[2];text2_b=hm[3]}else{text2_a=hm[0];text2_b=hm[1];text1_a=hm[2];text1_b=hm[3]}var mid_common=hm[4];return[text1_a,text1_b,text2_a,text2_b,mid_common]};diff_match_patch.prototype.diff_cleanupSemantic=function(diffs){var changes=false;var equalities=[];var lastequality=null;var pointer=0;var length_changes1=0;var length_changes2=0;while(pointer<diffs.length){if(diffs[pointer][0]==DIFF_EQUAL){equalities.push(pointer);length_changes1=length_changes2;length_changes2=0;lastequality=diffs[pointer][1]}else{length_changes2+=diffs[pointer][1].length;if(lastequality!==null&&(lastequality.length<=length_changes1)&&(lastequality.length<=length_changes2)){diffs.splice(equalities[equalities.length-1],0,[DIFF_DELETE,lastequality]);diffs[equalities[equalities.length-1]+1][0]=DIFF_INSERT;equalities.pop();equalities.pop();pointer=equalities.length?equalities[equalities.length-1]:-1;length_changes1=0;length_changes2=0;lastequality=null;changes=true}}pointer++}if(changes){this.diff_cleanupMerge(diffs)}this.diff_cleanupSemanticLossless(diffs)};diff_match_patch.prototype.diff_cleanupSemanticLossless=function(diffs){function diff_cleanupSemanticScore(one,two,three){var whitespace=/\s/;var score=0;if(one.charAt(one.length-1).match(whitespace)||two.charAt(0).match(whitespace)){score++}if(two.charAt(two.length-1).match(whitespace)||three.charAt(0).match(whitespace)){score++}return score}var pointer=1;while(pointer<diffs.length-1){if(diffs[pointer-1][0]==DIFF_EQUAL&&diffs[pointer+1][0]==DIFF_EQUAL){var equality1=diffs[pointer-1][1];var edit=diffs[pointer][1];var equality2=diffs[pointer+1][1];var commonOffset=this.diff_commonSuffix(equality1,edit);if(commonOffset){var commonString=edit.substring(edit.length-commonOffset);equality1=equality1.substring(0,equality1.length-commonOffset);edit=commonString+edit.substring(0,edit.length-commonOffset);equality2=commonString+equality2}var bestEquality1=equality1;var bestEdit=edit;var bestEquality2=equality2;var bestScore=diff_cleanupSemanticScore(equality1,edit,equality2);while(edit.charAt(0)===equality2.charAt(0)){equality1+=edit.charAt(0);edit=edit.substring(1)+equality2.charAt(0);equality2=equality2.substring(1);var score=diff_cleanupSemanticScore(equality1,edit,equality2);if(score>=bestScore){bestScore=score;bestEquality1=equality1;bestEdit=edit;bestEquality2=equality2}}if(diffs[pointer-1][1]!=bestEquality1){diffs[pointer-1][1]=bestEquality1;diffs[pointer][1]=bestEdit;diffs[pointer+1][1]=bestEquality2}}pointer++}};diff_match_patch.prototype.diff_cleanupEfficiency=function(diffs){var changes=false;var equalities=[];var lastequality='';var pointer=0;var pre_ins=false;var pre_del=false;var post_ins=false;var post_del=false;while(pointer<diffs.length){if(diffs[pointer][0]==DIFF_EQUAL){if(diffs[pointer][1].length<this.Diff_EditCost&&(post_ins||post_del)){equalities.push(pointer);pre_ins=post_ins;pre_del=post_del;lastequality=diffs[pointer][1]}else{equalities=[];lastequality=''}post_ins=post_del=false}else{if(diffs[pointer][0]==DIFF_DELETE){post_del=true}else{post_ins=true}if(lastequality&&((pre_ins&&pre_del&&post_ins&&post_del)||((lastequality.length<this.Diff_EditCost/2)&&(pre_ins+pre_del+post_ins+post_del)==3))){diffs.splice(equalities[equalities.length-1],0,[DIFF_DELETE,lastequality]);diffs[equalities[equalities.length-1]+1][0]=DIFF_INSERT;equalities.pop();lastequality='';if(pre_ins&&pre_del){post_ins=post_del=true;equalities=[]}else{equalities.pop();pointer=equalities.length?equalities[equalities.length-1]:-1;post_ins=post_del=false}changes=true}}pointer++}if(changes){this.diff_cleanupMerge(diffs)}};diff_match_patch.prototype.diff_cleanupMerge=function(diffs){diffs.push([DIFF_EQUAL,'']);var pointer=0;var count_delete=0;var count_insert=0;var text_delete='';var text_insert='';var commonlength;while(pointer<diffs.length){if(diffs[pointer][0]==DIFF_INSERT){count_insert++;text_insert+=diffs[pointer][1];pointer++}else if(diffs[pointer][0]==DIFF_DELETE){count_delete++;text_delete+=diffs[pointer][1];pointer++}else{if(count_delete!==0||count_insert!==0){if(count_delete!==0&&count_insert!==0){commonlength=this.diff_commonPrefix(text_insert,text_delete);if(commonlength!==0){if((pointer-count_delete-count_insert)>0&&diffs[pointer-count_delete-count_insert-1][0]==DIFF_EQUAL){diffs[pointer-count_delete-count_insert-1][1]+=text_insert.substring(0,commonlength)}else{diffs.splice(0,0,[DIFF_EQUAL,text_insert.substring(0,commonlength)]);pointer++}text_insert=text_insert.substring(commonlength);text_delete=text_delete.substring(commonlength)}commonlength=this.diff_commonSuffix(text_insert,text_delete);if(commonlength!==0){diffs[pointer][1]=text_insert.substring(text_insert.length-commonlength)+diffs[pointer][1];text_insert=text_insert.substring(0,text_insert.length-commonlength);text_delete=text_delete.substring(0,text_delete.length-commonlength)}}if(count_delete===0){diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[DIFF_INSERT,text_insert])}else if(count_insert===0){diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[DIFF_DELETE,text_delete])}else{diffs.splice(pointer-count_delete-count_insert,count_delete+count_insert,[DIFF_DELETE,text_delete],[DIFF_INSERT,text_insert])}pointer=pointer-count_delete-count_insert+(count_delete?1:0)+(count_insert?1:0)+1}else if(pointer!==0&&diffs[pointer-1][0]==DIFF_EQUAL){diffs[pointer-1][1]+=diffs[pointer][1];diffs.splice(pointer,1)}else{pointer++}count_insert=0;count_delete=0;text_delete='';text_insert=''}}if(diffs[diffs.length-1][1]===''){diffs.pop()}var changes=false;pointer=1;while(pointer<diffs.length-1){if(diffs[pointer-1][0]==DIFF_EQUAL&&diffs[pointer+1][0]==DIFF_EQUAL){if(diffs[pointer][1].substring(diffs[pointer][1].length-diffs[pointer-1][1].length)==diffs[pointer-1][1]){diffs[pointer][1]=diffs[pointer-1][1]+diffs[pointer][1].substring(0,diffs[pointer][1].length-diffs[pointer-1][1].length);diffs[pointer+1][1]=diffs[pointer-1][1]+diffs[pointer+1][1];diffs.splice(pointer-1,1);changes=true}else if(diffs[pointer][1].substring(0,diffs[pointer+1][1].length)==diffs[pointer+1][1]){diffs[pointer-1][1]+=diffs[pointer+1][1];diffs[pointer][1]=diffs[pointer][1].substring(diffs[pointer+1][1].length)+diffs[pointer+1][1];diffs.splice(pointer+1,1);changes=true}}pointer++}if(changes){this.diff_cleanupMerge(diffs)}};diff_match_patch.prototype.diff_addIndex=function(diffs){var i=0;for(var x=0;x<diffs.length;x++){diffs[x].push(i);if(diffs[x][0]!==DIFF_DELETE){i+=diffs[x][1].length}}};diff_match_patch.prototype.diff_xIndex=function(diffs,loc){var chars1=0;var chars2=0;var last_chars1=0;var last_chars2=0;var x;for(x=0;x<diffs.length;x++){if(diffs[x][0]!==DIFF_INSERT){chars1+=diffs[x][1].length}if(diffs[x][0]!==DIFF_DELETE){chars2+=diffs[x][1].length}if(chars1>loc){break}last_chars1=chars1;last_chars2=chars2}if(diffs.length!=x&&diffs[x][0]===DIFF_DELETE){return last_chars2}return last_chars2+(loc-last_chars1)};diff_match_patch.prototype.diff_prettyHtml=function(diffs){this.diff_addIndex(diffs);var html=[];for(var x=0;x<diffs.length;x++){var m=diffs[x][0];var t=diffs[x][1];var i=diffs[x][2];t=t.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');t=t.replace(/\n/g,'¶<BR>');if(m===DIFF_DELETE){html.push('<DEL STYLE="background:#FFE6E6;" TITLE="i=',i,'">',t,'</DEL>')}else if(m===DIFF_INSERT){html.push('<INS STYLE="background:#E6FFE6;" TITLE="i=',i,'">',t,'</INS>')}else{html.push('<SPAN TITLE="i=',i,'">',t,'</SPAN>')}}return html.join('')};diff_match_patch.prototype.diff_text1=function(diffs){var txt=[];for(var x=0;x<diffs.length;x++){if(diffs[x][0]!==DIFF_INSERT){txt.push(diffs[x][1])}}return txt.join('')};diff_match_patch.prototype.diff_text2=function(diffs){var txt=[];for(var x=0;x<diffs.length;x++){if(diffs[x][0]!==DIFF_DELETE){txt.push(diffs[x][1])}}return txt.join('')};diff_match_patch.prototype.diff_toDelta=function(diffs){var txt=[];for(var x=0;x<diffs.length;x++){switch(diffs[x][0]){case DIFF_DELETE:txt.push('-',diffs[x][1].length,'\t');break;case DIFF_EQUAL:txt.push('=',diffs[x][1].length,'\t');break;case DIFF_INSERT:txt.push('+',encodeURI(diffs[x][1]),'\t');break;default:alert('Invalid diff operation in diff_toDelta()')}}return txt.join('').replace(/%20/g,' ')};diff_match_patch.prototype.diff_fromDelta=function(text1,delta){var diffs=[];var pointer=0;var tokens=delta.split(/\t/g);for(var x=0;x<tokens.length;x++){var param=tokens[x].substring(1);switch(tokens[x].charAt(0)){case'-':case'=':var n=parseInt(param,10);if(isNaN(n)||n<0){alert('Invalid number in diff_fromDelta()')}else{var text=text1.substring(pointer,pointer+=n);if(tokens[x].charAt(0)=='='){diffs.push([DIFF_EQUAL,text])}else{diffs.push([DIFF_DELETE,text])}}break;case'+':diffs.push([DIFF_INSERT,decodeURI(param)]);break;default:if(tokens[x]){alert('Invalid diff operation in diff_fromDelta()')}}}if(pointer!=text1.length){alert('Text length mismatch in diff_fromDelta()')}return diffs};diff_match_patch.prototype.match_main=function(text,pattern,loc){loc=Math.max(0,Math.min(loc,text.length-pattern.length));if(text==pattern){return 0}else if(text.length===0){return null}else if(text.substring(loc,loc+pattern.length)==pattern){return loc}else{return this.match_bitap(text,pattern,loc)}};diff_match_patch.prototype.match_bitap=function(text,pattern,loc){if(pattern.length>this.Match_MaxBits){return alert('Pattern too long for this browser.')}var s=this.match_alphabet(pattern);var score_text_length=text.length;score_text_length=Math.max(score_text_length,this.Match_MinLength);score_text_length=Math.min(score_text_length,this.Match_MaxLength);var dmp=this;function match_bitapScore(e,x){var d=Math.abs(loc-x);return(e/pattern.length/dmp.Match_Balance)+(d/score_text_length/(1.0-dmp.Match_Balance))}var score_threshold=this.Match_Threshold;var best_loc=text.indexOf(pattern,loc);if(best_loc!=-1){score_threshold=Math.min(match_bitapScore(0,best_loc),score_threshold)}best_loc=text.lastIndexOf(pattern,loc+pattern.length);if(best_loc!=-1){score_threshold=Math.min(match_bitapScore(0,best_loc),score_threshold)}var matchmask=1<<(pattern.length-1);best_loc=null;var bin_min,bin_mid;var bin_max=Math.max(loc+loc,text.length);var last_rd;for(var d=0;d<pattern.length;d++){var rd=Array(text.length);bin_min=loc;bin_mid=bin_max;while(bin_min<bin_mid){if(match_bitapScore(d,bin_mid)<score_threshold){bin_min=bin_mid}else{bin_max=bin_mid}bin_mid=Math.floor((bin_max-bin_min)/2+bin_min)}bin_max=bin_mid;var start=Math.max(0,loc-(bin_mid-loc)-1);var finish=Math.min(text.length-1,pattern.length+bin_mid);if(text.charAt(finish)==pattern.charAt(pattern.length-1)){rd[finish]=(1<<(d+1))-1}else{rd[finish]=(1<<d)-1}for(var j=finish-1;j>=start;j--){if(d===0){rd[j]=((rd[j+1]<<1)|1)&s[text.charAt(j)]}else{rd[j]=((rd[j+1]<<1)|1)&s[text.charAt(j)]|((last_rd[j+1]<<1)|1)|((last_rd[j]<<1)|1)|last_rd[j+1]}if(rd[j]&matchmask){var score=match_bitapScore(d,j);if(score<=score_threshold){score_threshold=score;best_loc=j;if(j>loc){start=Math.max(0,loc-(j-loc))}else{break}}}}if(match_bitapScore(d+1,loc)>score_threshold){break}last_rd=rd}return best_loc};diff_match_patch.prototype.match_alphabet=function(pattern){var s=Object();for(var i=0;i<pattern.length;i++){s[pattern.charAt(i)]=0}for(var i=0;i<pattern.length;i++){s[pattern.charAt(i)]|=1<<(pattern.length-i-1)}return s};diff_match_patch.prototype.patch_addContext=function(patch,text){var pattern=text.substring(patch.start2,patch.start2+patch.length1);var padding=0;while(text.indexOf(pattern)!=text.lastIndexOf(pattern)&&pattern.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin){padding+=this.Patch_Margin;pattern=text.substring(patch.start2-padding,patch.start2+patch.length1+padding)}padding+=this.Patch_Margin;var prefix=text.substring(patch.start2-padding,patch.start2);if(prefix!==''){patch.diffs.unshift([DIFF_EQUAL,prefix])}var suffix=text.substring(patch.start2+patch.length1,patch.start2+patch.length1+padding);if(suffix!==''){patch.diffs.push([DIFF_EQUAL,suffix])}patch.start1-=prefix.length;patch.start2-=prefix.length;patch.length1+=prefix.length+suffix.length;patch.length2+=prefix.length+suffix.length};diff_match_patch.prototype.patch_make=function(text1,text2,opt_diffs){var diffs;if(typeof opt_diffs!='undefined'){diffs=opt_diffs}else{diffs=this.diff_main(text1,text2,true);if(diffs.length>2){this.diff_cleanupSemantic(diffs);this.diff_cleanupEfficiency(diffs)}}if(diffs.length===0){return[]}var patches=[];var patch=new patch_obj();var char_count1=0;var char_count2=0;var prepatch_text=text1;var postpatch_text=text1;for(var x=0;x<diffs.length;x++){var diff_type=diffs[x][0];var diff_text=diffs[x][1];if(patch.diffs.length===0&&diff_type!==DIFF_EQUAL){patch.start1=char_count1;patch.start2=char_count2}if(diff_type===DIFF_INSERT){patch.diffs.push(diffs[x]);patch.length2+=diff_text.length;postpatch_text=postpatch_text.substring(0,char_count2)+diff_text+postpatch_text.substring(char_count2)}else if(diff_type===DIFF_DELETE){patch.length1+=diff_text.length;patch.diffs.push(diffs[x]);postpatch_text=postpatch_text.substring(0,char_count2)+postpatch_text.substring(char_count2+diff_text.length)}else if(diff_type===DIFF_EQUAL&&diff_text.length<=2*this.Patch_Margin&&patch.diffs.length!==0&&diffs.length!=x+1){patch.diffs.push(diffs[x]);patch.length1+=diff_text.length;patch.length2+=diff_text.length}if(diff_type===DIFF_EQUAL&&diff_text.length>=2*this.Patch_Margin){if(patch.diffs.length!==0){this.patch_addContext(patch,prepatch_text);patches.push(patch);patch=new patch_obj();prepatch_text=postpatch_text}}if(diff_type!==DIFF_INSERT){char_count1+=diff_text.length}if(diff_type!==DIFF_DELETE){char_count2+=diff_text.length}}if(patch.diffs.length!==0){this.patch_addContext(patch,prepatch_text);patches.push(patch)}return patches};diff_match_patch.prototype.patch_apply=function(patches,text){this.patch_splitMax(patches);var results=[];var delta=0;for(var x=0;x<patches.length;x++){var expected_loc=patches[x].start2+delta;var text1=this.diff_text1(patches[x].diffs);var start_loc=this.match_main(text,text1,expected_loc);if(start_loc===null){results.push(false)}else{results.push(true);delta=start_loc-expected_loc;var text2=text.substring(start_loc,start_loc+text1.length);if(text1==text2){text=text.substring(0,start_loc)+this.diff_text2(patches[x].diffs)+text.substring(start_loc+text1.length)}else{var diffs=this.diff_main(text1,text2,false);this.diff_cleanupSemanticLossless(diffs);var index1=0;var index2;for(var y=0;y<patches[x].diffs.length;y++){var mod=patches[x].diffs[y];if(mod[0]!==DIFF_EQUAL){index2=this.diff_xIndex(diffs,index1)}if(mod[0]===DIFF_INSERT){text=text.substring(0,start_loc+index2)+mod[1]+text.substring(start_loc+index2)}else if(mod[0]===DIFF_DELETE){text=text.substring(0,start_loc+index2)+text.substring(start_loc+this.diff_xIndex(diffs,index1+mod[1].length))}if(mod[0]!==DIFF_DELETE){index1+=mod[1].length}}}}}return[text,results]};diff_match_patch.prototype.patch_splitMax=function(patches){for(var x=0;x<patches.length;x++){if(patches[x].length1>this.Match_MaxBits){var bigpatch=patches[x];patches.splice(x,1);var patch_size=this.Match_MaxBits;var start1=bigpatch.start1;var start2=bigpatch.start2;var precontext='';while(bigpatch.diffs.length!==0){var patch=new patch_obj();var empty=true;patch.start1=start1-precontext.length;patch.start2=start2-precontext.length;if(precontext!==''){patch.length1=patch.length2=precontext.length;patch.diffs.push([DIFF_EQUAL,precontext])}while(bigpatch.diffs.length!==0&&patch.length1<patch_size-this.Patch_Margin){var diff_type=bigpatch.diffs[0][0];var diff_text=bigpatch.diffs[0][1];if(diff_type===DIFF_INSERT){patch.length2+=diff_text.length;start2+=diff_text.length;patch.diffs.push(bigpatch.diffs.shift());empty=false}else{diff_text=diff_text.substring(0,patch_size-patch.length1-this.Patch_Margin);patch.length1+=diff_text.length;start1+=diff_text.length;if(diff_type===DIFF_EQUAL){patch.length2+=diff_text.length;start2+=diff_text.length}else{empty=false}patch.diffs.push([diff_type,diff_text]);if(diff_text==bigpatch.diffs[0][1]){bigpatch.diffs.shift()}else{bigpatch.diffs[0][1]=bigpatch.diffs[0][1].substring(diff_text.length)}}}precontext=this.diff_text2(patch.diffs);precontext=precontext.substring(precontext.length-this.Patch_Margin);var postcontext=this.diff_text1(bigpatch.diffs).substring(0,this.Patch_Margin);if(postcontext!==''){patch.length1+=postcontext.length;patch.length2+=postcontext.length;if(patch.diffs.length!==0&&patch.diffs[patch.diffs.length-1][0]===DIFF_EQUAL){patch.diffs[patch.diffs.length-1][1]+=postcontext}else{patch.diffs.push([DIFF_EQUAL,postcontext])}}if(!empty){patches.splice(x++,0,patch)}}}}};diff_match_patch.prototype.patch_toText=function(patches){var text=[];for(var x=0;x<patches.length;x++){text.push(patches[x])}return text.join('')};diff_match_patch.prototype.patch_fromText=function(textline){var patches=[];var text=textline.split('\n');while(text.length!==0){var m=text[0].match(/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/);if(!m){return alert('Invalid patch string:\n'+text[0])}var patch=new patch_obj();patches.push(patch);patch.start1=parseInt(m[1],10);if(m[2]===''){patch.start1--;patch.length1=1}else if(m[2]=='0'){patch.length1=0}else{patch.start1--;patch.length1=parseInt(m[2],10)}patch.start2=parseInt(m[3],10);if(m[4]===''){patch.start2--;patch.length2=1}else if(m[4]=='0'){patch.length2=0}else{patch.start2--;patch.length2=parseInt(m[4],10)}text.shift();while(text.length!==0){var sign=text[0].charAt(0);var line=decodeURIComponent(text[0].substring(1));if(sign=='-'){patch.diffs.push([DIFF_DELETE,line])}else if(sign=='+'){patch.diffs.push([DIFF_INSERT,line])}else if(sign==' '){patch.diffs.push([DIFF_EQUAL,line])}else if(sign=='@'){break}else if(sign===''){}else{return alert('Invalid patch mode: "'+sign+'"\n'+line)}text.shift()}}return patches};function patch_obj(){this.diffs=[];this.start1=null;this.start2=null;this.length1=0;this.length2=0}patch_obj.prototype.toString=function(){var coords1,coords2;if(this.length1===0){coords1=this.start1+',0'}else if(this.length1==1){coords1=this.start1+1}else{coords1=(this.start1+1)+','+this.length1}if(this.length2===0){coords2=this.start2+',0'}else if(this.length2==1){coords2=this.start2+1}else{coords2=(this.start2+1)+','+this.length2}var txt=['@@ -',coords1,' +',coords2,' @@\n'];for(var x=0;x<this.diffs.length;x++){switch(this.diffs[x][0]){case DIFF_DELETE:txt.push('-');break;case DIFF_EQUAL:txt.push(' ');break;case DIFF_INSERT:txt.push('+');break;default:alert('Invalid diff operation in patch_obj.toString()')}txt.push(encodeURI(this.diffs[x][1]),'\n')}return txt.join('').replace(/%20/g,' ')};
|
@@ -0,0 +1,111 @@
|
|
1
|
+
|
2
|
+
describe('util.PathUtils#basenameの動作確認', {
|
3
|
+
'"aaa/bbb.txt" → "bbb.txt" ': function() {
|
4
|
+
value_of(util.PathUtils.basename("aaa/bbb.txt")).should_be("bbb.txt");
|
5
|
+
},
|
6
|
+
'"/aaa/ccc/bbb" → "bbb" ': function() {
|
7
|
+
value_of(util.PathUtils.basename("/aaa/ccc/bbb")).should_be("bbb");
|
8
|
+
},
|
9
|
+
'"aaa/日本語" → "日本語" ': function() {
|
10
|
+
value_of(util.PathUtils.basename("aaa/日本語")).should_be("日本語");
|
11
|
+
},
|
12
|
+
'"日本語" (スラッシュを含まない) → "日本語" ': function() {
|
13
|
+
value_of(util.PathUtils.basename("日本語")).should_be("日本語");
|
14
|
+
},
|
15
|
+
'"日本語/" (スラッシュが末尾) → "" ': function() {
|
16
|
+
value_of(util.PathUtils.basename("日本語/")).should_be("");
|
17
|
+
},
|
18
|
+
'"/" (スラッシュのみ) → "" ': function() {
|
19
|
+
value_of(util.PathUtils.basename("/")).should_be("");
|
20
|
+
},
|
21
|
+
'"" (空文字列) → "" ': function() {
|
22
|
+
value_of(util.PathUtils.basename("")).should_be("");
|
23
|
+
},
|
24
|
+
'null → "" ': function() {
|
25
|
+
value_of(util.PathUtils.basename(null)).should_be("");
|
26
|
+
},
|
27
|
+
'undefined → "" ': function() {
|
28
|
+
value_of(util.PathUtils.basename(undefined)).should_be("");
|
29
|
+
}
|
30
|
+
});
|
31
|
+
|
32
|
+
describe('util.PathUtils#dirnameの動作確認', {
|
33
|
+
'"aaa/bbb.txt" → "aaa" ': function() {
|
34
|
+
value_of(util.PathUtils.dirname("aaa/bbb.txt")).should_be("aaa");
|
35
|
+
},
|
36
|
+
'"/aaa/ccc/bbb" → "/aaa/ccc" ': function() {
|
37
|
+
value_of(util.PathUtils.dirname("/aaa/ccc/bbb")).should_be("/aaa/ccc");
|
38
|
+
},
|
39
|
+
'"/a/日本語/日本語" → "/a/日本語" ': function() {
|
40
|
+
value_of(util.PathUtils.dirname("/a/日本語/日本語")).should_be("/a/日本語");
|
41
|
+
},
|
42
|
+
'"日本語" (スラッシュを含まない) → "" ': function() {
|
43
|
+
value_of(util.PathUtils.dirname("日本語")).should_be("");
|
44
|
+
},
|
45
|
+
'"日本語/" (スラッシュが末尾) → "" ': function() {
|
46
|
+
value_of(util.PathUtils.dirname("日本語/")).should_be("日本語");
|
47
|
+
},
|
48
|
+
'"/" (スラッシュのみ) → "" ': function() {
|
49
|
+
value_of(util.PathUtils.dirname("/")).should_be("");
|
50
|
+
},
|
51
|
+
'"" (空文字列) → "" ': function() {
|
52
|
+
value_of(util.PathUtils.dirname("")).should_be("");
|
53
|
+
},
|
54
|
+
'null → "" ': function() {
|
55
|
+
value_of(util.PathUtils.dirname(null)).should_be("");
|
56
|
+
},
|
57
|
+
'undefined → "" ': function() {
|
58
|
+
value_of(util.PathUtils.dirname(undefined)).should_be("");
|
59
|
+
}
|
60
|
+
});
|
61
|
+
|
62
|
+
describe('util.PathUtils#isChildの動作確認', {
|
63
|
+
'path:"aaa/bbb/ccc", dir:"aaa/bbb", → true ': function() {
|
64
|
+
value_of(util.PathUtils.isChild("aaa/bbb/ccc", "aaa/bbb")).should_be(true);
|
65
|
+
},
|
66
|
+
'path:"aaa/bbb/ccc", dir:"aaa", → true ': function() {
|
67
|
+
value_of(util.PathUtils.isChild("aaa/bbb/ccc", "aaa")).should_be(true);
|
68
|
+
},
|
69
|
+
'path:"aaa/bbb/ccc", dir:"aaa/ccc", → false ': function() {
|
70
|
+
value_of(util.PathUtils.isChild("aaa/bbb/ccc", "aaa/ccc")).should_be(false);
|
71
|
+
},
|
72
|
+
'path:"aaa/bbb/ccc", dir:"aaa/bbbb", → false': function() {
|
73
|
+
value_of(util.PathUtils.isChild("aaa/bbb/ccc", "aaa/bbbb")).should_be(false);
|
74
|
+
},
|
75
|
+
'path:"aaa/bbb/ccc", dir:"aaa/bb", → false': function() {
|
76
|
+
value_of(util.PathUtils.isChild("aaa/bbb/ccc", "aaa/bb")).should_be(false);
|
77
|
+
},
|
78
|
+
'path:"日本語/ccc", dir:"日本語", → true': function() {
|
79
|
+
value_of(util.PathUtils.isChild("日本語/ccc", "日本語")).should_be(true);
|
80
|
+
},
|
81
|
+
'path:"/日本語/ccc", dir:"", → true': function() {
|
82
|
+
value_of(util.PathUtils.isChild("/日本語/ccc", "")).should_be(true);
|
83
|
+
},
|
84
|
+
'path:"", dir:"", → true': function() {
|
85
|
+
value_of(util.PathUtils.isChild("", "")).should_be(false);
|
86
|
+
}
|
87
|
+
});
|
88
|
+
|
89
|
+
describe('util.PathUtils#normarizeの動作確認', {
|
90
|
+
'基本のパターン': function() {
|
91
|
+
value_of(util.PathUtils.normarize([
|
92
|
+
"aaa/bbb",
|
93
|
+
"aaa",
|
94
|
+
"aa",
|
95
|
+
"aa/xx",
|
96
|
+
"aa/cc/dd",
|
97
|
+
"aa/cc",
|
98
|
+
"bb/dd/ss",
|
99
|
+
"bb/dd",
|
100
|
+
"cc/xx"
|
101
|
+
])).should_be([
|
102
|
+
"aa",
|
103
|
+
"aaa",
|
104
|
+
"bb/dd",
|
105
|
+
"cc/xx"
|
106
|
+
]);
|
107
|
+
},
|
108
|
+
'空の配列': function() {
|
109
|
+
value_of(util.PathUtils.normarize([])).should_be([]);
|
110
|
+
}
|
111
|
+
});
|
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
require 'jiji/util/file_lock'
|
3
|
+
require "jiji/models"
|
4
|
+
require 'jiji/util/util'
|
5
|
+
require 'jiji/operator'
|
6
|
+
require 'jiji/output'
|
7
|
+
require 'jiji/util/include_proxy'
|
8
|
+
|
9
|
+
module JIJI
|
10
|
+
|
11
|
+
#===エージェントを示すマーカーモジュール
|
12
|
+
#JIJIではこのモジュールをincludeしたクラスがエージェントとして認識されます。
|
13
|
+
#
|
14
|
+
module Agent
|
15
|
+
|
16
|
+
module Shared #:nodoc:
|
17
|
+
@@deleates = {}
|
18
|
+
def self.const_missing(id)
|
19
|
+
super unless @@deleates
|
20
|
+
result = nil
|
21
|
+
@@deleates.each_pair{|k,v|
|
22
|
+
if v.const_defined?(id)
|
23
|
+
result = v.const_get(id)
|
24
|
+
break
|
25
|
+
end
|
26
|
+
}
|
27
|
+
result ? result : super
|
28
|
+
end
|
29
|
+
def self.method_missing(name,*args, &block)
|
30
|
+
super unless @@deleates
|
31
|
+
target = nil
|
32
|
+
@@deleates.each_pair{|k,v|
|
33
|
+
if v.respond_to?(name)
|
34
|
+
target = v
|
35
|
+
break
|
36
|
+
end
|
37
|
+
}
|
38
|
+
target ? target.send( name, *args, &block ) : super
|
39
|
+
end
|
40
|
+
def self._delegates
|
41
|
+
@@deleates
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
#====エージェントの登録後に1度だけ呼び出される関数。
|
46
|
+
#必要に応じてオーバーライドしてください。コンストラクタと違いこのメソッドではoperatorやoutput,loggerが使用可能です。
|
47
|
+
def init( )
|
48
|
+
end
|
49
|
+
#====レート情報が通知されるメソッドです。
|
50
|
+
#エージェントが動作している間順次呼び出されます。
|
51
|
+
#このメソッドをオーバーライドして、シグナルの計算や取り引きを行うロジックを実装してください
|
52
|
+
#rates:: JIJI::Rates
|
53
|
+
def next_rates( rates )
|
54
|
+
end
|
55
|
+
#====設定可能なプロパティの一覧を返します。
|
56
|
+
#必要に応じてオーバーライドしてください。
|
57
|
+
#戻り値:: JIJI::Agent::Propertyの配列
|
58
|
+
def property_infos
|
59
|
+
[]
|
60
|
+
end
|
61
|
+
#====設定されたプロパティを取得します。
|
62
|
+
def properties
|
63
|
+
@properties
|
64
|
+
end
|
65
|
+
#====プロパティを設定します。
|
66
|
+
def properties=( properties )
|
67
|
+
@properties = properties
|
68
|
+
properties.each_pair {|k,v|
|
69
|
+
instance_variable_set("@#{k}", v)
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
#====エージェントの説明を返します。
|
74
|
+
#必要に応じてオーバーライドしてください。
|
75
|
+
def description
|
76
|
+
""
|
77
|
+
end
|
78
|
+
|
79
|
+
# オペレータ
|
80
|
+
attr :operator, true
|
81
|
+
# エラーロガー
|
82
|
+
attr :logger, true
|
83
|
+
# データの出力先
|
84
|
+
attr :output, true
|
85
|
+
|
86
|
+
#===エージェントのプロパティ
|
87
|
+
class Property
|
88
|
+
include JIJI::Util::Model
|
89
|
+
include JIJI::Util::JsonSupport
|
90
|
+
#====コンストラクタ
|
91
|
+
#id:: プロパティID
|
92
|
+
#name:: UIでの表示名
|
93
|
+
#default_value:: プロパティの初期値
|
94
|
+
#type:: 種類
|
95
|
+
def initialize( id, name, default_value=nil, type=:string )
|
96
|
+
@id = id
|
97
|
+
@name = name
|
98
|
+
@default = default_value
|
99
|
+
@type = type
|
100
|
+
end
|
101
|
+
#プロパティID。
|
102
|
+
#JIJI::Agent#properties=(props)で渡されるハッシュのキーになります。設定必須です。
|
103
|
+
attr :id, true
|
104
|
+
# UIでの表示名。設定必須です。
|
105
|
+
attr :name, true
|
106
|
+
# プロパティの初期値。
|
107
|
+
attr :default, true
|
108
|
+
# 種類。:string or :numberが指定可能。指定しない場合、:stringが指定されたものとみなされます。
|
109
|
+
attr :type, true
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
#===一定期間ごとに通知を受け取るエージェントの基底クラス。
|
115
|
+
class PeriodicallyAgent
|
116
|
+
include JIJI::Agent
|
117
|
+
include_proxy JIJI::Agent::Shared
|
118
|
+
|
119
|
+
#====コンストラクタ
|
120
|
+
#period:: レートの通知を受け取る間隔(分)の初期値
|
121
|
+
def initialize( period=10 )
|
122
|
+
@period = period
|
123
|
+
@start = nil
|
124
|
+
@rates = nil
|
125
|
+
end
|
126
|
+
def next_rates( rates )
|
127
|
+
@rates = PeriodicallyRates.new( rates.pair_infos ) unless @rates
|
128
|
+
now = rates.time
|
129
|
+
@start = now unless @start
|
130
|
+
@rates << rates
|
131
|
+
if ( now - @start ) > @period*60
|
132
|
+
next_period_rates( @rates )
|
133
|
+
@rates = PeriodicallyRates.new( rates.pair_infos )
|
134
|
+
@rates.start_time = now
|
135
|
+
@start = now
|
136
|
+
end
|
137
|
+
end
|
138
|
+
def property_infos
|
139
|
+
super() + [Property.new(:period, "レートの通知を受け取る間隔(分)", 10, :number)]
|
140
|
+
end
|
141
|
+
#====レート情報が通知されるメソッドです。
|
142
|
+
#エージェントが動作している間順次呼び出されます。
|
143
|
+
#このメソッドをオーバーライドして、シグナルの計算や取り引きを行うロジックを実装してください
|
144
|
+
#rates:: JIJI::PeriodicallyRates
|
145
|
+
def next_period_rates( rates )
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
|
2
|
+
require 'jiji/error'
|
3
|
+
require 'jiji/agent/agent'
|
4
|
+
require 'jiji/agent/agent_registry'
|
5
|
+
require 'jiji/agent/permitter'
|
6
|
+
require 'jiji/agent/util'
|
7
|
+
require 'jiji/output'
|
8
|
+
require 'jiji/operator'
|
9
|
+
require 'jiji/util/file_lock'
|
10
|
+
require 'set'
|
11
|
+
|
12
|
+
module JIJI
|
13
|
+
|
14
|
+
class AgentManager
|
15
|
+
|
16
|
+
include JIJI::AgentUtil
|
17
|
+
include Enumerable
|
18
|
+
State = Struct.new( :agent, :output, :operator, :active )
|
19
|
+
|
20
|
+
#コンストラクタ
|
21
|
+
#process_id:: プロセスID
|
22
|
+
#agent_registry:: エージェントレジストリ
|
23
|
+
#logger:: ロガー
|
24
|
+
#failsafe:: レートを通知した際にエージェントで発生したエラーを無視するかどうか?
|
25
|
+
def initialize( process_id, agent_registry, logger, failsafe=true )
|
26
|
+
@process_id = process_id
|
27
|
+
@agents = {}
|
28
|
+
@agent_registry = agent_registry
|
29
|
+
@logger = logger
|
30
|
+
# エージェントでエラーが発生した場合にエラーを無視し実行を継続するか
|
31
|
+
# true の場合、ログ出力後エラーを握って処理を継続(RMTはこちらで動作する)
|
32
|
+
# false の場合、ログ出力後エラーを再スロー(バックテストはこちらで動作する)
|
33
|
+
@failsafe = failsafe
|
34
|
+
end
|
35
|
+
|
36
|
+
# エージェントを追加する
|
37
|
+
def add( agent_id, agent, agent_name="" )
|
38
|
+
if @agents.key? agent_id
|
39
|
+
raise UserError.new( JIJI::ERROR_ALREADY_EXIST, "agent is already exist. id=#{agent_id}")
|
40
|
+
end
|
41
|
+
output = @output_manager.create( @process_id, agent_id )
|
42
|
+
output.agent_name = agent_name
|
43
|
+
op = AgentOperator.new( @operator, agent_name )
|
44
|
+
safe( conf.get( [:agent,:safe_level], 4) ){
|
45
|
+
agent.operator = op
|
46
|
+
agent.logger = @logger
|
47
|
+
agent.output = output
|
48
|
+
agent.init
|
49
|
+
}
|
50
|
+
@agents[agent_id] = State.new( agent, output, op, true )
|
51
|
+
end
|
52
|
+
|
53
|
+
# エージェントを破棄する
|
54
|
+
def remove( name )
|
55
|
+
unless @agents.key? name
|
56
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND, "agent not found. name=#{name}")
|
57
|
+
end
|
58
|
+
@agents.delete name
|
59
|
+
end
|
60
|
+
|
61
|
+
# エージェントの一覧を得る
|
62
|
+
def each( &block )
|
63
|
+
@agents.each( &block )
|
64
|
+
end
|
65
|
+
|
66
|
+
# エージェントを得る
|
67
|
+
def get( name )
|
68
|
+
@agents[name]
|
69
|
+
end
|
70
|
+
|
71
|
+
# エージェントをすべて破棄する
|
72
|
+
def clear
|
73
|
+
@agents.clear
|
74
|
+
end
|
75
|
+
|
76
|
+
# エージェントへのイベント通知を開始する
|
77
|
+
def on( agent_name )
|
78
|
+
unless @agents.key? agent_name
|
79
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND, "agent not found. name=#{agent_name}")
|
80
|
+
end
|
81
|
+
@agents[agent_name].active = true
|
82
|
+
end
|
83
|
+
|
84
|
+
# エージェントへのイベント通知を停止する
|
85
|
+
def off( agent_name )
|
86
|
+
unless @agents.key? agent_name
|
87
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND, "agent not found. name=#{agent_name}")
|
88
|
+
end
|
89
|
+
@agents[agent_name].active = false
|
90
|
+
end
|
91
|
+
|
92
|
+
# エージェントへのイベント通知状態を取得する
|
93
|
+
def on?( agent_name )
|
94
|
+
unless @agents.key? agent_name
|
95
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND, "agent not found. name=#{agent_name}")
|
96
|
+
end
|
97
|
+
@agents[agent_name].active
|
98
|
+
end
|
99
|
+
|
100
|
+
# レートを受け取ってエージェントに通知する。
|
101
|
+
def next_rates( rates )
|
102
|
+
@operator.next_rates( rates )
|
103
|
+
@agents.each_pair {|n,a|
|
104
|
+
a.output.time = rates.time
|
105
|
+
}
|
106
|
+
safe( conf.get( [:agent,:safe_level], 4) ){
|
107
|
+
@agents.each_pair {|n,a|
|
108
|
+
next unless a.active
|
109
|
+
if @failsafe
|
110
|
+
JIJI::Util.log_if_error( @logger ) {
|
111
|
+
next unless a.active
|
112
|
+
a.agent.next_rates( rates )
|
113
|
+
}
|
114
|
+
else
|
115
|
+
JIJI::Util.log_if_error_and_throw( @logger ) {
|
116
|
+
a.agent.next_rates( rates )
|
117
|
+
}
|
118
|
+
end
|
119
|
+
}
|
120
|
+
}
|
121
|
+
# 取引結果の集計
|
122
|
+
@trade_result_dao.next( operator, rates.time )
|
123
|
+
end
|
124
|
+
|
125
|
+
# 取引結果データを強制的にファイルに出力する。
|
126
|
+
def flush( time )
|
127
|
+
@trade_result_dao.flush( time )
|
128
|
+
@operator.flush
|
129
|
+
end
|
130
|
+
|
131
|
+
attr :agent_registry, true
|
132
|
+
attr :trade_result_dao, true
|
133
|
+
attr :operator, true
|
134
|
+
attr :conf, true
|
135
|
+
attr :output_manager, true
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
@@ -0,0 +1,165 @@
|
|
1
|
+
|
2
|
+
require 'jiji/error'
|
3
|
+
require 'jiji/agent/agent'
|
4
|
+
require 'jiji/agent/util'
|
5
|
+
require 'jiji/util/file_lock'
|
6
|
+
require 'set'
|
7
|
+
require 'logger'
|
8
|
+
|
9
|
+
module JIJI
|
10
|
+
|
11
|
+
#==エージェントレジストリ
|
12
|
+
class AgentRegistry
|
13
|
+
|
14
|
+
include JIJI::AgentUtil
|
15
|
+
include Enumerable
|
16
|
+
|
17
|
+
def initialize( agent_dir, shared_lib_dir )
|
18
|
+
@agent_dir = agent_dir
|
19
|
+
@shared_lib_dir = shared_lib_dir
|
20
|
+
@agents = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
# エージェント名を列挙する
|
24
|
+
def each( &block )
|
25
|
+
checked = Set.new
|
26
|
+
@agents.each() { |k,m|
|
27
|
+
find_agent( k, m, checked ) {|name| block.call(name) }
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# エージェントを生成する
|
32
|
+
def create(name, properties={})
|
33
|
+
cl = get(name)
|
34
|
+
safe( conf.get( [:agent,:safe_level], 4) ){
|
35
|
+
agent = cl.new
|
36
|
+
agent.properties = properties
|
37
|
+
agent
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
#エージェントを取得する
|
42
|
+
#name:: エージェント名( @ )
|
43
|
+
def get(name)
|
44
|
+
unless name =~ /([^@]+)@([^@]+)/
|
45
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND,
|
46
|
+
"agent class not found. name=#{name}")
|
47
|
+
end
|
48
|
+
m = @agents["agents/#{$2}"]
|
49
|
+
unless m
|
50
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND,
|
51
|
+
"agent class not found. name=#{name}")
|
52
|
+
end
|
53
|
+
|
54
|
+
path = $1.split("::")
|
55
|
+
path.each {|step|
|
56
|
+
unless m.const_defined? step
|
57
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND,
|
58
|
+
"agent class not found. name=#{name}")
|
59
|
+
end
|
60
|
+
m = m.const_get step
|
61
|
+
unless m
|
62
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND,
|
63
|
+
"agent class not found. name=#{name}")
|
64
|
+
end
|
65
|
+
unless m.kind_of?(Module)
|
66
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND,
|
67
|
+
"agent class not found. name=#{name}")
|
68
|
+
end
|
69
|
+
}
|
70
|
+
if m.kind_of?(Class) && m < JIJI::Agent
|
71
|
+
m
|
72
|
+
else
|
73
|
+
raise UserError.new( JIJI::ERROR_NOT_FOUND,
|
74
|
+
"agent class not found. name=#{name}")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# エージェントのプロパティ一覧を取得する
|
79
|
+
def get_property_infos(name)
|
80
|
+
cl = get(name)
|
81
|
+
return [] unless cl
|
82
|
+
safe( conf.get( [:agent,:safe_level], 4) ){
|
83
|
+
cl.new.property_infos
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
# エージェントの説明を取得する
|
88
|
+
def get_description(name)
|
89
|
+
cl = get(name)
|
90
|
+
return [] unless cl
|
91
|
+
safe( conf.get( [:agent,:safe_level], 4) ){
|
92
|
+
cl.new.description
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
# エージェント置き場から、エージェントをロードする。
|
97
|
+
# 起動時に一度だけ呼ばれる。
|
98
|
+
def load_all
|
99
|
+
[@agent_dir,@shared_lib_dir].each {|d|
|
100
|
+
@file_dao.list( d, true ).each {|item|
|
101
|
+
next if item[:type] == :directory
|
102
|
+
begin
|
103
|
+
inner_load( item[:path] )
|
104
|
+
rescue Exception
|
105
|
+
# ログ出力のみ行い、例外は握る。
|
106
|
+
server_logger.error( $! )
|
107
|
+
end
|
108
|
+
}
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
# 特定のファイルをロードする。
|
113
|
+
def load(file)
|
114
|
+
inner_load( file )
|
115
|
+
end
|
116
|
+
|
117
|
+
# 特定のファイルをアンロードする。
|
118
|
+
def unload(file)
|
119
|
+
if file =~ /^#{@agent_dir}\/.*/
|
120
|
+
@agents.delete file
|
121
|
+
else
|
122
|
+
JIJI::Agent::Shared._delegates.delete file
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
attr :conf, true
|
127
|
+
attr :file_dao, true
|
128
|
+
attr :server_logger, true
|
129
|
+
private
|
130
|
+
|
131
|
+
def inner_load( file )
|
132
|
+
body = @file_dao.get(file).taint
|
133
|
+
m = Module.new.taint
|
134
|
+
if file =~ /^#{@agent_dir}\/.*/
|
135
|
+
@agents[ file ] = m
|
136
|
+
elsif file =~ /^#{@shared_lib_dir}\/.*/
|
137
|
+
JIJI::Agent::Shared._delegates[ file ] = m
|
138
|
+
else
|
139
|
+
return # agent,shared_lib配下のファイル以外は読み込まない。
|
140
|
+
end
|
141
|
+
safe( conf.get( [:agent,:safe_level], 4) ){
|
142
|
+
m.module_eval( body, file, 1 )
|
143
|
+
}
|
144
|
+
end
|
145
|
+
|
146
|
+
def find_agent( file, m, checked, &block )
|
147
|
+
return if checked.include? m
|
148
|
+
checked << m
|
149
|
+
m.constants.each {|name|
|
150
|
+
cl = m.const_get name
|
151
|
+
agent_file = file.sub( /^#{@agent_dir}\/?/, "" )
|
152
|
+
begin
|
153
|
+
block.call( "#{get_name(cl.name)}@#{agent_file}" ) if cl.kind_of?(Class) && cl < JIJI::Agent
|
154
|
+
rescue Exception
|
155
|
+
end
|
156
|
+
find_agent( file, cl, checked, &block ) if cl.kind_of?(Module)
|
157
|
+
}
|
158
|
+
end
|
159
|
+
def get_name( name )
|
160
|
+
name.split("::", 2)[1]
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|