devtools
119684c9 - Avoid conflating concept of duration in `TimeRange` util class (#9325)

Commit
160 days ago
Avoid conflating concept of duration in `TimeRange` util class (#9325) `TimeRange` represents the range between two `start` and `end` times marked in microseconds (so a duration). However, it stored `start` and `end` as `Duration` as well, resulting in the existence of three durations which was a bit confusing as I worked to understand code using `TimeRange`. Beyond that, `TimeRange` was not immutable so had a concept of being "well formed" (or having both a start and end), resulting in multiple checks for that state and many not-null assertion operations. To maintain the intermediate status and also reduce the necessity of the not-null assertions, split out the intermediate state to a new `TimeRangeBuilder` class with a `build` method that consolidates the not-null assertions to that singular function.
Author
Parents
Loading