java-timeseries icon indicating copy to clipboard operation
java-timeseries copied to clipboard

The TimeUnit enum may be pointless

Open signaflo opened this issue 7 years ago • 0 comments

The TimeUnit enum is basically a wrapper around Java's native ChronoUnit enum, but it adds the concept of a Quarter and has two methods "frequencyPer(other time unit)" and "totalDuration()".

I'm beginning to think all of this should be moved to the TimePeriod class. The TimePeriod class should hold a reference to a TemporalUnit instead of a TimeUnit.

The TimePeriod class also has a frequencyPer(other time period) and totalSeconds() [Note that the totalDuration method in TimeUnit returns the duration in seconds, so its the same thing]. So at this point it appears the TimeUnit enum is basically just adding an unnecessary layer of redirection.

I'm going to remove it unless I get a compelling argument to keep it.

signaflo avatar Dec 23 '18 22:12 signaflo