MINT-core 1.0.1 → 2.0.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/Gemfile +22 -3
- data/Gemfile.lock +98 -22
- data/History.txt +262 -0
- data/LICENSE +30 -0
- data/MINT-core.gemspec +25 -80
- data/Manifest.txt +145 -30
- data/README.rdoc +6 -163
- data/Rakefile +16 -17
- data/bin/mint-aui +3 -3
- data/bin/mint-cui-gfx +3 -2
- data/bin/mint-juggernaut.sh +0 -0
- data/bin/mint-tuplespace +0 -0
- data/lib/MINT-core.rb +53 -15
- data/lib/MINT-core/agent/agent.rb +1 -1
- data/lib/MINT-core/agent/aui.rb +0 -14
- data/lib/MINT-core/agent/auicontrol.rb +91 -38
- data/lib/MINT-core/agent/cui-gfx.rb +3 -3
- data/lib/MINT-core/agent/cuicontrol.rb +94 -24
- data/lib/MINT-core/connector/redis_connector.rb +16 -0
- data/lib/MINT-core/manager/mapping_manager.rb +101 -0
- data/lib/MINT-core/manager/mapping_parser.rb +89 -0
- data/lib/MINT-core/manager/mapping_server.rb +99 -0
- data/lib/MINT-core/manager/position_updater.rb +33 -0
- data/lib/MINT-core/manager/scxml_client.rb +118 -0
- data/lib/MINT-core/manager/scxml_server.rb +86 -0
- data/lib/MINT-core/mapping/action/action.rb +32 -0
- data/lib/MINT-core/mapping/action/backend_action.rb +32 -0
- data/lib/MINT-core/mapping/action/bind_action.rb +88 -0
- data/lib/MINT-core/mapping/action/event_action.rb +40 -0
- data/lib/MINT-core/mapping/complementary_mapping.rb +31 -0
- data/lib/MINT-core/mapping/mapping.rb +170 -34
- data/lib/MINT-core/mapping/observation/negation_observation.rb +64 -0
- data/lib/MINT-core/mapping/observation/observation.rb +219 -0
- data/lib/MINT-core/mapping/sequential.rb +1 -2
- data/lib/MINT-core/mapping/sequential_mapping.rb +60 -0
- data/lib/MINT-core/model/aui/AIChoiceElement.rb +17 -0
- data/lib/MINT-core/model/aui/AICommand.rb +7 -0
- data/lib/MINT-core/model/aui/AIContainer.rb +73 -0
- data/lib/MINT-core/model/aui/AIContext.rb +12 -0
- data/lib/MINT-core/model/aui/AIIN.rb +8 -0
- data/lib/MINT-core/model/aui/AIINContinuous.rb +56 -0
- data/lib/MINT-core/model/aui/AIINDiscrete.rb +8 -0
- data/lib/MINT-core/model/aui/AIMultiChoice.rb +1 -2
- data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +4 -51
- data/lib/MINT-core/model/aui/AIO.rb +76 -123
- data/lib/MINT-core/model/aui/AIOUT.rb +8 -0
- data/lib/MINT-core/model/aui/AIOUTContinuous.rb +61 -0
- data/lib/MINT-core/model/aui/AIReference.rb +16 -0
- data/lib/MINT-core/model/aui/AISingleChoice.rb +18 -1
- data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +10 -56
- data/lib/MINT-core/model/aui/AISinglePresence.rb +39 -71
- data/lib/MINT-core/model/aui/aicommand.scxml +47 -0
- data/lib/MINT-core/model/aui/aicontainer.scxml +41 -0
- data/lib/MINT-core/model/aui/aicontext.scxml +34 -0
- data/lib/MINT-core/model/aui/aiincontinuous.scxml +59 -0
- data/lib/MINT-core/model/aui/aiinrange.scxml +86 -0
- data/lib/MINT-core/model/aui/aimultichoice.scxml +67 -0
- data/lib/MINT-core/model/aui/aimultichoiceelement.scxml +51 -0
- data/lib/MINT-core/model/aui/aio.scxml +18 -27
- data/lib/MINT-core/model/aui/aioutcontinuous.scxml +66 -0
- data/lib/MINT-core/model/aui/aireference.scxml +28 -0
- data/lib/MINT-core/model/aui/aisinglechoice.scxml +60 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +45 -60
- data/lib/MINT-core/model/aui/aisinglepresence.scxml +15 -24
- data/lib/MINT-core/model/aui/model.rb +15 -38
- data/lib/MINT-core/model/cui/gfx/CIC.rb +34 -10
- data/lib/MINT-core/model/cui/gfx/CIO.rb +66 -115
- data/lib/MINT-core/model/cui/gfx/CarouFredSel.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb +6 -0
- data/lib/MINT-core/model/cui/gfx/button.rb +16 -0
- data/lib/MINT-core/model/cui/gfx/button.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/caroufredsel.rb +48 -0
- data/lib/MINT-core/model/cui/gfx/cic.scxml +57 -0
- data/lib/MINT-core/model/cui/gfx/cio.scxml +54 -0
- data/lib/MINT-core/model/cui/gfx/markableradiobutton.scxml +67 -0
- data/lib/MINT-core/model/cui/gfx/model.rb +39 -176
- data/lib/MINT-core/model/cui/gfx/radiobutton.scxml +59 -0
- data/lib/MINT-core/model/interactor.rb +167 -46
- data/lib/MINT-core/model/interactor.scxml +3 -0
- data/lib/MINT-core/model/interactor_helpers.rb +25 -0
- data/lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb +15 -0
- data/lib/MINT-core/model/ir/body/body.rb +5 -0
- data/lib/MINT-core/model/ir/body/fingertip.rb +114 -0
- data/lib/MINT-core/model/ir/body/fingertip.scxml +43 -0
- data/lib/MINT-core/model/{body → ir/body}/gesture_button.rb +0 -0
- data/lib/MINT-core/model/ir/body/hand.rb +5 -0
- data/lib/MINT-core/model/ir/body/head.rb +102 -0
- data/lib/MINT-core/model/ir/body/head.scxml +92 -0
- data/lib/MINT-core/model/ir/body/onehandposenavigation.scxml +53 -0
- data/lib/MINT-core/model/ir/body/pose.rb +99 -0
- data/lib/MINT-core/model/ir/browserscreen.rb +27 -0
- data/lib/MINT-core/model/ir/browserscreen.scxml +14 -0
- data/lib/MINT-core/model/{device → ir}/button.rb +1 -1
- data/lib/MINT-core/model/ir/ir.rb +5 -0
- data/lib/MINT-core/model/ir/irmedia.rb +5 -0
- data/lib/MINT-core/model/ir/irmode.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/joypad.rb +1 -1
- data/lib/MINT-core/model/ir/mouse.rb +44 -0
- data/lib/MINT-core/model/ir/mouse.scxml +35 -0
- data/lib/MINT-core/model/{device/mouse.rb → ir/mouse_old.rb} +2 -2
- data/lib/MINT-core/model/{device → ir}/pointer.rb +20 -22
- data/lib/MINT-core/model/ir/pointer.scxml +19 -0
- data/lib/MINT-core/model/ir/screen.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/wheel.rb +1 -1
- data/lib/MINT-core/model/mim/aicommand_activate_to_button_press.xml +13 -0
- data/lib/MINT-core/model/mim/aicommand_deactivate_to_button_release.xml +13 -0
- data/lib/MINT-core/model/mim/aio_defocus_to_cio_unhighlight.xml +13 -0
- data/lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml +14 -0
- data/lib/MINT-core/model/mim/aio_present_to_cio_display.xml +14 -0
- data/lib/MINT-core/model/mim/aio_suspend_to_cio_hide.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_chosen_to_radiobutton_select.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_unchosen_to_radiobutton_unselect.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglepresence_children_finished_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglepresence_present_to_child_present.xml +15 -0
- data/lib/MINT-core/model/mim/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/lib/MINT-core/model/mim/button_press_to_aicommand_activate.xml +12 -0
- data/lib/MINT-core/model/mim/button_release_to_aicommand_deactivate.xml +12 -0
- data/lib/MINT-core/model/mim/caroufredsel_refreshing_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_defocus.xml +13 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_present.xml +12 -0
- data/lib/MINT-core/model/mim/cio_display_to_cio_display_cache_add.xml +11 -0
- data/lib/MINT-core/model/mim/cio_hide_to_aio_suspend.xml +12 -0
- data/lib/MINT-core/model/mim/cio_hide_to_cio_display_cache_remove.xml +12 -0
- data/lib/MINT-core/model/mim/cio_highlight_to_aio_focus.xml +13 -0
- data/lib/MINT-core/model/mim/head_looking_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_looking_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_nodding_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_tilting_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_tilting_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_enter.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/mim_default.xml +52 -0
- data/lib/MINT-core/model/mim/mint-mappings.xsd +127 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aicommand_activate.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_choose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_unchoose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_release_to_aicommand_deactivate.xml +16 -0
- data/lib/MINT-core/model/mim/mouse_stop_to_cio_highlight.xml +13 -0
- data/lib/MINT-core/model/mim/onehandposnav_confirm_to_aichoiceelement_choose.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_next_to_aio_next.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_previous_to_aio_prev.xml +14 -0
- data/lib/MINT-core/model/mim/radiobutton_selected_to_aisinglechoiceelement_choose.xml +13 -0
- data/lib/MINT-core/model/mim/radiobutton_unselected_to_aisinglechoiceelement_unchoose.xml +13 -0
- data/lib/MINT-core/model/mim/right_button_aisinglepresence_prev.xml +15 -0
- data/lib/MINT-core/model/task.rb +6 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/spec/AICommand_spec.rb +20 -0
- data/spec/AIContainer_spec.rb +161 -0
- data/spec/AIINContinuous_spec.rb +92 -0
- data/spec/AIOUTContinuous_spec.rb +93 -0
- data/spec/AIO_spec.rb +73 -0
- data/spec/AIReference_spec.rb +105 -0
- data/spec/AISinglePresence_spec.rb +204 -60
- data/spec/Button_spec.rb +114 -0
- data/spec/CIO_spec.rb +145 -0
- data/spec/Interactor_spec.rb +95 -0
- data/spec/MappingManager_spec.rb +126 -0
- data/spec/Spontaneous_spec.rb +53 -0
- data/spec/aio_agent_spec.rb +215 -186
- data/spec/aisinglechoice_spec.rb +147 -88
- data/spec/aisinglechoiceelement_spec.rb +154 -70
- data/spec/complementary_mapping_spec.rb +158 -0
- data/spec/core_spec.rb +27 -15
- data/spec/cui_helper.rb +100 -0
- data/spec/examples/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/spec/examples/mim_streaming_example.xml +9 -0
- data/spec/examples/mouse_highlight.xml +22 -0
- data/spec/examples/performance_mapping.xml +15 -0
- data/spec/examples/reset_click.xml +24 -0
- data/spec/interactor_test.scxml +32 -0
- data/spec/interactor_test_2.scxml +16 -0
- data/spec/mapping_performance_spec.rb +118 -0
- data/spec/mapping_server_spec.rb +161 -0
- data/spec/mapping_spec.rb +307 -0
- data/spec/music_spec.rb +301 -135
- data/spec/performance_counter.scxml +9 -0
- data/spec/sequential_mappings_spec.rb +69 -0
- data/spec/shared/aio_shared.rb +144 -0
- data/spec/spec_helper.rb +22 -3
- data/spec/spontaneous.scxml +11 -0
- data/spec/support/connection_helper.rb +19 -0
- data/spec/support/redis_connector_monkey_patch.rb +1 -0
- data/spec/support/statemachine_helper.rb +84 -0
- data/spec/sync_mappings_spec.rb +96 -0
- metadata +219 -354
- data/lib/MINT-core/mapping/complementary.rb +0 -100
- data/lib/MINT-core/mapping/on_state_change.rb +0 -65
- data/lib/MINT-core/model/aui/AIC.rb +0 -86
- data/lib/MINT-core/model/aui/AIChoice.rb +0 -65
- data/lib/MINT-core/model/aui/AIINChoose.rb +0 -54
- data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +0 -43
- data/lib/MINT-core/model/aui/aic.png +0 -0
- data/lib/MINT-core/model/aui/aic.scxml +0 -50
- data/lib/MINT-core/model/aui/aichoice.png +0 -0
- data/lib/MINT-core/model/aui/aichoice.scxml +0 -60
- data/lib/MINT-core/model/aui/aio.png +0 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
- data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
- data/lib/MINT-core/model/body/handgesture.rb +0 -279
- data/lib/MINT-core/model/body/head.png +0 -0
- data/lib/MINT-core/model/body/head.rb +0 -51
- data/lib/MINT-core/model/body/head.scxml +0 -28
- data/lib/MINT-core/model/cui/gfx/screen.rb +0 -18
- data/lib/MINT-core/overrides/rinda.rb +0 -34
- data/spec/AIC_spec.rb +0 -69
- data/spec/MINT-core_spec.rb +0 -11
- data/spec/aio_spec.rb +0 -144
- data/spec/cio_spec.rb +0 -369
- data/tasks/rspec.rake +0 -21
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<mapping name="Sync Mouse stop to CIO highlight" xmlns="http://www.multi-access.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
2
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
3
|
+
|
|
4
|
+
<operator type="complementary" id="33113" >
|
|
5
|
+
<observations>
|
|
6
|
+
<observation id="111" interactor="Interactor.IR.IRMode.Pointer.Mouse" states="stopped" result="p" process="onchange"/>
|
|
7
|
+
</observations>
|
|
8
|
+
<actions>
|
|
9
|
+
<backend id="2222" call="find_cio_from_coordinates" class="CUIControl" parameter="p"/>
|
|
10
|
+
</actions>
|
|
11
|
+
</operator>
|
|
12
|
+
|
|
13
|
+
</mapping>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<mapping name="OneHandPoseNavigation confirm to AIChoiceElement choose" xmlns="http://www.multi-access.de"
|
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
4
|
+
|
|
5
|
+
<operator id="1" type="sequential">
|
|
6
|
+
<observations>
|
|
7
|
+
<observation id="2" interactor="Interactor.IR.IRMode.Body.Hand.Pose.OneHandPoseNavigation" states="confirmed" process="onchange" />
|
|
8
|
+
<observation id="3" interactor="Interactor.AIO.AIIN.AIINDiscrete.AIReference.AIChoiceElement" states="focused" result="aic" process="instant" />
|
|
9
|
+
</observations>
|
|
10
|
+
<actions>
|
|
11
|
+
<event id="4" type="choose" target="aic"/>
|
|
12
|
+
</actions>
|
|
13
|
+
</operator>
|
|
14
|
+
</mapping>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<mapping name="OneHandPoseNavigation next to AIO next" xmlns="http://www.multi-access.de"
|
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
4
|
+
|
|
5
|
+
<operator id="1" type="sequential">
|
|
6
|
+
<observations>
|
|
7
|
+
<observation id="2" interactor="Interactor.IR.IRMode.Body.Hand.Pose.OneHandPoseNavigation" states="next" process="onchange" />
|
|
8
|
+
<observation id="3" interactor="Interactor.AIO" states="focused" result="aio" process="instant" />
|
|
9
|
+
</observations>
|
|
10
|
+
<actions>
|
|
11
|
+
<event id="4" type="next" target="aio"/>
|
|
12
|
+
</actions>
|
|
13
|
+
</operator>
|
|
14
|
+
</mapping>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<mapping name="OneHandPoseNavigation previous to AIO prev" xmlns="http://www.multi-access.de"
|
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
4
|
+
|
|
5
|
+
<operator id="1" type="sequential">
|
|
6
|
+
<observations>
|
|
7
|
+
<observation id="2" interactor="Interactor.IR.IRMode.Body.Hand.Pose.OneHandPoseNavigation" states="previous" process="onchange" />
|
|
8
|
+
<observation id="3" interactor="Interactor.AIO" states="focused" result="aio" process="instant" />
|
|
9
|
+
</observations>
|
|
10
|
+
<actions>
|
|
11
|
+
<event id="4" type="prev" target="aio"/>
|
|
12
|
+
</actions>
|
|
13
|
+
</operator>
|
|
14
|
+
</mapping>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<mapping name="Sync RadioButton selected to AISingleChoiceElement choose" xmlns="http://www.multi-access.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
2
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
3
|
+
<operator type="sequential" id="1">
|
|
4
|
+
<observations>
|
|
5
|
+
<observation id="2" interactor="Interactor.CIO.RadioButton" states="selected" result="cio" process="onchange"/>
|
|
6
|
+
<observation id="3" type="negation" interactor="Interactor.AIO.AIIN.AIINDiscrete.AIReference.AIChoiceElement.AISingleChoiceElement" name="cio.name" states="chosen" result="aio" process="instant"/>
|
|
7
|
+
</observations>
|
|
8
|
+
<actions>
|
|
9
|
+
<event id="4" type="choose" target="aio"/>
|
|
10
|
+
</actions>
|
|
11
|
+
</operator>
|
|
12
|
+
</mapping>
|
|
13
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<mapping name="Sync RadioButton unselected to AISingleChoiceElement unchoose" xmlns="http://www.multi-access.de" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
2
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
3
|
+
<operator type="sequential" id="1">
|
|
4
|
+
<observations>
|
|
5
|
+
<observation id="2" interactor="Interactor.CIO.RadioButton" states="unselected" result="cio" process="onchange"/>
|
|
6
|
+
<observation id="3" type="negation" interactor="Interactor.AIO.AIIN.AIINDiscrete.AIReference.AIChoiceElement.AISingleChoiceElement" name="cio.name" states="listed" result="aio" process="instant"/>
|
|
7
|
+
</observations>
|
|
8
|
+
<actions>
|
|
9
|
+
<event id="4" type="unchoose" target="aio"/>
|
|
10
|
+
</actions>
|
|
11
|
+
</operator>
|
|
12
|
+
</mapping>
|
|
13
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<mapping name="Right Button click to AISinglePresence prev" xmlns="http://www.multi-access.de"
|
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
3
|
+
xsi:schemaLocation="http://www.multi-access.de mint-mappings.xsd">
|
|
4
|
+
|
|
5
|
+
<operator id="1" type="sequential">
|
|
6
|
+
<observations>
|
|
7
|
+
<observation id="2" interactor="Interactor.IR.IRMode.Pointer.Mouse" states="right_pressed" process="onchange" />
|
|
8
|
+
<observation id="3" interactor="Interactor.AIO.AIOUT.AIContainer.AISinglePresence" states="entered" result="ais" process="instant" />
|
|
9
|
+
</observations>
|
|
10
|
+
<actions>
|
|
11
|
+
<event id="4" type="prev" target="ais"/>
|
|
12
|
+
</actions>
|
|
13
|
+
</operator>
|
|
14
|
+
|
|
15
|
+
</mapping>
|
data/lib/MINT-core/model/task.rb
CHANGED
|
@@ -5,12 +5,12 @@ module MINT
|
|
|
5
5
|
# A {Task} defines the basic control flow object, has a {#parent} task, unless it's the root task and a textual,
|
|
6
6
|
# unstructured {#description}.
|
|
7
7
|
#
|
|
8
|
-
class Task <
|
|
8
|
+
class Task < Interactor
|
|
9
9
|
# belongs_to :parent, "Task"
|
|
10
10
|
property :description, Text
|
|
11
11
|
|
|
12
12
|
def initialize_statemachine
|
|
13
|
-
if @statemachine.
|
|
13
|
+
if @statemachine.nil?
|
|
14
14
|
|
|
15
15
|
@statemachine = Statemachine.build do
|
|
16
16
|
trans :initialized, :run, :running
|
|
@@ -22,10 +22,10 @@ module MINT
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
# Each {InteractionTask} is linked to one abstract interaction container
|
|
25
|
-
# {MINT::
|
|
25
|
+
# {MINT::AIContainer}
|
|
26
26
|
#
|
|
27
27
|
class InteractionTask < Task
|
|
28
|
-
# has 1, :
|
|
28
|
+
# has 1, :AIContainer @TODO - Mappings unklar
|
|
29
29
|
belongs_to :pts, "PTS"
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -58,9 +58,9 @@ module MINT
|
|
|
58
58
|
# A Presentation Task set {PTS} contains a set of active interaction tasks that should be presented or manipulated by the
|
|
59
59
|
# user
|
|
60
60
|
#
|
|
61
|
-
class PTS <
|
|
61
|
+
class PTS < Interactor
|
|
62
62
|
def initialize_statemachine
|
|
63
|
-
if @statemachine.
|
|
63
|
+
if @statemachine.nil?
|
|
64
64
|
@statemachine = Statemachine.build do
|
|
65
65
|
trans :initialized, :calculate, :calculating
|
|
66
66
|
trans :calculating, :done, :finished
|
data/script/console
CHANGED
|
File without changes
|
data/script/destroy
CHANGED
|
File without changes
|
data/script/generate
CHANGED
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
require "em-spec/rspec"
|
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'shared/aio_shared'))
|
|
5
|
+
|
|
6
|
+
describe 'AUI' do
|
|
7
|
+
|
|
8
|
+
before :each do
|
|
9
|
+
Redis.connect.flushall
|
|
10
|
+
@interactor_class = MINT::AICommand
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it_should_behave_like 'An AIO interactor'
|
|
14
|
+
|
|
15
|
+
describe 'AICommand' do
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
end
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
require "em-spec/rspec"
|
|
3
|
+
|
|
4
|
+
describe 'AUI' do
|
|
5
|
+
include EventMachine::SpecHelper
|
|
6
|
+
|
|
7
|
+
before :all do
|
|
8
|
+
class ::Helper
|
|
9
|
+
def self.create_structure
|
|
10
|
+
MINT::AIContainer.create(:name=>"a", :children =>"e1|e2|e3")
|
|
11
|
+
MINT::AIO.create(:name => "e1", :parent=>"a")
|
|
12
|
+
MINT::AIO.create(:name => "e2", :parent=>"a")
|
|
13
|
+
MINT::AIO.create(:name => "e3", :parent=>"a")
|
|
14
|
+
MINT::AIContainer.first
|
|
15
|
+
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
connection_options = { :adapter => "redis"}
|
|
20
|
+
DataMapper.setup(:default, connection_options)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
connect do |redis|
|
|
24
|
+
require "MINT-core"
|
|
25
|
+
|
|
26
|
+
DataMapper.finalize
|
|
27
|
+
DataMapper::Model.raise_on_save_failure = true
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
describe 'AIContainer' do
|
|
33
|
+
it 'should initialize with initiated' do
|
|
34
|
+
connect do |redis|
|
|
35
|
+
@a = Helper.create_structure
|
|
36
|
+
|
|
37
|
+
@a.states.should ==[:initialized]
|
|
38
|
+
@a.new_states.should == [:initialized]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should transform to organizing state ' do
|
|
43
|
+
connect do |redis|
|
|
44
|
+
@a = Helper.create_structure
|
|
45
|
+
@a.process_event(:organize).should ==[:organized]
|
|
46
|
+
@a.states.should == [:organized]
|
|
47
|
+
@a.new_states.should == [:organized]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should support parent navigation' do
|
|
52
|
+
connect do |redis|
|
|
53
|
+
@a = Helper.create_structure
|
|
54
|
+
e = MINT::AIO.first(:name => "e1")
|
|
55
|
+
p = e.parent
|
|
56
|
+
p.should == @a
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'should support navigation to child' do
|
|
61
|
+
|
|
62
|
+
connect do |redis|
|
|
63
|
+
@a = Helper.create_structure
|
|
64
|
+
|
|
65
|
+
aio = @a.children.first
|
|
66
|
+
aio.states=[:defocused]
|
|
67
|
+
|
|
68
|
+
@a.states = [:focused]
|
|
69
|
+
|
|
70
|
+
@a.process_event(:child)
|
|
71
|
+
|
|
72
|
+
@a.states.should ==[:defocused]
|
|
73
|
+
e = MINT::AIO.first(:name => "e1")
|
|
74
|
+
e.states.should ==[:focused]
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
it 'should transform all children to presented if presented' do
|
|
80
|
+
connect do |redis|
|
|
81
|
+
@a = Helper.create_structure
|
|
82
|
+
AUIControl.organize(@a,nil,0)
|
|
83
|
+
# @a.process_event(:organize).should ==[:organized]
|
|
84
|
+
@a.states.should == [:organized]
|
|
85
|
+
@a.new_states.should == [:organized]
|
|
86
|
+
@a.process_event(:present).should ==[:defocused]
|
|
87
|
+
@a.children.each do |c|
|
|
88
|
+
c.states.should == [:defocused]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it 'should transform all children to suspended if suspended' do
|
|
94
|
+
connect do |redis|
|
|
95
|
+
@a = Helper.create_structure
|
|
96
|
+
@a.children.each do |c|
|
|
97
|
+
c.states = [:defocused]
|
|
98
|
+
end
|
|
99
|
+
@a.states = [:focused]
|
|
100
|
+
|
|
101
|
+
@a.process_event(:suspend).should ==[:suspended]
|
|
102
|
+
@a.children.each do |c|
|
|
103
|
+
c.states.should == [:suspended]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'should transform all children to suspended if AUIControl.suspend_all is called' do
|
|
109
|
+
connect do |redis|
|
|
110
|
+
@b = MINT::AIContainer.create(:name=>"b", :children =>"a")
|
|
111
|
+
@b.states = [:defocused]
|
|
112
|
+
|
|
113
|
+
@a = Helper.create_structure
|
|
114
|
+
@a.parent = "b"
|
|
115
|
+
|
|
116
|
+
@a.children.each do |c|
|
|
117
|
+
c.states = [:defocused]
|
|
118
|
+
c.save
|
|
119
|
+
end
|
|
120
|
+
@a.states = [:focused]
|
|
121
|
+
|
|
122
|
+
#@b.process_event(:suspend).should ==[:suspended]
|
|
123
|
+
AUIControl.suspend_all
|
|
124
|
+
|
|
125
|
+
@a = MINT::AIContainer.first(:name=>"a")
|
|
126
|
+
@a.states.should == [:suspended]
|
|
127
|
+
@a.children.each do |c|
|
|
128
|
+
c.states.should == [:suspended]
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
it 'AIO should handle parent' do
|
|
137
|
+
connect do |redis|
|
|
138
|
+
|
|
139
|
+
MINT::AIContainer.create(:name=>"parent", :states => [:defocused],:children =>"a1")
|
|
140
|
+
MINT::AIContainer.create(:name=>"a1", :states => [:focused],:children =>"ee1|ee2|ee3",:parent=>"parent")
|
|
141
|
+
MINT::AIO.create(:name => "ee1",:states => [:defocused],:parent=>"a1")
|
|
142
|
+
MINT::AIO.create(:name => "ee2",:states => [:defocused],:parent=>"a1")
|
|
143
|
+
MINT::AIO.create(:name => "ee3",:states => [:defocused],:parent=>"a1")
|
|
144
|
+
@a = MINT::AIContainer.first(:name => "a1")
|
|
145
|
+
b = MINT::AIContainer.first(:name => "parent")
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@a.states.should == [:focused]
|
|
149
|
+
#b = MINT2::AIContainer.create(:name=>"parent",:children =>[@a])
|
|
150
|
+
b.states.should == [:defocused]
|
|
151
|
+
@a.process_event(:parent)
|
|
152
|
+
|
|
153
|
+
@a.states.should ==[:defocused]
|
|
154
|
+
|
|
155
|
+
b = MINT::AIContainer.first(:name => "parent")
|
|
156
|
+
b.states.should ==[:focused]
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
end
|
|
161
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
require "em-spec/rspec"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
describe 'AUI' do
|
|
7
|
+
include EventMachine::SpecHelper
|
|
8
|
+
|
|
9
|
+
before :all do
|
|
10
|
+
connection_options = { :adapter => "redis"}
|
|
11
|
+
DataMapper.setup(:default, connection_options)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
connect do |redis|
|
|
15
|
+
require "MINT-core"
|
|
16
|
+
require "support/redis_connector_monkey_patch" # TODO dirty patch for a bug that i have not found :(
|
|
17
|
+
DataMapper.finalize
|
|
18
|
+
DataMapper::Model.raise_on_save_failure = true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'AIINContinuous' do
|
|
23
|
+
it 'should initialize with initiated' do
|
|
24
|
+
|
|
25
|
+
connect true do |redis|
|
|
26
|
+
test_state_flow redis,"Interactor.AIO.AIIN.AIINContinuous.a" ,%w(initialized) do
|
|
27
|
+
|
|
28
|
+
MINT::AIINContinuous.new(:name=>"a").save
|
|
29
|
+
@a = MINT::AIINContinuous.first
|
|
30
|
+
@a.states.should ==[:initialized]
|
|
31
|
+
@a.new_states.should == [:initialized]
|
|
32
|
+
end
|
|
33
|
+
#MINT::Interactor.redis redis
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should transform to organizing state ' do
|
|
38
|
+
connect true do |redis|
|
|
39
|
+
test_state_flow redis,"Interactor.AIO.AIIN.AIINContinuous.a" ,%w(initialized organized) do
|
|
40
|
+
|
|
41
|
+
MINT::AIINContinuous.new(:name=>"a").save
|
|
42
|
+
@a = MINT::AIINContinuous.first
|
|
43
|
+
|
|
44
|
+
@a.process_event(:organize).should ==[:organized]
|
|
45
|
+
@a.states.should == [:organized]
|
|
46
|
+
@a.new_states.should == [:organized]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should transform to progressing and regressing state and publishvalue' do
|
|
52
|
+
connect true do |redis|
|
|
53
|
+
test_state_flow redis,"Interactor.AIO.AIIN.AIINContinuous.a" , [ "initialized", "organized", ["presenting", "defocused"],["focused","waiting"],["moving", "progressing"],"regressing"] do
|
|
54
|
+
Fiber.new{
|
|
55
|
+
MINT::AIINContinuous.new(:name=>"a").save
|
|
56
|
+
@a = MINT::AIINContinuous.first
|
|
57
|
+
|
|
58
|
+
@a.process_event(:organize).should ==[:organized]
|
|
59
|
+
|
|
60
|
+
@a.process_event(:present).should ==[:defocused]
|
|
61
|
+
@a.process_event(:focus).should ==[:waiting]
|
|
62
|
+
|
|
63
|
+
channel_name = "in_channel:Interactor.AIO.AIIN.AIINContinuous.a:testuser"
|
|
64
|
+
|
|
65
|
+
RedisConnector.redis.publish(channel_name,"10")
|
|
66
|
+
RedisConnector.redis.publish(channel_name,"5")
|
|
67
|
+
}.resume
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
#@a.process_event(:move).should ==[:focused, :progressing]
|
|
71
|
+
|
|
72
|
+
#redis2 = EventMachine::Hiredis.connect
|
|
73
|
+
#redis2.publish("Interactor.AIO.AIOUT.AIOUTContinuous.data.a",{:data=>10,:name=>"a"}.to_json).callback { |c|
|
|
74
|
+
# @a.data.should==10
|
|
75
|
+
# redis2.publish("Interactor.AIO.AIOUT.AIOUTContinuous.data.a",{:data=>20,:name=>"a"}.to_json).callback { |c|
|
|
76
|
+
# @a.data.should==20
|
|
77
|
+
# @a.new_states.should==[:progressing,:moving, :c]
|
|
78
|
+
# redis2.publish("Interactor.AIO.AIOUT.AIOUTContinuous.data.a",{:data=>10,:name=>"a"}.to_json).callback { |c|
|
|
79
|
+
# @a.data.should==10
|
|
80
|
+
# @a.new_states.should==[:regressing]
|
|
81
|
+
# done
|
|
82
|
+
# }
|
|
83
|
+
# }
|
|
84
|
+
#}
|
|
85
|
+
#
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
require "em-spec/rspec"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
describe 'AUI' do
|
|
7
|
+
include EventMachine::SpecHelper
|
|
8
|
+
|
|
9
|
+
before :all do
|
|
10
|
+
connection_options = { :adapter => "redis"}
|
|
11
|
+
DataMapper.setup(:default, connection_options)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
connect do |redis|
|
|
15
|
+
require "MINT-core"
|
|
16
|
+
require "support/redis_connector_monkey_patch" # TODO dirty patch for a bug that i have not found :(
|
|
17
|
+
DataMapper.finalize
|
|
18
|
+
DataMapper::Model.raise_on_save_failure = true
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'AIOUTContinuous' do
|
|
23
|
+
it 'should initialize with initiated' do
|
|
24
|
+
|
|
25
|
+
connect true do |redis|
|
|
26
|
+
test_state_flow redis,"Interactor.AIO.AIOUT.AIOUTContinuous.a" ,%w(initialized) do
|
|
27
|
+
|
|
28
|
+
MINT::AIOUTContinuous.new(:name=>"a").save
|
|
29
|
+
@a = MINT::AIOUTContinuous.first
|
|
30
|
+
@a.states.should ==[:initialized]
|
|
31
|
+
@a.new_states.should == [:initialized]
|
|
32
|
+
end
|
|
33
|
+
#MINT::Interactor.redis redis
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should transform to organizing state ' do
|
|
38
|
+
connect true do |redis|
|
|
39
|
+
test_state_flow redis,"Interactor.AIO.AIOUT.AIOUTContinuous.a" ,%w(initialized organized) do
|
|
40
|
+
|
|
41
|
+
MINT::AIOUTContinuous.new(:name=>"a").save
|
|
42
|
+
@a = MINT::AIOUTContinuous.first
|
|
43
|
+
|
|
44
|
+
@a.process_event(:organize).should ==[:organized]
|
|
45
|
+
@a.states.should == [:organized]
|
|
46
|
+
@a.new_states.should == [:organized]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should transform to progressing and regressing state and consume value' do
|
|
52
|
+
connect true do |redis|
|
|
53
|
+
test_state_flow redis,"Interactor.AIO.AIOUT.AIOUTContinuous.a" , [ "initialized", "organized", ["presenting", "f", "p", "defocused", "waiting"],"focused",["moving", "progressing"],"regressing"] do
|
|
54
|
+
Fiber.new {
|
|
55
|
+
MINT::AIOUTContinuous.new(:name=>"a").save
|
|
56
|
+
@a = MINT::AIOUTContinuous.first
|
|
57
|
+
|
|
58
|
+
@a.process_event(:organize).should ==[:organized]
|
|
59
|
+
|
|
60
|
+
@a.process_event(:present).should ==[:defocused, :waiting]
|
|
61
|
+
@a.process_event(:focus).should ==[:focused, :waiting]
|
|
62
|
+
|
|
63
|
+
channel_name = @a.create_attribute_channel_name('data')
|
|
64
|
+
|
|
65
|
+
redis.publish(channel_name,MultiJson.encode({:data=>10,:name=>"a"}))
|
|
66
|
+
redis.publish(channel_name,MultiJson.encode({:data=>5,:name=>"a"}))
|
|
67
|
+
|
|
68
|
+
}.resume
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
#@a.process_event(:move).should ==[:focused, :progressing]
|
|
72
|
+
|
|
73
|
+
#redis2 = EventMachine::Hiredis.connect
|
|
74
|
+
#redis2.publish("Interactor.AIO.AIOUT.AIOUTContinuous.data.a",{:data=>10,:name=>"a"}.to_json).callback { |c|
|
|
75
|
+
# @a.data.should==10
|
|
76
|
+
# redis2.publish("Interactor.AIO.AIOUT.AIOUTContinuous.data.a",{:data=>20,:name=>"a"}.to_json).callback { |c|
|
|
77
|
+
# @a.data.should==20
|
|
78
|
+
# @a.new_states.should==[:progressing,:moving, :c]
|
|
79
|
+
# redis2.publish("Interactor.AIO.AIOUT.AIOUTContinuous.data.a",{:data=>10,:name=>"a"}.to_json).callback { |c|
|
|
80
|
+
# @a.data.should==10
|
|
81
|
+
# @a.new_states.should==[:regressing]
|
|
82
|
+
# done
|
|
83
|
+
# }
|
|
84
|
+
# }
|
|
85
|
+
#}
|
|
86
|
+
#
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
end
|