Class: AssociationEnd
Instance Attribute Summary collapse
- #aggregation ⇒ String readonly
- #changeability ⇒ String readonly
- #is_navigable ⇒ String readonly
- #is_specification ⇒ String readonly
- #multiplicity_range ⇒ String readonly
- #name ⇒ String readonly
- #ordering ⇒ String readonly
-
#stereotypes ⇒ Array<Stereotype>
readonly
Association end stereotypes.
-
#tagged_values ⇒ Array<TaggedValue>
readonly
Association end tagged values.
- #target_scope ⇒ String readonly
- #visibility ⇒ String readonly
Attributes inherited from Tag
Instance Method Summary collapse
- #==(obj) ⇒ Object
- #full_name ⇒ String
-
#initialize(xmls, index, parent_tag) ⇒ AssociationEnd
constructor
A new instance of AssociationEnd.
- #participant ⇒ Clazz
- #stereotype_by_name(name) ⇒ Stereotype
- #tagged_value_by_name(tagged_value_name) ⇒ TaggedValue
- #to_s ⇒ String
Methods inherited from Tag
Constructor Details
#initialize(xmls, index, parent_tag) ⇒ AssociationEnd
Returns a new instance of AssociationEnd.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 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 |
# File 'lib/xmimodel/association_end.rb', line 40 def initialize(xmls, index, parent_tag) super(xmls[index], parent_tag) @xml_a = xmls[0] @xml_b = xmls[1] @xmi_model = parent_tag.parent_tag @participant_id = @xml.attribute("participant").to_s # argoUML if @participant_id.nil? or @participant_id.empty? c = @xml.at_xpath("./UML:AssociationEnd.participant/UML:Class") @participant_id = c.attribute("xmi.idref").to_s unless c.nil? end @name = @xml.attribute("name").to_s if @name.empty? @name = index == 0 ? "EndA" : "EndB" end @visibility = @xml.attribute("visibility").to_s @is_navigable = @xml.attribute("isNavigable").to_s @is_specification = @xml.attribute("isSpecification").to_s @ordering = @xml.attribute("ordering").to_s @aggregation = @xml.attribute("aggregation").to_s @target_scope = @xml.attribute("targetScope").to_s @changeability = @xml.attribute("changeability").to_s @multiplicity_range = XmiHelper.multiplicity_range(@xml) @stereotypes = Array.new stereotype_id = @xml.attribute("stereotype").to_s if !stereotype_id.empty? stereotype = XmiHelper.stereotype_by_id(@xml, stereotype_id) stereotype = Stereotype.new(stereotype, self) @stereotypes << stereotype end 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 end |
Instance Attribute Details
#aggregation ⇒ String (readonly)
26 27 28 |
# File 'lib/xmimodel/association_end.rb', line 26 def aggregation @aggregation end |
#changeability ⇒ String (readonly)
32 33 34 |
# File 'lib/xmimodel/association_end.rb', line 32 def changeability @changeability end |
#is_navigable ⇒ String (readonly)
14 15 16 |
# File 'lib/xmimodel/association_end.rb', line 14 def is_navigable @is_navigable end |
#is_specification ⇒ String (readonly)
17 18 19 |
# File 'lib/xmimodel/association_end.rb', line 17 def is_specification @is_specification end |
#multiplicity_range ⇒ String (readonly)
20 21 22 |
# File 'lib/xmimodel/association_end.rb', line 20 def multiplicity_range @multiplicity_range end |
#name ⇒ String (readonly)
8 9 10 |
# File 'lib/xmimodel/association_end.rb', line 8 def name @name end |
#ordering ⇒ String (readonly)
23 24 25 |
# File 'lib/xmimodel/association_end.rb', line 23 def ordering @ordering end |
#stereotypes ⇒ Array<Stereotype> (readonly)
Returns Association end stereotypes.
35 36 37 |
# File 'lib/xmimodel/association_end.rb', line 35 def stereotypes @stereotypes end |
#tagged_values ⇒ Array<TaggedValue> (readonly)
Returns Association end tagged values.
38 39 40 |
# File 'lib/xmimodel/association_end.rb', line 38 def tagged_values @tagged_values end |
#target_scope ⇒ String (readonly)
29 30 31 |
# File 'lib/xmimodel/association_end.rb', line 29 def target_scope @target_scope end |
#visibility ⇒ String (readonly)
11 12 13 |
# File 'lib/xmimodel/association_end.rb', line 11 def visibility @visibility end |
Instance Method Details
#==(obj) ⇒ Object
97 98 99 100 101 102 103 104 105 106 |
# File 'lib/xmimodel/association_end.rb', line 97 def ==(obj) return false if obj.nil? if String == obj.class @name == obj elsif AssociationEnd == obj.class @name == obj.name && participant.full_name == obj.participant.full_name else return false end end |
#full_name ⇒ String
123 124 125 |
# File 'lib/xmimodel/association_end.rb', line 123 def full_name "#{@parent_tag.full_name}::#{@name}" end |
#participant ⇒ Clazz
92 93 94 95 |
# File 'lib/xmimodel/association_end.rb', line 92 def participant return nil if @participant_id.nil? or @participant_id.empty? participant = @xmi_model.class_by_id(@participant_id) end |
#stereotype_by_name(name) ⇒ Stereotype
109 110 111 112 113 |
# File 'lib/xmimodel/association_end.rb', line 109 def stereotype_by_name(name) stereotype = @stereotypes.select{|obj| obj == name} return stereotype[0] if !stereotype.nil? && stereotype.size > 0 nil end |
#tagged_value_by_name(tagged_value_name) ⇒ TaggedValue
116 117 118 119 120 |
# File 'lib/xmimodel/association_end.rb', line 116 def tagged_value_by_name(tagged_value_name) tagged_value = @tagged_values.select{|obj| obj.name == tagged_value_name} return tagged_value[0] if !tagged_value.nil? && tagged_value.size > 0 nil end |
#to_s ⇒ String
128 129 130 |
# File 'lib/xmimodel/association_end.rb', line 128 def to_s "AssociationEnd[#{name} (#{participant.full_name}])" end |