View Javadoc

1   package p3j.pppm.parameters;
2   
3   import p3j.pppm.SubPopulation;
4   
5   public enum ParameterType {
6   
7     JUMP_OFF,
8   
9     MIGRATION,
10  
11    FERTILITY,
12  
13    MORTALITY,
14  
15    PROP_MALE_LIVE_BIRTHS,
16  
17    PROP_INF_DEATHS_FIRST_6M,
18  
19    SURV_PROB_OPEN_END;
20  
21    public static final String LABEL_DELIM = ": ";
22  
23    public static final String LABEL_JUMP_OFF_POPULATION = LABEL_DELIM
24        + "Jump-off population";
25  
26    public static final String LABEL_FERTILITY = LABEL_DELIM + "Fertility";
27  
28    /**
29     * The survivors at age x. Since this string is later used to check whether a
30     * given parameter refers to mortality, it should be constant over all
31     * {@link Parameter} instances.
32     * 
33     * TODO: Add an enumeration to define the type of a {@link Parameter}.
34     */
35    public static final String SURVIVORS_AGE_X = "Survivors at age x";
36  
37    public static final String LABEL_SURVIVORS_AGE_X = ": " + SURVIVORS_AGE_X;
38  
39    public static final String LABEL_PROPORTION_MALE_LIVE_BIRTHS = LABEL_DELIM
40        + "Proportion of male live births";
41  
42    public static final String LABEL_PROPORTION_OF_INFANT_DEATHS_FIRST_6_MONTHS = LABEL_DELIM
43        + "Proportion of infant deaths dying in the first 6 months";
44  
45    public static final String LABEL_SURVIVAL_PROBABILITY_OF_OPEN_END_AGE_CLASS = LABEL_DELIM
46        + "Survival probability of open-end age class";
47  
48    public static final String LABEL_MALES = " (male)";
49  
50    public static final String LABEL_FEMALES = " (female)";
51  
52    public String getLabelFor(SubPopulation subPopulation) {
53      String prefix = subPopulation.getName();
54      switch (this) {
55      case JUMP_OFF:
56        return prefix + LABEL_JUMP_OFF_POPULATION;
57      case MIGRATION:
58        return prefix; // Special case in naming -- no additional label
59      case FERTILITY:
60        return prefix + LABEL_FERTILITY;
61      case MORTALITY:
62        return prefix + LABEL_SURVIVORS_AGE_X;
63      case PROP_MALE_LIVE_BIRTHS:
64        return prefix + LABEL_PROPORTION_MALE_LIVE_BIRTHS;
65      case PROP_INF_DEATHS_FIRST_6M:
66        return prefix + LABEL_PROPORTION_OF_INFANT_DEATHS_FIRST_6_MONTHS;
67      case SURV_PROB_OPEN_END:
68        return prefix + LABEL_SURVIVAL_PROBABILITY_OF_OPEN_END_AGE_CLASS;
69      default:
70        throw new IllegalArgumentException(
71            "This type of parameter is not handled properly:" + this);
72      }
73    }
74  
75    public String getMaleLabelFor(SubPopulation subPopulation) {
76      return getLabelFor(subPopulation) + LABEL_MALES;
77    }
78  
79    public String getFemaleLabelFor(SubPopulation subPopulation) {
80      return getLabelFor(subPopulation) + LABEL_FEMALES;
81    }
82  
83  }