View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
3    *  
4    * Licensed under the Apache License, Version 2.0 (the "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at 
7    *  
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *  
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License. 
15   */
16  package p3j.pppm.parameters;
17  
18  import java.util.Comparator;
19  
20  import p3j.pppm.SubPopulationModel;
21  
22  /**
23   * 
24   * Enumeration of the populations that are distinguished. Each {@link Parameter}
25   * is assigned with a population type, which facilitates ordering and
26   * presentation on the GUI.
27   * 
28   * Created: August 24, 2008
29   * 
30   * @author Christina Bohk
31   * @author Roland Ewald
32   * 
33   */
34  @Deprecated
35  public enum Population implements Comparator<Population> {
36  
37    /**
38     * The native population.
39     */
40    NATIVES,
41  
42    /**
43     * The emigrant population.
44     */
45    EMIGRANTS,
46  
47    /**
48     * The immigrant population.
49     */
50    IMMIGRANTS,
51  
52    /**
53     * The custom population, introduced to comply with {@link SubPopulationModel}
54     * , thus making this enumeration obsolete.
55     */
56    CUSTOM;
57  
58    @Override
59    public int compare(Population p1, Population p2) {
60      if (p1.equals(p2)) {
61        return 0;
62      }
63      if (p1 == NATIVES || (p1 == EMIGRANTS && p2 == IMMIGRANTS)) {
64        return -1;
65      }
66      return 1;
67    }
68  
69    @Override
70    public String toString() {
71      switch (this) {
72      case NATIVES:
73        return "Natives";
74      case EMIGRANTS:
75        return "Emigrants";
76      case IMMIGRANTS:
77        return "Immigrants";
78      case CUSTOM:
79        return "Custom";
80      default:
81        return "Unknown";
82      }
83    }
84  
85  }