Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Franck Pommereau
/
snakes
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Franck Pommereau
2014-05-05 13:46:20 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7bee8a12b328ad2c507f222bd4ed6f88a4e84c71
7bee8a12
1 parent
84a78d52
more complete httpless
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
snakes/utils/abcd/simul.py
snakes/utils/simul/__init__.py
snakes/utils/abcd/simul.py
View file @
7bee8a1
...
...
@@ -26,6 +26,17 @@ class ABCDSimulator (BaseSimulator) :
if
nid
in
n2html
.
n2a
:
self
.
abcd
[
trans
.
name
]
=
", "
.
join
(
"#"
+
i
for
i
in
n2html
.
n2a
[
nid
])
def
init
(
self
,
state
=-
1
)
:
res
=
BaseSimulator
.
init
(
self
,
state
)
res
.
update
(
self
.
info
)
res
[
"help"
]
=
self
.
init_help
()
return
res
def
init_help
(
self
)
:
help
=
BaseSimulator
.
init_help
(
self
)
help
.
update
({
"#model .abcd"
:
"ABCD source code"
,
"#model .tree"
:
"hierarchy of ABCD objects"
,
"#model .petrinet"
:
"Petri nets semantics"
})
return
help
def
getstate
(
self
,
state
)
:
marking
=
self
.
states
[
state
]
modes
=
dict
((
t
,
[])
for
t
in
self
.
transid
)
...
...
@@ -70,9 +81,3 @@ class Simulator (BaseHTTPSimulator) :
"href"
:
"#"
,
"script"
:
"dialog($('#model .petrinet').html())"
}]
def
init_help
(
self
)
:
help
=
BaseHTTPSimulator
.
init_help
(
self
)
help
.
update
({
"#model .abcd"
:
"ABCD source code"
,
"#model .tree"
:
"hierarchy of ABCD objects"
,
"#model .petrinet"
:
"Petri nets semantics"
})
return
help
...
...
snakes/utils/simul/__init__.py
View file @
7bee8a1
...
...
@@ -108,6 +108,12 @@ class BaseSimulator (object) :
def
succ
(
self
,
state
,
mode
)
:
state
=
self
.
states
.
succ
(
state
,
mode
)
return
self
.
getstate
(
state
)
def
init_help
(
self
)
:
return
{
"#trace"
:
"the states and transitions explored so far"
,
"#model"
:
"the model being simulated"
,
"#alive .ui #ui-quit"
:
"stop the simulator (server side)"
,
"#alive .ui #ui-help"
:
"show this help"
,
"#alive .ui #ui-about"
:
"show information about the simulator"
}
class
BaseHTTPSimulator
(
Node
)
:
def
__init__
(
self
,
net
,
port
=
8000
,
respatt
=
[],
simulator
=
None
)
:
...
...
@@ -197,12 +203,6 @@ class BaseHTTPSimulator (Node) :
"id"
:
"ui-argv"
,
"href"
:
"#"
,
"script"
:
"dialog(
%
r)"
%
argv
}]
def
init_help
(
self
)
:
return
{
"#trace"
:
"the states and transitions explored so far"
,
"#model"
:
"the model being simulated"
,
"#alive .ui #ui-quit"
:
"stop the simulator (server side)"
,
"#alive .ui #ui-help"
:
"show this help"
,
"#alive .ui #ui-about"
:
"show information about the simulator"
}
@http
(
"application/json"
,
state
=
int
)
def
init
(
self
,
state
=-
1
)
:
ret
=
{
"ui"
:
self
.
init_ui
(),
...
...
Please
register
or
login
to post a comment