overviewA temporal collection is a simple way to implement a Temporal Property or a Temporal Object. A temporal instance (either a Temporal Property or Temporal Object), when going through a series of amendments, the property itself or the properties the object references change over time. Each version of the temporal instance captures the state of the instance that will last for some period of time until the instance changes again with another amendment. implementationTemporal Collection The basic representation and interface for a temporal collection provides get and put operations that use a date as an index: TemporalCollection Interface
Single Temporal Collection The temporal collection implementation can use a Map<K,V> to keep track of the changes. A Single Temporal Collection is an implementation of Temporal Collection. A Single Temporal Collection keeps track of changes of an instance over time - over a single kind of time. That is, the updated time which is also the effective time. SingleTemporalCollection Class
[1] Temporal Collection is backed by a private HashMap<K,V>. This HashMap contains the values indexed by the effective date (the date of when they become effective). [2] milestones() returns a List of keys (effective dates) in a reverse order from the MashMap. [3] get() works through these milestones to find the right key (effective date). This algorithm works best when you are more likely to ask for the most recent value. [4] Sorts the specified list into reverse order. All elements in the list must implement the Comparable interface. Bi-Temporal Collection A Bi-Temporal Collection is also an implementation of Temporal Collection. A Bi-Temporal Collection keeps track of changes of an instance over time. Two kinds of time are involved. That is, the updated time and the effective time of the change, both times can be different. BiTemporalCollection Class
examples / usagesTemporal Property vs. Temporal Object If you want the underlying implementation tracks the changes of an instance at the property level but not at the object level, implement Temporal Property. Temporal Property
[1] addresses is a Single Temporal Property [2] names is another Single Temporal Property On the other hand, if the changes at the object level are to be stored in some sort of version history, implement Temporal Object. Temporal Object
[1] Temporal Collection is for storing version history of CustomerVersion When a class has a few properties that has temporal behavior and you want access to those temporal values, use Temporal Property. Whereas, if most of the properties of the class are temporal, use Temporal Object. references
0 Comments
Leave a Reply. |
Categories
All
Archives
May 2020
|