Commit 58b140dd authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

getEntity method clean-up, self.internal variable added to Entity

parent f931bd37
...@@ -120,11 +120,10 @@ class CoreObject(Process): ...@@ -120,11 +120,10 @@ class CoreObject(Process):
#(after the sorting of the entities in the queue of the giver object) #(after the sorting of the entities in the queue of the giver object)
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
activeEntity=giverObjectQueue[0] # remove entity from the giver
activeEntity = giverObject.removeEntity()
#get the entity from the previous object and put it in front of the activeQ #get the entity from the previous object and put it in front of the activeQ
activeObjectQueue.append(activeEntity) activeObjectQueue.append(activeEntity)
#remove the entity from the previous object
giverObject.removeEntity()
# if the giverObject is blocked then unBlock it # if the giverObject is blocked then unBlock it
if giverObject.exitIsAssigned(): if giverObject.exitIsAssigned():
giverObject.unAssignExit() giverObject.unAssignExit()
...@@ -204,7 +203,7 @@ class CoreObject(Process): ...@@ -204,7 +203,7 @@ class CoreObject(Process):
# =================== get the giver object in a getEntity transaction. ========================= # =================== get the giver object in a getEntity transaction. =========================
def getGiverObject(self): def getGiverObject(self):
return self.giver return self.giver.getActiveObject()
# ============== get the giver object queue in a getEntity transaction. ======================== # ============== get the giver object queue in a getEntity transaction. ========================
...@@ -213,13 +212,13 @@ class CoreObject(Process): ...@@ -213,13 +212,13 @@ class CoreObject(Process):
# ============== get the receiver object in a removeEntity transaction. ======================= # ============== get the receiver object in a removeEntity transaction. =======================
def getReceiverObject(self): def getReceiverObject(self):
return self.receiver return self.receiver.getActiveObject()
# ========== get the receiver object queue in a removeEntity transaction. ====================== # ========== get the receiver object queue in a removeEntity transaction. ======================
def getReceiverObjectQueue(self): def getReceiverObjectQueue(self):
return self.getReceiverObject().getActiveObjectQueue() return self.getReceiverObject().getActiveObjectQueue()
# ============== get the giver object queue in a getEntity transaction. ======================== # ============== get the giver object queue in a getEntity transaction. ========================
def updateGiverObject(self): def updateGiverObject(self):
activeObject=self activeObject=self
# dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject) # dummy variables that help prioritize the objects requesting to give objects to the Machine (activeObject)
...@@ -254,6 +253,7 @@ class CoreObject(Process): ...@@ -254,6 +253,7 @@ class CoreObject(Process):
maxTimeWaiting=timeWaiting maxTimeWaiting=timeWaiting
receiver=object # set the receiver as the longest waiting possible receiver receiver=object # set the receiver as the longest waiting possible receiver
return receiver return receiver
# ======================================================================= # =======================================================================
# calculates the processing time # calculates the processing time
# ======================================================================= # =======================================================================
......
...@@ -48,7 +48,9 @@ class Entity(object): ...@@ -48,7 +48,9 @@ class Entity(object):
# a list that holds information about the schedule # a list that holds information about the schedule
# of the entity (when it enters and exits every station) # of the entity (when it enters and exits every station)
self.schedule=[] self.schedule=[]
self.currentStation=None self.currentStation=None
# values to be used in the internal processing of compoundObjects
self.internal = False # informs if the entity is being processed internally
# =============== outputs results to JSON File ========================== # =============== outputs results to JSON File ==========================
def outputResultsJSON(self): def outputResultsJSON(self):
......
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