Skip to content

Commit

Permalink
fixed bug in using variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mattebit committed Sep 15, 2023
1 parent b7dee0c commit 4f6c0c8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tool/src/main/java/migt/Operation.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,24 @@ public Operation_API getAPI() {
// TODO: the api should be updated i.e. if the message is edited before making it available
}

/**
* Sets the api of this Operation with the given api. Note that the variables are added, not substituted
* @param api the new api to be set
*/
public void setAPI(Operation_API api) {
this.api = api;
if (this.api == null) {
this.api = api;
} else {
this.api.message = api.message;
this.api.is_request = api.is_request;

// update all variables
for (Var v : api.vars) {
if (!this.api.vars.contains(v)) {
this.api.vars.add(v);
}
}
}

// add the intercepted message to the matched messages to be displayed
if (!matchedMessages.contains(api.message)) {
Expand Down

0 comments on commit 4f6c0c8

Please sign in to comment.