Commit 65c71d9d authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Sebastien Robin

canAccept method of BatchReassembly corrected

parent 28be9826
...@@ -123,21 +123,25 @@ class BatchReassembly(CoreObject): ...@@ -123,21 +123,25 @@ class BatchReassembly(CoreObject):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
giverObject=self.getGiverObject() giverObject=self.getGiverObject()
giverObjectQueue = giverObject.getGiverObjectQueue() giverObjectQueue = self.getGiverObjectQueue()
if(len(activeObject.previous)==1 or callerObject==None): if(len(activeObject.previous)==1 or callerObject==None):
if len(activeObjectQueue)==0: if len(activeObjectQueue)==0:
return activeObject.Up return activeObject.Up
else: else:
return activeObject.Up and activeObjectQueue[0].type!='Batch'\ return activeObject.Up\
and activeObjectQueue[0].type!='Batch'\
and len(activeObjectQueue)<self.numberOfSubBatches\ and len(activeObjectQueue)<self.numberOfSubBatches\
and giverObjectQueue[0].batchId==activeObjectQueue[0].batchId and giverObjectQueue[0].batchId==activeObjectQueue[0].batchId
thecaller=callerObject thecaller=callerObject
# return True ONLY if the length of the activeOjbectQueue is smaller than # return True ONLY if the length of the activeOjbectQueue is smaller than
# the object capacity, and the callerObject is not None but the giverObject # the object capacity, and the callerObject is not None but the giverObject
return len(activeObjectQueue)<self.numberOfSubBatches and activeObjectQueue[0].type != 'Batch'\ return len(activeObjectQueue)<self.numberOfSubBatches\
and giverObjectQueue[0].batchId==activeObjectQueue[0].batchId and (thecaller is giverObject) and (thecaller is giverObject)\
and activeObjectQueue[0].type != 'Batch'\
and giverObjectQueue[0].batchId==activeObjectQueue[0].batchId
def haveToDispose(self,callerObject=None): def haveToDispose(self,callerObject=None):
...@@ -148,8 +152,8 @@ class BatchReassembly(CoreObject): ...@@ -148,8 +152,8 @@ class BatchReassembly(CoreObject):
#if we have only one successor just check if object waits to dispose and also is up #if we have only one successor just check if object waits to dispose and also is up
# this is done to achieve better (cpu) processing time # this is done to achieve better (cpu) processing time
if(len(activeObject.next)==1 or callerObject==None): if(len(activeObject.next)==1 or callerObject==None):
return len(activeObjectQueue)==1 and \ return len(activeObjectQueue)==1\
activeObjectQueue[0].type=="Batch" # the control of the length of the queue is not needed and activeObjectQueue[0].type=="Batch" # the control of the length of the queue is not needed
thecaller=callerObject thecaller=callerObject
#give the entity to the successor that is waiting for the most time. #give the entity to the successor that is waiting for the most time.
...@@ -166,8 +170,9 @@ class BatchReassembly(CoreObject): ...@@ -166,8 +170,9 @@ class BatchReassembly(CoreObject):
#return true only to the predecessor from which the queue will take #return true only to the predecessor from which the queue will take
receiverObject=activeObject.getReceiverObject() receiverObject=activeObject.getReceiverObject()
return len(self.Res.activeQ)==1 and \ return len(self.Res.activeQ)==1\
(thecaller is receiverObject) and activeObjectQueue[0].type!="Batch" # the control of the length of the queue is not needed and (thecaller is receiverObject)\
and activeObjectQueue[0].type!="Batch" # the control of the length of the queue is not needed
def canAcceptAndIsRequested(self): def canAcceptAndIsRequested(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