Module: Pione::PNML::TicketInstantiation
- Defined in:
- lib/pione/pnml/ticket-instantiation.rb
Overview
TicketInstantiation is a net rewriting rule for ticket operation ">>>". This rule replaces anonymous ticket operations into named tickets. Net like this
A --> >>> --> B
is replaced
A --> ticket <TICKET_FROM_A_TO_B> --> B
Constant Summary collapse
- TICKET_NAME =
"__TICKET_FROM_%s_TO_%s__"
Class Method Summary collapse
- .find_subjects(net, env) ⇒ Object
-
.rewrite(net, subjects, env) ⇒ Object
Rewrite the net with subjects by the following way.
Class Method Details
.find_subjects(net, env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pione/pnml/ticket-instantiation.rb', line 16 def self.find_subjects(net, env) net.places.each do |place| next unless place.name.strip == ">>>" net.find_all_transitions_by_target_id(place.id) do |transition_from| net.find_all_transitions_by_source_id(place.id) do |transition_to| return [transition_from, transition_to, place] end end end return nil end |
.rewrite(net, subjects, env) ⇒ Object
Rewrite the net with subjects by the following way.
- Change the place name
33 34 35 36 37 38 39 |
# File 'lib/pione/pnml/ticket-instantiation.rb', line 33 def self.rewrite(net, subjects, env) transition_from, transition_to, place = subjects name_from = LabelExtractor.extract_rule_expr(transition_from.name) name_to = LabelExtractor.extract_rule_expr(transition_to.name) place.name = "<%s>" % (TICKET_NAME % [name_from, name_to]) end |