Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tlc4b
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tlc4b
Commits
7b7d5c5f
Commit
7b7d5c5f
authored
10 months ago
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Add new variant of checkTLC4BIsApplicable to let caller manage executor
parent
55da7320
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tlc4b/TLC4B.java
+21
-4
21 additions, 4 deletions
src/main/java/de/tlc4b/TLC4B.java
with
21 additions
and
4 deletions
src/main/java/de/tlc4b/TLC4B.java
+
21
−
4
View file @
7b7d5c5f
...
...
@@ -102,20 +102,37 @@ public class TLC4B {
return
results
;
}
/**
* Check whether TLC4B is applicable to the provided machine.
* This method has no return value - if it returns without throwing an exception, then TLC4B is applicable.
* Be aware that this method may take a long time to run for large/complex machines.
*
* @param path path to B machine file
* @throws IOException if files could not be read
* @throws BCompoundException if the machine file could not be parsed
* @throws TLC4BException if translation fails for any other reason
*/
public
static
void
checkTLC4BIsApplicable
(
String
path
)
throws
IOException
,
BCompoundException
{
TLC4B
tlc4B
=
new
TLC4B
();
tlc4B
.
processArgs
(
new
String
[]{
path
,
SILENT
.
cliArg
()});
tlc4B
.
translate
();
// tlc4B.createFiles() is intentionally not called here!
}
/**
* Quickly check whether TLC4B is applicable to the provided machine.
*
* @param path path to B machine file
* @param timeOut time out in seconds
* @return Exception if TLC4B is not applicable, else null (also if unknown)
* @deprecated This method creates an executor that is never shut down.
* Use {@link #checkTLC4BIsApplicable(String)} instead and implement the timeout logic yourself as appropriate for your application.
*/
@Deprecated
public
static
Exception
checkTLC4BIsApplicable
(
final
String
path
,
int
timeOut
)
{
Future
<
Exception
>
future
=
Executors
.
newSingleThreadExecutor
().
submit
(()
->
{
try
{
TLC4B
tlc4B
=
new
TLC4B
();
tlc4B
.
processArgs
(
new
String
[]{
path
,
SILENT
.
cliArg
()});
tlc4B
.
translate
();
// tlc4B.createFiles() is intentionally not called here!
checkTLC4BIsApplicable
(
path
);
return
null
;
}
catch
(
BCompoundException
|
IOException
|
TLC4BException
e
)
{
return
e
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment