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
df1fff32
Commit
df1fff32
authored
May 12, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor commit in CoreObject
parent
5bb1846e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
24 deletions
+23
-24
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+23
-24
No files found.
dream/simulation/CoreObject.py
View file @
df1fff32
...
...
@@ -319,37 +319,35 @@ class CoreObject(Process):
self
.
wipStatList
.
append
([
now
(),
len
(
activeObjectQueue
)])
return
activeEntity
#===========================================================================
# find possible receivers
#===========================================================================
def
findReceivers
(
self
):
activeObject
=
self
.
getActiveObject
()
receivers
=
[]
for
object
in
[
x
for
x
in
self
.
next
if
x
.
canAccept
(
activeObject
)]:
receivers
.
append
(
object
)
return
receivers
# =======================================================================
# signal the successor that the object can dispose an entity
# =======================================================================
def
signalReceiver
(
self
):
# print now(), self.id, 'trying to signal receiver'
activeObject
=
self
.
getActiveObject
()
possibleReceivers
=
[]
for
object
in
[
x
for
x
in
self
.
next
if
x
.
canAccept
(
activeObject
)]:
possibleReceivers
.
append
(
object
)
# print now(), self.id,'possibleReceivers',[str(x.id) for x in possibleReceivers]
possibleReceivers
=
activeObject
.
findReceivers
()
if
possibleReceivers
:
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
# activeObject.receiver=activeObject.selectReceiver(possibleReceivers)
receiversGiver
=
activeObject
# activeObject.receiver.giver=activeObject
# perform the checks that canAcceptAndIsRequested used to perform and update activeCallersList or assignExit and operatorPool
while
not
receiver
.
canAcceptAndIsRequested
(
receiversGiver
):
# while not activeObject.receiver.canAcceptAndIsRequested():
possibleReceivers
.
remove
(
receiver
)
# possibleReceivers.remove(activeObject.receiver)
if
not
possibleReceivers
:
# print self.id, 'reseting receiver'
receiversGiver
=
None
receiver
=
None
# activeObject.receiver.giver=None
# activeObject.receiver=None
return
False
receiver
=
activeObject
.
selectReceiver
(
possibleReceivers
)
# activeObject.receiver=activeObject.selectReceiver(possibleReceivers)
receiversGiver
=
activeObject
# activeObject.receiver.giver=activeObject
#------------------------------------------------------------------------------
# if an operator is not assigned to the receiver then do not signal the receiver but the Router
...
...
@@ -397,33 +395,34 @@ class CoreObject(Process):
receiver
=
object
# set the receiver as the longest waiting possible receiver
return
receiver
#===========================================================================
# find possible givers
#===========================================================================
def
findGivers
(
self
):
activeObject
=
self
.
getActiveObject
()
givers
=
[]
for
object
in
[
x
for
x
in
activeObject
.
previous
if
(
not
x
is
activeObject
)]:
if
object
.
haveToDispose
(
activeObject
):
givers
.
append
(
object
)
return
givers
# =======================================================================
# signal the giver that the entity is removed from its internalQueue
# =======================================================================
def
signalGiver
(
self
):
# print now(), self.id, 'trying to signal giver'
activeObject
=
self
.
getActiveObject
()
possibleGivers
=
[]
for
object
in
[
x
for
x
in
activeObject
.
previous
if
(
not
x
is
activeObject
)]:
if
object
.
haveToDispose
(
activeObject
):
possibleGivers
.
append
(
object
)
# print 'possibleGivers:', [str(x.id) for x in possibleGivers]
possibleGivers
=
activeObject
.
findGivers
()
if
possibleGivers
:
giver
=
activeObject
.
selectGiver
(
possibleGivers
)
# activeObject.giver=activeObject.selectGiver(possibleGivers)
giversReceiver
=
activeObject
# activeObject.giver.receiver=activeObject
# perform the checks that canAcceptAndIsRequested used to perform and update activeCallersList or assignExit and operatorPool
while
not
activeObject
.
canAcceptAndIsRequested
(
giver
):
# while not activeObject.canAcceptAndIsRequested():
possibleGivers
.
remove
(
giver
)
# possibleGivers.remove(activeObject.giver)
if
not
possibleGivers
:
return
False
giver
=
activeObject
.
selectGiver
(
possibleGivers
)
# activeObject.giver=activeObject.selectGiver(possibleGivers)
giversReceiver
=
activeObject
# activeObject.giver.receiver=activeObject
activeObject
.
giver
=
giver
activeObject
.
giver
.
receiver
=
activeObject
#===================================================================
...
...
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