forked from trvrb/antigen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhenotypeFactory.java
More file actions
44 lines (33 loc) · 1.43 KB
/
Copy pathPhenotypeFactory.java
File metadata and controls
44 lines (33 loc) · 1.43 KB
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
/* Acts as constructor for Phenotype objects */
/* A completely static class */
public class PhenotypeFactory {
// returns newly instantiated Phenotype objects of type according to Parameters.phenotypeSpace
public static Phenotype makeVirusPhenotype() {
Phenotype p = null;
if (Parameters.phenotypeSpace == "geometric") { p = new GeometricPhenotype(); }
if (Parameters.phenotypeSpace == "geometric3d") { p = new GeometricPhenotype3D(); }
if (Parameters.phenotypeSpace == "geometric10d") { p = new GeometricPhenotype10D(); }
return p;
}
// returns newly instantiated Phenotype objects of type according to Parameters.phenotypeSpace
public static Phenotype makeHostPhenotype() {
Phenotype p = null;
if (Parameters.phenotypeSpace == "geometric") {
p = new GeometricPhenotype(Parameters.initialTraitA, 0);
}
if (Parameters.phenotypeSpace == "geometric3d") {
p = new GeometricPhenotype3D(Parameters.initialTraitA, 0, 0);
}
if (Parameters.phenotypeSpace == "geometric10d") {
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 (Parameters.phenotypeSpace == "geometric") { p = new GeometricPhenotype(x, y); }
return p;
}
}