Commit ab0b09c2 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Georgios Dagkakis

isInRoute made an CoreObject method that controls whether an activeObject is...

isInRoute made an CoreObject method that controls whether an activeObject is successor to a callerObject
parent f24eb2f1
......@@ -696,6 +696,20 @@ class CoreObject(ManPyObject):
def canAccept(self, callerObject=None):
pass
#===========================================================================
# method used to check whether the station is a successor of the caller
#===========================================================================
def isInRoute(self, callerObject=None):
thecaller=callerObject
# if the caller is not defined then return True. We are only interested in checking whether
# the station can accept whatever entity from whichever giver
if not thecaller:
return True
#check it the caller object is predecessor to the activeObject
if thecaller in self.previous:
return True
return False
# =======================================================================
# sorts the Entities in the activeQ of the objects
# =======================================================================
......
......@@ -966,11 +966,7 @@ class Machine(CoreObject):
if self.isLocked:
return False
activeObjectQueue=self.Res.users
# local flag that is set only if there is no callerObject or if thecaller is predecessor of the activeObject
theCallerIsPredecessor=False
thecaller=callerObject
if callerObject==None or thecaller in self.previous:
theCallerIsPredecessor=True
# return True ONLY if the length of the activeOjbectQue is smaller than
# the object capacity, and the callerObject is not None but the giverObject
if (self.operatorPool!='None' and (any(type=='Load' for type in self.multOperationTypeList)\
......@@ -978,14 +974,14 @@ class Machine(CoreObject):
return self.operatorPool.checkIfResourceIsAvailable()\
and self.checkIfMachineIsUp()\
and len(activeObjectQueue)<self.capacity\
and theCallerIsPredecessor\
and self.isInRoute(thecaller)\
and not self.entryIsAssignedTo()
else:
# the operator doesn't have to be present for the loading of the machine as the load operation
# is not assigned to operators
return self.checkIfMachineIsUp()\
and len(activeObjectQueue)<self.capacity\
and theCallerIsPredecessor\
and self.isInRoute(thecaller)\
and not self.entryIsAssignedTo()
# =======================================================================
......
......@@ -152,7 +152,7 @@ class Queue(CoreObject):
if(callerObject==None):
return len(activeObjectQueue)<self.capacity
thecaller=callerObject
return len(activeObjectQueue)<self.capacity and (thecaller in self.previous)
return len(activeObjectQueue)<self.capacity and (self.isInRoute(thecaller))
# =======================================================================
# checks if the Queue can dispose an entity to the following object
......
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