Commit 5884aa88 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

defineRouting arguments made explicit so that the user can define them in...

defineRouting arguments made explicit so that the user can define them in different sequence if wanted. Applied also to the first example of the documentation
parent 92e4115f
No preview for this file type
......@@ -66,9 +66,9 @@ class CoreObject(Process):
raise NotImplementedError("Subclass must define 'run' method")
#sets the routing in and out elements for the Object
def defineRouting(self, p, n):
self.next=n
self.previous=p
def defineRouting(self, predecessorList=[], successorList=[]):
self.next=successorList
self.previous=predecessorList
#removes an entity from the Object
def removeEntity(self):
......
......@@ -13,9 +13,9 @@ E=Exit('E1','Exit')
G.ObjList=[S,M,E] #add all the objects in G.ObjList so that they can be easier accessed later
#define predecessors and successors for the objects
S.defineRouting([M])
M.defineRouting([S],[E])
E.defineRouting([M])
S.defineRouting(successorList=[M])
M.defineRouting(predecessorList=[S],successorList=[E])
E.defineRouting(predecessorList=[M])
initialize() #initialize the simulation (SimPy method)
......
......@@ -93,8 +93,8 @@ class Exit(CoreObject):
self.timeLastEntityLeft=now() #update the time that the last entity left from the Exit
#sets the routing in element for the Exit
def defineRouting(self, p):
self.previous=p
def defineRouting(self, predecessorList=[]):
self.previous=predecessorList
#checks if the Exit can accept an entity
def canAccept(self, callerObject=None):
......
......@@ -115,8 +115,8 @@ class Source(CoreObject):
print "Distribution Error in "+str(self.objName)
#sets the routing out element for the Source
def defineRouting(self, n):
self.next=n
def defineRouting(self, successorList=[]):
self.next=successorList
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | "generated")
def outputTrace(self, message):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment