Class: SignalEvent

Inherits:
Tag
  • Object
show all
Defined in:
lib/xmimodel/signal_event.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) ⇒ SignalEvent

Returns a new instance of SignalEvent.


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/xmimodel/signal_event.rb', line 14

def initialize(xml, parent_tag)
  super(xml, parent_tag)
  @use_case = parent_tag.parent_tag

  @name = xml.attribute("name").to_s

  @parameters = Array.new
  XmiHelper.parameters(xml).each do |uml_parameter|
    parameter = Parameter.new(uml_parameter, self)
    @parameters << parameter
  end    
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


8
9
10
# File 'lib/xmimodel/signal_event.rb', line 8

def name
  @name
end

#parametersObject (readonly)

Returns the value of attribute parameters


10
11
12
# File 'lib/xmimodel/signal_event.rb', line 10

def parameters
  @parameters
end

#use_caseObject (readonly)

Returns the value of attribute use_case


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

def use_case
  @use_case
end

Instance Method Details

#<=>(obj) ⇒ Object


33
34
35
# File 'lib/xmimodel/signal_event.rb', line 33

def <=>(obj)
    full_name <=> obj.full_name
end

#==(obj) ⇒ Object


37
38
39
40
41
42
43
44
# File 'lib/xmimodel/signal_event.rb', line 37

def ==(obj)
  return false if obj.nil?
  if String == obj.class
    full_name == obj
  else
      full_name == obj.full_name
    end
end

#full_nameObject


46
47
48
# File 'lib/xmimodel/signal_event.rb', line 46

def full_name
  "#{use_case.full_name}::#{name}"
end

#parameter_by_name(name) ⇒ Object


27
28
29
30
31
# File 'lib/xmimodel/signal_event.rb', line 27

def parameter_by_name(name)
  parameter = @parameters.select{|obj| obj.name == name}
  return parameter[0] if !parameter.nil? && parameter.size > 0
  nil    
end

#to_sObject


50
51
52
# File 'lib/xmimodel/signal_event.rb', line 50

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