#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.33.0.6934.a386b0a58 modeling language!
# line 27 "../ReflexiveAssociationTest.ump"
class OneToMany():
#------------------------
# MEMBER VARIABLES
#------------------------
#OneToMany Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aOneToMany):
self._oneToMany = None
if not self.setOneToMany(aOneToMany) :
raise RuntimeError ("Unable to create OneToMany due to aOneToMany. See http://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetOne
def getOneToMany(self):
return self._oneToMany
# Code from template association_SetUnidirectionalOne
def setOneToMany(self, aNewOneToMany):
wasSet = False
if not (aNewOneToMany is None) :
self._oneToMany = aNewOneToMany
wasSet = True
return wasSet
def delete(self):
self._oneToMany = None
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.33.0.6934.a386b0a58 modeling language!
# line 9 "../ReflexiveAssociationTest.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#Student Attributes
#Student Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aNumber):
self._ta = None
self._pupil = None
self._number = None
self._number = aNumber
#------------------------
# INTERFACE
#------------------------
def setNumber(self, aNumber):
wasSet = False
self._number = aNumber
wasSet = True
return wasSet
def getNumber(self):
return self._number
# Code from template association_GetOne
def getPupil(self):
return self._pupil
def hasPupil(self):
has = not (self._pupil is None)
return has
# Code from template association_GetOne
def getTa(self):
return self._ta
def hasTa(self):
has = not (self._ta is None)
return has
# Code from template association_SetOptionalOneToOptionalOne
def setPupil(self, aNewPupil):
wasSet = False
if aNewPupil is None :
existingPupil = self._pupil
self._pupil = None
if not (existingPupil is None) and not (existingPupil.getTa() is None) :
existingPupil.setTa(None)
wasSet = True
return wasSet
currentPupil = self.getPupil()
if not (currentPupil is None) and not currentPupil == aNewPupil :
currentPupil.setTa(None)
self._pupil = aNewPupil
existingTa = aNewPupil.getTa()
if not self == existingTa :
aNewPupil.setTa(self)
wasSet = True
return wasSet
# Code from template association_SetOptionalOneToOptionalOne
def setTa(self, aNewTa):
wasSet = False
if aNewTa is None :
existingTa = self._ta
self._ta = None
if not (existingTa is None) and not (existingTa.getPupil() is None) :
existingTa.setPupil(None)
wasSet = True
return wasSet
currentTa = self.getTa()
if not (currentTa is None) and not currentTa == aNewTa :
currentTa.setPupil(None)
self._ta = aNewTa
existingPupil = aNewTa.getPupil()
if not self == existingPupil :
aNewTa.setPupil(self)
wasSet = True
return wasSet
def delete(self):
if not (self._pupil is None) :
self._pupil.setTa(None)
if not (self._ta is None) :
self._ta.setPupil(None)
def __str__(self):
return str(super().__str__()) + "[" + "number" + ":" + str(self.getNumber()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.33.0.6934.a386b0a58 modeling language!
# line 15 "../ReflexiveAssociationTest.ump"
import os
class OneSymmetric():
#------------------------
# MEMBER VARIABLES
#------------------------
#OneSymmetric Attributes
#OneSymmetric Associations
#------------------------
# CONSTRUCTOR
#------------------------
@classmethod
def alternateConstructor(cls, aName, aNumber, aFriend):
self = cls.__new__(cls)
self._friend = None
self._number = None
self._name = None
self._name = aName
self._number = aNumber
if aFriend is None or not (aFriend.getFriend() is None) :
raise RuntimeError ("Unable to create OneSymmetric due to aFriend. See http://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
self._friend = aFriend
return self
def __init__(self, aName, aNumber, aNameForFriend, aNumberForFriend):
self._friend = None
self._number = None
self._name = None
self._name = aName
self._number = aNumber
self._friend = OneSymmetric.alternateConstructor(aNameForFriend, aNumberForFriend, 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 getFriend(self):
return self._friend
def delete(self):
existingFriend = self._friend
self._friend = None
if not (existingFriend is None) :
existingFriend.delete()
def __str__(self):
return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "," + "number" + ":" + str(self.getNumber()) + "]" + str(os.linesep) + " " + "friend = " + ((format(id(self.getFriend()), "x")) if not (self.getFriend() is None) else "null")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.33.0.6934.a386b0a58 modeling language!
# line 22 "../ReflexiveAssociationTest.ump"
class OneSymmetricNoParam():
#------------------------
# MEMBER VARIABLES
#------------------------
#OneSymmetricNoParam Associations
#------------------------
# CONSTRUCTOR
#------------------------
@classmethod
def alternateConstructor(cls, aFriend):
self = cls.__new__(cls)
self._friend = None
if aFriend is None or not (aFriend.getFriend() is None) :
raise RuntimeError ("Unable to create OneSymmetricNoParam due to aFriend. See http://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
self._friend = aFriend
return self
def __init__(self):
self._friend = None
self._friend = OneSymmetricNoParam.alternateConstructor(self)
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetOne
def getFriend(self):
return self._friend
def delete(self):
existingFriend = self._friend
self._friend = None
if not (existingFriend is None) :
existingFriend.delete()
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.33.0.6934.a386b0a58 modeling language!
# line 3 "../ReflexiveAssociationTest.ump"
import os
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#Mentor Attributes
#Mentor Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aName):
self._superMentor = None
self._name = None
self._name = aName
#------------------------
# INTERFACE
#------------------------
def setName(self, aName):
wasSet = False
self._name = aName
wasSet = True
return wasSet
def getName(self):
return self._name
# Code from template association_GetOne
def getSuperMentor(self):
return self._superMentor
def hasSuperMentor(self):
has = not (self._superMentor is None)
return has
# Code from template association_SetOptionalOneToOptionalOne
def setSuperMentor(self, aNewSuperMentor):
wasSet = False
if aNewSuperMentor is None :
existingSuperMentor = self._superMentor
self._superMentor = None
if not (existingSuperMentor is None) and not (existingSuperMentor.getSuperMentor() is None) :
existingSuperMentor.setSuperMentor(None)
wasSet = True
return wasSet
currentSuperMentor = self.getSuperMentor()
if not (currentSuperMentor is None) and not currentSuperMentor == aNewSuperMentor :
currentSuperMentor.setSuperMentor(None)
self._superMentor = aNewSuperMentor
existingSuperMentor = aNewSuperMentor.getSuperMentor()
if not self == existingSuperMentor :
aNewSuperMentor.setSuperMentor(self)
wasSet = True
return wasSet
def delete(self):
if not (self._superMentor is None) :
self._superMentor.setSuperMentor(None)
def __str__(self):
return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "]" + str(os.linesep) + " " + "superMentor = " + ((format(id(self.getSuperMentor()), "x")) if not (self.getSuperMentor() is None) else "null")