summaryrefslogtreecommitdiff
path: root/src/main/java/com/benburwell/planes/data/Airport.java
blob: 07cbceb468fa26ce74f01b8224091bef5be4ffb1 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
package com.benburwell.planes.data;

import org.apache.commons.csv.CSVRecord;

/**
 * @author ben
 */
public class Airport extends AbstractCSVReader {
    private int id;
    private String ident;
    private String type;
    private String name;
    private double latitude;
    private double longitude;
    private int elevation;
    private String continent;
    private String isoCountry;
    private String isoRegion;
    private String municipality;
    private boolean scheduledService;
    private String gpsCode;
    private String iataCode;
    private String localCode;
    private String homeLink;
    private String wikipediaLink;
    private String keywords;

    public void readRecord(CSVRecord record) {
        this.setId(Integer.valueOf(record.get("id")));
        this.setIdent(record.get("ident"));
        this.setType(record.get("type"));
        this.setName(record.get("name"));
        try {
            this.setLatitude(Double.valueOf(record.get("latitude_deg")));
        } catch (NumberFormatException ignored) {}
        try {
            this.setLongitude(Double.valueOf(record.get("longitude_deg")));
        } catch (NumberFormatException ignored) {}
        try {
            this.setElevation(Integer.valueOf(record.get("elevation_ft")));
        } catch (NumberFormatException ignored) {}
        this.setContinent(record.get("continent"));
        this.setIsoCountry(record.get("iso_country"));
        this.setIsoRegion(record.get("iso_region"));
        this.setMunicipality(record.get("municipality"));
        this.setScheduledService(record.get("scheduled_service").equals("yes"));
        this.setGpsCode(record.get("gps_code"));
        this.setIataCode(record.get("iata_code"));
        this.setLocalCode(record.get("local_code"));
        this.setHomeLink(record.get("home_link"));
        this.setWikipediaLink(record.get("wikipedia_link"));
        this.setKeywords(record.get("keywords"));
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getIdent() {
        return ident;
    }

    public void setIdent(String ident) {
        this.ident = ident;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public int getElevation() {
        return elevation;
    }

    public void setElevation(int elevation) {
        this.elevation = elevation;
    }

    public String getContinent() {
        return continent;
    }

    public void setContinent(String continent) {
        this.continent = continent;
    }

    public String getIsoCountry() {
        return isoCountry;
    }

    public void setIsoCountry(String isoCountry) {
        this.isoCountry = isoCountry;
    }

    public String getIsoRegion() {
        return isoRegion;
    }

    public void setIsoRegion(String isoRegion) {
        this.isoRegion = isoRegion;
    }

    public String getMunicipality() {
        return municipality;
    }

    public void setMunicipality(String municipality) {
        this.municipality = municipality;
    }

    public boolean isScheduledService() {
        return scheduledService;
    }

    public void setScheduledService(boolean scheduledService) {
        this.scheduledService = scheduledService;
    }

    public String getGpsCode() {
        return gpsCode;
    }

    public void setGpsCode(String gpsCode) {
        this.gpsCode = gpsCode;
    }

    public String getIataCode() {
        return iataCode;
    }

    public void setIataCode(String iataCode) {
        this.iataCode = iataCode;
    }

    public String getLocalCode() {
        return localCode;
    }

    public void setLocalCode(String localCode) {
        this.localCode = localCode;
    }

    public String getHomeLink() {
        return homeLink;
    }

    public void setHomeLink(String homeLink) {
        this.homeLink = homeLink;
    }

    public String getWikipediaLink() {
        return wikipediaLink;
    }

    public void setWikipediaLink(String wikipediaLink) {
        this.wikipediaLink = wikipediaLink;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }
}