lib/openwfe/expressions/fe_sequence.rb in openwferu-0.9.8 vs lib/openwfe/expressions/fe_sequence.rb in openwferu-0.9.9
- old
+ new
@@ -58,51 +58,56 @@
names :sequence
attr_accessor \
:current_child_id
- #
- # apply / reply
def apply (workitem)
@current_child_id = -1
- reply(workitem)
+ reply workitem
end
def reply (workitem)
cfei = get_to_next_child()
- if not cfei
- reply_to_parent(workitem)
+ unless cfei
+ reply_to_parent workitem
return
end
#ldebug do
- # "reply() self : \n#{self.to_s}\n" + \
+ # "reply() self : \n#{self.to_s}\n" +
# "reply() next is #{@current_child_id} : #{cfei.to_debug_s}"
#end
store_itself()
- get_expression_pool().apply(cfei, workitem)
+ get_expression_pool.apply cfei, workitem
end
protected
def get_to_next_child ()
- return nil if @children.length < 1
+ #return nil if @children.length < 1
- @current_child_id = @current_child_id + 1
+ @current_child_id += 1
+ return nil if @current_child_id >= @children.length
+
+ #ldebug do
+ # "get_to_next_child() " +
+ # "len: #{@children.length} / id: #{@current_child_id}"
+ #end
+
@children[@current_child_id..-1].each do |c|
return c if c.kind_of? OpenWFE::FlowExpressionId
- @current_child_id = @current_child_id + 1
+ @current_child_id += 1
end
return nil
#
# did not find any child expression