It seems that the constructor Minute(Date time) in Minute.java has a bug similar to one described in a previous post concerning a constructor for the Week object. The Day constructor reads:
public Minute(Date time) {
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int min = calendar.get(Calendar.MINUTE);
this.minute = (hour*60)+min+1;
this.day = new Day(time);
}
Without using the statement "calendar.setTime(time);" after the Calendar object is instantiated the Minute object will be constructed referring to the current time as opposed to the argument time. I noticed this when attempting to add more than one minute object from the same day to a chart and received the error:
"TimeSeries.add(...): time period already exists."
Day constructor bug
Re: Day constructor bug
Oops, that topic should read 'Minute' constructor bug. My apologies.
Re: Minute constructor bug
Hi Barrie,
Thanks for the report...there's some cut and pasted code in the Hour, Minute and Second classes, and none of them have been thoroughly tested. I'll review them and apply the appropriate fix...
Regards,
DG.
Thanks for the report...there's some cut and pasted code in the Hour, Minute and Second classes, and none of them have been thoroughly tested. I'll review them and apply the appropriate fix...
Regards,
DG.