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
4dbaa5fd
Commit
4dbaa5fd
authored
9 years ago
by
Ludovic Apvrille
Browse files
Options
Downloads
Patches
Plain Diff
Correcting bug occuring when adding signals
parent
184b2c67
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ui/AvatarMethod.java
+21
-19
21 additions, 19 deletions
src/ui/AvatarMethod.java
src/ui/AvatarSignal.java
+210
-210
210 additions, 210 deletions
src/ui/AvatarSignal.java
with
231 additions
and
229 deletions
src/ui/AvatarMethod.java
+
21
−
19
View file @
4dbaa5fd
...
...
@@ -103,7 +103,7 @@ public class AvatarMethod {
// Returns null in case the method is not valid
public
static
AvatarMethod
isAValidMethod
(
String
_method
)
{
//
TraceManager.addDev("Is a valid method? " + _method);
TraceManager
.
addDev
(
"Is a valid method? "
+
_method
);
String
method
,
tmp
,
id
;
String
rt
=
""
;
...
...
@@ -113,28 +113,30 @@ public class AvatarMethod {
}
method
=
_method
.
trim
();
// Must replace all "more than one space" by only one space
method
=
Conversion
.
replaceAllString
(
method
,
"\t"
,
" "
);
method
=
Conversion
.
replaceAllString
(
method
,
" "
,
" "
);
TraceManager
.
addDev
(
"Method="
+
method
);
// Must replace all "more than one space" by only one space
method
=
Conversion
.
replaceAllString
(
method
,
"\t"
,
" "
);
method
=
Conversion
.
replaceAllString
(
method
,
" "
,
" "
);
TraceManager
.
addDev
(
"Method="
+
method
);
if
(
method
.
length
()
==
0
)
{
return
null
;
}
// If has opening parenthesis, remove all spaces before
int
index0
=
method
.
indexOf
(
'('
);
// If has opening parenthesis, remove all spaces before
int
index0
=
method
.
indexOf
(
'('
);
int
index1
;
index0
=
method
.
indexOf
(
'('
);
if
(
index0
==
0
)
{
return
null
;
}
else
if
(
method
.
charAt
(
index0
-
1
)
==
' '
)
{
method
=
method
.
substring
(
0
,
index0
-
1
)
+
method
.
substring
(
index0
,
method
.
length
());
}
index0
=
method
.
indexOf
(
'('
);
if
(
index0
!=
-
1
)
{
if
(
index0
==
0
)
{
return
null
;
}
else
if
(
method
.
charAt
(
index0
-
1
)
==
' '
)
{
method
=
method
.
substring
(
0
,
index0
-
1
)
+
method
.
substring
(
index0
,
method
.
length
());
}
}
// Check whether there is a return type or not
int
index2
=
method
.
indexOf
(
' '
);
...
...
@@ -154,10 +156,10 @@ public class AvatarMethod {
}
}
//TraceManager.addDev("Valid type stage 1");
//TraceManager.addDev("Valid type stage 1");
index0
=
method
.
indexOf
(
'('
);
index0
=
method
.
indexOf
(
'('
);
index1
=
method
.
indexOf
(
')'
);
// Only one of the two parenthesis
if
((
index0
==
-
1
)
&&
(
index1
>
-
1
))
{
...
...
@@ -198,7 +200,7 @@ public class AvatarMethod {
//TraceManager.addDev("Checking for an id before parenthesis index0=" + index0 + " method=" + method);
// Before parenthesis -> id
tmp
=
method
.
substring
(
0
,
index0
).
trim
();
//TraceManager.addDev("Checking for an id before parenthesis; tmp=" + tmp);
//TraceManager.addDev("Checking for an id before parenthesis; tmp=" + tmp);
if
(!
isAValidId
(
tmp
,
true
,
true
,
true
))
{
return
null
;
}
...
...
This diff is collapsed.
Click to expand it.
src/ui/AvatarSignal.java
+
210
−
210
View file @
4dbaa5fd
/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
ludovic.apvrille AT enst.fr
This software is a computer program whose purpose is to allow the
edition of TURTLE analysis, design and deployment diagrams, to
allow the generation of RT-LOTOS or Java code from this diagram,
and at last to allow the analysis of formal validation traces
obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
from INRIA Rhone-Alpes.
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
/**
* Class AvatarSignal
* Signals in Avatar ...
* Creation: 08/04/2010
* @version 1.0 08/04/2010
* @author Ludovic APVRILLE
* @see
*/
ludovic.apvrille AT enst.fr
This software is a computer program whose purpose is to allow the
edition of TURTLE analysis, design and deployment diagrams, to
allow the generation of RT-LOTOS or Java code from this diagram,
and at last to allow the analysis of formal validation traces
obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
from INRIA Rhone-Alpes.
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
/**
* Class AvatarSignal
* Signals in Avatar ...
* Creation: 08/04/2010
* @version 1.0 08/04/2010
* @author Ludovic APVRILLE
* @see
*/
package
ui
;
...
...
@@ -54,196 +54,196 @@ import java.util.*;
import
myutil.*
;
public
class
AvatarSignal
extends
AvatarMethod
{
// Signa type
// Signa type
public
final
static
int
IN
=
0
;
public
final
static
int
OUT
=
1
;
private
int
inout
;
public
AvatarSignal
(
int
_inout
,
String
_id
,
String
_types
[],
String
_typeIds
[])
{
super
(
_id
,
_types
,
_typeIds
);
inout
=
_inout
;
inout
=
_inout
;
}
public
static
AvatarSignal
isAValidSignal
(
String
_content
)
{
String
tmp
=
_content
.
trim
();
if
(!((
_content
.
startsWith
(
"in "
))
||
(
_content
.
startsWith
(
"out "
))))
{
return
null
;
}
int
tmpinout
;
if
(
_content
.
startsWith
(
"in "
))
{
tmpinout
=
IN
;
}
else
{
tmpinout
=
OUT
;
}
return
isAValidSignal
(
tmpinout
,
tmp
.
substring
(
3
,
tmp
.
length
()).
trim
());
}
public
static
AvatarSignal
isAValidSignal
(
int
_inout
,
String
_content
)
{
if
(!((
_inout
==
IN
)
||
(
_inout
==
OUT
)))
{
return
null
;
}
AvatarMethod
am
=
isAValidMethod
(
_content
);
if
(
am
==
null
)
{
TraceManager
.
addDev
(
"invalid signal: "
+
_content
);
return
null
;
}
AvatarSignal
as
=
new
AvatarSignal
(
_inout
,
am
.
getId
(),
am
.
getTypes
(),
am
.
getTypeIds
());
return
as
;
}
public
static
boolean
isAValidUseSignal
(
String
_content
)
{
if
(
_content
.
indexOf
(
"()"
)
==
-
1
)
{
_content
=
Conversion
.
replaceAllString
(
_content
,
"("
,
"#int "
);
_content
=
Conversion
.
replaceAllString
(
_content
,
"#"
,
"("
);
_content
=
Conversion
.
replaceAllString
(
_content
,
","
,
"#int "
);
_content
=
Conversion
.
replaceAllString
(
_content
,
"#"
,
","
);
}
TraceManager
.
addDev
(
"content:"
+
_content
);
return
(
isAValidMethod
(
_content
)
!=
null
);
}
public
int
getInOut
()
{
return
inout
;
}
public
static
String
getStringInOut
(
int
_inout
)
{
switch
(
_inout
)
{
case
IN:
return
"in"
;
case
OUT:
default
:
return
"out"
;
}
}
public
static
AvatarSignal
isAValidSignal
(
String
_content
)
{
String
tmp
=
_content
.
trim
();
if
(!((
_content
.
startsWith
(
"in "
))
||
(
_content
.
startsWith
(
"out "
))))
{
return
null
;
}
int
tmpinout
;
if
(
_content
.
startsWith
(
"in "
))
{
tmpinout
=
IN
;
}
else
{
tmpinout
=
OUT
;
}
return
isAValidSignal
(
tmpinout
,
tmp
.
substring
(
3
,
tmp
.
length
()).
trim
());
}
public
static
AvatarSignal
isAValidSignal
(
int
_inout
,
String
_content
)
{
if
(!((
_inout
==
IN
)
||
(
_inout
==
OUT
)))
{
return
null
;
}
AvatarMethod
am
=
isAValidMethod
(
_content
);
if
(
am
==
null
)
{
TraceManager
.
addDev
(
"invalid signal: "
+
_content
);
return
null
;
}
AvatarSignal
as
=
new
AvatarSignal
(
_inout
,
am
.
getId
(),
am
.
getTypes
(),
am
.
getTypeIds
());
return
as
;
}
public
static
boolean
isAValidUseSignal
(
String
_content
)
{
if
(
_content
.
indexOf
(
"()"
)
==
-
1
)
{
_content
=
Conversion
.
replaceAllString
(
_content
,
"("
,
"#int "
);
_content
=
Conversion
.
replaceAllString
(
_content
,
"#"
,
"("
);
_content
=
Conversion
.
replaceAllString
(
_content
,
","
,
"#int "
);
_content
=
Conversion
.
replaceAllString
(
_content
,
"#"
,
","
);
}
TraceManager
.
addDev
(
"content:"
+
_content
);
return
(
isAValidMethod
(
_content
)
!=
null
);
}
public
int
getInOut
()
{
return
inout
;
}
public
static
String
getStringInOut
(
int
_inout
)
{
switch
(
_inout
)
{
case
IN:
return
"in"
;
case
OUT:
default
:
return
"out"
;
}
}
public
String
toBasicString
()
{
return
super
.
toString
();
}
public
String
toBasicString
()
{
return
super
.
toString
();
}
public
String
toString
()
{
int
cpt
=
0
;
int
cpt
=
0
;
String
signal
=
getStringInOut
(
inout
)
+
" "
;
signal
+=
super
.
toString
();
return
signal
;
signal
+=
super
.
toString
();
return
signal
;
}
// Comparison on id only
public
boolean
equals
(
Object
o
)
{
if
(!(
o
instanceof
AvatarSignal
))
{
return
false
;
}
AvatarSignal
as
=
(
AvatarSignal
)
o
;
if
(
getId
().
equals
(
as
.
getId
()))
{
return
true
;
}
return
false
;
}
// Comparison on all fields
/*public int compareTo(Object o){
if (!(o instanceof AvatarMethod)) {
return 1;
}
AvatarMethod am = (AvatarMethod)o;
if (!(getId().equals(am.getId()))) {
return 1;
}
return 0;
}*/
if (!(o instanceof AvatarMethod)) {
return 1;
}
AvatarMethod am = (AvatarMethod)o;
if (!(getId().equals(am.getId()))) {
return 1;
}
return 0;
}*/
public
AvatarSignal
makeClone
()
{
return
isAValidSignal
(
inout
,
super
.
toString
());
}
public
boolean
isCompatibleWith
(
AvatarSignal
_as
)
{
if
(
_as
.
getInOut
()
==
getInOut
())
{
return
false
;
}
String
[]
astypes
=
_as
.
getTypes
();
if
(
astypes
.
length
!=
types
.
length
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
types
.
length
;
i
++)
{
if
(!(
types
[
i
].
compareTo
(
astypes
[
i
])
==
0
))
{
return
false
;
}
}
return
true
;
}
public
static
String
getSignalNameFromFullSignalString
(
String
_signal
)
{
String
signal
=
_signal
.
trim
();
int
index0
=
signal
.
indexOf
(
" "
);
if
(
index0
!=
-
1
)
{
signal
=
signal
.
substring
(
index0
+
1
,
signal
.
length
()).
trim
();
}
index0
=
signal
.
indexOf
(
"("
);
if
(
index0
!=
-
1
)
{
signal
=
signal
.
substring
(
0
,
index0
).
trim
();
}
return
signal
;
}
public
static
int
getNbOfValues
(
String
_value
)
{
int
index
=
_value
.
indexOf
(
'('
);
if
(
index
==
-
1
)
{
return
-
1
;
}
int
index0
=
_value
.
indexOf
(
')'
);
if
(
index0
==
-
1
)
{
return
-
1
;
}
String
val
=
_value
.
substring
(
index
+
1
,
index0
).
trim
();
if
(
val
.
length
()
==
0
)
{
return
0
;
}
int
nbChar
=
Conversion
.
nbChar
(
_value
,
','
);
return
nbChar
+
1
;
}
public
static
String
getValue
(
String
_value
,
int
_index
)
{
int
nbOfValues
=
getNbOfValues
(
_value
);
if
(
nbOfValues
<
1
)
{
return
null
;
}
if
(
_index
>=
nbOfValues
)
{
return
null
;
}
int
index0
=
_value
.
indexOf
(
'('
);
int
index1
=
_value
.
indexOf
(
')'
);
String
val
=
_value
.
substring
(
index0
+
1
,
index1
).
trim
();
String
[]
vals
=
val
.
split
(
","
);
return
vals
[
_index
].
trim
();
}
}
\ No newline at end of file
public
boolean
isCompatibleWith
(
AvatarSignal
_as
)
{
if
(
_as
.
getInOut
()
==
getInOut
())
{
return
false
;
}
String
[]
astypes
=
_as
.
getTypes
();
if
(
astypes
.
length
!=
types
.
length
)
{
return
false
;
}
for
(
int
i
=
0
;
i
<
types
.
length
;
i
++)
{
if
(!(
types
[
i
].
compareTo
(
astypes
[
i
])
==
0
))
{
return
false
;
}
}
return
true
;
}
public
static
String
getSignalNameFromFullSignalString
(
String
_signal
)
{
String
signal
=
_signal
.
trim
();
int
index0
=
signal
.
indexOf
(
" "
);
if
(
index0
!=
-
1
)
{
signal
=
signal
.
substring
(
index0
+
1
,
signal
.
length
()).
trim
();
}
index0
=
signal
.
indexOf
(
"("
);
if
(
index0
!=
-
1
)
{
signal
=
signal
.
substring
(
0
,
index0
).
trim
();
}
return
signal
;
}
public
static
int
getNbOfValues
(
String
_value
)
{
int
index
=
_value
.
indexOf
(
'('
);
if
(
index
==
-
1
)
{
return
-
1
;
}
int
index0
=
_value
.
indexOf
(
')'
);
if
(
index0
==
-
1
)
{
return
-
1
;
}
String
val
=
_value
.
substring
(
index
+
1
,
index0
).
trim
();
if
(
val
.
length
()
==
0
)
{
return
0
;
}
int
nbChar
=
Conversion
.
nbChar
(
_value
,
','
);
return
nbChar
+
1
;
}
public
static
String
getValue
(
String
_value
,
int
_index
)
{
int
nbOfValues
=
getNbOfValues
(
_value
);
if
(
nbOfValues
<
1
)
{
return
null
;
}
if
(
_index
>=
nbOfValues
)
{
return
null
;
}
int
index0
=
_value
.
indexOf
(
'('
);
int
index1
=
_value
.
indexOf
(
')'
);
String
val
=
_value
.
substring
(
index0
+
1
,
index1
).
trim
();
String
[]
vals
=
val
.
split
(
","
);
return
vals
[
_index
].
trim
();
}
}
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