13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'app/models/wf/lola.rb', line 13
def to_text
places = workflow.places
transitions = workflow.transitions
places_text = places.map(&:lola_id).join(",")
marking_text = start_p.lola_id
transitions_text = transitions.map do |t|
consume = t.arcs.in.map { |arc| "#{arc.place.lola_id}:1" }.join(",")
produce = t.arcs.out.map { |arc| "#{arc.place.lola_id}:1" }.join(",")
[
"TRANSITION #{t.lola_id}",
"CONSUME #{consume};",
"PRODUCE #{produce};"
].join("\n")
end.join("\n\n")
<<~LOLA
PLACE #{places_text};
MARKING #{marking_text};
#{transitions_text}
LOLA
end
|