1 package cz.cuni.amis.pogamut.sposh.engine;
2
3 import cz.cuni.amis.pogamut.sposh.executor.ActionResult;
4
5
6
7
8
9 public interface ITestPrimitive {
10 String getName();
11 Object work(VariableContext ctx);
12 int triggered();
13 }
14
15
16 class PrintPrimitive implements ITestPrimitive {
17 private String primitive;
18 private Object returnValue = true;
19 private int triggered = 0;
20
21 PrintPrimitive(String primitive) {
22 this.primitive = primitive;
23 }
24
25 PrintPrimitive(String primitive, boolean b) {
26 this.primitive = primitive;
27 this.returnValue = b;
28 }
29
30 PrintPrimitive(String primitive, String s) {
31 this.primitive = primitive;
32 this.returnValue = s;
33 }
34
35 PrintPrimitive(String primitive, ActionResult result) {
36 this.primitive = primitive;
37 this.returnValue = result;
38 }
39
40 @Override
41 public Object work(VariableContext ctx) {
42 System.out.println("WORKING: " + getName() + "" + ctx);
43 ++triggered;
44 return returnValue;
45 }
46
47 @Override
48 public String getName() {
49 return primitive;
50 }
51
52 @Override
53 public int triggered() {
54 return triggered;
55 }
56
57 public void setReturnValue(Object b) {
58 this.returnValue = b;
59 }
60
61 }