Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
31bf8c2c
Commit
31bf8c2c
authored
May 22, 2014
by
Alexandre Duret-Lutz
Browse files
ngraph: support aliasing states
* src/graph/ngraph.hh (alias_state): New method. * src/graphtest/ngraph.cc: Use it.
parent
424de903
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph/ngraph.hh
View file @
31bf8c2c
...
...
@@ -77,6 +77,13 @@ namespace spot
return
p
.
first
->
second
;
}
/// \brief Give an alternate name to a state.
/// \return true iff the newname was already used.
bool
alias_state
(
state
s
,
name
newname
)
{
return
!
name_to_state
.
insert
(
std
::
make_pair
(
newname
,
s
)).
second
;
}
state
get_state
(
name
n
)
const
{
return
name_to_state
.
at
(
n
);
...
...
src/graphtest/ngraph.cc
View file @
31bf8c2c
...
...
@@ -389,10 +389,12 @@ bool f9()
spot
::
named_graph
<
graph_t
,
std
::
string
>
gg
(
g
);
auto
s1
=
gg
.
new_state
(
"s1"
);
gg
.
new_state
(
"s2"
);
gg
.
new_state
(
"s3"
);
auto
s3
=
gg
.
new_state
(
"s3"
);
gg
.
alias_state
(
s3
,
"s3b"
);
gg
.
new_transition
(
"s1"
,
"s2"
,
1
,
3
);
gg
.
new_transition
(
"s1"
,
"s3"
,
2
,
5
);
gg
.
new_transition
(
"s2"
,
"s3"
,
3
,
7
);
gg
.
new_transition
(
"s2"
,
"s3
b
"
,
3
,
7
);
gg
.
new_transition
(
"s3"
,
"s2"
,
4
,
9
);
dot
(
std
::
cout
,
gg
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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