java - Object Oriented Design/How to set up class structure -
i new object oriented programming , curious know @ high level how solve problem.
if have list of different calendars i.e. work calendar, personal calendar, sports calendars, etc , each of them have there own respective events. assume have calendar class , nested class event class. since want display of events calendars on 1 list go on sorted array. lets wanted delete 1 of calendars work calendar how ensure work events deleted list/array. curious how class structure set @ high level. appreciated.
here how go it, highlighted parts pick on:
if have list of different calendars
i.e. work calendar
, personal calendar
, sports calendars
, etc , each of them have there own respective events
. since want display of events calendars on 1 list
go on sorted array. lets wanted delete 1 of calendars
work calendar how ensure work events deleted
list/array.
that gives me:
emum calendartype { work, personal, sport, } class event { // event data, time, place, people, etc... private calendar owner; } class calendar { private calendartype type; // or make string , rid of enum // if people can make own types private list<event> event;s }
the part wanting have events in single list , delete them when calendar bit harder.
i think add method in calendarutils
class:
public static void deleteevents(calendar c, list<event> events) { // loop through events, each 1 calendar remove }
Comments
Post a Comment