1
2
3
4
5 package org.state4j.sm.evaluators;
6
7 import org.state4j.sm.SmContext;
8 import org.state4j.sm.SmEvaluator;
9 import org.state4j.sm.SmGuardCondition;
10
11 public class SmNotOperatorEvaluatorImpl implements SmEvaluator {
12 private SmGuardCondition argument;
13
14 public boolean hasArgument() {
15 return argument != null;
16 }
17
18 public SmGuardCondition getArgument() {
19 if (!hasArgument()) {
20 throw new RuntimeException("this.Argument is null and can't be returned");
21 }
22 return this.argument;
23 }
24
25 public void setArgument(SmGuardCondition argument) {
26 this.argument = argument;
27 }
28
29 public boolean evaluate(SmContext cntx) {
30 return !this.getArgument().evaluate(cntx);
31 }
32 }