implemented inversion of conditions

This commit is contained in:
Stephan Richter
2020-10-30 11:37:24 +01:00
parent b68b1168c7
commit d8ce80f2da
4 changed files with 40 additions and 25 deletions

View File

@@ -60,7 +60,7 @@ public class ConditionalAction extends Action {
@Override
public boolean fire(Context context) throws IOException {
for (Condition condition : conditions) {
if (condition.fulfilledBy(context)) return fireActions(context);
if (condition.fulfilledBy(context) != condition.inverted) return fireActions(context);
}
return false;
}
@@ -106,7 +106,7 @@ public class ConditionalAction extends Action {
@Override
public String toString() {
if (conditions.isEmpty()) return t("Invalid condition");
if (conditions.isEmpty()) return t("[Click here to add condition]");
StringBuffer sb = new StringBuffer();
for (int i = 0; i<conditions.size(); i++) {
if (i>0) sb.append(t(" or "));