# PLEASE DO NOT EDIT THIS CODE
# This code was generated using the UMPLE 1.32.1.6535.66c005ced modeling language!
# NOTE: Ruby generator is experimental and is missing some features available in
# in other Umple generated languages like Java or PHP
module Example
class MySubordinate
#------------------------
# MEMBER VARIABLES
#------------------------
#MySubordinate Attributes - for documentation purposes
#attr_reader :number
#MySubordinate Associations - for documentation purposes
#attr_reader :myDriver
#------------------------
# CONSTRUCTOR
#------------------------
def initialize(a_number, a_myDriver)
@initialized = false
@deleted = false
@number = a_number
@myDriver = nil
did_add_myDriver = set_myDriver(a_myDriver)
raise "Unable to create mySubordinate due to @myDriver. See http://manual.umple.org?RE002ViolationofAssociationMultiplicity.html" unless did_add_myDriver
@initialized = true
end
#------------------------
# INTERFACE
#------------------------
def set_number(a_number)
was_set = false
@number = a_number
was_set = true
was_set
end
def get_number
@number
end
def get_myDriver
@myDriver
end
def set_myDriver(a_new_myDriver)
was_set = false
if a_new_myDriver.nil?
#Unable to set_myDriver to nil, as mySubordinate must always be associated to a @myDriver
return was_set
end
existing_mySubordinate = a_new_myDriver.get_mySubordinate
if !existing_mySubordinate.nil? and !self.eql?(existing_mySubordinate)
#Unable to set_myDriver, the current @myDriver already has a mySubordinate, which would be orphaned if it were re-assigned
return was_set
end
an_old_myDriver = @myDriver
@myDriver = a_new_myDriver
@myDriver.set_mySubordinate(self)
unless an_old_myDriver.nil?
an_old_myDriver.set_mySubordinate(nil)
end
was_set = true
was_set
end
def delete
@deleted = true
existing_myDriver = @myDriver
@myDriver = nil
unless existing_myDriver.nil?
existing_myDriver.set_mySubordinate(nil)
end
end
end
end
# PLEASE DO NOT EDIT THIS CODE
# This code was generated using the UMPLE 1.32.1.6535.66c005ced modeling language!
# NOTE: Ruby generator is experimental and is missing some features available in
# in other Umple generated languages like Java or PHP
module Example
class MyDriver
#------------------------
# MEMBER VARIABLES
#------------------------
#MyDriver Attributes - for documentation purposes
#attr_reader :name
#MyDriver Associations - for documentation purposes
#attr_reader :mySubordinate
#------------------------
# CONSTRUCTOR
#------------------------
def initialize(a_name)
@initialized = false
@deleted = false
@name = a_name
@mySubordinate = nil
@initialized = true
end
#------------------------
# INTERFACE
#------------------------
def set_name(a_name)
was_set = false
@name = a_name
was_set = true
was_set
end
def get_name
@name
end
def get_mySubordinate
@mySubordinate
end
def has_mySubordinate
has = !@mySubordinate.nil?
has
end
def set_mySubordinate(a_new_mySubordinate)
was_set = false
if !@mySubordinate.nil? and !@mySubordinate.eql?(a_new_mySubordinate) and self.eql?(@mySubordinate.get_myDriver)
#Unable to set_mySubordinate, as existing @mySubordinate would become an orphan
return was_set
end
@mySubordinate = a_new_mySubordinate
an_old_myDriver = !a_new_mySubordinate.nil? ? a_new_mySubordinate.get_myDriver : nil
unless self.eql?(an_old_myDriver)
unless an_old_myDriver.nil?
an_old_myDriver.instance_variable_set("@mySubordinate",nil)
end
unless @mySubordinate.nil?
@mySubordinate.set_myDriver(self)
end
end
was_set = true
was_set
end
def delete
@deleted = true
existing_mySubordinate = @mySubordinate
@mySubordinate = nil
unless existing_mySubordinate.nil?
existing_mySubordinate.delete
end
end
end
end