Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dziegel committed Aug 22, 2024
1 parent 5162772 commit a3daa34
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
16 changes: 14 additions & 2 deletions generator/src/generator/Transformations.egl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,18 @@ operation Tuple stateTransform(statemachine : Tuple, region : Tuple, parent_stat
}
}

operation List splitEntries() : List {
var result = new List();
for (entry in self) {
if (entry.matches(".*,.*")) {
result.addAll(entry.split(","));
} else {
result.add(entry);
}
}
return result;
}

operation Tuple transitionTransform(statemachine : Tuple, state : Tuple, trigger: String, all_actions: List) {
self.trans_conditional = new List();
self.trans_unconditional = new List();
Expand All @@ -155,7 +167,7 @@ operation Tuple transitionTransform(statemachine : Tuple, state : Tuple, trigger

// Collect all actions
var actions = new List();
for (action in self.actions) {
for (action in self.actions.splitEntries()) {
all_actions.add("&" + statemachine.name + "::" + statemachine.impl_type + "::" + action);
if (not statemachine.all_actions.includes(action)) {
if (action == "") {
Expand All @@ -167,7 +179,7 @@ operation Tuple transitionTransform(statemachine : Tuple, state : Tuple, trigger

// Collect all guards and create guards_list
var guards = new List();
for (guard in self.guards) {
for (guard in self.guards.splitEntries()) {
guards.add("impl->" + guard + "(event)");
if (not statemachine.all_guards.includes(guard)) {
statemachine.all_guards.add(guard);
Expand Down
13 changes: 2 additions & 11 deletions generator/src/generator/XmiModel.egl
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,7 @@ operation Transition getModel(sm : Tuple, state : Tuple) : Tuple {

// Actions
if (self.effect.isDefined() and (self.effect != null)) {
var body = self.effect.getBody();
if (body.matches(".*,.*")) {
result.actions.addAll(body.split(","));
} else {
result.actions.add(body.trim());
}
result.actions.add(self.effect.getBody());
}

// Guard
Expand All @@ -121,11 +116,7 @@ operation Transition getModel(sm : Tuple, state : Tuple) : Tuple {
guard = self.guard.name;
}
if (guard != "else") {
if (guard.matches(".*,.*")) {
result.guards.addAll(guard.split(","));
} else {
result.guards.add(guard.trim());
}
result.guards.add(guard.trim());
}
}

Expand Down

0 comments on commit a3daa34

Please sign in to comment.