From 3ae9566eea151fe7560c6b06b07718c83132c75f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 14 Jan 2019 11:45:44 +0100 Subject: [PATCH] Add country envelope class. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/Country.java | 251 +++++++++++++++++++++++++++++++++++++++++++++++ src/Region.java | 2 +- 2 files changed, 252 insertions(+), 1 deletion(-) create mode 100644 src/Country.java diff --git a/src/Country.java b/src/Country.java new file mode 100644 index 0000000..0dffb2c --- /dev/null +++ b/src/Country.java @@ -0,0 +1,251 @@ +import java.util.ArrayList; + +public class Country { + private String name; + ArrayList topLevelDomain = new ArrayList(); + private String alpha2Code; + private String alpha3Code; + ArrayList callingCodes = new ArrayList(); + private String capital; + ArrayList altSpellings = new ArrayList(); + private String region; + private String subregion; + private float population; + ArrayList latlng = new ArrayList(); + private String demonym; + private float area; + private float gini; + ArrayList timezones = new ArrayList(); + ArrayList borders = new ArrayList(); + private String nativeName; + private String numericCode; + ArrayList currencies = new ArrayList(); + ArrayList languages = new ArrayList(); + Translations TranslationsObject; + private String flag; + ArrayList regionalBlocs = new ArrayList(); + private String cioc; + + public class Translations { + private String de; + private String es; + private String fr; + private String ja; + private String it; + private String br; + private String pt; + private String nl; + private String hr; + private String fa; + + // Getter Methods + + public String getDe() { + return de; + } + + public String getEs() { + return es; + } + + public String getFr() { + return fr; + } + + public String getJa() { + return ja; + } + + public String getIt() { + return it; + } + + public String getBr() { + return br; + } + + public String getPt() { + return pt; + } + + public String getNl() { + return nl; + } + + public String getHr() { + return hr; + } + + public String getFa() { + return fa; + } + + // Setter Methods + + public void setDe(String de) { + this.de = de; + } + + public void setEs(String es) { + this.es = es; + } + + public void setFr(String fr) { + this.fr = fr; + } + + public void setJa(String ja) { + this.ja = ja; + } + + public void setIt(String it) { + this.it = it; + } + + public void setBr(String br) { + this.br = br; + } + + public void setPt(String pt) { + this.pt = pt; + } + + public void setNl(String nl) { + this.nl = nl; + } + + public void setHr(String hr) { + this.hr = hr; + } + + public void setFa(String fa) { + this.fa = fa; + } + } + + + // Getter Methods + + public String getName() { + return name; + } + + public String getAlpha2Code() { + return alpha2Code; + } + + public String getAlpha3Code() { + return alpha3Code; + } + + public String getCapital() { + return capital; + } + + public String getRegion() { + return region; + } + + public String getSubregion() { + return subregion; + } + + public float getPopulation() { + return population; + } + + public String getDemonym() { + return demonym; + } + + public float getArea() { + return area; + } + + public float getGini() { + return gini; + } + + public String getNativeName() { + return nativeName; + } + + public String getNumericCode() { + return numericCode; + } + + public Translations getTranslations() { + return TranslationsObject; + } + + public String getFlag() { + return flag; + } + + public String getCioc() { + return cioc; + } + + // Setter Methods + + public void setName(String name) { + this.name = name; + } + + public void setAlpha2Code(String alpha2Code) { + this.alpha2Code = alpha2Code; + } + + public void setAlpha3Code(String alpha3Code) { + this.alpha3Code = alpha3Code; + } + + public void setCapital(String capital) { + this.capital = capital; + } + + public void setRegion(String region) { + this.region = region; + } + + public void setSubregion(String subregion) { + this.subregion = subregion; + } + + public void setPopulation(float population) { + this.population = population; + } + + public void setDemonym(String demonym) { + this.demonym = demonym; + } + + public void setArea(float area) { + this.area = area; + } + + public void setGini(float gini) { + this.gini = gini; + } + + public void setNativeName(String nativeName) { + this.nativeName = nativeName; + } + + public void setNumericCode(String numericCode) { + this.numericCode = numericCode; + } + + public void setTranslations(Translations translationsObject) { + this.TranslationsObject = translationsObject; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public void setCioc(String cioc) { + this.cioc = cioc; + } +} + diff --git a/src/Region.java b/src/Region.java index 4fd0143..43e8521 100644 --- a/src/Region.java +++ b/src/Region.java @@ -18,7 +18,7 @@ public class Region { Region r = new Region(); String contenu = ""; try { - InputStream flux = new FileInputStream(continent + ".txt"); + InputStream flux = new FileInputStream(continent + ".json"); InputStreamReader lecture = new InputStreamReader(flux); BufferedReader buff = new BufferedReader(lecture); String ligne; -- 2.34.1