Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
naomod
faezeh-public
XTDL
Commits
f6f2fb9f
Commit
f6f2fb9f
authored
Jan 04, 2022
by
Faezeh KHORRAM
💬
Browse files
Update k3fsmAspects.xtend
parent
c831b780
Changes
1
Hide whitespace changes
Inline
Side-by-side
Language_Workbench/xFSM-K3/org.eclipse.gemoc.example.k3fsm.k3dsa/src/org/eclipse/gemoc/example/k3fsm/k3dsa/k3fsmAspects.xtend
View file @
f6f2fb9f
...
...
@@ -21,16 +21,16 @@ class FSMAspect {
@
Step
@
InitializeModel
//
<
1
>
def
void
initializeModel
(
EList
<
String
>
args
){
if
(
_self
.
currentState
==
null
){
if
(
_self
.
currentState
==
=
null
){
_self
.
currentState
=
_self
.
initialState
;
}
if
(
_self
.
unprocessedString
==
null
||
_self
.
unprocessedString
.
isEmpty
){
if
(
_self
.
unprocessedString
==
=
null
||
_self
.
unprocessedString
.
isEmpty
){
_self
.
unprocessedString
=
args
.
get
(
0
);
}
if
(
_self
.
consumedString
==
null
){
if
(
_self
.
consumedString
==
=
null
){
_self
.
consumedString
=
""
;
}
if
(
_self
.
producedString
==
null
){
if
(
_self
.
producedString
==
=
null
){
_self
.
producedString
=
""
;
}
}
...
...
@@ -42,11 +42,11 @@ class FSMAspect {
_self
.
currentState
.
step
(
_self
.
unprocessedString
)
}
}
catch
(
FSMRuntimeException
nt
){
println
(
"Stopped due to "
+
nt
.
message
)
//
println
(
"Stopped due to "
+
nt
.
message
)
}
println
(
"unprocessed string: "
+
_self
.
unprocessedString
)
println
(
"processed string: "
+
_self
.
consumedString
)
println
(
"produced string: "
+
_self
.
producedString
)
//
println
(
"unprocessed string: "
+
_self
.
unprocessedString
)
//
println
(
"processed string: "
+
_self
.
consumedString
)
//
println
(
"produced string: "
+
_self
.
producedString
)
}
}
...
...
@@ -56,7 +56,7 @@ class StateAspect {
def
void
step
(
String
inputString
)
{
//
Get
the
valid
transitions
var
validTransitions
=
_self
.
outgoingTransitions
.
filter
[
t
|
if
(
t
.
input
!= null){
if
(
t
.
input
!=
=
null){
inputString
.
startsWith
(
t
.
input
)
}
else
{
false
...
...
@@ -64,7 +64,7 @@ class StateAspect {
]
if
(
validTransitions
.
empty
)
{
//
throw
new
FSMRuntimeException
(
"No Transition"
)
validTransitions
=
_self
.
outgoingTransitions
.
filter
[
t
|
t
.
input
==
null
]
validTransitions
=
_self
.
outgoingTransitions
.
filter
[
t
|
t
.
input
==
=
null
]
}
if
(
validTransitions
.
empty
)
{
throw
new
FSMRuntimeException
(
"No Transition"
)
...
...
@@ -83,18 +83,18 @@ class TransitionAspect {
@
Step
//
<
4
>
def
void
fire
()
{
println
(
"Firing "
+
_self
.
name
+
" and entering "
+
_self
.
target
.
name
)
//
println
(
"Firing "
+
_self
.
name
+
" and entering "
+
_self
.
target
.
name
)
val
fsm
=
_self
.
source
.
owningFSM
fsm
.
currentState
=
_self
.
target
if
(
_self
.
output
!= null){
if
(
fsm
.
producedString
!= null){
if
(
_self
.
output
!=
=
null){
if
(
fsm
.
producedString
!=
=
null){
fsm
.
producedString
=
fsm
.
producedString
+
_self
.
output
}
else
{
fsm
.
producedString
=
_self
.
output
}
}
if
(
_self
.
input
!= null){
if
(
fsm
.
consumedString
!= null){
if
(
_self
.
input
!=
=
null){
if
(
fsm
.
consumedString
!=
=
null){
fsm
.
consumedString
=
fsm
.
consumedString
+
_self
.
input
}
else
{
fsm
.
consumedString
=
_self
.
input
...
...
@@ -108,6 +108,4 @@ class FSMRuntimeException extends Exception {
new
(
String
message
)
{
super
(
message
)
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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