Class: MergeMultiplicity

Inherits:
Merge
  • Object
show all
Defined in:
lib/xmimerge/merge_multiplicity.rb

Instance Method Summary collapse

Methods inherited from Merge

#check, #check_change_propertie, #merge

Constructor Details

#initialize(name, from_tag, to_tag) ⇒ MergeMultiplicity

Returns a new instance of MergeMultiplicity.



5
6
7
8
9
10
# File 'lib/xmimerge/merge_multiplicity.rb', line 5

def initialize(name, from_tag, to_tag)
	super()
	@name = name
	@from_tag = from_tag
	@to_tag = to_tag
end

Instance Method Details

#verifyObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/xmimerge/merge_multiplicity.rb', line 12

def verify

	from_value = @from_tag.multiplicity_range
	to_value = @to_tag.multiplicity_range

	if !from_value.nil? && to_value.nil?

		command = "+ #{@name}Multiplicity #{@from_tag.full_name} '#{from_value}'"
		@commands.add_command_to_buffer(command)	
	
	elsif from_value.nil? && !to_value.nil?

		command = "- #{@name}Multiplicity #{@from_tag.full_name} '#{to_value}'"
		@commands.add_command_to_buffer(command)
	
	elsif (!from_value.nil? && !to_value.nil?) && to_value != from_value
		
		command = "* #{@name}Multiplicity #{@from_tag.full_name} '#{to_value}' --> '#{from_value}'"
		@commands.add_command_to_buffer(command)
	end			

end