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): ...@@ -66,9 +66,9 @@ class CoreObject(Process):
raise NotImplementedError("Subclass must define 'run' method") raise NotImplementedError("Subclass must define 'run' method")
#sets the routing in and out elements for the Object #sets the routing in and out elements for the Object
def defineRouting(self, p, n): def defineRouting(self, predecessorList=[], successorList=[]):
self.next=n self.next=successorList
self.previous=p self.previous=predecessorList
#removes an entity from the Object #removes an entity from the Object
def removeEntity(self): def removeEntity(self):
......
...@@ -13,9 +13,9 @@ E=Exit('E1','Exit') ...@@ -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 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 #define predecessors and successors for the objects
S.defineRouting([M]) S.defineRouting(successorList=[M])
M.defineRouting([S],[E]) M.defineRouting(predecessorList=[S],successorList=[E])
E.defineRouting([M]) E.defineRouting(predecessorList=[M])
initialize() #initialize the simulation (SimPy method) initialize() #initialize the simulation (SimPy method)
......
...@@ -93,8 +93,8 @@ class Exit(CoreObject): ...@@ -93,8 +93,8 @@ class Exit(CoreObject):
self.timeLastEntityLeft=now() #update the time that the last entity left from the Exit self.timeLastEntityLeft=now() #update the time that the last entity left from the Exit
#sets the routing in element for the Exit #sets the routing in element for the Exit
def defineRouting(self, p): def defineRouting(self, predecessorList=[]):
self.previous=p self.previous=predecessorList
#checks if the Exit can accept an entity #checks if the Exit can accept an entity
def canAccept(self, callerObject=None): def canAccept(self, callerObject=None):
......
...@@ -115,8 +115,8 @@ class Source(CoreObject): ...@@ -115,8 +115,8 @@ class Source(CoreObject):
print "Distribution Error in "+str(self.objName) print "Distribution Error in "+str(self.objName)
#sets the routing out element for the Source #sets the routing out element for the Source
def defineRouting(self, n): def defineRouting(self, successorList=[]):
self.next=n self.next=successorList
#outputs message to the trace.xls. Format is (Simulation Time | Entity Name | "generated") #outputs message to the trace.xls. Format is (Simulation Time | Entity Name | "generated")
def outputTrace(self, message): 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