Day Log
In order to provide the desired functionality, we need two main data structures:
A data structure for the current day, holding the date and the values and times for the day's measurements
A data structure storing all the days persistently
Thus, the day log data structure needs a field holding the date and a list of the time and value pairs. The date is stored in the integer variable date, holding the day of the month in the lowest byte, the month in the second-lowest byte, and the year in the two upper bytes. We are using this format instead of the Date or Calendar object for simplified comparison, required for keeping the log entries in the right order. To store the pairs, a local class Entry is used, consisting of two integer values: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access