1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package p3j.pppm;
17
18 import james.core.model.IModel;
19 import james.core.model.formalism.Formalism;
20 import james.core.model.plugintype.ModelFactory;
21 import james.core.model.symbolic.ISymbolicModel;
22
23 import java.util.ArrayList;
24 import java.util.Calendar;
25 import java.util.List;
26
27
28
29
30
31
32
33
34 public class PPPModelFactory extends ModelFactory {
35
36
37 private static final long serialVersionUID = -8959309833233820296L;
38
39
40 public static final int DEFAULT_GENERATIONS = 2;
41
42
43 public static final int DEFAULT_YEARS = 10;
44
45
46 public static final int DEFAULT_MAX_AGE = 100;
47
48
49 public static final int DEFAULT_JUMP_OFF_YEAR = Calendar.getInstance().get(
50 Calendar.YEAR);
51
52 @Override
53 public ISymbolicModel<?> create() {
54 return new SymbolicProjectionModel(createDefaultModel());
55 }
56
57 @Override
58 public Formalism getFormalism() {
59 return new PPPMFormalism();
60 }
61
62 @Override
63 public List<Class<? extends IModel>> getSupportedInterfaces() {
64 ArrayList<Class<? extends IModel>> suppInterfaces = new ArrayList<Class<? extends IModel>>();
65 suppInterfaces.add(IProjectionModel.class);
66 return suppInterfaces;
67 }
68
69
70
71
72
73
74 public ProjectionModel createDefaultModel() {
75 return createModel("New Projection", "No description entered.",
76 DEFAULT_GENERATIONS, DEFAULT_YEARS, DEFAULT_MAX_AGE,
77 DEFAULT_JUMP_OFF_YEAR);
78 }
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 public ProjectionModel createModel(String name, String description,
98 int generations, int years, int maxAge, int jumpOffYear) {
99 return new ProjectionModel(name, description, generations, years, maxAge,
100 jumpOffYear);
101 }
102
103 }