Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mbe-tools
TTool
Commits
285fab91
Commit
285fab91
authored
10 months ago
by
Ludovic Apvrille
Browse files
Options
Downloads
Patches
Plain Diff
Adding avatar syntax checker in command line
parent
9b429283
No related branches found
No related tags found
No related merge requests found
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/cli/Action.java
+103
-56
103 additions, 56 deletions
src/main/java/cli/Action.java
with
103 additions
and
56 deletions
src/main/java/cli/Action.java
+
103
−
56
View file @
285fab91
...
...
@@ -148,7 +148,8 @@ public class Action extends Command implements ProVerifOutputListener {
private
final
static
String
AVATAR_SIMULATION_SELECT_TRACE
=
"avatar-simulation-select-trace"
;
private
final
static
String
AVATAR_SIMULATION_OPEN_WINDOW
=
"avatar-simulation-open-window"
;
private
final
static
String
AVATAR_SIMULATION_GENERIC
=
"avatar-simulation-generic"
;
private
final
static
String
AVATAR_LOAD_FROM_SYSMLV2
=
"avatar-load-sysmlv2"
;
private
final
static
String
AVATAR_LOAD_FROM_SYSMLV2
=
"avatar-load-sysmlv2"
;
private
final
static
String
AVATAR_SYNTAX_CHECKER
=
"avatar-syntax-checker"
;
private
final
static
String
AVATAR_COMPLEXITY
=
"avatar-complexity"
;
...
...
@@ -229,7 +230,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Start
ing
the graphical interface of TTool"
;
return
"Start
s
the graphical interface of TTool"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -272,7 +273,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Resize TTool main window"
;
return
"Resize
s
TTool main window"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -307,7 +308,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Open
ing
a model in TTool"
;
return
"Open
s
a model in TTool"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -332,7 +333,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Creat
ing
a new model in TTool"
;
return
"Creat
es
a new model in TTool"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -357,7 +358,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Set
ting
the save file of TTool"
;
return
"Set
s
the save file of TTool"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -388,7 +389,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Get the name of the model under edition TTool"
;
return
"Get
s
the name of the model under edition TTool"
;
}
public
String
getUsage
()
{
...
...
@@ -409,7 +410,7 @@ public class Action extends Command implements ProVerifOutputListener {
interpreter
.
addVariable
(
commands
[
0
],
fileName
);
}
System
.
out
.
println
(
fileName
);
TraceManager
.
addUser
(
fileName
);
return
null
;
}
...
...
@@ -426,7 +427,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Sav
ing
a model in TTool"
;
return
"Sav
es
a model in TTool"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -451,7 +452,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Clos
ing
the graphical interface of TTool"
;
return
"Clos
es
the graphical interface of TTool"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -474,7 +475,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Create a new design view"
;
return
"Create
s
a new design view"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -499,7 +500,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Remove the current tab"
;
return
"Remove
s
the current tab"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -524,7 +525,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Check
ing
the syntax of an opened model"
;
return
"Check
s
the syntax of an opened
graphical
model"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -569,7 +570,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Remov
ing
time operators from an avatar specification"
;
return
"Remov
es
time operators from an avatar specification"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -714,7 +715,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Perform a series of mutations on a DIPLODOCUS (TML, TMAP or TARCHI) model"
;
return
"Perform
s
a series of mutations on a DIPLODOCUS (TML, TMAP or TARCHI) model"
;
}
public
String
getUsage
()
{
...
...
@@ -887,7 +888,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Generate the TML code of a diplodocus model"
;
return
"Generate
s
the TML code of a diplodocus model"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -929,7 +930,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Generate the XML of a diplodocus model"
;
return
"Generate
s
the XML of a diplodocus model"
;
}
public
String
getUsage
()
{
...
...
@@ -979,7 +980,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Use UPPAAL for formal verification of a DIPLO app"
;
return
"Use
s
UPPAAL for formal verification of a DIPLO app"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1023,7 +1024,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Remove the NoCs of a diplodocus mapping"
;
return
"Remove
s
the NoCs of a diplodocus mapping"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1058,7 +1059,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Load a textual TML specification"
;
return
"Load
s
a textual TML specification"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1099,7 +1100,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Load a textual TMAP specification"
;
return
"Load
s
a textual TMAP specification"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1141,7 +1142,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Draw a TML specification"
;
return
"Draw
s
a TML specification"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1180,7 +1181,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Draw a TMAP specification"
;
return
"Draw
s
a TMAP specification"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1230,7 +1231,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Perform security verification over a TMAP specification"
;
return
"Perform
s
security verification over a TMAP specification"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1308,7 +1309,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Select the edition panel with a name"
;
return
"Select
s
the edition panel with a name
provided as argument
"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1338,7 +1339,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Move current panel to the left"
;
return
"Move
s
current panel to the left"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1362,7 +1363,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Move current panel to the right"
;
return
"Move
s
current panel to the right"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -1484,7 +1485,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Perform a series of mutations on an AVATAR spec"
;
return
"Perform
s
a series of mutations on an AVATAR spec"
;
}
public
String
getUsage
()
{
...
...
@@ -1553,7 +1554,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Print
in text format
an Avatar Specification"
;
return
"Print
s
an Avatar Specification
in text format
"
;
}
public
String
getUsage
()
{
...
...
@@ -1574,7 +1575,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
}
System
.
out
.
println
(
spec
);
TraceManager
.
addUser
(
spec
.
toString
()
);
return
null
;
}
...
...
@@ -1590,7 +1591,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Draw the current avatar specification"
;
return
"Draw
s
the current avatar specification"
;
}
public
String
getUsage
()
{
...
...
@@ -1608,7 +1609,7 @@ public class Action extends Command implements ProVerifOutputListener {
return
Interpreter
.
TTOOL_NO_MODEL
;
}
AvatarSpecification
spec
=
as
;
if
(
spec
==
null
)
{
spec
=
interpreter
.
mgui
.
gtm
.
getAvatarSpecification
();
...
...
@@ -1633,7 +1634,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Generate the dependency graph of an Avatar model"
;
return
"Generate
s
the dependency graph of an Avatar model"
;
}
public
String
getUsage
()
{
...
...
@@ -1690,7 +1691,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Generate a Reachability graph from an AVATAR model"
;
return
"Generate
s
a Reachability graph from an AVATAR model"
;
}
public
String
getUsage
()
{
return
"[OPTION]... [FILE]\n"
...
...
@@ -1825,7 +1826,7 @@ public class Action extends Command implements ProVerifOutputListener {
for
(
String
q
:
queries
)
{
if
(
q
!=
""
)
{
if
(
amc
.
addSafety
(
q
,
q
)
==
false
)
{
System
.
out
.
println
(
"Query "
+
q
+
" is badly written"
);
TraceManager
.
addUser
(
"Query "
+
q
+
" is badly written"
);
return
Interpreter
.
BAD
;
}
}
...
...
@@ -1921,8 +1922,8 @@ public class Action extends Command implements ProVerifOutputListener {
}
System
.
out
.
println
(
"Model checking done\nGraph: states:"
+
amc
.
getNbOfStates
()
+
TraceManager
.
addUser
(
"Model checking done\nGraph: states:"
+
amc
.
getNbOfStates
()
+
" links:"
+
amc
.
getNbOfLinks
()
+
"\n"
);
if
(
noDeadlocks
)
{
...
...
@@ -1973,9 +1974,9 @@ public class Action extends Command implements ProVerifOutputListener {
try
{
File
f
=
new
File
(
file
);
FileUtils
.
saveFile
(
file
,
trace
);
System
.
out
.
println
(
"\nCounterexample trace saved in "
+
file
+
"\n"
);
TraceManager
.
addUser
(
"\nCounterexample trace saved in "
+
file
+
"\n"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"\nCounterexample trace could not be saved in "
+
file
+
"\n"
);
TraceManager
.
addUser
(
"\nCounterexample trace could not be saved in "
+
file
+
"\n"
);
}
if
(
counterTracesAUT
)
{
...
...
@@ -1998,9 +1999,9 @@ public class Action extends Command implements ProVerifOutputListener {
interpreter
.
mgui
.
addRG
(
rg
);
File
f
=
new
File
(
filename
);
FileUtils
.
saveFile
(
filename
,
tr
.
getReport
());
System
.
out
.
println
(
"Counterexample graph trace "
+
tr
.
getQuery
()
+
" saved in "
+
filename
+
"\n"
);
TraceManager
.
addUser
(
"Counterexample graph trace "
+
tr
.
getQuery
()
+
" saved in "
+
filename
+
"\n"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Counterexample graph trace "
+
tr
.
getQuery
()
+
" could not be saved in "
+
filename
+
"\n"
);
TraceManager
.
addUser
(
"Counterexample graph trace "
+
tr
.
getQuery
()
+
" could not be saved in "
+
filename
+
"\n"
);
}
i
++;
}
...
...
@@ -2018,15 +2019,15 @@ public class Action extends Command implements ProVerifOutputListener {
}
if
(
graphPath
.
indexOf
(
"?"
)
!=
-
1
)
{
//
System.out.println
("Question mark found");
//
TraceManager.addUser
("Question mark found");
autfile
=
Conversion
.
replaceAllChar
(
graphPath
,
'?'
,
dateAndTime
);
//
System.out.println
("graphpath=" + graphPath);
//
TraceManager.addUser
("graphpath=" + graphPath);
}
else
{
autfile
=
graphPath
;
}
System
.
out
.
println
(
"graphpath="
+
graphPath
);
System
.
out
.
println
(
"autfile="
+
autfile
);
TraceManager
.
addUser
(
"graphpath="
+
graphPath
);
TraceManager
.
addUser
(
"autfile="
+
autfile
);
try
{
RG
rg
=
new
RG
(
autfile
);
...
...
@@ -2034,14 +2035,14 @@ public class Action extends Command implements ProVerifOutputListener {
rg
.
fileName
=
autfile
;
rg
.
nbOfStates
=
amc
.
getNbOfStates
();
rg
.
nbOfTransitions
=
amc
.
getNbOfLinks
();
System
.
out
.
println
(
"Saving graph in "
+
autfile
+
"\n"
);
TraceManager
.
addUser
(
"Saving graph in "
+
autfile
+
"\n"
);
File
f
=
new
File
(
autfile
);
rg
.
name
=
f
.
getName
();
interpreter
.
mgui
.
addRG
(
rg
);
FileUtils
.
saveFile
(
autfile
,
graphAUT
);
System
.
out
.
println
(
"Graph saved in "
+
autfile
+
"\n"
);
TraceManager
.
addUser
(
"Graph saved in "
+
autfile
+
"\n"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Graph could not be saved in "
+
autfile
+
"\n"
);
TraceManager
.
addUser
(
"Graph could not be saved in "
+
autfile
+
"\n"
);
}
}
...
...
@@ -2079,7 +2080,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Validate the internal verification tool with uppaal"
;
return
"Validate
s
the internal verification tool with uppaal"
;
}
public
String
getUsage
()
{
...
...
@@ -2173,7 +2174,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Simulate an avatar design until a breakpoint
or the end
"
;
return
"Simulate
s
an avatar design until a breakpoint
is met or the simulation terminates
"
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
...
...
@@ -2209,7 +2210,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"S
imulate a
trace to be simulated"
;
return
"S
elects an execution
trace to be simulated"
;
}
public
String
getUsage
()
{
...
...
@@ -2252,7 +2253,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Show / hide Avatar simulation window"
;
return
"Show
s
/ hide
s
Avatar simulation window"
;
}
public
String
getUsage
()
{
...
...
@@ -2284,7 +2285,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Execute a generic action in the Avatar simulation"
;
return
"Execute
s
a generic action in the Avatar simulation"
;
}
public
String
getUsage
()
{
...
...
@@ -2339,7 +2340,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
public
String
getDescription
()
{
return
"Load an Avatar specification from a SysML v2 textual description"
;
return
"Load
s
an Avatar specification from a SysML v2 textual description"
;
}
public
String
getUsage
()
{
...
...
@@ -2366,6 +2367,51 @@ public class Action extends Command implements ProVerifOutputListener {
}
};
Command
avatarSyntaxChecker
=
new
Command
()
{
public
String
getCommand
()
{
return
AVATAR_SYNTAX_CHECKER
;
}
public
String
getShortCommand
()
{
return
"asc"
;
}
public
String
getDescription
()
{
return
"Checks the syntax of an avatar specification"
;
}
public
String
getUsage
()
{
String
usage
=
"avatar-syntax-checker\n"
;
return
usage
;
}
public
String
executeCommand
(
String
command
,
Interpreter
interpreter
)
{
AvatarSpecification
spec
=
as
;
if
(
spec
==
null
)
{
if
(
interpreter
.
hasAModel
())
{
spec
=
interpreter
.
mgui
.
gtm
.
getAvatarSpecification
();
}
if
(
spec
==
null
)
{
return
"No AVATAR specification"
;
}
}
List
<
AvatarError
>
errors
=
AvatarSyntaxChecker
.
checkSyntaxErrors
(
spec
);
TraceManager
.
addUser
(
"Syntax checking done, "
+
errors
.
size
()
+
" errors found"
);
for
(
int
i
=
0
;
i
<
errors
.
size
();
i
++)
{
AvatarError
err
=
errors
.
get
(
i
);
String
res
=
i
+
".\t"
+
err
.
toString
();
TraceManager
.
addUser
(
res
);
}
return
null
;
}
};
Command
graphtToAvatar
=
new
Command
()
{
public
String
getCommand
()
{
...
...
@@ -2477,6 +2523,7 @@ public class Action extends Command implements ProVerifOutputListener {
addAndSortSubcommand
(
avatarSimulationOpenWindow
);
addAndSortSubcommand
(
avatarSimulationGeneric
);
addAndSortSubcommand
(
avatarLoadFromSysMLV2
);
addAndSortSubcommand
(
avatarSyntaxChecker
);
addAndSortSubcommand
(
generic
);
...
...
@@ -2593,7 +2640,7 @@ public class Action extends Command implements ProVerifOutputListener {
}
}
System
.
out
.
println
(
buffer
);
TraceManager
.
addUser
(
buffer
.
toString
()
);
}
}
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