use of org.jfree.data.time.Day in project nimbus by nimbus-org.
the class TimeSeriesCollectionFactoryService method addTimeSeries.
/**
* TimeSeriesに値を追加する。<p>
*
* @param series TimeSeries
* @param date 日付
* @param value 値
* @param periodType TimePeriodタイプ
* @param inOut メソッドコールの入出力で必要なデータを保持したクラス
* @return TimeSeries
*/
protected TimeSeries addTimeSeries(TimeSeries series, Date date, double value, int periodType, long period, Holder inOut, boolean isAddOrUpdate) {
switch(collateDataType) {
case COLLATE_DATA_TYPE_START:
case COLLATE_DATA_TYPE_END:
case COLLATE_DATA_TYPE_AVERAGE:
case COLLATE_DATA_TYPE_SUM:
date = createCollateDate(date, period);
break;
case COLLATE_DATA_TYPE_ALL:
case COLLATE_DATA_TYPE_OHLC:
default:
break;
}
RegularTimePeriod regTimePeriod = null;
switch(periodType) {
case PERIOD_MILLISECOND:
regTimePeriod = new Millisecond(date);
break;
case PERIOD_FIXEDMILLISECOND:
regTimePeriod = new FixedMillisecond(date);
break;
case PERIOD_SECOND:
regTimePeriod = new Second(date);
break;
case PERIOD_MINUTE:
regTimePeriod = new Minute(date);
break;
case PERIOD_HOUR:
regTimePeriod = new Hour(date);
break;
case PERIOD_DAY:
regTimePeriod = new Day(date);
break;
case PERIOD_WEEK:
regTimePeriod = new Week(date);
break;
case PERIOD_MONTH:
regTimePeriod = new Month(date);
break;
case PERIOD_QUARTER:
regTimePeriod = new Quarter(date);
break;
case PERIOD_YEAR:
regTimePeriod = new Year(date);
break;
default:
}
if (isAddOrUpdate) {
series.addOrUpdate(regTimePeriod, value);
} else {
series.add(regTimePeriod, value);
}
if (inOut.lastDate == null) {
inOut.lastDate = (Date) date.clone();
} else {
inOut.lastDate.setTime(date.getTime());
}
inOut.lastValue = value;
return series;
}
Aggregations