Module: Pione::PNML::InputParallelizationComplement
- Defined in:
- lib/pione/pnml/input-parallelization-complement.rb
Overview
InputParallelizationComplement
is a net rewriting rule. This rule
complements names of empty places that form input parallelization
pattern. For example, the net likes the following
+--> empty place --> A
|
'p1' --> empty transition --+--> empty place --> B
|
+--> empty place --> C
is rewritten as the following.
+--> 'p1' --> A
|
'p1' --> empty transition --+--> 'p1' --> B
|
+--> 'p1' --> C
Class Method Summary collapse
-
.find_subjects(net, env) ⇒ Array
Find subjects(input place and target places) of this rule from the net.
-
.rewrite(net, subjects, env) ⇒ void
Rewrite targe place's name same as input place's name.
Class Method Details
.find_subjects(net, env) ⇒ Array
Find subjects(input place and target places) of this rule from the net. The conditions are followings:
- There is an empty source transition. It has only one named place as an input.
- There are more than 2 target places that includes empty place.
- There are arcs that connect the source and targets.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pione/pnml/input-parallelization-complement.rb', line 36 def self.find_subjects(net, env) net.transitions.each do |transition| # source transition should have no names next unless Perspective.empty_transition?(env, transition) # transition should have only one named input input_places = net.find_all_places_by_target_id(transition.id) unless input_places.size == 1 and Perspective.data_place?(env, input_places.first) next end # collect places output_places = net.find_all_places_by_source_id(transition.id) next unless output_places.all? {|output_place| Perspective.empty_place?(env, output_place)} # there should be more than 2 places next unless output_places.size > 1 return [input_places.first, output_places] end return nil end |
.rewrite(net, subjects, env) ⇒ void
This method returns an undefined value.
Rewrite targe place's name same as input place's name.
69 70 71 72 73 74 75 76 |
# File 'lib/pione/pnml/input-parallelization-complement.rb', line 69 def self.rewrite(net, subjects, env) input_place, target_places = subjects # rewrite names of target places target_places.each do |place| place.name = LabelExtractor.extract_data_expr(input_place.name) end end |