#PLEASE DO NOT EDIT THIS CODE #This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language! # line 3 "../OneToOneTest.ump" import os class Mentor(): #------------------------ # MEMBER VARIABLES #------------------------ #Mentor Attributes #Mentor Associations #------------------------ # CONSTRUCTOR #------------------------ @classmethod def alternateConstructor(cls, aName, aStudent): self = cls.__new__(cls) self._student = None self._id = None self._name = None self._name = aName self._id = None if aStudent is None or not (aStudent.getMentor() is None) : raise RuntimeError ("Unable to create Mentor due to aStudent. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html") self._student = aStudent return self def __init__(self, aName, aNameForStudent, aNumberForStudent): from Student import Student self._student = None self._id = None self._name = None self._name = aName self._id = None self._student = Student.alternateConstructor(aNameForStudent, aNumberForStudent, self) #------------------------ # INTERFACE #------------------------ def setName(self, aName): wasSet = False self._name = aName wasSet = True return wasSet def setId(self, aId): wasSet = False self._id = aId wasSet = True return wasSet def getName(self): return self._name def getId(self): return self._id # Code from template association_GetOne def getStudent(self): return self._student def delete(self): existingStudent = self._student self._student = None if not (existingStudent is None) : existingStudent.delete() def __str__(self): return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "," + "id" + ":" + str(self.getId()) + "]" + str(os.linesep) + " " + "student = " + ((format(id(self.getStudent()), "x")) if not (self.getStudent() is None) else "null") #PLEASE DO NOT EDIT THIS CODE #This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language! # line 10 "../OneToOneTest.ump" import os class Student(): #------------------------ # MEMBER VARIABLES #------------------------ #Student Attributes #Student Associations #------------------------ # CONSTRUCTOR #------------------------ @classmethod def alternateConstructor(cls, aName, aNumber, aMentor): self = cls.__new__(cls) self._mentor = None self._number = None self._name = None self._name = aName self._number = aNumber if aMentor is None or not (aMentor.getStudent() is None) : raise RuntimeError ("Unable to create Student due to aMentor. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html") self._mentor = aMentor return self def __init__(self, aName, aNumber, aNameForMentor): from Mentor import Mentor self._mentor = None self._number = None self._name = None self._name = aName self._number = aNumber self._mentor = Mentor.alternateConstructor(aNameForMentor, self) #------------------------ # INTERFACE #------------------------ def setName(self, aName): wasSet = False self._name = aName wasSet = True return wasSet def setNumber(self, aNumber): wasSet = False self._number = aNumber wasSet = True return wasSet def getName(self): return self._name def getNumber(self): return self._number # Code from template association_GetOne def getMentor(self): return self._mentor def delete(self): existingMentor = self._mentor self._mentor = None if not (existingMentor is None) : existingMentor.delete() def __str__(self): return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "," + "number" + ":" + str(self.getNumber()) + "]" + str(os.linesep) + " " + "mentor = " + ((format(id(self.getMentor()), "x")) if not (self.getMentor() is None) else "null")