Exemple #1
0
    def haveToDispose(self, callerObject=None):
        # get active object and its queue
        activeObject=self.getActiveObject()
        activeObjectQueue=self.getActiveObjectQueue()
        thecaller=callerObject
        # update the objectSortingFor variable to hold the value of the callerObject
        activeObject.objectSortingFor=thecaller
        # TODO: when the callerObject is not defined will receive error ass the checkIfResourceIsAvailable requests a caller
        
        #search if for one or more of the Entities the operator is available        
        haveEntityWithAvailableManager=False
        for entity in activeObjectQueue:
            if entity.manager:
                if entity.manager.checkIfResourceIsAvailable(thecaller):
                    haveEntityWithAvailableManager=True
                    break
            else:
                haveEntityWithAvailableManager=True
                break
#         for entity in [x for x in activeObjectQueue if x.manager]:
#             if entity.manager.checkIfResourceIsAvailable(thecaller):
#                 haveEntityWithAvailableManager=True
#                 break
        #if none of the Entities has an available manager return False
        if not haveEntityWithAvailableManager:
            return False
        #sort the internal queue so that the Entities that have an available manager go in the front
        # the sortEntities method needs a receiver defined to sort the entities according to the availability of the manager
        #     so if there is a caller define him ass receiver and after the sorting set the receiver again to None
        activeObject.sortEntities()
        activeObject.sortEntitiesForReceiver(activeObject.objectSortingFor)
        
        # and then perform the default behaviour
        return QueueJobShop.haveToDispose(self,thecaller)
Exemple #2
0
    def haveToDispose(self, callerObject=None):
        # get active object and its queue
        activeObject = self.getActiveObject()
        activeObjectQueue = self.getActiveObjectQueue()
        thecaller = callerObject
        # update the objectSortingFor variable to hold the value of the callerObject
        activeObject.objectSortingFor = thecaller
        # TODO: when the callerObject is not defined will receive error ass the checkIfResourceIsAvailable requests a caller

        #search if for one or more of the Entities the operator is available
        haveEntityWithAvailableManager = False
        for entity in activeObjectQueue:
            if entity.manager:
                if entity.manager.checkIfResourceIsAvailable(thecaller):
                    haveEntityWithAvailableManager = True
                    break
            else:
                haveEntityWithAvailableManager = True
                break
        #if none of the Entities has an available manager return False
        if not haveEntityWithAvailableManager:
            return False
        #sort the internal queue so that the Entities that have an available manager go in the front
        # the sortEntities method needs a receiver defined to sort the entities according to the availability of the manager
        #     so if there is a caller define him ass receiver and after the sorting set the receiver again to None
        activeObject.sortEntities()
        activeObject.sortEntitiesForReceiver(activeObject.objectSortingFor)

        # and then perform the default behaviour
        return QueueJobShop.haveToDispose(self, thecaller)
Exemple #3
0
    def haveToDispose(self, callerObject=None):
        # get active object and its queue
        activeObject = self.getActiveObject()
        activeObjectQueue = self.getActiveObjectQueue()

        # and then perform the default behaviour
        if QueueJobShop.haveToDispose(self, callerObject):
            # sort the activeObjectQueue to brink the entities that can proceed to front
            activeObject.sortEntities()
            # return True if the first object of the queue can proceed
            return activeObjectQueue[0].mayProceed
        return False
 def haveToDispose(self, callerObject=None):
     # get active object and its queue
     activeObject=self.getActiveObject()
     activeObjectQueue=self.getActiveObjectQueue()
     
     # and then perform the default behaviour
     if QueueJobShop.haveToDispose(self,callerObject):
         # sort the activeObjectQueue to brink the entities that can proceed to front
         activeObject.sortEntities()
         # return True if the first object of the queue can proceed
         return activeObjectQueue[0].mayProceed
     return False