-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPhenotypeFactory.java
48 lines (36 loc) · 1.62 KB
/
PhenotypeFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Acts as constructor for Phenotype objects */
/* A completely static class */
public class PhenotypeFactory {
public static String GEOMETRIC = "geometric";
public static String GEOMETRIC3D = "geometric3d";
public static String GEOMETRIC10D = "geometric10d";
// returns newly instantiated Phenotype objects of type according to Parameters.phenotypeSpace
public static Phenotype makeVirusPhenotype() {
Phenotype p = null;
if (GEOMETRIC.equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype(); }
if ("geometric3d".equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype3D(); }
if ("geometric10d".equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype10D(); }
return p;
}
// returns newly instantiated Phenotype objects of type according to Parameters.phenotypeSpace
public static Phenotype makeHostPhenotype() {
Phenotype p = null;
if ("geometric".equals(Parameters.phenotypeSpace)) {
p = new GeometricPhenotype(Parameters.initialTraitA, 0);
}
if ("geometric3d".equals(Parameters.phenotypeSpace)) {
p = new GeometricPhenotype3D(Parameters.initialTraitA, 0, 0);
}
if ("geometric10d".equals(Parameters.phenotypeSpace)) {
double[] traits = {Parameters.initialTraitA, 0, 0, 0, 0, 0, 0, 0, 0, 0};
p = new GeometricPhenotype10D(traits);
}
return p;
}
// returns newly instantiated Phenotype objects of type according to Parameters.phenotypeSpace
public static Phenotype makeArbitaryPhenotype(double x, double y) {
Phenotype p = null;
if ("geometric".equals(Parameters.phenotypeSpace)) { p = new GeometricPhenotype(x, y); }
return p;
}
}