#PLEASE DO NOT EDIT THIS CODE #This code was generated using the UMPLE 1.35.0.7523.c616a4dce modeling language! # line 4 "../ClassTemplateTest_AbstractClass.ump" from abc import ABC, abstractmethod class Student(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! # 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 2 "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 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 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 Time import Time from 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.remove(anOldId) 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 Date import Date return Date.valueOf("1978-12-26") def getW(self): return self._w # Code from template attribute_GetDefaulted def getDefaultW(self): from 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.remove(self.getId()) 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! #* # * 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! #* # * 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 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! #* # * 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 "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