-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgradlew.bat
92 lines (73 loc) · 2.12 KB
/
gradlew.bat
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
package justthinkinnovation.munguriek.notekeeper;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Jim.
*/
public class DataManager {
private static DataManager ourInstance = null;
private List<CourseInfo> mCourses = new ArrayList<>();
private List<NoteInfo> mNotes = new ArrayList<>();
public static DataManager getInstance() {
if(ourInstance == null) {
ourInstance = new DataManager();
ourInstance.initializeCourses();
ourInstance.initializeExampleNotes();
}
return ourInstance;
}
public String getCurrentUserName() {
return "Jim Wilson";
}
public String getCurrentUserEmail() {
return "[email protected]";
}
public List<NoteInfo> getNotes() {
return mNotes;
}
public int createNewNote() {
NoteInfo note = new NoteInfo(null, null, null);
mNotes.add(note);
return mNotes.size() - 1;
}
public int findNote(NoteInfo note) {
for(int index = 0; index < mNotes.size(); index++) {
if(note.equals(mNotes.get(index)))
return index;
}
return -1;
}
public void removeNote(int index) {
mNotes.remove(index);
}
public List<CourseInfo> getCourses() {
return mCourses;
}
public CourseInfo getCourse(String id) {
for (CourseInfo course : mCourses) {
if (id.equals(course.getCourseId()))
return course;
}
return null;
}
public List<NoteInfo> getNotes(CourseInfo course) {
ArrayList<NoteInfo> notes = new ArrayList<>();
for(NoteInfo note:mNotes) {
if(course.equals(note.getCourse()))
notes.add(note);
}
return notes;
}
public int getNoteCount(CourseInfo course) {
int count = 0;
for(NoteInfo note:mNotes) {
if(course.equals(note.getCourse()))
count++;
}
return count;
}
private DataManager() {
}
//region Initialization code
private void initializeCourses() {
mCourses.add(init