Commit 90b8b085 authored by s7_spruge_k's avatar s7_spruge_k
Browse files

Updated Calendar class; Basic classes somewhat done

parent b48e89cf
...@@ -46,7 +46,7 @@ public class Calendar { ...@@ -46,7 +46,7 @@ public class Calendar {
return true; return true;
} }
//TODO We have 3 different constructors, which one to use here? //TODO DISCUSS We have 3 different constructors, which one to use here?
public boolean addNewEvent(String name, String description, Date startDate, EventType newEventType, boolean isAllDayEvent) public boolean addNewEvent(String name, String description, Date startDate, EventType newEventType, boolean isAllDayEvent)
{ {
Event tempEvent = new Event(name, description, startDate, isAllDayEvent); Event tempEvent = new Event(name, description, startDate, isAllDayEvent);
...@@ -155,7 +155,47 @@ public class Calendar { ...@@ -155,7 +155,47 @@ public class Calendar {
return eventWithTheID; return eventWithTheID;
} }
//TODO get events byDate //TODO DISCUSS Better to get event by day? -> how to input day
/**
* returns array list of events at date. (maybe need by day?)
*
*
* @param date
* @return
*/
public ArrayList<Event> getEventsByDate(Date date)
{
ArrayList<Event> allEventsAtDate = new ArrayList<>();
for (Event e : eventList) {
if(e.getStartDate().equals(date))
{
allEventsAtDate.add(e);
}
}
return allEventsAtDate;
}
//TODO DISCUSS deleteEventsByDate necessary?
//TODO get events by Type //TODO get events by Type
/**
* Returns events by EventType enum.
*
*
* @param type
* @return
*/
public ArrayList<Event> getEventsByEventType(EventType type)
{
ArrayList<Event> allEventsByType = new ArrayList<>();
for (Event e : eventList) {
if(e.getEventType().equals(type))
{
allEventsByType.add(e);
}
}
return allEventsByType;
}
//TODO DISCUSS deleteEventsByType neccessary?
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment