Commit 0fa26904 authored by Ioannis Papagiannopoulos's avatar Ioannis Papagiannopoulos Committed by Jérome Perrin

activeQSorter method modified to incoporate the sorting criterion of ConditionalBuffer object

parent 71602134
......@@ -209,9 +209,6 @@ class Queue(CoreObject):
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
# =======================================================================
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
# =======================================================================
def activeQSorter(self, criterion=None):
activeObjectQ=self.Res.activeQ
if criterion==None:
......@@ -279,4 +276,12 @@ class Queue(CoreObject):
if obj.id in nextObjIds:
nextObject=obj
entity.nextQueueLength=len(nextObject.getActiveObjectQueue())
activeObjectQ.sort(key=lambda x: x.nextQueueLength)
\ No newline at end of file
activeObjectQ.sort(key=lambda x: x.nextQueueLength)
#if the schedulingRule is set to ConditionalBuffer scheduling rule "CB" where orderComponents of type "Secondary"
#are moved to the end of the queue if their parent order.basicsEnded property is set to False
elif criterion=='CB':
# if the componentType is Basic then don't move it to the end of the activeQ
# else if the componentType is Secondary and it's basics are not ended then move it to the back
activeObjectQ.sort(key=lambda x: not ((x.componentType=='Basic')\
or ((x.order.basicsEnded)\
and (x.componentType=='Secondary'))))
\ No newline at end of file
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