#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.33.0.6934.a386b0a58 modeling language!
# line 3 "../ImmutableUnidirectionalNTest.ump"

class Student():
    #------------------------
    # MEMBER VARIABLES
    #------------------------
    #Student Attributes
    #Student Associations
    #Helper Variables
    #------------------------
    # CONSTRUCTOR
    #------------------------
    def __init__(self, aNumber, *allMentors):
        allMentors = list(allMentors)
        self._canSetMentors = None
        self._mentors = None
        self._number = None
        self._number = aNumber
        self._canSetMentors = True
        self._mentors = []
        didAddMentors = self.setMentors(*allMentors)
        if not didAddMentors :
            raise RuntimeError ("Unable to create Student, must have 3 mentors. See http://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")

    #------------------------
    # INTERFACE
    #------------------------
    def getNumber(self):
        return self._number

    # Code from template association_GetMany 
    def getMentor(self, index):
        aMentor = self._mentors[index]
        return aMentor

    def getMentors(self):
        newMentors = tuple(self._mentors)
        return newMentors

    def numberOfMentors(self):
        self._number = len(self._mentors)
        return self._number

    def hasMentors(self):
        has = len(self._mentors) > 0
        return has

    def indexOfMentor(self, aMentor):
        index = (-1 if not aMentor in self._mentors else self._mentors.index(aMentor))
        return index

    # Code from template association_RequiredNumberOfMethod 
    @staticmethod
    def requiredNumberOfMentors():
        return 3

    # Code from template association_MinimumNumberOfMethod 
    @staticmethod
    def minimumNumberOfMentors():
        return 3

    # Code from template association_MaximumNumberOfMethod 
    @staticmethod
    def maximumNumberOfMentors():
        return 3

    # Code from template association_SetUnidirectionalN 
    def setMentors(self, *newMentors):
        newMentors = list(newMentors)
        wasSet = False
        if not self._canSetMentors :
            return False
        self._canSetMentors = False
        verifiedMentors = []
        for aMentor in newMentors:
            if (aMentor) in verifiedMentors :
                continue
            verifiedMentors.append(aMentor)

        if len(verifiedMentors) != len(newMentors) or len(verifiedMentors) != Student.requiredNumberOfMentors() :
            return wasSet
        self._mentors.clear()
        self._mentors.extend(verifiedMentors)
        wasSet = True
        return wasSet

    def delete(self):
        pass

    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 9 "../ImmutableUnidirectionalNTest.ump"

class Mentor():
    #------------------------
    # MEMBER VARIABLES
    #------------------------
    #Mentor Attributes
    #------------------------
    # CONSTRUCTOR
    #------------------------
    def __init__(self, aName):
        self._name = None
        self._name = aName

    #------------------------
    # INTERFACE
    #------------------------
    def getName(self):
        return self._name

    def delete(self):
        pass

    def __str__(self):
        return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "]"