-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuilding.java
120 lines (98 loc) · 2.6 KB
/
Building.java
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
package com.deange.uwaterlooapi.model.buildings;
import android.os.Parcel;
import android.os.Parcelable;
import com.deange.uwaterlooapi.model.BaseModel;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class Building
extends BaseModel
implements
Parcelable {
@SerializedName("building_id")
String mBuildingId;
@SerializedName("building_code")
String mBuildingCode;
@SerializedName("building_name")
String mBuildingName;
@SerializedName("alternate_names")
List<String> mAlternateNames;
@SerializedName("latitude")
float mLatitude;
@SerializedName("longitude")
float mLongitude;
@SerializedName("building_sections")
List<BuildingSection> mBuildingSections;
protected Building(final Parcel in) {
super(in);
mBuildingId = in.readString();
mBuildingCode = in.readString();
mBuildingName = in.readString();
mAlternateNames = in.createStringArrayList();
mLatitude = in.readFloat();
mLongitude = in.readFloat();
mBuildingSections = in.createTypedArrayList(BuildingSection.CREATOR);
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mBuildingId);
dest.writeString(mBuildingCode);
dest.writeString(mBuildingName);
dest.writeStringList(mAlternateNames);
dest.writeFloat(mLatitude);
dest.writeFloat(mLongitude);
dest.writeTypedList(mBuildingSections);
}
public static final Creator<Building> CREATOR = new Creator<Building>() {
@Override
public Building createFromParcel(final Parcel in) {
return new Building(in);
}
@Override
public Building[] newArray(final int size) {
return new Building[size];
}
};
/**
* Official unique building number
*/
public String getBuildingId() {
return mBuildingId;
}
/**
* Official unique building code
*/
public String getBuildingCode() {
return mBuildingCode;
}
/**
* Official unique building name
*/
public String getBuildingName() {
return mBuildingName;
}
/**
* Alternate building names
*/
public List<String> getAlternateNames() {
return mAlternateNames;
}
/**
* Latitude + longitude of building location
*/
public float[] getLocation() {
return new float[]{mLatitude, mLongitude};
}
/**
* List of building sections
*/
public List<BuildingSection> getBuildingSections() {
return mBuildingSections;
}
/**
* Check to see if building coordinates are provided
*/
public boolean hasLocation() {
return mLatitude != 0 && mLongitude != 0;
}
}