signaflo / java-timeseries

Time series analysis in Java
MIT License
197 stars 49 forks source link

The TimeUnit enum may be pointless #29

Open signaflo opened 5 years ago

signaflo commented 5 years ago

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.