uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

Country.java (1563B)


      1 package population;
      2 
      3 import java.util.HashMap;
      4 
      5 public class Country {
      6 	public static final int STARTING_YEAR = 1950;
      7 	public static int LAST_YEAR;
      8 	private String index;
      9 	private String variant = "";
     10 	private String name = "";
     11 	private String notes = "";
     12 	private String ctrycode;
     13 	private String type = "";
     14 	private String pntcode;
     15 	private HashMap<Integer, Integer> population;
     16 	private String curpop;
     17 
     18 	Country(String index, String variant, String name, String notes,
     19 	    String ctrycode, String type, String pntcode,
     20 	    HashMap<Integer, Integer> population) {
     21 		this.index = index;
     22 		this.variant = variant;
     23 		this.name = name;
     24 		this.notes = notes;
     25 		this.ctrycode = ctrycode;
     26 		this.type = type;
     27 		this.pntcode = pntcode;
     28 		this.population = population;
     29 		LAST_YEAR = STARTING_YEAR + this.population.size() - 1;
     30 		setCurpop(LAST_YEAR);
     31 
     32 	}
     33 	
     34 	/* 
     35 	 * The getters *must* have this naming convention, otherwise 
     36 	 * JavaFX TableView methods don't recognize them. Pretty stupid...
     37 	 */
     38 	public String getIndex() {
     39 		return index;
     40 	}
     41 	
     42 	public String getVariant() {
     43 		return variant;
     44 	}
     45 	
     46 	public String getName() {
     47 		return name;
     48 	}
     49 	
     50 	public String getNotes() {
     51 		return notes;
     52 	}
     53 	
     54 	public String getCtrycode() {
     55 		return ctrycode;
     56 	}
     57 	
     58 	public String getType() {
     59 		return type;
     60 	}
     61 	
     62 	public String getPntcode() {
     63 		return pntcode;
     64 	}
     65 	
     66 	public HashMap<Integer, Integer> getPopulation() {
     67 		return population;
     68 	}
     69 	
     70 	public String getCurpop() {
     71 		return curpop;
     72 	}
     73 	
     74 	public void setCurpop(Integer i) {
     75 		curpop = String.valueOf(population.get(i));
     76 	}
     77 }