cpee 1.5.20 → 2.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.
- checksums.yaml +4 -4
- data/{FEATURES → FEATURES.md} +7 -6
- data/INSTALL.md +1 -0
- data/{README → README.md} +3 -3
- data/Rakefile +1 -0
- data/cockpit/index.html +8 -8
- data/cockpit/js/details.js +13 -14
- data/cockpit/js/instance.js +192 -290
- data/cockpit/js/parameters.js +13 -3
- data/cockpit/js/ui.js +2 -2
- data/cockpit/rngs/attributes.rng +3 -3
- data/cockpit/rngs/dataelements.rng +3 -3
- data/cockpit/rngs/endpoints.rng +3 -3
- data/cockpit/{testsets → templates.legacy}/Async.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/BCO.xml +7 -10
- data/cockpit/{testsets → templates.legacy}/BCS.xml +7 -10
- data/cockpit/{testsets → templates.legacy}/Centurio.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Concurrent.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Coopis Testset.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Endpoints and Data Manipulation.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/ICSOC Testset.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Infinity.xml +3 -3
- data/cockpit/{testsets → templates.legacy}/Lego Boxer.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Conveyor.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Crane.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Ejector.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Full.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Liddy.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Plate.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego Transporter.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Lego_Part_1.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/LgLinear.xml +6 -10
- data/cockpit/{testsets → templates.legacy}/Linear.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Log.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Mangler 1.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Mangler 2.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Manuel Labels.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Promise.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/SOPROMO Test Sonification.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Subprocess.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Syncing P34 1.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/Syncing P34 2.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/Syncing P34 3.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/Syncing P34.xml +8 -11
- data/cockpit/{testsets → templates.legacy}/TEST - Bad Loop.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/TEST - Wrong Positions.xml +6 -6
- data/cockpit/{testsets → templates.legacy}/Take_5.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Update.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Parallel.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Test CPEE.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Test.xml +7 -7
- data/cockpit/{testsets → templates.legacy}/Worklist Test2.xml +7 -7
- data/cockpit/templates.legacy/convert_cpee2.rb +15 -0
- data/cockpit/{testsets → templates.legacy}/convert_preset.rb +0 -0
- data/cockpit/{testsets → templates.legacy}/testsets.xml +1 -1
- data/cockpit/{testsets → templates.legacy}/transformations.xml +0 -0
- data/cockpit/templates/BPM 2020 Manual Adjust.xml +182 -0
- data/cockpit/templates/BPM 2020 Solution Baseline.xml +196 -0
- data/cockpit/templates/BPM 2020 Solution NN.xml +197 -0
- data/cockpit/templates/BPM 2020 Solution View.xml +144 -0
- data/cockpit/templates/BPM 2020.xml +26 -0
- data/cockpit/templates/Coopis 2010.xml +85 -0
- data/cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml +77 -0
- data/cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml +77 -0
- data/cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml +77 -0
- data/cockpit/templates/Worklist.xml +42 -0
- data/cockpit/templates/convert_cpee2.rb +15 -0
- data/cockpit/themes/compact/rngs/alternative.rng +25 -0
- data/cockpit/themes/compact/rngs/call.rng +20 -14
- data/cockpit/themes/compact/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/compact/rngs/choose.rng +14 -0
- data/cockpit/themes/compact/rngs/critical.rng +5 -0
- data/cockpit/themes/compact/rngs/escape.rng +1 -0
- data/cockpit/themes/compact/rngs/group.rng +3 -0
- data/cockpit/themes/compact/rngs/loop.rng +22 -0
- data/cockpit/themes/compact/rngs/manipulate.rng +9 -0
- data/cockpit/themes/compact/rngs/otherwise.rng +22 -0
- data/cockpit/themes/compact/rngs/parallel.rng +21 -0
- data/cockpit/themes/compact/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/compact/rngs/scripts.rng +10 -11
- data/cockpit/themes/compact/rngs/stop.rng +5 -0
- data/cockpit/themes/compact/rngs/terminate.rng +1 -0
- data/cockpit/themes/compact/theme.js +1 -1
- data/cockpit/themes/convert_cpee2.rb +8 -0
- data/cockpit/themes/default/rngs/alternative.rng +8 -8
- data/cockpit/themes/default/rngs/call.rng +85 -49
- data/cockpit/themes/default/rngs/callmanipulate.rng +103 -64
- data/cockpit/themes/default/rngs/choose.rng +5 -3
- data/cockpit/themes/default/rngs/critical.rng +2 -2
- data/cockpit/themes/default/rngs/escape.rng +1 -1
- data/cockpit/themes/default/rngs/group.rng +3 -3
- data/cockpit/themes/default/rngs/loop.rng +8 -8
- data/cockpit/themes/default/rngs/manipulate.rng +3 -3
- data/cockpit/themes/default/rngs/otherwise.rng +8 -8
- data/cockpit/themes/default/rngs/parallel.rng +14 -6
- data/cockpit/themes/default/rngs/parallel_branch.rng +2 -2
- data/cockpit/themes/default/rngs/scripts.rng +23 -0
- data/cockpit/themes/default/rngs/stop.rng +2 -2
- data/cockpit/themes/default/rngs/terminate.rng +1 -1
- data/cockpit/themes/extended/rngs/alternative.rng +25 -0
- data/cockpit/themes/extended/rngs/call.rng +20 -14
- data/cockpit/themes/extended/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/extended/rngs/choose.rng +14 -0
- data/cockpit/themes/extended/rngs/critical.rng +5 -0
- data/cockpit/themes/extended/rngs/escape.rng +1 -0
- data/cockpit/themes/extended/rngs/group.rng +3 -0
- data/cockpit/themes/extended/rngs/loop.rng +22 -0
- data/cockpit/themes/extended/rngs/manipulate.rng +9 -0
- data/cockpit/themes/extended/rngs/otherwise.rng +22 -0
- data/cockpit/themes/extended/rngs/parallel.rng +21 -0
- data/cockpit/themes/extended/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/extended/rngs/scripts.rng +10 -11
- data/cockpit/themes/extended/rngs/stop.rng +5 -0
- data/cockpit/themes/extended/rngs/terminate.rng +1 -0
- data/cockpit/themes/extended/theme.js +14 -28
- data/cockpit/themes/model/rngs/alternative.rng +1 -1
- data/cockpit/themes/model/rngs/call.rng +16 -16
- data/cockpit/themes/model/rngs/callmanipulate.rng +17 -17
- data/cockpit/themes/model/rngs/choose.rng +1 -1
- data/cockpit/themes/model/rngs/critical.rng +1 -1
- data/cockpit/themes/model/rngs/escape.rng +1 -1
- data/cockpit/themes/model/rngs/group.rng +1 -1
- data/cockpit/themes/model/rngs/loop.rng +1 -1
- data/cockpit/themes/model/rngs/manipulate.rng +1 -1
- data/cockpit/themes/model/rngs/otherwise.rng +1 -1
- data/cockpit/themes/model/rngs/parallel.rng +1 -1
- data/cockpit/themes/model/rngs/parallel_branch.rng +1 -1
- data/cockpit/themes/model/rngs/scripts.rng +3 -4
- data/cockpit/themes/model/rngs/stop.rng +1 -1
- data/cockpit/themes/model/rngs/terminate.rng +1 -1
- data/cockpit/themes/model/theme.js +8 -7
- data/cockpit/themes/packed/rngs/alternative.rng +25 -0
- data/cockpit/themes/packed/rngs/call.rng +20 -14
- data/cockpit/themes/packed/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/packed/rngs/choose.rng +14 -0
- data/cockpit/themes/packed/rngs/critical.rng +5 -0
- data/cockpit/themes/packed/rngs/escape.rng +1 -0
- data/cockpit/themes/packed/rngs/group.rng +3 -0
- data/cockpit/themes/packed/rngs/loop.rng +22 -0
- data/cockpit/themes/packed/rngs/manipulate.rng +9 -0
- data/cockpit/themes/packed/rngs/otherwise.rng +22 -0
- data/cockpit/themes/packed/rngs/parallel.rng +21 -0
- data/cockpit/themes/packed/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/packed/rngs/scripts.rng +10 -11
- data/cockpit/themes/packed/rngs/stop.rng +5 -0
- data/cockpit/themes/packed/rngs/terminate.rng +1 -0
- data/cockpit/themes/packed/theme.js +8 -7
- data/cockpit/themes/preset/rngs/alternative.rng +25 -0
- data/cockpit/themes/preset/rngs/call.rng +20 -14
- data/cockpit/themes/preset/rngs/callmanipulate.rng +28 -22
- data/cockpit/themes/preset/rngs/choose.rng +14 -0
- data/cockpit/themes/preset/rngs/critical.rng +5 -0
- data/cockpit/themes/preset/rngs/escape.rng +1 -0
- data/cockpit/themes/preset/rngs/group.rng +3 -0
- data/cockpit/themes/preset/rngs/loop.rng +22 -0
- data/cockpit/themes/preset/rngs/manipulate.rng +9 -0
- data/cockpit/themes/preset/rngs/otherwise.rng +22 -0
- data/cockpit/themes/preset/rngs/parallel.rng +21 -0
- data/cockpit/themes/preset/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/preset/rngs/scripts.rng +10 -11
- data/cockpit/themes/preset/rngs/stop.rng +5 -0
- data/cockpit/themes/preset/rngs/terminate.rng +1 -0
- data/cockpit/themes/preset/theme.js +8 -7
- data/cpee.gemspec +9 -9
- data/{log/topics.xml → lib/callbacks.xml} +16 -6
- data/lib/{engine → callbacks}/callbacks.rng +2 -8
- data/lib/cpee.xml +10 -4
- data/lib/cpee/attributes_helper.rb +27 -0
- data/lib/cpee/controller.rb +113 -596
- data/lib/cpee/implementation.rb +152 -191
- data/lib/cpee/implementation_callbacks.rb +77 -0
- data/lib/cpee/implementation_notifications.rb +189 -0
- data/lib/cpee/implementation_properties.rb +707 -0
- data/lib/cpee/{callback.rb → message.rb} +20 -18
- data/lib/cpee/persistence.rb +135 -0
- data/lib/cpee/statemachine.rb +20 -0
- data/lib/cpee/transform.rb +95 -0
- data/lib/engine.xml +1 -59
- data/lib/properties.xml +236 -0
- data/lib/properties/arbitrary.rng +26 -0
- data/lib/properties/attributes.rng +10 -0
- data/lib/properties/dataelements.rng +10 -0
- data/lib/properties/description.rng +8 -0
- data/lib/properties/dsl.rng +7 -0
- data/lib/properties/dslx.rng +8 -0
- data/lib/properties/endpoints.rng +10 -0
- data/lib/properties/handlerwrapper.rng +9 -0
- data/lib/properties/position.rng +15 -0
- data/lib/properties/positions.rng +10 -0
- data/lib/properties/properties.rng +29 -0
- data/lib/properties/set-properties.rng +25 -0
- data/lib/properties/set-some-properties.rng +45 -0
- data/lib/properties/simple.rng +8 -0
- data/lib/properties/state.rng +33 -0
- data/lib/properties/status.rng +12 -0
- data/lib/properties/t_attributes.rng +7 -0
- data/lib/properties/t_dataelements.rng +7 -0
- data/lib/properties/t_endpoints.rng +7 -0
- data/lib/properties/t_position.rng +7 -0
- data/lib/properties/t_positions.rng +7 -0
- data/lib/properties/t_simple.rng +7 -0
- data/lib/properties/t_status.rng +7 -0
- data/lib/properties/t_transformation.rng +7 -0
- data/lib/properties/transformation.rng +40 -0
- data/server/dev.rb +1 -0
- data/server/handlerwrappers/default.rb +40 -34
- data/server/resources/backend/README.md +17 -0
- data/server/resources/backend/instance.rb +23 -0
- data/server/resources/backend/instance.template +19 -0
- data/server/resources/backend/opts.yaml +6 -0
- data/server/resources/backend/run +29 -0
- data/server/resources/notifications/logging/subscription.xml +1 -1
- data/server/resources/properties.empty +38 -0
- data/server/resources/properties.init +11 -11
- data/server/resources/states.dot +19 -0
- data/server/resources/states.xml +49 -0
- data/server/resources/transformation_dslx.xsl +3 -0
- data/server/routing/end.rb +44 -0
- data/server/routing/forward-events.rb +59 -0
- data/server/routing/forward-votes.rb +108 -0
- data/server/routing/persist.rb +155 -0
- data/server/server.rb +1 -0
- data/tools/cpee +19 -15
- metadata +126 -156
- data/INSTALL +0 -23
- data/cockpit/test.html +0 -40
- data/cockpit/themes/compact/rngs/alternative.rng +0 -1
- data/cockpit/themes/compact/rngs/choose.rng +0 -1
- data/cockpit/themes/compact/rngs/critical.rng +0 -1
- data/cockpit/themes/compact/rngs/escape.rng +0 -1
- data/cockpit/themes/compact/rngs/group.rng +0 -1
- data/cockpit/themes/compact/rngs/loop.rng +0 -1
- data/cockpit/themes/compact/rngs/manipulate.rng +0 -1
- data/cockpit/themes/compact/rngs/otherwise.rng +0 -1
- data/cockpit/themes/compact/rngs/parallel.rng +0 -1
- data/cockpit/themes/compact/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/compact/rngs/stop.rng +0 -1
- data/cockpit/themes/compact/rngs/terminate.rng +0 -1
- data/cockpit/themes/default/rngs/finalize.rng +0 -6
- data/cockpit/themes/default/rngs/update.rng +0 -6
- data/cockpit/themes/default/theme.js +0 -1286
- data/cockpit/themes/extended/rngs/alternative.rng +0 -1
- data/cockpit/themes/extended/rngs/choose.rng +0 -1
- data/cockpit/themes/extended/rngs/critical.rng +0 -1
- data/cockpit/themes/extended/rngs/escape.rng +0 -1
- data/cockpit/themes/extended/rngs/group.rng +0 -1
- data/cockpit/themes/extended/rngs/loop.rng +0 -1
- data/cockpit/themes/extended/rngs/manipulate.rng +0 -1
- data/cockpit/themes/extended/rngs/otherwise.rng +0 -1
- data/cockpit/themes/extended/rngs/parallel.rng +0 -1
- data/cockpit/themes/extended/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/extended/rngs/stop.rng +0 -1
- data/cockpit/themes/extended/rngs/terminate.rng +0 -1
- data/cockpit/themes/labels/rngs/alternative.rng +0 -25
- data/cockpit/themes/labels/rngs/call.rng +0 -81
- data/cockpit/themes/labels/rngs/callmanipulate.rng +0 -101
- data/cockpit/themes/labels/rngs/choose.rng +0 -12
- data/cockpit/themes/labels/rngs/critical.rng +0 -5
- data/cockpit/themes/labels/rngs/escape.rng +0 -1
- data/cockpit/themes/labels/rngs/finalize.rng +0 -6
- data/cockpit/themes/labels/rngs/group.rng +0 -3
- data/cockpit/themes/labels/rngs/loop.rng +0 -22
- data/cockpit/themes/labels/rngs/manipulate.rng +0 -9
- data/cockpit/themes/labels/rngs/otherwise.rng +0 -22
- data/cockpit/themes/labels/rngs/parallel.rng +0 -13
- data/cockpit/themes/labels/rngs/parallel_branch.rng +0 -8
- data/cockpit/themes/labels/rngs/stop.rng +0 -5
- data/cockpit/themes/labels/rngs/terminate.rng +0 -1
- data/cockpit/themes/labels/rngs/update.rng +0 -6
- data/cockpit/themes/labels/symbols/alternative.svg +0 -5
- data/cockpit/themes/labels/symbols/arrow.svg +0 -3
- data/cockpit/themes/labels/symbols/call.svg +0 -6
- data/cockpit/themes/labels/symbols/callmanipulate.svg +0 -8
- data/cockpit/themes/labels/symbols/choose.svg +0 -5
- data/cockpit/themes/labels/symbols/choose_exclusive.svg +0 -5
- data/cockpit/themes/labels/symbols/choose_inclusive.svg +0 -4
- data/cockpit/themes/labels/symbols/complex.svg +0 -8
- data/cockpit/themes/labels/symbols/critical.svg +0 -4
- data/cockpit/themes/labels/symbols/end.svg +0 -3
- data/cockpit/themes/labels/symbols/escape.svg +0 -5
- data/cockpit/themes/labels/symbols/event_end.svg +0 -3
- data/cockpit/themes/labels/symbols/loop.svg +0 -5
- data/cockpit/themes/labels/symbols/manipulate.svg +0 -4
- data/cockpit/themes/labels/symbols/otherwise.svg +0 -5
- data/cockpit/themes/labels/symbols/parallel.svg +0 -5
- data/cockpit/themes/labels/symbols/parallel_branch.svg +0 -5
- data/cockpit/themes/labels/symbols/parallel_branch_compact.svg +0 -4
- data/cockpit/themes/labels/symbols/parallel_branch_event.svg +0 -14
- data/cockpit/themes/labels/symbols/parallel_branch_normal.svg +0 -5
- data/cockpit/themes/labels/symbols/scripts.svg +0 -4
- data/cockpit/themes/labels/symbols/start.svg +0 -3
- data/cockpit/themes/labels/symbols/stop.svg +0 -5
- data/cockpit/themes/labels/symbols/terminate.svg +0 -4
- data/cockpit/themes/packed/rngs/alternative.rng +0 -1
- data/cockpit/themes/packed/rngs/choose.rng +0 -1
- data/cockpit/themes/packed/rngs/critical.rng +0 -1
- data/cockpit/themes/packed/rngs/escape.rng +0 -1
- data/cockpit/themes/packed/rngs/group.rng +0 -1
- data/cockpit/themes/packed/rngs/loop.rng +0 -1
- data/cockpit/themes/packed/rngs/manipulate.rng +0 -1
- data/cockpit/themes/packed/rngs/otherwise.rng +0 -1
- data/cockpit/themes/packed/rngs/parallel.rng +0 -1
- data/cockpit/themes/packed/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/packed/rngs/stop.rng +0 -1
- data/cockpit/themes/packed/rngs/terminate.rng +0 -1
- data/cockpit/themes/preset/rngs/alternative.rng +0 -1
- data/cockpit/themes/preset/rngs/choose.rng +0 -1
- data/cockpit/themes/preset/rngs/critical.rng +0 -1
- data/cockpit/themes/preset/rngs/escape.rng +0 -1
- data/cockpit/themes/preset/rngs/group.rng +0 -1
- data/cockpit/themes/preset/rngs/loop.rng +0 -1
- data/cockpit/themes/preset/rngs/manipulate.rng +0 -1
- data/cockpit/themes/preset/rngs/otherwise.rng +0 -1
- data/cockpit/themes/preset/rngs/parallel.rng +0 -1
- data/cockpit/themes/preset/rngs/parallel_branch.rng +0 -1
- data/cockpit/themes/preset/rngs/stop.rng +0 -1
- data/cockpit/themes/preset/rngs/terminate.rng +0 -1
- data/lib/cpee/empty_workflow.rb +0 -28
- data/lib/cpee/handler_notifications.rb +0 -47
- data/lib/cpee/handler_properties.rb +0 -50
- data/lib/cpee/instantiation.rb +0 -368
- data/lib/cpee/processtransformation/bpel/Repository/booking.bpel +0 -125
- data/lib/cpee/processtransformation/bpel/Repository/booking.wsdl +0 -72
- data/lib/cpee/processtransformation/bpel/Repository/booking/airline.wsdl +0 -71
- data/lib/cpee/processtransformation/bpel/Repository/booking/hotel.wsdl +0 -64
- data/lib/cpee/processtransformation/bpel/Repository/booking/report.wsdl +0 -71
- data/lib/cpee/processtransformation/bpel/bpel2wee.rb +0 -34
- data/lib/cpee/processtransformation/bpel/bpelserver.ru +0 -64
- data/lib/cpee/processtransformation/bpel/bpelserver.xml +0 -70
- data/lib/cpee/processtransformation/bpel/lib/BPEL_Transform.rb +0 -367
- data/lib/cpee/processtransformation/bpmn2.rb +0 -297
- data/lib/cpee/processtransformation/cpee.rb +0 -119
- data/lib/cpee/processtransformation/structures.rb +0 -465
- data/lib/cpee/processtransformation/target.rb +0 -50
- data/log/azure.rb +0 -10
- data/log/azure_logger.rb +0 -136
- data/log/chain.xml +0 -27
- data/log/elasticsearch.rb +0 -15
- data/log/elasticsearch_logging.rb +0 -377
- data/log/legacy/test_es.rb +0 -26
- data/log/legacy/test_split.rb +0 -211
- data/log/log.xml +0 -13
- data/log/non_tamp.rb +0 -156
- data/log/sic.rb +0 -63
- data/log/template.xes_xml +0 -23
- data/log/template.xes_yaml +0 -28
- data/log/trace.yaml +0 -17717
- data/log/trace_sic.yaml +0 -18343
- data/log/xes_xml.rb +0 -121
- data/log/xes_yaml.rb +0 -96
- data/server/handlerwrappers/soap.rb +0 -146
- data/server/resources/notifications/logging/consumer-secret +0 -1
- data/server/resources/notifications/logging/producer-secret +0 -1
- data/server/resources/properties.schema.active +0 -139
- data/server/resources/properties.schema.finished +0 -139
- data/server/resources/properties.schema.inactive +0 -136
- data/server/resources/test1.xml +0 -58
- data/server/resources/test2.xml +0 -60
- data/server/resources/test3.xml +0 -217
- data/test/callback.rb +0 -9
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
#
|
|
3
|
-
# This file is part of CPEE.
|
|
4
|
-
#
|
|
5
|
-
# Apache License, Version 2.0
|
|
6
|
-
#
|
|
7
|
-
# Copyright (c) 2013 Juergen Mangler
|
|
8
|
-
#
|
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
# you may not use this file except in compliance with the License.
|
|
11
|
-
# You may obtain a copy of the License at
|
|
12
|
-
#
|
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
#
|
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
# See the License for the specific language governing permissions and
|
|
19
|
-
# limitations under the License.
|
|
20
|
-
|
|
21
|
-
require File.expand_path(File.dirname(__FILE__) + '/target')
|
|
22
|
-
|
|
23
|
-
module CPEE
|
|
24
|
-
|
|
25
|
-
module ProcessTransformation
|
|
26
|
-
|
|
27
|
-
module Target
|
|
28
|
-
|
|
29
|
-
class CPEE < Default
|
|
30
|
-
def generate
|
|
31
|
-
res = XML::Smart.string("<description xmlns='http://cpee.org/ns/description/1.0'/>")
|
|
32
|
-
res.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
|
|
33
|
-
output_to_document res
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def print_Break(node,res)
|
|
37
|
-
res.add('escape')
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def print_Loop(node,res)
|
|
41
|
-
if node.sub.length == 2 && node.sub[1].condition.empty? && ((node.sub[1].length == 1 && node.sub[1][0].class.name.gsub(/\w+:+/,'') == 'Break') || node.sub[1].length == 0)
|
|
42
|
-
s1 = res.add('loop', 'mode' => 'pre_test', 'condition' => node.sub[0].condition.empty? ? 'true' : node.sub[0].condition.join(' && '))
|
|
43
|
-
s1.attributes['language'] = node.sub[0].condition_type unless node.sub[0].condition_type.nil?
|
|
44
|
-
node.sub[0].attributes.each do |k,v|
|
|
45
|
-
s1.attributes[k] = v
|
|
46
|
-
end
|
|
47
|
-
generate_for_list(node.sub[0],s1)
|
|
48
|
-
else
|
|
49
|
-
s1 = res.add('loop', 'mode' => 'pre_test', 'condition' => 'true')
|
|
50
|
-
if node.sub.length == 1
|
|
51
|
-
generate_for_list(node.sub[0],s1)
|
|
52
|
-
else
|
|
53
|
-
print_Conditional(node,s1)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
s1
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def print_Node(node,res)
|
|
60
|
-
if node.endpoints.empty? && !node.script.nil? && node.script.strip != ''
|
|
61
|
-
n = res.add('d:manipulate', node.script, 'id' => "a#{node.niceid}")
|
|
62
|
-
n.attributes['output'] = node.script_var unless node.script_var.nil?
|
|
63
|
-
n.attributes['language'] = node.script_type unless node.script_type.nil?
|
|
64
|
-
else
|
|
65
|
-
n = res.add('d:call', 'id' => "a#{node.niceid}", 'endpoint' => node.endpoints.join(','))
|
|
66
|
-
p = n.add('d:parameters')
|
|
67
|
-
p.add('d:label',"\"#{node.label.gsub(/"/,"\\\"")}\"")
|
|
68
|
-
p.add('d:method',node.methods.join(',') || 'post')
|
|
69
|
-
p.add('d:type',":#{node.type}")
|
|
70
|
-
p.add('d:mid',"'#{node.id}'")
|
|
71
|
-
par = p.add('d:arguments')
|
|
72
|
-
node.parameters.each do |k,v|
|
|
73
|
-
par.add(k,v)
|
|
74
|
-
end
|
|
75
|
-
if !node.script.nil? && node.script.strip != ''
|
|
76
|
-
x = n.add('d:finalize',node.script)
|
|
77
|
-
x.attributes['output'] = node.script_var unless node.script_var.nil?
|
|
78
|
-
x.attributes['language'] = node.script_type unless node.script_type.nil?
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def print_Parallel(node,res)
|
|
84
|
-
s1 = res.add('parallel','wait' => node.wait)
|
|
85
|
-
node.sub.each do |branch|
|
|
86
|
-
s2 = s1.add('parallel_branch')
|
|
87
|
-
generate_for_list(branch,s2)
|
|
88
|
-
end
|
|
89
|
-
s1
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def print_Conditional(node,res)
|
|
93
|
-
s1 = res.add('d:choose', 'mode' => node.mode)
|
|
94
|
-
node.sub.each do |branch|
|
|
95
|
-
s2 = if branch.condition.any?
|
|
96
|
-
a = s1.add('d:alternative','condition' => branch.condition.join(' or '))
|
|
97
|
-
a.attributes['language'] = branch.condition_type unless branch.condition_type.nil?
|
|
98
|
-
a
|
|
99
|
-
else
|
|
100
|
-
s1.add('d:otherwise')
|
|
101
|
-
end
|
|
102
|
-
branch.attributes.each do |k,v|
|
|
103
|
-
s2.attributes[k] = v
|
|
104
|
-
end
|
|
105
|
-
generate_for_list(branch,s2)
|
|
106
|
-
end
|
|
107
|
-
if (x = s1.find('d:otherwise')).any?
|
|
108
|
-
s1.add x
|
|
109
|
-
end
|
|
110
|
-
s1
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
end
|
|
@@ -1,465 +0,0 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
|
-
#
|
|
3
|
-
# This file is part of CPEE.
|
|
4
|
-
#
|
|
5
|
-
# Apache License, Version 2.0
|
|
6
|
-
#
|
|
7
|
-
# Copyright (c) 2013 Juergen Mangler
|
|
8
|
-
#
|
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
# you may not use this file except in compliance with the License.
|
|
11
|
-
# You may obtain a copy of the License at
|
|
12
|
-
#
|
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
#
|
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
# See the License for the specific language governing permissions and
|
|
19
|
-
# limitations under the License.
|
|
20
|
-
|
|
21
|
-
module CPEE
|
|
22
|
-
|
|
23
|
-
module ProcessTransformation
|
|
24
|
-
|
|
25
|
-
module Container #{{{
|
|
26
|
-
def container?
|
|
27
|
-
@container || false
|
|
28
|
-
end
|
|
29
|
-
end #}}}
|
|
30
|
-
module Struct #{{{
|
|
31
|
-
def each(&a)
|
|
32
|
-
@sub.each{|s| a.call(s)}
|
|
33
|
-
end
|
|
34
|
-
def length
|
|
35
|
-
@sub.length
|
|
36
|
-
end
|
|
37
|
-
end #}}}
|
|
38
|
-
|
|
39
|
-
class Node #{{{
|
|
40
|
-
include Container
|
|
41
|
-
@@niceid = {}
|
|
42
|
-
attr_reader :id, :label, :niceid
|
|
43
|
-
attr_reader :endpoints, :methods, :parameters, :attributes
|
|
44
|
-
attr_accessor :script, :script_id, :script_var, :script_type, :incoming, :outgoing, :type
|
|
45
|
-
def initialize(context,id,type,label,incoming,outgoing)
|
|
46
|
-
@@niceid[context] ||= -1
|
|
47
|
-
@niceid = (@@niceid[context] += 1)
|
|
48
|
-
@id = id
|
|
49
|
-
@type = type
|
|
50
|
-
@label = label
|
|
51
|
-
@endpoints = []
|
|
52
|
-
@methods = []
|
|
53
|
-
@script = nil
|
|
54
|
-
@script_type = nil
|
|
55
|
-
@script_id = nil
|
|
56
|
-
@script_var = 'result'
|
|
57
|
-
@parameters = {}
|
|
58
|
-
@incoming = incoming
|
|
59
|
-
@outgoing = outgoing
|
|
60
|
-
@attributes = {}
|
|
61
|
-
end
|
|
62
|
-
end # }}}
|
|
63
|
-
class Link #{{{
|
|
64
|
-
attr_accessor :from, :to
|
|
65
|
-
attr_reader :condition, :attributes
|
|
66
|
-
def initialize(from,to,cond=nil)
|
|
67
|
-
@from = from
|
|
68
|
-
@to = to
|
|
69
|
-
@condition = cond
|
|
70
|
-
@attributes = {}
|
|
71
|
-
end
|
|
72
|
-
end #}}}
|
|
73
|
-
class Break < Node #{{{
|
|
74
|
-
def initialize(context)
|
|
75
|
-
super context, '-1', :break, 'BREAK', 1, []
|
|
76
|
-
end
|
|
77
|
-
end #}}}
|
|
78
|
-
|
|
79
|
-
class Alternative < Array #{{{
|
|
80
|
-
include Container
|
|
81
|
-
attr_accessor :condition, :condition_type
|
|
82
|
-
attr_reader :id, :attributes
|
|
83
|
-
def condition?; true; end
|
|
84
|
-
def initialize(id)
|
|
85
|
-
@container = true
|
|
86
|
-
@id = id
|
|
87
|
-
@condition = []
|
|
88
|
-
@condition_type = nil
|
|
89
|
-
@attributes = {}
|
|
90
|
-
end
|
|
91
|
-
end #}}}
|
|
92
|
-
class Branch < Array #{{{
|
|
93
|
-
include Container
|
|
94
|
-
attr_reader :id
|
|
95
|
-
def condition?; false; end
|
|
96
|
-
def initialize(id)
|
|
97
|
-
@container = true
|
|
98
|
-
@id = id
|
|
99
|
-
end
|
|
100
|
-
end #}}}
|
|
101
|
-
|
|
102
|
-
class Loop #{{{
|
|
103
|
-
include Container
|
|
104
|
-
include Struct
|
|
105
|
-
include Enumerable
|
|
106
|
-
attr_reader :id, :sub, :mode
|
|
107
|
-
attr_accessor :type, :condition, :condition_type
|
|
108
|
-
attr_reader :attributes
|
|
109
|
-
def condition?; true; end
|
|
110
|
-
def initialize(id)
|
|
111
|
-
@container = true
|
|
112
|
-
@id = id
|
|
113
|
-
@type = :loop
|
|
114
|
-
@mode = :exclusive
|
|
115
|
-
@condition = []
|
|
116
|
-
@sub = []
|
|
117
|
-
@condition_type = nil
|
|
118
|
-
@attributes = {}
|
|
119
|
-
end
|
|
120
|
-
def new_branch
|
|
121
|
-
(@sub << Alternative.new(@id)).last
|
|
122
|
-
end
|
|
123
|
-
end #}}}
|
|
124
|
-
|
|
125
|
-
class Parallel #{{{
|
|
126
|
-
include Container
|
|
127
|
-
include Struct
|
|
128
|
-
include Enumerable
|
|
129
|
-
attr_reader :id, :sub
|
|
130
|
-
attr_accessor :type, :wait
|
|
131
|
-
def initialize(id,type,wait='-1')
|
|
132
|
-
@container = true
|
|
133
|
-
@id = id
|
|
134
|
-
@type = type
|
|
135
|
-
@sub = []
|
|
136
|
-
@wait = wait
|
|
137
|
-
end
|
|
138
|
-
def new_branch
|
|
139
|
-
(@sub << Branch.new(@id)).last
|
|
140
|
-
end
|
|
141
|
-
end #}}}
|
|
142
|
-
|
|
143
|
-
class Conditional #{{{
|
|
144
|
-
include Container
|
|
145
|
-
include Struct
|
|
146
|
-
include Enumerable
|
|
147
|
-
attr_reader :container
|
|
148
|
-
attr_reader :id, :sub, :mode
|
|
149
|
-
attr_reader :attributes
|
|
150
|
-
attr_accessor :type
|
|
151
|
-
def initialize(id,mode,type)
|
|
152
|
-
@container = true
|
|
153
|
-
@id = id
|
|
154
|
-
@sub = []
|
|
155
|
-
@mode = mode
|
|
156
|
-
@type = type
|
|
157
|
-
@attributes = {}
|
|
158
|
-
end
|
|
159
|
-
def new_branch
|
|
160
|
-
(@sub << Alternative.new(@id)).last
|
|
161
|
-
end
|
|
162
|
-
end #}}}
|
|
163
|
-
|
|
164
|
-
class Graph #{{{
|
|
165
|
-
attr_reader :flow, :nodes
|
|
166
|
-
|
|
167
|
-
def find_node(niceid)
|
|
168
|
-
@nodes.find{|k,v| v.niceid == niceid }
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def initialize
|
|
172
|
-
@nodes = {}
|
|
173
|
-
@links = []
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
def clean_up(&bl)
|
|
177
|
-
selnodes = []
|
|
178
|
-
@nodes.each do |k,n|
|
|
179
|
-
ret = bl.call(n)
|
|
180
|
-
selnodes << n if ret
|
|
181
|
-
end
|
|
182
|
-
selnodes.each do |n|
|
|
183
|
-
if n.incoming > 1 || n.outgoing > 1
|
|
184
|
-
raise "#{n.inspect} - not a simple node to remove"
|
|
185
|
-
end
|
|
186
|
-
to,from = nil
|
|
187
|
-
@links.each do |f|
|
|
188
|
-
to = f if f.to == n.id
|
|
189
|
-
from = f if f.from == n.id
|
|
190
|
-
end
|
|
191
|
-
if to && from
|
|
192
|
-
to.to = from.to
|
|
193
|
-
@links.delete(from)
|
|
194
|
-
@nodes.delete(n.id)
|
|
195
|
-
else
|
|
196
|
-
raise "#{n.inspect} - could not remove flow"
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def find_script_id(s)
|
|
202
|
-
@nodes.find_all{|k,n| n.script_id == s}
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
def add_node(n)
|
|
206
|
-
@nodes[n.id] = n
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
def link(f,t)
|
|
210
|
-
@links.find{ |x| x.from == f && x.to == t }
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
def add_link(l)
|
|
214
|
-
@links << l
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def next_nodes(from)
|
|
218
|
-
links = @links.find_all { |x| x.from == from.id }
|
|
219
|
-
links.map{|x| @nodes[x.to] }
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
def next_node(from)
|
|
223
|
-
if (nodes = next_nodes(from)).length == 1
|
|
224
|
-
nodes.first
|
|
225
|
-
else
|
|
226
|
-
raise "#{from.inspect} - multiple outgoing connections"
|
|
227
|
-
end
|
|
228
|
-
end
|
|
229
|
-
end #}}}
|
|
230
|
-
|
|
231
|
-
class Tree < Array #{{{
|
|
232
|
-
def condition?; false; end
|
|
233
|
-
|
|
234
|
-
def to_s(verbose=true)
|
|
235
|
-
"TREE:\n" << print_tree(self,' ',verbose)
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def print_tree(ele,indent=' ',verbose=true)
|
|
239
|
-
ret = ''
|
|
240
|
-
ele.each_with_index do |e,i|
|
|
241
|
-
last = (i == ele.length - 1)
|
|
242
|
-
pchar = last ? '└' : '├'
|
|
243
|
-
if e.container?
|
|
244
|
-
ret << indent + pchar + ' ' + e.class.to_s.gsub(/[^:]*::/,'') + "\n"
|
|
245
|
-
ret << print_tree(e,indent + (last ? ' ' : '│ '),verbose)
|
|
246
|
-
elsif e.is_a?(Break)
|
|
247
|
-
ret << indent + pchar + ' ' + e.class.to_s.gsub(/[^:]*::/,'') + "\n"
|
|
248
|
-
else
|
|
249
|
-
ret << indent + pchar + ' ' + e.niceid.to_s + (verbose ? " (#{e.label})" : "") + "\n"
|
|
250
|
-
end
|
|
251
|
-
end
|
|
252
|
-
ret
|
|
253
|
-
end
|
|
254
|
-
private :print_tree
|
|
255
|
-
end #}}}
|
|
256
|
-
|
|
257
|
-
class Traces < Array #{{{
|
|
258
|
-
def initialize_copy(other)
|
|
259
|
-
super
|
|
260
|
-
self.map!{ |t| t.dup }
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
def remove(trcs)
|
|
264
|
-
trcs.each do |t|
|
|
265
|
-
self.delete(t)
|
|
266
|
-
end
|
|
267
|
-
end
|
|
268
|
-
def remove_by_endnode(enode)
|
|
269
|
-
self.delete_if do |t|
|
|
270
|
-
t[0] != enode
|
|
271
|
-
end
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
def empty!
|
|
275
|
-
self.delete_if{true}
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
def remove_empty
|
|
279
|
-
self.delete_if{|t| t.empty? }
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
def first_node
|
|
283
|
-
self.first.first
|
|
284
|
-
end
|
|
285
|
-
def second_nodes
|
|
286
|
-
self.map { |t| t.length > 1 ? t[1] : t[0] }
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
def shortest
|
|
290
|
-
self.min_by{|e|e.length}
|
|
291
|
-
end
|
|
292
|
-
|
|
293
|
-
def legend
|
|
294
|
-
ret = "Legend:\n"
|
|
295
|
-
a = self.flatten.uniq
|
|
296
|
-
a.each {|n| ret << " " + n.niceid.to_s + ' ' + n.type.to_s + ' ' + n.label.to_s + "\n" }
|
|
297
|
-
ret
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
def to_s
|
|
301
|
-
"TRACES: " + self.collect { |t| t.empty? ? '∅' : t.collect{|n| "%2d" % n.niceid }.join('→ ') }.join("\n ")
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
def shift_all
|
|
305
|
-
self.each{ |tr| tr.shift }
|
|
306
|
-
end
|
|
307
|
-
def pop_all(what=nil)
|
|
308
|
-
if node.nil?
|
|
309
|
-
self.each{ |tr| tr.pop }
|
|
310
|
-
else
|
|
311
|
-
self.each{ |tr| tr.pop if tr.last == what }
|
|
312
|
-
end
|
|
313
|
-
end
|
|
314
|
-
|
|
315
|
-
def finished?
|
|
316
|
-
self.reduce(0){|sum,t| sum += t.length} == 0
|
|
317
|
-
end
|
|
318
|
-
|
|
319
|
-
def same_first
|
|
320
|
-
(n = self.map{|t| t.first }.uniq).length == 1 ? n.first : nil
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
def incoming(node)
|
|
324
|
-
tcount = 1
|
|
325
|
-
self.each do |t|
|
|
326
|
-
break if t.length == 1
|
|
327
|
-
tcount += 1 if t.last == node
|
|
328
|
-
end
|
|
329
|
-
tcount
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
def include_in_all?(e)
|
|
333
|
-
num = 0
|
|
334
|
-
self.each{|n| num += 1 if n.include?(e)}
|
|
335
|
-
num == self.length
|
|
336
|
-
end
|
|
337
|
-
|
|
338
|
-
def all_loops?
|
|
339
|
-
num = 0
|
|
340
|
-
self.each{|n| num += 1 if n.first == n.last }
|
|
341
|
-
num == self.length
|
|
342
|
-
end
|
|
343
|
-
|
|
344
|
-
def add_breaks(context,front=true)
|
|
345
|
-
trueloops = self.find_all{ |t| t.last == t.first }.length
|
|
346
|
-
tb = Break.new(context)
|
|
347
|
-
if trueloops == self.length
|
|
348
|
-
self << (front ? [nil,tb] : [tb,nil])
|
|
349
|
-
else
|
|
350
|
-
self.each do |t|
|
|
351
|
-
t << tb unless t.last == t.first ### an explicit break
|
|
352
|
-
end
|
|
353
|
-
end
|
|
354
|
-
end
|
|
355
|
-
|
|
356
|
-
def loops
|
|
357
|
-
lo = Traces.new self.find_all{ |t| t.first == t.last }
|
|
358
|
-
self.each do |t|
|
|
359
|
-
lo << t if lo.second_nodes.include?(t[1])
|
|
360
|
-
end
|
|
361
|
-
lo.uniq
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
def eliminate(loops)
|
|
365
|
-
### find nested loops
|
|
366
|
-
self.each_with_index do |t,i|
|
|
367
|
-
maxcut = 0
|
|
368
|
-
### find out which common parts the traces share with theloops
|
|
369
|
-
loops.each do |l|
|
|
370
|
-
maxcut.upto(l.length) do |i|
|
|
371
|
-
maxcut = i if t[0...i] == l[0...i]
|
|
372
|
-
end
|
|
373
|
-
end
|
|
374
|
-
### in case of nested loop (common part occurs at end of loop), include the whole
|
|
375
|
-
0.upto (maxcut-1) do |j|
|
|
376
|
-
if self[i][j] == self[i].last
|
|
377
|
-
loops << self[i].shift(self[i].length)
|
|
378
|
-
end
|
|
379
|
-
end
|
|
380
|
-
end
|
|
381
|
-
loops.uniq!
|
|
382
|
-
loops.remove_empty
|
|
383
|
-
self.remove_empty
|
|
384
|
-
|
|
385
|
-
### cut from non-nested loops
|
|
386
|
-
self.each_with_index do |t,i|
|
|
387
|
-
maxcut = 0
|
|
388
|
-
### find out which common parts the traces share with theloops
|
|
389
|
-
loops.each do |l|
|
|
390
|
-
maxcut.upto(l.length) do |i|
|
|
391
|
-
maxcut = i if t[0...i] == l[0...i]
|
|
392
|
-
end
|
|
393
|
-
end
|
|
394
|
-
cutted = self[i].shift(maxcut)
|
|
395
|
-
loops << cutted if cutted.length > 1 ### if only the loop node is left, no need to attach
|
|
396
|
-
end
|
|
397
|
-
end
|
|
398
|
-
|
|
399
|
-
def extend
|
|
400
|
-
# find largest common
|
|
401
|
-
max = []
|
|
402
|
-
sh = self.shortest
|
|
403
|
-
sh = sh[0..-2] if sh.first == sh.last
|
|
404
|
-
sh.each_with_index do |e,i|
|
|
405
|
-
max << e if self.include_in_all?(e)
|
|
406
|
-
end
|
|
407
|
-
max = max.last
|
|
408
|
-
|
|
409
|
-
# if last is the largest common do nothing
|
|
410
|
-
# else append from last to largest common
|
|
411
|
-
self.each do |t|
|
|
412
|
-
unless t.last == max
|
|
413
|
-
last = t.last
|
|
414
|
-
if t.index(last) && t.index(max)
|
|
415
|
-
(t.index(last) + 1).upto(t.index(max)) do |i|
|
|
416
|
-
t << t[i]
|
|
417
|
-
end
|
|
418
|
-
end
|
|
419
|
-
end
|
|
420
|
-
end
|
|
421
|
-
|
|
422
|
-
max
|
|
423
|
-
end
|
|
424
|
-
|
|
425
|
-
def find_endnode
|
|
426
|
-
# supress loops
|
|
427
|
-
trcs = self.dup
|
|
428
|
-
# dangerous TODO
|
|
429
|
-
trcs.delete_if { |t| t.uniq.length < t.length }
|
|
430
|
-
|
|
431
|
-
# find common node (except loops)
|
|
432
|
-
enode = nil
|
|
433
|
-
unless trcs.empty?
|
|
434
|
-
trcs.first.each do |n|
|
|
435
|
-
if trcs.include_in_all?(n)
|
|
436
|
-
enode = n
|
|
437
|
-
break
|
|
438
|
-
end
|
|
439
|
-
end
|
|
440
|
-
end
|
|
441
|
-
enode
|
|
442
|
-
end
|
|
443
|
-
|
|
444
|
-
def segment_by(endnode)
|
|
445
|
-
# cut shit until common node, return the shit you cut away
|
|
446
|
-
tracesgroup = self.group_by{|t| t.first}.map do |k,trace|
|
|
447
|
-
coltrace = trace.map do |t|
|
|
448
|
-
# slice upto common node, collect the sliced away part
|
|
449
|
-
len = t.index(endnode)
|
|
450
|
-
if len
|
|
451
|
-
cut = t.slice!(0...len)
|
|
452
|
-
cut << t.first
|
|
453
|
-
else # if endnode is nil, then return the whole
|
|
454
|
-
t
|
|
455
|
-
end
|
|
456
|
-
end.uniq
|
|
457
|
-
Traces.new(coltrace)
|
|
458
|
-
end
|
|
459
|
-
[tracesgroup,endnode]
|
|
460
|
-
end
|
|
461
|
-
end #}}}
|
|
462
|
-
|
|
463
|
-
end
|
|
464
|
-
|
|
465
|
-
end
|