inline comments - OperatorRouter

parent 2d5a2f91
...@@ -89,8 +89,12 @@ class Router(ObjectInterruption): ...@@ -89,8 +89,12 @@ class Router(ObjectInterruption):
# for all the called operators find those available # for all the called operators find those available
# sort the objects for each one of them # sort the objects for each one of them
# and assign the operator to those with the highest priority # and assign the operator to those with the highest priority
# for all the operators that are requested
for operator in self.calledOperators: for operator in self.calledOperators:
priorityObject=None priorityObject=None
# check if they are available
if operator.checkIfResourceIsAvailable(): if operator.checkIfResourceIsAvailable():
#=========================================================== #===========================================================
# # TESTING # # TESTING
...@@ -98,6 +102,8 @@ class Router(ObjectInterruption): ...@@ -98,6 +102,8 @@ class Router(ObjectInterruption):
# for caller in operator.activeCallersList: # for caller in operator.activeCallersList:
# print ' ', caller.id # print ' ', caller.id
#=========================================================== #===========================================================
# sort the activeCallersList of the operator
operator.sortEntities() operator.sortEntities()
#=========================================================== #===========================================================
# # TESTING # # TESTING
...@@ -105,17 +111,24 @@ class Router(ObjectInterruption): ...@@ -105,17 +111,24 @@ class Router(ObjectInterruption):
# for caller in operator.activeCallersList: # for caller in operator.activeCallersList:
# print ' ', caller.id # print ' ', caller.id
#=========================================================== #===========================================================
# find the activeCaller that has priority
priorityObject=next(x for x in operator.activeCallersList if x in self.pendingObjects) priorityObject=next(x for x in operator.activeCallersList if x in self.pendingObjects)
#=========================================================== #===========================================================
# # TESTING # # TESTING
# print ' the PRIORITY object is', priorityObject.id # print ' the PRIORITY object is', priorityObject.id
#=========================================================== #===========================================================
# and if the priorityObject is indeed pending
if priorityObject in self.pendingObjects: if priorityObject in self.pendingObjects:
# assign an operator to it
operator.operatorAssignedTo=priorityObject operator.operatorAssignedTo=priorityObject
#======================================================= #=======================================================
# # TESTING # # TESTING
# print now(), operator.objName, 'got assigned to', priorityObject.id # print now(), operator.objName, 'got assigned to', priorityObject.id
#======================================================= #=======================================================
# and let it proceed withGetEntity
priorityObject.canProceedWithGetEntity=True priorityObject.canProceedWithGetEntity=True
priorityObject.inPositionToGet=False priorityObject.inPositionToGet=False
# if an object cannot proceed with getEntity, unAssign the exit of its giver # if an object cannot proceed with getEntity, unAssign the exit of its giver
......
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