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
d00abf64
Commit
d00abf64
authored
Sep 10, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first version of ManPyObject.sendSignal
parent
6ec9f4a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+1
-3
dream/simulation/ManPyObject.py
dream/simulation/ManPyObject.py
+18
-1
No files found.
dream/simulation/CoreObject.py
View file @
d00abf64
...
...
@@ -567,10 +567,8 @@ class CoreObject(ManPyObject):
self
.
giver
=
giver
self
.
giver
.
receiver
=
self
if
self
.
giver
.
expectedSignals
[
'canDispose'
]:
self
.
sendSignal
(
receiver
=
self
.
giver
,
signal
=
self
.
giver
.
canDispose
)
self
.
printTrace
(
self
.
id
,
signalGiver
=
self
.
giver
.
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
giver
.
canDispose
.
succeed
(
succeedTuple
)
self
.
giver
.
expectedSignals
[
'canDispose'
]
=
0
return
True
return
False
...
...
dream/simulation/ManPyObject.py
View file @
d00abf64
...
...
@@ -145,7 +145,24 @@ class ManPyObject(object):
G
.
traceIndex
=
0
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#===========================================================================
# sends a signal
#===========================================================================
def
sendSignal
(
self
,
sender
=
None
,
receiver
=
None
,
signal
=
None
,
succeedTuple
=
None
):
assert
signal
,
'there is no signal defined'
assert
receiver
,
'there is no receiver defined for the signal'
# give default values if not given
if
not
sender
:
sender
=
self
if
not
succeedTuple
:
succeedTuple
=
(
self
,
self
.
env
.
now
)
# send the signal
signal
.
succeed
(
succeedTuple
)
# reset the expected signals of the receiver to 0
for
key
,
value
in
receiver
.
expectedSignals
.
iteritems
():
receiver
.
expectedSignals
[
key
]
=
0
#===========================================================================
# actions to be performed after the end of the simulation
#===========================================================================
...
...
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