Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
bfdcac3c
Commit
bfdcac3c
authored
Jun 02, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SelectiveQueue to work as normal if successors have the same priority
parent
9f2208be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
dream/simulation/Examples/SelectiveQueue.py
dream/simulation/Examples/SelectiveQueue.py
+3
-0
No files found.
dream/simulation/Examples/SelectiveQueue.py
View file @
bfdcac3c
...
...
@@ -4,6 +4,9 @@ from dream.simulation.imports import Queue
class
SelectiveQueue
(
Queue
):
#override so that it chooses receiver according to priority
def
selectReceiver
(
self
,
possibleReceivers
=
[]):
#if the priorities are the same work as cycle
if
possibleReceivers
[
0
].
priority
==
possibleReceivers
[
1
].
priority
:
return
Queue
.
selectReceiver
(
possibleReceivers
)
# sort the receivers according to their priority
possibleReceivers
.
sort
(
key
=
lambda
x
:
x
.
priority
,
reverse
=
True
)
if
possibleReceivers
[
0
].
canAccept
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment