Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mbe-tools
utilities
Commits
47617dbd
Commit
47617dbd
authored
Mar 01, 2021
by
razvan
Browse files
comments added
parent
1b0b6889
Changes
3
Hide whitespace changes
Inline
Side-by-side
analysis/fr.mem4csd.analysis.otawa/src/fr/mem4csd/analysis/workflowanalysisotawa/impl/AadlToA3FlowFactsImpl.java
View file @
47617dbd
...
...
@@ -295,12 +295,13 @@ public class AadlToA3FlowFactsImpl extends WorkflowComponentImpl implements Aadl
for
(
PropertyAssociation
propertyAssociation
:
main_thread
.
getAllPropertyAssociations
())
{
// skip other properties than Loop_Bounds
if
(!
propertyAssociation
.
getProperty
().
getName
().
equals
(
"Loop_Bounds"
))
{
break
;
}
String
callSequence
=
main_thread
.
getTypeName
();
// "main"
// A. Build the call sequence (e.g. main, main.f0.g0, main.g1...)
String
callSequence
=
main_thread
.
getTypeName
();
// "main"
if
(!
propertyAssociation
.
getAppliesTos
().
isEmpty
())
{
// if loop in a subprogram
ContainmentPathElement
path
=
propertyAssociation
.
getAppliesTos
().
get
(
0
).
getPath
();
while
(
path
!=
null
)
...
...
@@ -311,6 +312,7 @@ public class AadlToA3FlowFactsImpl extends WorkflowComponentImpl implements Aadl
}
}
// B. Add the loop bounds to the right call sequence
LinkedList
<
Integer
>
boundsList
=
new
LinkedList
<
Integer
>();
assert
propertyAssociation
.
getOwnedValues
().
get
(
0
).
getOwnedValue
()
instanceof
ListValue
;
ListValue
listValue
=
(
ListValue
)
propertyAssociation
.
getOwnedValues
().
get
(
0
).
getOwnedValue
();
...
...
@@ -362,7 +364,7 @@ public class AadlToA3FlowFactsImpl extends WorkflowComponentImpl implements Aadl
* 3. Edition of the AIS file
*/
// A. First step: enter with statements for each label
// A. First step:
add
enter with statements for each label
FileOutputStream
file
=
null
;
StringBuffer
buffer
=
new
StringBuffer
();
for
(
String
label
:
labels
)
...
...
@@ -374,7 +376,7 @@ public class AadlToA3FlowFactsImpl extends WorkflowComponentImpl implements Aadl
}
buffer
.
append
(
"\n"
);
// B. Second step: loop bound statements for each loop
// B. Second step:
add
loop bound statements for each loop
for
(
String
function
:
functions
)
{
// Filter loopBounds to get only the loop bounds that apply to function
...
...
@@ -417,6 +419,8 @@ public class AadlToA3FlowFactsImpl extends WorkflowComponentImpl implements Aadl
buffer
.
append
(
";\n"
);
}
}
// C. Write the content of the StringBuffer in the right file
try
{
file
=
new
FileOutputStream
(
outputAISFile
);
...
...
analysis/fr.mem4csd.analysis.otawa/src/fr/mem4csd/analysis/workflowanalysisotawa/impl/AadlToOtawaFlowFactsImpl.java
View file @
47617dbd
...
...
@@ -310,12 +310,13 @@ public class AadlToOtawaFlowFactsImpl extends WorkflowComponentImpl implements A
for
(
PropertyAssociation
propertyAssociation
:
main_thread
.
getAllPropertyAssociations
())
{
// skip other properties than Loop_Bounds
if
(!
propertyAssociation
.
getProperty
().
getName
().
equals
(
"Loop_Bounds"
))
{
break
;
}
String
callSequence
=
main_thread
.
getTypeName
();
// "main"
// A. Build the call sequence type (e.g. main, main.f.g, main.g...)
String
callSequence
=
main_thread
.
getTypeName
();
// "main"
if
(!
propertyAssociation
.
getAppliesTos
().
isEmpty
())
{
// if loop in a subprogram
ContainmentPathElement
path
=
propertyAssociation
.
getAppliesTos
().
get
(
0
).
getPath
();
while
(
path
!=
null
)
...
...
@@ -325,6 +326,7 @@ public class AadlToOtawaFlowFactsImpl extends WorkflowComponentImpl implements A
}
}
// B. Add the loop bounds to the right call sequence type
LinkedList
<
Integer
>
boundsList
=
new
LinkedList
<
Integer
>();
assert
propertyAssociation
.
getOwnedValues
().
get
(
0
).
getOwnedValue
()
instanceof
ListValue
;
ListValue
listValue
=
(
ListValue
)
propertyAssociation
.
getOwnedValues
().
get
(
0
).
getOwnedValue
();
...
...
@@ -356,6 +358,8 @@ public class AadlToOtawaFlowFactsImpl extends WorkflowComponentImpl implements A
StringBuffer
inputBuffer
=
new
StringBuffer
();
Pattern
pattern
=
Pattern
.
compile
(
"\"([^\"]*)\""
);
// matches words in quotes (call sequence)
String
line
;
// A. Read the pre-filed Flow Facts file and modify lines that need to be modified
while
((
line
=
fileIn
.
readLine
())
!=
null
)
{
if
(
line
.
contains
(
"?"
))
{
...
...
@@ -379,6 +383,7 @@ public class AadlToOtawaFlowFactsImpl extends WorkflowComponentImpl implements A
}
fileIn
.
close
();
// B. Write the content of the StringBuffer in the right file
fileOut
=
new
FileOutputStream
(
outputFlowFactsFile
);
fileOut
.
write
(
inputBuffer
.
toString
().
getBytes
());
fileOut
.
close
();
...
...
analysis/fr.mem4csd.analysis.otawa/src/fr/mem4csd/analysis/workflowanalysisotawa/impl/AadlToOtawaFlowFactsStateMachineImpl.java
View file @
47617dbd
...
...
@@ -484,10 +484,12 @@ public class AadlToOtawaFlowFactsStateMachineImpl extends WorkflowComponentImpl
for
(
PropertyAssociation
propertyAssociation
:
mainThread
.
getAllPropertyAssociations
())
{
// skip other properties than Loop_Bounds
if
(!
propertyAssociation
.
getProperty
().
getName
().
equals
(
"Loop_Bounds"
))
{
break
;
}
// A. Build the AADL call sequence (e.g. f1, f3.g0...) and the OTAWA call sequence type (e.g. main.f, main.f.g...)
String
aadlCalls
=
""
;
String
otawaCalls
=
"main"
;
if
(!
propertyAssociation
.
getAppliesTos
().
isEmpty
())
{
// always true
...
...
@@ -500,6 +502,7 @@ public class AadlToOtawaFlowFactsStateMachineImpl extends WorkflowComponentImpl
}
}
// B. Add the loop bounds to the right call sequence
LinkedList
<
Integer
>
loopBounds
=
new
LinkedList
<
Integer
>();
assert
propertyAssociation
.
getOwnedValues
().
get
(
0
).
getOwnedValue
()
instanceof
ListValue
;
ListValue
listValue
=
(
ListValue
)
propertyAssociation
.
getOwnedValues
().
get
(
0
).
getOwnedValue
();
...
...
@@ -647,9 +650,11 @@ public class AadlToOtawaFlowFactsStateMachineImpl extends WorkflowComponentImpl
fileIn
=
new
BufferedReader
(
new
FileReader
(
outputFlowFactsFile
));
StringBuffer
outputBuffer
=
new
StringBuffer
();
String
line
;
// A. Read the edited Flow Facts file and modify the line containing the last "?"
while
((
line
=
fileIn
.
readLine
())
!=
null
)
{
if
(
line
.
contains
(
"?"
))
{
if
(
line
.
contains
(
"?"
))
{
// should be entered only once
line
=
line
.
replace
(
"?"
,
""
+
loopBound
);
}
outputBuffer
.
append
(
line
);
...
...
@@ -657,6 +662,7 @@ public class AadlToOtawaFlowFactsStateMachineImpl extends WorkflowComponentImpl
}
fileIn
.
close
();
// B. Write the content of the StringBuffer in the right file
fileOut
=
new
FileOutputStream
(
outputFlowFactsFile
);
fileOut
.
write
(
outputBuffer
.
toString
().
getBytes
());
fileOut
.
close
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment