# PLEASE DO NOT EDIT THIS CODE # This code was generated using the UMPLE 1.35.0.7523.c616a4dce 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 Mentor #------------------------ # MEMBER VARIABLES #------------------------ #Mentor Associations - for documentation purposes #attr_reader :student #------------------------ # CONSTRUCTOR #------------------------ def initialize() @initialized = false @deleted = false @student = nil @initialized = true end #------------------------ # INTERFACE #------------------------ def get_student @student end def has_student has = !@student.nil? has end def set_student(a_new_student) was_set = false if a_new_student.nil? existing_student = @student @student = nil if !existing_student.nil? and !existing_student.get_mentor.nil? existing_student.set_mentor(nil) end was_set = true return was_set end current_student = self.get_student if !current_student.nil? and !current_student.eql?(a_new_student) current_student.set_mentor(nil) end @student = a_new_student existing_mentor = a_new_student.get_mentor unless self.eql?(existing_mentor) a_new_student.set_mentor(self) end was_set = true was_set end def delete @deleted = true unless @student.nil? @student.set_mentor(nil) end end end end # PLEASE DO NOT EDIT THIS CODE # This code was generated using the UMPLE 1.35.0.7523.c616a4dce 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 Student #------------------------ # MEMBER VARIABLES #------------------------ #Student Associations - for documentation purposes #attr_reader :mentor #------------------------ # CONSTRUCTOR #------------------------ def initialize() @initialized = false @deleted = false @mentor = nil @initialized = true end #------------------------ # INTERFACE #------------------------ def get_mentor @mentor end def has_mentor has = !@mentor.nil? has end def set_mentor(a_new_mentor) was_set = false if a_new_mentor.nil? existing_mentor = @mentor @mentor = nil if !existing_mentor.nil? and !existing_mentor.get_student.nil? existing_mentor.set_student(nil) end was_set = true return was_set end current_mentor = self.get_mentor if !current_mentor.nil? and !current_mentor.eql?(a_new_mentor) current_mentor.set_student(nil) end @mentor = a_new_mentor existing_student = a_new_mentor.get_student unless self.eql?(existing_student) a_new_mentor.set_student(self) end was_set = true was_set end def delete @deleted = true unless @mentor.nil? @mentor.set_student(nil) end end end end