OperatorPool comments clean-up

parent 3730e733
...@@ -101,10 +101,11 @@ class OperatorPool(ObjectResource): ...@@ -101,10 +101,11 @@ class OperatorPool(ObjectResource):
# if callerOjbect is None then the checkIfResourceIsAvailable performs the default behaviour # if callerOjbect is None then the checkIfResourceIsAvailable performs the default behaviour
# so initially it checks whether there is a free operator # so initially it checks whether there is a free operator
isAvailable = any(operator.checkIfResourceIsAvailable()==True for operator in self.operators) isAvailable = any(operator.checkIfResourceIsAvailable()==True for operator in self.operators)
if isAvailable: # if isAvailable:
return True # return True
# if there is no free operator, then check if any of the operators can preempt return isAvailable
return any(operator.checkIfResourceIsAvailable(callerObject=self)==True for operator in self.operators) # # if there is no free operator, then check if any of the operators can preempt
# return any(operator.checkIfResourceIsAvailable(callerObject=self)==True for operator in self.operators)
# ======================================================================= # =======================================================================
# find the first available operator and return it # find the first available operator and return it
...@@ -112,10 +113,11 @@ class OperatorPool(ObjectResource): ...@@ -112,10 +113,11 @@ class OperatorPool(ObjectResource):
def findAvailableOperator(self): # may need to implement different sorting of the operators def findAvailableOperator(self): # may need to implement different sorting of the operators
# find the free operator if any # find the free operator if any
freeOperator = next(x for x in self.operators if x.checkIfResourceIsAvailable()) freeOperator = next(x for x in self.operators if x.checkIfResourceIsAvailable())
if freeOperator: # if freeOperator:
return freeOperator # return freeOperator
# if there is no free operator, return the operator that can preempt return freeOperator
return next(x for x in self.operators if x.checkIfResourceIsAvailable(callerObject=self)) # # if there is no free operator, return the operator that can preempt
# return next(x for x in self.operators if x.checkIfResourceIsAvailable(callerObject=self))
# ======================================================================= # =======================================================================
# returns the resource # returns the resource
......
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