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

comments populated in BatchReassembly

parent 2b18a52c
...@@ -77,7 +77,9 @@ class BatchReassembly(CoreObject): ...@@ -77,7 +77,9 @@ class BatchReassembly(CoreObject):
CoreObject.initialize(self) # using the default CoreObject Functionality CoreObject.initialize(self) # using the default CoreObject Functionality
self.Res=Resource(self.numberOfSubBatches) # initialize the Internal resource (Queue) functionality self.Res=Resource(self.numberOfSubBatches) # initialize the Internal resource (Queue) functionality
# =======================================================================
# the main method of the object
# =======================================================================
def run(self): def run(self):
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
...@@ -97,7 +99,9 @@ class BatchReassembly(CoreObject): ...@@ -97,7 +99,9 @@ class BatchReassembly(CoreObject):
yield hold,self,self.calculateProcessingTime() yield hold,self,self.calculateProcessingTime()
self.reassemble() self.reassemble()
# =======================================================================
# reassemble method that assembles the subBatches back together to a Batch
# =======================================================================
def reassemble(self): def reassemble(self):
activeObject = self.getActiveObject() activeObject = self.getActiveObject()
activeObjectQueue=activeObject.getActiveObjectQueue() # get the internal queue of the active core object activeObjectQueue=activeObject.getActiveObjectQueue() # get the internal queue of the active core object
...@@ -123,6 +127,11 @@ class BatchReassembly(CoreObject): ...@@ -123,6 +127,11 @@ class BatchReassembly(CoreObject):
batchToBeReassembled.currentStation=self batchToBeReassembled.currentStation=self
self.timeLastEntityEnded=now() self.timeLastEntityEnded=now()
# =======================================================================
# returns True if the object doensn't hold entities of type Batch
# and if the subBatches in the its internal queue and the one of the giver
# hold subBatches of the same batchId
# =======================================================================
def canAccept(self,callerObject=None): def canAccept(self,callerObject=None):
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
...@@ -148,8 +157,9 @@ class BatchReassembly(CoreObject): ...@@ -148,8 +157,9 @@ class BatchReassembly(CoreObject):
and activeObjectQueue[0].type != 'Batch'\ and activeObjectQueue[0].type != 'Batch'\
and giverObjectQueue[0].batchId==activeObjectQueue[0].batchId and giverObjectQueue[0].batchId==activeObjectQueue[0].batchId
# =======================================================================
# returns True if it holds an entity of type Batch
# =======================================================================
def haveToDispose(self,callerObject=None): def haveToDispose(self,callerObject=None):
# get active and the receiver object # get active and the receiver object
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
...@@ -178,7 +188,11 @@ class BatchReassembly(CoreObject): ...@@ -178,7 +188,11 @@ class BatchReassembly(CoreObject):
and (thecaller is receiverObject)\ and (thecaller is receiverObject)\
and 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
# =======================================================================
# returns true if the giver has an entity to dispose
# which is of the same batchId as the ones that the assembler currently holds
# (if it holds any), and if doesn't hold any entities of type Batch
# =======================================================================
def canAcceptAndIsRequested(self): def canAcceptAndIsRequested(self):
# get the active and the giver objects # get the active and the giver objects
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
......
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