Class: Transition

Inherits:
Tag
  • Object
show all
Defined in:
lib/xmimodel/transition.rb

Instance Attribute Summary collapse

Attributes inherited from Tag

#id, #parent_tag, #xml

Instance Method Summary collapse

Methods inherited from Tag

#xml_root

Constructor Details

#initialize(xml, parent_tag) ⇒ Transition

Returns a new instance of Transition.


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/xmimodel/transition.rb', line 25

def initialize(xml, parent_tag)
	super(xml, parent_tag)

	@activity_graph = parent_tag
	
	@trigger_id = xml.attribute("trigger").to_s
	@source_id = xml.attribute("source").to_s
	@target_id = xml.attribute("target").to_s

	@stereotypes = Array.new
	XmiHelper.stereotypes(xml).each do |uml_stereotype|
		stereotype = Stereotype.new(uml_stereotype, self)
		@stereotypes << stereotype
	end	

	@tagged_values = Array.new
	XmiHelper.tagged_values(xml).each do |uml_tagged_value|
		tagged_value = TaggedValue.new(uml_tagged_value, self)
		@tagged_values << tagged_value
	end	

	guard_condition = XmiHelper.guard_condition(xml)
	@guard_condition = guard_condition.attribute("body").to_s unless guard_condition.nil?
end

Instance Attribute Details

#activity_graphObject (readonly)

Returns the value of attribute activity_graph


9
10
11
# File 'lib/xmimodel/transition.rb', line 9

def activity_graph
  @activity_graph
end

#guard_conditionObject (readonly)

Returns the value of attribute guard_condition


23
24
25
# File 'lib/xmimodel/transition.rb', line 23

def guard_condition
  @guard_condition
end

#sourceObject

Returns the value of attribute source


17
18
19
# File 'lib/xmimodel/transition.rb', line 17

def source
  @source
end

#source_idObject (readonly)

Returns the value of attribute source_id


12
13
14
# File 'lib/xmimodel/transition.rb', line 12

def source_id
  @source_id
end

#stereotypesObject (readonly)

Returns the value of attribute stereotypes


20
21
22
# File 'lib/xmimodel/transition.rb', line 20

def stereotypes
  @stereotypes
end

#tagged_valuesObject (readonly)

Returns the value of attribute tagged_values


21
22
23
# File 'lib/xmimodel/transition.rb', line 21

def tagged_values
  @tagged_values
end

#targetObject

Returns the value of attribute target


18
19
20
# File 'lib/xmimodel/transition.rb', line 18

def target
  @target
end

#target_idObject (readonly)

Returns the value of attribute target_id


13
14
15
# File 'lib/xmimodel/transition.rb', line 13

def target_id
  @target_id
end

#triggerObject

SerĂ¡ povoado em ActivityGraph


16
17
18
# File 'lib/xmimodel/transition.rb', line 16

def trigger
  @trigger
end

#trigger_idObject (readonly)

Returns the value of attribute trigger_id


11
12
13
# File 'lib/xmimodel/transition.rb', line 11

def trigger_id
  @trigger_id
end

Instance Method Details

#full_nameObject


62
63
64
65
66
# File 'lib/xmimodel/transition.rb', line 62

def full_name
	source_name = @source.nil? ? "" : @source.name
	target_name = @target.nil? ? "" : @target.name
	"#{@activity_graph.full_name} ('#{source_name}' --> '#{target_name}')"
end

#stereotype_by_name(name) ⇒ Object


50
51
52
53
54
# File 'lib/xmimodel/transition.rb', line 50

def stereotype_by_name(name)
	stereotype = @stereotypes.select{|s| s.name == name}
	return stereotype[0] if !stereotype.nil? && stereotype.size > 0
	nil		
end

#tagged_value_by_name(tagged_value_name) ⇒ Object


56
57
58
59
60
# File 'lib/xmimodel/transition.rb', line 56

def tagged_value_by_name(tagged_value_name)
	tagged_value = @tagged_values.select{|t| t.name == tagged_value_name}
	return tagged_value[0] if !tagged_value.nil? && tagged_value.size > 0
	nil			
end

#to_sObject


68
69
70
# File 'lib/xmimodel/transition.rb', line 68

def to_s
	"Transition[#{full_name}]"
end