forked from trvrb/antigen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhenotypeFactory.java
60 lines (48 loc) · 2.19 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
49
50
51
52
53
54
55
56
57
58
59
60
/* 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";
public static String SEQUENCE = "sequence";
public static String GEOMETRIC_SEQ = "geometricSeq";
// 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(); }
if (GEOMETRIC_SEQ.equals(Parameters.phenotypeSpace)) { p = new GeometricSeqPhenotype(); }
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);
}
if (GEOMETRIC_SEQ.equals(Parameters.phenotypeSpace)) {
String startingSequence = Parameters.startingSequence;
if (startingSequence == null) {
p = new GeometricSeqPhenotype(Parameters.initialTraitA, 0);
} else {
p = new GeometricSeqPhenotype(Parameters.initialTraitA, 0, Parameters.startingSequence.toCharArray());
}
}
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); }
if (GEOMETRIC_SEQ.equals(Parameters.phenotypeSpace)) { p = new GeometricSeqPhenotype(x, y); }
return p;
}
}