Class: RRT_RUBY::RRTLogical::Role

Inherits:
RRT_RUBY::RRTGeneric::Element show all
Defined in:
lib/rrt_ruby/rrt_logical.rb

Instance Attribute Summary collapse

Attributes inherited from RRT_RUBY::RRTGeneric::Element

#documentation, #name, #qualifiedname, #stereotype

Instance Method Summary collapse

Constructor Details

#initialize(element) ⇒ Role

Returns a new instance of Role.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/rrt_ruby/rrt_logical.rb', line 111

def initialize element
	begin
		super(element)
		#name for the class and cardinality
		@class_name=element.ClassifierName
		@cardinality=element.multiplicity
		#get the name of the capsule containing the role
		@parent=element.ParentCollaboration.ParentClassifier.Name
		#get the capsule for the role
		@capsule=nil
		#checking against the name of the parent ensures that we avoid endless loops
		@capsule=Capsule.new(element.Classifier) if element.Classifier.IsClass("Capsule") && element.Classifier.name==@parent
	rescue
		raise RRTGeneric::ElementException.new(element),"error while initialising element: #{$!}"
	end
end

Instance Attribute Details

#capsuleObject (readonly)

Returns the value of attribute capsule.



110
111
112
# File 'lib/rrt_ruby/rrt_logical.rb', line 110

def capsule
  @capsule
end

#cardinalityObject (readonly)

Returns the value of attribute cardinality.



110
111
112
# File 'lib/rrt_ruby/rrt_logical.rb', line 110

def cardinality
  @cardinality
end

#class_nameObject (readonly)

Returns the value of attribute class_name.



110
111
112
# File 'lib/rrt_ruby/rrt_logical.rb', line 110

def class_name
  @class_name
end

#parentObject (readonly)

Returns the value of attribute parent.



110
111
112
# File 'lib/rrt_ruby/rrt_logical.rb', line 110

def parent
  @parent
end

Instance Method Details

#to_sObject



128
129
130
# File 'lib/rrt_ruby/rrt_logical.rb', line 128

def to_s
	return "#{@name}/#{@class_name}"
end