#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 4 "../ClassTemplateTest_Python.ump"
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MethodParameterTypes.ump"
class Object():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
# line 3 "MethodParameterTypes.ump"
def example_obj(self, g):
#implementation
# line 5 "MethodParameterTypes.ump"
def example_bool(self, b):
# line 6 "MethodParameterTypes.ump"
def example_int(self, i):
# line 7 "MethodParameterTypes.ump"
def example_float(self, f):
# line 8 "MethodParameterTypes.ump"
def example_double(self, d):
# line 9 "MethodParameterTypes.ump"
def example_string(self, s):
# line 10 "MethodParameterTypes.ump"
def example_obj_array(self, gs):
# line 11 "MethodParameterTypes.ump"
def example_primitive_array(self, is):
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "ClassTemplateTest_InternalConstant.ump"
class Student():
Name = "XYZ"
#------------------------
# STATIC VARIABLES
#------------------------
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_FixmlAttributes2.ump"
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#Mentor Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aCapacity, aId, aName):
self._name = None
self._id = None
self._capacity = None
self._capacity = aCapacity
self._id = aId
self._name = aName
@classmethod
def alternateConstructor(cls):
self = cls.__new__(cls)
self._name = None
self._id = None
self._capacity = None
self._capacity = "31"
self._name = "Umple"
return self
#------------------------
# INTERFACE
#------------------------
def setCapacity(self, aCapacity):
wasSet = False
self._capacity = aCapacity
wasSet = True
return wasSet
def setId(self, aId):
wasSet = False
self._id = aId
wasSet = True
return wasSet
def setName(self, aName):
wasSet = False
self._name = aName
wasSet = True
return wasSet
def getCapacity(self):
return self._capacity
def getId(self):
return self._id
def getName(self):
return self._name
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "capacity" + ":" + str(self.getCapacity()) + "," + "id" + ":" + str(self.getId()) + "," + "name" + ":" + str(self.getName()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 9 "ClassTemplateTest_StateMachineDoesNotImplementInterface.ump"
from NetworkNode import NetworkNode
from enum import Enum, auto
class Router(NetworkNode):
#------------------------
# MEMBER VARIABLES
#------------------------
#Router Attributes
#Router State Machines
class Status(Enum):
def _generate_next_value_(name, start, count, last_values):
return name
def __str__(self):
return str(self.value)
disconnected = auto()
connected = auto()
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aIpAddress):
self._status = None
self._ipAddress = None
self._ipAddress = aIpAddress
self.setStatus(Router.Status.disconnected)
#------------------------
# INTERFACE
#------------------------
def getStatusFullName(self):
answer = self._status.__str__()
return answer
def getStatus(self):
return self._status
def createConnection(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.disconnected :
self.setStatus(Router.Status.connected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def disconnectRequest(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.connected :
self.setStatus(Router.Status.disconnected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def setStatus(self, aStatus):
self._status = aStatus
def delete(self):
pass
def connect(self):
return False
def disconnect(self):
return False
def errorDetected(self):
return False
def __str__(self):
return str(super().__str__()) + "[" + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 9 "ClassTemplateTest_StateMachineImplementsInterface.ump"
from NetworkNode import NetworkNode
from enum import Enum, auto
class Router(NetworkNode):
#------------------------
# MEMBER VARIABLES
#------------------------
#Router Attributes
#Router State Machines
class Status(Enum):
def _generate_next_value_(name, start, count, last_values):
return name
def __str__(self):
return str(self.value)
disconnected = auto()
connected = auto()
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aIpAddress):
self._status = None
self._ipAddress = None
self._ipAddress = aIpAddress
self.setStatus(Router.Status.disconnected)
#------------------------
# INTERFACE
#------------------------
def getStatusFullName(self):
answer = self._status.__str__()
return answer
def getStatus(self):
return self._status
def connect(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.disconnected :
self.setStatus(Router.Status.connected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def disconnect(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.connected :
self.setStatus(Router.Status.disconnected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def errorDetected(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.connected :
self.setStatus(Router.Status.disconnected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def setStatus(self, aStatus):
self._status = aStatus
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 9 "ClassTemplateTest_StateMachineImplementsPartialInterface.ump"
from NetworkNode import NetworkNode
from enum import Enum, auto
class Router(NetworkNode):
#------------------------
# MEMBER VARIABLES
#------------------------
#Router Attributes
#Router State Machines
class Status(Enum):
def _generate_next_value_(name, start, count, last_values):
return name
def __str__(self):
return str(self.value)
disconnected = auto()
connected = auto()
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aIpAddress):
self._status = None
self._ipAddress = None
self._ipAddress = aIpAddress
self.setStatus(Router.Status.disconnected)
#------------------------
# INTERFACE
#------------------------
def getStatusFullName(self):
answer = self._status.__str__()
return answer
def getStatus(self):
return self._status
def connect(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.disconnected :
self.setStatus(Router.Status.connected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def disconnect(self):
wasEventProcessed = False
aStatus = self._status
if aStatus == Router.Status.connected :
self.setStatus(Router.Status.disconnected)
wasEventProcessed = True
else :
# Other states do respond to this event
pass
return wasEventProcessed
def setStatus(self, aStatus):
self._status = aStatus
def delete(self):
pass
def errorDetected(self):
return False
def __str__(self):
return str(super().__str__()) + "[" + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 4 "../ClassTemplateTest_ExtraCode.ump"
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
# line 7 "../ClassTemplateTest_ExtraCode.ump"
def showMe(self):
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 5 "../ClassTemplateTest_BuildOutputPath.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 4 "../ClassTemplateTest_Attributes.ump"
import os
class Mentor():
MAX = 100
MIN = -99
HELLO = "Hello"
nextX = 1
mentorsById = dict()
#------------------------
# STATIC VARIABLES
#------------------------
#------------------------
# MEMBER VARIABLES
#------------------------
#Mentor Attributes
#Autounique Attributes
#Helper Variables
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aStr, aD, aI, aId):
from example.Time import Time
from example.Date import Date
self._canSetStr2 = None
self._x = None
self._w = None
self._v = None
self._u = None
self._tt = None
self._s = None
self._r = None
self._q = None
self._p = None
self._id = None
self._i = None
self._t = None
self._d = None
self._name = None
self._lBool = None
self._lDoub = None
self._someName = None
self._str2 = None
self._str = None
self._str = aStr
self._canSetStr2 = True
self._someName = None
self._lDoub = 0
self._lBool = False
self._name = "Johannes"
self._d = aD
self._t = Time()
self._i = aI
self.resetP()
self._q = "chicken"
self.resetR()
self._s = "123"
self._tt = Date.valueOf("1978-12-25")
self._u = Time.valueOf("12:13:14")
self.resetV()
self.resetW()
self._x, Mentor.nextX = Mentor.nextX, Mentor.nextX + 1
if not self.setId(aId) :
raise RuntimeError ("Cannot create due to duplicate id. See https://manual.umple.org?RE003ViolationofUniqueness.html")
#------------------------
# INTERFACE
#------------------------
# Code from template attribute_SetImmutable
def setStr2(self, aStr2):
wasSet = False
if not self._canSetStr2 :
return False
self._canSetStr2 = False
self._str2 = aStr2
wasSet = True
return wasSet
def setSomeName(self, aSomeName):
wasSet = False
self._someName = aSomeName
wasSet = True
return wasSet
def setLDoub(self, aLDoub):
wasSet = False
self._lDoub = aLDoub
wasSet = True
return wasSet
def setLBool(self, aLBool):
wasSet = False
self._lBool = aLBool
wasSet = True
return wasSet
def setName(self, aName):
wasSet = False
self._name = aName
wasSet = True
return wasSet
def setD(self, aD):
wasSet = False
self._d = aD
wasSet = True
return wasSet
def setI(self, aI):
wasSet = False
self._i = aI
wasSet = True
return wasSet
def setId(self, aId):
wasSet = False
anOldId = self.getId()
if not (anOldId is None) and anOldId == aId :
return True
if Mentor.hasWithId(aId) :
return wasSet
self._id = aId
wasSet = True
if not (anOldId is None) :
Mentor.mentorsById.pop(anOldId, None)
Mentor.mentorsById[aId] = self
return wasSet
# Code from template attribute_SetDefaulted
def setP(self, aP):
wasSet = False
self._p = aP
wasSet = True
return wasSet
def resetP(self):
wasReset = False
self._p = self.getDefaultP()
wasReset = True
return wasReset
def setQ(self, aQ):
wasSet = False
self._q = aQ
wasSet = True
return wasSet
# Code from template attribute_SetDefaulted
def setR(self, aR):
wasSet = False
self._r = aR
wasSet = True
return wasSet
def resetR(self):
wasReset = False
self._r = self.getDefaultR()
wasReset = True
return wasReset
def setTt(self, aTt):
wasSet = False
self._tt = aTt
wasSet = True
return wasSet
def setU(self, aU):
wasSet = False
self._u = aU
wasSet = True
return wasSet
# Code from template attribute_SetDefaulted
def setV(self, aV):
wasSet = False
self._v = aV
wasSet = True
return wasSet
def resetV(self):
wasReset = False
self._v = self.getDefaultV()
wasReset = True
return wasReset
# Code from template attribute_SetDefaulted
def setW(self, aW):
wasSet = False
self._w = aW
wasSet = True
return wasSet
def resetW(self):
wasReset = False
self._w = self.getDefaultW()
wasReset = True
return wasReset
def getStr(self):
return self._str
def getStr2(self):
return self._str2
def getSomeName(self):
return self._someName
def getLDoub(self):
return self._lDoub
def getLBool(self):
return self._lBool
def getName(self):
return self._name
def getD(self):
return self._d
def getI(self):
return self._i
def getDerivedTwiceI(self):
return self._i * 2
def getId(self):
return self._id
# Code from template attribute_GetUnique
@staticmethod
def getWithId(aId):
return Mentor.mentorsById.get(aId)
# Code from template attribute_HasUnique
@staticmethod
def hasWithId(aId):
return not (Mentor.getWithId(aId) is None)
def getP(self):
return self._p
# Code from template attribute_GetDefaulted
def getDefaultP(self):
return "robot"
def getQ(self):
return self._q
def getR(self):
return self._r
# Code from template attribute_GetDefaulted
def getDefaultR(self):
return ""
def getS(self):
return self._s
def getTt(self):
return self._tt
def getU(self):
return self._u
def getV(self):
return self._v
# Code from template attribute_GetDefaulted
def getDefaultV(self):
from example.Date import Date
return Date.valueOf("1978-12-26")
def getW(self):
return self._w
# Code from template attribute_GetDefaulted
def getDefaultW(self):
from example.Time import Time
return Time.valueOf("12:59:59")
def getX(self):
return self._x
# Code from template attribute_IsBoolean
def isLBool(self):
return self._lBool
def delete(self):
Mentor.mentorsById.pop(self.getId(), None)
def __str__(self):
return str(super().__str__()) + "[" + "x" + ":" + str(self.getX()) + "," + "str" + ":" + str(self.getStr()) + "," + "str2" + ":" + str(self.getStr2()) + "," + "someName" + ":" + str(self.getSomeName()) + "," + "lDoub" + ":" + str(self.getLDoub()) + "," + "lBool" + ":" + str(self.getLBool()) + "," + "name" + ":" + str(self.getName()) + "," + "i" + ":" + str(self.getI()) + "," + "derivedTwiceI" + ":" + str(self.getDerivedTwiceI()) + "," + "id" + ":" + str(self.getId()) + "," + "p" + ":" + str(self.getP()) + "," + "q" + ":" + str(self.getQ()) + "," + "r" + ":" + str(self.getR()) + "," + "s" + ":" + str(self.getS()) + "]" + str(os.linesep) + " " + "d" + "=" + str((((self.getD().__str__().replaceAll(" ", " ")) if not self.getD() == self else "this") if not (self.getD() is None) else "null")) + str(os.linesep) + " " + "tt" + "=" + str((((self.getTt().__str__().replaceAll(" ", " ")) if not self.getTt() == self else "this") if not (self.getTt() is None) else "null")) + str(os.linesep) + " " + "u" + "=" + str((((self.getU().__str__().replaceAll(" ", " ")) if not self.getU() == self else "this") if not (self.getU() is None) else "null")) + str(os.linesep) + " " + "v" + "=" + str((((self.getV().__str__().replaceAll(" ", " ")) if not self.getV() == self else "this") if not (self.getV() is None) else "null")) + str(os.linesep) + " " + "w" + "=" + (((self.getW().__str__().replaceAll(" ", " ")) if not self.getW() == self else "this") if not (self.getW() 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 1 "ClassTemplateTest_AbstractClassAvoidingInstantiation.ump"
class Teacher():
#------------------------
# MEMBER VARIABLES
#------------------------
#Teacher Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._myStudents = None
self._myStudents = []
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetMany
def getMyStudent(self, index):
aMyStudent = self._myStudents[index]
return aMyStudent
def getMyStudents(self):
newMyStudents = tuple(self._myStudents)
return newMyStudents
def numberOfMyStudents(self):
number = len(self._myStudents)
return number
def hasMyStudents(self):
has = len(self._myStudents) > 0
return has
def indexOfMyStudent(self, aMyStudent):
index = (-1 if not aMyStudent in self._myStudents else self._myStudents.index(aMyStudent))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfMyStudents():
return 0
# Code from template association_AddManyToOne
def addMyStudent(self, aMyStudent):
wasAdded = False
if (aMyStudent) in self._myStudents :
return False
existingTeacher = aMyStudent.getTeacher()
isNewTeacher = not (existingTeacher is None) and not self == existingTeacher
if isNewTeacher :
aMyStudent.setTeacher(self)
else :
self._myStudents.append(aMyStudent)
wasAdded = True
return wasAdded
def removeMyStudent(self, aMyStudent):
wasRemoved = False
#Unable to remove aMyStudent, as it must always have a teacher
if not self == aMyStudent.getTeacher() :
self._myStudents.remove(aMyStudent)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addMyStudentAt(self, aMyStudent, index):
wasAdded = False
if self.addMyStudent(aMyStudent) :
if index < 0 :
index = 0
if index > self.numberOfMyStudents() :
index = self.numberOfMyStudents() - 1
self._myStudents.remove(aMyStudent)
self._myStudents.insert(index, aMyStudent)
wasAdded = True
return wasAdded
def addOrMoveMyStudentAt(self, aMyStudent, index):
wasAdded = False
if (aMyStudent) in self._myStudents :
if index < 0 :
index = 0
if index > self.numberOfMyStudents() :
index = self.numberOfMyStudents() - 1
self._myStudents.remove(aMyStudent)
self._myStudents.insert(index, aMyStudent)
wasAdded = True
else :
wasAdded = self.addMyStudentAt(aMyStudent, index)
return wasAdded
def delete(self):
i = len(self._myStudents)
while i > 0 :
aMyStudent = self._myStudents[i - 1]
aMyStudent.delete()
i -= 1
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 7 "../ClassTemplateTest_AssociationClassTest_1.ump"
import os
class Registration():
#------------------------
# MEMBER VARIABLES
#------------------------
#Registration Attributes
#Registration Associations
#Helper Variables
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aGrade, aStudent, aCourseSection):
self._canSetCourseSection = None
self._canSetStudent = None
self._cachedHashCode = None
self._courseSection = None
self._student = None
self._grade = None
self._cachedHashCode = -1
self._canSetStudent = True
self._canSetCourseSection = True
self._grade = aGrade
didAddStudent = self.setStudent(aStudent)
if not didAddStudent :
raise RuntimeError ("Unable to create registration due to student. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
didAddCourseSection = self.setCourseSection(aCourseSection)
if not didAddCourseSection :
raise RuntimeError ("Unable to create registration due to courseSection. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
#------------------------
# INTERFACE
#------------------------
def setGrade(self, aGrade):
wasSet = False
self._grade = aGrade
wasSet = True
return wasSet
def getGrade(self):
return self._grade
# Code from template association_GetOne
def getStudent(self):
return self._student
# Code from template association_GetOne
def getCourseSection(self):
return self._courseSection
# Code from template association_SetOneToManyAssociationClass
def setStudent(self, aStudent):
wasSet = False
if not self._canSetStudent :
return False
if aStudent is None :
return wasSet
existingStudent = self._student
self._student = aStudent
if not (existingStudent is None) and not existingStudent == aStudent :
existingStudent.removeRegistration(self)
if not self._student.addRegistration(self) :
self._student = existingStudent
wasSet = False
else :
wasSet = True
return wasSet
# Code from template association_SetOneToManyAssociationClass
def setCourseSection(self, aCourseSection):
wasSet = False
if not self._canSetCourseSection :
return False
if aCourseSection is None :
return wasSet
existingCourseSection = self._courseSection
self._courseSection = aCourseSection
if not (existingCourseSection is None) and not existingCourseSection == aCourseSection :
existingCourseSection.removeRegistration(self)
if not self._courseSection.addRegistration(self) :
self._courseSection = existingCourseSection
wasSet = False
else :
wasSet = True
return wasSet
def equals(self, obj):
if obj is None :
return False
if not type(self) is type(obj) :
return False
compareTo = obj
if self.getStudent() is None and not (compareTo.getStudent() is None) :
return False
elif not (self.getStudent() is None) and not self.getStudent() == compareTo.getStudent() :
return False
if self.getCourseSection() is None and not (compareTo.getCourseSection() is None) :
return False
elif not (self.getCourseSection() is None) and not self.getCourseSection() == compareTo.getCourseSection() :
return False
return True
def __hash__(self):
if self._cachedHashCode != -1 :
return self._cachedHashCode
self._cachedHashCode = 17
if not (self.getStudent() is None) :
self._cachedHashCode = self._cachedHashCode * 23 + self.getStudent().__hash__()
else :
self._cachedHashCode = self._cachedHashCode * 23
if not (self.getCourseSection() is None) :
self._cachedHashCode = self._cachedHashCode * 23 + self.getCourseSection().__hash__()
else :
self._cachedHashCode = self._cachedHashCode * 23
self._canSetStudent = False
self._canSetCourseSection = False
return self._cachedHashCode
def delete(self):
placeholderStudent = self._student
self._student = None
if not (placeholderStudent is None) :
placeholderStudent.removeRegistration(self)
placeholderCourseSection = self._courseSection
self._courseSection = None
if not (placeholderCourseSection is None) :
placeholderCourseSection.removeRegistration(self)
def __str__(self):
return str(super().__str__()) + "[" + "grade" + ":" + str(self.getGrade()) + "]" + str(os.linesep) + " " + "student = " + str(((format(id(self.getStudent()), "x")) if not (self.getStudent() is None) else "null")) + str(os.linesep) + " " + "courseSection = " + ((format(id(self.getCourseSection()), "x")) if not (self.getCourseSection() 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 7 "../ClassTemplateTest_AssociationClassTest_2.ump"
import os
class Registration():
#------------------------
# MEMBER VARIABLES
#------------------------
#Registration Attributes
#Registration Associations
#Helper Variables
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aGrade, aStudent, aCourseSection):
self._canSetCourseSection = None
self._canSetStudent = None
self._cachedHashCode = None
self._courseSection = None
self._student = None
self._grade = None
self._cachedHashCode = -1
self._canSetStudent = True
self._canSetCourseSection = True
self._grade = aGrade
didAddStudent = self.setStudent(aStudent)
if not didAddStudent :
raise RuntimeError ("Unable to create registration due to student. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
didAddCourseSection = self.setCourseSection(aCourseSection)
if not didAddCourseSection :
raise RuntimeError ("Unable to create registration due to courseSection. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
#------------------------
# INTERFACE
#------------------------
def setGrade(self, aGrade):
wasSet = False
self._grade = aGrade
wasSet = True
return wasSet
def getGrade(self):
return self._grade
# Code from template association_GetOne
def getStudent(self):
return self._student
# Code from template association_GetOne
def getCourseSection(self):
return self._courseSection
# Code from template association_SetOneToManyAssociationClass
def setStudent(self, aStudent):
wasSet = False
if not self._canSetStudent :
return False
if aStudent is None :
return wasSet
existingStudent = self._student
self._student = aStudent
if not (existingStudent is None) and not existingStudent == aStudent :
existingStudent.removeRegistration(self)
if not self._student.addRegistration(self) :
self._student = existingStudent
wasSet = False
else :
wasSet = True
return wasSet
# Code from template association_SetOneToManyAssociationClass
def setCourseSection(self, aCourseSection):
wasSet = False
if not self._canSetCourseSection :
return False
if aCourseSection is None :
return wasSet
existingCourseSection = self._courseSection
self._courseSection = aCourseSection
if not (existingCourseSection is None) and not existingCourseSection == aCourseSection :
existingCourseSection.removeRegistration(self)
if not self._courseSection.addRegistration(self) :
self._courseSection = existingCourseSection
wasSet = False
else :
wasSet = True
return wasSet
def equals(self, obj):
if obj is None :
return False
if not type(self) is type(obj) :
return False
compareTo = obj
if self.getStudent() is None and not (compareTo.getStudent() is None) :
return False
elif not (self.getStudent() is None) and not self.getStudent() == compareTo.getStudent() :
return False
if self.getCourseSection() is None and not (compareTo.getCourseSection() is None) :
return False
elif not (self.getCourseSection() is None) and not self.getCourseSection() == compareTo.getCourseSection() :
return False
return True
def __hash__(self):
if self._cachedHashCode != -1 :
return self._cachedHashCode
self._cachedHashCode = 17
if not (self.getStudent() is None) :
self._cachedHashCode = self._cachedHashCode * 23 + self.getStudent().__hash__()
else :
self._cachedHashCode = self._cachedHashCode * 23
if not (self.getCourseSection() is None) :
self._cachedHashCode = self._cachedHashCode * 23 + self.getCourseSection().__hash__()
else :
self._cachedHashCode = self._cachedHashCode * 23
self._canSetStudent = False
self._canSetCourseSection = False
return self._cachedHashCode
def delete(self):
placeholderStudent = self._student
self._student = None
if not (placeholderStudent is None) :
placeholderStudent.removeRegistration(self)
placeholderCourseSection = self._courseSection
self._courseSection = None
if not (placeholderCourseSection is None) :
placeholderCourseSection.removeRegistration(self)
def __str__(self):
return str(super().__str__()) + "[" + "grade" + ":" + str(self.getGrade()) + "]" + str(os.linesep) + " " + "student = " + str(((format(id(self.getStudent()), "x")) if not (self.getStudent() is None) else "null")) + str(os.linesep) + " " + "courseSection = " + ((format(id(self.getCourseSection()), "x")) if not (self.getCourseSection() is None) else "null")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
#*
# * This is a student
#
# line 4 "../ClassTemplateTest_Comment.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "AssociationMultilineComment.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#Foo Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._bars = None
self._bars = []
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetMany
def getBar(self, index):
aBar = self._bars[index]
return aBar
#*
# * I am a multiline comment above an association.
#
def getBars(self):
newBars = tuple(self._bars)
return newBars
def numberOfBars(self):
number = len(self._bars)
return number
def hasBars(self):
has = len(self._bars) > 0
return has
def indexOfBar(self, aBar):
index = (-1 if not aBar in self._bars else self._bars.index(aBar))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfBars():
return 0
# Code from template association_AddManyToOne
def addBar1(self):
from Bar import Bar
return Bar(self)
def addBar2(self, aBar):
wasAdded = False
if (aBar) in self._bars :
return False
existingFoo = aBar.getFoo()
isNewFoo = not (existingFoo is None) and not self == existingFoo
if isNewFoo :
aBar.setFoo(self)
else :
self._bars.append(aBar)
wasAdded = True
return wasAdded
def removeBar(self, aBar):
wasRemoved = False
#Unable to remove aBar, as it must always have a foo
if not self == aBar.getFoo() :
self._bars.remove(aBar)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addBarAt(self, aBar, index):
wasAdded = False
if self.addBar(aBar) :
if index < 0 :
index = 0
if index > self.numberOfBars() :
index = self.numberOfBars() - 1
self._bars.remove(aBar)
self._bars.insert(index, aBar)
wasAdded = True
return wasAdded
def addOrMoveBarAt(self, aBar, index):
wasAdded = False
if (aBar) in self._bars :
if index < 0 :
index = 0
if index > self.numberOfBars() :
index = self.numberOfBars() - 1
self._bars.remove(aBar)
self._bars.insert(index, aBar)
wasAdded = True
else :
wasAdded = self.addBarAt(aBar, index)
return wasAdded
def delete(self):
i = len(self._bars)
while i > 0 :
aBar = self._bars[i - 1]
aBar.delete()
i -= 1
def addBar(self, *argv):
from Bar import Bar
if len(argv) == 0 :
return self.addBar1()
if len(argv) == 1 and isinstance(argv[0], Bar) :
return self.addBar2(argv[0])
raise TypeError("No method matches provided parameters")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_EmptyStringAttr.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#Student Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._grade = None
self._grade = ""
#------------------------
# INTERFACE
#------------------------
def setGrade(self, aGrade):
wasSet = False
self._grade = aGrade
wasSet = True
return wasSet
def getGrade(self):
return self._grade
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "grade" + ":" + str(self.getGrade()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_AssociationAttributes.ump"
import os
class Token():
#------------------------
# MEMBER VARIABLES
#------------------------
#Token Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aP):
self._p = None
self._p = aP
#------------------------
# INTERFACE
#------------------------
def setP(self, aP):
wasSet = False
self._p = aP
wasSet = True
return wasSet
def getP(self):
return self._p
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "]" + str(os.linesep) + " " + "p" + "=" + (((self.getP().__str__().replaceAll(" ", " ")) if not self.getP() == self else "this") if not (self.getP() is None) else "null")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
#*
# * This is a student
# * Multiple comments
# * on several lines
#
# line 6 "../ClassTemplateTest_MultiComment.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "ClassTemplateTest_AbstractClass.ump"
from abc import ABC, abstractmethod
class Foo(ABC):
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
#*
# * I am a class comment.
# *
# * Notice how there are 4 empty lines below me.
# *
# *
# *
# *
# * And 2 below me.
# *
# *
# * These lines should come out as we see here.
# * Comments such as these are often used to improve readability through whitespace clarity.
#
# line 15 "ClassCommentWithEmptyLines.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "AttributeMultilineComment.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#Foo Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aName):
self._name = None
self._name = aName
#------------------------
# INTERFACE
#------------------------
def setName(self, aName):
wasSet = False
self._name = aName
wasSet = True
return wasSet
#*
# * I am a multiline comment above an attribute.
#
def getName(self):
return self._name
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "ClassTemplateTest_NoNamespace.ump"
class Token():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MultipleAttributeComments.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#Foo Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aTestAttribute1, aTestAttribute2, aTestAttribute3, aTestAttribute4):
self._testAttribute4 = None
self._testAttribute3 = None
self._testAttribute2 = None
self._testAttribute1 = None
self._testAttribute1 = aTestAttribute1
self._testAttribute2 = aTestAttribute2
self._testAttribute3 = aTestAttribute3
self._testAttribute4 = aTestAttribute4
#------------------------
# INTERFACE
#------------------------
def setTestAttribute1(self, aTestAttribute1):
wasSet = False
self._testAttribute1 = aTestAttribute1
wasSet = True
return wasSet
def setTestAttribute2(self, aTestAttribute2):
wasSet = False
self._testAttribute2 = aTestAttribute2
wasSet = True
return wasSet
def setTestAttribute3(self, aTestAttribute3):
wasSet = False
self._testAttribute3 = aTestAttribute3
wasSet = True
return wasSet
def setTestAttribute4(self, aTestAttribute4):
wasSet = False
self._testAttribute4 = aTestAttribute4
wasSet = True
return wasSet
#*
# * Inline comment above attribute.
#
def getTestAttribute1(self):
return self._testAttribute1
#*
# * Multiple inline comments
# * above attribute.
#
def getTestAttribute2(self):
return self._testAttribute2
#*
# * Multiline comment above attribute.
#
def getTestAttribute3(self):
return self._testAttribute3
#*
# * Multiple multiline comments
# * above attribute.
#
def getTestAttribute4(self):
return self._testAttribute4
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "testAttribute1" + ":" + str(self.getTestAttribute1()) + "," + "testAttribute2" + ":" + str(self.getTestAttribute2()) + "," + "testAttribute3" + ":" + str(self.getTestAttribute3()) + "," + "testAttribute4" + ":" + str(self.getTestAttribute4()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 8 "../ClassTemplateTest_IsA.ump"
from Mentor import Mentor
class SubMentor(Mentor):
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aName):
super().__init__(aName)
#------------------------
# INTERFACE
#------------------------
def delete(self):
super().delete()
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 13 "../ClassTemplateTest_IsA.ump"
from Mentor import Mentor
class SubMentor2(Mentor):
#------------------------
# MEMBER VARIABLES
#------------------------
#SubMentor2 Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aName, aSubName):
self._subName = None
super().__init__(aName)
self._subName = aSubName
#------------------------
# INTERFACE
#------------------------
def setSubName(self, aSubName):
wasSet = False
self._subName = aSubName
wasSet = True
return wasSet
def getSubName(self):
return self._subName
def delete(self):
super().delete()
def __str__(self):
return str(super().__str__()) + "[" + "subName" + ":" + str(self.getSubName()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_ListAttributes.ump"
class Token():
#------------------------
# MEMBER VARIABLES
#------------------------
#Token Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._positions = None
self._positions = []
#------------------------
# INTERFACE
#------------------------
# Code from template attribute_SetMany
def addPosition(self, aPosition):
wasAdded = False
wasAdded = self._positions.append(aPosition)
return wasAdded
def removePosition(self, aPosition):
wasRemoved = False
wasRemoved = self._positions.remove(aPosition)
return wasRemoved
# Code from template attribute_GetMany
def getPosition(self, index):
aPosition = self._positions[index]
return aPosition
def getPositions(self):
newPositions = self._positions.copy()
return newPositions
def numberOfPositions(self):
number = len(self._positions)
return number
def hasPositions(self):
has = len(self._positions) > 0
return has
def indexOfPosition(self, aPosition):
index = (-1 if not aPosition in self._positions else self._positions.index(aPosition))
return index
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../../ClassTemplateTest_Import.ump"
import os
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#Mentor Attributes
#Mentor Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aName):
self._student = 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 getStudent(self):
return self._student
def hasStudent(self):
has = not (self._student is None)
return has
# Code from template association_SetOptionalOneToMandatoryMany
def setStudent(self, aStudent):
#
# This source of this source generation is association_SetOptionalOneToMandatoryMany.jet
# This set file assumes the generation of a maximumNumberOfXXX method does not exist because
# it's not required (No upper bound)
#
wasSet = False
existingStudent = self._student
if existingStudent is None :
if not (aStudent is None) :
if aStudent.addMentor(self) :
existingStudent = aStudent
wasSet = True
elif not (existingStudent is None) :
if aStudent is None :
if existingStudent.minimumNumberOfMentors() < existingStudent.numberOfMentors() :
existingStudent.removeMentor(self)
existingStudent = aStudent
# aStudent == null
wasSet = True
else :
if existingStudent.minimumNumberOfMentors() < existingStudent.numberOfMentors() :
existingStudent.removeMentor(self)
aStudent.addMentor(self)
existingStudent = aStudent
wasSet = True
if wasSet :
self._student = existingStudent
return wasSet
def delete(self):
if not (self._student is None) :
if self._student.numberOfMentors() <= 1 :
self._student.delete()
else :
placeholderStudent = self._student
self._student = None
placeholderStudent.removeMentor(self)
def __str__(self):
return str(super().__str__()) + "[" + "name" + ":" + str(self.getName()) + "]" + 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 11 "../../ClassTemplateTest_Import.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#Student Attributes
#Student Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aNumber, *allMentors):
allMentors = list(allMentors)
self._courses = None
self._mentors = None
self._number = None
self._number = aNumber
self._mentors = []
didAddMentors = self.setMentors(*allMentors)
if not didAddMentors :
raise RuntimeError ("Unable to create Student, must have at least 1 mentors. See https://manual.umple.org?RE002ViolationofAssociationMultiplicity.html")
self._courses = []
#------------------------
# INTERFACE
#------------------------
def setNumber(self, aNumber):
wasSet = False
self._number = aNumber
wasSet = True
return wasSet
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):
number = len(self._mentors)
return 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_GetMany
def getCourse(self, index):
aCourse = self._courses[index]
return aCourse
def getCourses(self):
newCourses = tuple(self._courses)
return newCourses
def numberOfCourses(self):
number = len(self._courses)
return number
def hasCourses(self):
has = len(self._courses) > 0
return has
def indexOfCourse(self, aCourse):
index = (-1 if not aCourse in self._courses else self._courses.index(aCourse))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfMentors():
return 1
# Code from template association_AddMNToOptionalOne
def addMentor(self, aMentor):
wasAdded = False
if (aMentor) in self._mentors :
return False
existingStudent = aMentor.getStudent()
if not (existingStudent is None) and existingStudent.numberOfMentors() <= Student.minimumNumberOfMentors() :
return wasAdded
elif not (existingStudent is None) :
existingStudent.mentors.remove(aMentor)
self._mentors.append(aMentor)
self.setStudent(aMentor, self)
wasAdded = True
return wasAdded
def removeMentor(self, aMentor):
wasRemoved = False
if (aMentor) in self._mentors and self.numberOfMentors() > Student.minimumNumberOfMentors() :
self._mentors.remove(aMentor)
self.setStudent(aMentor, None)
wasRemoved = True
return wasRemoved
# Code from template association_SetMNToOptionalOne
def setMentors(self, *newMentors):
newMentors = list(newMentors)
wasSet = False
if len(newMentors) < Student.minimumNumberOfMentors() :
return wasSet
checkNewMentors = []
studentToNewMentors = dict()
for aMentor in newMentors:
if (aMentor) in checkNewMentors :
return wasSet
elif not (aMentor.getStudent() is None) and not self == aMentor.getStudent() :
existingStudent = aMentor.getStudent()
if not (existingStudent) in studentToNewMentors :
studentToNewMentors[existingStudent] = int(existingStudent.numberOfMentors())
currentCount = studentToNewMentors.get(existingStudent)
nextCount = currentCount - 1
if nextCount < 1 :
return wasSet
studentToNewMentors[existingStudent] = int(nextCount)
checkNewMentors.append(aMentor)
self._mentors = list(filter(lambda a : not a in checkNewMentors, self._mentors))
for orphan in self._mentors:
self.setStudent(orphan, None)
self._mentors.clear()
for aMentor in newMentors:
if not (aMentor.getStudent() is None) :
aMentor.getStudent().mentors.remove(aMentor)
self.setStudent(aMentor, self)
self._mentors.append(aMentor)
wasSet = True
return wasSet
# Code from template association_GetPrivate
def setStudent(self, aMentor, aStudent):
try :
aMentor._student = aStudent
except :
raise RuntimeError ("Issue internally setting aStudent to aMentor")
# Code from template association_AddIndexControlFunctions
def addMentorAt(self, aMentor, index):
wasAdded = False
if self.addMentor(aMentor) :
if index < 0 :
index = 0
if index > self.numberOfMentors() :
index = self.numberOfMentors() - 1
self._mentors.remove(aMentor)
self._mentors.insert(index, aMentor)
wasAdded = True
return wasAdded
def addOrMoveMentorAt(self, aMentor, index):
wasAdded = False
if (aMentor) in self._mentors :
if index < 0 :
index = 0
if index > self.numberOfMentors() :
index = self.numberOfMentors() - 1
self._mentors.remove(aMentor)
self._mentors.insert(index, aMentor)
wasAdded = True
else :
wasAdded = self.addMentorAt(aMentor, index)
return wasAdded
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfCourses():
return 0
# Code from template association_AddManyToManyMethod
def addCourse(self, aCourse):
wasAdded = False
if (aCourse) in self._courses :
return False
self._courses.append(aCourse)
if aCourse.indexOfStudent(self) != -1 :
wasAdded = True
else :
wasAdded = aCourse.addStudent(self)
if not wasAdded :
self._courses.remove(aCourse)
return wasAdded
# Code from template association_RemoveMany
def removeCourse(self, aCourse):
wasRemoved = False
if not (aCourse) in self._courses :
return wasRemoved
oldIndex = (-1 if not aCourse in self._courses else self._courses.index(aCourse))
self._courses.remove(oldIndex)
if aCourse.indexOfStudent(self) == -1 :
wasRemoved = True
else :
wasRemoved = aCourse.removeStudent(self)
if not wasRemoved :
self._courses.insert(oldIndex, aCourse)
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addCourseAt(self, aCourse, index):
wasAdded = False
if self.addCourse(aCourse) :
if index < 0 :
index = 0
if index > self.numberOfCourses() :
index = self.numberOfCourses() - 1
self._courses.remove(aCourse)
self._courses.insert(index, aCourse)
wasAdded = True
return wasAdded
def addOrMoveCourseAt(self, aCourse, index):
wasAdded = False
if (aCourse) in self._courses :
if index < 0 :
index = 0
if index > self.numberOfCourses() :
index = self.numberOfCourses() - 1
self._courses.remove(aCourse)
self._courses.insert(index, aCourse)
wasAdded = True
else :
wasAdded = self.addCourseAt(aCourse, index)
return wasAdded
def delete(self):
for aMentor in self._mentors:
self.setStudent(aMentor, None)
self._mentors.clear()
copyOfCourses = self._courses.copy()
self._courses.clear()
for aCourse in copyOfCourses:
aCourse.removeStudent(self)
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.35.0.7523.c616a4dce modeling language!
# line 18 "../../ClassTemplateTest_Import.ump"
class Course():
#------------------------
# MEMBER VARIABLES
#------------------------
#Course Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._students = None
self._students = []
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetMany
def getStudent(self, index):
aStudent = self._students[index]
return aStudent
def getStudents(self):
newStudents = tuple(self._students)
return newStudents
def numberOfStudents(self):
number = len(self._students)
return number
def hasStudents(self):
has = len(self._students) > 0
return has
def indexOfStudent(self, aStudent):
index = (-1 if not aStudent in self._students else self._students.index(aStudent))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfStudents():
return 0
# Code from template association_AddManyToManyMethod
def addStudent(self, aStudent):
wasAdded = False
if (aStudent) in self._students :
return False
self._students.append(aStudent)
if aStudent.indexOfCourse(self) != -1 :
wasAdded = True
else :
wasAdded = aStudent.addCourse(self)
if not wasAdded :
self._students.remove(aStudent)
return wasAdded
# Code from template association_RemoveMany
def removeStudent(self, aStudent):
wasRemoved = False
if not (aStudent) in self._students :
return wasRemoved
oldIndex = (-1 if not aStudent in self._students else self._students.index(aStudent))
self._students.remove(oldIndex)
if aStudent.indexOfCourse(self) == -1 :
wasRemoved = True
else :
wasRemoved = aStudent.removeCourse(self)
if not wasRemoved :
self._students.insert(oldIndex, aStudent)
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addStudentAt(self, aStudent, index):
wasAdded = False
if self.addStudent(aStudent) :
if index < 0 :
index = 0
if index > self.numberOfStudents() :
index = self.numberOfStudents() - 1
self._students.remove(aStudent)
self._students.insert(index, aStudent)
wasAdded = True
return wasAdded
def addOrMoveStudentAt(self, aStudent, index):
wasAdded = False
if (aStudent) in self._students :
if index < 0 :
index = 0
if index > self.numberOfStudents() :
index = self.numberOfStudents() - 1
self._students.remove(aStudent)
self._students.insert(index, aStudent)
wasAdded = True
else :
wasAdded = self.addStudentAt(aStudent, index)
return wasAdded
def delete(self):
copyOfStudents = self._students.copy()
self._students.clear()
for aStudent in copyOfStudents:
aStudent.removeCourse(self)
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_Singleton.ump"
class Application():
theInstance = None
#------------------------
# STATIC VARIABLES
#------------------------
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
@staticmethod
def getInstance():
if Application.theInstance is None :
Application.theInstance = Application()
return Application.theInstance
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MethodCommentWithEmptyLines.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#*
# * I am a method comment.
# *
# * Notice how there are 4 empty lines below me.
# *
# *
# *
# *
# * And 2 below me.
# *
# *
# * These lines should come out as we see here.
# * Comments such as these are often used to improve readability through whitespace clarity.
#
# line 19 "MethodCommentWithEmptyLines.ump"
def testMethod(self):
// I am a test method.
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_EmptyClass.ump"
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 16 "ClassTemplateTest_AbstractClassInheritance.ump"
from Person import Person
class Teacher(Person):
#------------------------
# MEMBER VARIABLES
#------------------------
#Teacher Attributes
#Teacher Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aName, aAge, aPosition):
self._students = None
self._position = None
super().__init__(aName, aAge)
self._position = aPosition
self._students = []
#------------------------
# INTERFACE
#------------------------
def setPosition(self, aPosition):
wasSet = False
self._position = aPosition
wasSet = True
return wasSet
def getPosition(self):
return self._position
# Code from template association_GetMany
def getStudent(self, index):
aStudent = self._students[index]
return aStudent
def getStudents(self):
newStudents = tuple(self._students)
return newStudents
def numberOfStudents(self):
number = len(self._students)
return number
def hasStudents(self):
has = len(self._students) > 0
return has
def indexOfStudent(self, aStudent):
index = (-1 if not aStudent in self._students else self._students.index(aStudent))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfStudents():
return 0
# Code from template association_AddManyToOne
def addStudent1(self, aName, aAge, aStudentID):
from Student import Student
return Student(aName, aAge, aStudentID, self)
def addStudent2(self, aStudent):
wasAdded = False
if (aStudent) in self._students :
return False
existingTeacher = aStudent.getTeacher()
isNewTeacher = not (existingTeacher is None) and not self == existingTeacher
if isNewTeacher :
aStudent.setTeacher(self)
else :
self._students.append(aStudent)
wasAdded = True
return wasAdded
def removeStudent(self, aStudent):
wasRemoved = False
#Unable to remove aStudent, as it must always have a teacher
if not self == aStudent.getTeacher() :
self._students.remove(aStudent)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addStudentAt(self, aStudent, index):
wasAdded = False
if self.addStudent(aStudent) :
if index < 0 :
index = 0
if index > self.numberOfStudents() :
index = self.numberOfStudents() - 1
self._students.remove(aStudent)
self._students.insert(index, aStudent)
wasAdded = True
return wasAdded
def addOrMoveStudentAt(self, aStudent, index):
wasAdded = False
if (aStudent) in self._students :
if index < 0 :
index = 0
if index > self.numberOfStudents() :
index = self.numberOfStudents() - 1
self._students.remove(aStudent)
self._students.insert(index, aStudent)
wasAdded = True
else :
wasAdded = self.addStudentAt(aStudent, index)
return wasAdded
def delete(self):
i = len(self._students)
while i > 0 :
aStudent = self._students[i - 1]
aStudent.delete()
i -= 1
super().delete()
def __str__(self):
return str(super().__str__()) + "[" + "position" + ":" + str(self.getPosition()) + "]"
def addStudent(self, *argv):
from Student import Student
if len(argv) == 3 and isinstance(argv[0], str) and isinstance(argv[1], int) and isinstance(argv[2], int) :
return self.addStudent1(argv[0], argv[1], argv[2])
if len(argv) == 1 and isinstance(argv[0], Student) :
return self.addStudent2(argv[0])
raise TypeError("No method matches provided parameters")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "ClassTemplateTest_ImmutableNotLazyAttributeConstructor.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#Student Attributes
#Helper Variables
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aNumber):
self._canSetNumber2 = None
self._number2 = None
self._number = None
self._number = aNumber
self._canSetNumber2 = True
#------------------------
# INTERFACE
#------------------------
# Code from template attribute_SetImmutable
def setNumber2(self, aNumber2):
wasSet = False
if not self._canSetNumber2 :
return False
self._canSetNumber2 = False
self._number2 = aNumber2
wasSet = True
return wasSet
def getNumber(self):
return self._number
def getNumber2(self):
return self._number2
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "number" + ":" + str(self.getNumber()) + "," + "number2" + ":" + str(self.getNumber2()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "ClassTemplateTest_AttributeComments.ump"
class Student():
a = ""
#------------------------
# STATIC VARIABLES
#------------------------
#*
# * Comment for a const attribute
#
#------------------------
# MEMBER VARIABLES
#------------------------
#Student Attributes
#*
# * Comment for an internal attribute
#
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aB):
self._b = None
self._b = aB
#------------------------
# INTERFACE
#------------------------
#*
# * Comment for a derived attribute
#
def getC(self):
return 1 + 1
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "c" + ":" + str(self.getC()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
#*
# * This is a student
# * Multiple comments
# * on several lines
#
# line 6 "../ClassTemplateTest_MultiLineComment.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "AssociationInlineComment.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#Foo Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._bars = None
self._bars = []
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetMany
def getBar(self, index):
aBar = self._bars[index]
return aBar
#*
# * I am a inline comment above an association.
#
def getBars(self):
newBars = tuple(self._bars)
return newBars
def numberOfBars(self):
number = len(self._bars)
return number
def hasBars(self):
has = len(self._bars) > 0
return has
def indexOfBar(self, aBar):
index = (-1 if not aBar in self._bars else self._bars.index(aBar))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfBars():
return 0
# Code from template association_AddManyToOne
def addBar1(self):
from Bar import Bar
return Bar(self)
def addBar2(self, aBar):
wasAdded = False
if (aBar) in self._bars :
return False
existingFoo = aBar.getFoo()
isNewFoo = not (existingFoo is None) and not self == existingFoo
if isNewFoo :
aBar.setFoo(self)
else :
self._bars.append(aBar)
wasAdded = True
return wasAdded
def removeBar(self, aBar):
wasRemoved = False
#Unable to remove aBar, as it must always have a foo
if not self == aBar.getFoo() :
self._bars.remove(aBar)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addBarAt(self, aBar, index):
wasAdded = False
if self.addBar(aBar) :
if index < 0 :
index = 0
if index > self.numberOfBars() :
index = self.numberOfBars() - 1
self._bars.remove(aBar)
self._bars.insert(index, aBar)
wasAdded = True
return wasAdded
def addOrMoveBarAt(self, aBar, index):
wasAdded = False
if (aBar) in self._bars :
if index < 0 :
index = 0
if index > self.numberOfBars() :
index = self.numberOfBars() - 1
self._bars.remove(aBar)
self._bars.insert(index, aBar)
wasAdded = True
else :
wasAdded = self.addBarAt(aBar, index)
return wasAdded
def delete(self):
i = len(self._bars)
while i > 0 :
aBar = self._bars[i - 1]
aBar.delete()
i -= 1
def addBar(self, *argv):
from Bar import Bar
if len(argv) == 0 :
return self.addBar1()
if len(argv) == 1 and isinstance(argv[0], Bar) :
return self.addBar2(argv[0])
raise TypeError("No method matches provided parameters")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
#*
# * This is a student
#
# line 5 "../ClassTemplateTest_GarbageComment.ump"
class Student():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MultipleMethodComments.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#*
# * Inline comment above method.
#
# line 6 "MultipleMethodComments.ump"
def testMethod1(self):
// I am a comment inside a method.
#*
# * Multiple inline comments
# * above method.
#
# line 13 "MultipleMethodComments.ump"
def testMethod2(self):
// I am a comment inside a method.
#*
# * Multiline comment above method.
#
# line 19 "MultipleMethodComments.ump"
def testMethod3(self):
// I am a comment inside a method.
#*
# * Multiple multiline comments
# * above method.
#
# line 28 "MultipleMethodComments.ump"
def testMethod4(self):
// I am a comment inside a method.
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MultipleAssociationComments.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#Foo Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._bar4s = None
self._bar3s = None
self._bar2s = None
self._bar1s = None
self._bar1s = []
self._bar2s = []
self._bar3s = []
self._bar4s = []
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetMany
def getBar1(self, index):
aBar1 = self._bar1s[index]
return aBar1
#*
# * Inline comment above association.
#
def getBar1s(self):
newBar1s = tuple(self._bar1s)
return newBar1s
def numberOfBar1s(self):
number = len(self._bar1s)
return number
def hasBar1s(self):
has = len(self._bar1s) > 0
return has
def indexOfBar1(self, aBar1):
index = (-1 if not aBar1 in self._bar1s else self._bar1s.index(aBar1))
return index
# Code from template association_GetMany
def getBar2(self, index):
aBar2 = self._bar2s[index]
return aBar2
#*
# * Multiple inline comments
# * above association.
#
def getBar2s(self):
newBar2s = tuple(self._bar2s)
return newBar2s
def numberOfBar2s(self):
number = len(self._bar2s)
return number
def hasBar2s(self):
has = len(self._bar2s) > 0
return has
def indexOfBar2(self, aBar2):
index = (-1 if not aBar2 in self._bar2s else self._bar2s.index(aBar2))
return index
# Code from template association_GetMany
def getBar3(self, index):
aBar3 = self._bar3s[index]
return aBar3
#*
# * Multiline comment above association.
#
def getBar3s(self):
newBar3s = tuple(self._bar3s)
return newBar3s
def numberOfBar3s(self):
number = len(self._bar3s)
return number
def hasBar3s(self):
has = len(self._bar3s) > 0
return has
def indexOfBar3(self, aBar3):
index = (-1 if not aBar3 in self._bar3s else self._bar3s.index(aBar3))
return index
# Code from template association_GetMany
def getBar4(self, index):
aBar4 = self._bar4s[index]
return aBar4
#*
# * Multiple multiline comments
# * above association.
#
def getBar4s(self):
newBar4s = tuple(self._bar4s)
return newBar4s
def numberOfBar4s(self):
number = len(self._bar4s)
return number
def hasBar4s(self):
has = len(self._bar4s) > 0
return has
def indexOfBar4(self, aBar4):
index = (-1 if not aBar4 in self._bar4s else self._bar4s.index(aBar4))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfBar1s():
return 0
# Code from template association_AddManyToOne
def addBar5(self):
from Bar1 import Bar1
return Bar1(self)
def addBar6(self, aBar1):
wasAdded = False
if (aBar1) in self._bar1s :
return False
existingFoo = aBar1.getFoo()
isNewFoo = not (existingFoo is None) and not self == existingFoo
if isNewFoo :
aBar1.setFoo(self)
else :
self._bar1s.append(aBar1)
wasAdded = True
return wasAdded
def removeBar1(self, aBar1):
wasRemoved = False
#Unable to remove aBar1, as it must always have a foo
if not self == aBar1.getFoo() :
self._bar1s.remove(aBar1)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addBar1At(self, aBar1, index):
wasAdded = False
if self.addBar1(aBar1) :
if index < 0 :
index = 0
if index > self.numberOfBar1s() :
index = self.numberOfBar1s() - 1
self._bar1s.remove(aBar1)
self._bar1s.insert(index, aBar1)
wasAdded = True
return wasAdded
def addOrMoveBar1At(self, aBar1, index):
wasAdded = False
if (aBar1) in self._bar1s :
if index < 0 :
index = 0
if index > self.numberOfBar1s() :
index = self.numberOfBar1s() - 1
self._bar1s.remove(aBar1)
self._bar1s.insert(index, aBar1)
wasAdded = True
else :
wasAdded = self.addBar1At(aBar1, index)
return wasAdded
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfBar2s():
return 0
# Code from template association_AddManyToOne
def addBar7(self):
from Bar2 import Bar2
return Bar2(self)
def addBar8(self, aBar2):
wasAdded = False
if (aBar2) in self._bar2s :
return False
existingFoo = aBar2.getFoo()
isNewFoo = not (existingFoo is None) and not self == existingFoo
if isNewFoo :
aBar2.setFoo(self)
else :
self._bar2s.append(aBar2)
wasAdded = True
return wasAdded
def removeBar2(self, aBar2):
wasRemoved = False
#Unable to remove aBar2, as it must always have a foo
if not self == aBar2.getFoo() :
self._bar2s.remove(aBar2)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addBar2At(self, aBar2, index):
wasAdded = False
if self.addBar2(aBar2) :
if index < 0 :
index = 0
if index > self.numberOfBar2s() :
index = self.numberOfBar2s() - 1
self._bar2s.remove(aBar2)
self._bar2s.insert(index, aBar2)
wasAdded = True
return wasAdded
def addOrMoveBar2At(self, aBar2, index):
wasAdded = False
if (aBar2) in self._bar2s :
if index < 0 :
index = 0
if index > self.numberOfBar2s() :
index = self.numberOfBar2s() - 1
self._bar2s.remove(aBar2)
self._bar2s.insert(index, aBar2)
wasAdded = True
else :
wasAdded = self.addBar2At(aBar2, index)
return wasAdded
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfBar3s():
return 0
# Code from template association_AddManyToOne
def addBar9(self):
from Bar3 import Bar3
return Bar3(self)
def addBar10(self, aBar3):
wasAdded = False
if (aBar3) in self._bar3s :
return False
existingFoo = aBar3.getFoo()
isNewFoo = not (existingFoo is None) and not self == existingFoo
if isNewFoo :
aBar3.setFoo(self)
else :
self._bar3s.append(aBar3)
wasAdded = True
return wasAdded
def removeBar3(self, aBar3):
wasRemoved = False
#Unable to remove aBar3, as it must always have a foo
if not self == aBar3.getFoo() :
self._bar3s.remove(aBar3)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addBar3At(self, aBar3, index):
wasAdded = False
if self.addBar3(aBar3) :
if index < 0 :
index = 0
if index > self.numberOfBar3s() :
index = self.numberOfBar3s() - 1
self._bar3s.remove(aBar3)
self._bar3s.insert(index, aBar3)
wasAdded = True
return wasAdded
def addOrMoveBar3At(self, aBar3, index):
wasAdded = False
if (aBar3) in self._bar3s :
if index < 0 :
index = 0
if index > self.numberOfBar3s() :
index = self.numberOfBar3s() - 1
self._bar3s.remove(aBar3)
self._bar3s.insert(index, aBar3)
wasAdded = True
else :
wasAdded = self.addBar3At(aBar3, index)
return wasAdded
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfBar4s():
return 0
# Code from template association_AddManyToOne
def addBar11(self):
from Bar4 import Bar4
return Bar4(self)
def addBar12(self, aBar4):
wasAdded = False
if (aBar4) in self._bar4s :
return False
existingFoo = aBar4.getFoo()
isNewFoo = not (existingFoo is None) and not self == existingFoo
if isNewFoo :
aBar4.setFoo(self)
else :
self._bar4s.append(aBar4)
wasAdded = True
return wasAdded
def removeBar4(self, aBar4):
wasRemoved = False
#Unable to remove aBar4, as it must always have a foo
if not self == aBar4.getFoo() :
self._bar4s.remove(aBar4)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addBar4At(self, aBar4, index):
wasAdded = False
if self.addBar4(aBar4) :
if index < 0 :
index = 0
if index > self.numberOfBar4s() :
index = self.numberOfBar4s() - 1
self._bar4s.remove(aBar4)
self._bar4s.insert(index, aBar4)
wasAdded = True
return wasAdded
def addOrMoveBar4At(self, aBar4, index):
wasAdded = False
if (aBar4) in self._bar4s :
if index < 0 :
index = 0
if index > self.numberOfBar4s() :
index = self.numberOfBar4s() - 1
self._bar4s.remove(aBar4)
self._bar4s.insert(index, aBar4)
wasAdded = True
else :
wasAdded = self.addBar4At(aBar4, index)
return wasAdded
def delete(self):
i = len(self._bar1s)
while i > 0 :
aBar1 = self._bar1s[i - 1]
aBar1.delete()
i -= 1
i = len(self._bar2s)
while i > 0 :
aBar2 = self._bar2s[i - 1]
aBar2.delete()
i -= 1
i = len(self._bar3s)
while i > 0 :
aBar3 = self._bar3s[i - 1]
aBar3.delete()
i -= 1
i = len(self._bar4s)
while i > 0 :
aBar4 = self._bar4s[i - 1]
aBar4.delete()
i -= 1
def addBar1(self, *argv):
from Bar1 import Bar1
if len(argv) == 0 :
return self.addBar5()
if len(argv) == 1 and isinstance(argv[0], Bar1) :
return self.addBar6(argv[0])
raise TypeError("No method matches provided parameters")
def addBar2(self, *argv):
from Bar2 import Bar2
if len(argv) == 0 :
return self.addBar7()
if len(argv) == 1 and isinstance(argv[0], Bar2) :
return self.addBar8(argv[0])
raise TypeError("No method matches provided parameters")
def addBar3(self, *argv):
from Bar3 import Bar3
if len(argv) == 0 :
return self.addBar9()
if len(argv) == 1 and isinstance(argv[0], Bar3) :
return self.addBar10(argv[0])
raise TypeError("No method matches provided parameters")
def addBar4(self, *argv):
from Bar4 import Bar4
if len(argv) == 0 :
return self.addBar11()
if len(argv) == 1 and isinstance(argv[0], Bar4) :
return self.addBar12(argv[0])
raise TypeError("No method matches provided parameters")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MethodInlineComment.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#*
# * I am a comment above a method.
#
# line 6 "MethodInlineComment.ump"
def testMethod(self):
// I am a comment inside a method.
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "ClassTemplateTest_AbstractClassAvoidingInstantiation2.ump"
class Teacher():
#------------------------
# MEMBER VARIABLES
#------------------------
#Teacher Associations
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
self._myFooss = None
self._myFooss = []
#------------------------
# INTERFACE
#------------------------
# Code from template association_GetMany
def getMyFooss1(self, index):
aMyFooss = self._myFooss[index]
return aMyFooss
def getMyFooss2(self):
newMyFooss = tuple(self._myFooss)
return newMyFooss
def numberOfMyFooss(self):
number = len(self._myFooss)
return number
def hasMyFooss(self):
has = len(self._myFooss) > 0
return has
def indexOfMyFooss(self, aMyFooss):
index = (-1 if not aMyFooss in self._myFooss else self._myFooss.index(aMyFooss))
return index
# Code from template association_MinimumNumberOfMethod
@staticmethod
def minimumNumberOfMyFooss():
return 0
# Code from template association_MaximumNumberOfMethod
@staticmethod
def maximumNumberOfMyFooss():
return 2
# Code from template association_AddOptionalNToOne
def addMyFooss(self, aMyFooss):
wasAdded = False
if (aMyFooss) in self._myFooss :
return False
if self.numberOfMyFooss() >= Teacher.maximumNumberOfMyFooss() :
return wasAdded
existingTeacher = aMyFooss.getTeacher()
isNewTeacher = not (existingTeacher is None) and not self == existingTeacher
if isNewTeacher :
aMyFooss.setTeacher(self)
else :
self._myFooss.append(aMyFooss)
wasAdded = True
return wasAdded
def removeMyFooss(self, aMyFooss):
wasRemoved = False
#Unable to remove aMyFooss, as it must always have a teacher
if not self == aMyFooss.getTeacher() :
self._myFooss.remove(aMyFooss)
wasRemoved = True
return wasRemoved
# Code from template association_AddIndexControlFunctions
def addMyFoossAt(self, aMyFooss, index):
wasAdded = False
if self.addMyFooss(aMyFooss) :
if index < 0 :
index = 0
if index > self.numberOfMyFooss() :
index = self.numberOfMyFooss() - 1
self._myFooss.remove(aMyFooss)
self._myFooss.insert(index, aMyFooss)
wasAdded = True
return wasAdded
def addOrMoveMyFoossAt(self, aMyFooss, index):
wasAdded = False
if (aMyFooss) in self._myFooss :
if index < 0 :
index = 0
if index > self.numberOfMyFooss() :
index = self.numberOfMyFooss() - 1
self._myFooss.remove(aMyFooss)
self._myFooss.insert(index, aMyFooss)
wasAdded = True
else :
wasAdded = self.addMyFoossAt(aMyFooss, index)
return wasAdded
def delete(self):
i = len(self._myFooss)
while i > 0 :
aMyFooss = self._myFooss[i - 1]
aMyFooss.delete()
i -= 1
def getMyFooss(self, *argv):
if len(argv) == 1 and isinstance(argv[0], int) :
return self.getMyFooss1(argv[0])
if len(argv) == 0 :
return self.getMyFooss2()
raise TypeError("No method matches provided parameters")
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "MethodMultilineComment.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass
#*
# * I am a comment above a method.
#
# line 8 "MethodMultilineComment.ump"
def testMethod(self):
// I am a comment inside a method.
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 1 "AttributeInlineComment.ump"
class Foo():
#------------------------
# MEMBER VARIABLES
#------------------------
#Foo Attributes
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self, aBar):
self._bar = None
self._bar = aBar
#------------------------
# INTERFACE
#------------------------
def setBar(self, aBar):
wasSet = False
self._bar = aBar
wasSet = True
return wasSet
#*
# * I am a inline comment above an attribute.
#
def getBar(self):
return self._bar
def delete(self):
pass
def __str__(self):
return str(super().__str__()) + "[" + "bar" + ":" + str(self.getBar()) + "]"
#PLEASE DO NOT EDIT THIS CODE
#This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language!
# line 3 "../ClassTemplateTest_Depend.ump"
class Mentor():
#------------------------
# MEMBER VARIABLES
#------------------------
#------------------------
# CONSTRUCTOR
#------------------------
def __init__(self):
pass
#------------------------
# INTERFACE
#------------------------
def delete(self):
pass