Class: MergeTransitions
- Inherits:
-
Merge
- Object
- Merge
- MergeTransitions
show all
- Defined in:
- lib/xmimerge/merge_transitions.rb
Instance Method Summary
collapse
Methods inherited from Merge
#check, #check_change_propertie, #merge
Constructor Details
#initialize(from_activity_graph, to_activity_graph) ⇒ MergeTransitions
Returns a new instance of MergeTransitions.
5
6
7
8
9
|
# File 'lib/xmimerge/merge_transitions.rb', line 5
def initialize(from_activity_graph, to_activity_graph)
super()
@from_activity_graph = from_activity_graph
@to_activity_graph = to_activity_graph
end
|
Instance Method Details
#check_changes(from_transition) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/xmimerge/merge_transitions.rb', line 22
def check_changes(from_transition)
from_source_obj = @from.state_by_id(from_transition.source)
from_target_obj = @from.state_by_id(from_transition.target)
to_transition = @to_activity_graph.transition_by_source_target_ids(from_source_obj.id, from_target_obj.id)
@log.debug("Checking Transition between '#{from_source_obj.name}' and '#{from_target_obj.name}'")
if to_transition.nil?
new_obj(from_transition, from_source_obj, from_target_obj)
else
check_existing(from_transition, to_transition)
end
end
|
#check_existing(from_transition, to_transition) ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/xmimerge/merge_transitions.rb', line 52
def check_existing(from_transition, to_transition)
merge = MergeStereotypes.new("Transition", from_transition, to_transition)
@only_check ? merge.check : merge.merge
merge = MergeTaggedValues.new("Transition", from_transition, to_transition)
@only_check ? merge.check : merge.merge
end
|
#check_removed ⇒ Object
63
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
92
93
94
95
96
|
# File 'lib/xmimerge/merge_transitions.rb', line 63
def check_removed
@log.debug("Checking Removed Transitions ...")
@to_activity_graph.transitions.each do |to_transition|
to_source_obj = @to.state_by_id(to_transition.source)
to_target_obj = @to.state_by_id(to_transition.target)
ok = false
@from_activity_graph.transitions.each do |from_transition|
from_source_obj = @from.state_by_id(from_transition.source)
from_target_obj = @from.state_by_id(from_transition.target)
if from_source_obj.name == to_source_obj.name && from_target_obj.name == from_target_obj.name
ok = true
break
end
end
if !ok
@log.debug("Transition Removed: #{to_source_obj.activity_graph.full_name} {#{to_source_obj.name}} --> {#{to_target_obj.name}}")
command = "- Transition #{to_source_obj.activity_graph.full_name} {#{to_source_obj.name}} --> {#{to_target_obj.name}}"
@commands.add_command_to_buffer(command)
unless @only_check
if @commands.has_command?(command)
@log.info "[OK] #{command}"
else
end
end
end
end
end
|
#new_obj(from_transition, from_source_obj, from_target_obj) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/xmimerge/merge_transitions.rb', line 38
def new_obj(from_transition, from_source_obj, from_target_obj)
if from_source_obj.name == "Decision Point"
source = "#{from_source_obj.name} [#{from_transition.guard_condition}]"
else
source = "#{from_source_obj.name}"
end
target = "#{from_target_obj.name}"
command = "+ Transition #{from_source_obj.activity_graph.full_name} {#{source}} --> {#{target}}"
@commands.add_command_to_buffer(command)
end
|
#verify ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/xmimerge/merge_transitions.rb', line 11
def verify
@log.info("Checking Transitions: " + @from_activity_graph.transitions.size.to_s)
@from_activity_graph.transitions.each do |transition|
check_changes transition
end
check_removed
end
|