1 package cz.cuni.amis.pogamut.sposh.elements;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6
7
8
9
10
11 public class LapElementsFactory {
12
13
14
15
16
17 public static String DEFAULT_ACTION = "doNothing";
18
19
20
21
22 public static String DEFAULT_TRIGGER_SENSE = "succeed";
23
24
25
26
27
28
29
30
31
32 public static Competence createCompetence(String name, String... choices) {
33 List<CompetenceElement> elements = new ArrayList<CompetenceElement>(choices.length);
34
35 for (String choice : choices) {
36 elements.add(new CompetenceElement(choice, new Sense(DEFAULT_TRIGGER_SENSE), DEFAULT_ACTION, null));
37 }
38
39 return new Competence(name, new FormalParameters(), elements);
40 }
41
42
43
44
45
46
47 public static DriveElement createDriveElement(String driveName) {
48 return new DriveElement(driveName, new Triggers(new Sense(DEFAULT_TRIGGER_SENSE)), DEFAULT_ACTION, null);
49 }
50
51
52
53
54
55
56
57 public static DriveElement createDriveElementNoTriggers(String name) {
58 return new DriveElement(name, new Triggers(), DEFAULT_ACTION, null);
59 }
60
61
62
63
64
65
66 public static CompetenceElement createCompetenceElement(String name) {
67 return new CompetenceElement(name, new Sense(DEFAULT_TRIGGER_SENSE), DEFAULT_ACTION, null);
68 }
69
70
71
72
73
74
75 public static Sense createSense(String name) {
76 return new Sense(name);
77 }
78 }