Class: Pione::PNML::AnnotationExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/pione/pnml/annotation-extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(net, option) ⇒ AnnotationExtractor

Returns a new instance of AnnotationExtractor.



4
5
6
7
8
9
10
# File 'lib/pione/pnml/annotation-extractor.rb', line 4

def initialize(net, option)
  @net = net
  @flow_name = option[:flow_name] || "Main"
  @package_name = option[:package_name]
  @editor = option[:editor]
  @tag = option[:tag]
end

Instance Method Details

#extractObject

Extract annotations from transitions.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pione/pnml/annotation-extractor.rb', line 17

def extract
  package_annotations = []

  @net.transitions.each do |transition|
    if line = extract_annotation(transition)
      package_annotations << line
    end
  end

  package_annotations << ".@ PackageName :: \"%s\"" % @package_name if @package_name
  package_annotations << ".@ Editor :: \"%s\"" % @editor if @editor
  package_annotations << ".@ Tag :: \"%s\"" % @tag if @tag

  return package_annotations
end