| Class | OpenWFE::SequenceExpression |
| In: |
lib/openwfe/expressions/fe_sequence.rb
|
| Parent: | FlowExpression |
This expression sequentially executes each of its children expression. For a more sophisticated version of it, see the ‘cursor’ expression (fe_cursor.rb).
# File lib/openwfe/expressions/fe_sequence.rb, line 59
59: def apply (workitem)
60:
61: #store_itself
62: #
63: # remove that !
64:
65: reply workitem
66: end
# File lib/openwfe/expressions/fe_sequence.rb, line 68
68: def reply (workitem)
69:
70: cfei = next_child workitem.fei
71:
72: return reply_to_parent(workitem) \
73: unless cfei
74:
75: #ldebug do
76: # "reply() self : \n#{self.to_s}\n" +
77: # "reply() next is #{@current_child_id} : #{cfei.to_debug_s}"
78: #end
79:
80: get_expression_pool.apply cfei, workitem
81: end
Returns the flowExpressionId of the next child to apply, or nil if the sequence is over.
# File lib/openwfe/expressions/fe_sequence.rb, line 89
89: def next_child (current_fei)
90:
91: next_id = if (current_fei == self.fei)
92: 0
93: else
94: current_fei.child_id.to_i + 1
95: end
96:
97: loop do
98:
99: break if next_id >= @children.length
100:
101: child = @children[next_id]
102: return child if child.is_a?(FlowExpressionId)
103:
104: next_id += 1
105: end
106:
107: nil
108: end