Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / VorlesungsplanGroupsListItem.java
1 /* VorlesungsplanGroupsListItem.java
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 package de.dhbwloe.campusapp.fragments;
17 import java.text.SimpleDateFormat;
18 import java.util.Date;
19
20 import de.dhbwloe.campusapp.CampusAppContext;
21 import de.dhbwloe.campusapp.R;
22
23 /**
24  * Created by pk910 on 20.02.2016.
25  */
26 public class VorlesungsplanGroupsListItem {
27     private int groupId;
28     private String courseName;
29     private String groupName;
30     private long firstEvent, lastEvent, nextEvent, nextKlausurEvent;
31     private int eventCount;
32
33     public VorlesungsplanGroupsListItem(int groupid, String coursename, String groupname, long firstevent, long lastevent, int eventcount, long nextevent, long nextklausur) {
34         groupId = groupid;
35         courseName = coursename;
36         groupName = groupname;
37         firstEvent = firstevent;
38         lastEvent = lastevent;
39         eventCount = eventcount;
40         nextEvent = nextevent;
41         nextKlausurEvent = nextklausur;
42     }
43
44     public int getGroupId() {
45         return groupId;
46     }
47
48     public String getCourseName() {
49         return courseName;
50     }
51
52     public String getGroupName() {
53         return groupName;
54     }
55
56     public String getFirstEvent() {
57         if(firstEvent == 0)
58             return null;
59         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
60         Date date = new Date(firstEvent*1000);
61         return dateFormat.format(date);
62     }
63
64     public String getLastEvent() {
65         if(lastEvent == 0)
66             return null;
67         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
68         Date date = new Date(lastEvent*1000);
69         return dateFormat.format(date);
70     }
71
72     public String getNextEvent() {
73         if(nextEvent == 0)
74             return null;
75         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
76         Date date = new Date(nextEvent*1000);
77         return dateFormat.format(date);
78     }
79
80     public String getNextKlausurEvent() {
81         if(nextKlausurEvent == 0)
82             return null;
83         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
84         Date date = new Date(nextKlausurEvent*1000);
85         return dateFormat.format(date);
86     }
87
88     public int getEventCount() {
89         return eventCount;
90     }
91 }