To introduce the concept of a timeline, here are some everyday examples of data which can vary over time:
- A person's total income will tend to vary over time as the person receives pay rises or moves between employments. Given that a person's income at a point in time can be represented as a Number, then a person's varying income over time can be represented as a timeline of Numbers, which for simplicity we will write here as Timeline<Number>1;
- Regardless of total income, a person's employment record will tend to vary over time as the person moves between jobs (or has periods of time when the person has no job). If at any one time a person has at most one primary employment, then the person's history of primary employment can be represented as a Timeline<Employment>, where Employment is some rule class or Java type which holds employment details, and during periods of no primary employment the value of the timeline is some special marker value such as null (to represent "no employment");
- A person might own an asset which is eventually disposed of, for example a person might buy and subsequently sell a car. On any date, the person either does or does not own the car, which can be modeled as a Boolean. Over time, the condition of whether the car is owned on a particular date can be modeled as Timeline<Boolean>. The timeline's value will be false prior to the car's purchase date, and true from the purchase date up to and including the date of sale (or "until further notice" if the car is not known to be sold).
- Similarly, a person has a date of birth and, eventually a date of death. Persons who are still alive have a blank date of death recorded. On any date, the person is either alive or dead, and so the derived value for "is the person alive?" can be modeled as a Boolean. Over time, the condition of whether the person is alive can be modeled as Timeline<Boolean>. The timeline's value will be false prior to the person's date of birth, and true from the person's date of birth up to and including the date of death (or "until further notice" if the person has no date of death).
- A parent may have many children, born on different dates. On any particular date, the parent has a list of children who are alive on that date, which can be modeled as List<Person>. Over time, the list of children will change as more children are born or children reach the age of maturity (or, less happily, die in childhood), which can be modeled as Timeline<List<Person>>
The examples above are shown in graph form in the figure below.
Figure 1. Examples of Timeline Data