public
Description: the [OpenWFEru] workflow and BPM engine (ruby)
Homepage: http://openwferu.rubyforge.org
Clone URL: git://github.com/jmettraux/ruote.git
implemented some tailish optimization, but roi is limited :(
jmettraux (author)
Tue May 13 01:25:38 -0700 2008
commit  aa45f4935f5d69199cf9a7e683a4d455f4d1e5de
tree    1ab5ee4bde6de0683a0b15490fbcc951bf480ff0
parent  382d4f04992426a6d005dd21a392cc4e13ee9d71
...
343
344
345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
347
348
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
0
@@ -343,6 +343,26 @@ module OpenWFE
0
         end
0
 
0
         #
0
+ # Replaces the flow expression with a raw expression that has
0
+ # the same fei, same parent and points to the same env.
0
+ # The raw_representation will be the template.
0
+ # Stores and then apply the "cuckoo" expression.
0
+ #
0
+ def substitute_and_apply (fexp, template, workitem)
0
+
0
+ re = RawExpression.new_raw(
0
+ fexp.fei,
0
+ fexp.parent_id,
0
+ fexp.environment_id,
0
+ application_context,
0
+ template)
0
+
0
+ update re
0
+
0
+ apply re, workitem
0
+ end
0
+
0
+ #
0
         # Applies a given expression (id or expression)
0
         #
0
         def apply (exp_or_fei, workitem)
...
91
92
93
94
 
95
96
97
...
100
101
102
103
 
104
105
106
...
126
127
128
129
130
131
 
 
132
133
134
...
141
142
143
144
 
145
146
147
...
149
150
151
152
153
 
 
 
154
155
156
...
91
92
93
 
94
95
96
97
...
100
101
102
 
103
104
105
106
...
126
127
128
 
 
 
129
130
131
132
133
...
140
141
142
 
143
144
145
146
...
148
149
150
 
 
151
152
153
154
155
156
0
@@ -91,7 +91,7 @@ module OpenWFE
0
         names :step
0
 
0
 
0
- attr_accessor :out
0
+ #attr_accessor :out
0
         attr_accessor :outcomes
0
         attr_accessor :default
0
 
0
@@ -100,7 +100,7 @@ module OpenWFE
0
 
0
             step = lookup_attribute(:step, workitem) || @children.first
0
 
0
- @out = false
0
+ #@out = false
0
 
0
             # keeping track of outcomes and default as found at apply time
0
 
0
@@ -126,9 +126,8 @@ module OpenWFE
0
 
0
         def reply (workitem)
0
 
0
- return reply_to_parent(workitem) if @out
0
-
0
- @out = true
0
+ #return reply_to_parent(workitem) if @out
0
+ #@out = true
0
 
0
             outcome = workitem.fields.delete 'outcome'
0
             outcome = outcome.to_s if outcome
0
@@ -141,7 +140,7 @@ module OpenWFE
0
             return reply_to_parent(workitem) \
0
                 unless outcome
0
 
0
- store_itself
0
+ #store_itself
0
 
0
             template = [
0
                 outcome.to_s, # expression name
0
@@ -149,8 +148,9 @@ module OpenWFE
0
                 [], # children
0
             ]
0
 
0
- get_expression_pool.tlaunch_child(
0
- self, template, 1, workitem, true) #, vars=nil
0
+ #get_expression_pool.tlaunch_child(
0
+ # self, template, 1, workitem, true) #, vars=nil
0
+ get_expression_pool.substitute_and_apply self, template, workitem
0
         end
0
     end
0
 
...
27
28
29
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
32
33
...
27
28
29
 
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
0
@@ -27,7 +27,25 @@ class FlowTestRecursion < Test::Unit::TestCase
0
     # test 0
0
     #
0
 
0
- N = 500
0
+ #N = 500
0
+ N = 100
0
+
0
+ #
0
+ # Test0, N=100
0
+ #
0
+ # Tue May 13 17:24:53 JST 2008
0
+ #
0
+ # without substitution :
0
+ # q : 2.72s
0
+ # p : 752s
0
+ #
0
+ # with substitution :
0
+ # q : 2.67s
0
+ # p : 715s
0
+ # (c : 10s)
0
+ #
0
+ # => :(
0
+ #
0
 
0
     #
0
     # chaining N steps

Comments

    No one has commented yet.