Class: CPEE::Transformation::Source::Graphviz
- Inherits:
-
Object
- Object
- CPEE::Transformation::Source::Graphviz
- Defined in:
- lib/cpee/transformation/graphviz.rb
Instance Attribute Summary collapse
-
#dataelements ⇒ Object
readonly
Returns the value of attribute dataelements.
-
#endpoints ⇒ Object
readonly
Returns the value of attribute endpoints.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#traces ⇒ Object
readonly
Returns the value of attribute traces.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Instance Method Summary collapse
-
#extract_nodelink(text) ⇒ Object
{{{.
-
#initialize(text) ⇒ Graphviz
constructor
{{{.
Constructor Details
#initialize(text) ⇒ Graphviz
{{{
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cpee/transformation/graphviz.rb', line 30 def initialize(text) #{{{ Node.class_variable_set(:@@niceid, {}) @tree = Tree.new @start = nil @dataelements = {} @endpoints = {} @graph = Graph.new extract_nodelink(text) @traces = Traces.new [[@start]] end |
Instance Attribute Details
#dataelements ⇒ Object (readonly)
Returns the value of attribute dataelements.
28 29 30 |
# File 'lib/cpee/transformation/graphviz.rb', line 28 def dataelements @dataelements end |
#endpoints ⇒ Object (readonly)
Returns the value of attribute endpoints.
28 29 30 |
# File 'lib/cpee/transformation/graphviz.rb', line 28 def endpoints @endpoints end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
28 29 30 |
# File 'lib/cpee/transformation/graphviz.rb', line 28 def graph @graph end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
28 29 30 |
# File 'lib/cpee/transformation/graphviz.rb', line 28 def start @start end |
#traces ⇒ Object (readonly)
Returns the value of attribute traces.
28 29 30 |
# File 'lib/cpee/transformation/graphviz.rb', line 28 def traces @traces end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
28 29 30 |
# File 'lib/cpee/transformation/graphviz.rb', line 28 def tree @tree end |
Instance Method Details
#extract_nodelink(text) ⇒ Object
{{{
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cpee/transformation/graphviz.rb', line 64 def extract_nodelink(text) #{{{ text.each_line do |line| if line =~ /^\s*"([^"]+)"\[shape=([a-z]+)(\slabel="([^"]*)")?\]\s*;?/ id = $1 type = map_nodes($2,$4) label = id label.sub(/^'/,'') label.sub(/'$/,'') label.sub(/^"/,'') label.sub(/"$/,'') n = Node.new(0,id,type,label,0,1) @graph.add_node n @start = n if n.type == :startEvent && @start == nil end end text.each_line do |line| if line =~ /^\s*"([^"]+)"\s+->\s+"([^"]+)"(\s*\[(label="([^"]*)")?\])?\s*;?/ lid = $1 rid = $2 cond = $5 @graph.add_link Link.new(lid, rid, cond.nil? ? nil : cond) end end end |