lib/cpee/processtransformation/cpee.rb in cpee-1.3.170 vs lib/cpee/processtransformation/cpee.rb in cpee-1.3.171

- old
+ new

@@ -16,28 +16,30 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +require File.expand_path(File.dirname(__FILE__) + '/target') + module CPEE module ProcessTransformation module Target class CPEE < Default def generate res = XML::Smart.string("<description xmlns='http://cpee.org/ns/description/1.0'/>") res.register_namespace 'd', 'http://cpee.org/ns/description/1.0' - super.generate(res.root) + output_to_document res end def print_Break(node,res) res.add('escape') end - def print_Loop_default(node,res) + def print_Loop(node,res) if node.sub.length == 2 s1 = res.add('loop', 'pre_test' => node.sub[0].condition.empty? ? 'true' : node.sub[0].condition.join(' && ')) s1.attributes['language'] = node.sub[0].condition_type unless node.sub[0].condition_type.nil? node.sub[0].attributes.each do |k,v| s1.attributes[k] = v @@ -47,13 +49,10 @@ s1 = res.add('loop', 'pre_test' => 'true') print_Conditional(node,s1) end s1 end - private :print_Loop_default - def print_Loop(node,res); print_Loop_default(node,res); end - private :print_Loop def print_Node(node,res) if node.endpoints.empty? && !node.script.nil? && node.script.strip != '' n = res.add('d:manipulate', 'id' => "a#{node.niceid}") n.text = node.script @@ -75,25 +74,21 @@ x.attributes['output'] = node.script_var unless node.script_var.nil? x.attributes['language'] = node.script_type unless node.script_type.nil? end end end - private :print_Node - def print_Parallel_default(node,res) + def print_Parallel(node,res) s1 = res.add('parallel','wait' => node.wait) node.sub.each do |branch| s2 = s1.add('parallel_branch') generate_for_list(branch,s2) end s1 end - private :print_Parallel_default - def print_Parallel(node,res); print_Parallel_default(node,res); end - private :print_Parallel - def print_Conditional_default(node,res) + def print_Conditional(node,res) s1 = res.add('d:choose', 'mode' => node.mode) node.sub.each do |branch| s2 = if branch.condition.any? a = s1.add('d:alternative','condition' => branch.condition.join(' or ')) a.attributes['language'] = branch.condition_type unless branch.condition_type.nil? @@ -109,12 +104,9 @@ if (x = s1.find('d:otherwise')).any? s1.add x end s1 end - private :print_Conditional_default - def print_Conditional(node,res); print_Conditional_default(node,res); end - private :print_Conditional end end