naming conventions changed, minor clean-up

parent 7096353c
......@@ -160,7 +160,7 @@ class ConditionalBuffer(QueueManagedJob):
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def canEntityProceed(self, entity=None):
def canDeliver(self, entity=None):
activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity
......@@ -175,7 +175,7 @@ class ConditionalBuffer(QueueManagedJob):
mayProceed=False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]:
activeEntity.canProceed=True
activeEntity.proceed=True
activeEntity.candidateReceivers.append(nextObject)
mayProceed=True
return mayProceed
\ No newline at end of file
......@@ -64,7 +64,7 @@ class Entity(object):
self.family='Entity'
# variables to be used by OperatorRouter
self.canProceed=False # boolean that is used to check weather the entity can proceed to the candidateReceiver
self.proceed=False # boolean that is used to check weather the entity can proceed to the candidateReceiver
self.candidateReceivers=[] # list of candidateReceivers of the entity (those stations that can receive the entity
self.candidateReceiver=None # the station that is finaly chosen to receive the entity
......@@ -72,6 +72,13 @@ class Entity(object):
self.receiver=None
self.timeOfAssignement=0
#===========================================================================
# check if the entity can proceed to an operated machine, for use by Router
#===========================================================================
def canProceed(self):
activeObject=self.currentStation
return activeObject.canDeliver(self)
#===========================================================================
# method that finds a receiver for a candidate entity
#===========================================================================
......
......@@ -765,7 +765,7 @@ class Machine(CoreObject):
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def canEntityProceed(self, entity=None):
def canDeliver(self, entity=None):
activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity
......@@ -774,7 +774,7 @@ class Machine(CoreObject):
router = G.Router
# if the entity is in a machines who's broker waits for operator then
if activeObject in router.pendingMachines:
activeEntity.canProceed=True
activeEntity.proceed=True
activeEntity.candidateReceivers.append(activeObject)
return True
return False
......
......@@ -184,7 +184,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def canEntityProceed(self, entity=None):
def canDeliver(self, entity=None):
activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity
......@@ -195,7 +195,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
mayProceed=False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]:
activeEntity.canProceed=True
activeEntity.proceed=True
activeEntity.candidateReceivers.append(nextObject)
mayProceed=True
return mayProceed
......@@ -235,7 +235,7 @@ class Router(ObjectInterruption):
operator.candidateStation=None
operator.candidateEntity=None
for entity in G.pendingEntities:
entity.canProceed=False
entity.proceed=False
entity.candidateReceivers=[]
entity.candidateReceiver=None
del self.candidateOperators[:]
......@@ -424,8 +424,7 @@ class Router(ObjectInterruption):
# if the entity is ready to move to a machine and its manager is available
if entity.manager.checkIfResourceIsAvailable():
# check whether the entity canProceed and update the its candidateReceivers
# if entity.canEntityProceed()\
if entity.currentStation.canEntityProceed(entity)\
if entity.canProceed()\
and not entity.manager in self.candidateOperators:
self.candidateOperators.append(entity.manager)
# TODO: check if preemption can be implemented for the managed case
......
......@@ -201,7 +201,7 @@ class Queue(CoreObject):
#===========================================================================
# checks whether the entity can proceed to a successor object
#===========================================================================
def canEntityProceed(self, entity=None):
def canDeliver(self, entity=None):
activeObject=self.getActiveObject()
assert activeObject.isInActiveQueue(entity), entity.id +' not in the internalQueue of'+ activeObject.id
activeEntity=entity
......@@ -209,7 +209,7 @@ class Queue(CoreObject):
mayProceed=False
# for all the possible receivers of an entity check whether they can accept and then set accordingly the canProceed flag of the entity
for nextObject in [object for object in activeObject.next if object.canAcceptEntity(activeEntity)]:
activeEntity.canProceed=True
activeEntity.proceed=True
activeEntity.candidateReceivers.append(nextObject)
mayProceed=True
return mayProceed
......
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