Added News RSS parser.

This commit is contained in:
Robert Kolner committed 2011-11-02 22:08:11 +01:00
1 parent 51b41a4253
commit 05b7ceb954
4 files changed
+180 -67

No files matched your search

@@ -7,7 +7,8 @@ import java.util.TreeSet;
public class DataHandler {
private List<Event> events = new LinkedList<Event>();
private Set<String> categories = new TreeSet<String>();
private List<News> news = new LinkedList<News>();
private Set<String> eventCategories = new TreeSet<String>();
public void insertEvent(String id, String title, String description, String date, String location, String text, String category) {
int intId = Integer.parseInt(id);
@@ -16,7 +17,12 @@ public class DataHandler {
Event e = new Event(intId, title, description, date, location, text, category);
events.add(e);
categories.add(category);
eventCategories.add(category);
}
public void insertNews(String title, String description, String content, String link, String pubDate) {
News n = new News(title, description, content, link, pubDate);
this.news.add(n);
}
public Event getEvent(int id) {
@@ -41,12 +47,16 @@ public class DataHandler {
return sorted.toArray(new Event[sorted.size()]);
}
public News[] populateNewsList() {
return this.news.toArray(new News[this.news.size()]);
}
public String[] getEventCategories() {
String[] result = new String[categories.size() + 1];
String[] result = new String[eventCategories.size() + 1];
result[0] = Event.ALL;
int counter = 1;
for (String c : categories) {
for (String c : eventCategories) {
result[counter++] = c;
}