acc: introduce acc_cond::name()

* spot/twa/acc.cc, spot/twa/acc.hh (acc_cond::name): New method.
* spot/twaalgos/dot.cc: Use it.
* tests/python/acc_cond.ipynb: Add a small test.
* NEWS: Mention it.
This commit is contained in:
Alexandre Duret-Lutz 2017-11-03 18:15:58 +01:00
parent 4711dcd74f
commit bd39edde27
5 changed files with 215 additions and 86 deletions

View file

@ -15,7 +15,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.6.3"
},
"name": ""
},
@ -1266,6 +1266,36 @@
],
"prompt_number": 46
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If the acceptance condition has some known name, it can be retrieved using the `name()` method. By default the name given is a human-readable string close that used in the HOA format, but with proper accents, and support for name like `Streett-like` or `Rabin-like`. The argument `arg` can specify a different style using the same syntax as in `--format='%[arg]g'` when using the command-line tools."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(acc.name())\n",
"print(acc.name(\"d\")) # <- Style used by print_dot(aut, \"a\")\n",
"print(acc.name(\"0\")) # <- no parameters"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"generalized-B\u00fcchi 4\n",
"gen. B\u00fcchi 4\n",
"generalized-Buchi\n"
]
}
],
"prompt_number": 47
},
{
"cell_type": "markdown",
"metadata": {},
@ -1293,7 +1323,7 @@
]
}
],
"prompt_number": 47
"prompt_number": 48
},
{
"cell_type": "markdown",
@ -1314,13 +1344,13 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 48,
"prompt_number": 49,
"text": [
"{0,1,2,3}"
]
}
],
"prompt_number": 48
"prompt_number": 49
},
{
"cell_type": "markdown",
@ -1351,7 +1381,7 @@
]
}
],
"prompt_number": 49
"prompt_number": 50
},
{
"cell_type": "markdown",
@ -1381,7 +1411,7 @@
]
}
],
"prompt_number": 50
"prompt_number": 51
},
{
"cell_type": "code",
@ -1403,7 +1433,7 @@
]
}
],
"prompt_number": 51
"prompt_number": 52
},
{
"cell_type": "code",
@ -1425,7 +1455,7 @@
]
}
],
"prompt_number": 52
"prompt_number": 53
}
],
"metadata": {}