#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.32.1.6535.66c005ced modeling language!
# line 8 "../OptionalOneToOptionalOneTest.ump"

class Student():
    #------------------------
    # MEMBER VARIABLES
    #------------------------
    #Student Associations
    #------------------------
    # CONSTRUCTOR
    #------------------------
    def __init__(self):
        self._mentor = None

    #------------------------
    # INTERFACE
    #------------------------
    # Code from template association_GetOne 
    def getMentor(self):
        return self._mentor

    def hasMentor(self):
        has = not (self._mentor is None)
        return has

    # Code from template association_SetOptionalOneToOptionalOne 
    def setMentor(self, aNewMentor):
        wasSet = False
        if aNewMentor is None :
            existingMentor = self._mentor
            self._mentor = None
            if not (existingMentor is None) and not (existingMentor.getStudent() is None) :
                existingMentor.setStudent(None)
            wasSet = True
            return wasSet
        currentMentor = self.getMentor()
        if not (currentMentor is None) and not currentMentor == aNewMentor :
            currentMentor.setStudent(None)
        self._mentor = aNewMentor
        existingStudent = aNewMentor.getStudent()
        if not self == existingStudent :
            aNewMentor.setStudent(self)
        wasSet = True
        return wasSet

    def delete(self):
        if not (self._mentor is None) :
            self._mentor.setStudent(None)

