-
Notifications
You must be signed in to change notification settings - Fork 0
/
TermInfo.java
89 lines (73 loc) · 1.9 KB
/
TermInfo.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
package com.deange.uwaterlooapi.model.terms;
import android.os.Parcel;
import android.os.Parcelable;
import com.deange.uwaterlooapi.model.BaseModel;
import com.deange.uwaterlooapi.utils.MapUtils;
import com.google.gson.annotations.SerializedName;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TermInfo
extends BaseModel
implements
Parcelable {
@SerializedName("current_term")
int mCurrentTerm;
@SerializedName("previous_term")
int mPreviousTerm;
@SerializedName("next_term")
int mNextTerm;
@SerializedName("listings")
Map<Integer, List<TermId>> mListings;
protected TermInfo(final Parcel in) {
super(in);
mCurrentTerm = in.readInt();
mPreviousTerm = in.readInt();
mNextTerm = in.readInt();
mListings = MapUtils.readMap(in, new HashMap<Integer, List<TermId>>());
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(mCurrentTerm);
dest.writeInt(mPreviousTerm);
dest.writeInt(mNextTerm);
MapUtils.writeMap(dest, mListings);
}
public static final Creator<TermInfo> CREATOR = new Creator<TermInfo>() {
@Override
public TermInfo createFromParcel(final Parcel in) {
return new TermInfo(in);
}
@Override
public TermInfo[] newArray(final int size) {
return new TermInfo[size];
}
};
/**
* Current Term's numerical value
*/
public int getCurrentTerm() {
return mCurrentTerm;
}
/**
* Previous term's numerical value
*/
public int getPreviousTerm() {
return mPreviousTerm;
}
/**
* Upcoming term's numerical value
*/
public int getNextTerm() {
return mNextTerm;
}
/**
* Term listings by year
* <p/>
* First item is previous year, second is current, last is next year
*/
public Map<Integer, List<TermId>> getListings() {
return mListings;
}
}