gen: hide ks_cobuchi(), introduce aut_pattern()
* spot/gen/automata.hh, spot/gen/automata.cc: Hide ks_cobuchi() behind introduce aut_pattern(), as we have already done for the formulas. * bin/genaut.cc: Simplify using this interface. * python/spot/gen.i: Introduce aut_patterns(). * tests/python/gen.ipynb, tests/python/gen.py: Adjust.
This commit is contained in:
parent
ca7f72bb4b
commit
11ca2803c9
6 changed files with 216 additions and 122 deletions
|
|
@ -85,4 +85,32 @@ def ltl_patterns(*args):
|
|||
raise RuntimeError("invalid pattern specification")
|
||||
for n in range(min, max + 1):
|
||||
yield ltl_pattern(pat, n)
|
||||
|
||||
def aut_patterns(*args):
|
||||
"""
|
||||
Generate automata patterns.
|
||||
|
||||
The arguments should be have one of these three forms:
|
||||
- (id, n)
|
||||
- (id, min, max)
|
||||
- id
|
||||
In the first case, the pattern id=n is generated. In the second
|
||||
case, all pattern id=n for min<=n<=max are generated. The
|
||||
third case is a shorthand for (id, 1, 10).
|
||||
"""
|
||||
for spec in args:
|
||||
if type(spec) is int:
|
||||
pat = spec
|
||||
min = 1
|
||||
max = 10
|
||||
else:
|
||||
ls = len(spec)
|
||||
if ls == 2:
|
||||
pat, min, max = spec[0], spec[1], spec[1]
|
||||
elif ls == 3:
|
||||
pat, min, max = spec
|
||||
else:
|
||||
raise RuntimeError("invalid pattern specification")
|
||||
for n in range(min, max + 1):
|
||||
yield aut_pattern(pat, n)
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue