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.
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.
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/>.
16 package de.dhbwloe.campusapp.vorlesungen;
17 import android.os.Bundle;
18 import android.provider.ContactsContract;
20 import java.lang.reflect.Array;
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.regex.Matcher;
24 import java.util.regex.Pattern;
26 import de.dhbwloe.campusapp.database.DatabaseManager;
29 * Created by pk910 on 21.01.2016.
31 public class CourseGroup {
32 private static ArrayList<CourseGroup> CourseGroups = new ArrayList<CourseGroup>();
33 private int iCourseGroupId;
34 private String sCourseGroupName;
35 private String sCourseName;
36 private boolean bIsNew = false;
37 private ArrayList<CourseEvent> events = new ArrayList<CourseEvent>();
39 private Bundle extraData = new Bundle();
41 public static CourseGroup GetCourseGroupById(DatabaseManager dbm, int id) {
42 for(CourseGroup group : CourseGroups) {
43 if(group.iCourseGroupId == id)
46 return dbm.getCourseGroup(id);
49 public static CourseGroup GetCourseGroupByName(DatabaseManager dbm, String coursename, String groupname) {
50 for(CourseGroup group : CourseGroups) {
51 if(group.sCourseName.equalsIgnoreCase(coursename) && group.sCourseGroupName.equalsIgnoreCase(groupname))
54 CourseGroup group = dbm.getCourseGroup(coursename, groupname);
56 group = dbm.addCourseGroup(coursename, groupname);
62 public static void ResetEventGroups() {
63 for(CourseGroup group : CourseGroups) {
69 public CourseGroup(int id, String coursename, String groupname) {
71 sCourseGroupName = groupname;
72 sCourseName = coursename;
74 CourseGroups.add(this);
77 public void addCourseEvent(CourseEvent event) {
78 this.events.add(event);
81 public CourseEvent[] getCourseEvents() {
82 return (CourseEvent[])this.events.toArray();
85 public CourseEvent[] getOrderedCourseEvents() {
86 CourseEvent[] events = getCourseEvents();
93 public int getGroupId() {
94 return iCourseGroupId;
97 public boolean isNewGroup(boolean reset) {
104 public Bundle getExtraData() {
108 public String getGroupName() {
109 return sCourseGroupName;