I am thinkink how to generate data structure representing tasks in my calendar (for my private purposes only). I have date-ordered tasks records from DBMS like these:
Buy milk (on 18.1.2013)
- task date (2013-01-15)
- task label ("Buy milk")
- time frame ("day")
or
Task: Wash a car (sometime in January 2013)
- task date (2013-01-05)
- task label ("Wash a car")
- time frame ("month")
"time frame" value is enum value {DAY,WEEK,MONTH,QUARTER,YEAR} and specifies time frame of the task, e.g. time frame "month" specifies that this task needs to be done sometime in month specified by task date value.
I would like to represent my tasks in date structure, e.g.:
- 2013 (year)
- I. (quarter)
- January (month)
- Wash a car
- Week 14.1.-20.1.
- 15.1.2013 (day)
- Buy milk
- 18.1.2013 (day)
- Do somenthing...
etc. It is not problem but problem occures when there is record from next data frame, e.g. task from February.
I have tried many ways how to accomplish it but the my biggest problem is to select proper data structure and find algorithm how to fill into my structure all data frames values above concrete task and how to don't do it when these data frames exist.
I hope I explained it clearly. Thank you for ideas.