lib/ruote/exp/fe_concurrent_iterator.rb in ruote-2.3.0.1 vs lib/ruote/exp/fe_concurrent_iterator.rb in ruote-2.3.0.2

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -148,12 +148,12 @@ # == options # # the concurrent_iterator accepts the same options for merging as its bigger # brother, the concurrence expression. # - # :count, :merge (override, mix, isolate), remaining (cancel, forget) and - # :over. + # :count, :merge (override, mix, isolate, stack, union, concat, deep, ignore), + # :remaining (cancel, forget) and :over. # # # == add branches # # The 'add_branches'/'add_branch' expression can be used to add branches @@ -226,23 +226,28 @@ else [ "#{h.fei['expid']}_0", tree_children[0] ] end launch_sub( - expid, subtree, :workitem => workitem, :variables => variables) + expid, + subtree, + :workitem => workitem, + :variables => variables, + :child_id => h.list_size - 1) end end def reply(workitem) if ab = workitem['fields'].delete(ADD_BRANCHES_FIELD) add_branches(ab) - if h.fei['wfid'] != workitem['fei']['wfid'] || - ( ! workitem['fei']['expid'].match(/^#{h.fei['expid']}_\d+$/)) - + if + h.fei['wfid'] != workitem['fei']['wfid'] || + ( ! workitem['fei']['expid'].match(/^#{h.fei['expid']}_\d+$/)) + then do_persist return end end @@ -272,9 +277,22 @@ # Overrides the implementation found in ConcurrenceExpression # def count_list_size h.list_size + end + + # TODO + # + def workitem_index(workitem) + + if %w[ highest lowest ].include?(h.cmerge) + nil + elsif m = workitem['fei']['subid'].match(/k(\d)+$/) + m[1].to_i + else + nil + end end end end